def sset self oids oids is tuple that contains oid as tuple type of va

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def sset(self, *oids):
"""
oids is a tuple that contains (oid as tuple, type of value as string, value as string)
TYPE: one of i, u, t, a, o, s, x, d, b
i: INTEGER, u: unsigned INTEGER, t: TIMETICKS, a: IPADDRESS
o: OBJID, s: STRING, x: HEX STRING, d: DECIMAL STRING, b: BITS
U: unsigned int64, I: signed int64, F: float, D: double
"""
req = self._create_request(SNMP_MSG_SET)
for oid, _type, value in oids:
oid = mkoid(oid)
lib.snmp_add_var(req, oid, len(oid), _type, value)
response = netsnmp_pdu_p()
if lib.snmp_synch_response(self.sess, req, byref(response)) == 0:
result = dict(getResult(response.contents))
lib.snmp_free_pdu(response)
return result