-
Notifications
You must be signed in to change notification settings - Fork 224
/
netmiko5.py
64 lines (48 loc) · 1.21 KB
/
netmiko5.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
from netmiko import ConnectHandler
iosv_l2_s1 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.71',
'username': 'david',
'password': 'cisco',
}
iosv_l2_s2 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.72',
'username': 'david',
'password': 'cisco',
}
iosv_l2_s3 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.73',
'username': 'david',
'password': 'cisco',
}
iosv_l2_s4 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.74',
'username': 'david',
'password': 'cisco',
}
iosv_l2_s5 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.75',
'username': 'david',
'password': 'cisco',
}
with open('iosv_l2_cisco_design') as f:
lines = f.read().splitlines()
print lines
all_devices = [iosv_l2_s5, iosv_l2_s4, iosv_l2_s3]
for devices in all_devices:
net_connect = ConnectHandler(**devices)
output = net_connect.send_config_set(lines)
print output
with open('iosv_l2_core') as f:
lines = f.read().splitlines()
print lines
all_devices = [iosv_l2_s2, iosv_l2_s1]
for devices in all_devices:
net_connect = ConnectHandler(**devices)
output = net_connect.send_config_set(lines)
print output