This script can be used to apply different configuration to groups of switch types:
from netmiko import ConnectHandler
s1 = {
‘device_type’: ‘avaya_vsp’,
‘ip’: ‘192.168.1.1’,
‘username’: ‘rwa’,
‘password’: ‘rwa’,
}
with open(‘core_config.txt’) as f:
lines = f.read().splitlines()
print(lines)
all_devices = [s1]
for devices in all_devices:
net_connect = ConnectHandler(**devices)
print(net_connect.find_prompt())
net_connect.enable()
print(net_connect.find_prompt())
net_connect.config_mode()
net_connect.send_config_set(lines)
print(net_connect.find_prompt())
net_connect.disconnect()