LLDP Discovery - LldpRemPortId convert to string when in HEX (#16438)

* Update discovery-protocols.inc.php

When using the LLDP-V2-MIB, the device may reply with lldpV2RemPortId as hexadecimal. To convert it to a string, this update checks if the lldpV2RemPortIdSubtype is '5' = "interfaceName(5)"; if so, the code removes the character ":" from the value of lldpV2RemPortId and tests if it is hexadecimal. If the test is positive, it translates it into a string.

* Update discovery-protocols.inc.php
Added lines 342 to 345 to convert the lldpRemPortId when is hex and lldpRemPortIdSutype is 5.

* Update discovery-protocols.inc.php
Importing lib StringHelpers.

* tabs + tests PANOS

---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
Luis Wolfarth
2024-09-26 15:39:25 -03:00
committed by GitHub
parent c4ca7acc4d
commit a6c195ee90
2 changed files with 187 additions and 1 deletions

View File

@@ -13942,7 +13942,7 @@
"active": 1,
"protocol": "lldp",
"remote_hostname": "acme-xxx-sr-001",
"remote_port": "31:30:47:45:32:2f:34:2f:30:2f:37 (32303a32383a33653a36653a65333a3131)",
"remote_port": "10GE2/4/0/7 (32303a32383a33653a36653a65333a3131)",
"remote_platform": null,
"remote_version": "Huawei Versatile Routing Platform Software\nVRP (R) software, Version 8.150 (CE12800 V200R002C50SPC800)\r\nCopyright (C) 2012-2017 Huawei Technologies Co., Ltd.\r\nHUAWEI CE12804S",
"ifAlias": "ethernet1/12",
@@ -13951,5 +13951,186 @@
}
]
}
},
"ports-stack": {
"discovery": {
"ports_stack": [
{
"high_ifIndex": 300000000,
"low_ifIndex": 300000001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 300000000,
"low_ifIndex": 300000002,
"ifStackStatus": "active"
},
{
"high_ifIndex": 300000000,
"low_ifIndex": 300000004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 300000000,
"low_ifIndex": 300000005,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000002,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000101,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000102,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000103,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000107,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000108,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000109,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000201,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000202,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000301,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000302,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000303,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000304,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000306,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000401,
"ifStackStatus": "active"
},
{
"high_ifIndex": 400000000,
"low_ifIndex": 400000501,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050030,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050035,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050060,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050070,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050075,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050121,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050200,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050220,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050251,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050255,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050290,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050300,
"ifStackStatus": "active"
},
{
"high_ifIndex": 500050000,
"low_ifIndex": 500050320,
"ifStackStatus": "active"
}
]
}
}
}