Update Report for checking for lonely cables #6826
-
Hello, I had a Netbox report, which showed me all cables, who are not connected to an endpoint (device). Here is my old code: class Cables(Report): |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You want to check whether the path which the cable is part of, ends on an Interface at both ends, rather than on a frontport or rearport. Look at the code here which identifies all the paths which pass through the termination (in general, if it were a rearport rather than a frontport, multiple paths could pass through it). I believe the CablePath will only exist if there are interfaces at both ends. The condition then becomes something like this (you may need to experiment a bit with it in nbshell):
I'd also point out that looking at string representations of objects is a fragile way to check their type. You could do something like this instead:
|
Beta Was this translation helpful? Give feedback.
You want to check whether the path which the cable is part of, ends on an Interface at both ends, rather than on a frontport or rearport.
Look at the code here which identifies all the paths which pass through the termination (in general, if it were a rearport rather than a frontport, multiple paths could pass through it).
I believe the CablePath will only exist if there are interfaces at both ends. The condition then becomes something like this (you may need to experiment a bit with it in nbshell):
I'd also point out that looking at string …