Closed jftuga closed 7 years ago
Okay, looking into this...
After looking at this in conversation with @ktbyers on Slack, I can confirm that EdgeOS is behaviorally similar to VyOS, and we'd need to have similar behavior as listed in the VyOS class where we don't attempt to Enable, etc. The #
prompt only appears in Configure mode (configure
) and when sudo'ed to root (sudo su
).
The existing Ubiquiti child class doesn't override the default actions around entering Enable mode as shown in the parent Cisco Base Connection class.
One potential solution would just be to have the EdgeOS class inherit from VyOS instead of the Cisco Base Class. The behaviors of EdgeOS and VyOS are functionally very similar as they both came from the same root software, Vyatta.
I can confirm the prompt issue is now fixed. Thank you.
The next issue is that my script will hang after this:
cmd = "configure"
net_connect.send_command(cmd)
I believe this is because the prompt changes from '$' to '#' and netmiko is waiting for a '$' but will never get it. How can I fix this?
File "C:\Python35\lib\site-packages\netmiko\base_connection.py", line 815, in send_command
search_pattern))
OSError: Search pattern never detected in send_command_expect: ubnt\@ubnt\:\~\$
@jftuga You don't want to send configure
as a command, you need to use the other method on net_connect, net_connect.send_config_set()
, to get into configuration mode, Example:
config_list = ['set interface ethernet eth1 blah']
net_connect.send_config_set(config_list)
If you just want to view config that's when you'd use net_connect.send_command()
:
command_list = ['terminal length 9999','show configuration all']
for command in command_list:
net_connect.send_command(command)
If you use send_config_set
it has handling for $
vs #
built in.
Using send_config_set
work for me. I am now able to output the config.
Thank you!
How can I drop into vshell with netmiko on viptela?
I am using device_type=ubiquiti_edge but my edge router has a different default prompt. I just installed the latest firmware on my EgdeRouter Lite 3 (v1.9.1.1).
When I ssh in, my shell prompt look like this:
I can then type 'configure' which will change the prompt:
I am initiating a connection like this:
I get this error:
How can I call something like the code below before the ConnectHandler actually makes the SSH connection so that the prompt is set correctly beforehand?
Ideally, the full set of commands I want to run are:
Notice that after the 'configure' command, the prompt changes and then it will change back after the 'exit' command is issued. The 'exit' command does not log off, it just exits the configure mode.