netbox-sync icon indicating copy to clipboard operation
netbox-sync copied to clipboard

[Feature Request] Add/Import CDP Cabling Data from pnics

Open Littlericket opened this issue 1 year ago • 2 comments

Enabling CDP on the pnic displays some references which can be used to cable vhosts to switches, also can be used to add neighbour devices directly to netbox.

You can get the PhysicalNicCdpInfo info with QueryNetworkHint when quering the hostSystem -> configManager-> networkSystem and using the method queryNetworkHint (vmnicXX as parameter or empty) on the returned networkSystem. This will return a PhysicalNicHintInfo with a PhysicalNicCdpInfo below connectedSwitchPort.

Took me a while to find out. Hidden like the most secret information on earth.

The returned PhysicalNicCdpInfo can be used to import network devices and cables to the vhost automatically, if cdp is enabled.

I would suggest that this feature needs to be opt-in, if the infrastructure below the vcenter has cdp enabled through all devices.

image

Littlericket avatar Sep 28 '23 14:09 Littlericket

@bb-Ricardo not familiar with python sadly, but as far as I tested you can get the data in connection.py add_host when you loop the pnics

obj.configManager.networkSystem.QueryNetworkHint(pnic_name)

image

devId/systemName is the device name of the connected switch - which should be existing already or can be created by the script. linking the pnic with a cable to the portId of the given systemName would be awesome.

Littlericket avatar Sep 29 '23 10:09 Littlericket

Hi, Thank you for the idea. This would be a great addition to the existing FR https://github.com/bb-Ricardo/netbox-sync/issues/318

bb-Ricardo avatar Nov 08 '23 16:11 bb-Ricardo