From d444aa11101a8ed298fd1533f8c12e6925d149df Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 7 Jul 2022 14:35:02 -0400 Subject: [PATCH] Fix support for tracing across bridge relationships --- netbox/dcim/api/views.py | 2 +- netbox/dcim/models/device_components.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/api/views.py b/netbox/dcim/api/views.py index e71a6500d..cff337fcf 100644 --- a/netbox/dcim/api/views.py +++ b/netbox/dcim/api/views.py @@ -59,7 +59,7 @@ class PathEndpointMixin(object): width = int(request.GET.get('width', CABLE_TRACE_SVG_DEFAULT_WIDTH)) except (ValueError, TypeError): width = CABLE_TRACE_SVG_DEFAULT_WIDTH - drawing = CableTraceSVG(self, base_url=request.build_absolute_uri('/'), width=width) + drawing = CableTraceSVG(obj, base_url=request.build_absolute_uri('/'), width=width) return HttpResponse(drawing.render().tostring(), content_type='image/svg+xml') # Serialize path objects, iterating over each three-tuple in the path diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 5bc3e00ff..1105724c9 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -211,10 +211,10 @@ class PathEndpoint(models.Model): # by inserting empty entries immediately prior to the path's destination node(s) path.append([]) - # TODO: Add bridging support - # # Check for bridge interface to continue the trace - # origin = getattr(origin._path.destination, 'bridge', None) - origin = None + # Check for a bridged relationship to continue the trace + destinations = origin._path.destinations + if len(destinations) == 1: + origin = getattr(destinations[0], 'bridge', None) # Return the path as a list of three-tuples (A termination(s), cable(s), B termination(s)) return list(zip(*[iter(path)] * 3))