Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Create a list, called port _ list, It shall include all ports between 2 2 0 5 - 2 2 1 4 .

1. Create a list, called port_list, It shall include all ports between 2205-2214.
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
1. Example..... Port 12205
2. Create a program that reads from a list of port numbers to login to network devices.
a. Create a list called port_list that contains ports 2205-2214
b. Create a for loop that uses the len() of port_list as stop point
i. Loop shall connect to each device in port_list.
c. Create s dictionary named cisco that contains
i. Device_type
ii. Ip
iii. Username
iv. Password
v. Port (from port_list[])
d. Connect to each device in port_list
3. Conditionals
a. If statements with the less than operator to overwrite the device type.
b. Use an if statement to prevent attempts at port 2205
i. Use the continue statement
4. Exception Handling
a. Import Netmiko authenticaton and timeout exceptions
i. Dont 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.
5. Testing
a. Add a conditional that sets the password to CISCO for port 22013
b. Add an invalid port to the list, somewhere before the last element.
device login script
'''
devicelogin.py
a basic program to create an initial login to a cisco device
'''
from netmiko import ConnectHandler
device ={
'device_type': 'vyos',
'ip': '128.177.0.130',
'port':'2201',
'username': 'itsc1342',
'password': '1342itsc',
}
#create SSH socket to connect to device using the data in the library 'cisco'
net_connect = ConnectHandler(**device)
prompt=net_connect.find_prompt()
print(prompt)
Device NamePort Vendor Device_TypeType Model Username Password Inside IP Address
DLLS-COR12201 VYOS vyos Router itsc13421342itsc 172.16.10.3
DLLS-COR22202 VYOS vyos Router itsc13421342itsc 172.16.10.4
DLLS-DIS12203 VYOS vyos Router itsc13421342itsc 172.16.1.2
DLLS-DIS22204 VYOS vyos Router itsc13421342itsc 172.16.1.14
DLLS-ACC12205 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.101.1
DLLS-ACC22206 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.102.1
DLLS-ACC32207 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.103.1
FTW-COR12208 MikroTik mikrotik_routerosRouter itsc1342+t10000h1342itsc 172.16.10.5
FTW-COR22209 MikroTik mikrotik_routerosRouter itsc1342+t10000h1342itsc 172.16.10.6
FTW-DIS12210 MikroTik mikrotik_routerosRouter itsc1342+t10000h1342itsc 172.16.11.2
FTW-DIS22211 MikroTik mikrotik_routerosRouter itsc1342+t10000h1342itsc 172.16.11.14
FTW-ACC12212 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.111.1
FTW-ACC22213 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.112.1
FTW-ACC32214 Extreme Networksextreme_exosL3 Switch 8284XSQ itsc13421342itsc 172.16.113.1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

=+ Are they breakable for any reason?

Answered: 1 week ago