Skip to main content
Available

Get Device Neighbors

  • September 28, 2021
  • 6 replies
  • 41 views

When using the Get Device Neighbors by Topology Type API I can request L2 or L3 neighbours from a device. The L3 result looks the same in format just providing L3 neighbours instead of L2, naturally.
For L2, I get a result that looks like this
{'neighbors': [{'hostname': 'R4', 'interface': 'Ethernet0/1 123.10.1.1/30'},.....

What you will immediately realize is that it is a simple JSON list giving neighbouring hostname and its interface.What you will not get is the interface on the queried switch to which the neighbours are connected. This L2 information would be very usefull and even for L3 it would be interesting if the local L3 interface were provided.

6 replies

Forum|alt.badge.img+1
  • Community Manager
  • 85 replies
  • September 29, 2021

@Carsten.Schmidt  It looks like a bug, I will create an internal bug to track it.

I tested another API, it works well. Could you have a try this one:

https://github.com/NetBrainAPI/NetBrain-REST-API-R10/blob/master/REST%20APIs%20Documentation/Topology%20Management/Get%20Device%20Neighbors%20by%20Topology%20Type%20API%20Version_1.md


Forum|alt.badge.img+4
  • Author
  • Brainy
  • 82 replies
  • September 29, 2021

@Gerry.zhang this is not a bug. The interface provided is only of the neighbouring device. In the RESTAPI documentation it is the same. The response documentation and the example confirm this:

I would like to see the interface of the queried device where the neighbour is connected to.

{'neighbors': [{'hostname': 'R4', 'interface': 'Ethernet0/1 123.10.1.1/30'}, {'hostname': 'R5', 'interface': 'Ethernet0/1 123.10.1.6/30'}], 'statusCode': 790200, 'statusDescription': 'Success.'}

Forum|alt.badge.img+1
  • Community Manager
  • 85 replies
  • September 29, 2021

@Carsten.Schmidt  Please see above link, the script is a little different, it provides the local interfaces.

 

{
    "topology":
    [
        {   
            "hostname": "device_1",
            "neighbors":
            [
                {
                    "interface": "intf_1",
                    "connected_device":
                    {
                        "nbr_device": "device_2",
                        "nbr_intf": "intf_3"
                    },
                    "topology": "L2"
                }
                {
                    "interface": "intf_2",
                    "connected_device":
                    {
                        "nbr_device": "device_3",
                        "nbr_intf": "intf_4"
                    },
                    "topology": "L2"
                }
            ]
        }
        {   
            "hostname": "device_4",
            "neighbors":
            [
                {
                    "interface": "intf_5",
                    "connected_device":
                    {
                        "nbr_device": "device_5",
                        "nbr_intf": "intf_6"
                    },
                    "topology": "L3"
                }
        }
    ]
}
 


Forum|alt.badge.img+4
  • Author
  • Brainy
  • 82 replies
  • September 29, 2021

@Gerry.zhang That fixed it, thank you very much!


Forum|alt.badge.img+1
  • Community Manager
  • 85 replies
  • September 29, 2021

Glad to hear that!


Forum|alt.badge.img
  • Known Participant
  • 26 replies
  • October 6, 2021
Updated idea statusOpenAvailable