I am trying to automate the retrieval of switch information (config, mac-address-table, lldp info) from an Avaya ERS 5000 using python and netmiko.
When opening an SSH session to the switch, Avaya requires that you enter Ctrl-Y to get to a text menu and then enter another key (c) to get to the CLI.
I have tried the following the code below, which yields a timeout exception. When I strip away the try/except, I see the following output.
As best I can tell from inserting print() statements at various places, the session is established and then times out.
Is there more info I can extract from the netmiko exception that would illuminate where this process is going wrong?
I'll admit up front that coding and I are very recent acquaintances and I may be missing the obvious.
-------------------------------------------------------------------------------
Connecting to switch
Traceback (most recent call last):
File "./netmiko-test4.py", line 24, in <module>
ssh_connection = netmiko.ConnectHandler(**avaya5000_ers)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/netmiko/ssh_dispatcher.py", line 100, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/netmiko/base_connection.py", line 144, in __init__
self.establish_connection()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/netmiko/base_connection.py", line 525, in establish_connection
raise NetMikoTimeoutException("Timed out waiting for data")
netmiko.ssh_exception.NetMikoTimeoutException: Timed out waiting for data
<<----begin code fragment---->>
from __future__ import unicode_literals
import netmiko
# Avaya presents Enter Ctrl-Y to begin.
CTRL_Y = '\x19'
avaya5000_ers = {
'device_type': 'avaya_ers',
'ip': 'a.b.c.d', #ip obscured for posting
'username': 'user1',
'password': 'password',
}
try:
ssh_connection = netmiko.ConnectHandler(**avaya5000_ers)
ssh_connection.write_channel(CTRL_Y)
ssh_connection.send_command('c')
print(ssh_connection.send_command('show clock')) #a test command
ssh_connection.disconnect()
except netmiko.ssh_exception.NetMikoTimeoutException:
print("timed out")