networktocode / ntc-templates

TextFSM templates for parsing show commands of network devices
https://ntc-templates.readthedocs.io/
Other
1.11k stars 723 forks source link

nxos show interface status issue #426

Closed antoinekh closed 5 years ago

antoinekh commented 5 years ago

ISSUE TYPE

TEMPLATE USING
Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk|--)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (\S+)

Start
  ^${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
  ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$
  ^-+\s*$$
  ^$$
^.*$$ -> Error
SAMPLE COMMAND OUTPUT
n5K# sh int status

--------------------------------------------------------------------------------
Port          Name               Status    Vlan      Duplex  Speed   Type
--------------------------------------------------------------------------------
Eth1/1        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/2        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/3        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/4        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/5        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/6        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/7        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/8        upk peerLink_XXXX connected trunk     full    10G     10Gbase-SR
Eth1/9        --                 channelDo 1         full    10G     Fabric Exte
Eth1/10       --                 channelDo 1         full    10G     Fabric Exte
Eth1/11       --                 channelDo 1         full    10G     Fabric Exte
Eth1/12       --                 channelDo 1         full    10G     Fabric Exte
Eth1/13       upk N2232PP-651-10 connected 1         full    10G     Fabric Exte
SUMMARY

State error raised on line where type is Fabric Extender It works fine on all Nexus Without Fabric Extender

STEPS TO REPRODUCE
EXPECTED RESULTS

No error

ACTUAL RESULTS
  File "upgrade.py", line 162, in <module>
    before = net_conn.send_command("sh int status", use_textfsm=True)
  File "/home/antoine/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1307, in send_command
    output, platform=self.device_type, command=command_string.strip()
  File "/home/antoine/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 238, in get_structured_data
    textfsm_obj.ParseCmd(raw_output, attrs)
  File "/home/antoine/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 266, in ParseCmd
    self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
  File "/home/antoine/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 297, in _ParseCmdItem
    for record in fsm.ParseText(cmd_input):
  File "/home/antoine/.local/lib/python3.6/site-packages/textfsm.py", line 885, in ParseText
    self._CheckLine(line)
  File "/home/antoine/.local/lib/python3.6/site-packages/textfsm.py", line 908, in _CheckLine
    if self._Operations(rule, line):
  File "/home/antoine/.local/lib/python3.6/site-packages/textfsm.py", line 989, in _Operations
    % (rule.line_num, line))
textfsm.TextFSMError: State Error raised. Rule Line: 14. Input Line: Eth1/9        --                 channelDo 1         full    10G     Fabric Exte
-->
antoinekh commented 5 years ago

Thanks a lot