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
But when I change prompt and go into config mode i get the below, but I do end up in config mode:
>>> session.config_mode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/cisco_base_connection.py", line 49, in config_mode
return super().config_mode(
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/base_connection.py", line 2011, in config_mode
raise ValueError("Failed to enter configuration mode.")
ValueError: Failed to enter configuration mode.
>>> session.find_prompt()
'H-TXA-2W-AP-1 (config) #'
And when i exit_config_mode nothing changes until i send_command
>>> session.exit_config_mode()
''
>>> session.find_prompt()
'H-TXA-2W-AP-1 (config) #'
>>> session.send_command(command_string="exit")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/utilities.py", line 592, in wrapper_decorator
return func(self, *args, **kwargs)
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/base_connection.py", line 1721, in send_command
raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout:
Pattern not detected: 'H\\-TXA\\-2W\\-AP\\-1\\ \\(config\\)\\ \\#' in output.
Things you might try to fix this:
1. Explicitly set your pattern using the expect_string argument.
2. Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.
>>> session.find_prompt()
'H-TXA-2W-AP-1#'
Cant understand why I am getting the above errors. # is there but with a space before it. Im guesing that's why it's erroring out?
>>> session.config_mode(pattern=" #")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/cisco_base_connection.py", line 49, in config_mode
return super().config_mode(
File "/home/dmacias/dave-dev-environment/lib64/python3.9/site-packages/netmiko/base_connection.py", line 2011, in config_mode
raise ValueError("Failed to enter configuration mode.")
ValueError: Failed to enter configuration mode.
>>> session.exit_config_mode(exit_config="exit", pattern="#")
''
>>> session.find_prompt()
'H-TXA-2W-AP-1 (config) #'
How can i avoid the erros? I've tried the below with no success.
Any input is appreciated
Thank you,
Dave
EDIT*
Forgot to add the debug
session.config_mode()
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
H-TXA-2W-AP-1#
DEBUG:netmiko:Pattern found: ([>#])
H-TXA-2W-AP-1#
DEBUG:netmiko:write_channel: b'configure terminal\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel: configure terminal
We now support CLI commit model, please type "commit apply" for configuration to take effect.
H-TXA-2W-AP-1 (config) #
DEBUG:netmiko:Pattern found: (configure\ terminal) configure terminal
DEBUG:netmiko:read_channel:
DEBUG:netmiko:Pattern found: (H\-TXA\-2W\-AP\-1.*)
We now support CLI commit model, please type "commit apply" for configuration to take effect.
H-TXA-2W-AP-1 (config) #
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
H-TXA-2W-AP-1 (config) #
DEBUG:netmiko:Pattern found: ([>#])
H-TXA-2W-AP-1 (config) #
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
First-time poster here!
Trying to understand how the prompt is detected.
I have the below-working fine. I can send commands, no problem.
But when I change prompt and go into config mode i get the below, but I do end up in config mode:
And when i
exit_config_mode
nothing changes until isend_command
Cant understand why I am getting the above errors.
#
is there but with aspace
before it. Im guesing that's why it's erroring out?How can i avoid the erros? I've tried the below with no success.
Any input is appreciated
Thank you,
Dave
EDIT*
Forgot to add the debug
session.config_mode()
session.exit_config_mode()
Beta Was this translation helpful? Give feedback.
All reactions