Re: [pysnmp-users] ObjectIdentity.resolveWithMib() fails to resolve instance indices with InetAddre
Brought to you by:
elie
From: <et...@gm...> - 2017-09-29 23:24:49
|
Hi Kim, Can you check out pysnmp master branch at GitHub please? There have been relevant changes lately. Let me know if it helps or not. Thanks! > On 29 Sep 2017, at 03:06, Eugene Kim <eug...@nt...> wrote: > > Greetings, > > While walking TCP-MIB::tcpConnectionTable, I noticed that their table > indices were left unresolved after calling resolveWithMib(); turning MIB > instrumentation debugging on revealed that the size constraint checks > were applied to the textual IP address value, and not to the raw > (4-byte) value. The problem does not occur for non-IP-address table > indices, such as ifIndex. > > To reproduce: > > from pysnmp.smi.rfc1902 import ObjectIdentity > from pysnmp.smi.builder import MibBuilder > from pysnmp.smi.compiler import addMibCompiler > from pysnmp.smi.view import MibViewController > from pysnmp.debug import Debug, setLogger > > builder = MibBuilder() > addMibCompiler(builder) > builder.loadModules('IF-MIB') > builder.loadModules('TCP-MIB') > view = MibViewController(builder) > > def doit(*poargs): > print(ObjectIdentity(*poargs).resolveWithMib(view).getMibSymbol()) > > setLogger(Debug('all')) > doit('.1.3.6.1.2.1.2.2.1.1.1') > doit('.1.3.6.1.2.1.6.19.1.7.1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629') > > > Returns: > > 2017-09-28 18:03:13,481 pysnmp: running pysnmp version 4.3.9 > 2017-09-28 18:03:13,481 pysnmp: debug category 'all' enabled > 2017-09-28 18:03:13,482 pysnmp: resolving .1.3.6.1.2.1.2.2.1.2.1 as > OID or label > 2017-09-28 18:03:13,482 pysnmp: indexMib: re-indexing MIB view > 2017-09-28 18:03:13,486 pysnmp: getNodeNameByOid: resolved > :1.3.6.1.2.1.2.2.1.2.1 -> ('iso', 'org', 'dod', 'internet', 'mgmt', > 'mib-2', 'interfaces', 'ifTable', 'ifEntry', 'ifDescr').1 > 2017-09-28 18:03:13,486 pysnmp: resolved ('.1.3.6.1.2.1.2.2.1.2.1',) > into prefix ObjectName('1.3.6.1.2.1.2.2.1.2') and suffix ObjectName('1') > 2017-09-28 18:03:13,486 pysnmp: getNodeNameByOid: resolved > :1.3.6.1.2.1.2.2.1.2 -> ('iso', 'org', 'dod', 'internet', 'mgmt', > 'mib-2', 'interfaces', 'ifTable', 'ifEntry', 'ifDescr').() > 2017-09-28 18:03:13,486 pysnmp: resolved prefix > ObjectName('1.3.6.1.2.1.2.2.1.2') into MIB node MibTableColumn((1, > 3, 6, 1, 2, 1, 2, 2, 1, 2), > DisplayString(subtypeSpec=ConstraintsIntersection(ValueSizeConstraint(0, > 65535), ValueSizeConstraint(0, 255), ValueSizeConstraint(0, 255)))) > 2017-09-28 18:03:13,486 pysnmp: getNodeNameByOid: resolved :(1, 3, > 6, 1, 2, 1, 2, 2, 1) -> ('iso', 'org', 'dod', 'internet', 'mgmt', > 'mib-2', 'interfaces', 'ifTable', 'ifEntry').() > 2017-09-28 18:03:13,487 pysnmp: resolved indices are > (InterfaceIndex(1),) > ('IF-MIB', 'ifDescr', (InterfaceIndex(1),)) > 2017-09-28 18:03:13,487 pysnmp: resolving > .1.3.6.1.2.1.6.19.1.7.1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629 > as OID or label > 2017-09-28 18:03:13,490 pysnmp: getNodeNameByOid: resolved > :1.3.6.1.2.1.6.19.1.7.1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629 > -> ('iso', 'org', 'dod', 'internet', 'mgmt', 'mib-2', 'tcp', > 'tcpConnectionTable', 'tcpConnectionEntry', > 'tcpConnectionState').1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629 > 2017-09-28 18:03:13,490 pysnmp: resolved > ('.1.3.6.1.2.1.6.19.1.7.1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629',) > into prefix ObjectName('1.3.6.1.2.1.6.19.1.7') and suffix > ObjectName('1.9.49.48.46.48.46.48.46.49.49.22.1.14.49.57.50.46.49.54.57.46.50.48.46.49.53.52.2629') > 2017-09-28 18:03:13,490 pysnmp: getNodeNameByOid: resolved > :1.3.6.1.2.1.6.19.1.7 -> ('iso', 'org', 'dod', 'internet', 'mgmt', > 'mib-2', 'tcp', 'tcpConnectionTable', 'tcpConnectionEntry', > 'tcpConnectionState').() > 2017-09-28 18:03:13,490 pysnmp: resolved prefix > ObjectName('1.3.6.1.2.1.6.19.1.7') into MIB node MibTableColumn((1, > 3, 6, 1, 2, 1, 6, 19, 1, 7), > Integer32(subtypeSpec=ConstraintsIntersection(ValueRangeConstraint(-2147483648, > 2147483647), ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, > 6, 7, 8, 9, 10, 11, 12))), NamedValues((('synReceived', 4), > ('established', 5), ('finWait2', 7), ('timeWait', 11), ('finWait1', > 6), ('lastAck', 9), ('closeWait', 8), ('deleteTCB', 12), ('closed', > 1), ('closing', 10), ('listen', 2), ('synSent', 3))))) > 2017-09-28 18:03:13,490 pysnmp: getNodeNameByOid: resolved :(1, 3, > 6, 1, 2, 1, 6, 19, 1) -> ('iso', 'org', 'dod', 'internet', 'mgmt', > 'mib-2', 'tcp', 'tcpConnectionTable', 'tcpConnectionEntry').() > 2017-09-28 18:03:13,491 pysnmp: error resolving table indices at > MibTableRow, (9, 49, 48, 46, 48, 46, 48, 46, 49, 49, 22, 1, 14, 49, > 57, 50, 46, 49, 54, 57, 46, 50, 48, 46, 49, 53, 52, 2629): > ConstraintsIntersection(ValueSizeConstraint(0, 65535), > ValueSizeConstraint(4, 4)) failed at: > ValueConstraintError("ValueSizeConstraint(4, 4) failed at: > ValueConstraintError('10.0.0.11',)",) at InetAddressIPv4 > 2017-09-28 18:03:13,491 pysnmp: resolved indices are ((9, 49, 48, > 46, 48, 46, 48, 46, 49, 49, 22, 1, 14, 49, 57, 50, 46, 49, 54, 57, > 46, 50, 48, 46, 49, 53, 52, 2629),) > ('TCP-MIB', 'tcpConnectionState', ((9, 49, 48, 46, 48, 46, 48, 46, > 49, 49, 22, 1, 14, 49, 57, 50, 46, 49, 54, 57, 46, 50, 48, 46, 49, > 53, 52, 2629),)) > > > Note how IF-MIB::ifDescr's instance index was resolved correctly to > (InterfaceIndex(1),), while TCP-MIB::tcpConnectionState's instance index > was left unresolved as ((9, 49, 48, 46, ...),). > > How can I fix or work around this issue? > > Cheers, > Eugene > ________________________________ > This email message is intended for the use of the person to whom it has been sent, and may contain information that is confidential or legally protected. If you are not the intended recipient or have received this message in error, you are not authorized to copy, distribute, or otherwise use this message or its attachments. Please notify the sender immediately by return e-mail and permanently delete this message and any attachments. NTT I3 makes no warranty that this email is error or virus free. Thank you. > ________________________________ > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users |