pynetbox
pynetbox copied to clipboard
add cable trace (pathing) for front-ports and rear-ports
The Netbox API has no /trace endpoint for front-ports and rear-ports, but a /paths endpoint (see issue #434).
This PR implements the /paths endpoint for pynetbox.
Hi, I've tested your code. It doesn't work for me when tracing an open path. I think a condition is missing in case there is no origin/destination port.
origin_endpoint = "/".join(
urlsplit(origin["url"])
.path[len(urlsplit(self.api.base_url).path):]
.split("/")[1:3]
) if origin else None
destination_endpoint = "/".join(
urlsplit(destination["url"])
.path[len(urlsplit(self.api.base_url).path):]
.split("/")[1:3]
) if destination else None