Dear Mr. Morten,
Is it possible to ignore this negative ifIndex values and focusing on ifIndex, IfDescription, IfName, IfAlias, , IfSpeed, IfHighSpeed, IfHwAddr, and IfIP ?
I tried using PRTG and LibreNMS, both are able to show all GPON Ports on Huawei OLTs like cacti does.
Agungreza NCSIRT DIVISION
PT MORA TELEMATIKA INDONESIA Grha 9, Jalan Panataran No.9 Proklamasi Jakarta Pusat 10320, Indonesia Office : +62-21 31998600 | Fax : +62-21 3142882 | Email: ncsirt@moratelindo.co.id
-----Original Message----- From: Morten Brekkevold morten.brekkevold@uninett.no Sent: 04 March 2020 21:47 To: Agung Reza Satria agung.reza@moratelindo.co.id Cc: nav-users@uninett.no Subject: Re: GPON port didn't shows up
On Wed, 4 Mar 2020 08:46:36 +0700 "Agung Reza Satria" agung.reza@moratelindo.co.id wrote:
I have tried it and here is the result that I found for negative index value on Huawei GPON:
[snip]
- Index found at OID: 'ifIndex.4194304000' value: '-100663296'
- Index found at OID: 'ifIndex.4194304256' value: '-100663040'
- Index found at OID: 'ifIndex.4194304512' value: '-100662784'
This is a problem with the SNMP implementation on your Huawei device. I can't say for sure this is the exact problem that causes NAV to ignore the ports, but it certainly causes a problem for the SNMP library on your computer, and for Cacti, it appears.
The spec for ifIndex says:
| IF-MIB::ifIndex | ifIndex OBJECT-TYPE | -- FROM IF-MIB, RFC1213-MIB, RFC1158-MIB | -- TEXTUAL CONVENTION InterfaceIndex | SYNTAX Integer32 (1..2147483647) | DISPLAY-HINT "d" | MAX-ACCESS read-only | STATUS current | DESCRIPTION "A unique value, greater than zero, for each interface. It | is recommended that values are assigned contiguously | starting from 1. The value for each interface sub-layer | must remain constant at least from one re-initialization of | the entity's network management system to the next re- | initialization." | ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) interfaces(2) | ifTable(2) ifEntry(1) 1 }
Note the SYNTAX clause: Integer32 (1..2147483647). Your Huawei device seems to use ifIndex values that are out of bounds, according to the spec. It seems your SNMP library tries to interpret an ifIndex number as a signed integer, which causes the resulting value to wrap around and become a negative number, e.g. (using Python):
import struct struct.unpack("i", struct.pack("I", 4194304000))
(-100663296,)
This may wreac havoc in code trying to correlate information from different MIB objects. In one object, it might find the literal value 4194304000, which it then is unable to correlate to the value -100663296, which it "got" from the IF-MIB.
It sounds to me like Huawei's implementation is broken and needs to be fixed, and that you may have just been lucky that Cacti coincidentally works for you. You cannot be guaranteed that any other SNMP-based NMS that follows the spec will actually work properly with these devices.
To figure out what actually happens inside NAV when it talks to your Huawei devices, you would need to switch on debug logging in parts of ipdevpoll. However, if the problem occurs within the low-level SNMP library, I cannot promise you a workaround in NAV at all. You should really report a bug with Huawei, IMNSHO.
-- sincerely, Morten Brekkevold Uninett