mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #9733: Handle split paths during trace when fanning out to front ports with differing cables
This commit is contained in:
@@ -100,6 +100,8 @@ Custom field UI visibility has no impact on API operation.
|
|||||||
|
|
||||||
* [#9728](https://github.com/netbox-community/netbox/issues/9728) - Fix validation when assigning a virtual machine to a device
|
* [#9728](https://github.com/netbox-community/netbox/issues/9728) - Fix validation when assigning a virtual machine to a device
|
||||||
* [#9729](https://github.com/netbox-community/netbox/issues/9729) - Fix ordering of content type creation to ensure compatability with demo data
|
* [#9729](https://github.com/netbox-community/netbox/issues/9729) - Fix ordering of content type creation to ensure compatability with demo data
|
||||||
|
* [#9730](https://github.com/netbox-community/netbox/issues/9730) - Fix validation error when creating a new cable via UI form
|
||||||
|
* [#9733](https://github.com/netbox-community/netbox/issues/9733) - Handle split paths during trace when fanning out to front ports with differing cables
|
||||||
|
|
||||||
### Plugins API
|
### Plugins API
|
||||||
|
|
||||||
|
@@ -463,6 +463,10 @@ class CablePath(models.Model):
|
|||||||
"""
|
"""
|
||||||
from circuits.models import CircuitTermination
|
from circuits.models import CircuitTermination
|
||||||
|
|
||||||
|
# Ensure all originating terminations are attached to the same link
|
||||||
|
if len(terminations) > 1:
|
||||||
|
assert all(t.link == terminations[0].link for t in terminations[1:])
|
||||||
|
|
||||||
path = []
|
path = []
|
||||||
position_stack = []
|
position_stack = []
|
||||||
is_complete = False
|
is_complete = False
|
||||||
@@ -474,6 +478,12 @@ class CablePath(models.Model):
|
|||||||
# Terminations must all be of the same type
|
# Terminations must all be of the same type
|
||||||
assert all(isinstance(t, type(terminations[0])) for t in terminations[1:])
|
assert all(isinstance(t, type(terminations[0])) for t in terminations[1:])
|
||||||
|
|
||||||
|
# Check for a split path (e.g. rear port fanning out to multiple front ports with
|
||||||
|
# different cables attached)
|
||||||
|
if len(set(t.link for t in terminations)) > 1:
|
||||||
|
is_split = True
|
||||||
|
break
|
||||||
|
|
||||||
# Step 1: Record the near-end termination object(s)
|
# Step 1: Record the near-end termination object(s)
|
||||||
path.append([
|
path.append([
|
||||||
object_to_path_node(t) for t in terminations
|
object_to_path_node(t) for t in terminations
|
||||||
@@ -481,7 +491,6 @@ class CablePath(models.Model):
|
|||||||
|
|
||||||
# Step 2: Determine the attached link (Cable or WirelessLink), if any
|
# Step 2: Determine the attached link (Cable or WirelessLink), if any
|
||||||
link = terminations[0].link
|
link = terminations[0].link
|
||||||
assert all(t.link == link for t in terminations[1:])
|
|
||||||
if link is None and len(path) == 1:
|
if link is None and len(path) == 1:
|
||||||
# If this is the start of the path and no link exists, return None
|
# If this is the start of the path and no link exists, return None
|
||||||
return None
|
return None
|
||||||
|
Reference in New Issue
Block a user