mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Remove unused follow_circuits arg for cable tracing
This commit is contained in:
parent
40bfb55370
commit
e143158f12
@ -77,7 +77,7 @@ class CableTraceMixin(object):
|
|||||||
# Initialize the path array
|
# Initialize the path array
|
||||||
path = []
|
path = []
|
||||||
|
|
||||||
for near_end, cable, far_end in obj.trace(follow_circuits=True):
|
for near_end, cable, far_end in obj.trace():
|
||||||
|
|
||||||
# Serialize each object
|
# Serialize each object
|
||||||
serializer_a = get_serializer_for_model(near_end, prefix='Nested')
|
serializer_a = get_serializer_for_model(near_end, prefix='Nested')
|
||||||
|
@ -89,7 +89,7 @@ class CableTermination(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
def trace(self, follow_circuits=False):
|
def trace(self):
|
||||||
"""
|
"""
|
||||||
Return a list representing a complete cable path, with each individual segment represented as a three-tuple:
|
Return a list representing a complete cable path, with each individual segment represented as a three-tuple:
|
||||||
[
|
[
|
||||||
@ -102,7 +102,7 @@ class CableTermination(models.Model):
|
|||||||
path = []
|
path = []
|
||||||
position_stack = []
|
position_stack = []
|
||||||
|
|
||||||
def get_peer_port(termination, follow_circuits=False):
|
def get_peer_port(termination):
|
||||||
from circuits.models import CircuitTermination
|
from circuits.models import CircuitTermination
|
||||||
|
|
||||||
# Map a front port to its corresponding rear port
|
# Map a front port to its corresponding rear port
|
||||||
@ -135,7 +135,7 @@ class CableTermination(models.Model):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Follow a circuit to its other termination
|
# Follow a circuit to its other termination
|
||||||
elif isinstance(termination, CircuitTermination) and follow_circuits:
|
elif isinstance(termination, CircuitTermination):
|
||||||
peer_termination = termination.get_peer_termination()
|
peer_termination = termination.get_peer_termination()
|
||||||
if peer_termination is None:
|
if peer_termination is None:
|
||||||
return None
|
return None
|
||||||
@ -169,7 +169,7 @@ class CableTermination(models.Model):
|
|||||||
))
|
))
|
||||||
|
|
||||||
# Get the peer port of the far end termination
|
# Get the peer port of the far end termination
|
||||||
endpoint = get_peer_port(far_end, follow_circuits)
|
endpoint = get_peer_port(far_end)
|
||||||
if endpoint is None:
|
if endpoint is None:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
@ -2019,7 +2019,7 @@ class CableTraceView(PermissionRequiredMixin, View):
|
|||||||
def get(self, request, model, pk):
|
def get(self, request, model, pk):
|
||||||
|
|
||||||
obj = get_object_or_404(model, pk=pk)
|
obj = get_object_or_404(model, pk=pk)
|
||||||
trace = obj.trace(follow_circuits=True)
|
trace = obj.trace()
|
||||||
total_length = sum([entry[1]._abs_length for entry in trace if entry[1] and entry[1]._abs_length])
|
total_length = sum([entry[1]._abs_length for entry in trace if entry[1] and entry[1]._abs_length])
|
||||||
|
|
||||||
return render(request, 'dcim/cable_trace.html', {
|
return render(request, 'dcim/cable_trace.html', {
|
||||||
|
Loading…
Reference in New Issue
Block a user