From 1c3e82e1e84c180717288b28796422a3f962461d Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 12 Aug 2024 11:40:28 -0400 Subject: [PATCH] s300 lldp neighbors allow for multiline values --- .../cisco_s300_show_lldp_neighbors.textfsm | 10 +++-- .../cisco_s300_show_lldp_neighbors.yml | 12 ++++-- ...sco_s300_show_lldp_neighbors_multiline.raw | 21 ++++++++++ ...sco_s300_show_lldp_neighbors_multiline.yml | 42 +++++++++++++++++++ 4 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.raw create mode 100644 tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.yml diff --git a/ntc_templates/templates/cisco_s300_show_lldp_neighbors.textfsm b/ntc_templates/templates/cisco_s300_show_lldp_neighbors.textfsm index 61ee90770f..ae819f0a5b 100644 --- a/ntc_templates/templates/cisco_s300_show_lldp_neighbors.textfsm +++ b/ntc_templates/templates/cisco_s300_show_lldp_neighbors.textfsm @@ -1,6 +1,6 @@ -Value NEIGHBOR_NAME (\S+) +Value List NEIGHBOR_NAME (\S+) Value LOCAL_INTERFACE (\S+) -Value NEIGHBOR_INTERFACE (\S+) +Value List NEIGHBOR_INTERFACE (\S+) Value CHASSIS_ID (([0-9a-f]{2}[:-]){5}([0-9a-f]{2})) Start @@ -11,7 +11,11 @@ Start ^. -> Error Begin + ^\S+ -> Continue.Record + ^${LOCAL_INTERFACE}\s+${CHASSIS_ID}\s+${NEIGHBOR_INTERFACE}\s+(${NEIGHBOR_NAME})?\s+\S+\s+\d+ + ^\s{28}${NEIGHBOR_INTERFACE}\s*$$ + ^\s{42}${NEIGHBOR_NAME}\s*$$ + ^\s{28}${NEIGHBOR_INTERFACE}\s+${NEIGHBOR_NAME}\s*$$ ^-+ - ^${LOCAL_INTERFACE}\s+${CHASSIS_ID}\s+${NEIGHBOR_INTERFACE}\s+${NEIGHBOR_NAME}.+ -> Record ^\s*$$ ^. -> Error diff --git a/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors.yml b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors.yml index 6262d742e3..14d4015c27 100644 --- a/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors.yml +++ b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors.yml @@ -2,9 +2,13 @@ parsed_sample: - chassis_id: "00:08:32:0f:1e:bd" local_interface: "gi27" - neighbor_interface: "gi27" - neighbor_name: "prsw03freeporil" + neighbor_interface: + - "gi27" + neighbor_name: + - "prsw03freeporil" - chassis_id: "00:08:32:0f:04:cc" local_interface: "gi28" - neighbor_interface: "gi28" - neighbor_name: "prsw01freeportin" + neighbor_interface: + - "gi28" + neighbor_name: + - "prsw01freeportin" diff --git a/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.raw b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.raw new file mode 100644 index 0000000000..da50d75d3b --- /dev/null +++ b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.raw @@ -0,0 +1,21 @@ +System capability legend: +B - Bridge; R - Router; W - Wlan Access Point; T - telephone; +D - DOCSIS Cable Device; H - Host; r - Repeater; +TP - Two Ports MAC Relay; S - S-VLAN; C - C-VLAN; O - Other + + Port Device ID Port ID System Name Capabilities TTL +--------- ----------------- ------------- ----------------- ------------ ----- +gi10 f8:b1:56:ac:07:64 f8:b1:56:ac:0 O 3482 + 7:64 +gi21 28:6f:7f:0b:75:a0 Gi0 Fjallarodgardsfor B 105 + skola-AP03.net.no + rob.se +gi22 a0:e0:af:ec:e9:d0 a0:e0:af:ec:e Fjallarodgardsfor B 118 + 9:d0 skola-AP01.net.no + rob.se +gi23 a0:e0:af:b1:c8:a0 Gi0 Fjallarodgardsfor B 105 + skola-AP04.net.no + rob.se +gi24 a0:e0:af:22:3d:40 Gi0 Fjallarodgardsfor B 114 + skola-AP02.net.no + rob.se diff --git a/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.yml b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.yml new file mode 100644 index 0000000000..6006ab8ece --- /dev/null +++ b/tests/cisco_s300/show_lldp_neighbors/cisco_s300_show_lldp_neighbors_multiline.yml @@ -0,0 +1,42 @@ +--- +parsed_sample: + - chassis_id: "f8:b1:56:ac:07:64" + local_interface: "gi10" + neighbor_interface: + - "f8:b1:56:ac:0" + - "7:64" + neighbor_name: + - "None" + - chassis_id: "28:6f:7f:0b:75:a0" + local_interface: "gi21" + neighbor_interface: + - "Gi0" + neighbor_name: + - "Fjallarodgardsfor" + - "skola-AP03.net.no" + - "rob.se" + - chassis_id: "a0:e0:af:ec:e9:d0" + local_interface: "gi22" + neighbor_interface: + - "a0:e0:af:ec:e" + - "9:d0" + neighbor_name: + - "Fjallarodgardsfor" + - "skola-AP01.net.no" + - "rob.se" + - chassis_id: "a0:e0:af:b1:c8:a0" + local_interface: "gi23" + neighbor_interface: + - "Gi0" + neighbor_name: + - "Fjallarodgardsfor" + - "skola-AP04.net.no" + - "rob.se" + - chassis_id: "a0:e0:af:22:3d:40" + local_interface: "gi24" + neighbor_interface: + - "Gi0" + neighbor_name: + - "Fjallarodgardsfor" + - "skola-AP02.net.no" + - "rob.se"