From e983f44fd327961dbacbe183eacdcdf45a73521a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 16 Sep 2020 12:53:11 -0400 Subject: [PATCH] Closes #5128: Increase maximum rear port positions from 64 to 1024 --- docs/models/dcim/rearporttemplate.md | 2 +- docs/release-notes/version-2.9.md | 1 + netbox/dcim/constants.py | 2 +- .../migrations/0116_rearport_max_positions.py | 34 +++++++++++++++++++ .../dcim/models/device_component_templates.py | 10 ++++-- netbox/dcim/models/device_components.py | 10 ++++-- 6 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 netbox/dcim/migrations/0116_rearport_max_positions.py diff --git a/docs/models/dcim/rearporttemplate.md b/docs/models/dcim/rearporttemplate.md index 71d9a200b..01ba02ac0 100644 --- a/docs/models/dcim/rearporttemplate.md +++ b/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). diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index fd7a99ff0..5472188ba 100644 --- a/docs/release-notes/version-2.9.md +++ b/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 diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index 66768515c..961c458e0 100644 --- a/netbox/dcim/constants.py +++ b/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 # diff --git a/netbox/dcim/migrations/0116_rearport_max_positions.py b/netbox/dcim/migrations/0116_rearport_max_positions.py new file mode 100644 index 000000000..a03f4e3d5 --- /dev/null +++ b/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)]), + ), + ] diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py index 492fe3762..7a94b3e1b 100644 --- a/netbox/dcim/models/device_component_templates.py +++ b/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: diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index d7e077a16..18ca5cf3e 100644 --- a/netbox/dcim/models/device_components.py +++ b/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)