𝗙𝗼𝗿 𝗖𝗼𝗺𝗽𝗹𝗲𝘁𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 𝗙𝗼𝗿 𝗡𝗲𝘁𝘄𝗼𝗿𝗸 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀 𝗖𝗼𝘂𝗿𝘀𝗲:
𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗯𝗲𝗹𝗼𝘄 𝗨𝗱𝗲𝗺𝘆 𝗖𝗹𝗮𝘀𝘀: 𝟐𝟎𝟐𝟐 𝐕𝐞𝐫𝐬𝐢𝐨𝐧
𝑫𝒊𝒔𝒄𝒐𝒖𝒏𝒕𝒆𝒅 𝑹𝒆𝒇𝒆𝒓𝒓𝒂𝒍 𝑳𝒊𝒏𝒌:
https://www.udemy.com/course/python-f... How to search for Cisco interfaces IP address from the dictionaries and list from using List comprehension in python.
from netmiko import ConnectHandler
from operator import itemgetter
ip = input('Enter the IP: ')
RTR_10 = {
'ip': '10.10.10.10',
'username': 'admin',
'password': 'admin',
'device_type': 'cisco_ios',
}
print ('Connecting to the device..')
net_connect = ConnectHandler(**RTR_10)
output = net_connect.send_command('show ip int brie', use_textfsm=True)
print ('\nSearch result \n')
ipsearch =[i['intf'] for i in output if i['ipaddr'] == ip]
for ipoutput in ipsearch:
print ('IP Address ' + ip + ' belongs to interface ' + ipoutput )
print ('IP Address ' + ip + ' belongs to interface ' + str(ipsearch) )
#PythonListComprehension #CiscoFindIPPython #PythonTutorialCisco
Watch video Python for Cisco How to Search for Interface IP list | Part 32|TEXTFSM output with NETMIKO online, duration hours minute second in high quality that is uploaded to the channel NetworkEvolution 05 May 2019. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 3,767 times and liked it 34 visitors.