cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
260
Views
0
Helpful
1
Replies

Netmiko and Cisco Switch

georefi
Level 1
Level 1

Hi everyone,

Here is the plan, assume we have a cisco switch 9200 never used before, is it possible to develop a python script using netmiko to connect to the switch using a serial cable, and authenticate with the default creds, and prompts me to set a hostname, username, password, and enable ssh. The idea i would like to get the swithces ready for ansible palybooks.

1 Reply 1

I think you can use NetMiko for this you would append "_serial" to your device type (this might not be supported for all device types, but it works on Cisco platforms and similar devices). Instead of providing a host/IP/port to ConnectHandler, use "serial_settings" = {"port": "/dev/ttyS01"}, replacing the port with your specific serial port. The "serial_settings" dictionary can also include values for baud rate, byte size, parity, and stop bits.

The other you can try is https://github.com/ktbyers/pynet/blob/master/serial/cisco_serial.py - never used this YMMV.

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io