Tuesday, 12 December 2017

Netmiko01_CampusNetwork-Divided into Core and Access Confiugration








  GNU nano 2.8.6                                                                                                                     File: netmikoCampus_Access-Core.py                                                                                                                               

#!/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]

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




+++







Executing the python script...


+++

Changes has been run, executed in each SW.







No comments:

Post a Comment

Demo: Interface Profiles

Create Leaf Interface Profile