forked from davidbombal/pythonvideos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetmiko1.py
More file actions
26 lines (20 loc) · 664 Bytes
/
netmiko1.py
File metadata and controls
26 lines (20 loc) · 664 Bytes
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
#!/usr/bin/env python
from netmiko import ConnectHandler
iosv_l2 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.72',
'username': 'david',
'password': 'cisco',
}
net_connect = ConnectHandler(**iosv_l2)
#net_connect.find_prompt()
output = net_connect.send_command('show ip int brief')
print output
config_commands = ['int loop 0', 'ip address 1.1.1.1 255.255.255.0']
output = net_connect.send_config_set(config_commands)
print output
for n in range (2,21):
print "Creating VLAN " + str(n)
config_commands = ['vlan ' + str(n), 'name Python_VLAN ' + str(n)]
output = net_connect.send_config_set(config_commands)
print output