Skip to content

Commit 9628d9e

Browse files
authored
Update NetmikoMultipleDevices
1 parent 4a234d9 commit 9628d9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

NetmikoMultipleDevices

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ from netmiko.ssh_exception import NetMikoTimeoutException
33
from paramiko.ssh_exception import SSHException
44
from netmiko.ssh_exception import AuthenticationException
55

6-
6+
#read text file with comands to run
77
def commands():
88
with open('commands') as f:
99
commands_to_send = f.read().splitlines()
1010
return commands_to_send
1111

12-
12+
#read text file with list of devices to iterate through
1313
def devices():
1414
with open('devices') as f:
1515
devices_list = f.read().splitlines()
1616
return devices_list
1717

18-
18+
#user input for username and password (for security use getpass)
1919
def user_pass():
2020
username = input("username: ")
2121
password = input("password: ")
2222
return username, password
2323

24-
24+
#Main loop to call devices
2525
def main():
2626
u, p = user_pass()
2727
for device in devices():
@@ -33,7 +33,7 @@ def main():
3333
'username': u,
3434
'password': p
3535
}
36-
36+
#netmiko ConnectHandler and connection error handling
3737
try:
3838
net_connect = ConnectHandler(**ios_device)
3939
except AuthenticationException:

0 commit comments

Comments
 (0)