mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 20:22:53 -06:00
#1177: Render planned connections as dashed lines on topology maps
This commit is contained in:
parent
3be6e5b015
commit
a49521d683
@ -318,7 +318,7 @@ class TopologyMap(models.Model):
|
|||||||
def render(self, img_format='png'):
|
def render(self, img_format='png'):
|
||||||
|
|
||||||
from circuits.models import CircuitTermination
|
from circuits.models import CircuitTermination
|
||||||
from dcim.models import Device, InterfaceConnection
|
from dcim.models import CONNECTION_STATUS_CONNECTED, Device, InterfaceConnection
|
||||||
|
|
||||||
# Construct the graph
|
# Construct the graph
|
||||||
graph = graphviz.Graph()
|
graph = graphviz.Graph()
|
||||||
@ -360,7 +360,8 @@ class TopologyMap(models.Model):
|
|||||||
interface_a__device__in=devices, interface_b__device__in=devices
|
interface_a__device__in=devices, interface_b__device__in=devices
|
||||||
)
|
)
|
||||||
for c in connections:
|
for c in connections:
|
||||||
graph.edge(c.interface_a.device.name, c.interface_b.device.name)
|
style = 'solid' if c.connection_status == CONNECTION_STATUS_CONNECTED else 'dashed'
|
||||||
|
graph.edge(c.interface_a.device.name, c.interface_b.device.name, style=style)
|
||||||
|
|
||||||
# Add all circuits to the graph
|
# 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', interface__device__in=devices):
|
||||||
|
Loading…
Reference in New Issue
Block a user