I am trying to create an automation which manages Avocent ACS800/8000 and Avocent ACS600/6000 console servers. I chose Netmiko as the SSH library. Now my problem is, Netmiko doesn't support these devices specifically, but it supports Linux in general. There is an embedded Linux system on these servers.
My main problem is, the base prompt on these devices look like this: --:- / cli->
.
Netmiko expects either "#" or "$" as the last character of the prompt.
from netmiko import ConnectHandler
from cfslibconfig import CfsLibConfig
def get_session(config):
device= {
"host": config.get_config_key('console_host'),
"username": config.get_config_key('console_username'),
"password": config.get_config_key('console_password'),
"device_type": "linux",
"session_log": "netmiko_session.log",
"auto_connect": False
}
session = ConnectHandler(**device)
session.establish_connection()
session.set_base_prompt(alt_prompt_terminator=">")
I was trying to do it like this, but always get this exception on the last line:
**Exception has occurred: ReadTimeout
Pattern not detected: '[\\$\\#]' in output.
Things you might try to fix this:
1. Adjust the regex pattern to better identify the terminating string. Note, in
many situations the pattern is automatically based on the network device's prompt.
2. Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.
File "/local/repo/console-port/scripts/common.py", line 19, in get_session
session.set_base_prompt(alt_prompt_terminator=">")
File "/local/repo/console-port/scripts/new_group.py", line 6, in <module>
session = get_session(config)
^^^^^^^^^^^^^^^^^^^
netmiko.exceptions.ReadTimeout:
Pattern not detected: '[\\$\\#]' in output.
Things you might try to fix this:
1. Adjust the regex pattern to better identify the terminating string. Note, in
many situations the pattern is automatically based on the network device's prompt.
2. Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.**
Isn't the entire purpose of the set_base_prompt function to change that pattern??
Netmiko "supports" Linux in the sense that it has built-in prompts and commands for the standard Linux CLI (e.g. bash). A device which runs on the Linux kernel but has a custom CLI is not really "Linux" as far as Netmiko is concerned. I can't say for sure without seeing the debug output, but my opinion is that Netmiko is probably trying to disable pagination or widen the terminal or do some other Linux-specific session preparation which the Avocent CLI does not support.
For unsupported CLIs, try using "generic" as the device type, which sets up an SSH connection without any builtin prompt detections or session preparation.
Also, you can use "find_prompt" with no arguments. It sends a newline and marks whatever returns as prompt.