Search in sources :

Example 1 with SnmpStore

use of org.opennms.netmgt.snmp.SnmpStore in project opennms by OpenNMS.

the class SnmpStoreTest method testStoreResultWithValueThenEndOfMibView.

public void testStoreResultWithValueThenEndOfMibView() {
    String baseOid = ".1.3.6.1.2.1.31.1.1.1.18";
    String ifAliasName = "ifAlias";
    String ifAliasValue = "Foo!";
    SnmpStore store = new SnmpStore(new NamedSnmpVar[] { new NamedSnmpVar(NamedSnmpVar.SNMPOCTETSTRING, ifAliasName, baseOid, 18) });
    SnmpObjId base = SnmpObjId.get(baseOid);
    SnmpInstId inst = new SnmpInstId("1");
    store.storeResult(new SnmpResult(base, inst, SnmpUtils.getValueFactory().getOctetString(ifAliasValue.getBytes())));
    store.storeResult(new SnmpResult(base, inst, SnmpUtils.getValueFactory().getValue(SnmpValue.SNMP_END_OF_MIB, null)));
    assertEquals("ifAlias value", ifAliasValue, store.getDisplayString(ifAliasName));
}
Also used : NamedSnmpVar(org.opennms.netmgt.snmp.NamedSnmpVar) SnmpInstId(org.opennms.netmgt.snmp.SnmpInstId) SnmpObjId(org.opennms.netmgt.snmp.SnmpObjId) SnmpStore(org.opennms.netmgt.snmp.SnmpStore) SnmpResult(org.opennms.netmgt.snmp.SnmpResult)

Aggregations

NamedSnmpVar (org.opennms.netmgt.snmp.NamedSnmpVar)1 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)1 SnmpObjId (org.opennms.netmgt.snmp.SnmpObjId)1 SnmpResult (org.opennms.netmgt.snmp.SnmpResult)1 SnmpStore (org.opennms.netmgt.snmp.SnmpStore)1