forked from MichaelCade/90DaysOfDevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netmiko_con_multi.py
46 lines (40 loc) · 970 Bytes
/
netmiko_con_multi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
#password = getpass()
R1 = {
"device_type": "cisco_ios",
"host": "192.168.169.115",
"username": "admin",
"password": "access123",
}
SW1 = {
"device_type": "cisco_ios",
"host": "192.168.169.178",
"username": "admin",
"password": "access123",
}
SW2 = {
"device_type": "cisco_ios",
"host": "192.168.169.193",
"username": "admin",
"password": "access123",
}
SW3 = {
"device_type": "cisco_ios",
"host": "192.168.169.125",
"username": "admin",
"password": "access123",
}
SW4 = {
"device_type": "cisco_ios",
"host": "192.168.169.197",
"username": "admin",
"password": "access123",
}
command = "show ip int brief"
for device in (R1, SW1, SW2, SW3, SW4):
net_connect = ConnectHandler(**device)
print(net_connect.find_prompt())
print(net_connect.send_command(command))
net_connect.disconnect()