bug - Fixing 'cisco-pw' cpwVcMplsPeerLdpID (#16268)

* fix for cpwVcMplsPeerLdpID in IP form

* tests
This commit is contained in:
PipoCanaja
2024-08-03 19:57:33 +02:00
committed by GitHub
parent 549741d31e
commit d1ee543b6b
4 changed files with 381 additions and 54 deletions

View File

@@ -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']])) {