Jun-07-2021, 04:25 AM
Help Please. This is my first time attempting Python. My testing lab has 4 Ethernet interfaces E0/0-3 on my Router. I am writing a script to shutdown all interfaces at 1900 hrs.
My script only shuts down E0/0 no others. Please would some tell me what I am doing wrong, and possibly giving me some pointers on how to input the time variables? I have uploaded my script for review.
netshud.py
Cris
My script only shuts down E0/0 no others. Please would some tell me what I am doing wrong, and possibly giving me some pointers on how to input the time variables? I have uploaded my script for review.
netshud.py
from netmiko import ConnectHandler import subprocess Network_Device ={"host": "192.168.2.119", "username": "admin", "password": "cisco", "device_type": "cisco_ios", "secret": "cisco", } Connent_to_Device = ConnectHandler(**Network_Device) Connent_to_Device.enable() First_Port = 0 Last_Port = 3 To_Execute = Connent_to_Device.send_command("sh ip interface brief") print(To_Execute) for Port in range(First_Port, (Last_Port +1)): List_of_Commands = ["interface eth 0/0" + str(Port), "shut"] To_Execute = Connent_to_Device.send_config_set(List_of_Commands) print(To_Execute) To_Execute = Connent_to_Device.send_command("sh ip interface brief") print(To_Execute)Thank
Cris