From ffc698d0aaacbb308c41cacb3301314cbc4621ca Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Tue, 23 Jul 2019 16:17:29 -0600 Subject: [PATCH 1/4] updated to latest --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5e46500fc7..d3e8c1f0a4 100644 --- a/tox.ini +++ b/tox.ini @@ -10,4 +10,4 @@ whitelist_externals = git rm -commands = pytest +commands = pytest -vv From 9c96ddc7303d109df2e8b5caed3fb29017a4a0ed Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Fri, 17 Jan 2020 19:48:49 +0000 Subject: [PATCH 2/4] Huawei display lldp neighbor template --- .../huawei_vrp_display_lldp_neighbor.textfsm | 76 +++++++++ templates/index | 1 + .../huawei_vrp_display_lldp_neighbor.raw | 146 ++++++++++++++++++ .../huawei_vrp_display_lldp_neighbor.yml | 36 +++++ 4 files changed, 259 insertions(+) create mode 100644 templates/huawei_vrp_display_lldp_neighbor.textfsm create mode 100644 tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.raw create mode 100644 tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.yml diff --git a/templates/huawei_vrp_display_lldp_neighbor.textfsm b/templates/huawei_vrp_display_lldp_neighbor.textfsm new file mode 100644 index 0000000000..5b42e8dba5 --- /dev/null +++ b/templates/huawei_vrp_display_lldp_neighbor.textfsm @@ -0,0 +1,76 @@ +Value Required LOCAL_INTERFACE (\S+) +Value CHASSIS_ID (.+?) +Value MANUFACTURER_NAME (.*) +Value MODEL_NAME (.*) +Value NEIGHBOR_PORT_ID (.*) +Value NEIGHBOR_INTERFACE (.*) +Value NEIGHBOR (.+?) +Value List SYSTEM_DESCRIPTION (.*) +Value CAPABILITIES (.*) +Value MANAGEMENT_IP (\S+) +Value VLAN (\d+) +Value SERIAL (\S+) + +Start + ^${LOCAL_INTERFACE}\s+has\s+\d+\s+neighbors:$$ + ^\S+\s+has\s+\d+\s+neighbors + ^Neighbor\s+index + ^Chassis\s+type + ^Chassis\s+ID\s+:${CHASSIS_ID}$$ + ^Port\s+ID\s+type + ^Port\s+ID\s+:${NEIGHBOR_PORT_ID}$$ + ^Port\s+description\s+:${NEIGHBOR_INTERFACE}$$ + ^System\s+name\s+:${NEIGHBOR}$$ + ^System\s+description\s+:${SYSTEM_DESCRIPTION} -> SystemDescription + ^System\s+capabilities\s+supported + ^System\s+capabilities\s+enabled\s+:${CAPABILITIES}$$ + ^Management\s+address\s+type + ^Management\s+address\s*:\s*${MANAGEMENT_IP} + ^Expired\s+time + ^Port\s+VLAN\s+ID\(PVID\)\s+:${VLAN} + ^VLAN\s+name\s+of\s+VLAN + ^Protocol\s+identity + ^Auto-negotiation + ^OperMau + ^Power + ^PSE + ^Port\s+power + ^Link\s+aggregation + ^Aggregation + ^Maximum\s+frame\s+Size + ^MED\s+Device\s+information -> MED + ^\s*$$ + ^. -> Error + +SystemDescription + ^${SYSTEM_DESCRIPTION} -> IgnoreDescription + +IgnoreDescription + ^System\s+capabilities\s+supported -> Start + ^${SYSTEM_DESCRIPTION} + ^\s*$$ + ^.*$$ -> Error + +MED + ^Device\s+class + ^HardwareRev + ^FirmwareRev + ^SoftwareRev + ^SerialNum\s+:${SERIAL} + ^Manufacturer\s+name\s+:${MANUFACTURER_NAME} + ^Model\s+name\s+:${MODEL_NAME} + ^Asset\s+tracking + ^Media\s+policy\s+type + ^Unknown\s+Policy + ^VLAN\s+tagged + ^Media + ^Power + ^PoE + ^Port\s+PSE\s+Priority + ^Port\s+Available\s+power + ^Location\s+format + ^Location\s+information + ^Ca + ^\S+\s+has\s+\d+\s+neighbors -> Record Start + ^\s*$$ + ^. -> Error diff --git a/templates/index b/templates/index index 26b99b539b..e02e419c3f 100644 --- a/templates/index +++ b/templates/index @@ -323,6 +323,7 @@ hp_procurve_show_vlans.textfsm, .*, hp_procurve, sh[[ow]] vl[[ans]] hp_procurve_show_arp.textfsm, .*, hp_procurve, sh[[ow]] ar[[p]] huawei_vrp_display_interface_brief.textfsm, .*, huawei_vrp, disp[[lay]] inter[[face]] br[[ief]] +huawei_vrp_display_lldp_neighbor.textfsm, .*, huawei_vrp, disp[[lay]] lldp nei[[ghbor]] huawei_vrp_display_temperature.textfsm, .*, huawei_vrp, disp[[lay]] tem[[perature]] juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] diff --git a/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.raw b/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.raw new file mode 100644 index 0000000000..3721c468bb --- /dev/null +++ b/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.raw @@ -0,0 +1,146 @@ +iGigabitEthernet0/0/0 has 0 neighbors + +GigabitEthernet0/0/1 has 1 neighbors: + +Neighbor index : 1 +Chassis type :macAddress +Chassis ID :f55f-c2c5-e180 +Port ID type :interfaceName +Port ID :Gi1/0/1 +Port description :GigabitEthernet1/0/1 +System name :tsa-2960-sw01 +System description :Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2013 by Cisco Systems, Inc. +Compiled Mon 28-Jan-13 10:28 by prod_rel_team +System capabilities supported :bridge router +System capabilities enabled :bridge +Management address type :ipV4 +Management address : 192.168.0.240 +Expired time :102s + +Port VLAN ID(PVID) :1 +Protocol identity : + +Auto-negotiation supported :Yes +Auto-negotiation enabled :Yes +OperMau :speed(1000)/duplex(Full) + +Power port class :PD +PSE power supported :No +PSE power enabled :No +PSE pairs control ability:No +Power pairs :Unknown +Port power classification:Unknown + +Link aggregation supported:No +Link aggregation enabled :No +Aggregation port ID :0 +Maximum frame Size :0 + +MED Device information +Device class :Network Connectivity + +HardwareRev :WS-C2960S-48LPS-L (PowerPC):F0 +FirmwareRev :NA +SoftwareRev :12.2(55)SE7 +SerialNum :NA +Manufacturer name :Cisco Systems, Inc. +Model name :WS-C2960S-48LPS-L +Asset tracking identifier :NA + +Media policy type :Voice +Unknown Policy :Unknown +VLAN tagged :No +Media policy VlanID :0 +Media policy L2 priority :0 +Media policy Dscp :0 + +Power Type :PSE +PoE PSE power source :PSE +Port PSE Priority :Low +Port Available power value:0 + +Location format :Civic Address LCI +Location information:what(LLDP-MED Endpoint) country( ) +Ca type Ca value +GigabitEthernet0/0/2 has 0 neighbors + +GigabitEthernet0/0/3 has 0 neighbors + +GigabitEthernet0/0/4 has 0 neighbors + +GigabitEthernet0/0/5 has 0 neighbors + +GigabitEthernet0/0/6 has 0 neighbors + +GigabitEthernet0/0/7 has 0 neighbors + +GigabitEthernet0/0/8 has 1 neighbors: + +Neighbor index : 1 +Chassis type :macAddress +Chassis ID :f41f-c2c5-e180 +Port ID type :interfaceName +Port ID :Gi1/0/2 +Port description :GigabitEthernet1/0/2 +System name :tsa-2960-sw01 +System description :Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7, RELEASE SOFTWARE (fc1) +Technical Support: http://www.cisco.com/techsupport +Copyright (c) 1986-2013 by Cisco Systems, Inc. +Compiled Mon 28-Jan-13 10:28 by prod_rel_team +System capabilities supported :bridge router +System capabilities enabled :bridge +Management address type :ipV4 +Management address : 192.168.0.241 +Expired time :102s + +Port VLAN ID(PVID) :1 +Protocol identity : + +Auto-negotiation supported :Yes +Auto-negotiation enabled :Yes +OperMau :speed(1000)/duplex(Full) + +Power port class :PD +PSE power supported :No +PSE power enabled :No +PSE pairs control ability:No +Power pairs :Unknown +Port power classification:Unknown + +Link aggregation supported:No +Link aggregation enabled :No +Aggregation port ID :0 +Maximum frame Size :0 + +MED Device information +Device class :Network Connectivity + +HardwareRev :WS-C2960S-48LPS-L (PowerPC):F0 +FirmwareRev :NA +SoftwareRev :12.2(55)SE7 +SerialNum :NA +Manufacturer name :Cisco Systems, Inc. +Model name :WS-C2960S-48LPS-L +Asset tracking identifier :NA + +Media policy type :Voice +Unknown Policy :Unknown +VLAN tagged :No +Media policy VlanID :0 +Media policy L2 priority :0 +Media policy Dscp :0 + +Power Type :PSE +PoE PSE power source :PSE +Port PSE Priority :Low +Port Available power value:0 + +Location format :Civic Address LCI +Location information:what(LLDP-MED Endpoint) country( ) +Ca type Ca value + +GigabitEthernet0/0/9 has 0 neighbors + +GigabitEthernet0/0/10 has 0 neighbors diff --git a/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.yml b/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.yml new file mode 100644 index 0000000000..db45bc2fda --- /dev/null +++ b/tests/huawei_vrp/display_lldp_neighbor/huawei_vrp_display_lldp_neighbor.yml @@ -0,0 +1,36 @@ +--- +parsed_sample: + - local_interface: "GigabitEthernet0/0/1" + chassis_id: "f55f-c2c5-e180" + manufacturer_name: "Cisco Systems, Inc." + model_name: "WS-C2960S-48LPS-L" + neighbor_port_id: "Gi1/0/1" + neighbor_interface: "GigabitEthernet1/0/1" + neighbor: "tsa-2960-sw01" + system_description: + - "Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7,\ + \ RELEASE SOFTWARE (fc1)" + - "Technical Support: http://www.cisco.com/techsupport" + - "Copyright (c) 1986-2013 by Cisco Systems, Inc." + - "Compiled Mon 28-Jan-13 10:28 by prod_rel_team" + capabilities: "bridge" + management_ip: "192.168.0.240" + vlan: "1" + serial: "NA" + - local_interface: "GigabitEthernet0/0/8" + chassis_id: "f41f-c2c5-e180" + manufacturer_name: "Cisco Systems, Inc." + model_name: "WS-C2960S-48LPS-L" + neighbor_port_id: "Gi1/0/2" + neighbor_interface: "GigabitEthernet1/0/2" + neighbor: "tsa-2960-sw01" + system_description: + - "Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 12.2(55)SE7,\ + \ RELEASE SOFTWARE (fc1)" + - "Technical Support: http://www.cisco.com/techsupport" + - "Copyright (c) 1986-2013 by Cisco Systems, Inc." + - "Compiled Mon 28-Jan-13 10:28 by prod_rel_team" + capabilities: "bridge" + management_ip: "192.168.0.241" + vlan: "1" + serial: "NA" From 4fa4460f2460c75360eef6d1f3708ca3103ae298 Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Thu, 23 Jan 2020 18:39:07 +0000 Subject: [PATCH 3/4] Addressed feedback --- templates/huawei_vrp_display_lldp_neighbor.textfsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/huawei_vrp_display_lldp_neighbor.textfsm b/templates/huawei_vrp_display_lldp_neighbor.textfsm index 5b42e8dba5..271e170223 100644 --- a/templates/huawei_vrp_display_lldp_neighbor.textfsm +++ b/templates/huawei_vrp_display_lldp_neighbor.textfsm @@ -1,6 +1,6 @@ Value Required LOCAL_INTERFACE (\S+) Value CHASSIS_ID (.+?) -Value MANUFACTURER_NAME (.*) +Value MANUFACTURER_NAME (.*?) Value MODEL_NAME (.*) Value NEIGHBOR_PORT_ID (.*) Value NEIGHBOR_INTERFACE (.*) @@ -57,7 +57,7 @@ MED ^FirmwareRev ^SoftwareRev ^SerialNum\s+:${SERIAL} - ^Manufacturer\s+name\s+:${MANUFACTURER_NAME} + ^Manufacturer\s+name\s+:${MANUFACTURER_NAME}\s*$$ ^Model\s+name\s+:${MODEL_NAME} ^Asset\s+tracking ^Media\s+policy\s+type From 42b5b6d854b4e91525ab81966c7226c23e2460f3 Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Thu, 23 Jan 2020 18:45:15 +0000 Subject: [PATCH 4/4] Another update --- .../huawei_vrp_display_lldp_neighbor.textfsm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/huawei_vrp_display_lldp_neighbor.textfsm b/templates/huawei_vrp_display_lldp_neighbor.textfsm index 271e170223..d14186eaae 100644 --- a/templates/huawei_vrp_display_lldp_neighbor.textfsm +++ b/templates/huawei_vrp_display_lldp_neighbor.textfsm @@ -1,12 +1,12 @@ Value Required LOCAL_INTERFACE (\S+) Value CHASSIS_ID (.+?) Value MANUFACTURER_NAME (.*?) -Value MODEL_NAME (.*) -Value NEIGHBOR_PORT_ID (.*) -Value NEIGHBOR_INTERFACE (.*) +Value MODEL_NAME (.*?) +Value NEIGHBOR_PORT_ID (.*?) +Value NEIGHBOR_INTERFACE (.*?) Value NEIGHBOR (.+?) Value List SYSTEM_DESCRIPTION (.*) -Value CAPABILITIES (.*) +Value CAPABILITIES (.*?) Value MANAGEMENT_IP (\S+) Value VLAN (\d+) Value SERIAL (\S+) @@ -18,12 +18,12 @@ Start ^Chassis\s+type ^Chassis\s+ID\s+:${CHASSIS_ID}$$ ^Port\s+ID\s+type - ^Port\s+ID\s+:${NEIGHBOR_PORT_ID}$$ - ^Port\s+description\s+:${NEIGHBOR_INTERFACE}$$ - ^System\s+name\s+:${NEIGHBOR}$$ + ^Port\s+ID\s+:${NEIGHBOR_PORT_ID}\s*$$ + ^Port\s+description\s+:${NEIGHBOR_INTERFACE}\s*$$ + ^System\s+name\s+:${NEIGHBOR}\s*$$ ^System\s+description\s+:${SYSTEM_DESCRIPTION} -> SystemDescription ^System\s+capabilities\s+supported - ^System\s+capabilities\s+enabled\s+:${CAPABILITIES}$$ + ^System\s+capabilities\s+enabled\s+:${CAPABILITIES}\s*$$ ^Management\s+address\s+type ^Management\s+address\s*:\s*${MANAGEMENT_IP} ^Expired\s+time @@ -58,7 +58,7 @@ MED ^SoftwareRev ^SerialNum\s+:${SERIAL} ^Manufacturer\s+name\s+:${MANUFACTURER_NAME}\s*$$ - ^Model\s+name\s+:${MODEL_NAME} + ^Model\s+name\s+:${MODEL_NAME}\s*$$ ^Asset\s+tracking ^Media\s+policy\s+type ^Unknown\s+Policy