'__EXAMPLE-MIB', # table object exampleTable=MibTable((1, 3, 6, 6, 1)) .setMaxAccess('read-create'), # table row object, also carries references to table indices exampleTableEntry=MibTableRow((1, 3, 6, 6, 1, 5)) .setMaxAccess('read-create') .setIndexNames((0, '__EXAMPLE-MIB', 'exampleTableColumn1')), # table column: string index exampleTableColumn1=MibTableColumn((1, 3, 6, 6, 1, 5, 1), v2c.OctetString()) .setMaxAccess('read-create'), # table column: string value exampleTableColumn2=MibTableColumn((1, 3, 6, 6, 1, 5, 2), v2c.OctetString()) .setMaxAccess('read-create'), # table column: integer value with default exampleTableColumn3=MibTableColumn((1, 3, 6, 6, 1, 5, 3), v2c.Integer32(123)) .setMaxAccess('read-create'), # table column: row status exampleTableStatus=MibTableColumn((1, 3, 6, 6, 1, 5, 4), RowStatus('notExists')) .setMaxAccess('read-create') ) # --- end of custom SNMP table definition, empty table now exists --- # --- populate custom SNMP table with one row --- (exampleTableEntry, exampleTableColumn2, exampleTableColumn3, exampleTableStatus) = mibBuilder.importSymbols( '__EXAMPLE-MIB',
# PDU v1/v2c two-way proxy from pysnmp.proto import rfc1905, rfc3411, error from pysnmp.proto.api import v1, v2c from pysnmp import debug # 2.1.1 __v1ToV2ValueMap = { v1.Integer.tagSet: v2c.Integer32(), v1.OctetString.tagSet: v2c.OctetString(), v1.Null.tagSet: v2c.Null(), v1.ObjectIdentifier.tagSet: v2c.ObjectIdentifier(), v1.IpAddress.tagSet: v2c.IpAddress(), v1.Counter.tagSet: v2c.Counter32(), v1.Gauge.tagSet: v2c.Gauge32(), v1.TimeTicks.tagSet: v2c.TimeTicks(), v1.Opaque.tagSet: v2c.Opaque() } __v2ToV1ValueMap = { # XXX do not re-create same-type items? v2c.Integer32.tagSet: v1.Integer(), v2c.OctetString.tagSet: v1.OctetString(), v2c.Null.tagSet: v1.Null(), v2c.ObjectIdentifier.tagSet: v1.ObjectIdentifier(), v2c.IpAddress.tagSet: v1.IpAddress(), v2c.Counter32.tagSet: v1.Counter(), v2c.Gauge32.tagSet: v1.Gauge(), v2c.TimeTicks.tagSet: v1.TimeTicks(), v2c.Opaque.tagSet: v1.Opaque() }
###OID 0.16777252.324.0 class Answer_16777252_324_attempt_count(MibScalarInstance): def getValue(self, name, idx): try: return self.getSyntax().clone( redis_store.get('Answer_16777252_324_attempt_count')) except: return self.getSyntax().clone(0) mibBuilder.exportSymbols( '__MY_MIB', MibScalar((1, 3, 6, 1, 2, 1, 1, 1), v2c.OctetString()), AIR_hss_imsi_known_check_SQL_Fail((1, 3, 6, 1, 2, 1, 1, 1), (1, 0, 0, 0), v2c.Integer32()), AIR_hss_imsi_known_check_IMSI_unattached_w_SIM( (1, 3, 6, 1, 2, 1, 1, 1), (2, 0, 0, 0), v2c.Integer32()), AIR_hss_imsi_known_check_IMSI_Blocked((1, 3, 6, 1, 2, 1, 1, 1), (3, 0, 0, 0), v2c.Integer32()), AIR_hss_get_subscriber_data_v2_v2_IMSI_Blocked( (1, 3, 6, 1, 2, 1, 1, 1), (4, 0, 0, 0), v2c.Integer32()), AIR_general((1, 3, 6, 1, 2, 1, 1, 1), (5, 0, 0, 0), v2c.Integer32()), generate_avp_count((1, 3, 6, 1, 2, 1, 1, 1), (6, 0, 0, 0), v2c.Integer32()), generate_vendor_avp((1, 3, 6, 1, 2, 1, 1, 1), (7, 0, 0, 0), v2c.Integer32()), diameter_packet_count((1, 3, 6, 1, 2, 1, 1, 1), (8, 0, 0, 0), v2c.Integer32()), diameter_packet_decode_count((1, 3, 6, 1, 2, 1, 1, 1), (9, 0, 0, 0), v2c.Integer32()),
'__EXAMPLE-MIB', # table object exampleTable=MibTable((1, 3, 6, 6, 1)).setMaxAccess('readcreate'), # table row object, also carries references to table indices exampleTableEntry=MibTableRow( (1, 3, 6, 6, 1, 5)).setMaxAccess('readcreate').setIndexNames( (0, '__EXAMPLE-MIB', 'exampleTableColumn1')), # table column: string index exampleTableColumn1=MibTableColumn( (1, 3, 6, 6, 1, 5, 1), v2c.OctetString()).setMaxAccess('readcreate'), # table column: string value exampleTableColumn2=MibTableColumn( (1, 3, 6, 6, 1, 5, 2), v2c.OctetString()).setMaxAccess('readcreate'), # table column: integer value with default exampleTableColumn3=MibTableColumn( (1, 3, 6, 6, 1, 5, 3), v2c.Integer32(123)).setMaxAccess('readcreate'), # table column: row status exampleTableStatus=MibTableColumn( (1, 3, 6, 6, 1, 5, 4), RowStatus('notExists')).setMaxAccess('readcreate')) # --- end of custom SNMP table definition, empty table now exists --- # --- populate custom SNMP table with one row --- (exampleTableEntry, exampleTableColumn2, exampleTableColumn3, exampleTableStatus) = mibBuilder.importSymbols('__EXAMPLE-MIB', 'exampleTableEntry', 'exampleTableColumn2', 'exampleTableColumn3', 'exampleTableStatus')