Question: Using the below python code: from get _ ospf _ function import get _ exos _ ospf _ neighbors, get _ mikrotik _ ospf _

Using the below python code:
from get_ospf_function import get_exos_ospf_neighbors, get_mikrotik_ospf_neighbors,
get_vyos_ospf_neighbors
address='192.168.7.2'
location = input('Are you on campus? (y/n)')
if location=='n'or'N':
address ='128.177.0.130'
# Get port number from user
port = input('Enter port number of device ')
# Get device type from user
print('Enter 1 for Mikrotik')
print('Enter 2 for Extreme Networks')
print('Enter 3 for Vyos')
selection = input('Enter Number: ')
# identify device_type from user input
device_type='vyos'
if selection =='1':
device_type='mikrotik_routeros'
if selection =='2':
device_type='extreme_exos'
print('Device Type is '+ device_type)
print('IP address is '+ address)
print('Port number is '+ port)
#Call appropriate Function
if device_type == 'vyos':
ospf=get_vyos_ospf_neighbors(address,port)
elif device_type == 'mikrotik_routeros':
ospf=get_mikrotik_ospf_neighbors(address,port)
else:
ospf=get_exos_ospf_neighbors(address,port)
print(ospf)
write a module named get_ospf_function.py. Within the module you will create three functions.
You will pass IP address and Port information into each function.
each function will create a connection and return the ospf neighbors informaiton.
get_exos_ospf_neighbors() uses the command 'show ospf neigbor'
get_vyos_ospf_neighbors() uses the command 'show ip ospf neighbor'
get_mikrotik_ospf_neighbors() uses the command 'routing ospf neighbor print'
You can use the following code to create your connection.
device ={
'device_type': 'mikrotik_routeros',
'ip': 128.177.0.130
'port': port #
'username': 'itsc1342',
'password': '1342itsc',
}
#create SSH socket to connect to device using the data in the library 'device'
net_connect = ConnectHandler(**device)
prompt=net_connect.find_prompt()
print(prompt)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!