Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

13-24. What does a marketing manager do?

Answered: 1 week ago

Question

1. What does this mean for me?

Answered: 1 week ago

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago