Index: includes/defaults.inc.php =================================================================== --- includes/defaults.inc.php (revision 8038) +++ includes/defaults.inc.php (working copy) @@ -814,7 +814,8 @@ $config['discovery_modules']['junose-atm-vp'] = 1; $config['discovery_modules']['bgp-peers'] = 1; $config['discovery_modules']['mac-accounting'] = 1; -$config['discovery_modules']['cisco-vrf'] = 1; +$config['discovery_modules']['vrf'] = 1; +$config['discovery_modules']['cisco-vrf'] = 0; #$config['discovery_modules']['cisco-cef'] = 1; $config['discovery_modules']['sla'] = 1; $config['discovery_modules']['pseudowires'] = 1; Index: includes/discovery/vrf.inc.php =================================================================== --- includes/discovery/vrf.inc.php (revision 0) +++ includes/discovery/vrf.inc.php (revision 0) @@ -0,0 +1,60 @@ + NULL), 'ports', '`port_id` = ?', array($if)); + } + else + { + echo("."); + } + } +} + +foreach (dbFetchRows('SELECT * FROM vrfs WHERE device_id = ?', array($device['device_id'])) as $row) +{ + $vrf_id = $row['vrf_id']; + if (!$valid_vrf[$vrf_id]) + { + echo("-"); + dbDelete('vrfs', '`vrf_id` = ?', array($vrf_id)); + } + else + { + echo("."); + } +} + +unset($valid_vrf_if); +unset($valid_vrf); + +echo(PHP_EOL); + +//EOF Index: includes/discovery/vrf/mpls-vpn-mib.inc.php =================================================================== --- includes/discovery/vrf/mpls-vpn-mib.inc.php (revision 0) +++ includes/discovery/vrf/mpls-vpn-mib.inc.php (working copy) @@ -13,8 +13,6 @@ if ($config['enable_vrfs']) { - if ($device['os_group'] == "cisco" || $device['os'] == "junos" || $device['os'] == "ironware" || $device['os'] == "zxr10") - { unset($vrf_count); echo("VRFs : "); @@ -29,26 +27,13 @@ // Grab all the info first, then use it in the code. // It removes load on the device and makes things much faster - $rds = snmp_walk($device, "mplsL3VpnVrfRD", "-Osqn", "MPLS-L3VPN-STD-MIB", NULL); + $rds = snmp_walk($device, "mplsVpnVrfRouteDistinguisher", "-Osqn", "MPLS-VPN-MIB", NULL); + $vpnmib = "MPLS-VPN-MIB"; + $rds = str_replace(".1.3.6.1.3.118.1.2.2.1.3.", "", $rds); - if (empty($rds)) - { - $rds = snmp_walk($device, "mplsVpnVrfRouteDistinguisher", "-Osqn", "MPLS-VPN-MIB", NULL); - $vpnmib = "MPLS-VPN-MIB"; - $rds = str_replace(".1.3.6.1.3.118.1.2.2.1.3.", "", $rds); + $descrs_oid = ".1.3.6.1.3.118.1.2.2.1.2"; + $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2"; - $descrs_oid = ".1.3.6.1.3.118.1.2.2.1.2"; - $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2"; - } - else - { - $vpnmib = "MPLS-L3VPN-STD-MIB"; - $rds = str_replace(".1.3.6.1.2.1.10.166.11.1.2.2.1.4.", "", $rds); - - $descrs_oid = ".1.3.6.1.2.1.10.166.11.1.2.2.1.3"; - $ports_oid = ".1.3.6.1.2.1.10.166.11.1.2.1.1.2"; - } - print_debug("\n[DEBUG]\nUsing $vpnmib\n[/DEBUG]" . "\n[DEBUG OIDS]\n$rds\n[/DEBUG]"); @@ -123,45 +108,7 @@ } } - echo "\n"; - - foreach (dbFetchRows('SELECT * FROM ports WHERE device_id = ?', array($device['device_id'])) as $row) - { - $if = $row['port_id']; - $vrf_id = $row['ifVrf']; - if ($row['ifVrf']) - { - if (!$valid_vrf_if[$vrf_id][$if]) - { - echo("-"); - dbUpdate(array('ifVrf' => NULL), 'ports', '`port_id` = ?', array($if)); - } - else - { - echo("."); - } - } - } - - foreach (dbFetchRows('SELECT * FROM vrfs WHERE device_id = ?', array($device['device_id'])) as $row) - { - $vrf_id = $row['vrf_id']; - if (!$valid_vrf[$vrf_id]) - { - echo("-"); - dbDelete('vrfs', '`vrf_id` = ?', array($vrf_id)); - } - else - { - echo("."); - } - } - - unset($valid_vrf_if); - unset($valid_vrf); - echo(PHP_EOL); - } # cisco/junos/ironware } # enable_vrfs // EOF Index: includes/discovery/vrf/mpls-l3vpn-std-mib.inc.php =================================================================== --- includes/discovery/vrf/mpls-l3vpn-std-mib.inc.php (revision 0) +++ includes/discovery/vrf/mpls-l3vpn-std-mib.inc.php (working copy) @@ -13,8 +13,6 @@ if ($config['enable_vrfs']) { - if ($device['os_group'] == "cisco" || $device['os'] == "junos" || $device['os'] == "ironware" || $device['os'] == "zxr10") - { unset($vrf_count); echo("VRFs : "); @@ -30,25 +28,12 @@ // It removes load on the device and makes things much faster $rds = snmp_walk($device, "mplsL3VpnVrfRD", "-Osqn", "MPLS-L3VPN-STD-MIB", NULL); + $vpnmib = "MPLS-L3VPN-STD-MIB"; + $rds = str_replace(".1.3.6.1.2.1.10.166.11.1.2.2.1.4.", "", $rds); - if (empty($rds)) - { - $rds = snmp_walk($device, "mplsVpnVrfRouteDistinguisher", "-Osqn", "MPLS-VPN-MIB", NULL); - $vpnmib = "MPLS-VPN-MIB"; - $rds = str_replace(".1.3.6.1.3.118.1.2.2.1.3.", "", $rds); + $descrs_oid = ".1.3.6.1.2.1.10.166.11.1.2.2.1.3"; + $ports_oid = ".1.3.6.1.2.1.10.166.11.1.2.1.1.2"; - $descrs_oid = ".1.3.6.1.3.118.1.2.2.1.2"; - $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2"; - } - else - { - $vpnmib = "MPLS-L3VPN-STD-MIB"; - $rds = str_replace(".1.3.6.1.2.1.10.166.11.1.2.2.1.4.", "", $rds); - - $descrs_oid = ".1.3.6.1.2.1.10.166.11.1.2.2.1.3"; - $ports_oid = ".1.3.6.1.2.1.10.166.11.1.2.1.1.2"; - } - print_debug("\n[DEBUG]\nUsing $vpnmib\n[/DEBUG]" . "\n[DEBUG OIDS]\n$rds\n[/DEBUG]"); @@ -123,45 +108,7 @@ } } - echo "\n"; - - foreach (dbFetchRows('SELECT * FROM ports WHERE device_id = ?', array($device['device_id'])) as $row) - { - $if = $row['port_id']; - $vrf_id = $row['ifVrf']; - if ($row['ifVrf']) - { - if (!$valid_vrf_if[$vrf_id][$if]) - { - echo("-"); - dbUpdate(array('ifVrf' => NULL), 'ports', '`port_id` = ?', array($if)); - } - else - { - echo("."); - } - } - } - - foreach (dbFetchRows('SELECT * FROM vrfs WHERE device_id = ?', array($device['device_id'])) as $row) - { - $vrf_id = $row['vrf_id']; - if (!$valid_vrf[$vrf_id]) - { - echo("-"); - dbDelete('vrfs', '`vrf_id` = ?', array($vrf_id)); - } - else - { - echo("."); - } - } - - unset($valid_vrf_if); - unset($valid_vrf); - echo(PHP_EOL); - } # cisco/junos/ironware } # enable_vrfs // EOF Index: includes/discovery/vrf/cisco-vrf-mib.inc.php =================================================================== --- includes/discovery/vrf/cisco-vrf-mib.inc.php (revision 0) +++ includes/discovery/vrf/cisco-vrf-mib.inc.php (revision 0) @@ -0,0 +1,58 @@ + $int) +{ + //print_vars($int); + + $vrf_index = explode('.', $index); + $vrf_id = $vrf_index[0]; // VRF Index in cvVrfTable + $if_id = $vrf_index[1]; // ifIndex + $vrf_oid = $index; + $vrf_name = $vrfs[$vrf_id]['cvVrfName']; + + if (dbFetchCell('SELECT COUNT(*) FROM `vrfs` WHERE `device_id` = ? AND `vrf_oid` = ?', array($device['device_id'], $vrf_oid))) + { + $update_array = array('vrf_name' => $vrf_name); + dbUpdate($update_array, 'vrfs', '`device_id` = ? AND `vrf_oid` = ?', array($device['device_id'], $vrf_oid)); + } + else + { + $insert_array = array('device_id' => $device['device_id'], 'vrf_oid' => $vrf_oid, 'vrf_name' => $vrf_name); + dbInsert($insert_array, 'vrfs'); + } + + $vrf_id = dbFetchCell('SELECT `vrf_id` FROM `vrfs` WHERE `device_id` = ? AND `vrf_oid` = ?', array($device['device_id'], $vrf_oid)); + $valid_vrf[$vrf_id] = 1; + + $interface = dbFetchRow('SELECT `ifDescr`, `port_id` FROM `ports` WHERE `ifIndex` = ? AND `device_id` = ?', array($if_id, $device['device_id'])); + + echo(short_ifname($interface['ifDescr']) . " "); + + dbUpdate(array('ifVrf' => $vrf_id), 'ports', '`port_id` = ?', array($interface['port_id'])); + + $if = $interface['port_id']; + $valid_vrf_if[$vrf_id][$if] = 1; +} + +// EOF Index: includes/definitions/os.inc.php =================================================================== --- includes/definitions/os.inc.php (revision 8038) +++ includes/definitions/os.inc.php (working copy) @@ -164,6 +164,7 @@ $config['os_group'][$os_group]['mibs'][] = "POWER-ETHERNET-MIB"; $config['os_group'][$os_group]['mibs'][] = "MPLS-L3VPN-STD-MIB"; // VRF $config['os_group'][$os_group]['mibs'][] = "MPLS-VPN-MIB"; // VRF +$config['os_group'][$os_group]['mibs'][] = "CISCO-VRF-MIB"; // VRF $config['os_group'][$os_group]['mibs'][] = "SMON-MIB"; // Monitoring ([e|r]span) ports $config['os_group'][$os_group]['mibs'][] = "CISCO-TRUSTSEC-INTERFACE-MIB"; // TrustSec port status $config['os_group'][$os_group]['mibs'][] = "CISCO-IETF-IP-MIB"; // IPv6 addresses Index: includes/definitions/mibs.inc.php =================================================================== --- includes/definitions/mibs.inc.php (revision 8038) +++ includes/definitions/mibs.inc.php (working copy) @@ -511,6 +511,12 @@ $config['mibs'][$mib]['mib_dir'] = 'cisco'; $config['mibs'][$mib]['descr'] = ''; +$mib = 'CISCO-VRF-MIB'; +$config['mibs'][$mib]['enable'] = 1; +$config['mibs'][$mib]['identity_num'] = '.1.3.6.1.4.1.9.9.711'; +$config['mibs'][$mib]['mib_dir'] = 'cisco'; +$config['mibs'][$mib]['descr'] = ''; + $mib = 'CISCO-RTTMON-MIB'; $config['mibs'][$mib]['enable'] = 1; $config['mibs'][$mib]['identity_num'] = '.1.3.6.1.4.1.9.9.42';