[SNMP4J] set a tablerow
Stefan Sanner
gemoron at hotmail.de
Tue Mar 11 10:48:26 CET 2014
Hello everyone,
I have written a similar question around 2 weeks ago, but I couldn't make any progress.
I still try to add and modify rows in a table wich don't support the usage of TableUltils.createRow().
I looked for an example on how to add a row with snmp4j without using this function, but I couldn't find one.
Does anyone has an example on how to add a row?
I tried to code a low level API solution on the basis of http://www.webnms.com/snmp/help/snmpapi/snmpv3/table_handling/snmptables_addrow.html#Low
01> SNMPClient snmp = new SNMPClient("udp:"+ ip +"/161");
02>
03> VariableBinding[] bindings={new VariableBinding(new OID( WLAN_MAC_ACL + ".1." + String.valueOf(rowCount)),new OctetString(mac)),
04> new VariableBinding(new OID( WLAN_MAC_ACL + ".2." + String.valueOf(rowCount)),new Integer32(200000)),
05> new VariableBinding(new OID( WLAN_MAC_ACL + ".3." + String.valueOf(rowCount)),new Integer32(1))};
06>
07> snmp.getUSM().addUser(new OctetString(AccessName), new UsmUser(new OctetString(AccessName),AuthMD5.ID, new OctetString(AccessPassword),PrivDES.ID, new OctetString(AccessPassword)));
08>
09> ScopedPDU pdu = new ScopedPDU();
10> pdu.setType(ScopedPDU.SET);
11> for(int i = 0; i < Binding.length;i++)
12> pdu.add(Binding[i]);
13>
14> ResponseEvent response = snmp.send(pdu, getUserTarget(AccessName));
I try to send the content of the row within a single PDU. The return message shows:
01> 1.3.6.1.4.1.272.4.46.8.1.1.2 = 00:01:02:03:04:07
, but the table hasn't changed on the router.
Am I using the wrong approach or is setting a row without tableUtils.createRow() simply impossible?
This is the description of the table I need to modify http://system-update.eu/snmp_manager/brickmib_9_1/tables/wlanACLTable.html
Thanks,
Stefan
More information about the SNMP4J
mailing list