From aed144fc1923d4199bf326b2e5d18a0575914914 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 24 Sep 2019 10:37:02 -0500 Subject: [PATCH] Fixes: #3519 - Disallow(API) connections to virtual & wireless interfaces --- netbox/dcim/models.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 88d2aee1d..da1f11d21 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2868,6 +2868,30 @@ class Cable(ChangeLoggedModel): ( isinstance(endpoint_b, Interface) and endpoint_b.type == IFACE_TYPE_VIRTUAL + ) or + ( + isinstance(self.termination_a, Interface) and + self.termination_a.type == IFACE_TYPE_VIRTUAL + ) or + ( + isinstance(self.termination_b, Interface) and + self.termination_b.type == IFACE_TYPE_VIRTUAL + ) or + ( + isinstance(endpoint_b, Interface) and + endpoint_b.type in WIRELESS_IFACE_TYPES + ) or + ( + isinstance(endpoint_b, Interface) and + endpoint_b.type in WIRELESS_IFACE_TYPES + ) or + ( + isinstance(self.termination_a, Interface) and + self.termination_a.type in WIRELESS_IFACE_TYPES + ) or + ( + isinstance(self.termination_b, Interface) and + self.termination_b.type in WIRELESS_IFACE_TYPES ) ): raise ValidationError("Cannot connect to a virtual interface")