From 7d777f72594be64e5de91ca96fae7658c7b5f77c Mon Sep 17 00:00:00 2001 From: eperpinya Date: Thu, 23 Jan 2025 14:54:19 +0100 Subject: [PATCH 1/3] Improving template (I got an error due to a whitespace) --- .../templates/huawei_vrp_display_mac-address.textfsm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm b/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm index 7f0cded4d0..95a30cf400 100644 --- a/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm +++ b/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm @@ -4,9 +4,9 @@ Value TYPE (\S+) Value VLAN_ID (\d+) Start - ^-+$$ + ^\s*-+$$ ^\s+$$ - ^MAC\s+Address - ^${DESTINATION_ADDRESS}\s+${VLAN_ID}/([^/]+)/([^/]+)\s+${DESTINATION_PORT}\s+${TYPE} -> Record - ^Total\s+items + ^\s*MAC\s+Address\s*VLAN\/VSI\/BD\s*Learned-From\s*Type\s*$$ + ^\s*${DESTINATION_ADDRESS}\s+${VLAN_ID}/([^/]+)/([^/]+)\s+${DESTINATION_PORT}\s+${TYPE}\s*$$ -> Record + ^\s*Total\s+items\s*displayed\s*=\s*\d+\s*$$ ^. -> Error From b0b0a6b2448b6fa07487665ac110180e0e82a2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enric=20Perpiny=C3=A0=20Pitarch?= Date: Fri, 24 Jan 2025 10:26:21 +0100 Subject: [PATCH 2/3] added modified test --- .../display_mac-address/huawei_vrp_display_mac-address.raw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address.raw b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address.raw index 40fcc17893..cfe992d4bf 100644 --- a/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address.raw +++ b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address.raw @@ -2,7 +2,7 @@ MAC Address VLAN/VSI/BD Learned-From Type ------------------------------------------------------------------------------- b8d6-f6ff-7390 10/-/- XGE0/0/1 dynamic -b8d6-f6ff-739b 10/-/- XGE0/0/1 dynamic + b8d6-f6ff-739b 10/-/- XGE0/0/1 dynamic ------------------------------------------------------------------------------- Total items displayed = 2 From 06f1ba18c1c8740b746d055a2118e38abb97f99e Mon Sep 17 00:00:00 2001 From: eperpinya Date: Tue, 28 Jan 2025 11:13:41 +0100 Subject: [PATCH 3/3] Updating Huawei VRP template: `display mac-address` --- .../templates/huawei_vrp_display_mac-address.textfsm | 4 ++-- .../huawei_vrp_display_mac-address2.raw | 7 +++++++ .../huawei_vrp_display_mac-address2.yml | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.raw create mode 100644 tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.yml diff --git a/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm b/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm index 95a30cf400..798d73a9ff 100644 --- a/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm +++ b/ntc_templates/templates/huawei_vrp_display_mac-address.textfsm @@ -6,7 +6,7 @@ Value VLAN_ID (\d+) Start ^\s*-+$$ ^\s+$$ - ^\s*MAC\s+Address\s*VLAN\/VSI\/BD\s*Learned-From\s*Type\s*$$ - ^\s*${DESTINATION_ADDRESS}\s+${VLAN_ID}/([^/]+)/([^/]+)\s+${DESTINATION_PORT}\s+${TYPE}\s*$$ -> Record + ^\s*MAC\s+Address\s*VLAN\/VSI(?:\/BD)?\s*Learned-From\s*Type\s*$$ + ^\s*${DESTINATION_ADDRESS}\s+${VLAN_ID}/([^/]+)(?:/([^/]+))?\s+${DESTINATION_PORT}\s+${TYPE}\s*$$ -> Record ^\s*Total\s+items\s*displayed\s*=\s*\d+\s*$$ ^. -> Error diff --git a/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.raw b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.raw new file mode 100644 index 0000000000..a914d28565 --- /dev/null +++ b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.raw @@ -0,0 +1,7 @@ +------------------------------------------------------------------------------- +MAC Address VLAN/VSI Learned-From Type +------------------------------------------------------------------------------- +aaaa-aaaa-aaaa 1/- GE0/0/25 dynamic +bbbb-bbbb-bbbb 1/- GE0/0/25 dynamic +------------------------------------------------------------------------------- +Total items displayed = 2 diff --git a/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.yml b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.yml new file mode 100644 index 0000000000..1e8bcb6fe3 --- /dev/null +++ b/tests/huawei_vrp/display_mac-address/huawei_vrp_display_mac-address2.yml @@ -0,0 +1,10 @@ +--- +parsed_sample: + - destination_address: "aaaa-aaaa-aaaa" + destination_port: "GE0/0/25" + type: "dynamic" + vlan_id: "1" + - destination_address: "bbbb-bbbb-bbbb" + destination_port: "GE0/0/25" + type: "dynamic" + vlan_id: "1"