From 8a6913fe19f246deeaaa9de22e5adccb1cd4a981 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Mon, 12 Nov 2018 23:18:23 -0500 Subject: [PATCH] fixed #2585 - connections with virtual interfaces --- netbox/dcim/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 9a0a59bb8..501bf32cb 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2553,6 +2553,20 @@ class Cable(ChangeLoggedModel): self.termination_b, self.termination_b.cable_id )) + # Virtual interfaces cannot be connected + endpoint_a, endpoint_b = self.get_path_endpoints() + if ( + ( + isinstance(endpoint_a, Interface) and + endpoint_a.form_factor == IFACE_FF_VIRTUAL + ) or + ( + isinstance(endpoint_b, Interface) and + endpoint_b.form_factor == IFACE_FF_VIRTUAL + ) + ): + raise ValidationError("Cannot connect to a virtual interface") + # Validate length and length_unit if self.length and not self.length_unit: raise ValidationError("Must specify a unit when setting a cable length")