cisco_ios failure to parse "show boot" command on new IOS version 15.2.6 (3560cx switch)
Closed this issue · 4 comments
bskine commented
ISSUE TYPE
- Template Issue with error and raw data
TEMPLATE USING
STEPS TO REPRODUCE
cmd = ["show boot"]
try:
net_connect = ConnectHandler(**device)
show = net_connect.send_command(cmd, use_textfsm=True)
pprint(show)
except (ReadTimeout, NetmikoTimeoutException) as error:
print(f"{error} Connection timed out to {device['host']}")
except NetmikoAuthenticationException as error:
print(f"{error} Authentication failed to {device['host']}")
except (IndexError, ValueError) as error:
print(f"{error} {device['host']} had a problem parsing the output")
EXPECTED RESULTS
Would return formatted data like every other command using textfsm??? show version/sh int status/sh clock/sh vlan brief works
ACTUAL RESULTS
State error raised
Traceback (most recent call last):
File "C:\Users\pboynto\PycharmProjects\NetMiko\single_tasks\simple_show_command.py", line 24, in <module>
show = net_connect.send_command(cmd, use_textfsm=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\netmiko\utilities.py", line 592, in wrapper_decorator
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\netmiko\base_connection.py", line 1729, in send_command
return_val = structured_data_converter(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\netmiko\utilities.py", line 556, in structured_data_converter
structured_output_tfsm = get_structured_data_textfsm(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\netmiko\utilities.py", line 379, in get_structured_data_textfsm
output = _textfsm_parse(textfsm_obj, raw_output, attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\netmiko\utilities.py", line 343, in _textfsm_parse
tfsm_parse(raw_output, attrs)
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\textfsm\clitable.py", line 282, in ParseCmd
self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\textfsm\clitable.py", line 315, in _ParseCmdItem
for record in fsm.ParseText(cmd_input):
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\textfsm\parser.py", line 897, in ParseText
self._CheckLine(line)
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\textfsm\parser.py", line 946, in _CheckLine
if self._Operations(rule, line):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\pboynto\PycharmProjects\NetMiko\venv\Lib\site-packages\textfsm\parser.py", line 1026, in _Operations
raise TextFSMError('State Error raised. Rule Line: %s. Input Line: %s'
textfsm.parser.TextFSMError: State Error raised. Rule Line: 46. Input Line: Boot optimization : disabled
itdependsnetworks commented
please provide the output of the command
mjbear commented
The white space in the show boot
output changed during a Cisco IOS release.
Currently:
^Boot\soptimization\s:\s${BOOT_OPTIMIZATION}
Suggested:
^Boot\s+optimization\s+:\s+${BOOT_OPTIMIZATION}
I'm working up a PR for this.
mjbear commented
ryanmerolle commented
This was merged, please close issue.