-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnetmiko.python3b.py
More file actions
55 lines (48 loc) · 1.13 KB
/
Copy pathnetmiko.python3b.py
File metadata and controls
55 lines (48 loc) · 1.13 KB
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
from netmiko import ConnectHandler
Core1 = {
'device_type': 'cisco_ios',
'ip': '192.168.6.40',
'username': 'cisco',
'password': 'cisco',
}
Core2 = {
'device_type': 'cisco_ios',
'ip': '192.168.6.41',
'username': 'cisco',
'password': 'cisco',
}
Leaf1 = {
'device_type': 'cisco_ios',
'ip': '192.168.6.42',
'username': 'cisco',
'password': 'cisco',
}
Leaf2 = {
'device_type': 'cisco_ios',
'ip': '192.168.6.43',
'username': 'cisco',
'password': 'cisco',
}
Leaf3 = {
'device_type': 'cisco_ios',
'ip': '192.168.6.44',
'username': 'cisco',
'password': 'cisco',
}
all_devices = [Core1, Core2, Leaf1, Leaf2, Leaf3]
for devices in all_devices:
net_connect = ConnectHandler(**devices)
for n in range (2,21):
print ("Creating VLAN " + str(n))
config_commands = ['no vlan ' + str(n)]
output = net_connect.send_config_set(config_commands)
print (output)
output = net_connect.send_command(
"show ip int br"
)
print(output)
output = net_connect.send_command(
"show vlan"
)
print(output)
net_connect.save_config()