diff --git a/includes/discovery/cisco-pw.inc.php b/includes/discovery/cisco-pw.inc.php index 5288cfe974..e150359f76 100644 --- a/includes/discovery/cisco-pw.inc.php +++ b/includes/discovery/cisco-pw.inc.php @@ -28,6 +28,12 @@ if (Config::get('enable_pseudowires') && $device['os_group'] == 'cisco') { // END [$cpw_remote_id] = explode(':', $pw['cpwVcMplsPeerLdpID']); + + if (\LibreNMS\Util\IPv4::isValid($cpw_remote_id)) { + //If cpwVcMplsPeerLdpID is in the IP form, then convert it to number to store it in DB to avoid failing + $cpw_remote_id = ip2long($cpw_remote_id); + } + $cpw_remote_device = dbFetchCell('SELECT device_id from ipv4_addresses AS A, ports AS I WHERE A.ipv4_address=? AND A.port_id=I.port_id', [$cpw_remote_id]); $if_id = dbFetchCell('SELECT port_id from ports WHERE `ifDescr`=? AND `device_id`=?', [$pw['cpwVcName'], $device['device_id']]); if (! empty($pws_db[$pw['cpwVcID']])) { diff --git a/tests/data/iosxr_asr9001.json b/tests/data/iosxr_asr9001.json index 33d65142a0..17f8fa1836 100644 --- a/tests/data/iosxr_asr9001.json +++ b/tests/data/iosxr_asr9001.json @@ -6737,8 +6737,8 @@ "ifName": "Null0", "portName": null, "ifIndex": 2, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7037,8 +7037,8 @@ "ifName": "dwdm0/0/0/0", "portName": null, "ifIndex": 10, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7137,8 +7137,8 @@ "ifName": "dwdm0/0/2/0", "portName": null, "ifIndex": 11, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7237,8 +7237,8 @@ "ifName": "dwdm0/0/0/1", "portName": null, "ifIndex": 12, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7337,8 +7337,8 @@ "ifName": "dwdm0/0/0/2", "portName": null, "ifIndex": 13, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7437,8 +7437,8 @@ "ifName": "dwdm0/0/2/1", "portName": null, "ifIndex": 14, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7537,8 +7537,8 @@ "ifName": "dwdm0/0/2/2", "portName": null, "ifIndex": 15, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7637,8 +7637,8 @@ "ifName": "dwdm0/0/0/3", "portName": null, "ifIndex": 16, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -7737,8 +7737,8 @@ "ifName": "dwdm0/0/2/3", "portName": null, "ifIndex": 17, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -10637,8 +10637,8 @@ "ifName": "Loopback0", "portName": null, "ifIndex": 54, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -10937,8 +10937,8 @@ "ifName": "Loopback10001", "portName": null, "ifIndex": 76, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -27489,5 +27489,33 @@ ] }, "poller": "matches discovery" + }, + "cisco-pw": { + "discovery": { + "pseudowires": [ + { + "peer_ldp_id": 183894018, + "cpwVcID": 111111, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "l3vpn:VC111111", + "ifIndex": 74 + }, + { + "peer_ldp_id": 183894018, + "cpwVcID": 123456, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "PBB-EDGE:BD-I-100001", + "ifIndex": null + } + ] + } } } diff --git a/tests/data/iosxr_asr9010.json b/tests/data/iosxr_asr9010.json index eb747abf8f..87050b6724 100644 --- a/tests/data/iosxr_asr9010.json +++ b/tests/data/iosxr_asr9010.json @@ -10037,8 +10037,8 @@ "ifName": "Null0", "portName": null, "ifIndex": 2, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -10437,8 +10437,8 @@ "ifName": "Loopback0", "portName": null, "ifIndex": 10, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -10537,8 +10537,8 @@ "ifName": "Loopback99", "portName": null, "ifIndex": 11, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -11137,8 +11137,8 @@ "ifName": "dwdm0/7/0/0", "portName": null, "ifIndex": 23, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -11237,8 +11237,8 @@ "ifName": "dwdm0/7/0/1", "portName": null, "ifIndex": 24, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -11337,8 +11337,8 @@ "ifName": "dwdm0/7/0/2", "portName": null, "ifIndex": 25, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -11437,8 +11437,8 @@ "ifName": "dwdm0/7/0/3", "portName": null, "ifIndex": 26, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -13837,8 +13837,8 @@ "ifName": "dwdm0/0/0/0", "portName": null, "ifIndex": 54, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -13937,8 +13937,8 @@ "ifName": "dwdm0/0/0/1", "portName": null, "ifIndex": 55, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -14037,8 +14037,8 @@ "ifName": "dwdm0/0/0/2", "portName": null, "ifIndex": 56, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -14137,8 +14137,8 @@ "ifName": "dwdm0/0/0/3", "portName": null, "ifIndex": 57, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -52118,5 +52118,270 @@ ] }, "poller": "matches discovery" + }, + "ports-stack": { + "discovery": { + "ports_stack": [ + { + "high_ifIndex": 31, + "low_ifIndex": 97, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 31, + "low_ifIndex": 98, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 31, + "low_ifIndex": 99, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 31, + "low_ifIndex": 100, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 91, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 102, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 104, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 110, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 113, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 120, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 129, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 32, + "low_ifIndex": 130, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 33, + "low_ifIndex": 112, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 33, + "low_ifIndex": 124, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 33, + "low_ifIndex": 125, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 34, + "low_ifIndex": 107, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 34, + "low_ifIndex": 109, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 36, + "low_ifIndex": 117, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 62, + "low_ifIndex": 126, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 62, + "low_ifIndex": 128, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 64, + "low_ifIndex": 87, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 64, + "low_ifIndex": 88, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 64, + "low_ifIndex": 89, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 64, + "low_ifIndex": 90, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 64, + "low_ifIndex": 131, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 65, + "low_ifIndex": 93, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 65, + "low_ifIndex": 94, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 65, + "low_ifIndex": 95, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 65, + "low_ifIndex": 96, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 65, + "low_ifIndex": 127, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 66, + "low_ifIndex": 116, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 81, + "low_ifIndex": 114, + "ifStackStatus": "active" + }, + { + "high_ifIndex": 81, + "low_ifIndex": 119, + "ifStackStatus": "active" + } + ] + } + }, + "cisco-pw": { + "discovery": { + "pseudowires": [ + { + "peer_ldp_id": 2147483647, + "cpwVcID": 50, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 51, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 52, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 53, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 100, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 101, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 102, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + }, + { + "peer_ldp_id": 2147483647, + "cpwVcID": 103, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "", + "ifIndex": null + } + ] + } } } diff --git a/tests/data/iosxr_asr9901.json b/tests/data/iosxr_asr9901.json index f4d409bf9f..e670df7a0a 100644 --- a/tests/data/iosxr_asr9901.json +++ b/tests/data/iosxr_asr9901.json @@ -5037,8 +5037,8 @@ "ifName": "Null0", "portName": null, "ifIndex": 2, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -9537,8 +9537,8 @@ "ifName": "Loopback0", "portName": null, "ifIndex": 54, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -9637,8 +9637,8 @@ "ifName": "Loopback10001", "portName": null, "ifIndex": 55, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -9837,8 +9837,8 @@ "ifName": "Bundle-Ether200", "portName": null, "ifIndex": 57, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "down", "ifOperStatus_prev": "down", @@ -9937,8 +9937,8 @@ "ifName": "Bundle-Ether200.2000", "portName": null, "ifIndex": 58, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "false", "ifOperStatus": "down", "ifOperStatus_prev": "down", @@ -29189,5 +29189,33 @@ ] }, "poller": "matches discovery" + }, + "cisco-pw": { + "discovery": { + "pseudowires": [ + { + "peer_ldp_id": 183894021, + "cpwVcID": 222222, + "cpwOid": 2147483647, + "pw_type": "ethernet", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "l3vpn:VC222222", + "ifIndex": 56 + }, + { + "peer_ldp_id": 183894018, + "cpwVcID": 234567, + "cpwOid": 2147483647, + "pw_type": "ethernetVPLS", + "pw_psntype": "mpls", + "pw_local_mtu": 0, + "pw_peer_mtu": 0, + "pw_descr": "PBB-EDGE:BD-I-100001", + "ifIndex": null + } + ] + } } }