mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-19 03:42:25 -06:00
Misc cleanup
This commit is contained in:
@@ -88,20 +88,7 @@ class BToManyCableProfile(BaseCableProfile):
|
||||
pop_stack_b_side = False
|
||||
|
||||
|
||||
class Shuffle4x4CableProfile(BaseCableProfile):
|
||||
a_max_connections = 4
|
||||
b_max_connections = 4
|
||||
|
||||
def get_mapped_position(self, position):
|
||||
return {
|
||||
1: 1,
|
||||
2: 3,
|
||||
3: 2,
|
||||
4: 4,
|
||||
}.get(position)
|
||||
|
||||
|
||||
class Shuffle8x8CableProfile(BaseCableProfile):
|
||||
class Shuffle2x2MPOCableProfile(BaseCableProfile):
|
||||
a_max_connections = 8
|
||||
b_max_connections = 8
|
||||
|
||||
|
||||
@@ -1722,8 +1722,7 @@ class CableProfileChoices(ChoiceSet):
|
||||
STRAIGHT_MULTI = 'straight-multi'
|
||||
A_TO_MANY = 'a-to-many'
|
||||
B_TO_MANY = 'b-to-many'
|
||||
SHUFFLE_4X4 = 'shuffle-4x4'
|
||||
SHUFFLE_8X8 = 'shuffle-8x8'
|
||||
SHUFFLE_2X2_MPO = 'shuffle-2x2-mpo'
|
||||
|
||||
CHOICES = (
|
||||
(STRAIGHT_SINGLE, _('Straight (single position)')),
|
||||
@@ -1731,8 +1730,7 @@ class CableProfileChoices(ChoiceSet):
|
||||
# TODO: Better names for many-to-one profiles?
|
||||
(A_TO_MANY, _('A to many')),
|
||||
(B_TO_MANY, _('B to many')),
|
||||
(SHUFFLE_4X4, _('Shuffle (4x4)')),
|
||||
(SHUFFLE_8X8, _('Shuffle (8x8)')),
|
||||
(SHUFFLE_2X2_MPO, _('Shuffle (2x2 MPO)')),
|
||||
)
|
||||
|
||||
# TODO: Move these designations into the profiles
|
||||
@@ -1740,15 +1738,13 @@ class CableProfileChoices(ChoiceSet):
|
||||
STRAIGHT_SINGLE,
|
||||
STRAIGHT_MULTI,
|
||||
B_TO_MANY,
|
||||
SHUFFLE_4X4,
|
||||
SHUFFLE_8X8,
|
||||
SHUFFLE_2X2_MPO,
|
||||
)
|
||||
B_SIDE_NUMBERED = (
|
||||
STRAIGHT_SINGLE,
|
||||
STRAIGHT_MULTI,
|
||||
A_TO_MANY,
|
||||
SHUFFLE_4X4,
|
||||
SHUFFLE_8X8,
|
||||
SHUFFLE_2X2_MPO,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ RACK_STARTING_UNIT_DEFAULT = 1
|
||||
# Cables
|
||||
#
|
||||
|
||||
CABLETERMINATION_POSITION_MIN = 1
|
||||
CABLETERMINATION_POSITION_MAX = 1024
|
||||
CABLE_POSITION_MIN = 1
|
||||
CABLE_POSITION_MAX = 1024
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -138,8 +138,7 @@ class Cable(PrimaryModel):
|
||||
CableProfileChoices.STRAIGHT_MULTI: cable_profiles.StraightMultiCableProfile,
|
||||
CableProfileChoices.A_TO_MANY: cable_profiles.AToManyCableProfile,
|
||||
CableProfileChoices.B_TO_MANY: cable_profiles.BToManyCableProfile,
|
||||
CableProfileChoices.SHUFFLE_4X4: cable_profiles.Shuffle4x4CableProfile,
|
||||
CableProfileChoices.SHUFFLE_8X8: cable_profiles.Shuffle8x8CableProfile,
|
||||
CableProfileChoices.SHUFFLE_2X2_MPO: cable_profiles.Shuffle2x2MPOCableProfile,
|
||||
}.get(self.profile)
|
||||
|
||||
def _get_x_terminations(self, side):
|
||||
@@ -376,8 +375,8 @@ class CableTermination(ChangeLoggedModel):
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=(
|
||||
MinValueValidator(CABLETERMINATION_POSITION_MIN),
|
||||
MaxValueValidator(CABLETERMINATION_POSITION_MAX)
|
||||
MinValueValidator(CABLE_POSITION_MIN),
|
||||
MaxValueValidator(CABLE_POSITION_MAX)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -180,8 +180,8 @@ class CabledObjectModel(models.Model):
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=(
|
||||
MinValueValidator(CABLETERMINATION_POSITION_MIN),
|
||||
MaxValueValidator(CABLETERMINATION_POSITION_MAX)
|
||||
MinValueValidator(CABLE_POSITION_MIN),
|
||||
MaxValueValidator(CABLE_POSITION_MAX)
|
||||
),
|
||||
)
|
||||
mark_connected = models.BooleanField(
|
||||
|
||||
Reference in New Issue
Block a user