Issue with final test for adding support for new OS (GE MDS)

Hey!

I’m having some issues with the final test after adding support for a new os (GE MDS). I have added the Mibs, added icon and logo, added the definitions and discovery yaml files.

My device is now showing up with logo, correct hardware info and temprature and PSU voltage is working perfectly.

My first issue is when I run the “save-test-data.php” script the output does not contain things like sysname, version, hardware, and serial.

The other problem is when running “lnms dev:check unit -o gemds”
I get this error

[email protected]:~$ lnms dev:check unit -o gemds
Only checking os: gemds
Running unit check... 
Starting snmpsim listening on 127.1.6.2:1162... 
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

Error in bootstrap script: PDOException:
SQLSTATE[HY000] [1045] Access denied for user 'librenms'@'localhost' (using password: YES)
failed (6.21s)

My definition file:

[email protected]:~$ cd includes/definitions/
[email protected]:~/includes/definitions$ cat gemds.yaml 
os: gemds
text: GE MDS Orbit network Operating System
type: network
icon: ge
mib_dir: gemds

discovery:
    - sysObjectID: .1.3.6.1.4.1.4130.10

My discovery file:

[email protected]:~/includes/definitions/discovery$ cat gemds.yaml
mib: MDS-SYSTEM-MIB
modules:
    os:
        hardware: MDS-SYSTEM-MIB::mSysProductConfiguration.0
        serial: MDS-SYSTEM-MIB::mSysSerialNumberPlatform.0
        version: MDS-SYSTEM-MIB::mSysVersion.2

    sensors:
        voltage:
            data:
                -
                    oid: mSysPowerSupplyVoltage
                    num_oid: '.1.3.6.1.4.1.4130.10.1.1.1.2.9.{{ $index }}'
                    index: 'mSysTemperature.{{ $index }}'
                    descr: 'DC input voltage'
                    devisor: 1
                -
        temperature:
            data:
                -
                    oid: mSysTemperature
                    num_oid: '.1.3.6.1.4.1.4130.10.1.1.1.2.6.{{ $index }}'
                    index: 'mSysTemperature.{{ $index }}'
                    descr: 'System Temperature'
                    divisor: 1

lnms dev:simulate passes without any issues:
OK (3 tests, 695 assertions)
success (1.11s)

My ./validate.php

[email protected]:~$ ./validate.php 
====================================
Component | Version
--------- | -------
LibreNMS  | 21.4.0-59-gbb39b4ad8
DB Schema | 2021_04_08_151101_add_foreign_keys_to_port_group_port_table (208)
PHP       | 7.4.3
Python    | 3.8.5
MySQL     | 10.3.25-MariaDB-0ubuntu0.20.04.1
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.8
====================================

[OK]    Composer Version: 2.0.13
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  Your local git contains modified files, this could prevent automatic updates.
	[FIX]: 
	You can fix this with ./scripts/github-remove
	Modified Files:
	 html/images/os/ge.svg

Fix this issue by setting up test user in the .env file.

Example:

APP_KEY=base64:wGA0vt5fktmlbxYPWURj1LUqSk54QXBWGA/Wwctvrd4=
DB_HOST=localhost
DB_DATABASE=librenms
DB_USERNAME=librenms
DB_PASSWORD=D42nf23rewD

#APP_URL=
NODE_ID=602f36c01e6f0
DB_HOST=localhost
DB_DATABASE=librenms
DB_USER=localhost
DB_PASSWORD=D42nf23rewD
LIBRENMS_USER=librenms
APP_URL=/


#Testing
DB_TEST_HOST=localhost
DB_TEST_DATABASE=librenms_phpunit_78hunjuybybh
DB_TEST_USERNAME=librenms
DB_TEST_PASSWORD=D42nf23rewD
[email protected]:~$ 

The data is for a lab environment so it’s not sensitive.

Now the test runs but it fails with one Failure.

[modules.sensors.voltage.data[1]] NULL value found, but an object is required
Failed asserting that false is true.

[email protected]:~$ lnms dev:check unit -o gemds
Only checking os: gemds
Running unit check... 
Starting snmpsim listening on 127.1.6.2:1162... 
Refreshing database...done
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

...SNMP['/usr/bin/snmpget' '-v2c' '-c' 'gemds_mxncl4ene4sn1s1e6dcnn' '-Ovq' '-M' '/opt/librenms/mibs' 'udp:127.1.6.2:1162' 'SNMPv2-MIB::sysDescr.0']
SNMP['/usr/bin/snmpget' '-v2c' '-c' 'gemds_mxncl4ene4sn1s1e6dcnn' '-Ovqn' '-M' '/opt/librenms/mibs' 'udp:127.1.6.2:1162' 'SNMPv2-MIB::sysObjectID.0']
SNMP['/usr/bin/snmpget' '-v2c' '-c' 'gemds_mxncl4ene4sn1s1e6dcnn' '-Oqv' '-m' 'SNMPv2-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/gemds' 'udp:127.1.6.2:1162' 'sysName.0']
.....F                                                           9 / 9 (100%)

Time: 00:02.511, Memory: 88.50 MB

There was 1 failure:

1) LibreNMS\Tests\YamlSchemaTest::testDiscoveryDefinitionSchema
gemds.yaml does not validate. Violations:
[modules.sensors.voltage.data[1]] NULL value found, but an object is required

Failed asserting that false is true.

/opt/librenms/tests/YamlSchemaTest.php:148
/opt/librenms/tests/YamlSchemaTest.php:81
/opt/librenms/tests/YamlSchemaTest.php:75

FAILURES!
Tests: 9, Assertions: 2051, Failures: 1.
failed (14.94s)

Mib:

MDS-SYSTEM-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-IDENTITY, 
    OBJECT-TYPE, 
    Integer32,
    Unsigned32
        FROM SNMPv2-SMI
    TEXTUAL-CONVENTION,
    TruthValue,DateAndTime
        FROM SNMPv2-TC
    MODULE-COMPLIANCE, 
    OBJECT-GROUP
        FROM SNMPv2-CONF
    mdsSystem
        FROM MDS-ORBIT-SMI-MIB;

mdsSystemMIB MODULE-IDENTITY
    LAST-UPDATED "201805160000Z" -- May 16, 2018
    ORGANIZATION 
        "GE MDS LLC
        http://www.gemds.com"
    CONTACT-INFO
        "T 1-800-474-0694 (Toll Free in North America)
         T 585-242-9600
         F 585-242-9620

         175 Science Parkway
         Rochester, New York 14620
         USA"
    DESCRIPTION
        "The MIB module to describe the system."
	REVISION      "201911180000Z"
    DESCRIPTION
        "Added boot and current time."
    REVISION      "201805160000Z"
    DESCRIPTION
        "Updated conformance statments based on smilint."
    REVISION      "201402100000Z"
    DESCRIPTION
        "Initial version."
    ::= { mdsSystem 1 }

mSysMIBObjects OBJECT IDENTIFIER
    ::= { mdsSystemMIB 1 }

mSysConfig OBJECT IDENTIFIER
    ::= { mSysMIBObjects 1 }

mSysStatus OBJECT IDENTIFIER
    ::= { mSysMIBObjects 2 }

-- Textual Conventions
FirmwareLocation ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "d"
    STATUS      current
    DESCRIPTION "FirmwareLocation"
    SYNTAX      Unsigned32 (0 .. 255)

-- System Status Objects
mSysSerialNumberCore OBJECT-TYPE
    SYNTAX      Unsigned32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Core board serial number."
    ::= { mSysStatus 1 }

mSysSerialNumberPlatform OBJECT-TYPE
    SYNTAX      Unsigned32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Platform board serial number."
    ::= { mSysStatus 2 }

mSysProductConfiguration OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Product configuration."
    ::= { mSysStatus 3 }

mSysGuid OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "GUID of the unit."
    ::= { mSysStatus 4 }

mSysUptime OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "System uptime (in secs) since bootup."
    ::= { mSysStatus 5 }

mSysTemperature OBJECT-TYPE
    SYNTAX      Integer32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "System temperature (in Celsius)."
    ::= { mSysStatus 6 }

mSysFirmwareVersionTable OBJECT-TYPE
    SYNTAX      SEQUENCE OF MSysFirmwareVersionEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
        "This table contains status of system firmware."
    ::= { mSysStatus 7 }

mSysPowerSupplyVoltage OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Power Supply Voltage (in VDC)."
    ::= { mSysStatus 9 }

mSysCurrentDateTime OBJECT-TYPE
    SYNTAX      DateAndTime
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Current system date and time."
    ::= { mSysStatus 10 }

mSysBootDateTime OBJECT-TYPE
    SYNTAX      DateAndTime
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "system date and time on boot."
    ::= { mSysStatus 11 }

mSysFirmwareVersionEntry OBJECT-TYPE
    SYNTAX      MSysFirmwareVersionEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
            "Each entry contains information about the stored firmware image."
    INDEX   { mSysLocation }
    ::= { mSysFirmwareVersionTable 1 }

MSysFirmwareVersionEntry ::=
    SEQUENCE {
        mSysLocation FirmwareLocation,
        mSysVersion OCTET STRING,
        mSysActive TruthValue
    }

mSysLocation OBJECT-TYPE
    SYNTAX      FirmwareLocation
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
            "Firmware location."
    ::= { mSysFirmwareVersionEntry 1 }

mSysVersion OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Firmware version."
    ::= { mSysFirmwareVersionEntry 2 }

mSysActive OBJECT-TYPE
    SYNTAX      TruthValue
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Firmware state."
    ::= { mSysFirmwareVersionEntry 3 }

mSysAutoUpdateState OBJECT-TYPE
    SYNTAX      Unsigned32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Current state of the auto-update daemon."
    ::= { mSysStatus 12 }

mSysAutoUpdateDetails OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "Detailed information on auto-update state."
    ::= { mSysStatus 13 }

-- OIDs in the mSysMprStatus subtree only exists on MPR devices.
mSysMprStatus OBJECT IDENTIFIER
    ::= { mSysStatus 8 }

mSysMprHeatsinkTemperature1 OBJECT-TYPE
    SYNTAX      Integer32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "The current heatsink #1 temperature in degrees Celsius."
    ::= { mSysMprStatus 1 }

mSysMprHeatsinkTemperature2 OBJECT-TYPE
    SYNTAX      Integer32
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "The current heatsink #2 temperature in degrees Celsius."
    ::= { mSysMprStatus 2 }

mSysMprPowerSupplyVoltage1 OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "The current output voltage of power supply #1."
    ::= { mSysMprStatus 3 }

mSysMprPowerSupplyVoltage2 OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "The current output voltage of power supply #2."
    ::= { mSysMprStatus 4 }

mSysMprRelaySwitchPosition OBJECT-TYPE
    SYNTAX      OCTET STRING
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION "The current state of the manual override switch on the relay card."
    ::= { mSysMprStatus 5 }

-- conformance information
mdsSysMIBConformance   OBJECT IDENTIFIER ::= { mdsSystemMIB 3 }
mdsSysMIBCompliances OBJECT IDENTIFIER ::= { mdsSysMIBConformance 1 }
mdsSysMIBGroups      OBJECT IDENTIFIER ::= { mdsSysMIBConformance 2 }

-- compliance statements
mSysCompliance MODULE-COMPLIANCE
    STATUS  current
    DESCRIPTION
            "The compliance statement for SNMP entities that 
            implement the MDS-SYSTEM-MIB."
    MODULE  -- this module
        MANDATORY-GROUPS {
            mSysStatusGroup
        }
        GROUP  mSysMprStatusGroup
        DESCRIPTION
            "This group is for SNMP entities that
            support Orbit MPR status."

    ::= { mdsSysMIBCompliances 1 }

-- units of conformance
mSysStatusGroup OBJECT-GROUP
    OBJECTS {
        mSysSerialNumberCore,
        mSysSerialNumberPlatform,
        mSysProductConfiguration,
        mSysGuid,
        mSysUptime,
        mSysTemperature,
        mSysPowerSupplyVoltage,
        mSysLocation,
        mSysVersion,
        mSysActive
    }
    STATUS  current
    DESCRIPTION
        "A collection of objects providing information about
        Orbit system status."
    ::= { mdsSysMIBGroups 1 }

mSysMprStatusGroup OBJECT-GROUP
    OBJECTS {
        mSysMprHeatsinkTemperature1,
        mSysMprHeatsinkTemperature2,
        mSysMprPowerSupplyVoltage1,
        mSysMprPowerSupplyVoltage2,
        mSysMprRelaySwitchPosition
    }
    STATUS  current
    DESCRIPTION
        "A collection of objects providing information about
        Orbit MPR system status."
    ::= { mdsSysMIBGroups 2 }

END

I’ll recommend you Submit a draft pull request on github, it’s easier to help there