From afeddee10d2e825f5369de5ee931595323d26237 Mon Sep 17 00:00:00 2001 From: Omripresent <6192223+Omripresent@users.noreply.github.com> Date: Thu, 12 Jun 2025 10:49:09 -0400 Subject: [PATCH] Fixes #19687: Treat cellular interface type as not connectable (#19691) * Add cellular interface types to WIRELESS_IFACE_TYPES const Add cable termination test for cellular interface * Add regression tag to cellular test --- netbox/dcim/constants.py | 5 +++++ netbox/dcim/tests/test_models.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index c6e18ca82..387b4d6a7 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -53,6 +53,11 @@ WIRELESS_IFACE_TYPES = [ InterfaceTypeChoices.TYPE_802151, InterfaceTypeChoices.TYPE_802154, InterfaceTypeChoices.TYPE_OTHER_WIRELESS, + InterfaceTypeChoices.TYPE_GSM, + InterfaceTypeChoices.TYPE_CDMA, + InterfaceTypeChoices.TYPE_LTE, + InterfaceTypeChoices.TYPE_4G, + InterfaceTypeChoices.TYPE_5G, ] NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES diff --git a/netbox/dcim/tests/test_models.py b/netbox/dcim/tests/test_models.py index 281071ed9..be9f067d4 100644 --- a/netbox/dcim/tests/test_models.py +++ b/netbox/dcim/tests/test_models.py @@ -954,6 +954,19 @@ class CableTestCase(TestCase): with self.assertRaises(ValidationError): cable.clean() + @tag('regression') + def test_cable_cannot_terminate_to_a_cellular_interface(self): + """ + A cable cannot terminate to a cellular interface + """ + device1 = Device.objects.get(name='TestDevice1') + interface2 = Interface.objects.get(device__name='TestDevice2', name='eth0') + + cellular_interface = Interface(device=device1, name="W1", type=InterfaceTypeChoices.TYPE_LTE) + cable = Cable(a_terminations=[interface2], b_terminations=[cellular_interface]) + with self.assertRaises(ValidationError): + cable.clean() + class VirtualDeviceContextTestCase(TestCase):