Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Cisco IOS commands show vlan and show cdp neighbor have a lot of header and trailer information. See show vlan brief for vlan expectations

The Cisco IOS commands show vlan and show cdp neighbor have a lot of header and trailer information. See show vlan brief for vlan expectations
You will create two programs.
one to execute commands and print the output
login to a device
retrieve the output of show vlan, and show cdp neighbors
pass output of commands to functions
print the function returns
the other will have only the two functions
remove_header()
remove_trailer()
Both functions will require two arguments.
String data from show command
Delimiter
Each function will need to perform the following
Split the string to a list, using newline character(
) as delimiter.
Find the index position of the delimiter
Slice the list based on the delimiters index position
Convert the list back to the string using code similar to this:
Mystring =
For x in list:
Mystring +=\ n+ x
#mystring = mystring +\ n+ x
Return the list to the original function call
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

Fundamentals of Corporate Finance

Authors: Stephen A. Ross, Randolph W. Westerfield, Bradford D.Jordan

8th Edition

978-0073530628, 978-0077861629

Students also viewed these Databases questions