Python Forum
ciscolib cdp output list printing support
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ciscolib cdp output list printing support
#1
Hi There,

trying ciscolib module to discover network topology. small script as below

import ciscolib
switch = ciscolib.Device("172.21.160.3", "test123", "anna")
switch.connect()
print(switch.get_neighbors())
Output:
[{'ip': '172.21.162.164', 'hostname': 'PUN-DIG-DIG-01-ONN-BR-BS-GL-01', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/18'}, {'ip': '172.21.162.157', 'hostname': 'PUN-DIG-DIG-02-ONN-BR-BS-01', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/15'}, {'ip': '172.21.162.71', 'hostname': 'PUN-DIG-DIG-01-ONN-BR-BS-70', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/19'}, {'ip': '172.21.160.2', 'hostname': 'pu-dig-dig-r1-as01', 'remote_port': 'GigabitEthernet1/0/9', 'local_port': 'GigabitEthernet0/1'}]
need to print output as below

ip:172.21.162.164 hostname:PUN-DIG-DIG-01-ONN-BR-BS-GL-01 remote_port:FastEthernet0/24 local_port:FastEthernet0/18
ip:172.21.162.157 hostname:PUN-DIG-DIG-02-ONN-BR-BS-01 remote_port:FastEthernet0/24 local_port:FastEthernet0/15
ip:172.21.160.2 hostname:pu-dig-dig-r1-as01 remote_port:GigabitEthernet1/0/9 local_port:GigabitEthernet0/1
Reply


Messages In This Thread
ciscolib cdp output list printing support - by anna - Jul-25-2018, 10:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sum() list from SQLAlchemy output Personne 5 4,522 May-17-2022, 12:25 AM
Last Post: Personne
Question Printing through list.. again jesse68 2 1,162 Apr-16-2022, 03:24 PM
Last Post: jesse68
  help for list printing jip31 8 3,696 May-01-2021, 03:52 AM
Last Post: Pedroski55
  Problem printing last element from a list tester_V 3 2,429 Oct-30-2020, 04:54 AM
Last Post: tester_V
  Printing empty list? hhydration 2 2,146 Oct-28-2020, 11:34 AM
Last Post: Atekka
  How to append to list a function output? rama27 5 6,787 Aug-24-2020, 10:53 AM
Last Post: DeaD_EyE
  Printing images from a list Heyjoe 4 2,849 Jun-22-2020, 02:28 AM
Last Post: Heyjoe
  json.dumps list output qurr 12 5,306 Apr-08-2020, 10:13 PM
Last Post: micseydel
  If item in list = true, Output = xx kroh 0 1,506 Feb-19-2020, 09:17 AM
Last Post: kroh
  printing a list contents without brackets in a print statement paracelx 1 2,158 Feb-15-2020, 02:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020