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

Deprecated the InterfaceConnection model

This commit is contained in:
Jeremy Stretch
2018-10-24 13:59:44 -04:00
parent 2ec8dc8319
commit f30367e094
22 changed files with 219 additions and 884 deletions

View File

@ -504,15 +504,18 @@ class TopologyMap(models.Model):
def add_network_connections(self, devices):
from circuits.models import CircuitTermination
from dcim.models import InterfaceConnection
from dcim.models import Interface
# Add all interface connections to the graph
connections = InterfaceConnection.objects.filter(
interface_a__device__in=devices, interface_b__device__in=devices
connected_interfaces = Interface.objects.select_related(
'connected_endpoint__device'
).filter(
Q(device__in=devices) | Q(connected_endpoint__device__in=devices),
connected_endpoint__isnull=False,
)
for c in connections:
style = 'solid' if c.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed'
self.graph.edge(c.interface_a.device.name, c.interface_b.device.name, style=style)
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):