networktocode/ntc-templates

Add "suspended" state compatibility to cisco_ios_show_interfaces_status

georgealmg opened this issue · 2 comments

ISSUE TYPE
  • Feature Idea: add suspended as a posible value in cisco_ios_show_interfaces_status.
TEMPLATE USING

Value PORT (\S+)
Value NAME (.+?)
Value STATUS (err-disabled|disabled|connected|notconnect|inactive|up|down|monitoring)
Value VLAN (\S+)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (.*)
Value FC_MODE (\S+)

Start
^Load\s+for\s+

Capture time-stamp if vty line has command time-stamping turned on

^Time\s+source\s+is
^-+\s*$$
^Port\s+Name\s+Status\s+Vlan\s+Duplex\s+Speed\s+Type -> Interfaces
^\s*$$
^. -> Error

Interfaces
#Match fc...
^\s*${PORT}\s+is\s+${STATUS}\s+Port\s+mode\s+is\s+${FC_MODE}\s*$$ -> Record
^\s*${PORT}\s+is\s+${STATUS}\s+(${TYPE})\s*$$ -> 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
^-+
^\s*$$
^. -> Error

SAMPLE COMMAND OUTPUT

cdlv-0204-4948-ACC19#show inter status

Port Name Status Vlan Duplex Speed Type
Gi1/1 *** IBM U370 / IP: suspended 22 full 1000 10/100/1000-TX

SUMMARY

When I tried to use the cisco_ios_show_interfaces_status template in a IOS device with a suspended interface I got an exception, I fixed the issue by adding suspended as a possible value.

STEPS TO REPRODUCE

Use the referenced template in a IOS device with an interface in suspended state.

EXPECTED RESULTS

[{'port': 'Gi1/1', 'name': '*** IBM U370 / IP:', 'status': 'suspended', 'vlan': '22', 'duplex': 'full', 'speed': '1000', 'type': '10/100/1000-TX', 'fc_mode': ''}]

ACTUAL RESULTS

raise TextFSMError('State Error raised. Rule Line: %s. Input Line: %s'
textfsm.parser.TextFSMError: State Error raised. Rule Line: 27. Input Line: Gi1/1 *** IBM U370 / IP: suspended 22 full 1000 10/100/1000-TX

@georgealmg just checking on the closure of this. If it is from a response perspective, we generally wait a bit to see if the person opening the issue is working on creating the fix.

Hi!

The issue was solved 21 days ago so I proceeded to close the issue.