Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cisco nxos show interface status issue when FC ports are present #788

Closed
zedz0 opened this issue Aug 8, 2020 · 2 comments
Closed

cisco nxos show interface status issue when FC ports are present #788

zedz0 opened this issue Aug 8, 2020 · 2 comments

Comments

@zedz0
Copy link

zedz0 commented Aug 8, 2020

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk|--)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (\S+|\S+\s+\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

--------------------------------------------------------------------------------
Port          Name               Status    Vlan      Duplex  Speed   Type
--------------------------------------------------------------------------------
fc2/1 is up    Port mode is NP
fc2/2 is up    Port mode is NP
fc2/3 is up    Port mode is NP
fc2/4 is up    Port mode is NP
fc2/5 is down (SFP not present)
fc2/6 is down (SFP not present)
Eth1/1        XXXXXXX1_bond1_Act connected 111       full    1000    SFP-1000BAS
Eth1/2        XXXXXXX3_bond1_Act connected 112       full    1000    SFP-1000BAS
Eth1/3        YYYYYYYY1_ha1      connected 115       full    1000    SFP-1000BAS
Eth1/4        ZZZZZZZZZZZZZ1_tru connected trunk     full    10G     10Gbase-SR
Eth1/5        ZZZZZZZZZZZZZ1_tru connected trunk     full    10G     10Gbase-SR
Eth1/6        AAAAAAAAA1_po2     connected trunk     full    1000    SFP-1000BAS
Eth1/7        BBBBBBBB10-1       connected 4093      full    10G     Fabric Exte
Eth1/8        BBBBBBBB10-1       connected 4093      full    10G     Fabric Exte
Eth1/9        BBBBBBBB11-1       connected 4093      full    10G     Fabric Exte
Eth1/10       BBBBBBBB11-1       connected 4093      full    10G     Fabric Exte

SUMMARY

Parsing fails when fc ports are present in output

STEPS TO REPRODUCE
    nr = InitNornir(config_file='nr-inventory.yml')
    result = nr.run(task=netmiko_send_command, command_string='show int status', use_textfsm=True)
    print_result(result)
EXPECTED RESULTS

Parsing without errors. Info about fc ports is desirable, but not mandatory if it is hard to implement.

ACTUAL RESULTS
Host 'HHHHHHHHK3': task 'netmiko_send_command' failed with traceback:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/nornir/core/task.py", line 85, in start
    r = self.task(self, **self.params)
  File "/usr/local/lib/python3.6/site-packages/nornir/plugins/tasks/networking/netmiko_send_command.py", line 32, in netmiko_send_command
    result = net_connect.send_command(command_string, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 347, in wrapper_decorator
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1448, in send_command
    template=textfsm_template,
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 280, in get_structured_data
    return _textfsm_parse(textfsm_obj, raw_output, attrs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 252, in _textfsm_parse
    textfsm_obj.ParseCmd(raw_output, attrs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 272, in ParseCmd
    self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
  File "/usr/local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 303, in _ParseCmdItem
    for record in fsm.ParseText(cmd_input):
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 895, in ParseText
    self._CheckLine(line)
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 944, in _CheckLine
    if self._Operations(rule, line):
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 1025, in _Operations
    % (rule.line_num, line))
textfsm.parser.TextFSMError: State Error raised. Rule Line: 14. Input Line: fc2/1 is up    Port mode is NP

netmiko_send_command************************************************************
* HHHHHHHHK3 ** changed : False ************************************************
vvvv netmiko_send_command ** changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ERROR
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/nornir/core/task.py", line 85, in start
    r = self.task(self, **self.params)
  File "/usr/local/lib/python3.6/site-packages/nornir/plugins/tasks/networking/netmiko_send_command.py", line 32, in netmiko_send_command
    result = net_connect.send_command(command_string, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 347, in wrapper_decorator
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1448, in send_command
    template=textfsm_template,
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 280, in get_structured_data
    return _textfsm_parse(textfsm_obj, raw_output, attrs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/utilities.py", line 252, in _textfsm_parse
    textfsm_obj.ParseCmd(raw_output, attrs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 272, in ParseCmd
    self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
  File "/usr/local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 303, in _ParseCmdItem
    for record in fsm.ParseText(cmd_input):
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 895, in ParseText
    self._CheckLine(line)
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 944, in _CheckLine
    if self._Operations(rule, line):
  File "/usr/local/lib/python3.6/site-packages/textfsm/parser.py", line 1025, in _Operations
    % (rule.line_num, line))
textfsm.parser.TextFSMError: State Error raised. Rule Line: 14. Input Line: fc2/1 is up    Port mode is NP

^^^^ END netmiko_send_command ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@diepes
Copy link
Contributor

diepes commented Dec 7, 2020

@zedz0 can you confirm if it's fixed now ?

@FragmentedPacket
Copy link
Contributor

Fixed via #839, but not confirmed by user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants