From ca7b78926feb63754f276ecac44ca7992e047d11 Mon Sep 17 00:00:00 2001 From: julmanglano Date: Mon, 4 May 2026 16:28:42 +0200 Subject: [PATCH 1/3] hp_procurve_show_lldp_info_remote-device_detail: tolerate empty values --- ...how_lldp_info_remote-device_detail.textfsm | 12 +- ...e_show_lldp_info_remote-device_detail2.raw | 117 ++++++++++++++++++ ...e_show_lldp_info_remote-device_detail2.yml | 62 ++++++++++ 3 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.raw create mode 100644 tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.yml diff --git a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm index 46ececcc4f..7922d39a54 100644 --- a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm +++ b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm @@ -22,13 +22,13 @@ LLDP ^\s+ChassisId\s+:\s${CHASSIS_ID}\s*$$ ^\s+PortType\s+:\s${PORT_TYPE}\s*$$ ^\s+PortId\s+:\s${NEIGHBOR_INTERFACE}\s*$$ - ^\s+SysName\s+:\s${NEIGHBOR_NAME}\s*$$ - ^\s+System\sDescr\s:\s${NEIGHBOR_DESCRIPTION}\s*$$ - ^\s+PortDescr\s+:\s${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$ + ^\s+SysName\s+:\s?${NEIGHBOR_NAME}\s*$$ + ^\s+System\sDescr\s:\s?${NEIGHBOR_DESCRIPTION}\s*$$ + ^\s+PortDescr\s+:\s?${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$ # Port VLAN ID - ^\s+Pvid\s+:\s${VLAN_ID}\s*$$ - ^\s+System\s+Capabilities\s+Supported\s+:\s${CAPABILITIES_SUPPORTED}\s*$$ - ^\s+System\s+Capabilities\s+Enabled\s+:\s${CAPABILITIES}\s*$$ + ^\s+Pvid\s+:\s?${VLAN_ID}\s*$$ + ^\s+System\s+Capabilities\s+Supported\s+:\s?${CAPABILITIES_SUPPORTED}\s*$$ + ^\s+System\s+Capabilities\s+Enabled\s+:\s?${CAPABILITIES}\s*$$ ^\s+Remote\s+Management\s+Address\s*$$ ^\s+Type.*$$ ^\s+Address\s:\s${MGMT_ADDRESS} diff --git a/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.raw b/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.raw new file mode 100644 index 0000000000..b736457772 --- /dev/null +++ b/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.raw @@ -0,0 +1,117 @@ + LLDP Remote Device Information Detail + + Local Port : A2 + ChassisType : mac-address + ChassisId : c025a5-aabb01 + PortType : mac-address + PortId : c0 25 a5 aa bb 01 + SysName : + System Descr : + PortDescr : + Pvid : + + System Capabilities Supported : + System Capabilities Enabled : + + Remote Management Address + + MED Information Detail + EndpointClass :Class1 + +------------------------------------------------------------------------------ + Local Port : A8 + ChassisType : mac-address + ChassisId : 20a6cd-aabb02 + PortType : mac-address + PortId : 20 a6 cd aa bb 02 + SysName : Generic-AP-1 + System Descr : ArubaOS (MODEL: 315), Version Aruba AP + PortDescr : bond0 + Pvid : 1 + + System Capabilities Supported : bridge, wlan-access-point + System Capabilities Enabled : wlan-access-point + + Remote Management Address + Type : ipv4 + Address : 192.0.2.41 + + Poe Plus Information Detail + + Poe Device Type : Type2 PD + Power Source : Only PSE + Power Priority : Unknown + PD Requested Power Value : 20.8 Watts + PSE Allocated Power Value : 20.8 Watts + +------------------------------------------------------------------------------ + Local Port : A9 + ChassisType : mac-address + ChassisId : bcd7a5-aabb03 + PortType : interface-name + PortId : 1/1/12 + SysName : SWITCH-1 + System Descr : Aruba JL817A RL.10.13.1060 + PortDescr : Switch-Generic-A9 + Pvid : 60 + + System Capabilities Supported : bridge, router + System Capabilities Enabled : bridge, router + + Remote Management Address + Type : ipv4 + Address : 192.0.2.12 + + Poe Plus Information Detail + + Poe Device Type : Type2 PSE + Power Source : Unknown + Power Priority : Unknown + PD Requested Power Value : 0.0 Watts + PSE Allocated Power Value : 0.0 Watts + +------------------------------------------------------------------------------ + Local Port : A17 + ChassisType : local + ChassisId : AC_AP_GenericLoc... + PortType : local + PortId : emac0 + SysName : Generic-AP-12 + System Descr : Cisco 1200 Series AP 12.01T1 + PortDescr : + Pvid : + + System Capabilities Supported : + System Capabilities Enabled : + + Remote Management Address + Type : ipv4 + Address : 192.0.2.11 + +------------------------------------------------------------------------------ + Local Port : D13 + ChassisType : mac-address + ChassisId : f061c0-aabb04 + PortType : mac-address + PortId : f0 61 c0 aa bb 04 + SysName : AP 07-01-04 + System Descr : ArubaOS (MODEL: 535), Version Aruba AP + PortDescr : eth0 + Pvid : 1 + + System Capabilities Supported : bridge, wlan-access-point + System Capabilities Enabled : wlan-access-point + + Remote Management Address + Type : ipv4 + Address : 192.0.2.222 + + Poe Plus Information Detail + + Poe Device Type : Type2 PD + Power Source : Only PSE + Power Priority : Unknown + PD Requested Power Value : 23.3 Watts + PSE Allocated Power Value : 23.3 Watts + +------------------------------------------------------------------------------ diff --git a/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.yml b/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.yml new file mode 100644 index 0000000000..f2e89d6c9e --- /dev/null +++ b/tests/hp_procurve/show_lldp_info_remote-device_detail/hp_procurve_show_lldp_info_remote-device_detail2.yml @@ -0,0 +1,62 @@ +--- +parsed_sample: + - capabilities: "" + capabilities_supported: "" + chassis_id: "c025a5-aabb01" + local_interface: "A2" + mgmt_address: "" + neighbor_chassis_type: "mac-address" + neighbor_description: "" + neighbor_interface: "c0 25 a5 aa bb 01" + neighbor_interface_description: "" + neighbor_name: "" + port_type: "mac-address" + vlan_id: "" + - capabilities: "wlan-access-point" + capabilities_supported: "bridge, wlan-access-point" + chassis_id: "20a6cd-aabb02" + local_interface: "A8" + mgmt_address: "192.0.2.41" + neighbor_chassis_type: "mac-address" + neighbor_description: "ArubaOS (MODEL: 315), Version Aruba AP" + neighbor_interface: "20 a6 cd aa bb 02" + neighbor_interface_description: "bond0" + neighbor_name: "Generic-AP-1" + port_type: "mac-address" + vlan_id: "1" + - capabilities: "bridge, router" + capabilities_supported: "bridge, router" + chassis_id: "bcd7a5-aabb03" + local_interface: "A9" + mgmt_address: "192.0.2.12" + neighbor_chassis_type: "mac-address" + neighbor_description: "Aruba JL817A RL.10.13.1060" + neighbor_interface: "1/1/12" + neighbor_interface_description: "Switch-Generic-A9" + neighbor_name: "SWITCH-1" + port_type: "interface-name" + vlan_id: "60" + - capabilities: "" + capabilities_supported: "" + chassis_id: "AC_AP_GenericLoc..." + local_interface: "A17" + mgmt_address: "192.0.2.11" + neighbor_chassis_type: "local" + neighbor_description: "Cisco 1200 Series AP 12.01T1" + neighbor_interface: "emac0" + neighbor_interface_description: "" + neighbor_name: "Generic-AP-12" + port_type: "local" + vlan_id: "" + - capabilities: "wlan-access-point" + capabilities_supported: "bridge, wlan-access-point" + chassis_id: "f061c0-aabb04" + local_interface: "D13" + mgmt_address: "192.0.2.222" + neighbor_chassis_type: "mac-address" + neighbor_description: "ArubaOS (MODEL: 535), Version Aruba AP" + neighbor_interface: "f0 61 c0 aa bb 04" + neighbor_interface_description: "eth0" + neighbor_name: "AP 07-01-04" + port_type: "mac-address" + vlan_id: "1" From 8945b00ea40965f7504fcd9e114e9ecf65ca463e Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Mon, 11 May 2026 20:12:10 -0400 Subject: [PATCH 2/3] Replace single non-optional spaces with \s+ --- ...show_lldp_info_remote-device_detail.textfsm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm index 7922d39a54..6de9cdacf6 100644 --- a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm +++ b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm @@ -13,17 +13,17 @@ Value MGMT_ADDRESS (\S+|.*?) Start ^\s*$$ - ^\s*LLDP\sRemote\sDevice\sInformation\sDetail -> LLDP + ^\s*LLDP\s+Remote\s+Device\s+Information\s+Detail -> LLDP ^. -> Error LLDP - ^\s+Local\sPort\s+:\s${LOCAL_INTERFACE}\s*$$ - ^\s+ChassisType\s+:\s${NEIGHBOR_CHASSIS_TYPE}\s*$$ - ^\s+ChassisId\s+:\s${CHASSIS_ID}\s*$$ - ^\s+PortType\s+:\s${PORT_TYPE}\s*$$ - ^\s+PortId\s+:\s${NEIGHBOR_INTERFACE}\s*$$ + ^\s+Local\s+Port\s+:\s+${LOCAL_INTERFACE}\s*$$ + ^\s+ChassisType\s+:\s+${NEIGHBOR_CHASSIS_TYPE}\s*$$ + ^\s+ChassisId\s+:\s+${CHASSIS_ID}\s*$$ + ^\s+PortType\s+:\s+${PORT_TYPE}\s*$$ + ^\s+PortId\s+:\s+${NEIGHBOR_INTERFACE}\s*$$ ^\s+SysName\s+:\s?${NEIGHBOR_NAME}\s*$$ - ^\s+System\sDescr\s:\s?${NEIGHBOR_DESCRIPTION}\s*$$ + ^\s+System\s+Descr\s+:\s?${NEIGHBOR_DESCRIPTION}\s*$$ ^\s+PortDescr\s+:\s?${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$ # Port VLAN ID ^\s+Pvid\s+:\s?${VLAN_ID}\s*$$ @@ -31,7 +31,7 @@ LLDP ^\s+System\s+Capabilities\s+Enabled\s+:\s?${CAPABILITIES}\s*$$ ^\s+Remote\s+Management\s+Address\s*$$ ^\s+Type.*$$ - ^\s+Address\s:\s${MGMT_ADDRESS} + ^\s+Address\s+:\s+${MGMT_ADDRESS} ^\s+Poe\s+Plus\s+Information\s+Detail\s*$$ ^\s+Poe\s+Device\s+Type.* ^\s+Power\s+Source.* @@ -41,7 +41,7 @@ LLDP ^\s+Requested\s+Power\s+Value.* ^\s+Actual\s+Power\s+Value.* ^\s+PSE\s+Allocated\s+Power\s+Value.* - ^\s+MED\sInformation\sDetail\s*$$ + ^\s+MED\s+Information\s+Detail\s*$$ ^\s+EndpointClass.* ^\s+Poe\s+Device\s+Type.* ^\s+Power\s+Requested.* From 58d0a6acb414f5b355f0af1653b30c03ca480b31 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Mon, 11 May 2026 20:14:18 -0400 Subject: [PATCH 3/3] Replace optional whitespace regex with \s* Instead of \s? we could use \s* to allow for zero or more (repeated) space capturing (in case the vendor output changes). --- ...curve_show_lldp_info_remote-device_detail.textfsm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm index 6de9cdacf6..517c50a67a 100644 --- a/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm +++ b/ntc_templates/templates/hp_procurve_show_lldp_info_remote-device_detail.textfsm @@ -22,13 +22,13 @@ LLDP ^\s+ChassisId\s+:\s+${CHASSIS_ID}\s*$$ ^\s+PortType\s+:\s+${PORT_TYPE}\s*$$ ^\s+PortId\s+:\s+${NEIGHBOR_INTERFACE}\s*$$ - ^\s+SysName\s+:\s?${NEIGHBOR_NAME}\s*$$ - ^\s+System\s+Descr\s+:\s?${NEIGHBOR_DESCRIPTION}\s*$$ - ^\s+PortDescr\s+:\s?${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$ + ^\s+SysName\s+:\s*${NEIGHBOR_NAME}\s*$$ + ^\s+System\s+Descr\s+:\s*${NEIGHBOR_DESCRIPTION}\s*$$ + ^\s+PortDescr\s+:\s*${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$ # Port VLAN ID - ^\s+Pvid\s+:\s?${VLAN_ID}\s*$$ - ^\s+System\s+Capabilities\s+Supported\s+:\s?${CAPABILITIES_SUPPORTED}\s*$$ - ^\s+System\s+Capabilities\s+Enabled\s+:\s?${CAPABILITIES}\s*$$ + ^\s+Pvid\s+:\s*${VLAN_ID}\s*$$ + ^\s+System\s+Capabilities\s+Supported\s+:\s*${CAPABILITIES_SUPPORTED}\s*$$ + ^\s+System\s+Capabilities\s+Enabled\s+:\s*${CAPABILITIES}\s*$$ ^\s+Remote\s+Management\s+Address\s*$$ ^\s+Type.*$$ ^\s+Address\s+:\s+${MGMT_ADDRESS}