Przeglądaj źródła

Closes #5128: Increase maximum rear port positions from 64 to 1024

Jeremy Stretch 5 lat temu
rodzic
commit
e983f44fd3

+ 1 - 1
docs/models/dcim/rearporttemplate.md

@@ -1,3 +1,3 @@
 ## Rear Port Templates
 
-A template for a rear-facing pass-through port that will be created on all instantiations of the parent device type. Each rear port may have a physical type and one or more front port templates assigned to it. The number of positions associated with a rear port determines how many front ports can be assigned to it (the maximum is 64).
+A template for a rear-facing pass-through port that will be created on all instantiations of the parent device type. Each rear port may have a physical type and one or more front port templates assigned to it. The number of positions associated with a rear port determines how many front ports can be assigned to it (the maximum is 1024).

+ 1 - 0
docs/release-notes/version-2.9.md

@@ -5,6 +5,7 @@
 ### Enhancements
 
 * [#1755](https://github.com/netbox-community/netbox/issues/1755) - Toggle order in which rack elevations are displayed
+* [#5128](https://github.com/netbox-community/netbox/issues/5128) - Increase maximum rear port positions from 64 to 1024
 * [#5134](https://github.com/netbox-community/netbox/issues/5134) - Display full hierarchy in breadcrumbs for sites/racks
 
 ### Bug Fixes

+ 1 - 1
netbox/dcim/constants.py

@@ -18,7 +18,7 @@ RACK_ELEVATION_LEGEND_WIDTH_DEFAULT = 30
 #
 
 REARPORT_POSITIONS_MIN = 1
-REARPORT_POSITIONS_MAX = 64
+REARPORT_POSITIONS_MAX = 1024
 
 
 #

+ 34 - 0
netbox/dcim/migrations/0116_rearport_max_positions.py

@@ -0,0 +1,34 @@
+# Generated by Django 3.1 on 2020-09-16 16:51
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('dcim', '0115_rackreservation_order'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='frontport',
+            name='rear_port_position',
+            field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)]),
+        ),
+        migrations.AlterField(
+            model_name='frontporttemplate',
+            name='rear_port_position',
+            field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)]),
+        ),
+        migrations.AlterField(
+            model_name='rearport',
+            name='positions',
+            field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)]),
+        ),
+        migrations.AlterField(
+            model_name='rearporttemplate',
+            name='positions',
+            field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)]),
+        ),
+    ]

+ 8 - 2
netbox/dcim/models/device_component_templates.py

@@ -264,7 +264,10 @@ class FrontPortTemplate(ComponentTemplateModel):
     )
     rear_port_position = models.PositiveSmallIntegerField(
         default=1,
-        validators=[MinValueValidator(1), MaxValueValidator(64)]
+        validators=[
+            MinValueValidator(REARPORT_POSITIONS_MIN),
+            MaxValueValidator(REARPORT_POSITIONS_MAX)
+        ]
     )
 
     class Meta:
@@ -315,7 +318,10 @@ class RearPortTemplate(ComponentTemplateModel):
     )
     positions = models.PositiveSmallIntegerField(
         default=1,
-        validators=[MinValueValidator(1), MaxValueValidator(64)]
+        validators=[
+            MinValueValidator(REARPORT_POSITIONS_MIN),
+            MaxValueValidator(REARPORT_POSITIONS_MAX)
+        ]
     )
 
     class Meta:

+ 8 - 2
netbox/dcim/models/device_components.py

@@ -809,7 +809,10 @@ class FrontPort(CableTermination, ComponentModel):
     )
     rear_port_position = models.PositiveSmallIntegerField(
         default=1,
-        validators=[MinValueValidator(1), MaxValueValidator(64)]
+        validators=[
+            MinValueValidator(REARPORT_POSITIONS_MIN),
+            MaxValueValidator(REARPORT_POSITIONS_MAX)
+        ]
     )
     tags = TaggableManager(through=TaggedItem)
 
@@ -864,7 +867,10 @@ class RearPort(CableTermination, ComponentModel):
     )
     positions = models.PositiveSmallIntegerField(
         default=1,
-        validators=[MinValueValidator(1), MaxValueValidator(64)]
+        validators=[
+            MinValueValidator(REARPORT_POSITIONS_MIN),
+            MaxValueValidator(REARPORT_POSITIONS_MAX)
+        ]
     )
     tags = TaggableManager(through=TaggedItem)