Answered step by step
Verified Expert Solution
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 getospffunction import getexosospfneighbors, getmikrotikospfneighbors,
getvyosospfneighbors
address
location inputAre you on campus? yn
if location'n'or'N':
address
# Get port number from user
port inputEnter port number of device
# Get device type from user
printEnter for Mikrotik'
printEnter for Extreme Networks'
printEnter for Vyos'
selection inputEnter Number:
# identify devicetype from user input
devicetype'vyos'
if selection :
devicetype'mikrotikrouteros'
if selection :
devicetype'extremeexos'
printDevice Type is devicetype
printIP address is address
printPort number is port
#Call appropriate Function
if devicetype 'vyos':
ospfgetvyosospfneighborsaddressport
elif devicetype 'mikrotikrouteros':
ospfgetmikrotikospfneighborsaddressport
else:
ospfgetexosospfneighborsaddressport
printospf
write a module named getospffunction.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.
getexosospfneighbors uses the command 'show ospf neigbor'
getvyosospfneighbors uses the command 'show ip ospf neighbor'
getmikrotikospfneighbors uses the command 'routing ospf neighbor print'
You can use the following code to create your connection.
device
'devicetype': 'mikrotikrouteros',
ip:
'port': port #
'username': 'itsc
'password': itsc',
#create SSH socket to connect to device using the data in the library 'device'
netconnect ConnectHandlerdevice
promptnetconnect.findprompt
printprompt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started