Question: Create a list, called port _ list, It shall include all ports between 2 2 0 5 - 2 2 1 4 . a .
Create a list, called portlist, It shall include all ports between
a Create a loop that iterates through each list element
i Use the function len to stop the loop
ii Print "port", list position # and port number of each list item
Example..... Port
Create a program that reads from a list of port numbers to login to network devices.
a Create a list called portlist that contains ports
b Create a for loop that uses the len of portlist as stop point
i Loop shall connect to each device in portlist.
c Create s dictionary named cisco that contains
i Devicetype
ii Ip
iii. Username
iv Password
v Port from portlist
d Connect to each device in portlist
Conditionals
a If statements with the less than operator to overwrite the device type.
b Use an if statement to prevent attempts at port
i Use the continue statement
Exception Handling
a Import Netmiko authenticaton and timeout exceptions
i Don't forget the general exception Clause
b Use a try and exept block to catch exceptions so loop continues to operate
i Use a print statement to notify user that an error has occurred.
Testing
a Add a conditional that sets the password to 'CISCO' for port
b Add an invalid port to the list, somewhere before the last element.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
