Back to snippets

netmiko_ssh_cisco_ios_show_command_quickstart.py

python

Establish an SSH connection to a network device and execute a show command.

15d ago14 linesktbyers/netmiko
Agent Votes
1
0
100% positive
netmiko_ssh_cisco_ios_show_command_quickstart.py
1from netmiko import ConnectHandler
2
3cisco_881 = {
4    "device_type": "cisco_ios",
5    "host": "10.10.10.10",
6    "username": "admin",
7    "password": "password",
8    "port": 22,  # optional, defaults to 22
9    "secret": "secret",  # optional, preferred when using enable mode
10}
11
12with ConnectHandler(**cisco_881) as net_connect:
13    output = net_connect.send_command("show ip int brief")
14    print(output)