From c1ce53242295a326c58d9ed96f0e34f93f5f57a5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 15 Dec 2025 14:30:41 -0500 Subject: [PATCH] Rename shuffle profiles --- netbox/dcim/cable_profiles.py | 9 ++-- netbox/dcim/choices.py | 60 ++++++++++++--------------- netbox/dcim/models/cables.py | 6 +-- netbox/dcim/tests/test_cablepaths2.py | 2 +- 4 files changed, 34 insertions(+), 43 deletions(-) diff --git a/netbox/dcim/cable_profiles.py b/netbox/dcim/cable_profiles.py index 49a736a8b..7fc14d840 100644 --- a/netbox/dcim/cable_profiles.py +++ b/netbox/dcim/cable_profiles.py @@ -296,7 +296,7 @@ class Breakout1C6Px6C1PCableProfile(BaseCableProfile): } -class Shuffle2C4PCableProfile(BaseCableProfile): +class Trunk2C4PShuffleCableProfile(BaseCableProfile): a_connectors = { 1: 4, 2: 4, @@ -314,7 +314,7 @@ class Shuffle2C4PCableProfile(BaseCableProfile): } -class Shuffle4C4PCableProfile(BaseCableProfile): +class Trunk4C4PShuffleCableProfile(BaseCableProfile): a_connectors = { 1: 4, 2: 4, @@ -342,10 +342,7 @@ class Shuffle4C4PCableProfile(BaseCableProfile): } -class ShuffleBreakout2x8CableProfile(BaseCableProfile): - """ - Temporary solution for mapping 2 front/rear ports to 8 discrete interfaces - """ +class Breakout2C4Px8C1PShuffleCableProfile(BaseCableProfile): a_connectors = { 1: 4, 2: 4, diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py index a90e9a431..1be3f7ca4 100644 --- a/netbox/dcim/choices.py +++ b/netbox/dcim/choices.py @@ -1734,66 +1734,60 @@ class CableProfileChoices(ChoiceSet): TRUNK_2C1P = 'trunk-2c1p' TRUNK_2C2P = 'trunk-2c2p' TRUNK_2C4P = 'trunk-2c4p' + TRUNK_2C4P_SHUFFLE = 'trunk-2c4p-shuffle' TRUNK_2C6P = 'trunk-2c6p' TRUNK_2C8P = 'trunk-2c8p' TRUNK_2C12P = 'trunk-2c12p' TRUNK_4C1P = 'trunk-4c1p' TRUNK_4C2P = 'trunk-4c2p' TRUNK_4C4P = 'trunk-4c4p' + TRUNK_4C4P_SHUFFLE = 'trunk-4c4p-shuffle' TRUNK_4C6P = 'trunk-4c6p' TRUNK_4C8P = 'trunk-4c8p' TRUNK_8C4P = 'trunk-8c4p' # Breakouts BREAKOUT_1C4P_4C1P = 'breakout-1c4p-4c1p' BREAKOUT_1C6P_6C1P = 'breakout-1c6p-6c1p' - SHUFFLE_BREAKOUT_2X8 = 'shuffle-breakout-2x8' - # Shuffles - SHUFFLE_2C4P = 'shuffle-2c4p' - SHUFFLE_4C4P = 'shuffle-4c4p' + BREAKOUT_2C4P_8C1P_SHUFFLE = 'breakout-2c4p-8c1p-shuffle' CHOICES = ( ( _('Single'), ( - (SINGLE_1C1P, _('Single (1C1P)')), - (SINGLE_1C2P, _('Single (1C2P)')), - (SINGLE_1C4P, _('Single (1C4P)')), - (SINGLE_1C6P, _('Single (1C6P)')), - (SINGLE_1C8P, _('Single (1C8P)')), - (SINGLE_1C12P, _('Single (1C12P)')), - (SINGLE_1C16P, _('Single (1C16P)')), + (SINGLE_1C1P, _('1C1P')), + (SINGLE_1C2P, _('1C2P')), + (SINGLE_1C4P, _('1C4P')), + (SINGLE_1C6P, _('1C6P')), + (SINGLE_1C8P, _('1C8P')), + (SINGLE_1C12P, _('1C12P')), + (SINGLE_1C16P, _('1C16P')), ), ), ( _('Trunk'), ( - (TRUNK_2C1P, _('Trunk (2C1P)')), - (TRUNK_2C2P, _('Trunk (2C2P)')), - (TRUNK_2C4P, _('Trunk (2C4P)')), - (TRUNK_2C6P, _('Trunk (2C6P)')), - (TRUNK_2C8P, _('Trunk (2C8P)')), - (TRUNK_2C12P, _('Trunk (2C12P)')), - (TRUNK_4C1P, _('Trunk (4C1P)')), - (TRUNK_4C2P, _('Trunk (4C2P)')), - (TRUNK_4C4P, _('Trunk (4C4P)')), - (TRUNK_4C6P, _('Trunk (4C6P)')), - (TRUNK_4C8P, _('Trunk (4C8P)')), - (TRUNK_8C4P, _('Trunk (8C4P)')), + (TRUNK_2C1P, _('2C1P trunk')), + (TRUNK_2C2P, _('2C2P trunk')), + (TRUNK_2C4P, _('2C4P trunk')), + (TRUNK_2C4P_SHUFFLE, _('2C4P trunk (shuffle)')), + (TRUNK_2C6P, _('2C6P trunk')), + (TRUNK_2C8P, _('2C8P trunk')), + (TRUNK_2C12P, _('2C12P trunk')), + (TRUNK_4C1P, _('4C1P trunk')), + (TRUNK_4C2P, _('4C2P trunk')), + (TRUNK_4C4P, _('4C4P trunk')), + (TRUNK_4C4P_SHUFFLE, _('4C4P trunk (shuffle)')), + (TRUNK_4C6P, _('4C6P trunk')), + (TRUNK_4C8P, _('4C8P trunk')), + (TRUNK_8C4P, _('8C4P trunk')), ), ), ( _('Breakout'), ( - (BREAKOUT_1C4P_4C1P, _('Breakout (1C4P/4C1P)')), - (BREAKOUT_1C6P_6C1P, _('Breakout (1C6P/6C1P)')), - ), - ), - ( - _('Shuffle'), - ( - (SHUFFLE_2C4P, _('Shuffle (2C4P)')), - (SHUFFLE_4C4P, _('Shuffle (4C4P)')), - (SHUFFLE_BREAKOUT_2X8, _('Shuffle breakout (2x8)')), + (BREAKOUT_1C4P_4C1P, _('1C4P:4C1P breakout')), + (BREAKOUT_1C6P_6C1P, _('1C6P:6C1P breakout')), + (BREAKOUT_2C4P_8C1P_SHUFFLE, _('2C4P:8C1P breakout (shuffle)')), ), ), ) diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py index 3b3dbb658..8e155d70e 100644 --- a/netbox/dcim/models/cables.py +++ b/netbox/dcim/models/cables.py @@ -147,20 +147,20 @@ class Cable(PrimaryModel): CableProfileChoices.TRUNK_2C1P: cable_profiles.Trunk2C1PCableProfile, CableProfileChoices.TRUNK_2C2P: cable_profiles.Trunk2C2PCableProfile, CableProfileChoices.TRUNK_2C4P: cable_profiles.Trunk2C4PCableProfile, + CableProfileChoices.TRUNK_2C4P_SHUFFLE: cable_profiles.Trunk2C4PShuffleCableProfile, CableProfileChoices.TRUNK_2C6P: cable_profiles.Trunk2C6PCableProfile, CableProfileChoices.TRUNK_2C8P: cable_profiles.Trunk2C8PCableProfile, CableProfileChoices.TRUNK_2C12P: cable_profiles.Trunk2C12PCableProfile, CableProfileChoices.TRUNK_4C1P: cable_profiles.Trunk4C1PCableProfile, CableProfileChoices.TRUNK_4C2P: cable_profiles.Trunk4C2PCableProfile, CableProfileChoices.TRUNK_4C4P: cable_profiles.Trunk4C4PCableProfile, + CableProfileChoices.TRUNK_4C4P_SHUFFLE: cable_profiles.Trunk4C4PShuffleCableProfile, CableProfileChoices.TRUNK_4C6P: cable_profiles.Trunk4C6PCableProfile, CableProfileChoices.TRUNK_4C8P: cable_profiles.Trunk4C8PCableProfile, CableProfileChoices.TRUNK_8C4P: cable_profiles.Trunk8C4PCableProfile, CableProfileChoices.BREAKOUT_1C4P_4C1P: cable_profiles.Breakout1C4Px4C1PCableProfile, CableProfileChoices.BREAKOUT_1C6P_6C1P: cable_profiles.Breakout1C6Px6C1PCableProfile, - CableProfileChoices.SHUFFLE_2C4P: cable_profiles.Shuffle2C4PCableProfile, - CableProfileChoices.SHUFFLE_4C4P: cable_profiles.Shuffle4C4PCableProfile, - CableProfileChoices.SHUFFLE_BREAKOUT_2X8: cable_profiles.ShuffleBreakout2x8CableProfile, + CableProfileChoices.BREAKOUT_2C4P_8C1P_SHUFFLE: cable_profiles.Breakout2C4Px8C1PShuffleCableProfile, }.get(self.profile) def _get_x_terminations(self, side): diff --git a/netbox/dcim/tests/test_cablepaths2.py b/netbox/dcim/tests/test_cablepaths2.py index a59e26b14..27ecf962f 100644 --- a/netbox/dcim/tests/test_cablepaths2.py +++ b/netbox/dcim/tests/test_cablepaths2.py @@ -710,7 +710,7 @@ class CablePathTests(CablePathTestCase): cable.save() cables.append(cable) shuffle_cable = Cable( - profile=CableProfileChoices.SHUFFLE_2C4P, + profile=CableProfileChoices.TRUNK_2C4P_SHUFFLE, a_terminations=rear_ports[0:2], b_terminations=rear_ports[2:4], )