mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fix cable path tracing
This commit is contained in:
parent
ecee7421ea
commit
93daa6406b
@ -338,6 +338,7 @@ class CablePath(models.Model):
|
|||||||
|
|
||||||
path = []
|
path = []
|
||||||
position_stack = []
|
position_stack = []
|
||||||
|
is_complete = False
|
||||||
is_active = True
|
is_active = True
|
||||||
is_split = False
|
is_split = False
|
||||||
|
|
||||||
@ -369,11 +370,12 @@ class CablePath(models.Model):
|
|||||||
termination_type=ContentType.objects.get_for_model(RearPort),
|
termination_type=ContentType.objects.get_for_model(RearPort),
|
||||||
termination_id__in=[t.termination_id for t in peer_terminations]
|
termination_id__in=[t.termination_id for t in peer_terminations]
|
||||||
)
|
)
|
||||||
node = terminations[0].termination
|
rear_ports = RearPort.objects.filter(pk__in=[t.termination.rear_port_id for t in peer_terminations])
|
||||||
|
node = rear_ports[0]
|
||||||
if node.positions > 1:
|
if node.positions > 1:
|
||||||
position_stack.append(node.rear_port_position)
|
position_stack.append(node.rear_port_position)
|
||||||
path.append([
|
path.append([
|
||||||
object_to_path_node(t.termination) for t in terminations
|
object_to_path_node(rp) for rp in rear_ports
|
||||||
])
|
])
|
||||||
|
|
||||||
# Follow RearPorts to their corresponding FrontPorts (if any)
|
# Follow RearPorts to their corresponding FrontPorts (if any)
|
||||||
@ -438,10 +440,12 @@ class CablePath(models.Model):
|
|||||||
path.append([
|
path.append([
|
||||||
object_to_path_node(t.termination) for t in peer_terminations
|
object_to_path_node(t.termination) for t in peer_terminations
|
||||||
])
|
])
|
||||||
|
is_complete = True
|
||||||
break
|
break
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
path=path,
|
path=path,
|
||||||
|
is_complete=is_complete,
|
||||||
is_active=is_active,
|
is_active=is_active,
|
||||||
is_split=is_split
|
is_split=is_split
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user