-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Problem with Catalyst 1300 - random detect pattern and noting more. #3474
Comments
That is not "ios_xr" i.e. your device_type is wrong. Also disabling of output paging is not working and there are ANSI escape codes are in the output? It is a bit unclear what the actual operating system of the catalyst 1300 is? You can try "cisco_ios", but you will need to figure out why Also you probably need to disable the output paging, from looking at the CLI manual for Cat 1300, it looks like `Example
Also need to set:
So your code should become: from netmiko import ConnectHandler
import logging
logging.basicConfig(filename="test.log", level=logging.DEBUG)
logger = logging.getLogger("netmiko")
net_connect = ConnectHandler(
host="192.168.10.1",
username="username",
password="password",
device_type="cisco_ios", # Note change
secret="", port=22,
)
net_connect.send_command("terminal datadump", expect_string=r"#")
net_connect.ansi_escape_codes = True
# Then try your "show" command using the "send_command" method. Let me know if this works and we can build a driver for this platform. Reference to notes on Operating System for Catalyst 1200 (and assume 1300): https://www.reddit.com/r/Cisco/comments/185xmg0/os_used_in_the_catalyst_1200/ |
Of course I would like you to create a driver for this platform, just tell me what I can help with. Code: from netmiko import ConnectHandler
import logging
logging.basicConfig(filename="test.log", level=logging.DEBUG)
logger = logging.getLogger("netmiko")
net_connect = ConnectHandler(host="192.168.10.1", username="username", password="password", device_type="cisco_ios", secret="", port=22, )
net_connect.send_command("terminal datadump", expect_string=r"#")
net_connect.ansi_escape_codes = True
net_connect.send_command("show ver")
net_connect.send_command("show interface status")
net_connect.disconnect() Result
Debug result |
@iniagolov Did that all work properly from an end-user perspective? |
>>> net_connect.send_command("show interface status")
'\n Flow Link Back Mdix\nPort Type Duplex Speed Neg ctrl State Pressure Mode\n-------- ------------ ------ ----- -------- ---- ----------- -------- -------\ngi1/0/1 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi1/0/2 1G-Copper -- -- -- -- Down -- -- \ngi1/0/3 1G-Copper -- -- -- -- Down -- -- \ngi1/0/4 1G-Copper -- -- -- -- Down -- -- \ngi1/0/5 1G-Copper -- -- -- -- Down -- -- \ngi1/0/6 1G-Copper -- -- -- -- Down -- -- \ngi1/0/7 1G-Copper -- -- -- -- Down -- -- \ngi1/0/8 1G-Copper -- -- -- -- Down -- -- \ngi1/0/9 1G-Copper -- -- -- -- Down -- -- \ngi1/0/10 1G-Copper -- -- -- -- Down -- -- \ngi1/0/11 1G-Copper -- -- -- -- Down -- -- \ngi1/0/12 1G-Copper -- -- -- -- Down -- -- \ngi1/0/13 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi1/0/14 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi1/0/15 1G-Copper -- -- -- -- Down -- -- \ngi1/0/16 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi1/0/17 1G-Copper -- -- -- -- Down -- -- \ngi1/0/18 1G-Copper -- -- -- -- Down -- -- \ngi1/0/19 1G-Copper -- -- -- -- Down -- -- \ngi1/0/20 1G-Copper -- -- -- -- Down -- -- \ngi1/0/21 1G-Copper -- -- -- -- Down -- -- \ngi1/0/22 1G-Copper -- -- -- -- Down -- -- \ngi1/0/23 1G-Copper Full 1000 Enabled Off Up Disabled On \ngi1/0/24 1G-Copper Full 1000 Enabled Off Up Disabled Off \nte1/0/1 10G-Fiber Full 10000 Disabled Off Up Disabled Off \nte1/0/2 10G-Fiber Full 10000 Disabled Off Up Disabled Off \ngi2/0/1 1G-Copper Full 1000 Enabled Off Up Disabled On \ngi2/0/2 1G-Copper -- -- -- -- Down -- -- \ngi2/0/3 1G-Copper -- -- -- -- Down -- -- \ngi2/0/4 1G-Copper -- -- -- -- Down -- -- \ngi2/0/5 1G-Copper -- -- -- -- Down -- -- \ngi2/0/6 1G-Copper -- -- -- -- Down -- -- \ngi2/0/7 1G-Copper -- -- -- -- Down -- -- \ngi2/0/8 1G-Copper -- -- -- -- Down -- -- \ngi2/0/9 1G-Copper -- -- -- -- Down -- -- \ngi2/0/10 1G-Copper -- -- -- -- Down -- -- \ngi2/0/11 1G-Copper -- -- -- -- Down -- -- \ngi2/0/12 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi2/0/13 1G-Copper -- -- -- -- Down -- -- \ngi2/0/14 1G-Copper -- -- -- -- Down -- -- \ngi2/0/15 1G-Copper -- -- -- -- Down -- -- \ngi2/0/16 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi2/0/17 1G-Copper -- -- -- -- Down -- -- \ngi2/0/18 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi2/0/19 1G-Copper -- -- -- -- Down -- -- \ngi2/0/20 1G-Copper -- -- -- -- Down -- -- \ngi2/0/21 1G-Copper -- -- -- -- Down -- -- \ngi2/0/22 1G-Copper -- -- -- -- Down -- -- \ngi2/0/23 1G-Copper Full 1000 Enabled Off Up Disabled Off \ngi2/0/24 1G-Copper -- -- -- -- Down -- -- \nte2/0/1 10G-Fiber Full 10000 Disabled Off Up Disabled Off \nte2/0/2 10G-Fiber Full 10000 Disabled Off Up Disabled Off \n\n Flow Link \nCh Type Duplex Speed Neg control State \n-------- ------- ------ ----- -------- ------- ----------- \nPo1 10G Full 10000 Enabled Off Up \nPo2 10G Full 10000 Enabled Off Up \nPo3 1G Full 1000 Enabled Off Up \nPo4 -- -- -- -- -- Not Present \nPo5 -- -- -- -- -- Not Present \nPo6 -- -- -- -- -- Not Present \nPo7 -- -- -- -- -- Not Present \nPo8 -- -- -- -- -- Not Present \nciscoS1#'
>>> work but this not work! >>> net_connect.send_command("show interface status", use_textfsm=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/base_connection.py", line 111, in wrapper_decorator
return_val = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/utilities.py", line 596, in wrapper_decorator
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/base_connection.py", line 1834, in send_command
return_val = structured_data_converter(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/utilities.py", line 560, in structured_data_converter
structured_output_tfsm = get_structured_data_textfsm(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/utilities.py", line 380, in get_structured_data_textfsm
output = _textfsm_parse(textfsm_obj, raw_output, attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/netmiko/utilities.py", line 344, in _textfsm_parse
tfsm_parse(raw_output, attrs)
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/textfsm/clitable.py", line 282, in ParseCmd
self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/textfsm/clitable.py", line 315, in _ParseCmdItem
for record in fsm.ParseText(cmd_input):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/textfsm/parser.py", line 895, in ParseText
self._CheckLine(line)
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/site-packages/textfsm/parser.py", line 944, in _CheckLine
if self._Operations(rule, line):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/networkmanager.tss.bg/.venv/lib/python3.11/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: 17. Input Line: Flow Link Back Mdix
>>> Debug
|
That doesn't work either from netmiko import ConnectHandler
import logging
logging.basicConfig(filename="test.log", level=logging.DEBUG)
logger = logging.getLogger("netmiko")
net_connect = ConnectHandler(host="192.168.10.1", username="networkmanager", password="N@Man390erp", device_type="cisco_ios", secret="", port=22, )
net_connect.send_command("terminal datadump", expect_string=r"#")
net_connect.ansi_escape_codes = True
net_connect.send_config_set('int gi1/0/3,no shutdown')
net_connect.disconnect() Result
Debug |
TextFSM likely won't wors as Catalyst 1300 is not really IOS so parsing will fail. |
This is not valid syntactically:
You need to provide a list of commands i.e. cmds = ['int gi1/0/3', 'no shutdown']
net_connect.send_config_set(cmds) |
Netmiko version
Netmiko device_type (if relevant to the issue)
======
Code
Error Traceback
======
Code
Error Traceback
======
Litle info from switch
The text was updated successfully, but these errors were encountered: