mirror of
https://github.com/MichaelCade/90DaysOfDevOps.git
synced 2025-07-21 05:11:22 +07:00
Day 27 - Getting Hands-On with Python & Network
This commit is contained in:
19
Days/Networking/netmiko_sendchange.py
Normal file
19
Days/Networking/netmiko_sendchange.py
Normal file
@ -0,0 +1,19 @@
|
||||
from netmiko import ConnectHandler
|
||||
|
||||
SW2 = {
|
||||
"device_type": "cisco_ios",
|
||||
"host": "192.168.169.193",
|
||||
"username": "admin",
|
||||
"password": "access123",
|
||||
"secret": "access123",
|
||||
}
|
||||
|
||||
core_sw_config = ["int range gig0/1 - 2", "switchport trunk encapsulation dot1q",
|
||||
"switchport mode trunk", "switchport trunk allowed vlan 1,2"]
|
||||
|
||||
print("########## Connecting to Device {0} ############".format(SW2))
|
||||
net_connect = ConnectHandler(**SW2)
|
||||
net_connect.enable()
|
||||
|
||||
print("***** Sending Configuration to Device *****")
|
||||
net_connect.send_config_set(core_sw_config)
|
Reference in New Issue
Block a user