From 7aa9ecd17a3eae5ff6dbf89a4e07b1e0631de28e Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Thu, 12 Nov 2020 10:25:04 -0500 Subject: [PATCH 1/6] Closes #5337: Add "splice" port type --- netbox/dcim/choices.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py index fa4f81792..fc5f9c12b 100644 --- a/netbox/dcim/choices.py +++ b/netbox/dcim/choices.py @@ -830,6 +830,7 @@ class PortTypeChoices(ChoiceSet): TYPE_MPO = 'mpo' TYPE_LSH = 'lsh' TYPE_LSH_APC = 'lsh-apc' + TYPE_SPLICE = 'splice' CHOICES = ( ( @@ -857,6 +858,7 @@ class PortTypeChoices(ChoiceSet): (TYPE_SC, 'SC'), (TYPE_SC_APC, 'SC/APC'), (TYPE_ST, 'ST'), + (TYPE_SPLICE, 'Splice'), ) ) ) From b9da0129ffbafc386e7a4329cf96df3fbb5c93c4 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Nov 2020 09:38:00 -0500 Subject: [PATCH 2/6] Changelog for #5337 --- docs/release-notes/version-2.9.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 6c7839818..367486017 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -1,5 +1,13 @@ # NetBox v2.9 +## v2.9.10 (FUTURE) + +### Enhancements + +* [#5337](https://github.com/netbox-community/netbox/issues/5337) - Add "splice" type for pass-through ports + +--- + ## v2.9.9 (2020-11-09) ### Enhancements @@ -17,7 +25,6 @@ * [#5328](https://github.com/netbox-community/netbox/issues/5328) - Fix CreatedUpdatedFilterTest when running in non-UTC timezone * [#5331](https://github.com/netbox-community/netbox/issues/5331) - Fix filtering of sites by null region - --- ## v2.9.8 (2020-10-30) From 0ee4bc22e52197e878cbfed83e1c621cbbf6f33a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Nov 2020 09:40:50 -0500 Subject: [PATCH 3/6] Add note about changelog --- CONTRIBUTING.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f5f1587d8..cf8e58a17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -103,14 +103,18 @@ any work that's already in progress. be assigned to you so that others are aware it's being worked on. A maintainer will then mark the issue as "accepted." -* Any pull request which does _not_ relate to an accepted issue will be closed. +* Any pull request which does _not_ relate to an **accepted** issue will be closed. -* All major new functionality must include relevant tests where applicable. +* All new functionality must include relevant tests where applicable. * When submitting a pull request, please be sure to work off of the `develop` branch, rather than `master`. The `develop` branch is used for ongoing development, while `master` is used for tagging stable releases. +* In most cases, it is not necessary to add a changelog entry: A maintainer will +take care of this when the PR is merged. (This helps avoid merge conflicts +resulting from multiple PRs being submitted simultaneously.) + * All code submissions should meet the following criteria (CI will enforce these checks): From 9f8f9e8b97e2b42221000afe74619d25cb698b87 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Nov 2020 10:17:05 -0500 Subject: [PATCH 4/6] Fixes #5345: Fix non-deterministic ordering of prefixes and IP addresses --- docs/release-notes/version-2.9.md | 4 ++++ netbox/ipam/api/views.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 367486017..ca255f9d0 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -6,6 +6,10 @@ * [#5337](https://github.com/netbox-community/netbox/issues/5337) - Add "splice" type for pass-through ports +### Bug Fixes + +* [#5345](https://github.com/netbox-community/netbox/issues/5345) - Fix non-deterministic ordering of prefixes and IP addresses + --- ## v2.9.9 (2020-11-09) diff --git a/netbox/ipam/api/views.py b/netbox/ipam/api/views.py index dd0731bb8..c296fd912 100644 --- a/netbox/ipam/api/views.py +++ b/netbox/ipam/api/views.py @@ -78,7 +78,9 @@ class RoleViewSet(ModelViewSet): # class PrefixViewSet(CustomFieldModelViewSet): - queryset = Prefix.objects.prefetch_related('site', 'vrf__tenant', 'tenant', 'vlan', 'role', 'tags') + queryset = Prefix.objects.prefetch_related( + 'site', 'vrf__tenant', 'tenant', 'vlan', 'role', 'tags' + ).order_by(*Prefix._meta.ordering) serializer_class = serializers.PrefixSerializer filterset_class = filters.PrefixFilterSet @@ -248,7 +250,7 @@ class PrefixViewSet(CustomFieldModelViewSet): class IPAddressViewSet(CustomFieldModelViewSet): queryset = IPAddress.objects.prefetch_related( 'vrf__tenant', 'tenant', 'nat_inside', 'nat_outside', 'tags', 'assigned_object' - ) + ).order_by(*IPAddress._meta.ordering) serializer_class = serializers.IPAddressSerializer filterset_class = filters.IPAddressFilterSet From 9a736170fe756e12e6255394077ed841b555078c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Nov 2020 10:38:57 -0500 Subject: [PATCH 5/6] Fixes #5350: Filter available racks by selected group when creating a rack reservation --- docs/release-notes/version-2.9.md | 1 + netbox/dcim/forms.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index ca255f9d0..cfa12a5dc 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -9,6 +9,7 @@ ### Bug Fixes * [#5345](https://github.com/netbox-community/netbox/issues/5345) - Fix non-deterministic ordering of prefixes and IP addresses +* [#5350](https://github.com/netbox-community/netbox/issues/5350) - Filter available racks by selected group when creating a rack reservation --- diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 45be438f2..871e4672c 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -741,7 +741,7 @@ class RackReservationForm(BootstrapMixin, TenancyForm, forms.ModelForm): display_field='display_name', query_params={ 'site_id': '$site', - 'group_id': '$rack', + 'group_id': '$rack_group', } ) units = NumericArrayField( From 8c4d4532a47e1b9fabe8b87b9a24e0eace6c30ca Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 16 Nov 2020 10:59:41 -0500 Subject: [PATCH 6/6] Fixes #5235: Fix exception when editing IP address with a NAT IP assigned to a non-racked device --- docs/release-notes/version-2.9.md | 1 + netbox/ipam/forms.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index cfa12a5dc..ebed19f20 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -8,6 +8,7 @@ ### Bug Fixes +* [#5235](https://github.com/netbox-community/netbox/issues/5235) - Fix exception when editing IP address with a NAT IP assigned to a non-racked device * [#5345](https://github.com/netbox-community/netbox/issues/5345) - Fix non-deterministic ordering of prefixes and IP addresses * [#5350](https://github.com/netbox-community/netbox/issues/5350) - Filter available racks by selected group when creating a rack reservation diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index ce7524dea..641f72a95 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -648,7 +648,8 @@ class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModel nat_inside_parent = instance.nat_inside.assigned_object if type(nat_inside_parent) is Interface: initial['nat_site'] = nat_inside_parent.device.site.pk - initial['nat_rack'] = nat_inside_parent.device.rack.pk + if nat_inside_parent.device.rack: + initial['nat_rack'] = nat_inside_parent.device.rack.pk initial['nat_device'] = nat_inside_parent.device.pk elif type(nat_inside_parent) is VMInterface: initial['nat_cluster'] = nat_inside_parent.virtual_machine.cluster.pk