Python for Cisco How to Search for Interface IP list | Part 32|TEXTFSM output with NETMIKO

Опубликовано: 05 Май 2019
на канале: NetworkEvolution
3,767
34

𝗙𝗼𝗿 𝗖𝗼𝗺𝗽𝗹𝗲𝘁𝗲 𝗣𝘆𝘁𝗵𝗼𝗻 𝗙𝗼𝗿 𝗡𝗲𝘁𝘄𝗼𝗿𝗸 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀 𝗖𝗼𝘂𝗿𝘀𝗲:
𝗘𝗻𝗿𝗼𝗹𝗹 𝗳𝗼𝗿 𝗯𝗲𝗹𝗼𝘄 𝗨𝗱𝗲𝗺𝘆 𝗖𝗹𝗮𝘀𝘀: 𝟐𝟎𝟐𝟐 𝐕𝐞𝐫𝐬𝐢𝐨𝐧
𝑫𝒊𝒔𝒄𝒐𝒖𝒏𝒕𝒆𝒅 𝑹𝒆𝒇𝒆𝒓𝒓𝒂𝒍 𝑳𝒊𝒏𝒌:
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


Смотрите видео Python for Cisco How to Search for Interface IP list | Part 32|TEXTFSM output with NETMIKO онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь NetworkEvolution 05 Май 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,767 раз и оно понравилось 34 людям.