mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #2127: Prevent non-conntectable interfaces from being connected
This commit is contained in:
parent
0af6df3121
commit
643b0eaf65
@ -1536,6 +1536,18 @@ class InterfaceConnection(models.Model):
|
|||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
'interface_b': "Cannot connect an interface to itself."
|
'interface_b': "Cannot connect an interface to itself."
|
||||||
})
|
})
|
||||||
|
if self.interface_a.form_factor in NONCONNECTABLE_IFACE_TYPES:
|
||||||
|
raise ValidationError({
|
||||||
|
'interface_a': '{} is not a connectable interface type.'.format(
|
||||||
|
self.interface_a.get_form_factor_display()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
if self.interface_b.form_factor in NONCONNECTABLE_IFACE_TYPES:
|
||||||
|
raise ValidationError({
|
||||||
|
'interface_b': '{} is not a connectable interface type.'.format(
|
||||||
|
self.interface_b.get_form_factor_display()
|
||||||
|
)
|
||||||
|
})
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user