You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Value Required NAME (.*?)
Value DESCR (.*)
Value PID (\S+)
Value VID (\S+)
Value SN (\S*)
Start
^NAME:\s+"${NAME}",\s+DESCR:\s+"${DESCR}"\s*$$
^\s*Name:\s+${NAME}\s+Descr:\s+${DESCR}\s*$$
^\s*PID:\s+${PID}\s*,\s+VID:\s+${VID}\s*,\s+SN:\s*${SN}$$ -> Record
^\s*PID:\s+${PID}\s+VID:\s+${VID}\s+SN:\s+${SN}$$ -> Record
#
^\s*$$
^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s\S{3}\s+\d
^. -> Error
SAMPLE COMMAND OUTPUT
$ python sh_ver_test.py
Traceback (most recent call last):
File "/test_scripts/sh_ver_test.py", line 45, in <module>
output = net_connect.send_command('admin show inventory', use_textfsm=True)
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/netmiko/utilities.py", line 592, in wrapper_decorator
return func(self, *args, **kwargs)
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/netmiko/base_connection.py", line 1798, in send_command
return_val = structured_data_converter(
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/netmiko/utilities.py", line 556, in structured_data_converter
structured_output_tfsm = get_structured_data_textfsm(
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/netmiko/utilities.py", line 379, in get_structured_data_textfsm
output = _textfsm_parse(textfsm_obj, raw_output, attrs)
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/netmiko/utilities.py", line 343, in _textfsm_parse
tfsm_parse(raw_output, attrs)
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/textfsm/clitable.py", line 282, in ParseCmd
self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/textfsm/clitable.py", line 315, in _ParseCmdItem
for record in fsm.ParseText(cmd_input):
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/textfsm/parser.py", line 895, in ParseText
self._CheckLine(line)
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/textfsm/parser.py", line 944, in _CheckLine
if self._Operations(rule, line):
File "/Users/rafi/netbot_env/lib/python3.10/site-packages/textfsm/parser.py", line 1024, in _Operations
raise TextFSMError('State Error raised. Rule Line: %s. Input Line: %s'
textfsm.parser.TextFSMError: State Error raised. Rule Line: 15. Input Line: PID: R-IOSXRV9000-CC VID: V01 SN: 767D97E4B21
SUMMARY
Every time I ran this command with netmiko along with ntc-template, I get above error regardless the version of iosxr, I looked into it and seen that this parser was fixed recently, even though it was improvised but yet it is broken. I can fix this via following changes in the template
Value Required NAME (.*?)
Value DESCR (.*?)
Value PID (\S+)
Value VID (\S+)
Value SN (\S*)
Start
^NAME:\s+"${NAME}",\s+DESCR:\s+"${DESCR}"\s*$$
^\s*Name:\s+${NAME}\s+Descr:\s+${DESCR}\s*$$
^\s*PID:\s+${PID}\s*,\s+VID:\s+${VID}\s*,\s+SN:\s*${SN} -> Record
^\s*PID:\s+${PID}\s+VID:\s+${VID}\s+SN:\s+${SN} -> Record
#
^\s*$$
^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s\S{3}\s+\d
^. -> Error
STEPS TO REPRODUCE
You can use following simple python script to reproduce it
ISSUE TYPE
TEMPLATE USING
SAMPLE COMMAND OUTPUT
SUMMARY
Every time I ran this command with netmiko along with ntc-template, I get above error regardless the version of iosxr, I looked into it and seen that this parser was fixed recently, even though it was improvised but yet it is broken. I can fix this via following changes in the template
STEPS TO REPRODUCE
You can use following simple python script to reproduce it
EXPECTED RESULTS
ACTUAL RESULTS
textfsm.parser.TextFSMError: State Error raised. Rule Line: 15. Input Line: PID: R-IOSXRV9000-CC VID: V01 SN: FOC1234PA56
The text was updated successfully, but these errors were encountered: