From edd119096ea3fc3be0e492f9507107fda6022d84 Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Sun, 8 Mar 2020 19:38:10 -0600 Subject: [PATCH] Removed reliance on static spacing for cisco_ios_show_interfaces_status --- .../cisco_ios_show_interfaces_status.textfsm | 4 +- .../cisco_ios_show_interfaces_status.raw | 1 + .../cisco_ios_show_interfaces_status.yml | 151 +++++++++--------- 3 files changed, 82 insertions(+), 74 deletions(-) diff --git a/templates/cisco_ios_show_interfaces_status.textfsm b/templates/cisco_ios_show_interfaces_status.textfsm index 1e92d87fef..00f2c7e70f 100644 --- a/templates/cisco_ios_show_interfaces_status.textfsm +++ b/templates/cisco_ios_show_interfaces_status.textfsm @@ -13,5 +13,5 @@ Start ^Time\s+source\s+is Begin - ^(?=\s{0,9}${PORT}).{9}\s{20}${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record - ^(?=\s{0,9}${PORT}).{9}\s${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record + ^\s*${PORT}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record + ^\s*${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record diff --git a/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.raw b/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.raw index e6cc0468bf..a6f3180abe 100644 --- a/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.raw +++ b/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.raw @@ -16,4 +16,5 @@ Gi1/0/14 Half Duplex 2950-S notconnect 16 a-half auto Not Present Gi1/0/15 Multi Space to the notconnect 16 a-half auto 10/100BaseTX Gi1/0/16 Multi Space to the err-disabled 16 a-half auto 10/100BaseTX Gi1/0/17 Multi Space disabled 16 a-half auto 10/100BaseTX +Fa1/6 test notconnect 1 auto auto 10/100BaseTX Po1 ethchl connected trunk a-full a-1000 diff --git a/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.yml b/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.yml index 796c56168c..7a83f3c6aa 100644 --- a/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.yml +++ b/tests/cisco_ios/show_interfaces_status/cisco_ios_show_interfaces_status.yml @@ -1,128 +1,135 @@ --- parsed_sample: - - duplex: "auto" + - port: "Gi1/0/1" name: "" - port: "Gi1/0/1" - speed: "auto" status: "notconnect" - type: "10/100/1000BaseTX" vlan: "1" - - duplex: "a-full" + duplex: "auto" + speed: "auto" + type: "10/100/1000BaseTX" + - port: "Gi1/0/2" name: "AccessPoint" - port: "Gi1/0/2" - speed: "a-1000" status: "connected" - type: "10/100/1000BaseTX" vlan: "8" - - duplex: "auto" + duplex: "a-full" + speed: "a-1000" + type: "10/100/1000BaseTX" + - port: "Gi1/0/3" name: "John's Office" - port: "Gi1/0/3" - speed: "auto" status: "notconnect" - type: "10/100/1000BaseTX" vlan: "1" - - duplex: "a-full" + duplex: "auto" + speed: "auto" + type: "10/100/1000BaseTX" + - port: "Gi1/0/4" name: "SingleName" - port: "Gi1/0/4" - speed: "a-100" status: "connected" - type: "10/100/1000BaseTX" vlan: "1" - - duplex: "a-full" + duplex: "a-full" + speed: "a-100" + type: "10/100/1000BaseTX" + - port: "Gi1/0/5" name: "Dashed-Name" - port: "Gi1/0/5" - speed: "a-1000" status: "connected" - type: "10/100/1000BaseTX" vlan: "1000" - - duplex: "a-full" + duplex: "a-full" + speed: "a-1000" + type: "10/100/1000BaseTX" + - port: "Gi1/0/6" name: "Spaced Example" - port: "Gi1/0/6" - speed: "a-100" status: "connected" - type: "10/100/1000BaseTX" vlan: "8" - - duplex: "a-full" + duplex: "a-full" + speed: "a-100" + type: "10/100/1000BaseTX" + - port: "Gi1/0/7" name: "Trunk Example" - port: "Gi1/0/7" - speed: "a-1000" status: "connected" - type: "1000BaseSX SFP" vlan: "trunk" - - duplex: "auto" + duplex: "a-full" + speed: "a-1000" + type: "1000BaseSX SFP" + - port: "Gi1/0/8" name: "SFP Not Present" - port: "Gi1/0/8" - speed: "auto" status: "notconnect" - type: "Not Present" vlan: "1" - - duplex: "auto" - name: "SFP Not Present" - port: "Gi1/0/9" + duplex: "auto" speed: "auto" - status: "notconnect" type: "Not Present" + - port: "Gi1/0/9" + name: "SFP Not Present" + status: "notconnect" vlan: "1" - - duplex: "auto" - name: "Management" - port: "Gi1/0/10" + duplex: "auto" speed: "auto" + type: "Not Present" + - port: "Gi1/0/10" + name: "Management" status: "notconnect" - type: "10/100BaseTX" vlan: "routed" - - duplex: "a-half" - name: "2960S Port" - port: "Gi1/0/11" + duplex: "auto" speed: "auto" - status: "notconnect" type: "10/100BaseTX" + - port: "Gi1/0/11" + name: "2960S Port" + status: "notconnect" vlan: "16" - - duplex: "a-half" - name: "Half Duplex 2950" - port: "Gi1/0/12" + duplex: "a-half" speed: "auto" - status: "notconnect" type: "10/100BaseTX" + - port: "Gi1/0/12" + name: "Half Duplex 2950" + status: "notconnect" vlan: "16" - - duplex: "a-half" - name: "Half Duplex 2950-S" - port: "Gi1/0/13" + duplex: "a-half" speed: "auto" - status: "notconnect" type: "10/100BaseTX" - vlan: "16" - - duplex: "a-half" + - port: "Gi1/0/13" name: "Half Duplex 2950-S" - port: "Gi1/0/14" - speed: "auto" status: "notconnect" - type: "Not Present" vlan: "16" - - duplex: "a-half" - name: "Multi Space to the" - port: "Gi1/0/15" + duplex: "a-half" speed: "auto" - status: "notconnect" type: "10/100BaseTX" + - port: "Gi1/0/14" + name: "Half Duplex 2950-S" + status: "notconnect" vlan: "16" - - duplex: "a-half" + duplex: "a-half" + speed: "auto" + type: "Not Present" + - port: "Gi1/0/15" name: "Multi Space to the" - port: "Gi1/0/16" + status: "notconnect" + vlan: "16" + duplex: "a-half" speed: "auto" - status: "err-disabled" type: "10/100BaseTX" + - port: "Gi1/0/16" + name: "Multi Space to the" + status: "err-disabled" vlan: "16" - - duplex: "a-half" - name: "Multi Space" - port: "Gi1/0/17" + duplex: "a-half" speed: "auto" - status: "disabled" type: "10/100BaseTX" + - port: "Gi1/0/17" + name: "Multi Space" + status: "disabled" vlan: "16" - - duplex: "a-full" + duplex: "a-half" + speed: "auto" + type: "10/100BaseTX" + - port: "Fa1/6" + name: "test" + status: "notconnect" + vlan: "1" + duplex: "auto" + speed: "auto" + type: "10/100BaseTX" + - port: "Po1" name: "ethchl" - port: "Po1" - speed: "a-1000" status: "connected" - type: "" vlan: "trunk" + duplex: "a-full" + speed: "a-1000" + type: ""