netbox-sync
netbox-sync copied to clipboard
[Feature Request] Add/Import CDP Cabling Data from pnics
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.
@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)
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.
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