From 0fb1ca246f37f83d0fba78bc14b981dda3e6a9e1 Mon Sep 17 00:00:00 2001 From: Clement Landier Date: Fri, 19 Dec 2025 22:06:50 +0100 Subject: [PATCH 1/7] Add juniper junos show ethernet-switching interfaces --- ntc_templates/templates/index | 1 + ...show_ethernet-switching_interfaces.textfsm | 20 +++ ...nos_show_ethernet-switching_interfaces.raw | 17 +++ ...nos_show_ethernet-switching_interfaces.yml | 121 ++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm create mode 100644 tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.raw create mode 100644 tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 528ae4093d..7a2161591a 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -805,6 +805,7 @@ ipinfusion_ocnos_show_lldp_table.textfsm, .*, ipinfusion_ocnos, show ll[[dp]] t[ juniper_junos_show_system_configuration_database_usage.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] c[[onfiguration]] d[[atabase]] u[[sage]] juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] +juniper_junos_show_ethernet-switching_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ethernet-switching i[[nterfaces]] juniper_junos_show_ethernet-switching_table.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] t[[able]] juniper_junos_show_system_processes_summary.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] proc[[esses]] sum[[mary]] juniper_junos_show_chassis_cluster_status.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] s[[tatus]] diff --git a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm new file mode 100644 index 0000000000..ea4b2a8f4b --- /dev/null +++ b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm @@ -0,0 +1,20 @@ +Value Required INTERFACE (\S+) +Value STATUS (up|down) +Value List VLAN_MEMBER (\S+) +Value List TAG (\d+) +Value List TAGGING (tagged|untagged) +Value List PORT_ERROR (.*) + +Start + ^\s*Interface\s+State\s+VLAN\smembers -> Table + ^. -> Error + +Table + ^\S -> Continue.Record + ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAG}\s+${TAGGING}\s+${PORT_ERROR} + ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAGGING}\s+${PORT_ERROR} + ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${PORT_ERROR} + ^\s+${VLAN_MEMBER}\s+${TAG}\s+${TAGGING}\s+${PORT_ERROR} + ^{.*}$$ + ^\s*$$ + ^. -> Error diff --git a/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.raw b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.raw new file mode 100644 index 0000000000..ae1cc2386a --- /dev/null +++ b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.raw @@ -0,0 +1,17 @@ +Interface State VLAN members Tag Tagging Blocking + +ae0.0 up default untagged unblocked +ge-0/0/2.0 up vlan300 300 untagged blocked by RTG (rtggroup) +ge-0/0/3.0 up default blocked by STP +ge-0/0/4.0 down default MAC limit exceeded +ge-0/0/5.0 down default MAC move limit exceeded +ge-0/0/6.0 down default Storm control in effect +ge-0/0/7.0 down default unblocked +ge-0/0/13.0 up default untagged unblocked +ge-0/0/14.0 up vlan100 100 tagged unblocked + vlan200 200 tagged unblocked +ge-0/0/15.0 up vlan100 100 tagged blocked by STP + vlan200 200 tagged blocked by STP +ge-0/0/16.0 down default untagged unblocked +ge-0/0/17.0 down vlan100 100 tagged Disabled by bpdu-control + vlan200 200 tagged Disabled by bpdu-control diff --git a/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml new file mode 100644 index 0000000000..40c1b713d2 --- /dev/null +++ b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml @@ -0,0 +1,121 @@ +--- +parsed_sample: + - interface: "ae0.0" + port_error: + - "unblocked" + status: "up" + tag: [] + tagging: + - "untagged" + vlan_member: + - "default" + - interface: "ge-0/0/2.0" + port_error: + - "blocked by RTG (rtggroup)" + status: "up" + tag: + - "300" + tagging: + - "untagged" + vlan_member: + - "vlan300" + - interface: "ge-0/0/3.0" + port_error: + - "blocked by STP " + status: "up" + tag: [] + tagging: [] + vlan_member: + - "default" + - interface: "ge-0/0/4.0" + port_error: + - "MAC limit exceeded" + status: "down" + tag: [] + tagging: [] + vlan_member: + - "default" + - interface: "ge-0/0/5.0" + port_error: + - "MAC move limit exceeded" + status: "down" + tag: [] + tagging: [] + vlan_member: + - "default" + - interface: "ge-0/0/6.0" + port_error: + - "Storm control in effect" + status: "down" + tag: [] + tagging: [] + vlan_member: + - "default" + - interface: "ge-0/0/7.0" + port_error: + - "unblocked" + status: "down" + tag: [] + tagging: [] + vlan_member: + - "default" + - interface: "ge-0/0/13.0" + port_error: + - "unblocked" + status: "up" + tag: [] + tagging: + - "untagged" + vlan_member: + - "default" + - interface: "ge-0/0/14.0" + port_error: + - "unblocked" + - "unblocked" + status: "up" + tag: + - "100" + - "200" + tagging: + - "tagged" + - "tagged" + vlan_member: + - "vlan100" + - "vlan200" + - interface: "ge-0/0/15.0" + port_error: + - "blocked by STP" + - "blocked by STP" + status: "up" + tag: + - "100" + - "200" + tagging: + - "tagged" + - "tagged" + vlan_member: + - "vlan100" + - "vlan200" + - interface: "ge-0/0/16.0" + port_error: + - "unblocked" + status: "down" + tag: [] + tagging: + - "untagged" + vlan_member: + - "default" + - interface: "ge-0/0/17.0" + port_error: + - "Disabled by bpdu-control" + - "Disabled by bpdu-control" + status: "down" + tag: + - "100" + - "200" + tagging: + - "tagged" + - "tagged" + vlan_member: + - "vlan100" + - "vlan200" From 01a754d7cdb65ab09880a23be8461087af0c7317 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Tue, 23 Dec 2025 11:51:04 -0500 Subject: [PATCH 2/7] Fix index order for junos ethernet-sw interfaces --- ntc_templates/templates/index | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 7a2161591a..73423e1265 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -804,8 +804,8 @@ huawei_vrp_dir.textfsm, .*, huawei_vrp, d[[ir]] ipinfusion_ocnos_show_lldp_table.textfsm, .*, ipinfusion_ocnos, show ll[[dp]] t[[able]] juniper_junos_show_system_configuration_database_usage.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] c[[onfiguration]] d[[atabase]] u[[sage]] -juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] juniper_junos_show_ethernet-switching_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ethernet-switching i[[nterfaces]] +juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] juniper_junos_show_ethernet-switching_table.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] t[[able]] juniper_junos_show_system_processes_summary.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] proc[[esses]] sum[[mary]] juniper_junos_show_chassis_cluster_status.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] s[[tatus]] From da6b9ad61133c97ee05a16890730c2167e93f797 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Tue, 23 Dec 2025 11:58:56 -0500 Subject: [PATCH 3/7] Simplify junos show eth-sw interfaces template --- .../juniper_junos_show_ethernet-switching_interfaces.textfsm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm index ea4b2a8f4b..c3f73f0b28 100644 --- a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm +++ b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm @@ -6,10 +6,7 @@ Value List TAGGING (tagged|untagged) Value List PORT_ERROR (.*) Start - ^\s*Interface\s+State\s+VLAN\smembers -> Table - ^. -> Error - -Table + ^\s*Interface\s+State\s+VLAN\s+members ^\S -> Continue.Record ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAG}\s+${TAGGING}\s+${PORT_ERROR} ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAGGING}\s+${PORT_ERROR} From dcc5e81fee823a8c54a97ca38d97b0105d11b11c Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Tue, 23 Dec 2025 11:59:47 -0500 Subject: [PATCH 4/7] Shorten TAGGING pattern via regex --- .../juniper_junos_show_ethernet-switching_interfaces.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm index c3f73f0b28..22bd87ea33 100644 --- a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm +++ b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm @@ -2,7 +2,7 @@ Value Required INTERFACE (\S+) Value STATUS (up|down) Value List VLAN_MEMBER (\S+) Value List TAG (\d+) -Value List TAGGING (tagged|untagged) +Value List TAGGING ((un)?tagged) Value List PORT_ERROR (.*) Start From 1d93800361a380dc95919b9b06e734ca2d33342d Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Tue, 23 Dec 2025 12:02:57 -0500 Subject: [PATCH 5/7] Use VLAN_ID instead of TAG Use the normalized VLAN_ID capture group name for the VLAN tag. --- ...show_ethernet-switching_interfaces.textfsm | 8 ++-- ...nos_show_ethernet-switching_interfaces.yml | 38 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm index 22bd87ea33..b61ec9c5ab 100644 --- a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm +++ b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm @@ -1,17 +1,17 @@ Value Required INTERFACE (\S+) Value STATUS (up|down) Value List VLAN_MEMBER (\S+) -Value List TAG (\d+) +Value List VLAN_ID (\d+) Value List TAGGING ((un)?tagged) Value List PORT_ERROR (.*) Start - ^\s*Interface\s+State\s+VLAN\s+members + ^\s*Interface\s+State\s+VLAN\s+members\s+Tag\s+Tagging\s+Blocking ^\S -> Continue.Record - ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAG}\s+${TAGGING}\s+${PORT_ERROR} + ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${VLAN_ID}\s+${TAGGING}\s+${PORT_ERROR} ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAGGING}\s+${PORT_ERROR} ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${PORT_ERROR} - ^\s+${VLAN_MEMBER}\s+${TAG}\s+${TAGGING}\s+${PORT_ERROR} + ^\s+${VLAN_MEMBER}\s+${VLAN_ID}\s+${TAGGING}\s+${PORT_ERROR} ^{.*}$$ ^\s*$$ ^. -> Error diff --git a/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml index 40c1b713d2..48bf9557d8 100644 --- a/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml +++ b/tests/juniper_junos/show_ethernet-switching_interfaces/juniper_junos_show_ethernet-switching_interfaces.yml @@ -4,68 +4,68 @@ parsed_sample: port_error: - "unblocked" status: "up" - tag: [] tagging: - "untagged" + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/2.0" port_error: - "blocked by RTG (rtggroup)" status: "up" - tag: - - "300" tagging: - "untagged" + vlan_id: + - "300" vlan_member: - "vlan300" - interface: "ge-0/0/3.0" port_error: - "blocked by STP " status: "up" - tag: [] tagging: [] + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/4.0" port_error: - "MAC limit exceeded" status: "down" - tag: [] tagging: [] + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/5.0" port_error: - "MAC move limit exceeded" status: "down" - tag: [] tagging: [] + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/6.0" port_error: - "Storm control in effect" status: "down" - tag: [] tagging: [] + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/7.0" port_error: - "unblocked" status: "down" - tag: [] tagging: [] + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/13.0" port_error: - "unblocked" status: "up" - tag: [] tagging: - "untagged" + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/14.0" @@ -73,12 +73,12 @@ parsed_sample: - "unblocked" - "unblocked" status: "up" - tag: - - "100" - - "200" tagging: - "tagged" - "tagged" + vlan_id: + - "100" + - "200" vlan_member: - "vlan100" - "vlan200" @@ -87,12 +87,12 @@ parsed_sample: - "blocked by STP" - "blocked by STP" status: "up" - tag: - - "100" - - "200" tagging: - "tagged" - "tagged" + vlan_id: + - "100" + - "200" vlan_member: - "vlan100" - "vlan200" @@ -100,9 +100,9 @@ parsed_sample: port_error: - "unblocked" status: "down" - tag: [] tagging: - "untagged" + vlan_id: [] vlan_member: - "default" - interface: "ge-0/0/17.0" @@ -110,12 +110,12 @@ parsed_sample: - "Disabled by bpdu-control" - "Disabled by bpdu-control" status: "down" - tag: - - "100" - - "200" tagging: - "tagged" - "tagged" + vlan_id: + - "100" + - "200" vlan_member: - "vlan100" - "vlan200" From e67d64bd41c7bab05c1bdfebeb8c896687d67a78 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Tue, 23 Dec 2025 12:10:14 -0500 Subject: [PATCH 6/7] Update ethernet-switching pattern in index Make the ethernet-switching regex pattern match another existing command (where there are optional characters for the shortened version.) --- ntc_templates/templates/index | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 73423e1265..eee431b920 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -804,7 +804,7 @@ huawei_vrp_dir.textfsm, .*, huawei_vrp, d[[ir]] ipinfusion_ocnos_show_lldp_table.textfsm, .*, ipinfusion_ocnos, show ll[[dp]] t[[able]] juniper_junos_show_system_configuration_database_usage.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] c[[onfiguration]] d[[atabase]] u[[sage]] -juniper_junos_show_ethernet-switching_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ethernet-switching i[[nterfaces]] +juniper_junos_show_ethernet-switching_interfaces.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] i[[nterfaces]] juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] juniper_junos_show_ethernet-switching_table.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] t[[able]] juniper_junos_show_system_processes_summary.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] proc[[esses]] sum[[mary]] From b051cc76374c448cae78ab7cb5cc891da0b8ade5 Mon Sep 17 00:00:00 2001 From: Clement Landier Date: Tue, 23 Dec 2025 22:47:30 +0100 Subject: [PATCH 7/7] Remove unneeded pattern matching for the routing info cli prompt {master:0} --- .../juniper_junos_show_ethernet-switching_interfaces.textfsm | 1 - 1 file changed, 1 deletion(-) diff --git a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm index b61ec9c5ab..cb33273e59 100644 --- a/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm +++ b/ntc_templates/templates/juniper_junos_show_ethernet-switching_interfaces.textfsm @@ -12,6 +12,5 @@ Start ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${TAGGING}\s+${PORT_ERROR} ^${INTERFACE}\s+${STATUS}\s+${VLAN_MEMBER}\s+${PORT_ERROR} ^\s+${VLAN_MEMBER}\s+${VLAN_ID}\s+${TAGGING}\s+${PORT_ERROR} - ^{.*}$$ ^\s*$$ ^. -> Error