diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index 6ef5ab488..2acd98801 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -1531,6 +1531,13 @@ class MACAddress(PrimaryModel): self._original_assigned_object_id = self.__dict__.get('assigned_object_id') self._original_assigned_object_type_id = self.__dict__.get('assigned_object_type_id') + @cached_property + def is_primary(self): + if self.assigned_object and hasattr(self.assigned_object, 'primary_mac_address'): + if self.assigned_object.primary_mac_address and self.assigned_object.primary_mac_address.pk == self.pk: + return True + return False + def clean(self, *args, **kwargs): super().clean() if self._original_assigned_object_id and self._original_assigned_object_type_id: