From 1728b8562e3ea209e7d4eea070fcdfb3479648d4 Mon Sep 17 00:00:00 2001 From: sliddjur Date: Tue, 5 May 2020 20:11:36 +0200 Subject: [PATCH 1/2] HP Procurve show lldp info remote device --- ...curve_show_lldp_info_remote-device.textfsm | 20 +++++++++ templates/index | 1 + ..._procurve_show_lldp_info_remote-device.raw | 14 +++++++ ..._procurve_show_lldp_info_remote-device.yml | 42 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 templates/hp_procurve_show_lldp_info_remote-device.textfsm create mode 100644 tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.raw create mode 100644 tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.yml diff --git a/templates/hp_procurve_show_lldp_info_remote-device.textfsm b/templates/hp_procurve_show_lldp_info_remote-device.textfsm new file mode 100644 index 0000000000..0b2b67c436 --- /dev/null +++ b/templates/hp_procurve_show_lldp_info_remote-device.textfsm @@ -0,0 +1,20 @@ +Value Required LOCAL_PORT (\S+) +Value NEIGHBOR_CHASSIS_ID ((?:[a-z0-9]{2}\s){5}[a-z0-9]{2}|\S+) +Value NEIGHBOR_PORTID ((?:[a-z0-9]{2}\s){5}[a-z0-9]{2}|\S+) +Value NEIGHBOR_DESCR (\S+|.*?) +Value NEIGHBOR_SYSNAME (\S+) + +Start + ^\s*LLDP\sRemote\sDevices\sInformation\s*$$ + ^\s+LocalPort\s|\sChassisId.*$$ + ^\s+-.* -> LLDP + ^\s*$$ + ^.* -> Error + +LLDP + ^\s+${LOCAL_PORT}\s+\|\s${NEIGHBOR_CHASSIS_ID}\s+${NEIGHBOR_PORTID}\s*$$ -> Record + ^\s+${LOCAL_PORT}\s+\|\s${NEIGHBOR_CHASSIS_ID}\s+${NEIGHBOR_PORTID}\s+${NEIGHBOR_SYSNAME}\s*$$ -> Record + ^\s+${LOCAL_PORT}\s+\|\s${NEIGHBOR_CHASSIS_ID}\s+${NEIGHBOR_PORTID}\s+${NEIGHBOR_DESCR}\s+${NEIGHBOR_SYSNAME}\s*$$ -> Record + ^\S+\#\s*$$ + ^\s*$$ + ^. -> Error diff --git a/templates/index b/templates/index index 3d81e76da1..cbfad0fafb 100644 --- a/templates/index +++ b/templates/index @@ -347,6 +347,7 @@ hp_comware_display_vlan_brief.textfsm, .*, hp_comware, di[[splay]] v[[lan]] b[[r hp_comware_display_clock.textfsm, .*, hp_comware, di[[splay]] clo[[ck]] hp_comware_display_arp.textfsm, .*, hp_comware, di[[splay]] a[[rp]] +hp_procurve_show_lldp_info_remote-device.textfsm, .*, hp_procurve, sh[[ow]] ll[[dp]] i[[nfo]] r[[emote-device]] hp_procurve_show_tech_buffers.textfsm, .*, hp_procurve, sh[[ow]] tec[[h]] buf[[ffers]] hp_procurve_show_mac-address.textfsm, .*, hp_procurve, sh[[ow]] mac-a[[ddress]] hp_procurve_show_system.textfsm, .*, hp_procurve, sh[[ow]] syst[[em]] diff --git a/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.raw b/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.raw new file mode 100644 index 0000000000..e0177c19c3 --- /dev/null +++ b/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.raw @@ -0,0 +1,14 @@ + + LLDP Remote Devices Information + + LocalPort | ChassisId PortId PortDescr SysName + --------- + ------------------ ------------------ --------- ------------------ + 1 | 3821c7-c1cd00 1 1 65432p-swi006-g... + 3 | 3ce1a1-2218f0 3c e1 a1 22 18 f0 + 7 | bcf310-1f8b40 mgt0 AH-cust-AP21 + 25 | d8cb8a-6d303c d8 cb 8a 6d 30 3c + 29 | 484d7e-e66c42 48 4d 7e e6 6c 42 + 36 | 603197-7aa548 1 UPLINK NAP203 + 37 | b00cd1-359a98 b0 0c d1 35 9a 98 + 42 | d8cb8a-894644 d8 cb 8a 89 46 44 + diff --git a/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.yml b/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.yml new file mode 100644 index 0000000000..91ee37824c --- /dev/null +++ b/tests/hp_procurve/show_lldp_info_remote-device/hp_procurve_show_lldp_info_remote-device.yml @@ -0,0 +1,42 @@ +--- +parsed_sample: + - local_port: "1" + neighbor_chassis_id: "3821c7-c1cd00" + neighbor_descr: "1" + neighbor_portid: "1" + neighbor_sysname: "65432p-swi006-g..." + - local_port: "3" + neighbor_chassis_id: "3ce1a1-2218f0" + neighbor_descr: "" + neighbor_portid: "3c e1 a1 22 18 f0" + neighbor_sysname: "" + - local_port: "7" + neighbor_chassis_id: "bcf310-1f8b40" + neighbor_descr: "" + neighbor_portid: "mgt0" + neighbor_sysname: "AH-cust-AP21" + - local_port: "25" + neighbor_chassis_id: "d8cb8a-6d303c" + neighbor_descr: "" + neighbor_portid: "d8 cb 8a 6d 30 3c" + neighbor_sysname: "" + - local_port: "29" + neighbor_chassis_id: "484d7e-e66c42" + neighbor_descr: "" + neighbor_portid: "48 4d 7e e6 6c 42" + neighbor_sysname: "" + - local_port: "36" + neighbor_chassis_id: "603197-7aa548" + neighbor_descr: "UPLINK" + neighbor_portid: "1" + neighbor_sysname: "NAP203" + - local_port: "37" + neighbor_chassis_id: "b00cd1-359a98" + neighbor_descr: "" + neighbor_portid: "b0 0c d1 35 9a 98" + neighbor_sysname: "" + - local_port: "42" + neighbor_chassis_id: "d8cb8a-894644" + neighbor_descr: "" + neighbor_portid: "d8 cb 8a 89 46 44" + neighbor_sysname: "" From cf4c1bf8902374cf301ac89efe0ae8cfe55eaff8 Mon Sep 17 00:00:00 2001 From: sliddjur Date: Wed, 6 May 2020 00:13:27 +0200 Subject: [PATCH 2/2] Update templates/hp_procurve_show_lldp_info_remote-device.textfsm Co-authored-by: Mikhail Yohman --- templates/hp_procurve_show_lldp_info_remote-device.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/hp_procurve_show_lldp_info_remote-device.textfsm b/templates/hp_procurve_show_lldp_info_remote-device.textfsm index 0b2b67c436..d2c5e956a2 100644 --- a/templates/hp_procurve_show_lldp_info_remote-device.textfsm +++ b/templates/hp_procurve_show_lldp_info_remote-device.textfsm @@ -9,7 +9,7 @@ Start ^\s+LocalPort\s|\sChassisId.*$$ ^\s+-.* -> LLDP ^\s*$$ - ^.* -> Error + ^. -> Error LLDP ^\s+${LOCAL_PORT}\s+\|\s${NEIGHBOR_CHASSIS_ID}\s+${NEIGHBOR_PORTID}\s*$$ -> Record