mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#8272: Cleanup & add filter for bridge_id
This commit is contained in:
@@ -377,6 +377,8 @@ class InterfaceTemplate(ModularComponentTemplateModel):
|
||||
super().clean()
|
||||
|
||||
if self.bridge:
|
||||
if self.pk and self.bridge_id == self.pk:
|
||||
raise ValidationError({'bridge': "An interface cannot be bridged to itself."})
|
||||
if self.device_type and self.device_type != self.bridge.device_type:
|
||||
raise ValidationError({
|
||||
'bridge': f"Bridge interface ({self.bridge}) must belong to the same device type"
|
||||
|
||||
Reference in New Issue
Block a user