This posts needs editing.. end to end connectivity is ok. But netmiko4.py script is not working.
- no neg?
Checking the files...
#!/usr/bin/env python
from netmiko import ConnectHandler
iosv_l2_s1 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.71',
'username': 'adrian',
'password': 'cisco',
}
iosv_l2_s2 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.72',
'username': 'adrian',
'password': 'cisco',
}
iosv_l2_s3 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.73',
'username': 'adrian',
'password': 'cisco',
}
iosv_l2_s4 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.74',
'username': 'adrian',
'password': 'cisco',
}
iosv_l2_s5 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.75',
'username': 'adrian',
'password': 'cisco',
}
with open('iosv_l2_access') as f:
lines = f.read().splitlines()
print lines
all_devices = [iosv_l2_s5, iosv_l2_s4, iosv_l2_s3, iosv_l2_s2, iosv_l2_s1]
for devices in all_devices:
net_connect = ConnectHandler(**devices)
output = net_connect.send_config_set(lines)
print output
+++
+++
Ensure no loop is happening. This will break the python script as seen below:
+++
'iosv_l2_config1' or 'iosv_l2_access' file
vlan 2
int range g2/0 - 3
switchport mode access
switchport access vlan 2
int range g0/0 - 3
switchport trunk encapsulation dot1q
switchport mode trunk
switchport nonegotiate
switchport trunk allowed vlan 1,2
spanning-tree link-type point-to-point --> makes link more stable, then SHR (shared)
int range g1/0 - 1
switchport trunk encapsulation dot1q
switchport mode trunk
switchport nonegotiate
switchport trunk allowed vlan 1,2
spanning-tree link-type point-to-point
No comments:
Post a Comment