Make IPv6 discovery work on JunOS

Although JunOS populates ipAddressIfIndex.ipv6, it does not add prefix lengths or other metadata. This means that IPv6 discovery fails.

This change removes OIDs from the list when there is incomplete data. If the list is empty after IP-MIB is walked, it then tries IPv6 MIB.

It's not a great fix, but I'm not confident I can fix the underlying issue without a complete re-write of this module.
This commit is contained in:
Adam Bishop
2020-06-15 01:29:02 +01:00
committed by GitHub
parent 200a39a4b0
commit 42d7fae9aa

View File

@@ -41,13 +41,18 @@ foreach ($vrfs_lite_cisco as $vrf) {
$ipv6_prefixlen = explode('.', $ipv6_prefixlen);
$ipv6_prefixlen = str_replace('"', '', end($ipv6_prefixlen));
if (Str::contains($ipv6_prefixlen, 'SNMPv2-SMI::zeroDotZero')) {
d_echo('Incomplete IPv6 data in IF-MIB');
$oids = trim(Str::replaceFirst($data, '', $oids));
}
$ipv6_origin = snmp_get($device, ".1.3.6.1.2.1.4.34.1.6.2.16.$oid", '-Ovq', 'IP-MIB');
discover_process_ipv6($valid, $ifIndex, $ipv6_address, $ipv6_prefixlen, $ipv6_origin, $device['context_name']);
} //end if
} //end foreach
if (!$oids) {
if (empty($oids)) {
$oids = snmp_walk($device, 'ipv6AddrPfxLength', ['-OsqnU', '-Ln'], 'IPV6-MIB');
$oids = str_replace('.1.3.6.1.2.1.55.1.8.1.2.', '', $oids);
$oids = str_replace('"', '', $oids);