From 6686a992442bec4a868f83eec8de8aff1084dcd1 Mon Sep 17 00:00:00 2001 From: Josh VanDeraa Date: Sun, 24 Feb 2019 14:17:51 -0600 Subject: [PATCH 1/2] Updated the template to get first 20 chars on LLDP neighbor for case of longer switch names. --- templates/cisco_ios_show_lldp_neighbors.template | 4 ++-- .../cisco_ios_show_lldp_neighbors2.parsed | 5 +++++ .../cisco_ios_show_lldp_neighbors2.raw | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.parsed create mode 100644 tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.raw diff --git a/templates/cisco_ios_show_lldp_neighbors.template b/templates/cisco_ios_show_lldp_neighbors.template index 7bfd7a674e..97ba471b57 100644 --- a/templates/cisco_ios_show_lldp_neighbors.template +++ b/templates/cisco_ios_show_lldp_neighbors.template @@ -1,4 +1,4 @@ -Value Required NEIGHBOR (\S+) +Value Required NEIGHBOR (\S{0,20}) Value Required LOCAL_INTERFACE (\S+) Value Required NEIGHBOR_INTERFACE (\S+) @@ -6,6 +6,6 @@ Start ^Device.*ID -> LLDP LLDP - ^${NEIGHBOR}\s+${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record + ^${NEIGHBOR}${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record ^${NEIGHBOR} ^\s+${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record diff --git a/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.parsed b/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.parsed new file mode 100644 index 0000000000..c6cf89712d --- /dev/null +++ b/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.parsed @@ -0,0 +1,5 @@ +--- +parsed_sample: +- neighbor: "long_name_swt.josh-v" + local_interface: "Gi0/2" + neighbor_interface: "Gi0/0" diff --git a/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.raw b/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.raw new file mode 100644 index 0000000000..027c64161d --- /dev/null +++ b/tests/cisco_ios/show_lldp_neighbors/cisco_ios_show_lldp_neighbors2.raw @@ -0,0 +1,8 @@ +Capability codes: + (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device + (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other + +Device ID Local Intf Hold-time Capability Port ID +long_name_swt.josh-vGi0/2 120 R Gi0/0 + +Total entries displayed: 1 From 378589ebbea714de4c319954a9f7ad65c2ea2a26 Mon Sep 17 00:00:00 2001 From: Jacob McGill Date: Sun, 24 Feb 2019 17:15:53 -0700 Subject: [PATCH 2/2] Update templates/cisco_ios_show_lldp_neighbors.template Co-Authored-By: jvanderaa --- templates/cisco_ios_show_lldp_neighbors.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cisco_ios_show_lldp_neighbors.template b/templates/cisco_ios_show_lldp_neighbors.template index 97ba471b57..bd5c725195 100644 --- a/templates/cisco_ios_show_lldp_neighbors.template +++ b/templates/cisco_ios_show_lldp_neighbors.template @@ -6,6 +6,6 @@ Start ^Device.*ID -> LLDP LLDP - ^${NEIGHBOR}${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record + ^${NEIGHBOR}\s*${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record ^${NEIGHBOR} ^\s+${LOCAL_INTERFACE}\s+\d+\s+(\S+)*\s+${NEIGHBOR_INTERFACE} -> Record