From fbad795c31279246e4d0e1b33b5f124a4a8dd85f Mon Sep 17 00:00:00 2001 From: ichisuke55 Date: Thu, 21 May 2020 14:25:34 +0000 Subject: [PATCH 1/3] add new template juniper_junos_show_lacp_interfaces --- templates/index | 1 + ...juniper_junos_show_lacp_interfaces.textfsm | 11 ++++ .../juniper_junos_show_lacp_interfaces.raw | 38 ++++++++++++++ .../juniper_junos_show_lacp_interfaces.yml | 50 +++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 templates/juniper_junos_show_lacp_interfaces.textfsm create mode 100644 tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.raw create mode 100644 tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.yml diff --git a/templates/index b/templates/index index 3d5ffc946b..d9506a6145 100644 --- a/templates/index +++ b/templates/index @@ -369,6 +369,7 @@ juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow juniper_junos_show_ethernet-switching_table.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] t[[able]] juniper_junos_show_chassis_cluster_status.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] s[[tatus]] juniper_junos_show_chassis_firmware.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] fi[[rmware]] +juniper_junos_show_lacp_interfaces.textfsm, .*, juniper_junos, sh[[ow]] la[[cp]] i[[nterfaces]] juniper_junos_show_arp_no-resolve.textfsm, .*, juniper_junos, sh[[ow]] a[[rp]] n[[o-resolve]] juniper_junos_show_isis_adjacency.textfsm, .*, juniper_junos, sh[[ow]] is[[is]] ad[[jacency]] juniper_junos_show_ospf_neighbor.textfsm, .*, juniper_junos, sh[[ow]] ospf n[[eighbor]] diff --git a/templates/juniper_junos_show_lacp_interfaces.textfsm b/templates/juniper_junos_show_lacp_interfaces.textfsm new file mode 100644 index 0000000000..36f3171f5d --- /dev/null +++ b/templates/juniper_junos_show_lacp_interfaces.textfsm @@ -0,0 +1,11 @@ +Value Required,Filldown AGGREGATED_INTERFACE (\S+) +Value List MEMBER_INTERFACE (\S+) +Value List RECEIVE_STATE (\S+\s?\w+) +Value List TRANSMIT_STATE (\S+\s?periodic) +Value List MUX_STATE (\S+\s?\S*) + +Start + ^Aggre -> Continue.Record + ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) -> Continue + ^\s+${MEMBER_INTERFACE}\s+${RECEIVE_STATE}\s+${TRANSMIT_STATE}\s+${MUX_STATE}(\s|$$) -> Continue + diff --git a/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.raw b/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.raw new file mode 100644 index 0000000000..93fe5013ef --- /dev/null +++ b/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.raw @@ -0,0 +1,38 @@ +Aggregated interface: ae33 + LACP state: Role Exp Def Dist Col Syn Aggr Timeout Activity + xe-0/0/0:0 Actor No No Yes Yes Yes Yes Fast Active + xe-0/0/0:0 Partner No No Yes Yes Yes Yes Slow Active + LACP protocol: Receive State Transmit State Mux State + xe-0/0/0:0 Current Slow periodic Collecting distributing + +Aggregated interface: ae111 + LACP state: Role Exp Def Dist Col Syn Aggr Timeout Activity + et-0/0/32 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/32 Partner No No Yes Yes Yes Yes Fast Active + et-0/0/33 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/33 Partner No No Yes Yes Yes Yes Fast Active + LACP protocol: Receive State Transmit State Mux State + et-0/0/32 Current Fast periodic Collecting distributing + et-0/0/33 Current Fast periodic Collecting distributing + +Aggregated interface: ae112 + LACP state: Role Exp Def Dist Col Syn Aggr Timeout Activity + et-0/0/34 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/34 Partner No No Yes Yes Yes Yes Fast Active + et-0/0/35 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/35 Partner No No Yes Yes Yes Yes Fast Active + LACP protocol: Receive State Transmit State Mux State + et-0/0/34 Current Fast periodic Collecting distributing + et-0/0/35 Current Fast periodic Collecting distributing + +Aggregated interface: ae115 + LACP state: Role Exp Def Dist Col Syn Aggr Timeout Activity + et-0/0/25 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/25 Partner No No Yes Yes Yes Yes Fast Active + et-0/0/29 Actor No No Yes Yes Yes Yes Fast Active + et-0/0/29 Partner No No Yes Yes Yes Yes Fast Active + LACP protocol: Receive State Transmit State Mux State + et-0/0/25 Current Fast periodic Collecting distributing + et-0/0/29 Current Fast periodic Collecting distributing + +{master:0} diff --git a/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.yml b/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.yml new file mode 100644 index 0000000000..0990686104 --- /dev/null +++ b/tests/juniper_junos/show_lacp_interfaces/juniper_junos_show_lacp_interfaces.yml @@ -0,0 +1,50 @@ +--- +parsed_sample: + - aggregated_interface: "ae33" + member_interface: + - "xe-0/0/0:0" + receive_state: + - "Current" + transmit_state: + - "Slow periodic" + mux_state: + - "Collecting distributing" + - aggregated_interface: "ae111" + member_interface: + - "et-0/0/32" + - "et-0/0/33" + receive_state: + - "Current" + - "Current" + transmit_state: + - "Fast periodic" + - "Fast periodic" + mux_state: + - "Collecting distributing" + - "Collecting distributing" + - aggregated_interface: "ae112" + member_interface: + - "et-0/0/34" + - "et-0/0/35" + receive_state: + - "Current" + - "Current" + transmit_state: + - "Fast periodic" + - "Fast periodic" + mux_state: + - "Collecting distributing" + - "Collecting distributing" + - aggregated_interface: "ae115" + member_interface: + - "et-0/0/25" + - "et-0/0/29" + receive_state: + - "Current" + - "Current" + transmit_state: + - "Fast periodic" + - "Fast periodic" + mux_state: + - "Collecting distributing" + - "Collecting distributing" From abb17598493eb8800eef0437c1121912b140910d Mon Sep 17 00:00:00 2001 From: ichisuke55 Date: Fri, 22 May 2020 16:25:24 +0000 Subject: [PATCH 2/3] add header LACP_PROTO --- .../juniper_junos_show_lacp_interfaces.textfsm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/juniper_junos_show_lacp_interfaces.textfsm b/templates/juniper_junos_show_lacp_interfaces.textfsm index 36f3171f5d..5f668a71c9 100644 --- a/templates/juniper_junos_show_lacp_interfaces.textfsm +++ b/templates/juniper_junos_show_lacp_interfaces.textfsm @@ -1,11 +1,19 @@ -Value Required,Filldown AGGREGATED_INTERFACE (\S+) +Value Required AGGREGATED_INTERFACE (\S+) Value List MEMBER_INTERFACE (\S+) Value List RECEIVE_STATE (\S+\s?\w+) Value List TRANSMIT_STATE (\S+\s?periodic) Value List MUX_STATE (\S+\s?\S*) Start - ^Aggre -> Continue.Record + ^Aggregated -> Continue.Record ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) -> Continue - ^\s+${MEMBER_INTERFACE}\s+${RECEIVE_STATE}\s+${TRANSMIT_STATE}\s+${MUX_STATE}(\s|$$) -> Continue + ^\s+LACP\s+state: -> Continue + ^\s+LACP\sprotocol: -> LACP_PROTO + ^\s*$$ + ^{master:\d+} +LACP_PROTO + ^\s+${MEMBER_INTERFACE}\s+${RECEIVE_STATE}\s+${TRANSMIT_STATE}\s+${MUX_STATE}(\s|$$) -> Continue + ^\s*$$ + ^Aggregated -> Continue.Record + ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) -> Start From fdb2dd90cfaa61200ccd1057a6a08fc789e94d79 Mon Sep 17 00:00:00 2001 From: ichisuke55 Date: Sat, 23 May 2020 15:36:16 +0000 Subject: [PATCH 3/3] fix template that added ^. & ^master --- templates/juniper_junos_show_lacp_interfaces.textfsm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/juniper_junos_show_lacp_interfaces.textfsm b/templates/juniper_junos_show_lacp_interfaces.textfsm index 5f668a71c9..51051f854c 100644 --- a/templates/juniper_junos_show_lacp_interfaces.textfsm +++ b/templates/juniper_junos_show_lacp_interfaces.textfsm @@ -6,14 +6,18 @@ Value List MUX_STATE (\S+\s?\S*) Start ^Aggregated -> Continue.Record - ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) -> Continue - ^\s+LACP\s+state: -> Continue + ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) + ^\s+LACP\s+state: ^\s+LACP\sprotocol: -> LACP_PROTO + ^\s+\S+ ^\s*$$ ^{master:\d+} + ^. -> Error LACP_PROTO - ^\s+${MEMBER_INTERFACE}\s+${RECEIVE_STATE}\s+${TRANSMIT_STATE}\s+${MUX_STATE}(\s|$$) -> Continue + ^\s+${MEMBER_INTERFACE}\s+${RECEIVE_STATE}\s+${TRANSMIT_STATE}\s+${MUX_STATE}(\s|$$) ^\s*$$ ^Aggregated -> Continue.Record ^Aggregated\sinterface:\s${AGGREGATED_INTERFACE}(\s|$$) -> Start + ^{master:\d+} + ^. -> Error