diff --git a/CHANGELOG.md b/CHANGELOG.md index f2fba454f..cb9c9ba67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ v2.5.5 (FUTURE) ## Enhancements * [#2809](https://github.com/digitalocean/netbox/issues/2809) - Remove VRF child prefixes table; link to main prefixes view +* [#2825](https://github.com/digitalocean/netbox/issues/2825) - Include directly connected device for front/rear ports ## Bug Fixes diff --git a/netbox/circuits/models.py b/netbox/circuits/models.py index f10221b0b..b558d5007 100644 --- a/netbox/circuits/models.py +++ b/netbox/circuits/models.py @@ -3,7 +3,7 @@ from django.db import models from django.urls import reverse from taggit.managers import TaggableManager -from dcim.constants import CONNECTION_STATUS_CHOICES, CONNECTION_STATUS_CONNECTED, STATUS_CLASSES +from dcim.constants import CONNECTION_STATUS_CHOICES, STATUS_CLASSES from dcim.fields import ASNField from dcim.models import CableTermination from extras.models import CustomFieldModel, ObjectChange @@ -283,6 +283,10 @@ class CircuitTermination(CableTermination): object_data=serialize_object(self) ).save() + @property + def parent(self): + return self.circuit + def get_peer_termination(self): peer_side = 'Z' if self.term_side == 'A' else 'A' try: diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 89e786a1b..8c6ed9650 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -68,6 +68,10 @@ class ComponentModel(models.Model): object_data=serialize_object(self) ).save() + @property + def parent(self): + return getattr(self, 'device', None) + class CableTermination(models.Model): cable = models.ForeignKey( @@ -162,6 +166,14 @@ class CableTermination(models.Model): return path + next_segment + def get_cable_peer(self): + if self.cable is None: + return None + if self._cabled_as_a: + return self.cable.termination_b + if self._cabled_as_b: + return self.cable.termination_a + # # Regions diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 860a3aa44..8ee50c423 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -682,7 +682,8 @@