1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Extended Cables to connect CircuitTerminations

This commit is contained in:
Jeremy Stretch
2018-10-30 12:16:22 -04:00
parent cbfb25f003
commit 4df74780b8
22 changed files with 305 additions and 199 deletions

View File

@@ -508,17 +508,17 @@ class TopologyMap(models.Model):
# Add all interface connections to the graph
connected_interfaces = Interface.objects.select_related(
'connected_endpoint__device'
'_connected_interface__device'
).filter(
Q(device__in=devices) | Q(connected_endpoint__device__in=devices),
connected_endpoint__isnull=False,
Q(device__in=devices) | Q(_connected_interface__device__in=devices),
_connected_interface__isnull=False,
)
for interface in connected_interfaces:
style = 'solid' if interface.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed'
self.graph.edge(interface.device.name, interface.connected_endpoint.device.name, style=style)
# Add all circuits to the graph
for termination in CircuitTermination.objects.filter(term_side='A', interface__device__in=devices):
for termination in CircuitTermination.objects.filter(term_side='A', connected_endpoint__device__in=devices):
peer_termination = termination.get_peer_termination()
if (peer_termination is not None and peer_termination.interface is not None and
peer_termination.interface.device in devices):