Search in sources :

Example 1 with MockSnmpValueFactory

use of org.opennms.netmgt.snmp.mock.MockSnmpValueFactory in project opennms by OpenNMS.

the class TableStrategyTest method testPhydAddrFromValue.

public void testPhydAddrFromValue() {
    SnmpValueFactory valueFactory = new MockSnmpValueFactory();
    final byte[] ZERO_MAC = new byte[] { 0, 0, 0, 0, 0, 0 };
    SnmpValue value = valueFactory.getOctetString(ZERO_MAC);
    assertEquals("00:00:00:00:00:00", TableStrategy.getPhysAddrFromValue(value));
    final byte[] RANDOM_MAC = new byte[] { 11, 22, 33, 44, (byte) 255, 66 };
    value = valueFactory.getOctetString(RANDOM_MAC);
    assertEquals("0B:16:21:2C:FF:42", TableStrategy.getPhysAddrFromValue(value));
    final byte[] NOT_A_MAC = new byte[] { 11, 22, 33, 44, 55 };
    value = valueFactory.getOctetString(NOT_A_MAC);
    assertEquals(null, TableStrategy.getPhysAddrFromValue(value));
}
Also used : MockSnmpValueFactory(org.opennms.netmgt.snmp.mock.MockSnmpValueFactory) SnmpValueFactory(org.opennms.netmgt.snmp.SnmpValueFactory) SnmpValue(org.opennms.netmgt.snmp.SnmpValue) MockSnmpValueFactory(org.opennms.netmgt.snmp.mock.MockSnmpValueFactory)

Aggregations

SnmpValue (org.opennms.netmgt.snmp.SnmpValue)1 SnmpValueFactory (org.opennms.netmgt.snmp.SnmpValueFactory)1 MockSnmpValueFactory (org.opennms.netmgt.snmp.mock.MockSnmpValueFactory)1