From c60a0f4f56f0cf5f259eb0b4520b84e43741e876 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 27 Sep 2024 05:33:02 -0700 Subject: [PATCH 01/65] 16136 remove Django Admin (#17619) * 16136 remove Django Admin * 16136 fix plugin test * 16136 fix migrations * Revert "16136 fix migrations" This reverts commit 80296fa1ecc294e4df8d11d11ea6dc10921517b0. * Remove obsolete admin module from dummy plugin * Remove obsolete admin site configuration * Remove unused import statement * Remove obsolete admin module * Misc cleanup --------- Co-authored-by: Jeremy Stretch --- docs/configuration/miscellaneous.md | 8 -------- netbox/netbox/admin.py | 14 -------------- netbox/netbox/configuration_testing.py | 2 -- netbox/netbox/plugins/urls.py | 2 -- netbox/netbox/settings.py | 5 ----- netbox/netbox/tests/dummy_plugin/admin.py | 9 --------- netbox/netbox/tests/test_plugins.py | 6 ------ netbox/netbox/urls.py | 5 ----- netbox/templates/inc/user_menu.html | 5 ----- netbox/users/admin.py | 5 ----- 10 files changed, 61 deletions(-) delete mode 100644 netbox/netbox/admin.py delete mode 100644 netbox/netbox/tests/dummy_plugin/admin.py delete mode 100644 netbox/users/admin.py diff --git a/docs/configuration/miscellaneous.md b/docs/configuration/miscellaneous.md index 124de3037..576eb8739 100644 --- a/docs/configuration/miscellaneous.md +++ b/docs/configuration/miscellaneous.md @@ -96,14 +96,6 @@ The maximum size (in bytes) of an incoming HTTP request (i.e. `GET` or `POST` da --- -## DJANGO_ADMIN_ENABLED - -Default: False - -Setting this to True installs the `django.contrib.admin` app and enables the [Django admin UI](https://docs.djangoproject.com/en/5.0/ref/contrib/admin/). This may be necessary to support older plugins which do not integrate with the native NetBox interface. - ---- - ## ENFORCE_GLOBAL_UNIQUE !!! tip "Dynamic Configuration Parameter" diff --git a/netbox/netbox/admin.py b/netbox/netbox/admin.py deleted file mode 100644 index cdfacc141..000000000 --- a/netbox/netbox/admin.py +++ /dev/null @@ -1,14 +0,0 @@ -from django.conf import settings -from django.contrib.admin import site as admin_site -from taggit.models import Tag - - -# Override default AdminSite attributes so we can avoid creating and -# registering our own class -admin_site.site_header = 'NetBox Administration' -admin_site.site_title = 'NetBox' -admin_site.site_url = '/{}'.format(settings.BASE_PATH) -admin_site.index_template = 'admin/index.html' - -# Unregister the unused stock Tag model provided by django-taggit -admin_site.unregister(Tag) diff --git a/netbox/netbox/configuration_testing.py b/netbox/netbox/configuration_testing.py index 346cd89d2..cec05cabb 100644 --- a/netbox/netbox/configuration_testing.py +++ b/netbox/netbox/configuration_testing.py @@ -39,8 +39,6 @@ REDIS = { SECRET_KEY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' -DJANGO_ADMIN_ENABLED = True - DEFAULT_PERMISSIONS = {} LOGGING = { diff --git a/netbox/netbox/plugins/urls.py b/netbox/netbox/plugins/urls.py index 075bda811..7a9f30c7e 100644 --- a/netbox/netbox/plugins/urls.py +++ b/netbox/netbox/plugins/urls.py @@ -3,13 +3,11 @@ from importlib import import_module from django.apps import apps from django.conf import settings from django.conf.urls import include -from django.contrib.admin.views.decorators import staff_member_required from django.urls import path from django.utils.module_loading import import_string, module_has_submodule from . import views -# Initialize URL base, API, and admin URL patterns for plugins plugin_patterns = [] plugin_api_patterns = [ path('', views.PluginsAPIRootView.as_view(), name='api-root'), diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 358f41ff8..206a58cff 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -110,7 +110,6 @@ DEFAULT_PERMISSIONS = getattr(configuration, 'DEFAULT_PERMISSIONS', { 'users.delete_token': ({'user': '$user'},), }) DEVELOPER = getattr(configuration, 'DEVELOPER', False) -DJANGO_ADMIN_ENABLED = getattr(configuration, 'DJANGO_ADMIN_ENABLED', False) DOCS_ROOT = getattr(configuration, 'DOCS_ROOT', os.path.join(os.path.dirname(BASE_DIR), 'docs')) EMAIL = getattr(configuration, 'EMAIL', {}) EVENTS_PIPELINE = getattr(configuration, 'EVENTS_PIPELINE', ( @@ -373,7 +372,6 @@ SERVER_EMAIL = EMAIL.get('FROM_EMAIL') # INSTALLED_APPS = [ - 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -411,8 +409,6 @@ INSTALLED_APPS = [ ] if not DEBUG: INSTALLED_APPS.remove('debug_toolbar') -if not DJANGO_ADMIN_ENABLED: - INSTALLED_APPS.remove('django.contrib.admin') # Middleware MIDDLEWARE = [ @@ -549,7 +545,6 @@ EXEMPT_EXCLUDE_MODELS = ( # All URLs starting with a string listed here are exempt from maintenance mode enforcement MAINTENANCE_EXEMPT_PATHS = ( - f'/{BASE_PATH}admin/', f'/{BASE_PATH}extras/config-revisions/', # Allow modifying the configuration LOGIN_URL, LOGIN_REDIRECT_URL, diff --git a/netbox/netbox/tests/dummy_plugin/admin.py b/netbox/netbox/tests/dummy_plugin/admin.py deleted file mode 100644 index 83bc22ad8..000000000 --- a/netbox/netbox/tests/dummy_plugin/admin.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.contrib import admin - -from netbox.admin import admin_site -from .models import DummyModel - - -@admin.register(DummyModel, site=admin_site) -class DummyModelAdmin(admin.ModelAdmin): - list_display = ('name', 'number') diff --git a/netbox/netbox/tests/test_plugins.py b/netbox/netbox/tests/test_plugins.py index 351fef9e2..ba44378c5 100644 --- a/netbox/netbox/tests/test_plugins.py +++ b/netbox/netbox/tests/test_plugins.py @@ -36,12 +36,6 @@ class PluginTest(TestCase): instance.delete() self.assertIsNone(instance.pk) - def test_admin(self): - - # Test admin view URL resolution - url = reverse('admin:dummy_plugin_dummymodel_add') - self.assertEqual(url, '/admin/dummy_plugin/dummymodel/add/') - @override_settings(LOGIN_REQUIRED=False) def test_views(self): diff --git a/netbox/netbox/urls.py b/netbox/netbox/urls.py index b0175ec04..08c9a46a8 100644 --- a/netbox/netbox/urls.py +++ b/netbox/netbox/urls.py @@ -77,11 +77,6 @@ _patterns = [ path('api/plugins/', include((plugin_api_patterns, 'plugins-api'))), ] -# Django admin UI -if settings.DJANGO_ADMIN_ENABLED: - from .admin import admin_site - _patterns.append(path('admin/', admin_site.urls)) - # django-debug-toolbar if settings.DEBUG: import debug_toolbar diff --git a/netbox/templates/inc/user_menu.html b/netbox/templates/inc/user_menu.html index 1b6757416..e27be3323 100644 --- a/netbox/templates/inc/user_menu.html +++ b/netbox/templates/inc/user_menu.html @@ -36,11 +36,6 @@ + {% if object.vlan_translation_policy %} +
+
+ {% include 'inc/panel_table.html' with table=vlan_translation_table heading="VLAN Translation" %} +
+
+ {% endif %} {% if object.is_bridge %}
diff --git a/netbox/templates/ipam/vlantranslationpolicy.html b/netbox/templates/ipam/vlantranslationpolicy.html new file mode 100644 index 000000000..5217db913 --- /dev/null +++ b/netbox/templates/ipam/vlantranslationpolicy.html @@ -0,0 +1,55 @@ +{% extends 'generic/object.html' %} +{% load helpers %} +{% load plugins %} +{% load render_table from django_tables2 %} +{% load i18n %} + +{% block content %} +
+
+
+

{% trans "VLAN Translation Policy" %}

+ + + + + + + + + +
{% trans "Name" %}{{ object.name|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
+
+ {% plugin_left_page object %} +
+
+ {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
+
+
+
+
+

+ {% trans "VLAN Translation Rules" %} + {% if perms.ipam.add_vlantranslationrule %} + + {% endif %} +

+ {% htmx_table 'ipam:vlantranslationrule_list' policy_id=object.pk %} +
+
+
+
+
+ {% plugin_full_width_page object %} +
+
+{% endblock %} diff --git a/netbox/templates/ipam/vlantranslationrule.html b/netbox/templates/ipam/vlantranslationrule.html new file mode 100644 index 000000000..7f3aad2ad --- /dev/null +++ b/netbox/templates/ipam/vlantranslationrule.html @@ -0,0 +1,45 @@ +{% extends 'generic/object.html' %} +{% load helpers %} +{% load plugins %} +{% load render_table from django_tables2 %} +{% load i18n %} + +{% block content %} +
+
+
+

{% trans "VLAN Translation Rule" %}

+ + + + + + + + + + + + + + + + + +
{% trans "Policy" %}{{ object.policy|linkify }}
{% trans "Local VID" %}{{ object.local_vid }}
{% trans "Remote VID" %}{{ object.remote_vid }}
{% trans "Description" %}{{ object.description }}
+
+ {% plugin_left_page object %} +
+
+ {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
+
+
+
+ {% plugin_full_width_page object %} +
+
+{% endblock %} diff --git a/netbox/templates/virtualization/vminterface.html b/netbox/templates/virtualization/vminterface.html index 0d679680d..13cc8aa2f 100644 --- a/netbox/templates/virtualization/vminterface.html +++ b/netbox/templates/virtualization/vminterface.html @@ -67,6 +67,10 @@ {% trans "Tunnel" %} {{ object.tunnel_termination.tunnel|linkify|placeholder }} + + {% trans "VLAN Translation" %} + {{ object.vlan_translation_policy|linkify|placeholder }} +
{% include 'inc/panels/tags.html' %} @@ -100,6 +104,13 @@ {% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
+{% if object.vlan_translation_policy %} +
+
+ {% include 'inc/panel_table.html' with table=vlan_translation_table heading="VLAN Translation" %} +
+
+{% endif %}
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %} diff --git a/netbox/virtualization/api/serializers_/virtualmachines.py b/netbox/virtualization/api/serializers_/virtualmachines.py index 1b224c16a..2c00cac96 100644 --- a/netbox/virtualization/api/serializers_/virtualmachines.py +++ b/netbox/virtualization/api/serializers_/virtualmachines.py @@ -8,7 +8,7 @@ from dcim.api.serializers_.sites import SiteSerializer from dcim.choices import InterfaceModeChoices from extras.api.serializers_.configtemplates import ConfigTemplateSerializer from ipam.api.serializers_.ip import IPAddressSerializer -from ipam.api.serializers_.vlans import VLANSerializer +from ipam.api.serializers_.vlans import VLANSerializer, VLANTranslationPolicySerializer from ipam.api.serializers_.vrfs import VRFSerializer from ipam.models import VLAN from netbox.api.fields import ChoiceField, SerializedPKRelatedField @@ -89,6 +89,7 @@ class VMInterfaceSerializer(NetBoxModelSerializer): required=False, many=True ) + vlan_translation_policy = VLANTranslationPolicySerializer(nested=True, required=False, allow_null=True) vrf = VRFSerializer(nested=True, required=False, allow_null=True) l2vpn_termination = L2VPNTerminationSerializer(nested=True, read_only=True, allow_null=True) count_ipaddresses = serializers.IntegerField(read_only=True) @@ -105,6 +106,7 @@ class VMInterfaceSerializer(NetBoxModelSerializer): 'id', 'url', 'display_url', 'display', 'virtual_machine', 'name', 'enabled', 'parent', 'bridge', 'mtu', 'mac_address', 'description', 'mode', 'untagged_vlan', 'tagged_vlans', 'vrf', 'l2vpn_termination', 'tags', 'custom_fields', 'created', 'last_updated', 'count_ipaddresses', 'count_fhrp_groups', + 'vlan_translation_policy', ] brief_fields = ('id', 'url', 'display', 'virtual_machine', 'name', 'description') diff --git a/netbox/virtualization/forms/model_forms.py b/netbox/virtualization/forms/model_forms.py index 9ffc914ab..5971fc894 100644 --- a/netbox/virtualization/forms/model_forms.py +++ b/netbox/virtualization/forms/model_forms.py @@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _ from dcim.forms.common import InterfaceCommonForm from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup from extras.models import ConfigTemplate -from ipam.models import IPAddress, VLAN, VLANGroup, VRF +from ipam.models import IPAddress, VLAN, VLANGroup, VLANTranslationPolicy, VRF from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm from utilities.forms import ConfirmationForm @@ -343,20 +343,25 @@ class VMInterfaceForm(InterfaceCommonForm, VMComponentForm): required=False, label=_('VRF') ) + vlan_translation_policy = DynamicModelChoiceField( + queryset=VLANTranslationPolicy.objects.all(), + required=False, + label=_('VLAN Translation Policy') + ) fieldsets = ( FieldSet('virtual_machine', 'name', 'description', 'tags', name=_('Interface')), FieldSet('vrf', 'mac_address', name=_('Addressing')), FieldSet('mtu', 'enabled', name=_('Operation')), FieldSet('parent', 'bridge', name=_('Related Interfaces')), - FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', name=_('802.1Q Switching')), + FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vlan_translation_policy', name=_('802.1Q Switching')), ) class Meta: model = VMInterface fields = [ 'virtual_machine', 'name', 'parent', 'bridge', 'enabled', 'mac_address', 'mtu', 'description', 'mode', - 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags', + 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags', 'vlan_translation_policy', ] labels = { 'mode': '802.1Q Mode', diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index 2d872322b..bed65a3b3 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -100,6 +100,7 @@ class VMInterfaceType(IPAddressesMixin, ComponentType): bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None + vlan_translation_policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] | None tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]] bridge_interfaces: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]] diff --git a/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py new file mode 100644 index 000000000..e0992c9c8 --- /dev/null +++ b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py @@ -0,0 +1,20 @@ +# Generated by Django 5.0.9 on 2024-10-11 19:45 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ipam', '0074_vlantranslationpolicy_vlantranslationrule'), + ('virtualization', '0041_charfield_null_choices'), + ] + + operations = [ + migrations.AddField( + model_name='vminterface', + name='vlan_translation_policy', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlantranslationpolicy'), + ), + ] diff --git a/netbox/virtualization/tests/test_filtersets.py b/netbox/virtualization/tests/test_filtersets.py index d2e6cc05f..cd598274f 100644 --- a/netbox/virtualization/tests/test_filtersets.py +++ b/netbox/virtualization/tests/test_filtersets.py @@ -1,7 +1,7 @@ from django.test import TestCase from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup -from ipam.models import IPAddress, VRF +from ipam.models import IPAddress, VLANTranslationPolicy, VRF from tenancy.models import Tenant, TenantGroup from utilities.testing import ChangeLoggedFilterSetTests, create_test_device from virtualization.choices import * @@ -561,6 +561,13 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): ) VirtualMachine.objects.bulk_create(vms) + vlan_translation_policies = ( + VLANTranslationPolicy(name='Policy 1'), + VLANTranslationPolicy(name='Policy 2'), + VLANTranslationPolicy(name='Policy 3'), + ) + VLANTranslationPolicy.objects.bulk_create(vlan_translation_policies) + interfaces = ( VMInterface( virtual_machine=vms[0], @@ -569,7 +576,8 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): mtu=100, mac_address='00-00-00-00-00-01', vrf=vrfs[0], - description='foobar1' + description='foobar1', + vlan_translation_policy=vlan_translation_policies[0], ), VMInterface( virtual_machine=vms[1], @@ -578,7 +586,8 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): mtu=200, mac_address='00-00-00-00-00-02', vrf=vrfs[1], - description='foobar2' + description='foobar2', + vlan_translation_policy=vlan_translation_policies[0], ), VMInterface( virtual_machine=vms[2], @@ -658,6 +667,13 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): params = {'description': ['foobar1', 'foobar2']} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + def test_vlan_translation_policy(self): + vlan_translation_policies = VLANTranslationPolicy.objects.all()[:2] + params = {'vlan_translation_policy_id': [vlan_translation_policies[0].pk, vlan_translation_policies[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'vlan_translation_policy': [vlan_translation_policies[0].name, vlan_translation_policies[1].name]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + class VirtualDiskTestCase(TestCase, ChangeLoggedFilterSetTests): queryset = VirtualDisk.objects.all() diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index d1d65b1ff..35f2f8f75 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -16,7 +16,7 @@ from dcim.models import Device from dcim.tables import DeviceTable from extras.views import ObjectConfigContextView from ipam.models import IPAddress -from ipam.tables import InterfaceVLANTable +from ipam.tables import InterfaceVLANTable, VLANTranslationRuleTable from netbox.constants import DEFAULT_ACTION_PERMISSIONS from netbox.views import generic from tenancy.views import ObjectContactsView @@ -516,6 +516,14 @@ class VMInterfaceView(generic.ObjectView): orderable=False ) + # Get VLAN translation rules + vlan_translation_table = None + if instance.vlan_translation_policy: + vlan_translation_table = VLANTranslationRuleTable( + data=instance.vlan_translation_policy.rules.all(), + orderable=False + ) + # Get assigned VLANs and annotate whether each is tagged or untagged vlans = [] if instance.untagged_vlan is not None: @@ -533,6 +541,7 @@ class VMInterfaceView(generic.ObjectView): return { 'child_interfaces_table': child_interfaces_tables, 'vlan_table': vlan_table, + 'vlan_translation_table': vlan_translation_table, } From a8eb455f3e83cc79f38a51ae32266911aa4e2f16 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Thu, 31 Oct 2024 06:55:08 -0700 Subject: [PATCH 20/65] 9604 Add Termination to CircuitTermination (#17821) * 9604 add scope type to CircuitTermination * 9604 add scope type to CircuitTermination * 9604 add scope type to CircuitTermination * 9604 model_forms * 9604 form filtersets * 9604 form bulk_import * 9604 form bulk_edit * 9604 serializers * 9604 graphql * 9604 tests and detail template * 9604 fix migration merge * 9604 fix tests * 9604 fix tests * 9604 fix table * 9604 updates * fix tests * fix tests * fix tests * fix tests * fix tests * fix tests * fix tests * 9604 remove provider_network * 9604 fix tests * 9604 fix tests * 9604 fix forms * 9604 review changes * 9604 scope->termination * 9604 fix _circuit_terminations * 9604 fix _circuit_terminations * 9604 sitegroup -> site_group * 9604 update docs * 9604 fix form termination side reference * Misc cleanup * Fix terminations in circuits table * Fix missing imports * Clean up termination attrs display * Add termination & type to CircuitTerminationTable * Update cable tracing logic --------- Co-authored-by: Jeremy Stretch --- docs/models/circuits/circuittermination.md | 8 +- netbox/circuits/api/serializers_/circuits.py | 51 ++++++++-- netbox/circuits/constants.py | 4 + netbox/circuits/filtersets.py | 76 +++++++++++---- netbox/circuits/forms/bulk_edit.py | 54 +++++++---- netbox/circuits/forms/bulk_import.py | 30 +++--- netbox/circuits/forms/filtersets.py | 25 +++-- netbox/circuits/forms/model_forms.py | 63 ++++++++++--- netbox/circuits/graphql/types.py | 16 +++- .../0047_circuittermination__termination.py | 56 +++++++++++ ...48_circuitterminations_cached_relations.py | 90 ++++++++++++++++++ netbox/circuits/models/circuits.py | 94 ++++++++++++++++--- netbox/circuits/tables/circuits.py | 52 +++++++--- netbox/circuits/tests/test_api.py | 14 +-- netbox/circuits/tests/test_filtersets.py | 48 +++++----- netbox/circuits/tests/test_views.py | 46 +++++---- netbox/circuits/views.py | 11 +-- netbox/dcim/graphql/types.py | 17 +++- netbox/dcim/models/cables.py | 12 +-- netbox/dcim/tests/test_cablepaths.py | 30 +++--- netbox/dcim/tests/test_filtersets.py | 6 +- netbox/dcim/tests/test_models.py | 6 +- netbox/dcim/views.py | 26 ++++- .../inc/circuit_termination_fields.html | 25 ++--- 24 files changed, 649 insertions(+), 211 deletions(-) create mode 100644 netbox/circuits/constants.py create mode 100644 netbox/circuits/migrations/0047_circuittermination__termination.py create mode 100644 netbox/circuits/migrations/0048_circuitterminations_cached_relations.py diff --git a/docs/models/circuits/circuittermination.md b/docs/models/circuits/circuittermination.md index c6aa966d0..791863483 100644 --- a/docs/models/circuits/circuittermination.md +++ b/docs/models/circuits/circuittermination.md @@ -21,13 +21,9 @@ Designates the termination as forming either the A or Z end of the circuit. If selected, the circuit termination will be considered "connected" even if no cable has been connected to it in NetBox. -### Site +### Termination -The [site](../dcim/site.md) with which this circuit termination is associated. Once created, a cable can be connected between the circuit termination and a device interface (or similar component). - -### Provider Network - -Circuits which do not connect to a site modeled by NetBox can instead be terminated to a [provider network](./providernetwork.md) representing an unknown network operated by a [provider](./provider.md). +The [region](../dcim/region.md), [site group](../dcim/sitegroup.md), [site](../dcim/site.md), [location](../dcim/location.md) or [provider network](./providernetwork.md) with which this circuit termination is associated. Once created, a cable can be connected between the circuit termination and a device interface (or similar component). ### Port Speed diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index 111fa6f87..96a686a65 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -1,11 +1,16 @@ +from django.contrib.contenttypes.models import ContentType +from drf_spectacular.utils import extend_schema_field +from rest_framework import serializers + from circuits.choices import CircuitPriorityChoices, CircuitStatusChoices +from circuits.constants import CIRCUIT_TERMINATION_TERMINATION_TYPES from circuits.models import Circuit, CircuitGroup, CircuitGroupAssignment, CircuitTermination, CircuitType from dcim.api.serializers_.cables import CabledObjectSerializer -from dcim.api.serializers_.sites import SiteSerializer -from netbox.api.fields import ChoiceField, RelatedObjectCountField +from netbox.api.fields import ChoiceField, ContentTypeField, RelatedObjectCountField from netbox.api.serializers import NetBoxModelSerializer, WritableNestedSerializer from netbox.choices import DistanceUnitChoices from tenancy.api.serializers_.tenants import TenantSerializer +from utilities.api import get_serializer_for_model from .providers import ProviderAccountSerializer, ProviderNetworkSerializer, ProviderSerializer @@ -33,16 +38,33 @@ class CircuitTypeSerializer(NetBoxModelSerializer): class CircuitCircuitTerminationSerializer(WritableNestedSerializer): - site = SiteSerializer(nested=True, allow_null=True) + termination_type = ContentTypeField( + queryset=ContentType.objects.filter( + model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES + ), + allow_null=True, + required=False, + default=None + ) + termination_id = serializers.IntegerField(allow_null=True, required=False, default=None) + termination = serializers.SerializerMethodField(read_only=True) provider_network = ProviderNetworkSerializer(nested=True, allow_null=True) class Meta: model = CircuitTermination fields = [ - 'id', 'url', 'display_url', 'display', 'site', 'provider_network', 'port_speed', 'upstream_speed', + 'id', 'url', 'display_url', 'display', 'termination_type', 'termination_id', 'termination', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', ] + @extend_schema_field(serializers.JSONField(allow_null=True)) + def get_termination(self, obj): + if obj.termination_id is None: + return None + serializer = get_serializer_for_model(obj.termination) + context = {'request': self.context['request']} + return serializer(obj.termination, nested=True, context=context).data + class CircuitGroupSerializer(NetBoxModelSerializer): tenant = TenantSerializer(nested=True, required=False, allow_null=True) @@ -95,18 +117,35 @@ class CircuitSerializer(NetBoxModelSerializer): class CircuitTerminationSerializer(NetBoxModelSerializer, CabledObjectSerializer): circuit = CircuitSerializer(nested=True) - site = SiteSerializer(nested=True, required=False, allow_null=True) + termination_type = ContentTypeField( + queryset=ContentType.objects.filter( + model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES + ), + allow_null=True, + required=False, + default=None + ) + termination_id = serializers.IntegerField(allow_null=True, required=False, default=None) + termination = serializers.SerializerMethodField(read_only=True) provider_network = ProviderNetworkSerializer(nested=True, required=False, allow_null=True) class Meta: model = CircuitTermination fields = [ - 'id', 'url', 'display_url', 'display', 'circuit', 'term_side', 'site', 'provider_network', 'port_speed', + 'id', 'url', 'display_url', 'display', 'circuit', 'term_side', 'termination_type', 'termination_id', 'termination', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', 'mark_connected', 'cable', 'cable_end', 'link_peers', 'link_peers_type', 'tags', 'custom_fields', 'created', 'last_updated', '_occupied', ] brief_fields = ('id', 'url', 'display', 'circuit', 'term_side', 'description', 'cable', '_occupied') + @extend_schema_field(serializers.JSONField(allow_null=True)) + def get_termination(self, obj): + if obj.termination_id is None: + return None + serializer = get_serializer_for_model(obj.termination) + context = {'request': self.context['request']} + return serializer(obj.termination, nested=True, context=context).data + class CircuitGroupAssignmentSerializer(CircuitGroupAssignmentSerializer_): circuit = CircuitSerializer(nested=True) diff --git a/netbox/circuits/constants.py b/netbox/circuits/constants.py new file mode 100644 index 000000000..8119bc286 --- /dev/null +++ b/netbox/circuits/constants.py @@ -0,0 +1,4 @@ +# models values for ContentTypes which may be CircuitTermination termination types +CIRCUIT_TERMINATION_TERMINATION_TYPES = ( + 'region', 'sitegroup', 'site', 'location', 'providernetwork', +) diff --git a/netbox/circuits/filtersets.py b/netbox/circuits/filtersets.py index ebd1fe28d..4a2a972f3 100644 --- a/netbox/circuits/filtersets.py +++ b/netbox/circuits/filtersets.py @@ -3,11 +3,11 @@ from django.db.models import Q from django.utils.translation import gettext as _ from dcim.filtersets import CabledObjectFilterSet -from dcim.models import Region, Site, SiteGroup +from dcim.models import Location, Region, Site, SiteGroup from ipam.models import ASN from netbox.filtersets import NetBoxModelFilterSet, OrganizationalModelFilterSet from tenancy.filtersets import ContactModelFilterSet, TenancyFilterSet -from utilities.filters import TreeNodeMultipleChoiceFilter +from utilities.filters import ContentTypeFilter, TreeNodeMultipleChoiceFilter from .choices import * from .models import * @@ -26,37 +26,37 @@ __all__ = ( class ProviderFilterSet(NetBoxModelFilterSet, ContactModelFilterSet): region_id = TreeNodeMultipleChoiceFilter( queryset=Region.objects.all(), - field_name='circuits__terminations__site__region', + field_name='circuits__terminations___region', lookup_expr='in', label=_('Region (ID)'), ) region = TreeNodeMultipleChoiceFilter( queryset=Region.objects.all(), - field_name='circuits__terminations__site__region', + field_name='circuits__terminations___region', lookup_expr='in', to_field_name='slug', label=_('Region (slug)'), ) site_group_id = TreeNodeMultipleChoiceFilter( queryset=SiteGroup.objects.all(), - field_name='circuits__terminations__site__group', + field_name='circuits__terminations___site_group', lookup_expr='in', label=_('Site group (ID)'), ) site_group = TreeNodeMultipleChoiceFilter( queryset=SiteGroup.objects.all(), - field_name='circuits__terminations__site__group', + field_name='circuits__terminations___site_group', lookup_expr='in', to_field_name='slug', label=_('Site group (slug)'), ) site_id = django_filters.ModelMultipleChoiceFilter( - field_name='circuits__terminations__site', + field_name='circuits__terminations___site', queryset=Site.objects.all(), label=_('Site'), ) site = django_filters.ModelMultipleChoiceFilter( - field_name='circuits__terminations__site__slug', + field_name='circuits__terminations___site__slug', queryset=Site.objects.all(), to_field_name='slug', label=_('Site (slug)'), @@ -173,7 +173,7 @@ class CircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte label=_('Provider account (account)'), ) provider_network_id = django_filters.ModelMultipleChoiceFilter( - field_name='terminations__provider_network', + field_name='terminations___provider_network', queryset=ProviderNetwork.objects.all(), label=_('Provider network (ID)'), ) @@ -193,37 +193,37 @@ class CircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte ) region_id = TreeNodeMultipleChoiceFilter( queryset=Region.objects.all(), - field_name='terminations__site__region', + field_name='terminations___region', lookup_expr='in', label=_('Region (ID)'), ) region = TreeNodeMultipleChoiceFilter( queryset=Region.objects.all(), - field_name='terminations__site__region', + field_name='terminations___region', lookup_expr='in', to_field_name='slug', label=_('Region (slug)'), ) site_group_id = TreeNodeMultipleChoiceFilter( queryset=SiteGroup.objects.all(), - field_name='terminations__site__group', + field_name='terminations___site_group', lookup_expr='in', label=_('Site group (ID)'), ) site_group = TreeNodeMultipleChoiceFilter( queryset=SiteGroup.objects.all(), - field_name='terminations__site__group', + field_name='terminations___site_group', lookup_expr='in', to_field_name='slug', label=_('Site group (slug)'), ) site_id = django_filters.ModelMultipleChoiceFilter( - field_name='terminations__site', + field_name='terminations___site', queryset=Site.objects.all(), label=_('Site (ID)'), ) site = django_filters.ModelMultipleChoiceFilter( - field_name='terminations__site__slug', + field_name='terminations___site__slug', queryset=Site.objects.all(), to_field_name='slug', label=_('Site (slug)'), @@ -263,18 +263,60 @@ class CircuitTerminationFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet): queryset=Circuit.objects.all(), label=_('Circuit'), ) + termination_type = ContentTypeFilter() + region_id = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + label=_('Region (ID)'), + ) + region = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + to_field_name='slug', + label=_('Region (slug)'), + ) + site_group_id = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + label=_('Site group (ID)'), + ) + site_group = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + to_field_name='slug', + label=_('Site group (slug)'), + ) site_id = django_filters.ModelMultipleChoiceFilter( queryset=Site.objects.all(), + field_name='_site', label=_('Site (ID)'), ) site = django_filters.ModelMultipleChoiceFilter( - field_name='site__slug', + field_name='_site__slug', queryset=Site.objects.all(), to_field_name='slug', label=_('Site (slug)'), ) + location_id = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + label=_('Location (ID)'), + ) + location = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + to_field_name='slug', + label=_('Location (slug)'), + ) provider_network_id = django_filters.ModelMultipleChoiceFilter( queryset=ProviderNetwork.objects.all(), + field_name='_provider_network', label=_('ProviderNetwork (ID)'), ) provider_id = django_filters.ModelMultipleChoiceFilter( @@ -292,7 +334,7 @@ class CircuitTerminationFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet): class Meta: model = CircuitTermination fields = ( - 'id', 'term_side', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', 'mark_connected', + 'id', 'termination_id', 'term_side', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', 'mark_connected', 'pp_info', 'cable_end', ) diff --git a/netbox/circuits/forms/bulk_edit.py b/netbox/circuits/forms/bulk_edit.py index 5cb7b5d30..e3f0b5d0c 100644 --- a/netbox/circuits/forms/bulk_edit.py +++ b/netbox/circuits/forms/bulk_edit.py @@ -1,17 +1,23 @@ from django import forms +from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ from circuits.choices import CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices +from circuits.constants import CIRCUIT_TERMINATION_TERMINATION_TYPES from circuits.models import * from dcim.models import Site from ipam.models import ASN from netbox.choices import DistanceUnitChoices from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant -from utilities.forms import add_blank_choice -from utilities.forms.fields import ColorField, CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField -from utilities.forms.rendering import FieldSet, TabbedGroups -from utilities.forms.widgets import BulkEditNullBooleanSelect, DatePicker, NumberWithOptions +from utilities.forms import add_blank_choice, get_field_value +from utilities.forms.fields import ( + ColorField, CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, +) +from utilities.forms.rendering import FieldSet +from utilities.forms.widgets import BulkEditNullBooleanSelect, DatePicker, HTMXSelect, NumberWithOptions +from utilities.templatetags.builtins.filters import bettertitle __all__ = ( 'CircuitBulkEditForm', @@ -197,15 +203,18 @@ class CircuitTerminationBulkEditForm(NetBoxModelBulkEditForm): max_length=200, required=False ) - site = DynamicModelChoiceField( - label=_('Site'), - queryset=Site.objects.all(), - required=False + termination_type = ContentTypeChoiceField( + queryset=ContentType.objects.filter(model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES), + widget=HTMXSelect(method='post', attrs={'hx-select': '#form_fields'}), + required=False, + label=_('Termination type') ) - provider_network = DynamicModelChoiceField( - label=_('Provider Network'), - queryset=ProviderNetwork.objects.all(), - required=False + termination = DynamicModelChoiceField( + label=_('Termination'), + queryset=Site.objects.none(), # Initial queryset + required=False, + disabled=True, + selector=True ) port_speed = forms.IntegerField( required=False, @@ -225,15 +234,26 @@ class CircuitTerminationBulkEditForm(NetBoxModelBulkEditForm): fieldsets = ( FieldSet( 'description', - TabbedGroups( - FieldSet('site', name=_('Site')), - FieldSet('provider_network', name=_('Provider Network')), - ), + 'termination_type', 'termination', 'mark_connected', name=_('Circuit Termination') ), FieldSet('port_speed', 'upstream_speed', name=_('Termination Details')), ) - nullable_fields = ('description') + nullable_fields = ('description', 'termination') + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + if termination_type_id := get_field_value(self, 'termination_type'): + try: + termination_type = ContentType.objects.get(pk=termination_type_id) + model = termination_type.model_class() + self.fields['termination'].queryset = model.objects.all() + self.fields['termination'].widget.attrs['selector'] = model._meta.label_lower + self.fields['termination'].disabled = False + self.fields['termination'].label = _(bettertitle(model._meta.verbose_name)) + except ObjectDoesNotExist: + pass class CircuitGroupBulkEditForm(NetBoxModelBulkEditForm): diff --git a/netbox/circuits/forms/bulk_import.py b/netbox/circuits/forms/bulk_import.py index d5cdc00a7..eab87b1f5 100644 --- a/netbox/circuits/forms/bulk_import.py +++ b/netbox/circuits/forms/bulk_import.py @@ -1,13 +1,14 @@ from django import forms +from django.contrib.contenttypes.models import ContentType from django.utils.translation import gettext_lazy as _ from circuits.choices import * +from circuits.constants import * from circuits.models import * -from dcim.models import Site from netbox.choices import DistanceUnitChoices from netbox.forms import NetBoxModelImportForm from tenancy.models import Tenant -from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField +from utilities.forms.fields import CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, SlugField __all__ = ( 'CircuitImportForm', @@ -127,17 +128,10 @@ class BaseCircuitTerminationImportForm(forms.ModelForm): label=_('Termination'), choices=CircuitTerminationSideChoices, ) - site = CSVModelChoiceField( - label=_('Site'), - queryset=Site.objects.all(), - to_field_name='name', - required=False - ) - provider_network = CSVModelChoiceField( - label=_('Provider network'), - queryset=ProviderNetwork.objects.all(), - to_field_name='name', - required=False + termination_type = CSVContentTypeField( + queryset=ContentType.objects.filter(model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES), + required=False, + label=_('Termination type (app & model)') ) @@ -145,9 +139,12 @@ class CircuitTerminationImportRelatedForm(BaseCircuitTerminationImportForm): class Meta: model = CircuitTermination fields = [ - 'circuit', 'term_side', 'site', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', + 'circuit', 'term_side', 'termination_type', 'termination_id', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description' ] + labels = { + 'termination_id': _('Termination ID'), + } class CircuitTerminationImportForm(NetBoxModelImportForm, BaseCircuitTerminationImportForm): @@ -155,9 +152,12 @@ class CircuitTerminationImportForm(NetBoxModelImportForm, BaseCircuitTermination class Meta: model = CircuitTermination fields = [ - 'circuit', 'term_side', 'site', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', + 'circuit', 'term_side', 'termination_type', 'termination_id', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', 'tags' ] + labels = { + 'termination_id': _('Termination ID'), + } class CircuitGroupImportForm(NetBoxModelImportForm): diff --git a/netbox/circuits/forms/filtersets.py b/netbox/circuits/forms/filtersets.py index 2e9b358e8..b585ce079 100644 --- a/netbox/circuits/forms/filtersets.py +++ b/netbox/circuits/forms/filtersets.py @@ -3,7 +3,7 @@ from django.utils.translation import gettext as _ from circuits.choices import CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices, CircuitTerminationSideChoices from circuits.models import * -from dcim.models import Region, Site, SiteGroup +from dcim.models import Location, Region, Site, SiteGroup from ipam.models import ASN from netbox.choices import DistanceUnitChoices from netbox.forms import NetBoxModelFilterSetForm @@ -207,18 +207,29 @@ class CircuitTerminationFilterForm(NetBoxModelFilterSetForm): fieldsets = ( FieldSet('q', 'filter_id', 'tag'), FieldSet('circuit_id', 'term_side', name=_('Circuit')), - FieldSet('provider_id', 'provider_network_id', name=_('Provider')), - FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')), + FieldSet('provider_id', name=_('Provider')), + FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Termination')), + ) + region_id = DynamicModelMultipleChoiceField( + queryset=Region.objects.all(), + required=False, + label=_('Region') + ) + site_group_id = DynamicModelMultipleChoiceField( + queryset=SiteGroup.objects.all(), + required=False, + label=_('Site group') ) site_id = DynamicModelMultipleChoiceField( queryset=Site.objects.all(), required=False, - query_params={ - 'region_id': '$region_id', - 'site_group_id': '$site_group_id', - }, label=_('Site') ) + location_id = DynamicModelMultipleChoiceField( + queryset=Location.objects.all(), + required=False, + label=_('Location') + ) circuit_id = DynamicModelMultipleChoiceField( queryset=Circuit.objects.all(), required=False, diff --git a/netbox/circuits/forms/model_forms.py b/netbox/circuits/forms/model_forms.py index e00034a10..10cd06563 100644 --- a/netbox/circuits/forms/model_forms.py +++ b/netbox/circuits/forms/model_forms.py @@ -1,14 +1,19 @@ +from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ from circuits.choices import CircuitCommitRateChoices, CircuitTerminationPortSpeedChoices +from circuits.constants import * from circuits.models import * from dcim.models import Site from ipam.models import ASN from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm -from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField -from utilities.forms.rendering import FieldSet, InlineFields, TabbedGroups -from utilities.forms.widgets import DatePicker, NumberWithOptions +from utilities.forms import get_field_value +from utilities.forms.fields import CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField +from utilities.forms.rendering import FieldSet, InlineFields +from utilities.forms.widgets import DatePicker, HTMXSelect, NumberWithOptions +from utilities.templatetags.builtins.filters import bettertitle __all__ = ( 'CircuitForm', @@ -144,26 +149,24 @@ class CircuitTerminationForm(NetBoxModelForm): queryset=Circuit.objects.all(), selector=True ) - site = DynamicModelChoiceField( - label=_('Site'), - queryset=Site.objects.all(), + termination_type = ContentTypeChoiceField( + queryset=ContentType.objects.filter(model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES), + widget=HTMXSelect(), required=False, - selector=True + label=_('Termination type') ) - provider_network = DynamicModelChoiceField( - label=_('Provider network'), - queryset=ProviderNetwork.objects.all(), + termination = DynamicModelChoiceField( + label=_('Termination'), + queryset=Site.objects.none(), # Initial queryset required=False, + disabled=True, selector=True ) fieldsets = ( FieldSet( 'circuit', 'term_side', 'description', 'tags', - TabbedGroups( - FieldSet('site', name=_('Site')), - FieldSet('provider_network', name=_('Provider Network')), - ), + 'termination_type', 'termination', 'mark_connected', name=_('Circuit Termination') ), FieldSet('port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', name=_('Termination Details')), @@ -172,7 +175,7 @@ class CircuitTerminationForm(NetBoxModelForm): class Meta: model = CircuitTermination fields = [ - 'circuit', 'term_side', 'site', 'provider_network', 'mark_connected', 'port_speed', 'upstream_speed', + 'circuit', 'term_side', 'termination_type', 'mark_connected', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', 'tags', ] widgets = { @@ -184,6 +187,36 @@ class CircuitTerminationForm(NetBoxModelForm): ), } + def __init__(self, *args, **kwargs): + instance = kwargs.get('instance') + initial = kwargs.get('initial', {}) + + if instance is not None and instance.termination: + initial['termination'] = instance.termination + kwargs['initial'] = initial + + super().__init__(*args, **kwargs) + + if termination_type_id := get_field_value(self, 'termination_type'): + try: + termination_type = ContentType.objects.get(pk=termination_type_id) + model = termination_type.model_class() + self.fields['termination'].queryset = model.objects.all() + self.fields['termination'].widget.attrs['selector'] = model._meta.label_lower + self.fields['termination'].disabled = False + self.fields['termination'].label = _(bettertitle(model._meta.verbose_name)) + except ObjectDoesNotExist: + pass + + if self.instance and termination_type_id != self.instance.termination_type_id: + self.initial['termination'] = None + + def clean(self): + super().clean() + + # Assign the selected termination (if any) + self.instance.termination = self.cleaned_data.get('termination') + class CircuitGroupForm(TenancyForm, NetBoxModelForm): slug = SlugField() diff --git a/netbox/circuits/graphql/types.py b/netbox/circuits/graphql/types.py index 45f0d065d..b52f9d18d 100644 --- a/netbox/circuits/graphql/types.py +++ b/netbox/circuits/graphql/types.py @@ -1,4 +1,4 @@ -from typing import Annotated, List +from typing import Annotated, List, Union import strawberry import strawberry_django @@ -59,13 +59,21 @@ class ProviderNetworkType(NetBoxObjectType): @strawberry_django.type( models.CircuitTermination, - fields='__all__', + exclude=('termination_type', 'termination_id', '_location', '_region', '_site', '_site_group', '_provider_network'), filters=CircuitTerminationFilter ) class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, ObjectType): circuit: Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')] - provider_network: Annotated["ProviderNetworkType", strawberry.lazy('circuits.graphql.types')] | None - site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] | None + + @strawberry_django.field + def termination(self) -> Annotated[Union[ + Annotated["LocationType", strawberry.lazy('dcim.graphql.types')], + Annotated["RegionType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteType", strawberry.lazy('dcim.graphql.types')], + Annotated["ProviderNetworkType", strawberry.lazy('circuits.graphql.types')], + ], strawberry.union("CircuitTerminationTerminationType")] | None: + return self.termination @strawberry_django.type( diff --git a/netbox/circuits/migrations/0047_circuittermination__termination.py b/netbox/circuits/migrations/0047_circuittermination__termination.py new file mode 100644 index 000000000..cb2c9ca07 --- /dev/null +++ b/netbox/circuits/migrations/0047_circuittermination__termination.py @@ -0,0 +1,56 @@ +import django.db.models.deletion +from django.db import migrations, models + + +def copy_site_assignments(apps, schema_editor): + """ + Copy site ForeignKey values to the Termination GFK. + """ + ContentType = apps.get_model('contenttypes', 'ContentType') + CircuitTermination = apps.get_model('circuits', 'CircuitTermination') + Site = apps.get_model('dcim', 'Site') + + CircuitTermination.objects.filter(site__isnull=False).update( + termination_type=ContentType.objects.get_for_model(Site), + termination_id=models.F('site_id') + ) + + ProviderNetwork = apps.get_model('circuits', 'ProviderNetwork') + CircuitTermination.objects.filter(provider_network__isnull=False).update( + termination_type=ContentType.objects.get_for_model(ProviderNetwork), + termination_id=models.F('provider_network_id') + ) + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0046_charfield_null_choices'), + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0193_poweroutlet_color'), + ] + + operations = [ + migrations.AddField( + model_name='circuittermination', + name='termination_id', + field=models.PositiveBigIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='circuittermination', + name='termination_type', + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location', 'providernetwork'))), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + + # Copy over existing site assignments + migrations.RunPython( + code=copy_site_assignments, + reverse_code=migrations.RunPython.noop + ), + ] diff --git a/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py b/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py new file mode 100644 index 000000000..628579228 --- /dev/null +++ b/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py @@ -0,0 +1,90 @@ +# Generated by Django 5.0.9 on 2024-10-21 17:34 +import django.db.models.deletion +from django.db import migrations, models + + +def populate_denormalized_fields(apps, schema_editor): + """ + Copy site ForeignKey values to the Termination GFK. + """ + CircuitTermination = apps.get_model('circuits', 'CircuitTermination') + + terminations = CircuitTermination.objects.filter(site__isnull=False).prefetch_related('site') + for termination in terminations: + termination._region_id = termination.site.region_id + termination._site_group_id = termination.site.group_id + termination._site_id = termination.site_id + # Note: Location cannot be set prior to migration + + CircuitTermination.objects.bulk_update(terminations, ['_region', '_site_group', '_site']) + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0047_circuittermination__termination'), + ] + + operations = [ + migrations.AddField( + model_name='circuittermination', + name='_location', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='circuit_terminations', + to='dcim.location', + ), + ), + migrations.AddField( + model_name='circuittermination', + name='_region', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='circuit_terminations', + to='dcim.region', + ), + ), + migrations.AddField( + model_name='circuittermination', + name='_site', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='circuit_terminations', + to='dcim.site', + ), + ), + migrations.AddField( + model_name='circuittermination', + name='_site_group', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='circuit_terminations', + to='dcim.sitegroup', + ), + ), + + # Populate denormalized FK values + migrations.RunPython( + code=populate_denormalized_fields, + reverse_code=migrations.RunPython.noop + ), + + # Delete the site ForeignKey + migrations.RemoveField( + model_name='circuittermination', + name='site', + ), + migrations.RenameField( + model_name='circuittermination', + old_name='provider_network', + new_name='_provider_network', + ), + ] diff --git a/netbox/circuits/models/circuits.py b/netbox/circuits/models/circuits.py index 5f749550c..85b22eaa5 100644 --- a/netbox/circuits/models/circuits.py +++ b/netbox/circuits/models/circuits.py @@ -1,9 +1,13 @@ +from django.apps import apps +from django.contrib.contenttypes.fields import GenericForeignKey from django.core.exceptions import ValidationError from django.db import models +from django.db.models import Q from django.urls import reverse from django.utils.translation import gettext_lazy as _ from circuits.choices import * +from circuits.constants import * from dcim.models import CabledObjectModel from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel from netbox.models.mixins import DistanceMixin @@ -230,22 +234,24 @@ class CircuitTermination( term_side = models.CharField( max_length=1, choices=CircuitTerminationSideChoices, - verbose_name=_('termination') + verbose_name=_('termination side') ) - site = models.ForeignKey( - to='dcim.Site', + termination_type = models.ForeignKey( + to='contenttypes.ContentType', on_delete=models.PROTECT, - related_name='circuit_terminations', + limit_choices_to=Q(model__in=CIRCUIT_TERMINATION_TERMINATION_TYPES), + related_name='+', blank=True, null=True ) - provider_network = models.ForeignKey( - to='circuits.ProviderNetwork', - on_delete=models.PROTECT, - related_name='circuit_terminations', + termination_id = models.PositiveBigIntegerField( blank=True, null=True ) + termination = GenericForeignKey( + ct_field='termination_type', + fk_field='termination_id' + ) port_speed = models.PositiveIntegerField( verbose_name=_('port speed (Kbps)'), blank=True, @@ -276,6 +282,43 @@ class CircuitTermination( blank=True ) + # Cached associations to enable efficient filtering + _provider_network = models.ForeignKey( + to='circuits.ProviderNetwork', + on_delete=models.PROTECT, + related_name='circuit_terminations', + blank=True, + null=True + ) + _location = models.ForeignKey( + to='dcim.Location', + on_delete=models.CASCADE, + related_name='circuit_terminations', + blank=True, + null=True + ) + _site = models.ForeignKey( + to='dcim.Site', + on_delete=models.CASCADE, + related_name='circuit_terminations', + blank=True, + null=True + ) + _region = models.ForeignKey( + to='dcim.Region', + on_delete=models.CASCADE, + related_name='circuit_terminations', + blank=True, + null=True + ) + _site_group = models.ForeignKey( + to='dcim.SiteGroup', + on_delete=models.CASCADE, + related_name='circuit_terminations', + blank=True, + null=True + ) + class Meta: ordering = ['circuit', 'term_side'] constraints = ( @@ -297,10 +340,35 @@ class CircuitTermination( super().clean() # Must define either site *or* provider network - if self.site is None and self.provider_network is None: - raise ValidationError(_("A circuit termination must attach to either a site or a provider network.")) - if self.site and self.provider_network: - raise ValidationError(_("A circuit termination cannot attach to both a site and a provider network.")) + if self.termination is None: + raise ValidationError(_("A circuit termination must attach to termination.")) + + def save(self, *args, **kwargs): + # Cache objects associated with the terminating object (for filtering) + self.cache_related_objects() + + super().save(*args, **kwargs) + + def cache_related_objects(self): + self._provider_network = self._region = self._site_group = self._site = self._location = None + if self.termination_type: + termination_type = self.termination_type.model_class() + if termination_type == apps.get_model('dcim', 'region'): + self._region = self.termination + elif termination_type == apps.get_model('dcim', 'sitegroup'): + self._site_group = self.termination + elif termination_type == apps.get_model('dcim', 'site'): + self._region = self.termination.region + self._site_group = self.termination.group + self._site = self.termination + elif termination_type == apps.get_model('dcim', 'location'): + self._region = self.termination.site.region + self._site_group = self.termination.site.group + self._site = self.termination.site + self._location = self.termination + elif termination_type == apps.get_model('circuits', 'providernetwork'): + self._provider_network = self.termination + cache_related_objects.alters_data = True def to_objectchange(self, action): objectchange = super().to_objectchange(action) @@ -314,7 +382,7 @@ class CircuitTermination( def get_peer_termination(self): peer_side = 'Z' if self.term_side == 'A' else 'A' try: - return CircuitTermination.objects.prefetch_related('site').get( + return CircuitTermination.objects.prefetch_related('termination').get( circuit=self.circuit, term_side=peer_side ) diff --git a/netbox/circuits/tables/circuits.py b/netbox/circuits/tables/circuits.py index e79212a14..ab9c661e6 100644 --- a/netbox/circuits/tables/circuits.py +++ b/netbox/circuits/tables/circuits.py @@ -18,10 +18,8 @@ __all__ = ( CIRCUITTERMINATION_LINK = """ -{% if value.site %} - {{ value.site }} -{% elif value.provider_network %} - {{ value.provider_network }} +{% if value.termination %} + {{ value.termination }} {% endif %} """ @@ -63,12 +61,12 @@ class CircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): verbose_name=_('Account') ) status = columns.ChoiceFieldColumn() - termination_a = tables.TemplateColumn( + termination_a = columns.TemplateColumn( template_code=CIRCUITTERMINATION_LINK, orderable=False, verbose_name=_('Side A') ) - termination_z = tables.TemplateColumn( + termination_z = columns.TemplateColumn( template_code=CIRCUITTERMINATION_LINK, orderable=False, verbose_name=_('Side Z') @@ -110,22 +108,54 @@ class CircuitTerminationTable(NetBoxTable): linkify=True, accessor='circuit.provider' ) + term_side = tables.Column( + verbose_name=_('Side') + ) + termination_type = columns.ContentTypeColumn( + verbose_name=_('Termination Type'), + ) + termination = tables.Column( + verbose_name=_('Termination Point'), + linkify=True + ) + + # Termination types site = tables.Column( verbose_name=_('Site'), - linkify=True + linkify=True, + accessor='_site' + ) + site_group = tables.Column( + verbose_name=_('Site Group'), + linkify=True, + accessor='_sitegroup' + ) + region = tables.Column( + verbose_name=_('Region'), + linkify=True, + accessor='_region' + ) + location = tables.Column( + verbose_name=_('Location'), + linkify=True, + accessor='_location' ) provider_network = tables.Column( verbose_name=_('Provider Network'), - linkify=True + linkify=True, + accessor='_provider_network' ) class Meta(NetBoxTable.Meta): model = CircuitTermination fields = ( - 'pk', 'id', 'circuit', 'provider', 'term_side', 'site', 'provider_network', 'port_speed', 'upstream_speed', - 'xconnect_id', 'pp_info', 'description', 'created', 'last_updated', 'actions', + 'pk', 'id', 'circuit', 'provider', 'term_side', 'termination_type', 'termination', 'site_group', 'region', + 'site', 'location', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', + 'description', 'created', 'last_updated', 'actions', + ) + default_columns = ( + 'pk', 'id', 'circuit', 'provider', 'term_side', 'termination_type', 'termination', 'description', ) - default_columns = ('pk', 'id', 'circuit', 'provider', 'term_side', 'description') class CircuitGroupTable(NetBoxTable): diff --git a/netbox/circuits/tests/test_api.py b/netbox/circuits/tests/test_api.py index 1edcd531b..1b2e9f3f8 100644 --- a/netbox/circuits/tests/test_api.py +++ b/netbox/circuits/tests/test_api.py @@ -181,10 +181,10 @@ class CircuitTerminationTest(APIViewTestCases.APIViewTestCase): Circuit.objects.bulk_create(circuits) circuit_terminations = ( - CircuitTermination(circuit=circuits[0], term_side=SIDE_A, site=sites[0]), - CircuitTermination(circuit=circuits[0], term_side=SIDE_Z, provider_network=provider_networks[0]), - CircuitTermination(circuit=circuits[1], term_side=SIDE_A, site=sites[1]), - CircuitTermination(circuit=circuits[1], term_side=SIDE_Z, provider_network=provider_networks[1]), + CircuitTermination(circuit=circuits[0], term_side=SIDE_A, termination=sites[0]), + CircuitTermination(circuit=circuits[0], term_side=SIDE_Z, termination=provider_networks[0]), + CircuitTermination(circuit=circuits[1], term_side=SIDE_A, termination=sites[1]), + CircuitTermination(circuit=circuits[1], term_side=SIDE_Z, termination=provider_networks[1]), ) CircuitTermination.objects.bulk_create(circuit_terminations) @@ -192,13 +192,15 @@ class CircuitTerminationTest(APIViewTestCases.APIViewTestCase): { 'circuit': circuits[2].pk, 'term_side': SIDE_A, - 'site': sites[0].pk, + 'termination_type': 'dcim.site', + 'termination_id': sites[0].pk, 'port_speed': 200000, }, { 'circuit': circuits[2].pk, 'term_side': SIDE_Z, - 'provider_network': provider_networks[0].pk, + 'termination_type': 'circuits.providernetwork', + 'termination_id': provider_networks[0].pk, 'port_speed': 200000, }, ] diff --git a/netbox/circuits/tests/test_filtersets.py b/netbox/circuits/tests/test_filtersets.py index 93958298c..0dbc7172b 100644 --- a/netbox/circuits/tests/test_filtersets.py +++ b/netbox/circuits/tests/test_filtersets.py @@ -70,10 +70,12 @@ class ProviderTestCase(TestCase, ChangeLoggedFilterSetTests): ) Circuit.objects.bulk_create(circuits) - CircuitTermination.objects.bulk_create(( - CircuitTermination(circuit=circuits[0], site=sites[0], term_side='A'), - CircuitTermination(circuit=circuits[1], site=sites[0], term_side='A'), - )) + circuit_terminations = ( + CircuitTermination(circuit=circuits[0], termination=sites[0], term_side='A'), + CircuitTermination(circuit=circuits[1], termination=sites[0], term_side='A'), + ) + for ct in circuit_terminations: + ct.save() def test_q(self): params = {'q': 'foobar1'} @@ -233,14 +235,15 @@ class CircuitTestCase(TestCase, ChangeLoggedFilterSetTests): Circuit.objects.bulk_create(circuits) circuit_terminations = (( - CircuitTermination(circuit=circuits[0], site=sites[0], term_side='A'), - CircuitTermination(circuit=circuits[1], site=sites[1], term_side='A'), - CircuitTermination(circuit=circuits[2], site=sites[2], term_side='A'), - CircuitTermination(circuit=circuits[3], provider_network=provider_networks[0], term_side='A'), - CircuitTermination(circuit=circuits[4], provider_network=provider_networks[1], term_side='A'), - CircuitTermination(circuit=circuits[5], provider_network=provider_networks[2], term_side='A'), + CircuitTermination(circuit=circuits[0], termination=sites[0], term_side='A'), + CircuitTermination(circuit=circuits[1], termination=sites[1], term_side='A'), + CircuitTermination(circuit=circuits[2], termination=sites[2], term_side='A'), + CircuitTermination(circuit=circuits[3], termination=provider_networks[0], term_side='A'), + CircuitTermination(circuit=circuits[4], termination=provider_networks[1], term_side='A'), + CircuitTermination(circuit=circuits[5], termination=provider_networks[2], term_side='A'), )) - CircuitTermination.objects.bulk_create(circuit_terminations) + for ct in circuit_terminations: + ct.save() def test_q(self): params = {'q': 'foobar1'} @@ -384,18 +387,19 @@ class CircuitTerminationTestCase(TestCase, ChangeLoggedFilterSetTests): Circuit.objects.bulk_create(circuits) circuit_terminations = (( - CircuitTermination(circuit=circuits[0], site=sites[0], term_side='A', port_speed=1000, upstream_speed=1000, xconnect_id='ABC', description='foobar1'), - CircuitTermination(circuit=circuits[0], site=sites[1], term_side='Z', port_speed=1000, upstream_speed=1000, xconnect_id='DEF', description='foobar2'), - CircuitTermination(circuit=circuits[1], site=sites[1], term_side='A', port_speed=2000, upstream_speed=2000, xconnect_id='GHI'), - CircuitTermination(circuit=circuits[1], site=sites[2], term_side='Z', port_speed=2000, upstream_speed=2000, xconnect_id='JKL'), - CircuitTermination(circuit=circuits[2], site=sites[2], term_side='A', port_speed=3000, upstream_speed=3000, xconnect_id='MNO'), - CircuitTermination(circuit=circuits[2], site=sites[0], term_side='Z', port_speed=3000, upstream_speed=3000, xconnect_id='PQR'), - CircuitTermination(circuit=circuits[3], provider_network=provider_networks[0], term_side='A'), - CircuitTermination(circuit=circuits[4], provider_network=provider_networks[1], term_side='A'), - CircuitTermination(circuit=circuits[5], provider_network=provider_networks[2], term_side='A'), - CircuitTermination(circuit=circuits[6], provider_network=provider_networks[0], term_side='A', mark_connected=True), + CircuitTermination(circuit=circuits[0], termination=sites[0], term_side='A', port_speed=1000, upstream_speed=1000, xconnect_id='ABC', description='foobar1'), + CircuitTermination(circuit=circuits[0], termination=sites[1], term_side='Z', port_speed=1000, upstream_speed=1000, xconnect_id='DEF', description='foobar2'), + CircuitTermination(circuit=circuits[1], termination=sites[1], term_side='A', port_speed=2000, upstream_speed=2000, xconnect_id='GHI'), + CircuitTermination(circuit=circuits[1], termination=sites[2], term_side='Z', port_speed=2000, upstream_speed=2000, xconnect_id='JKL'), + CircuitTermination(circuit=circuits[2], termination=sites[2], term_side='A', port_speed=3000, upstream_speed=3000, xconnect_id='MNO'), + CircuitTermination(circuit=circuits[2], termination=sites[0], term_side='Z', port_speed=3000, upstream_speed=3000, xconnect_id='PQR'), + CircuitTermination(circuit=circuits[3], termination=provider_networks[0], term_side='A'), + CircuitTermination(circuit=circuits[4], termination=provider_networks[1], term_side='A'), + CircuitTermination(circuit=circuits[5], termination=provider_networks[2], term_side='A'), + CircuitTermination(circuit=circuits[6], termination=provider_networks[0], term_side='A', mark_connected=True), )) - CircuitTermination.objects.bulk_create(circuit_terminations) + for ct in circuit_terminations: + ct.save() Cable(a_terminations=[circuit_terminations[0]], b_terminations=[circuit_terminations[1]]).save() diff --git a/netbox/circuits/tests/test_views.py b/netbox/circuits/tests/test_views.py index b06ade30b..a87e327af 100644 --- a/netbox/circuits/tests/test_views.py +++ b/netbox/circuits/tests/test_views.py @@ -1,5 +1,6 @@ import datetime +from django.contrib.contenttypes.models import ContentType from django.test import override_settings from django.urls import reverse @@ -190,27 +191,31 @@ class CircuitTestCase(ViewTestCases.PrimaryObjectViewTestCase): @override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], EXEMPT_EXCLUDE_MODELS=[]) def test_bulk_import_objects_with_terminations(self): - json_data = """ + site = Site.objects.first() + json_data = f""" [ - { + {{ "cid": "Circuit 7", "provider": "Provider 1", "type": "Circuit Type 1", "status": "active", "description": "Testing Import", "terminations": [ - { + {{ "term_side": "A", - "site": "Site 1" - }, - { + "termination_type": "dcim.site", + "termination_id": "{site.pk}" + }}, + {{ "term_side": "Z", - "site": "Site 1" - } + "termination_type": "dcim.site", + "termination_id": "{site.pk}" + }} ] - } + }} ] """ + initial_count = self._get_queryset().count() data = { 'data': json_data, @@ -336,7 +341,7 @@ class ProviderNetworkTestCase(ViewTestCases.PrimaryObjectViewTestCase): } -class CircuitTerminationTestCase(ViewTestCases.PrimaryObjectViewTestCase): +class TestCase(ViewTestCases.PrimaryObjectViewTestCase): model = CircuitTermination @classmethod @@ -359,24 +364,27 @@ class CircuitTerminationTestCase(ViewTestCases.PrimaryObjectViewTestCase): Circuit.objects.bulk_create(circuits) circuit_terminations = ( - CircuitTermination(circuit=circuits[0], term_side='A', site=sites[0]), - CircuitTermination(circuit=circuits[0], term_side='Z', site=sites[1]), - CircuitTermination(circuit=circuits[1], term_side='A', site=sites[0]), - CircuitTermination(circuit=circuits[1], term_side='Z', site=sites[1]), + CircuitTermination(circuit=circuits[0], term_side='A', termination=sites[0]), + CircuitTermination(circuit=circuits[0], term_side='Z', termination=sites[1]), + CircuitTermination(circuit=circuits[1], term_side='A', termination=sites[0]), + CircuitTermination(circuit=circuits[1], term_side='Z', termination=sites[1]), ) - CircuitTermination.objects.bulk_create(circuit_terminations) + for ct in circuit_terminations: + ct.save() cls.form_data = { 'circuit': circuits[2].pk, 'term_side': 'A', - 'site': sites[2].pk, + 'termination_type': ContentType.objects.get_for_model(Site).pk, + 'termination': sites[2].pk, 'description': 'New description', } + site = sites[0].pk cls.csv_data = ( - "circuit,term_side,site,description", - "Circuit 3,A,Site 1,Foo", - "Circuit 3,Z,Site 1,Bar", + "circuit,term_side,termination_type,termination_id,description", + f"Circuit 3,A,dcim.site,{site},Foo", + f"Circuit 3,Z,dcim.site,{site},Bar", ) cls.csv_update_data = ( diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 8218960c9..4059065bf 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -158,7 +158,7 @@ class ProviderNetworkView(GetRelatedModelsMixin, generic.ObjectView): instance, extra=( ( - Circuit.objects.restrict(request.user, 'view').filter(terminations__provider_network=instance), + Circuit.objects.restrict(request.user, 'view').filter(terminations___provider_network=instance), 'provider_network_id', ), ), @@ -257,8 +257,7 @@ class CircuitTypeBulkDeleteView(generic.BulkDeleteView): class CircuitListView(generic.ObjectListView): queryset = Circuit.objects.prefetch_related( - 'tenant__group', 'termination_a__site', 'termination_z__site', - 'termination_a__provider_network', 'termination_z__provider_network', + 'tenant__group', 'termination_a__termination', 'termination_z__termination', ) filterset = filtersets.CircuitFilterSet filterset_form = forms.CircuitFilterForm @@ -298,8 +297,7 @@ class CircuitBulkImportView(generic.BulkImportView): class CircuitBulkEditView(generic.BulkEditView): queryset = Circuit.objects.prefetch_related( - 'termination_a__site', 'termination_z__site', - 'termination_a__provider_network', 'termination_z__provider_network', + 'tenant__group', 'termination_a__termination', 'termination_z__termination', ) filterset = filtersets.CircuitFilterSet table = tables.CircuitTable @@ -308,8 +306,7 @@ class CircuitBulkEditView(generic.BulkEditView): class CircuitBulkDeleteView(generic.BulkDeleteView): queryset = Circuit.objects.prefetch_related( - 'termination_a__site', 'termination_z__site', - 'termination_a__provider_network', 'termination_z__provider_network', + 'tenant__group', 'termination_a__termination', 'termination_z__termination', ) filterset = filtersets.CircuitFilterSet table = tables.CircuitTable diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index db9f3899d..da7a0af25 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -462,6 +462,10 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]] children: List[Annotated["LocationType", strawberry.lazy('dcim.graphql.types')]] + @strawberry_django.field + def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + return self.circuit_terminations.all() + @strawberry_django.type( models.Manufacturer, @@ -705,6 +709,10 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): def parent(self) -> Annotated["RegionType", strawberry.lazy('dcim.graphql.types')] | None: return self.parent + @strawberry_django.field + def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + return self.circuit_terminations.all() + @strawberry_django.type( models.Site, @@ -726,10 +734,13 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]] locations: List[Annotated["LocationType", strawberry.lazy('dcim.graphql.types')]] asns: List[Annotated["ASNType", strawberry.lazy('ipam.graphql.types')]] - circuit_terminations: List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]] clusters: List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]] vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]] + @strawberry_django.field + def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + return self.circuit_terminations.all() + @strawberry_django.type( models.SiteGroup, @@ -746,6 +757,10 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): def parent(self) -> Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')] | None: return self.parent + @strawberry_django.field + def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + return self.circuit_terminations.all() + @strawberry_django.type( models.VirtualChassis, diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py index 9f47a63d3..744ec025c 100644 --- a/netbox/dcim/models/cables.py +++ b/netbox/dcim/models/cables.py @@ -344,7 +344,7 @@ class CableTermination(ChangeLoggedModel): ) # A CircuitTermination attached to a ProviderNetwork cannot have a Cable - if self.termination_type.model == 'circuittermination' and self.termination.provider_network is not None: + if self.termination_type.model == 'circuittermination' and self.termination._provider_network is not None: raise ValidationError(_("Circuit terminations attached to a provider network may not be cabled.")) def save(self, *args, **kwargs): @@ -690,19 +690,19 @@ class CablePath(models.Model): ).first() if circuit_termination is None: break - elif circuit_termination.provider_network: + elif circuit_termination._provider_network: # Circuit terminates to a ProviderNetwork path.extend([ [object_to_path_node(circuit_termination)], - [object_to_path_node(circuit_termination.provider_network)], + [object_to_path_node(circuit_termination._provider_network)], ]) is_complete = True break - elif circuit_termination.site and not circuit_termination.cable: - # Circuit terminates to a Site + elif circuit_termination.termination and not circuit_termination.cable: + # Circuit terminates to a Region/Site/etc. path.extend([ [object_to_path_node(circuit_termination)], - [object_to_path_node(circuit_termination.site)], + [object_to_path_node(circuit_termination.termination)], ]) break diff --git a/netbox/dcim/tests/test_cablepaths.py b/netbox/dcim/tests/test_cablepaths.py index f7c337bdf..b504d389a 100644 --- a/netbox/dcim/tests/test_cablepaths.py +++ b/netbox/dcim/tests/test_cablepaths.py @@ -1167,7 +1167,7 @@ class CablePathTestCase(TestCase): [IF1] --C1-- [CT1] """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') # Create cable 1 cable1 = Cable( @@ -1198,7 +1198,7 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') interface2 = Interface.objects.create(device=self.device, name='Interface 2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') # Create cable 1 cable1 = Cable( @@ -1214,7 +1214,7 @@ class CablePathTestCase(TestCase): ) # Create CT2 - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='Z') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') # Check for partial path to site self.assertPathExists( @@ -1266,7 +1266,7 @@ class CablePathTestCase(TestCase): interface2 = Interface.objects.create(device=self.device, name='Interface 2') interface3 = Interface.objects.create(device=self.device, name='Interface 3') interface4 = Interface.objects.create(device=self.device, name='Interface 4') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') # Create cable 1 cable1 = Cable( @@ -1282,7 +1282,7 @@ class CablePathTestCase(TestCase): ) # Create CT2 - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='Z') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') # Check for partial path to site self.assertPathExists( @@ -1335,8 +1335,8 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') site2 = Site.objects.create(name='Site 2', slug='site-2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, site=site2, term_side='Z') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=site2, term_side='Z') # Create cable 1 cable1 = Cable( @@ -1365,8 +1365,8 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') providernetwork = ProviderNetwork.objects.create(name='Provider Network 1', provider=self.circuit.provider) - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, provider_network=providernetwork, term_side='Z') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=providernetwork, term_side='Z') # Create cable 1 cable1 = Cable( @@ -1413,8 +1413,8 @@ class CablePathTestCase(TestCase): frontport2_2 = FrontPort.objects.create( device=self.device, name='Front Port 2:2', rear_port=rearport2, rear_port_position=2 ) - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='Z') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') # Create cables cable1 = Cable( @@ -1499,10 +1499,10 @@ class CablePathTestCase(TestCase): interface1 = Interface.objects.create(device=self.device, name='Interface 1') interface2 = Interface.objects.create(device=self.device, name='Interface 2') circuit2 = Circuit.objects.create(provider=self.circuit.provider, type=self.circuit.type, cid='Circuit 2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, site=self.site, term_side='Z') - circuittermination3 = CircuitTermination.objects.create(circuit=circuit2, site=self.site, term_side='A') - circuittermination4 = CircuitTermination.objects.create(circuit=circuit2, site=self.site, term_side='Z') + circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') + circuittermination3 = CircuitTermination.objects.create(circuit=circuit2, termination=self.site, term_side='A') + circuittermination4 = CircuitTermination.objects.create(circuit=circuit2, termination=self.site, term_side='Z') # Create cables cable1 = Cable( diff --git a/netbox/dcim/tests/test_filtersets.py b/netbox/dcim/tests/test_filtersets.py index 0a6417022..c5ca01db2 100644 --- a/netbox/dcim/tests/test_filtersets.py +++ b/netbox/dcim/tests/test_filtersets.py @@ -5135,7 +5135,7 @@ class CableTestCase(TestCase, ChangeLoggedFilterSetTests): provider = Provider.objects.create(name='Provider 1', slug='provider-1') circuit_type = CircuitType.objects.create(name='Circuit Type 1', slug='circuit-type-1') circuit = Circuit.objects.create(cid='Circuit 1', provider=provider, type=circuit_type) - circuit_termination = CircuitTermination.objects.create(circuit=circuit, term_side='A', site=sites[0]) + circuit_termination = CircuitTermination.objects.create(circuit=circuit, term_side='A', termination=sites[0]) # Cables cables = ( @@ -5308,9 +5308,9 @@ class CableTestCase(TestCase, ChangeLoggedFilterSetTests): def test_site(self): site = Site.objects.all()[:2] params = {'site_id': [site[0].pk, site[1].pk]} - self.assertEqual(self.filterset(params, self.queryset).qs.count(), 12) + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 11) params = {'site': [site[0].slug, site[1].slug]} - self.assertEqual(self.filterset(params, self.queryset).qs.count(), 12) + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 11) def test_tenant(self): tenant = Tenant.objects.all()[:2] diff --git a/netbox/dcim/tests/test_models.py b/netbox/dcim/tests/test_models.py index c11badbdd..f0fe4da3b 100644 --- a/netbox/dcim/tests/test_models.py +++ b/netbox/dcim/tests/test_models.py @@ -762,9 +762,9 @@ class CableTestCase(TestCase): circuittype = CircuitType.objects.create(name='Circuit Type 1', slug='circuit-type-1') circuit1 = Circuit.objects.create(provider=provider, type=circuittype, cid='1') circuit2 = Circuit.objects.create(provider=provider, type=circuittype, cid='2') - CircuitTermination.objects.create(circuit=circuit1, site=site, term_side='A') - CircuitTermination.objects.create(circuit=circuit1, site=site, term_side='Z') - CircuitTermination.objects.create(circuit=circuit2, provider_network=provider_network, term_side='A') + CircuitTermination.objects.create(circuit=circuit1, termination=site, term_side='A') + CircuitTermination.objects.create(circuit=circuit1, termination=site, term_side='Z') + CircuitTermination.objects.create(circuit=circuit2, termination=provider_network, term_side='A') def test_cable_creation(self): """ diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 38c3f68c3..9a821a384 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -242,6 +242,10 @@ class RegionView(GetRelatedModelsMixin, generic.ObjectView): extra=( (Location.objects.restrict(request.user, 'view').filter(site__region__in=regions), 'region_id'), (Rack.objects.restrict(request.user, 'view').filter(site__region__in=regions), 'region_id'), + ( + Circuit.objects.restrict(request.user, 'view').filter(terminations___region=instance).distinct(), + 'region_id' + ), ), ), } @@ -324,6 +328,10 @@ class SiteGroupView(GetRelatedModelsMixin, generic.ObjectView): extra=( (Location.objects.restrict(request.user, 'view').filter(site__group__in=groups), 'site_group_id'), (Rack.objects.restrict(request.user, 'view').filter(site__group__in=groups), 'site_group_id'), + ( + Circuit.objects.restrict(request.user, 'view').filter(terminations___site_group=instance).distinct(), + 'site_group_id' + ), ), ), } @@ -404,8 +412,10 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView): scope_id=instance.pk ), 'site'), (ASN.objects.restrict(request.user, 'view').filter(sites=instance), 'site_id'), - (Circuit.objects.restrict(request.user, 'view').filter(terminations__site=instance).distinct(), - 'site_id'), + ( + Circuit.objects.restrict(request.user, 'view').filter(terminations___site=instance).distinct(), + 'site_id' + ), ), ), } @@ -475,7 +485,17 @@ class LocationView(GetRelatedModelsMixin, generic.ObjectView): def get_extra_context(self, request, instance): locations = instance.get_descendants(include_self=True) return { - 'related_models': self.get_related_models(request, locations, [CableTermination]), + 'related_models': self.get_related_models( + request, + locations, + [CableTermination], + ( + ( + Circuit.objects.restrict(request.user, 'view').filter(terminations___location=instance).distinct(), + 'location_id' + ), + ), + ), } diff --git a/netbox/templates/circuits/inc/circuit_termination_fields.html b/netbox/templates/circuits/inc/circuit_termination_fields.html index 97d194f24..94c4599b0 100644 --- a/netbox/templates/circuits/inc/circuit_termination_fields.html +++ b/netbox/templates/circuits/inc/circuit_termination_fields.html @@ -1,18 +1,19 @@ {% load helpers %} {% load i18n %} -{% if termination.site %} - {% trans "Site" %} - - {% if termination.site.region %} - {{ termination.site.region|linkify }} / - {% endif %} - {{ termination.site|linkify }} - + {% trans "Termination point" %} + {% if termination.termination %} + + {{ termination.termination|linkify }} +
{% trans termination.termination_type.name|bettertitle %}
+ + {% else %} + {{ ''|placeholder }} + {% endif %} - {% trans "Termination" %} + {% trans "Connection" %} {% if termination.mark_connected %} @@ -57,12 +58,6 @@ {% endif %} -{% else %} - - {% trans "Provider Network" %} - {{ termination.provider_network.provider|linkify }} / {{ termination.provider_network|linkify }} - -{% endif %} {% trans "Speed" %} From 8767fd818610bd5efc48ada5aec0760d26eae467 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 31 Oct 2024 14:17:06 -0400 Subject: [PATCH 21/65] Closes #13428: Q-in-Q VLANs (#17822) * Initial work on #13428 (QinQ) * Misc cleanup; add tests for Q-in-Q fields * Address PR feedback --- docs/models/dcim/interface.md | 4 ++ docs/models/ipam/vlan.md | 8 ++++ docs/models/virtualization/vminterface.md | 4 ++ .../api/serializers_/device_components.py | 9 ++-- netbox/dcim/choices.py | 2 + netbox/dcim/filtersets.py | 6 ++- netbox/dcim/forms/common.py | 2 + netbox/dcim/forms/model_forms.py | 18 ++++++- netbox/dcim/graphql/types.py | 1 + netbox/dcim/migrations/0196_qinq_svlan.py | 28 +++++++++++ netbox/dcim/models/device_components.py | 47 +++++++++++++------ netbox/dcim/tables/devices.py | 16 ++++--- netbox/dcim/tests/test_api.py | 6 +++ netbox/dcim/tests/test_filtersets.py | 29 ++++++++++-- netbox/ipam/api/serializers_/nested.py | 8 ++++ netbox/ipam/api/serializers_/vlans.py | 7 ++- netbox/ipam/choices.py | 11 +++++ netbox/ipam/filtersets.py | 11 +++++ netbox/ipam/forms/bulk_edit.py | 16 ++++++- netbox/ipam/forms/bulk_import.py | 18 ++++++- netbox/ipam/forms/filtersets.py | 12 +++++ netbox/ipam/forms/model_forms.py | 12 ++++- netbox/ipam/graphql/types.py | 6 ++- netbox/ipam/migrations/0075_vlan_qinq.py | 30 ++++++++++++ netbox/ipam/models/vlans.py | 40 +++++++++++++++- netbox/ipam/tables/vlans.py | 9 +++- netbox/ipam/tests/test_api.py | 7 +++ netbox/ipam/tests/test_filtersets.py | 24 ++++++++++ netbox/ipam/tests/test_models.py | 21 +++++++++ netbox/templates/ipam/vlan.html | 31 ++++++++++++ netbox/templates/ipam/vlan_edit.html | 8 ++++ .../api/serializers_/virtualmachines.py | 7 +-- netbox/virtualization/forms/model_forms.py | 20 ++++++-- netbox/virtualization/graphql/types.py | 1 + ...042_vminterface_vlan_translation_policy.py | 2 - .../migrations/0043_qinq_svlan.py | 28 +++++++++++ .../virtualization/models/virtualmachines.py | 14 ------ .../virtualization/tables/virtualmachines.py | 7 +-- netbox/virtualization/tests/test_api.py | 8 ++++ .../virtualization/tests/test_filtersets.py | 24 ++++++++-- 40 files changed, 492 insertions(+), 70 deletions(-) create mode 100644 netbox/dcim/migrations/0196_qinq_svlan.py create mode 100644 netbox/ipam/migrations/0075_vlan_qinq.py create mode 100644 netbox/virtualization/migrations/0043_qinq_svlan.py diff --git a/docs/models/dcim/interface.md b/docs/models/dcim/interface.md index 869cb8510..fb7198682 100644 --- a/docs/models/dcim/interface.md +++ b/docs/models/dcim/interface.md @@ -120,6 +120,10 @@ The "native" (untagged) VLAN for the interface. Valid only when one of the above The tagged VLANs which are configured to be carried by this interface. Valid only for the "tagged" 802.1Q mode above. +### Q-in-Q SVLAN + +The assigned service VLAN (for Q-in-Q/802.1ad interfaces). + ### Wireless Role Indicates the configured role for wireless interfaces (access point or station). diff --git a/docs/models/ipam/vlan.md b/docs/models/ipam/vlan.md index 2dd5ec2d3..dc547ddbc 100644 --- a/docs/models/ipam/vlan.md +++ b/docs/models/ipam/vlan.md @@ -26,3 +26,11 @@ The user-defined functional [role](./role.md) assigned to the VLAN. ### VLAN Group or Site The [VLAN group](./vlangroup.md) or [site](../dcim/site.md) to which the VLAN is assigned. + +### Q-in-Q Role + +For VLANs which comprise a Q-in-Q/IEEE 802.1ad topology, this field indicates whether the VLAN is treated as a service or customer VLAN. + +### Q-in-Q Service VLAN + +The designated parent service VLAN for a Q-in-Q customer VLAN. This may be set only for Q-in-Q custom VLANs. diff --git a/docs/models/virtualization/vminterface.md b/docs/models/virtualization/vminterface.md index 1e022b091..4a0c474f9 100644 --- a/docs/models/virtualization/vminterface.md +++ b/docs/models/virtualization/vminterface.md @@ -53,6 +53,10 @@ The "native" (untagged) VLAN for the interface. Valid only when one of the above The tagged VLANs which are configured to be carried by this interface. Valid only for the "tagged" 802.1Q mode above. +### Q-in-Q SVLAN + +The assigned service VLAN (for Q-in-Q/802.1ad interfaces). + ### VRF The [virtual routing and forwarding](../ipam/vrf.md) instance to which this interface is assigned. diff --git a/netbox/dcim/api/serializers_/device_components.py b/netbox/dcim/api/serializers_/device_components.py index 3be19bb58..57111c2af 100644 --- a/netbox/dcim/api/serializers_/device_components.py +++ b/netbox/dcim/api/serializers_/device_components.py @@ -196,6 +196,7 @@ class InterfaceSerializer(NetBoxModelSerializer, CabledObjectSerializer, Connect required=False, many=True ) + qinq_svlan = VLANSerializer(nested=True, required=False, allow_null=True) vlan_translation_policy = VLANTranslationPolicySerializer(nested=True, required=False, allow_null=True) vrf = VRFSerializer(nested=True, required=False, allow_null=True) l2vpn_termination = L2VPNTerminationSerializer(nested=True, read_only=True, allow_null=True) @@ -223,10 +224,10 @@ class InterfaceSerializer(NetBoxModelSerializer, CabledObjectSerializer, Connect 'id', 'url', 'display_url', 'display', 'device', 'vdcs', 'module', 'name', 'label', 'type', 'enabled', 'parent', 'bridge', 'lag', 'mtu', 'mac_address', 'speed', 'duplex', 'wwn', 'mgmt_only', 'description', 'mode', 'rf_role', 'rf_channel', 'poe_mode', 'poe_type', 'rf_channel_frequency', 'rf_channel_width', - 'tx_power', 'untagged_vlan', 'tagged_vlans', 'mark_connected', 'cable', 'cable_end', 'wireless_link', - 'link_peers', 'link_peers_type', 'wireless_lans', 'vrf', 'l2vpn_termination', 'connected_endpoints', - 'connected_endpoints_type', 'connected_endpoints_reachable', 'tags', 'custom_fields', 'created', - 'last_updated', 'count_ipaddresses', 'count_fhrp_groups', '_occupied', 'vlan_translation_policy' + 'tx_power', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vlan_translation_policy', 'mark_connected', + 'cable', 'cable_end', 'wireless_link', 'link_peers', 'link_peers_type', 'wireless_lans', 'vrf', + 'l2vpn_termination', 'connected_endpoints', 'connected_endpoints_type', 'connected_endpoints_reachable', + 'tags', 'custom_fields', 'created', 'last_updated', 'count_ipaddresses', 'count_fhrp_groups', '_occupied', ] brief_fields = ('id', 'url', 'display', 'device', 'name', 'description', 'cable', '_occupied') diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py index fee587e6b..e1a99e0db 100644 --- a/netbox/dcim/choices.py +++ b/netbox/dcim/choices.py @@ -1258,11 +1258,13 @@ class InterfaceModeChoices(ChoiceSet): MODE_ACCESS = 'access' MODE_TAGGED = 'tagged' MODE_TAGGED_ALL = 'tagged-all' + MODE_Q_IN_Q = 'q-in-q' CHOICES = ( (MODE_ACCESS, _('Access')), (MODE_TAGGED, _('Tagged')), (MODE_TAGGED_ALL, _('Tagged (All)')), + (MODE_Q_IN_Q, _('Q-in-Q (802.1ad)')), ) diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index c11a7ef00..0371f882b 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -1647,7 +1647,8 @@ class CommonInterfaceFilterSet(django_filters.FilterSet): return queryset return queryset.filter( Q(untagged_vlan_id=value) | - Q(tagged_vlans=value) + Q(tagged_vlans=value) | + Q(qinq_svlan=value) ) def filter_vlan(self, queryset, name, value): @@ -1656,7 +1657,8 @@ class CommonInterfaceFilterSet(django_filters.FilterSet): return queryset return queryset.filter( Q(untagged_vlan_id__vid=value) | - Q(tagged_vlans__vid=value) + Q(tagged_vlans__vid=value) | + Q(qinq_svlan__vid=value) ) diff --git a/netbox/dcim/forms/common.py b/netbox/dcim/forms/common.py index 4341ec041..bae7fd222 100644 --- a/netbox/dcim/forms/common.py +++ b/netbox/dcim/forms/common.py @@ -37,6 +37,8 @@ class InterfaceCommonForm(forms.Form): del self.fields['vlan_group'] del self.fields['untagged_vlan'] del self.fields['tagged_vlans'] + if interface_mode != InterfaceModeChoices.MODE_Q_IN_Q: + del self.fields['qinq_svlan'] def clean(self): super().clean() diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 1ab9f138b..2fcdbe5fd 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -7,6 +7,7 @@ from dcim.choices import * from dcim.constants import * from dcim.models import * from extras.models import ConfigTemplate +from ipam.choices import VLANQinQRoleChoices from ipam.models import ASN, IPAddress, VLAN, VLANGroup, VLANTranslationPolicy, VRF from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm @@ -1372,6 +1373,16 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm): 'available_on_device': '$device', } ) + qinq_svlan = DynamicModelMultipleChoiceField( + queryset=VLAN.objects.all(), + required=False, + label=_('Q-in-Q Service VLAN'), + query_params={ + 'group_id': '$vlan_group', + 'available_on_device': '$device', + 'qinq_role': VLANQinQRoleChoices.ROLE_SERVICE, + } + ) vrf = DynamicModelChoiceField( queryset=VRF.objects.all(), required=False, @@ -1396,7 +1407,10 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm): FieldSet('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected', name=_('Operation')), FieldSet('parent', 'bridge', 'lag', name=_('Related Interfaces')), FieldSet('poe_mode', 'poe_type', name=_('PoE')), - FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vlan_translation_policy', name=_('802.1Q Switching')), + FieldSet( + 'mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vlan_translation_policy', + name=_('802.1Q Switching') + ), FieldSet( 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'wireless_lan_group', 'wireless_lans', name=_('Wireless') @@ -1409,7 +1423,7 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm): 'device', 'module', 'vdcs', 'name', 'label', 'type', 'speed', 'duplex', 'enabled', 'parent', 'bridge', 'lag', 'mac_address', 'wwn', 'mtu', 'mgmt_only', 'mark_connected', 'description', 'poe_mode', 'poe_type', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'wireless_lans', - 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags', 'vlan_translation_policy', + 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vlan_translation_policy', 'vrf', 'tags', ] widgets = { 'speed': NumberWithOptions( diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index da7a0af25..5965fdcec 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -385,6 +385,7 @@ class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, P wireless_link: Annotated["WirelessLinkType", strawberry.lazy('wireless.graphql.types')] | None untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None + qinq_svlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vlan_translation_policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] | None vdcs: List[Annotated["VirtualDeviceContextType", strawberry.lazy('dcim.graphql.types')]] diff --git a/netbox/dcim/migrations/0196_qinq_svlan.py b/netbox/dcim/migrations/0196_qinq_svlan.py new file mode 100644 index 000000000..9012d74f3 --- /dev/null +++ b/netbox/dcim/migrations/0196_qinq_svlan.py @@ -0,0 +1,28 @@ +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0195_interface_vlan_translation_policy'), + ('ipam', '0075_vlan_qinq'), + ] + + operations = [ + migrations.AddField( + model_name='interface', + name='qinq_svlan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_svlan', to='ipam.vlan'), + ), + migrations.AlterField( + model_name='interface', + name='tagged_vlans', + field=models.ManyToManyField(blank=True, related_name='%(class)ss_as_tagged', to='ipam.vlan'), + ), + migrations.AlterField( + model_name='interface', + name='untagged_vlan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_as_untagged', to='ipam.vlan'), + ), + ] diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 14f4120b5..36fd02add 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -547,17 +547,48 @@ class BaseInterface(models.Model): blank=True, verbose_name=_('bridge interface') ) + untagged_vlan = models.ForeignKey( + to='ipam.VLAN', + on_delete=models.SET_NULL, + related_name='%(class)ss_as_untagged', + null=True, + blank=True, + verbose_name=_('untagged VLAN') + ) + tagged_vlans = models.ManyToManyField( + to='ipam.VLAN', + related_name='%(class)ss_as_tagged', + blank=True, + verbose_name=_('tagged VLANs') + ) + qinq_svlan = models.ForeignKey( + to='ipam.VLAN', + on_delete=models.SET_NULL, + related_name='%(class)ss_svlan', + null=True, + blank=True, + verbose_name=_('Q-in-Q SVLAN') + ) vlan_translation_policy = models.ForeignKey( to='ipam.VLANTranslationPolicy', on_delete=models.PROTECT, null=True, blank=True, - verbose_name=_('VLAN Translation Policy'), + verbose_name=_('VLAN Translation Policy') ) class Meta: abstract = True + def clean(self): + super().clean() + + # SVLAN can be defined only for Q-in-Q interfaces + if self.qinq_svlan and self.mode != InterfaceModeChoices.MODE_Q_IN_Q: + raise ValidationError({ + 'qinq_svlan': _("Only Q-in-Q interfaces may specify a service VLAN.") + }) + def save(self, *args, **kwargs): # Remove untagged VLAN assignment for non-802.1Q interfaces @@ -697,20 +728,6 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd blank=True, verbose_name=_('wireless LANs') ) - untagged_vlan = models.ForeignKey( - to='ipam.VLAN', - on_delete=models.SET_NULL, - related_name='interfaces_as_untagged', - null=True, - blank=True, - verbose_name=_('untagged VLAN') - ) - tagged_vlans = models.ManyToManyField( - to='ipam.VLAN', - related_name='interfaces_as_tagged', - blank=True, - verbose_name=_('tagged VLANs') - ) vrf = models.ForeignKey( to='ipam.VRF', on_delete=models.SET_NULL, diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index b39a2b87f..fed33401c 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -585,6 +585,10 @@ class BaseInterfaceTable(NetBoxTable): orderable=False, verbose_name=_('Tagged VLANs') ) + qinq_svlan = tables.Column( + verbose_name=_('Q-in-Q SVLAN'), + linkify=True + ) def value_ip_addresses(self, value): return ",".join([str(obj.address) for obj in value.all()]) @@ -635,11 +639,11 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi model = models.Interface fields = ( 'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', - 'speed', 'speed_formatted', 'duplex', 'mode', 'mac_address', 'wwn', 'poe_mode', 'poe_type', 'rf_role', 'rf_channel', - 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', - 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', 'l2vpn', - 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'inventory_items', 'created', - 'last_updated', + 'speed', 'speed_formatted', 'duplex', 'mode', 'mac_address', 'wwn', 'poe_mode', 'poe_type', 'rf_role', + 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', + 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', + 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', + 'inventory_items', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description') @@ -676,7 +680,7 @@ class DeviceInterfaceTable(InterfaceTable): 'mgmt_only', 'mtu', 'mode', 'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', - 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', + 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'actions', ) default_columns = ( 'pk', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mtu', 'mode', 'description', 'ip_addresses', diff --git a/netbox/dcim/tests/test_api.py b/netbox/dcim/tests/test_api.py index 1b460cd59..f78722b67 100644 --- a/netbox/dcim/tests/test_api.py +++ b/netbox/dcim/tests/test_api.py @@ -7,6 +7,7 @@ from dcim.choices import * from dcim.constants import * from dcim.models import * from extras.models import ConfigTemplate +from ipam.choices import VLANQinQRoleChoices from ipam.models import ASN, RIR, VLAN, VRF from netbox.api.serializers import GenericObjectSerializer from tenancy.models import Tenant @@ -1618,6 +1619,7 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase VLAN(name='VLAN 1', vid=1), VLAN(name='VLAN 2', vid=2), VLAN(name='VLAN 3', vid=3), + VLAN(name='SVLAN 1', vid=1001, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), ) VLAN.objects.bulk_create(vlans) @@ -1676,18 +1678,22 @@ class InterfaceTest(Mixins.ComponentTraceMixin, APIViewTestCases.APIViewTestCase 'vdcs': [vdcs[1].pk], 'name': 'Interface 7', 'type': InterfaceTypeChoices.TYPE_80211A, + 'mode': InterfaceModeChoices.MODE_Q_IN_Q, 'tx_power': 10, 'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk], 'rf_channel': WirelessChannelChoices.CHANNEL_5G_32, + 'qinq_svlan': vlans[3].pk, }, { 'device': device.pk, 'vdcs': [vdcs[1].pk], 'name': 'Interface 8', 'type': InterfaceTypeChoices.TYPE_80211A, + 'mode': InterfaceModeChoices.MODE_Q_IN_Q, 'tx_power': 10, 'wireless_lans': [wireless_lans[0].pk, wireless_lans[1].pk], 'rf_channel': "", + 'qinq_svlan': vlans[3].pk, }, ] diff --git a/netbox/dcim/tests/test_filtersets.py b/netbox/dcim/tests/test_filtersets.py index c5ca01db2..993c2fa4e 100644 --- a/netbox/dcim/tests/test_filtersets.py +++ b/netbox/dcim/tests/test_filtersets.py @@ -4,7 +4,8 @@ from circuits.models import Circuit, CircuitTermination, CircuitType, Provider from dcim.choices import * from dcim.filtersets import * from dcim.models import * -from ipam.models import ASN, IPAddress, RIR, VLANTranslationPolicy, VRF +from ipam.choices import VLANQinQRoleChoices +from ipam.models import ASN, IPAddress, RIR, VLAN, VLANTranslationPolicy, VRF from netbox.choices import ColorChoices, WeightUnitChoices from tenancy.models import Tenant, TenantGroup from users.models import User @@ -3520,7 +3521,7 @@ class PowerOutletTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedF class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFilterSetTests): queryset = Interface.objects.all() filterset = InterfaceFilterSet - ignore_fields = ('tagged_vlans', 'untagged_vlan', 'vdcs') + ignore_fields = ('tagged_vlans', 'untagged_vlan', 'qinq_svlan', 'vdcs') @classmethod def setUpTestData(cls): @@ -3669,6 +3670,13 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil ) VirtualDeviceContext.objects.bulk_create(vdcs) + vlans = ( + VLAN(name='SVLAN 1', vid=1001, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(name='SVLAN 2', vid=1002, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(name='SVLAN 3', vid=1003, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + ) + VLAN.objects.bulk_create(vlans) + vlan_translation_policies = ( VLANTranslationPolicy(name='Policy 1'), VLANTranslationPolicy(name='Policy 2'), @@ -3753,6 +3761,8 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil duplex='full', poe_mode=InterfacePoEModeChoices.MODE_PD, poe_type=InterfacePoETypeChoices.TYPE_2_8023AT, + mode=InterfaceModeChoices.MODE_Q_IN_Q, + qinq_svlan=vlans[0], vlan_translation_policy=vlan_translation_policies[1], ), Interface( @@ -3762,7 +3772,9 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil type=InterfaceTypeChoices.TYPE_OTHER, enabled=True, mgmt_only=True, - tx_power=40 + tx_power=40, + mode=InterfaceModeChoices.MODE_Q_IN_Q, + qinq_svlan=vlans[1] ), Interface( device=devices[4], @@ -3771,7 +3783,9 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil type=InterfaceTypeChoices.TYPE_OTHER, enabled=False, mgmt_only=False, - tx_power=40 + tx_power=40, + mode=InterfaceModeChoices.MODE_Q_IN_Q, + qinq_svlan=vlans[2] ), Interface( device=devices[4], @@ -4027,6 +4041,13 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil params = {'vdc_identifier': vdc.values_list('identifier', flat=True)} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3) + def test_vlan(self): + vlan = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE).first() + params = {'vlan_id': vlan.pk} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + params = {'vlan': vlan.vid} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + def test_vlan_translation_policy(self): vlan_translation_policies = VLANTranslationPolicy.objects.all()[:2] params = {'vlan_translation_policy_id': [vlan_translation_policies[0].pk, vlan_translation_policies[1].pk]} diff --git a/netbox/ipam/api/serializers_/nested.py b/netbox/ipam/api/serializers_/nested.py index 5297565bb..b56b15984 100644 --- a/netbox/ipam/api/serializers_/nested.py +++ b/netbox/ipam/api/serializers_/nested.py @@ -6,6 +6,7 @@ from ..field_serializers import IPAddressField __all__ = ( 'NestedIPAddressSerializer', + 'NestedVLANSerializer', ) @@ -16,3 +17,10 @@ class NestedIPAddressSerializer(WritableNestedSerializer): class Meta: model = models.IPAddress fields = ['id', 'url', 'display_url', 'display', 'family', 'address'] + + +class NestedVLANSerializer(WritableNestedSerializer): + + class Meta: + model = models.VLAN + fields = ['id', 'url', 'display', 'vid', 'name', 'description'] diff --git a/netbox/ipam/api/serializers_/vlans.py b/netbox/ipam/api/serializers_/vlans.py index ee06357a5..05fdd5813 100644 --- a/netbox/ipam/api/serializers_/vlans.py +++ b/netbox/ipam/api/serializers_/vlans.py @@ -11,6 +11,7 @@ from netbox.api.serializers import NetBoxModelSerializer from tenancy.api.serializers_.tenants import TenantSerializer from utilities.api import get_serializer_for_model from vpn.api.serializers_.l2vpn import L2VPNTerminationSerializer +from .nested import NestedVLANSerializer from .roles import RoleSerializer __all__ = ( @@ -64,6 +65,8 @@ class VLANSerializer(NetBoxModelSerializer): tenant = TenantSerializer(nested=True, required=False, allow_null=True) status = ChoiceField(choices=VLANStatusChoices, required=False) role = RoleSerializer(nested=True, required=False, allow_null=True) + qinq_role = ChoiceField(choices=VLANQinQRoleChoices, required=False) + qinq_svlan = NestedVLANSerializer(required=False, allow_null=True, default=None) l2vpn_termination = L2VPNTerminationSerializer(nested=True, read_only=True, allow_null=True) # Related object counts @@ -73,8 +76,8 @@ class VLANSerializer(NetBoxModelSerializer): model = VLAN fields = [ 'id', 'url', 'display_url', 'display', 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', - 'description', 'comments', 'l2vpn_termination', 'tags', 'custom_fields', 'created', 'last_updated', - 'prefix_count', + 'description', 'qinq_role', 'qinq_svlan', 'comments', 'l2vpn_termination', 'tags', 'custom_fields', + 'created', 'last_updated', 'prefix_count', ] brief_fields = ('id', 'url', 'display', 'vid', 'name', 'description') diff --git a/netbox/ipam/choices.py b/netbox/ipam/choices.py index 017fd0430..4d9c0bdd4 100644 --- a/netbox/ipam/choices.py +++ b/netbox/ipam/choices.py @@ -157,6 +157,17 @@ class VLANStatusChoices(ChoiceSet): ] +class VLANQinQRoleChoices(ChoiceSet): + + ROLE_SERVICE = 's-vlan' + ROLE_CUSTOMER = 'c-vlan' + + CHOICES = [ + (ROLE_SERVICE, _('Service'), 'blue'), + (ROLE_CUSTOMER, _('Customer'), 'orange'), + ] + + # # Services # diff --git a/netbox/ipam/filtersets.py b/netbox/ipam/filtersets.py index 017a34ac4..88c869a50 100644 --- a/netbox/ipam/filtersets.py +++ b/netbox/ipam/filtersets.py @@ -1041,6 +1041,17 @@ class VLANFilterSet(NetBoxModelFilterSet, TenancyFilterSet): queryset=VirtualMachine.objects.all(), method='get_for_virtualmachine' ) + qinq_role = django_filters.MultipleChoiceFilter( + choices=VLANQinQRoleChoices + ) + qinq_svlan_id = django_filters.ModelMultipleChoiceFilter( + queryset=VLAN.objects.all(), + label=_('Q-in-Q SVLAN (ID)'), + ) + qinq_svlan_vid = MultiValueNumberFilter( + field_name='qinq_svlan__vid', + label=_('Q-in-Q SVLAN number (1-4094)'), + ) l2vpn_id = django_filters.ModelMultipleChoiceFilter( field_name='l2vpn_terminations__l2vpn', queryset=L2VPN.objects.all(), diff --git a/netbox/ipam/forms/bulk_edit.py b/netbox/ipam/forms/bulk_edit.py index 49a79623c..c323a41c1 100644 --- a/netbox/ipam/forms/bulk_edit.py +++ b/netbox/ipam/forms/bulk_edit.py @@ -527,15 +527,29 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm): max_length=200, required=False ) + qinq_role = forms.ChoiceField( + label=_('Q-in-Q role'), + choices=add_blank_choice(VLANQinQRoleChoices), + required=False + ) + qinq_svlan = DynamicModelChoiceField( + label=_('Q-in-Q SVLAN'), + queryset=VLAN.objects.all(), + required=False, + query_params={ + 'qinq_role': VLANQinQRoleChoices.ROLE_SERVICE, + } + ) comments = CommentField() model = VLAN fieldsets = ( FieldSet('status', 'role', 'tenant', 'description'), + FieldSet('qinq_role', 'qinq_svlan', name=_('Q-in-Q')), FieldSet('region', 'site_group', 'site', 'group', name=_('Site & Group')), ) nullable_fields = ( - 'site', 'group', 'tenant', 'role', 'description', 'comments', + 'site', 'group', 'tenant', 'role', 'description', 'qinq_role', 'qinq_svlan', 'comments', ) diff --git a/netbox/ipam/forms/bulk_import.py b/netbox/ipam/forms/bulk_import.py index cd34a6d84..3be4ccc59 100644 --- a/netbox/ipam/forms/bulk_import.py +++ b/netbox/ipam/forms/bulk_import.py @@ -461,10 +461,26 @@ class VLANImportForm(NetBoxModelImportForm): to_field_name='name', help_text=_('Functional role') ) + qinq_role = CSVChoiceField( + label=_('Q-in-Q role'), + choices=VLANStatusChoices, + required=False, + help_text=_('Operational status') + ) + qinq_svlan = CSVModelChoiceField( + label=_('Q-in-Q SVLAN'), + queryset=VLAN.objects.all(), + required=False, + to_field_name='vid', + help_text=_("Service VLAN (for Q-in-Q/802.1ad customer VLANs)") + ) class Meta: model = VLAN - fields = ('site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'comments', 'tags') + fields = ( + 'site', 'group', 'vid', 'name', 'tenant', 'status', 'role', 'description', 'qinq_role', 'qinq_svlan', + 'comments', 'tags', + ) class VLANTranslationPolicyImportForm(NetBoxModelImportForm): diff --git a/netbox/ipam/forms/filtersets.py b/netbox/ipam/forms/filtersets.py index b9bee6d97..3f951512b 100644 --- a/netbox/ipam/forms/filtersets.py +++ b/netbox/ipam/forms/filtersets.py @@ -506,6 +506,7 @@ class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): FieldSet('q', 'filter_id', 'tag'), FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')), FieldSet('group_id', 'status', 'role_id', 'vid', 'l2vpn_id', name=_('Attributes')), + FieldSet('qinq_role', 'qinq_svlan_id', name=_('Q-in-Q/802.1ad')), FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), ) selector_fields = ('filter_id', 'q', 'site_id') @@ -552,6 +553,17 @@ class VLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): required=False, label=_('VLAN ID') ) + qinq_role = forms.MultipleChoiceField( + label=_('Q-in-Q role'), + choices=VLANQinQRoleChoices, + required=False + ) + qinq_svlan_id = DynamicModelMultipleChoiceField( + queryset=VLAN.objects.all(), + required=False, + null_option='None', + label=_('Q-in-Q SVLAN') + ) l2vpn_id = DynamicModelMultipleChoiceField( queryset=L2VPN.objects.all(), required=False, diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index 629c1a481..3d0cd3dd1 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -683,13 +683,21 @@ class VLANForm(TenancyForm, NetBoxModelForm): queryset=Role.objects.all(), required=False ) + qinq_svlan = DynamicModelChoiceField( + label=_('Q-in-Q SVLAN'), + queryset=VLAN.objects.all(), + required=False, + query_params={ + 'qinq_role': VLANQinQRoleChoices.ROLE_SERVICE, + } + ) comments = CommentField() class Meta: model = VLAN fields = [ - 'site', 'group', 'vid', 'name', 'status', 'role', 'tenant_group', 'tenant', 'description', 'comments', - 'tags', + 'site', 'group', 'vid', 'name', 'status', 'role', 'tenant_group', 'tenant', 'qinq_role', 'qinq_svlan', + 'description', 'comments', 'tags', ] diff --git a/netbox/ipam/graphql/types.py b/netbox/ipam/graphql/types.py index ef50138c2..2ef63cf0c 100644 --- a/netbox/ipam/graphql/types.py +++ b/netbox/ipam/graphql/types.py @@ -236,7 +236,7 @@ class ServiceTemplateType(NetBoxObjectType): @strawberry_django.type( models.VLAN, - fields='__all__', + exclude=('qinq_svlan',), filters=VLANFilter ) class VLANType(NetBoxObjectType): @@ -252,6 +252,10 @@ class VLANType(NetBoxObjectType): interfaces_as_tagged: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]] vminterfaces_as_tagged: List[Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')]] + @strawberry_django.field + def qinq_svlan(self) -> Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None: + return self.qinq_svlan + @strawberry_django.type( models.VLANGroup, diff --git a/netbox/ipam/migrations/0075_vlan_qinq.py b/netbox/ipam/migrations/0075_vlan_qinq.py new file mode 100644 index 000000000..8a3b8a39a --- /dev/null +++ b/netbox/ipam/migrations/0075_vlan_qinq.py @@ -0,0 +1,30 @@ +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ipam', '0074_vlantranslationpolicy_vlantranslationrule'), + ] + + operations = [ + migrations.AddField( + model_name='vlan', + name='qinq_role', + field=models.CharField(blank=True, max_length=50, null=True), + ), + migrations.AddField( + model_name='vlan', + name='qinq_svlan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='qinq_cvlans', to='ipam.vlan'), + ), + migrations.AddConstraint( + model_name='vlan', + constraint=models.UniqueConstraint(fields=('qinq_svlan', 'vid'), name='ipam_vlan_unique_qinq_svlan_vid'), + ), + migrations.AddConstraint( + model_name='vlan', + constraint=models.UniqueConstraint(fields=('qinq_svlan', 'name'), name='ipam_vlan_unique_qinq_svlan_name'), + ), + ] diff --git a/netbox/ipam/models/vlans.py b/netbox/ipam/models/vlans.py index ff8394839..7832cfc67 100644 --- a/netbox/ipam/models/vlans.py +++ b/netbox/ipam/models/vlans.py @@ -204,6 +204,21 @@ class VLAN(PrimaryModel): null=True, help_text=_("The primary function of this VLAN") ) + qinq_svlan = models.ForeignKey( + to='self', + on_delete=models.PROTECT, + related_name='qinq_cvlans', + blank=True, + null=True + ) + qinq_role = models.CharField( + verbose_name=_('Q-in-Q role'), + max_length=50, + choices=VLANQinQRoleChoices, + blank=True, + null=True, + help_text=_("Customer/service VLAN designation (for Q-in-Q/IEEE 802.1ad)") + ) l2vpn_terminations = GenericRelation( to='vpn.L2VPNTermination', content_type_field='assigned_object_type', @@ -214,7 +229,7 @@ class VLAN(PrimaryModel): objects = VLANQuerySet.as_manager() clone_fields = [ - 'site', 'group', 'tenant', 'status', 'role', 'description', + 'site', 'group', 'tenant', 'status', 'role', 'description', 'qinq_role', 'qinq_svlan', ] class Meta: @@ -228,6 +243,14 @@ class VLAN(PrimaryModel): fields=('group', 'name'), name='%(app_label)s_%(class)s_unique_group_name' ), + models.UniqueConstraint( + fields=('qinq_svlan', 'vid'), + name='%(app_label)s_%(class)s_unique_qinq_svlan_vid' + ), + models.UniqueConstraint( + fields=('qinq_svlan', 'name'), + name='%(app_label)s_%(class)s_unique_qinq_svlan_name' + ), ) verbose_name = _('VLAN') verbose_name_plural = _('VLANs') @@ -255,9 +278,24 @@ class VLAN(PrimaryModel): ).format(ranges=ranges_to_string(self.group.vid_ranges), group=self.group) }) + # Only Q-in-Q customer VLANs may be assigned to a service VLAN + if self.qinq_svlan and self.qinq_role != VLANQinQRoleChoices.ROLE_CUSTOMER: + raise ValidationError({ + 'qinq_svlan': _("Only Q-in-Q customer VLANs maybe assigned to a service VLAN.") + }) + + # A Q-in-Q customer VLAN must be assigned to a service VLAN + if self.qinq_role == VLANQinQRoleChoices.ROLE_CUSTOMER and not self.qinq_svlan: + raise ValidationError({ + 'qinq_role': _("A Q-in-Q customer VLAN must be assigned to a service VLAN.") + }) + def get_status_color(self): return VLANStatusChoices.colors.get(self.status) + def get_qinq_role_color(self): + return VLANQinQRoleChoices.colors.get(self.qinq_role) + def get_interfaces(self): # Return all device interfaces assigned to this VLAN return Interface.objects.filter( diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 1a06bb700..d34ff5f45 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -132,6 +132,13 @@ class VLANTable(TenancyColumnsMixin, NetBoxTable): verbose_name=_('Role'), linkify=True ) + qinq_role = columns.ChoiceFieldColumn( + verbose_name=_('Q-in-Q role') + ) + qinq_svlan = tables.Column( + verbose_name=_('Q-in-Q SVLAN'), + linkify=True + ) l2vpn = tables.Column( accessor=tables.A('l2vpn_termination__l2vpn'), linkify=True, @@ -154,7 +161,7 @@ class VLANTable(TenancyColumnsMixin, NetBoxTable): model = VLAN fields = ( 'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'tenant_group', 'status', 'role', - 'description', 'comments', 'tags', 'l2vpn', 'created', 'last_updated', + 'qinq_role', 'qinq_svlan', 'description', 'comments', 'tags', 'l2vpn', 'created', 'last_updated', ) default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description') row_attrs = { diff --git a/netbox/ipam/tests/test_api.py b/netbox/ipam/tests/test_api.py index cd3e47342..4e8456e5a 100644 --- a/netbox/ipam/tests/test_api.py +++ b/netbox/ipam/tests/test_api.py @@ -980,6 +980,7 @@ class VLANTest(APIViewTestCases.APIViewTestCase): VLAN(name='VLAN 1', vid=1, group=vlan_groups[0]), VLAN(name='VLAN 2', vid=2, group=vlan_groups[0]), VLAN(name='VLAN 3', vid=3, group=vlan_groups[0]), + VLAN(name='SVLAN 1', vid=1001, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), ) VLAN.objects.bulk_create(vlans) @@ -999,6 +1000,12 @@ class VLANTest(APIViewTestCases.APIViewTestCase): 'name': 'VLAN 6', 'group': vlan_groups[1].pk, }, + { + 'vid': 2001, + 'name': 'CVLAN 1', + 'qinq_role': VLANQinQRoleChoices.ROLE_CUSTOMER, + 'qinq_svlan': vlans[3].pk, + }, ] def test_delete_vlan_with_prefix(self): diff --git a/netbox/ipam/tests/test_filtersets.py b/netbox/ipam/tests/test_filtersets.py index b402a8426..f651c970d 100644 --- a/netbox/ipam/tests/test_filtersets.py +++ b/netbox/ipam/tests/test_filtersets.py @@ -1630,6 +1630,7 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): Site(name='Site 4', slug='site-4', region=regions[0], group=site_groups[0]), Site(name='Site 5', slug='site-5', region=regions[1], group=site_groups[1]), Site(name='Site 6', slug='site-6', region=regions[2], group=site_groups[2]), + Site(name='Site 7', slug='site-7'), ) Site.objects.bulk_create(sites) @@ -1784,9 +1785,21 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): # Create one globally available VLAN VLAN(vid=1000, name='Global VLAN'), + + # Create some Q-in-Q service VLANs + VLAN(vid=2001, name='SVLAN 1', site=sites[6], qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(vid=2002, name='SVLAN 2', site=sites[6], qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(vid=2003, name='SVLAN 3', site=sites[6], qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), ) VLAN.objects.bulk_create(vlans) + # Create Q-in-Q customer VLANs + VLAN.objects.bulk_create([ + VLAN(vid=3001, name='CVLAN 1', site=sites[6], qinq_svlan=vlans[29], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), + VLAN(vid=3002, name='CVLAN 2', site=sites[6], qinq_svlan=vlans[30], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), + VLAN(vid=3003, name='CVLAN 3', site=sites[6], qinq_svlan=vlans[31], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), + ]) + # Assign VLANs to device interfaces interfaces[0].untagged_vlan = vlans[0] interfaces[0].tagged_vlans.add(vlans[1]) @@ -1897,6 +1910,17 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): params = {'vminterface_id': vminterface_id} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + def test_qinq_role(self): + params = {'qinq_role': [VLANQinQRoleChoices.ROLE_SERVICE, VLANQinQRoleChoices.ROLE_CUSTOMER]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 6) + + def test_qinq_svlan(self): + vlans = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE)[:2] + params = {'qinq_svlan_id': [vlans[0].pk, vlans[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'qinq_svlan_vid': [vlans[0].vid, vlans[1].vid]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + class VLANTranslationPolicyTestCase(TestCase, ChangeLoggedFilterSetTests): queryset = VLANTranslationPolicy.objects.all() diff --git a/netbox/ipam/tests/test_models.py b/netbox/ipam/tests/test_models.py index d14fa0657..917b50f33 100644 --- a/netbox/ipam/tests/test_models.py +++ b/netbox/ipam/tests/test_models.py @@ -586,3 +586,24 @@ class TestVLANGroup(TestCase): vlangroup.vid_ranges = string_to_ranges('2-2') vlangroup.full_clean() vlangroup.save() + + +class TestVLAN(TestCase): + + @classmethod + def setUpTestData(cls): + VLAN.objects.bulk_create(( + VLAN(name='VLAN 1', vid=1, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + )) + + def test_qinq_role(self): + svlan = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE).first() + + vlan = VLAN( + name='VLAN X', + vid=999, + qinq_role=VLANQinQRoleChoices.ROLE_SERVICE, + qinq_svlan=svlan + ) + with self.assertRaises(ValidationError): + vlan.full_clean() diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html index 95a4f7856..a10a1439a 100644 --- a/netbox/templates/ipam/vlan.html +++ b/netbox/templates/ipam/vlan.html @@ -62,6 +62,22 @@ {% trans "Description" %} {{ object.description|placeholder }} + + {% trans "Q-in-Q Role" %} + + {% if object.qinq_role %} + {% badge object.get_qinq_role_display bg_color=object.get_qinq_role_color %} + {% else %} + {{ ''|placeholder }} + {% endif %} + + + {% if object.qinq_role == 'c-vlan' %} + + {% trans "Q-in-Q SVLAN" %} + {{ object.qinq_svlan|linkify|placeholder }} + + {% endif %} {% trans "L2VPN" %} {{ object.l2vpn_termination.l2vpn|linkify|placeholder }} @@ -92,6 +108,21 @@ {% htmx_table 'ipam:prefix_list' vlan_id=object.pk %}
+ {% if object.qinq_role == 's-vlan' %} +
+

+ {% trans "Customer VLANs" %} + {% if perms.ipam.add_vlan %} + + {% endif %} +

+ {% htmx_table 'ipam:vlan_list' qinq_svlan_id=object.pk %} +
+ {% endif %} {% plugin_full_width_page object %}
diff --git a/netbox/templates/ipam/vlan_edit.html b/netbox/templates/ipam/vlan_edit.html index 814fc6b78..885844580 100644 --- a/netbox/templates/ipam/vlan_edit.html +++ b/netbox/templates/ipam/vlan_edit.html @@ -17,6 +17,14 @@ {% render_field form.tags %} +
+
+

{% trans "Q-in-Q (802.1ad)" %}

+
+ {% render_field form.qinq_role %} + {% render_field form.qinq_svlan %} +
+

{% trans "Tenancy" %}

diff --git a/netbox/virtualization/api/serializers_/virtualmachines.py b/netbox/virtualization/api/serializers_/virtualmachines.py index 2c00cac96..9b7000def 100644 --- a/netbox/virtualization/api/serializers_/virtualmachines.py +++ b/netbox/virtualization/api/serializers_/virtualmachines.py @@ -89,6 +89,7 @@ class VMInterfaceSerializer(NetBoxModelSerializer): required=False, many=True ) + qinq_svlan = VLANSerializer(nested=True, required=False, allow_null=True) vlan_translation_policy = VLANTranslationPolicySerializer(nested=True, required=False, allow_null=True) vrf = VRFSerializer(nested=True, required=False, allow_null=True) l2vpn_termination = L2VPNTerminationSerializer(nested=True, read_only=True, allow_null=True) @@ -104,9 +105,9 @@ class VMInterfaceSerializer(NetBoxModelSerializer): model = VMInterface fields = [ 'id', 'url', 'display_url', 'display', 'virtual_machine', 'name', 'enabled', 'parent', 'bridge', 'mtu', - 'mac_address', 'description', 'mode', 'untagged_vlan', 'tagged_vlans', 'vrf', 'l2vpn_termination', - 'tags', 'custom_fields', 'created', 'last_updated', 'count_ipaddresses', 'count_fhrp_groups', - 'vlan_translation_policy', + 'mac_address', 'description', 'mode', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', + 'vlan_translation_policy', 'vrf', 'l2vpn_termination', 'tags', 'custom_fields', 'created', 'last_updated', + 'count_ipaddresses', 'count_fhrp_groups', ] brief_fields = ('id', 'url', 'display', 'virtual_machine', 'name', 'description') diff --git a/netbox/virtualization/forms/model_forms.py b/netbox/virtualization/forms/model_forms.py index 5971fc894..4527e7f4c 100644 --- a/netbox/virtualization/forms/model_forms.py +++ b/netbox/virtualization/forms/model_forms.py @@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _ from dcim.forms.common import InterfaceCommonForm from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup from extras.models import ConfigTemplate +from ipam.choices import VLANQinQRoleChoices from ipam.models import IPAddress, VLAN, VLANGroup, VLANTranslationPolicy, VRF from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm @@ -338,6 +339,16 @@ class VMInterfaceForm(InterfaceCommonForm, VMComponentForm): 'available_on_virtualmachine': '$virtual_machine', } ) + qinq_svlan = DynamicModelChoiceField( + queryset=VLAN.objects.all(), + required=False, + label=_('Q-in-Q Service VLAN'), + query_params={ + 'group_id': '$vlan_group', + 'available_on_virtualmachine': '$virtual_machine', + 'qinq_role': VLANQinQRoleChoices.ROLE_SERVICE, + } + ) vrf = DynamicModelChoiceField( queryset=VRF.objects.all(), required=False, @@ -354,17 +365,20 @@ class VMInterfaceForm(InterfaceCommonForm, VMComponentForm): FieldSet('vrf', 'mac_address', name=_('Addressing')), FieldSet('mtu', 'enabled', name=_('Operation')), FieldSet('parent', 'bridge', name=_('Related Interfaces')), - FieldSet('mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vlan_translation_policy', name=_('802.1Q Switching')), + FieldSet( + 'mode', 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vlan_translation_policy', + name=_('802.1Q Switching') + ), ) class Meta: model = VMInterface fields = [ 'virtual_machine', 'name', 'parent', 'bridge', 'enabled', 'mac_address', 'mtu', 'description', 'mode', - 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags', 'vlan_translation_policy', + 'vlan_group', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vlan_translation_policy', 'vrf', 'tags', ] labels = { - 'mode': '802.1Q Mode', + 'mode': _('802.1Q Mode'), } widgets = { 'mode': HTMXSelect(), diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index bed65a3b3..79b5cb216 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -100,6 +100,7 @@ class VMInterfaceType(IPAddressesMixin, ComponentType): bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None + qinq_svlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vlan_translation_policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] | None tagged_vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]] diff --git a/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py index e0992c9c8..3a6d5e481 100644 --- a/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py +++ b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py @@ -1,5 +1,3 @@ -# Generated by Django 5.0.9 on 2024-10-11 19:45 - import django.db.models.deletion from django.db import migrations, models diff --git a/netbox/virtualization/migrations/0043_qinq_svlan.py b/netbox/virtualization/migrations/0043_qinq_svlan.py new file mode 100644 index 000000000..422289fb7 --- /dev/null +++ b/netbox/virtualization/migrations/0043_qinq_svlan.py @@ -0,0 +1,28 @@ +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ipam', '0075_vlan_qinq'), + ('virtualization', '0042_vminterface_vlan_translation_policy'), + ] + + operations = [ + migrations.AddField( + model_name='vminterface', + name='qinq_svlan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_svlan', to='ipam.vlan'), + ), + migrations.AlterField( + model_name='vminterface', + name='tagged_vlans', + field=models.ManyToManyField(blank=True, related_name='%(class)ss_as_tagged', to='ipam.vlan'), + ), + migrations.AlterField( + model_name='vminterface', + name='untagged_vlan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_as_untagged', to='ipam.vlan'), + ), + ] diff --git a/netbox/virtualization/models/virtualmachines.py b/netbox/virtualization/models/virtualmachines.py index 0767b2c13..da8419e88 100644 --- a/netbox/virtualization/models/virtualmachines.py +++ b/netbox/virtualization/models/virtualmachines.py @@ -322,20 +322,6 @@ class VMInterface(ComponentModel, BaseInterface, TrackingModelMixin): max_length=100, blank=True ) - untagged_vlan = models.ForeignKey( - to='ipam.VLAN', - on_delete=models.SET_NULL, - related_name='vminterfaces_as_untagged', - null=True, - blank=True, - verbose_name=_('untagged VLAN') - ) - tagged_vlans = models.ManyToManyField( - to='ipam.VLAN', - related_name='vminterfaces_as_tagged', - blank=True, - verbose_name=_('tagged VLANs') - ) ip_addresses = GenericRelation( to='ipam.IPAddress', content_type_field='assigned_object_type', diff --git a/netbox/virtualization/tables/virtualmachines.py b/netbox/virtualization/tables/virtualmachines.py index 8a2a26bb9..4a3138711 100644 --- a/netbox/virtualization/tables/virtualmachines.py +++ b/netbox/virtualization/tables/virtualmachines.py @@ -151,8 +151,8 @@ class VMInterfaceTable(BaseInterfaceTable): model = VMInterface fields = ( 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', - 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'created', - 'last_updated', + 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', + 'created', 'last_updated', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description') @@ -175,7 +175,8 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): model = VMInterface fields = ( 'pk', 'id', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags', - 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', + 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', + 'actions', ) default_columns = ('pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'ip_addresses') row_attrs = { diff --git a/netbox/virtualization/tests/test_api.py b/netbox/virtualization/tests/test_api.py index 69728f67c..521064fc6 100644 --- a/netbox/virtualization/tests/test_api.py +++ b/netbox/virtualization/tests/test_api.py @@ -4,6 +4,7 @@ from rest_framework import status from dcim.choices import InterfaceModeChoices from dcim.models import Site from extras.models import ConfigTemplate +from ipam.choices import VLANQinQRoleChoices from ipam.models import VLAN, VRF from utilities.testing import APITestCase, APIViewTestCases, create_test_device, create_test_virtualmachine from virtualization.choices import * @@ -270,6 +271,7 @@ class VMInterfaceTest(APIViewTestCases.APIViewTestCase): VLAN(name='VLAN 1', vid=1), VLAN(name='VLAN 2', vid=2), VLAN(name='VLAN 3', vid=3), + VLAN(name='SVLAN 1', vid=1001, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), ) VLAN.objects.bulk_create(vlans) @@ -307,6 +309,12 @@ class VMInterfaceTest(APIViewTestCases.APIViewTestCase): 'untagged_vlan': vlans[2].pk, 'vrf': vrfs[2].pk, }, + { + 'virtual_machine': virtualmachine.pk, + 'name': 'Interface 7', + 'mode': InterfaceModeChoices.MODE_Q_IN_Q, + 'qinq_svlan': vlans[3].pk, + }, ] def test_bulk_delete_child_interfaces(self): diff --git a/netbox/virtualization/tests/test_filtersets.py b/netbox/virtualization/tests/test_filtersets.py index cd598274f..0c7079bba 100644 --- a/netbox/virtualization/tests/test_filtersets.py +++ b/netbox/virtualization/tests/test_filtersets.py @@ -1,7 +1,9 @@ from django.test import TestCase +from dcim.choices import InterfaceModeChoices from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup -from ipam.models import IPAddress, VLANTranslationPolicy, VRF +from ipam.choices import VLANQinQRoleChoices +from ipam.models import IPAddress, VLAN, VLANTranslationPolicy, VRF from tenancy.models import Tenant, TenantGroup from utilities.testing import ChangeLoggedFilterSetTests, create_test_device from virtualization.choices import * @@ -528,7 +530,7 @@ class VirtualMachineTestCase(TestCase, ChangeLoggedFilterSetTests): class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): queryset = VMInterface.objects.all() filterset = VMInterfaceFilterSet - ignore_fields = ('tagged_vlans', 'untagged_vlan',) + ignore_fields = ('tagged_vlans', 'untagged_vlan', 'qinq_svlan') @classmethod def setUpTestData(cls): @@ -554,6 +556,13 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): ) VRF.objects.bulk_create(vrfs) + vlans = ( + VLAN(name='SVLAN 1', vid=1001, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(name='SVLAN 2', vid=1002, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + VLAN(name='SVLAN 3', vid=1003, qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), + ) + VLAN.objects.bulk_create(vlans) + vms = ( VirtualMachine(name='Virtual Machine 1', cluster=clusters[0]), VirtualMachine(name='Virtual Machine 2', cluster=clusters[1]), @@ -596,7 +605,9 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): mtu=300, mac_address='00-00-00-00-00-03', vrf=vrfs[2], - description='foobar3' + description='foobar3', + mode=InterfaceModeChoices.MODE_Q_IN_Q, + qinq_svlan=vlans[0] ), ) VMInterface.objects.bulk_create(interfaces) @@ -667,6 +678,13 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): params = {'description': ['foobar1', 'foobar2']} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + def test_vlan(self): + vlan = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE).first() + params = {'vlan_id': vlan.pk} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + params = {'vlan': vlan.vid} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + def test_vlan_translation_policy(self): vlan_translation_policies = VLANTranslationPolicy.objects.all()[:2] params = {'vlan_translation_policy_id': [vlan_translation_policies[0].pk, vlan_translation_policies[1].pk]} From 6dc75d8db1e7750f37ba5f50d65e05c430352146 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 1 Nov 2024 11:18:23 -0700 Subject: [PATCH 22/65] 7699 Add Scope to Cluster (#17848) * 7699 Add Scope to Cluster * 7699 Serializer * 7699 filterset * 7699 bulk_edit * 7699 bulk_import * 7699 model_form * 7699 graphql, tables * 7699 fixes * 7699 fixes * 7699 fixes * 7699 fixes * 7699 fix tests * 7699 fix graphql tests for clusters reference * 7699 fix dcim tests * 7699 fix ipam tests * 7699 fix tests * 7699 use mixin for model * 7699 change mixin name * 7699 scope form * 7699 scope form * 7699 scoped form, fitlerset * 7699 review changes * 7699 move ScopedFilterset * 7699 move CachedScopeMixin * 7699 review changes * 7699 review changes * 7699 refactor mixins * 7699 _sitegroup -> _site_group * 7699 update docstring * Misc cleanup * Update migrations --------- Co-authored-by: Jeremy Stretch --- docs/models/virtualization/cluster.md | 4 +- netbox/dcim/constants.py | 5 + netbox/dcim/filtersets.py | 58 ++++++++++ netbox/dcim/forms/mixins.py | 105 ++++++++++++++++++ netbox/dcim/graphql/types.py | 17 +++ netbox/dcim/models/devices.py | 11 +- netbox/dcim/models/mixins.py | 85 ++++++++++++++ netbox/dcim/tests/test_models.py | 9 +- netbox/extras/tests/test_models.py | 4 +- netbox/ipam/querysets.py | 2 +- netbox/ipam/tests/test_filtersets.py | 9 +- netbox/templates/virtualization/cluster.html | 8 +- .../api/serializers_/clusters.py | 31 +++++- netbox/virtualization/apps.py | 2 +- netbox/virtualization/filtersets.py | 42 +------ netbox/virtualization/forms/bulk_edit.py | 28 +---- netbox/virtualization/forms/bulk_import.py | 8 +- netbox/virtualization/forms/filtersets.py | 19 ++-- netbox/virtualization/forms/model_forms.py | 14 +-- netbox/virtualization/graphql/types.py | 15 ++- .../migrations/0044_cluster_scope.py | 51 +++++++++ .../0045_clusters_cached_relations.py | 94 ++++++++++++++++ netbox/virtualization/models/clusters.py | 48 +++++--- .../virtualization/models/virtualmachines.py | 4 +- netbox/virtualization/tables/clusters.py | 11 +- netbox/virtualization/tests/test_api.py | 10 +- .../virtualization/tests/test_filtersets.py | 18 +-- netbox/virtualization/tests/test_models.py | 9 +- netbox/virtualization/tests/test_views.py | 23 ++-- 29 files changed, 588 insertions(+), 156 deletions(-) create mode 100644 netbox/dcim/forms/mixins.py create mode 100644 netbox/virtualization/migrations/0044_cluster_scope.py create mode 100644 netbox/virtualization/migrations/0045_clusters_cached_relations.py diff --git a/docs/models/virtualization/cluster.md b/docs/models/virtualization/cluster.md index 50b5dbd1d..9acdb2bc4 100644 --- a/docs/models/virtualization/cluster.md +++ b/docs/models/virtualization/cluster.md @@ -23,6 +23,6 @@ The cluster's operational status. !!! tip Additional statuses may be defined by setting `Cluster.status` under the [`FIELD_CHOICES`](../../configuration/data-validation.md#field_choices) configuration parameter. -### Site +### Scope -The [site](../dcim/site.md) with which the cluster is associated. +The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) with which this cluster is associated. diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index ba3e6464b..4927b0198 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -123,3 +123,8 @@ COMPATIBLE_TERMINATION_TYPES = { 'powerport': ['poweroutlet', 'powerfeed'], 'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'], } + +# Models which can serve to scope an object by location +LOCATION_SCOPE_TYPES = ( + 'region', 'sitegroup', 'site', 'location', +) diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index 0371f882b..df66ad77b 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -73,6 +73,7 @@ __all__ = ( 'RearPortFilterSet', 'RearPortTemplateFilterSet', 'RegionFilterSet', + 'ScopedFilterSet', 'SiteFilterSet', 'SiteGroupFilterSet', 'VirtualChassisFilterSet', @@ -2344,3 +2345,60 @@ class InterfaceConnectionFilterSet(ConnectionFilterSet): class Meta: model = Interface fields = tuple() + + +class ScopedFilterSet(BaseFilterSet): + """ + Provides additional filtering functionality for location, site, etc.. for Scoped models. + """ + scope_type = ContentTypeFilter() + region_id = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + label=_('Region (ID)'), + ) + region = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + to_field_name='slug', + label=_('Region (slug)'), + ) + site_group_id = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + label=_('Site group (ID)'), + ) + site_group = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + to_field_name='slug', + label=_('Site group (slug)'), + ) + site_id = django_filters.ModelMultipleChoiceFilter( + queryset=Site.objects.all(), + field_name='_site', + label=_('Site (ID)'), + ) + site = django_filters.ModelMultipleChoiceFilter( + field_name='_site__slug', + queryset=Site.objects.all(), + to_field_name='slug', + label=_('Site (slug)'), + ) + location_id = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + label=_('Location (ID)'), + ) + location = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + to_field_name='slug', + label=_('Location (slug)'), + ) diff --git a/netbox/dcim/forms/mixins.py b/netbox/dcim/forms/mixins.py new file mode 100644 index 000000000..98862af10 --- /dev/null +++ b/netbox/dcim/forms/mixins.py @@ -0,0 +1,105 @@ +from django import forms +from django.contrib.contenttypes.models import ContentType +from django.core.exceptions import ObjectDoesNotExist +from django.utils.translation import gettext_lazy as _ + +from dcim.constants import LOCATION_SCOPE_TYPES +from dcim.models import Site +from utilities.forms import get_field_value +from utilities.forms.fields import ( + ContentTypeChoiceField, CSVContentTypeField, DynamicModelChoiceField, +) +from utilities.templatetags.builtins.filters import bettertitle +from utilities.forms.widgets import HTMXSelect + +__all__ = ( + 'ScopedBulkEditForm', + 'ScopedForm', + 'ScopedImportForm', +) + + +class ScopedForm(forms.Form): + scope_type = ContentTypeChoiceField( + queryset=ContentType.objects.filter(model__in=LOCATION_SCOPE_TYPES), + widget=HTMXSelect(), + required=False, + label=_('Scope type') + ) + scope = DynamicModelChoiceField( + label=_('Scope'), + queryset=Site.objects.none(), # Initial queryset + required=False, + disabled=True, + selector=True + ) + + def __init__(self, *args, **kwargs): + instance = kwargs.get('instance') + initial = kwargs.get('initial', {}) + + if instance is not None and instance.scope: + initial['scope'] = instance.scope + kwargs['initial'] = initial + + super().__init__(*args, **kwargs) + self._set_scoped_values() + + def clean(self): + super().clean() + + # Assign the selected scope (if any) + self.instance.scope = self.cleaned_data.get('scope') + + def _set_scoped_values(self): + if scope_type_id := get_field_value(self, 'scope_type'): + try: + scope_type = ContentType.objects.get(pk=scope_type_id) + model = scope_type.model_class() + self.fields['scope'].queryset = model.objects.all() + self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower + self.fields['scope'].disabled = False + self.fields['scope'].label = _(bettertitle(model._meta.verbose_name)) + except ObjectDoesNotExist: + pass + + if self.instance and scope_type_id != self.instance.scope_type_id: + self.initial['scope'] = None + + +class ScopedBulkEditForm(forms.Form): + scope_type = ContentTypeChoiceField( + queryset=ContentType.objects.filter(model__in=LOCATION_SCOPE_TYPES), + widget=HTMXSelect(method='post', attrs={'hx-select': '#form_fields'}), + required=False, + label=_('Scope type') + ) + scope = DynamicModelChoiceField( + label=_('Scope'), + queryset=Site.objects.none(), # Initial queryset + required=False, + disabled=True, + selector=True + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + if scope_type_id := get_field_value(self, 'scope_type'): + try: + scope_type = ContentType.objects.get(pk=scope_type_id) + model = scope_type.model_class() + self.fields['scope'].queryset = model.objects.all() + self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower + self.fields['scope'].disabled = False + self.fields['scope'].label = _(bettertitle(model._meta.verbose_name)) + except ObjectDoesNotExist: + pass + + +class ScopedImportForm(forms.Form): + scope_type = CSVContentTypeField( + queryset=ContentType.objects.filter(model__in=LOCATION_SCOPE_TYPES), + required=False, + label=_('Scope type (app & model)') + ) diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index 5965fdcec..6493ec6b1 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -463,6 +463,10 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]] children: List[Annotated["LocationType", strawberry.lazy('dcim.graphql.types')]] + @strawberry_django.field + def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: + return self._clusters.all() + @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: return self.circuit_terminations.all() @@ -710,6 +714,10 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): def parent(self) -> Annotated["RegionType", strawberry.lazy('dcim.graphql.types')] | None: return self.parent + @strawberry_django.field + def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: + return self._clusters.all() + @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: return self.circuit_terminations.all() @@ -735,9 +743,14 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]] locations: List[Annotated["LocationType", strawberry.lazy('dcim.graphql.types')]] asns: List[Annotated["ASNType", strawberry.lazy('ipam.graphql.types')]] + circuit_terminations: List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]] clusters: List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]] vlans: List[Annotated["VLANType", strawberry.lazy('ipam.graphql.types')]] + @strawberry_django.field + def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: + return self._clusters.all() + @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: return self.circuit_terminations.all() @@ -758,6 +771,10 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): def parent(self) -> Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')] | None: return self.parent + @strawberry_django.field + def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: + return self._clusters.all() + @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: return self.circuit_terminations.all() diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index b9ba2bb64..47f4ee6c9 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -958,10 +958,17 @@ class Device( }) # A Device can only be assigned to a Cluster in the same Site (or no Site) - if self.cluster and self.cluster.site is not None and self.cluster.site != self.site: + if self.cluster and self.cluster._site is not None and self.cluster._site != self.site: raise ValidationError({ 'cluster': _("The assigned cluster belongs to a different site ({site})").format( - site=self.cluster.site + site=self.cluster._site + ) + }) + + if self.cluster and self.cluster._location is not None and self.cluster._location != self.location: + raise ValidationError({ + 'cluster': _("The assigned cluster belongs to a different location ({location})").format( + site=self.cluster._location ) }) diff --git a/netbox/dcim/models/mixins.py b/netbox/dcim/models/mixins.py index c9be451a0..1df3364c4 100644 --- a/netbox/dcim/models/mixins.py +++ b/netbox/dcim/models/mixins.py @@ -1,6 +1,10 @@ +from django.apps import apps +from django.contrib.contenttypes.fields import GenericForeignKey from django.db import models +from dcim.constants import LOCATION_SCOPE_TYPES __all__ = ( + 'CachedScopeMixin', 'RenderConfigMixin', ) @@ -27,3 +31,84 @@ class RenderConfigMixin(models.Model): return self.role.config_template if self.platform and self.platform.config_template: return self.platform.config_template + + +class CachedScopeMixin(models.Model): + """ + Mixin for adding a GenericForeignKey scope to a model that can point to a Region, SiteGroup, Site, or Location. + Includes cached fields for each to allow efficient filtering. Appropriate validation must be done in the clean() + method as this does not have any as validation is generally model-specific. + """ + scope_type = models.ForeignKey( + to='contenttypes.ContentType', + on_delete=models.PROTECT, + limit_choices_to=models.Q(model__in=LOCATION_SCOPE_TYPES), + related_name='+', + blank=True, + null=True + ) + scope_id = models.PositiveBigIntegerField( + blank=True, + null=True + ) + scope = GenericForeignKey( + ct_field='scope_type', + fk_field='scope_id' + ) + + _location = models.ForeignKey( + to='dcim.Location', + on_delete=models.CASCADE, + related_name='_%(class)ss', + blank=True, + null=True + ) + _site = models.ForeignKey( + to='dcim.Site', + on_delete=models.CASCADE, + related_name='_%(class)ss', + blank=True, + null=True + ) + _region = models.ForeignKey( + to='dcim.Region', + on_delete=models.CASCADE, + related_name='_%(class)ss', + blank=True, + null=True + ) + _site_group = models.ForeignKey( + to='dcim.SiteGroup', + on_delete=models.CASCADE, + related_name='_%(class)ss', + blank=True, + null=True + ) + + class Meta: + abstract = True + + def save(self, *args, **kwargs): + # Cache objects associated with the terminating object (for filtering) + self.cache_related_objects() + + super().save(*args, **kwargs) + + def cache_related_objects(self): + self._region = self._site_group = self._site = self._location = None + if self.scope_type: + scope_type = self.scope_type.model_class() + if scope_type == apps.get_model('dcim', 'region'): + self._region = self.scope + elif scope_type == apps.get_model('dcim', 'sitegroup'): + self._site_group = self.scope + elif scope_type == apps.get_model('dcim', 'site'): + self._region = self.scope.region + self._site_group = self.scope.group + self._site = self.scope + elif scope_type == apps.get_model('dcim', 'location'): + self._region = self.scope.site.region + self._site_group = self.scope.site.group + self._site = self.scope.site + self._location = self.scope + cache_related_objects.alters_data = True diff --git a/netbox/dcim/tests/test_models.py b/netbox/dcim/tests/test_models.py index f0fe4da3b..8d43d67ea 100644 --- a/netbox/dcim/tests/test_models.py +++ b/netbox/dcim/tests/test_models.py @@ -601,11 +601,12 @@ class DeviceTestCase(TestCase): Site.objects.bulk_create(sites) clusters = ( - Cluster(name='Cluster 1', type=cluster_type, site=sites[0]), - Cluster(name='Cluster 2', type=cluster_type, site=sites[1]), - Cluster(name='Cluster 3', type=cluster_type, site=None), + Cluster(name='Cluster 1', type=cluster_type, scope=sites[0]), + Cluster(name='Cluster 2', type=cluster_type, scope=sites[1]), + Cluster(name='Cluster 3', type=cluster_type, scope=None), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() device_type = DeviceType.objects.first() device_role = DeviceRole.objects.first() diff --git a/netbox/extras/tests/test_models.py b/netbox/extras/tests/test_models.py index 188a06a3f..c90390dd1 100644 --- a/netbox/extras/tests/test_models.py +++ b/netbox/extras/tests/test_models.py @@ -274,7 +274,7 @@ class ConfigContextTest(TestCase): name="Cluster", group=cluster_group, type=cluster_type, - site=site, + scope=site, ) region_context = ConfigContext.objects.create( @@ -366,7 +366,7 @@ class ConfigContextTest(TestCase): """ site = Site.objects.first() cluster_type = ClusterType.objects.create(name="Cluster Type") - cluster = Cluster.objects.create(name="Cluster", type=cluster_type, site=site) + cluster = Cluster.objects.create(name="Cluster", type=cluster_type, scope=site) vm_role = DeviceRole.objects.first() # Create a ConfigContext associated with the site diff --git a/netbox/ipam/querysets.py b/netbox/ipam/querysets.py index 771e9b3b9..77ab8194a 100644 --- a/netbox/ipam/querysets.py +++ b/netbox/ipam/querysets.py @@ -148,7 +148,7 @@ class VLANQuerySet(RestrictedQuerySet): # Find all relevant VLANGroups q = Q() - site = vm.site or vm.cluster.site + site = vm.site or vm.cluster._site if vm.cluster: # Add VLANGroups scoped to the assigned cluster (or its group) q |= Q( diff --git a/netbox/ipam/tests/test_filtersets.py b/netbox/ipam/tests/test_filtersets.py index f651c970d..28e8cda1e 100644 --- a/netbox/ipam/tests/test_filtersets.py +++ b/netbox/ipam/tests/test_filtersets.py @@ -1675,11 +1675,12 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): cluster_type = ClusterType.objects.create(name='Cluster Type 1', slug='cluster-type-1') clusters = ( - Cluster(name='Cluster 1', type=cluster_type, group=cluster_groups[0], site=sites[0]), - Cluster(name='Cluster 2', type=cluster_type, group=cluster_groups[1], site=sites[1]), - Cluster(name='Cluster 3', type=cluster_type, group=cluster_groups[2], site=sites[2]), + Cluster(name='Cluster 1', type=cluster_type, group=cluster_groups[0], scope=sites[0]), + Cluster(name='Cluster 2', type=cluster_type, group=cluster_groups[1], scope=sites[1]), + Cluster(name='Cluster 3', type=cluster_type, group=cluster_groups[2], scope=sites[2]), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() virtual_machines = ( VirtualMachine(name='Virtual Machine 1', cluster=clusters[0]), diff --git a/netbox/templates/virtualization/cluster.html b/netbox/templates/virtualization/cluster.html index d79d8075c..4155dacb2 100644 --- a/netbox/templates/virtualization/cluster.html +++ b/netbox/templates/virtualization/cluster.html @@ -39,8 +39,12 @@ - {% trans "Site" %} - {{ object.site|linkify|placeholder }} + {% trans "Scope" %} + {% if object.scope %} + {{ object.scope|linkify }} ({% trans object.scope_type.name %}) + {% else %} + {{ ''|placeholder }} + {% endif %}
diff --git a/netbox/virtualization/api/serializers_/clusters.py b/netbox/virtualization/api/serializers_/clusters.py index b64b6e7ba..101a5b5a3 100644 --- a/netbox/virtualization/api/serializers_/clusters.py +++ b/netbox/virtualization/api/serializers_/clusters.py @@ -1,9 +1,13 @@ -from dcim.api.serializers_.sites import SiteSerializer -from netbox.api.fields import ChoiceField, RelatedObjectCountField +from dcim.constants import LOCATION_SCOPE_TYPES +from django.contrib.contenttypes.models import ContentType +from drf_spectacular.utils import extend_schema_field +from rest_framework import serializers +from netbox.api.fields import ChoiceField, ContentTypeField, RelatedObjectCountField from netbox.api.serializers import NetBoxModelSerializer from tenancy.api.serializers_.tenants import TenantSerializer from virtualization.choices import * from virtualization.models import Cluster, ClusterGroup, ClusterType +from utilities.api import get_serializer_for_model __all__ = ( 'ClusterGroupSerializer', @@ -45,7 +49,16 @@ class ClusterSerializer(NetBoxModelSerializer): group = ClusterGroupSerializer(nested=True, required=False, allow_null=True, default=None) status = ChoiceField(choices=ClusterStatusChoices, required=False) tenant = TenantSerializer(nested=True, required=False, allow_null=True) - site = SiteSerializer(nested=True, required=False, allow_null=True, default=None) + scope_type = ContentTypeField( + queryset=ContentType.objects.filter( + model__in=LOCATION_SCOPE_TYPES + ), + allow_null=True, + required=False, + default=None + ) + scope_id = serializers.IntegerField(allow_null=True, required=False, default=None) + scope = serializers.SerializerMethodField(read_only=True) # Related object counts device_count = RelatedObjectCountField('devices') @@ -54,8 +67,18 @@ class ClusterSerializer(NetBoxModelSerializer): class Meta: model = Cluster fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'site', + 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'scope_id', 'scope', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', 'virtualmachine_count', ] brief_fields = ('id', 'url', 'display', 'name', 'description', 'virtualmachine_count') + + @extend_schema_field(serializers.JSONField(allow_null=True)) + def get_scope(self, obj): + if obj.scope_id is None: + return None + serializer = get_serializer_for_model(obj.scope) + context = {'request': self.context['request']} + return serializer(obj.scope, nested=True, context=context).data + + diff --git a/netbox/virtualization/apps.py b/netbox/virtualization/apps.py index ebcc591bf..65ce0f112 100644 --- a/netbox/virtualization/apps.py +++ b/netbox/virtualization/apps.py @@ -17,7 +17,7 @@ class VirtualizationConfig(AppConfig): # Register denormalized fields denormalized.register(VirtualMachine, 'cluster', { - 'site': 'site', + 'site': '_site', }) # Register counters diff --git a/netbox/virtualization/filtersets.py b/netbox/virtualization/filtersets.py index ec0831f9f..ac72bea12 100644 --- a/netbox/virtualization/filtersets.py +++ b/netbox/virtualization/filtersets.py @@ -2,7 +2,7 @@ import django_filters from django.db.models import Q from django.utils.translation import gettext as _ -from dcim.filtersets import CommonInterfaceFilterSet +from dcim.filtersets import CommonInterfaceFilterSet, ScopedFilterSet from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup from extras.filtersets import LocalConfigContextFilterSet from extras.models import ConfigTemplate @@ -37,43 +37,7 @@ class ClusterGroupFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet) fields = ('id', 'name', 'slug', 'description') -class ClusterFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet): - region_id = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='site__region', - lookup_expr='in', - label=_('Region (ID)'), - ) - region = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='site__region', - lookup_expr='in', - to_field_name='slug', - label=_('Region (slug)'), - ) - site_group_id = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='site__group', - lookup_expr='in', - label=_('Site group (ID)'), - ) - site_group = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='site__group', - lookup_expr='in', - to_field_name='slug', - label=_('Site group (slug)'), - ) - site_id = django_filters.ModelMultipleChoiceFilter( - queryset=Site.objects.all(), - label=_('Site (ID)'), - ) - site = django_filters.ModelMultipleChoiceFilter( - field_name='site__slug', - queryset=Site.objects.all(), - to_field_name='slug', - label=_('Site (slug)'), - ) +class ClusterFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ScopedFilterSet, ContactModelFilterSet): group_id = django_filters.ModelMultipleChoiceFilter( queryset=ClusterGroup.objects.all(), label=_('Parent group (ID)'), @@ -101,7 +65,7 @@ class ClusterFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte class Meta: model = Cluster - fields = ('id', 'name', 'description') + fields = ('id', 'name', 'description', 'scope_id') def search(self, queryset, name, value): if not value.strip(): diff --git a/netbox/virtualization/forms/bulk_edit.py b/netbox/virtualization/forms/bulk_edit.py index 2bd3434ac..aaeb259b9 100644 --- a/netbox/virtualization/forms/bulk_edit.py +++ b/netbox/virtualization/forms/bulk_edit.py @@ -3,7 +3,8 @@ from django.utils.translation import gettext_lazy as _ from dcim.choices import InterfaceModeChoices from dcim.constants import INTERFACE_MTU_MAX, INTERFACE_MTU_MIN -from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup +from dcim.forms.mixins import ScopedBulkEditForm +from dcim.models import Device, DeviceRole, Platform, Site from extras.models import ConfigTemplate from ipam.models import VLAN, VLANGroup, VRF from netbox.forms import NetBoxModelBulkEditForm @@ -55,7 +56,7 @@ class ClusterGroupBulkEditForm(NetBoxModelBulkEditForm): nullable_fields = ('description',) -class ClusterBulkEditForm(NetBoxModelBulkEditForm): +class ClusterBulkEditForm(ScopedBulkEditForm, NetBoxModelBulkEditForm): type = DynamicModelChoiceField( label=_('Type'), queryset=ClusterType.objects.all(), @@ -77,25 +78,6 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm): queryset=Tenant.objects.all(), required=False ) - region = DynamicModelChoiceField( - label=_('Region'), - queryset=Region.objects.all(), - required=False, - ) - site_group = DynamicModelChoiceField( - label=_('Site group'), - queryset=SiteGroup.objects.all(), - required=False, - ) - site = DynamicModelChoiceField( - label=_('Site'), - queryset=Site.objects.all(), - required=False, - query_params={ - 'region_id': '$region', - 'group_id': '$site_group', - } - ) description = forms.CharField( label=_('Description'), max_length=200, @@ -106,10 +88,10 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm): model = Cluster fieldsets = ( FieldSet('type', 'group', 'status', 'tenant', 'description'), - FieldSet('region', 'site_group', 'site', name=_('Site')), + FieldSet('scope_type', 'scope', name=_('Scope')), ) nullable_fields = ( - 'group', 'site', 'tenant', 'description', 'comments', + 'group', 'scope', 'tenant', 'description', 'comments', ) diff --git a/netbox/virtualization/forms/bulk_import.py b/netbox/virtualization/forms/bulk_import.py index 17efc567a..9ccdd68f7 100644 --- a/netbox/virtualization/forms/bulk_import.py +++ b/netbox/virtualization/forms/bulk_import.py @@ -1,6 +1,7 @@ from django.utils.translation import gettext_lazy as _ from dcim.choices import InterfaceModeChoices +from dcim.forms.mixins import ScopedImportForm from dcim.models import Device, DeviceRole, Platform, Site from extras.models import ConfigTemplate from ipam.models import VRF @@ -36,7 +37,7 @@ class ClusterGroupImportForm(NetBoxModelImportForm): fields = ('name', 'slug', 'description', 'tags') -class ClusterImportForm(NetBoxModelImportForm): +class ClusterImportForm(ScopedImportForm, NetBoxModelImportForm): type = CSVModelChoiceField( label=_('Type'), queryset=ClusterType.objects.all(), @@ -72,7 +73,10 @@ class ClusterImportForm(NetBoxModelImportForm): class Meta: model = Cluster - fields = ('name', 'type', 'group', 'status', 'site', 'tenant', 'description', 'comments', 'tags') + fields = ('name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags') + labels = { + 'scope_id': _('Scope ID'), + } class VirtualMachineImportForm(NetBoxModelImportForm): diff --git a/netbox/virtualization/forms/filtersets.py b/netbox/virtualization/forms/filtersets.py index 7c040d948..695641e4e 100644 --- a/netbox/virtualization/forms/filtersets.py +++ b/netbox/virtualization/forms/filtersets.py @@ -1,7 +1,7 @@ from django import forms from django.utils.translation import gettext_lazy as _ -from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup +from dcim.models import Device, DeviceRole, Location, Platform, Region, Site, SiteGroup from extras.forms import LocalConfigContextFilterForm from extras.models import ConfigTemplate from ipam.models import VRF @@ -43,7 +43,7 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi fieldsets = ( FieldSet('q', 'filter_id', 'tag'), FieldSet('group_id', 'type_id', 'status', name=_('Attributes')), - FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')), + FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Scope')), FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')), ) @@ -58,11 +58,6 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi required=False, label=_('Region') ) - status = forms.MultipleChoiceField( - label=_('Status'), - choices=ClusterStatusChoices, - required=False - ) site_group_id = DynamicModelMultipleChoiceField( queryset=SiteGroup.objects.all(), required=False, @@ -78,6 +73,16 @@ class ClusterFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi }, label=_('Site') ) + location_id = DynamicModelMultipleChoiceField( + queryset=Location.objects.all(), + required=False, + label=_('Location') + ) + status = forms.MultipleChoiceField( + label=_('Status'), + choices=ClusterStatusChoices, + required=False + ) group_id = DynamicModelMultipleChoiceField( queryset=ClusterGroup.objects.all(), required=False, diff --git a/netbox/virtualization/forms/model_forms.py b/netbox/virtualization/forms/model_forms.py index 4527e7f4c..44c67d389 100644 --- a/netbox/virtualization/forms/model_forms.py +++ b/netbox/virtualization/forms/model_forms.py @@ -4,6 +4,7 @@ from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from dcim.forms.common import InterfaceCommonForm +from dcim.forms.mixins import ScopedForm from dcim.models import Device, DeviceRole, Platform, Rack, Region, Site, SiteGroup from extras.models import ConfigTemplate from ipam.choices import VLANQinQRoleChoices @@ -58,7 +59,7 @@ class ClusterGroupForm(NetBoxModelForm): ) -class ClusterForm(TenancyForm, NetBoxModelForm): +class ClusterForm(TenancyForm, ScopedForm, NetBoxModelForm): type = DynamicModelChoiceField( label=_('Type'), queryset=ClusterType.objects.all() @@ -68,23 +69,18 @@ class ClusterForm(TenancyForm, NetBoxModelForm): queryset=ClusterGroup.objects.all(), required=False ) - site = DynamicModelChoiceField( - label=_('Site'), - queryset=Site.objects.all(), - required=False, - selector=True - ) comments = CommentField() fieldsets = ( - FieldSet('name', 'type', 'group', 'site', 'status', 'description', 'tags', name=_('Cluster')), + FieldSet('name', 'type', 'group', 'status', 'description', 'tags', name=_('Cluster')), + FieldSet('scope_type', 'scope', name=_('Scope')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')), ) class Meta: model = Cluster fields = ( - 'name', 'type', 'group', 'status', 'tenant', 'site', 'description', 'comments', 'tags', + 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'description', 'comments', 'tags', ) diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index 79b5cb216..f51e0e3f5 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -1,4 +1,4 @@ -from typing import Annotated, List +from typing import Annotated, List, Union import strawberry import strawberry_django @@ -31,18 +31,25 @@ class ComponentType(NetBoxObjectType): @strawberry_django.type( models.Cluster, - fields='__all__', + exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'), filters=ClusterFilter ) class ClusterType(VLANGroupsMixin, NetBoxObjectType): type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None group: Annotated["ClusterGroupType", strawberry.lazy('virtualization.graphql.types')] | None tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None - site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] | None - virtual_machines: List[Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')]] devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]] + @strawberry_django.field + def scope(self) -> Annotated[Union[ + Annotated["LocationType", strawberry.lazy('dcim.graphql.types')], + Annotated["RegionType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteType", strawberry.lazy('dcim.graphql.types')], + ], strawberry.union("ClusterScopeType")] | None: + return self.scope + @strawberry_django.type( models.ClusterGroup, diff --git a/netbox/virtualization/migrations/0044_cluster_scope.py b/netbox/virtualization/migrations/0044_cluster_scope.py new file mode 100644 index 000000000..63a888ac3 --- /dev/null +++ b/netbox/virtualization/migrations/0044_cluster_scope.py @@ -0,0 +1,51 @@ +import django.db.models.deletion +from django.db import migrations, models + + +def copy_site_assignments(apps, schema_editor): + """ + Copy site ForeignKey values to the scope GFK. + """ + ContentType = apps.get_model('contenttypes', 'ContentType') + Cluster = apps.get_model('virtualization', 'Cluster') + Site = apps.get_model('dcim', 'Site') + + Cluster.objects.filter(site__isnull=False).update( + scope_type=ContentType.objects.get_for_model(Site), + scope_id=models.F('site_id') + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('virtualization', '0043_qinq_svlan'), + ] + + operations = [ + migrations.AddField( + model_name='cluster', + name='scope_id', + field=models.PositiveBigIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='cluster', + name='scope_type', + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location'))), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + + # Copy over existing site assignments + migrations.RunPython( + code=copy_site_assignments, + reverse_code=migrations.RunPython.noop + ), + + ] diff --git a/netbox/virtualization/migrations/0045_clusters_cached_relations.py b/netbox/virtualization/migrations/0045_clusters_cached_relations.py new file mode 100644 index 000000000..ff851aa7c --- /dev/null +++ b/netbox/virtualization/migrations/0045_clusters_cached_relations.py @@ -0,0 +1,94 @@ +import django.db.models.deletion +from django.db import migrations, models + + +def populate_denormalized_fields(apps, schema_editor): + """ + Copy the denormalized fields for _region, _site_group and _site from existing site field. + """ + Cluster = apps.get_model('virtualization', 'Cluster') + + clusters = Cluster.objects.filter(site__isnull=False).prefetch_related('site') + for cluster in clusters: + cluster._region_id = cluster.site.region_id + cluster._site_group_id = cluster.site.group_id + cluster._site_id = cluster.site_id + # Note: Location cannot be set prior to migration + + Cluster.objects.bulk_update(clusters, ['_region', '_site_group', '_site']) + + +class Migration(migrations.Migration): + + dependencies = [ + ('virtualization', '0044_cluster_scope'), + ] + + operations = [ + migrations.AddField( + model_name='cluster', + name='_location', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.location', + ), + ), + migrations.AddField( + model_name='cluster', + name='_region', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.region', + ), + ), + migrations.AddField( + model_name='cluster', + name='_site', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.site', + ), + ), + migrations.AddField( + model_name='cluster', + name='_site_group', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.sitegroup', + ), + ), + + # Populate denormalized FK values + migrations.RunPython( + code=populate_denormalized_fields, + reverse_code=migrations.RunPython.noop + ), + + migrations.RemoveConstraint( + model_name='cluster', + name='virtualization_cluster_unique_site_name', + ), + # Delete the site ForeignKey + migrations.RemoveField( + model_name='cluster', + name='site', + ), + migrations.AddConstraint( + model_name='cluster', + constraint=models.UniqueConstraint( + fields=('_site', 'name'), name='virtualization_cluster_unique__site_name' + ), + ), + ] diff --git a/netbox/virtualization/models/clusters.py b/netbox/virtualization/models/clusters.py index b8921c603..601ee7f23 100644 --- a/netbox/virtualization/models/clusters.py +++ b/netbox/virtualization/models/clusters.py @@ -1,9 +1,11 @@ +from django.apps import apps from django.contrib.contenttypes.fields import GenericRelation from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import gettext_lazy as _ from dcim.models import Device +from dcim.models.mixins import CachedScopeMixin from netbox.models import OrganizationalModel, PrimaryModel from netbox.models.features import ContactsMixin from virtualization.choices import * @@ -42,7 +44,7 @@ class ClusterGroup(ContactsMixin, OrganizationalModel): verbose_name_plural = _('cluster groups') -class Cluster(ContactsMixin, PrimaryModel): +class Cluster(ContactsMixin, CachedScopeMixin, PrimaryModel): """ A cluster of VirtualMachines. Each Cluster may optionally be associated with one or more Devices. """ @@ -76,13 +78,6 @@ class Cluster(ContactsMixin, PrimaryModel): blank=True, null=True ) - site = models.ForeignKey( - to='dcim.Site', - on_delete=models.PROTECT, - related_name='clusters', - blank=True, - null=True - ) # Generic relations vlan_groups = GenericRelation( @@ -93,7 +88,7 @@ class Cluster(ContactsMixin, PrimaryModel): ) clone_fields = ( - 'type', 'group', 'status', 'tenant', 'site', + 'scope_type', 'scope_id', 'type', 'group', 'status', 'tenant', ) prerequisite_models = ( 'virtualization.ClusterType', @@ -107,8 +102,8 @@ class Cluster(ContactsMixin, PrimaryModel): name='%(app_label)s_%(class)s_unique_group_name' ), models.UniqueConstraint( - fields=('site', 'name'), - name='%(app_label)s_%(class)s_unique_site_name' + fields=('_site', 'name'), + name='%(app_label)s_%(class)s_unique__site_name' ), ) verbose_name = _('cluster') @@ -123,11 +118,28 @@ class Cluster(ContactsMixin, PrimaryModel): def clean(self): super().clean() + site = location = None + if self.scope_type: + scope_type = self.scope_type.model_class() + if scope_type == apps.get_model('dcim', 'site'): + site = self.scope + elif scope_type == apps.get_model('dcim', 'location'): + location = self.scope + site = location.site + # If the Cluster is assigned to a Site, verify that all host Devices belong to that Site. - if not self._state.adding and self.site: - if nonsite_devices := Device.objects.filter(cluster=self).exclude(site=self.site).count(): - raise ValidationError({ - 'site': _( - "{count} devices are assigned as hosts for this cluster but are not in site {site}" - ).format(count=nonsite_devices, site=self.site) - }) + if not self._state.adding: + if site: + if nonsite_devices := Device.objects.filter(cluster=self).exclude(site=site).count(): + raise ValidationError({ + 'scope': _( + "{count} devices are assigned as hosts for this cluster but are not in site {site}" + ).format(count=nonsite_devices, site=site) + }) + if location: + if nonlocation_devices := Device.objects.filter(cluster=self).exclude(location=location).count(): + raise ValidationError({ + 'scope': _( + "{count} devices are assigned as hosts for this cluster but are not in location {location}" + ).format(count=nonlocation_devices, location=location) + }) diff --git a/netbox/virtualization/models/virtualmachines.py b/netbox/virtualization/models/virtualmachines.py index da8419e88..4ee41e403 100644 --- a/netbox/virtualization/models/virtualmachines.py +++ b/netbox/virtualization/models/virtualmachines.py @@ -181,7 +181,7 @@ class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, Co }) # Validate site for cluster & VM - if self.cluster and self.site and self.cluster.site and self.cluster.site != self.site: + if self.cluster and self.site and self.cluster._site and self.cluster._site != self.site: raise ValidationError({ 'cluster': _( 'The selected cluster ({cluster}) is not assigned to this site ({site}).' @@ -238,7 +238,7 @@ class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, Co # Assign site from cluster if not set if self.cluster and not self.site: - self.site = self.cluster.site + self.site = self.cluster._site super().save(*args, **kwargs) diff --git a/netbox/virtualization/tables/clusters.py b/netbox/virtualization/tables/clusters.py index d3c799fb9..91807e35b 100644 --- a/netbox/virtualization/tables/clusters.py +++ b/netbox/virtualization/tables/clusters.py @@ -73,8 +73,11 @@ class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): status = columns.ChoiceFieldColumn( verbose_name=_('Status'), ) - site = tables.Column( - verbose_name=_('Site'), + scope_type = columns.ContentTypeColumn( + verbose_name=_('Scope Type'), + ) + scope = tables.Column( + verbose_name=_('Scope'), linkify=True ) device_count = columns.LinkedCountColumn( @@ -97,7 +100,7 @@ class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): class Meta(NetBoxTable.Meta): model = Cluster fields = ( - 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'site', 'description', 'comments', - 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', 'description', + 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'type', 'group', 'status', 'tenant', 'site', 'device_count', 'vm_count') diff --git a/netbox/virtualization/tests/test_api.py b/netbox/virtualization/tests/test_api.py index 521064fc6..149b64684 100644 --- a/netbox/virtualization/tests/test_api.py +++ b/netbox/virtualization/tests/test_api.py @@ -113,7 +113,8 @@ class ClusterTest(APIViewTestCases.APIViewTestCase): Cluster(name='Cluster 2', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), Cluster(name='Cluster 3', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() cls.create_data = [ { @@ -157,11 +158,12 @@ class VirtualMachineTest(APIViewTestCases.APIViewTestCase): Site.objects.bulk_create(sites) clusters = ( - Cluster(name='Cluster 1', type=clustertype, site=sites[0], group=clustergroup), - Cluster(name='Cluster 2', type=clustertype, site=sites[1], group=clustergroup), + Cluster(name='Cluster 1', type=clustertype, scope=sites[0], group=clustergroup), + Cluster(name='Cluster 2', type=clustertype, scope=sites[1], group=clustergroup), Cluster(name='Cluster 3', type=clustertype), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() device1 = create_test_device('device1', site=sites[0], cluster=clusters[0]) device2 = create_test_device('device2', site=sites[1], cluster=clusters[1]) diff --git a/netbox/virtualization/tests/test_filtersets.py b/netbox/virtualization/tests/test_filtersets.py index 0c7079bba..5a5bf2325 100644 --- a/netbox/virtualization/tests/test_filtersets.py +++ b/netbox/virtualization/tests/test_filtersets.py @@ -138,7 +138,7 @@ class ClusterTestCase(TestCase, ChangeLoggedFilterSetTests): type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED, - site=sites[0], + scope=sites[0], tenant=tenants[0], description='foobar1' ), @@ -147,7 +147,7 @@ class ClusterTestCase(TestCase, ChangeLoggedFilterSetTests): type=cluster_types[1], group=cluster_groups[1], status=ClusterStatusChoices.STATUS_STAGING, - site=sites[1], + scope=sites[1], tenant=tenants[1], description='foobar2' ), @@ -156,12 +156,13 @@ class ClusterTestCase(TestCase, ChangeLoggedFilterSetTests): type=cluster_types[2], group=cluster_groups[2], status=ClusterStatusChoices.STATUS_ACTIVE, - site=sites[2], + scope=sites[2], tenant=tenants[2], description='foobar3' ), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() def test_q(self): params = {'q': 'foobar1'} @@ -274,11 +275,12 @@ class VirtualMachineTestCase(TestCase, ChangeLoggedFilterSetTests): Site.objects.bulk_create(sites) clusters = ( - Cluster(name='Cluster 1', type=cluster_types[0], group=cluster_groups[0], site=sites[0]), - Cluster(name='Cluster 2', type=cluster_types[1], group=cluster_groups[1], site=sites[1]), - Cluster(name='Cluster 3', type=cluster_types[2], group=cluster_groups[2], site=sites[2]), + Cluster(name='Cluster 1', type=cluster_types[0], group=cluster_groups[0], scope=sites[0]), + Cluster(name='Cluster 2', type=cluster_types[1], group=cluster_groups[1], scope=sites[1]), + Cluster(name='Cluster 3', type=cluster_types[2], group=cluster_groups[2], scope=sites[2]), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() platforms = ( Platform(name='Platform 1', slug='platform-1'), diff --git a/netbox/virtualization/tests/test_models.py b/netbox/virtualization/tests/test_models.py index a4e8d7947..7be423bf1 100644 --- a/netbox/virtualization/tests/test_models.py +++ b/netbox/virtualization/tests/test_models.py @@ -54,11 +54,12 @@ class VirtualMachineTestCase(TestCase): Site.objects.bulk_create(sites) clusters = ( - Cluster(name='Cluster 1', type=cluster_type, site=sites[0]), - Cluster(name='Cluster 2', type=cluster_type, site=sites[1]), - Cluster(name='Cluster 3', type=cluster_type, site=None), + Cluster(name='Cluster 1', type=cluster_type, scope=sites[0]), + Cluster(name='Cluster 2', type=cluster_type, scope=sites[1]), + Cluster(name='Cluster 3', type=cluster_type, scope=None), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() # VM with site only should pass VirtualMachine(name='vm1', site=sites[0]).full_clean() diff --git a/netbox/virtualization/tests/test_views.py b/netbox/virtualization/tests/test_views.py index 3c6a058c9..b9cb7b437 100644 --- a/netbox/virtualization/tests/test_views.py +++ b/netbox/virtualization/tests/test_views.py @@ -1,3 +1,4 @@ +from django.contrib.contenttypes.models import ContentType from django.test import override_settings from django.urls import reverse from netaddr import EUI @@ -117,11 +118,12 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase): ClusterType.objects.bulk_create(clustertypes) clusters = ( - Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]), - Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]), - Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, site=sites[0]), + Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), + Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), + Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() tags = create_tags('Alpha', 'Bravo', 'Charlie') @@ -131,7 +133,8 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase): 'type': clustertypes[1].pk, 'status': ClusterStatusChoices.STATUS_OFFLINE, 'tenant': None, - 'site': sites[1].pk, + 'scope_type': ContentType.objects.get_for_model(Site).pk, + 'scope': sites[1].pk, 'comments': 'Some comments', 'tags': [t.pk for t in tags], } @@ -155,7 +158,6 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase): 'type': clustertypes[1].pk, 'status': ClusterStatusChoices.STATUS_OFFLINE, 'tenant': None, - 'site': sites[1].pk, 'comments': 'New comments', } @@ -201,10 +203,11 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase): clustertype = ClusterType.objects.create(name='Cluster Type 1', slug='cluster-type-1') clusters = ( - Cluster(name='Cluster 1', type=clustertype, site=sites[0]), - Cluster(name='Cluster 2', type=clustertype, site=sites[1]), + Cluster(name='Cluster 1', type=clustertype, scope=sites[0]), + Cluster(name='Cluster 2', type=clustertype, scope=sites[1]), ) - Cluster.objects.bulk_create(clusters) + for cluster in clusters: + cluster.save() devices = ( create_test_device('device1', site=sites[0], cluster=clusters[0]), @@ -292,7 +295,7 @@ class VMInterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase): site = Site.objects.create(name='Site 1', slug='site-1') role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') clustertype = ClusterType.objects.create(name='Cluster Type 1', slug='cluster-type-1') - cluster = Cluster.objects.create(name='Cluster 1', type=clustertype, site=site) + cluster = Cluster.objects.create(name='Cluster 1', type=clustertype, scope=site) virtualmachines = ( VirtualMachine(name='Virtual Machine 1', site=site, cluster=cluster, role=role), VirtualMachine(name='Virtual Machine 2', site=site, cluster=cluster, role=role), From 4bba92617d88f1eb63e9fc8894d54a928a34d9f2 Mon Sep 17 00:00:00 2001 From: Alexander Haase Date: Fri, 1 Nov 2024 19:56:08 +0100 Subject: [PATCH 23/65] Closes #16971: Add system jobs (#17716) * Fix check for existing jobs If a job is to be enqueued once and no specific scheduled time is specified, any scheduled time of existing jobs will be valid. Only if a specific scheduled time is specified for 'enqueue_once()' can it be evaluated. * Allow system jobs to be registered A new registry key allows background system jobs to be registered and automatically scheduled when rqworker starts. * Test scheduling of system jobs * Fix plugins scheduled job documentation The documentation reflected a non-production state of the JobRunner framework left over from development. Now a more practical example demonstrates the usage. * Allow plugins to register system jobs * Rename system job metadata To clarify which meta-attributes belong to system jobs, each of them is now prefixed with 'system_'. * Add predefined job interval choices * Remove 'system_enabled' JobRunner attribute Previously, the 'system_enabled' attribute was used to control whether a job should run or not. However, this can also be accomplished by evaluating the job's interval. * Fix test * Use a decorator to register system jobs * Specify interval when registering system job * Update documentation --------- Co-authored-by: Jeremy Stretch --- docs/plugins/development/background-jobs.md | 53 +++++++++++++++----- docs/plugins/development/data-backends.md | 2 +- netbox/core/choices.py | 14 ++++++ netbox/core/management/commands/rqworker.py | 11 ++++ netbox/netbox/jobs.py | 21 +++++++- netbox/netbox/registry.py | 1 + netbox/netbox/tests/dummy_plugin/__init__.py | 5 ++ netbox/netbox/tests/dummy_plugin/jobs.py | 9 ++++ netbox/netbox/tests/test_jobs.py | 36 +++++++++++++ netbox/netbox/tests/test_plugins.py | 9 ++++ 10 files changed, 147 insertions(+), 14 deletions(-) create mode 100644 netbox/netbox/tests/dummy_plugin/jobs.py diff --git a/docs/plugins/development/background-jobs.md b/docs/plugins/development/background-jobs.md index 873390a58..d51981b9e 100644 --- a/docs/plugins/development/background-jobs.md +++ b/docs/plugins/development/background-jobs.md @@ -29,6 +29,9 @@ class MyTestJob(JobRunner): You can schedule the background job from within your code (e.g. from a model's `save()` method or a view) by calling `MyTestJob.enqueue()`. This method passes through all arguments to `Job.enqueue()`. However, no `name` argument must be passed, as the background job name will be used instead. +!!! tip + A set of predefined intervals is available at `core.choices.JobIntervalChoices` for convenience. + ### Attributes `JobRunner` attributes are defined under a class named `Meta` within the job. These are optional, but encouraged. @@ -46,26 +49,52 @@ As described above, jobs can be scheduled for immediate execution or at any late #### Example +```python title="models.py" +from django.db import models +from core.choices import JobIntervalChoices +from netbox.models import NetBoxModel +from .jobs import MyTestJob + +class MyModel(NetBoxModel): + foo = models.CharField() + + def save(self, *args, **kwargs): + MyTestJob.enqueue_once(instance=self, interval=JobIntervalChoices.INTERVAL_HOURLY) + return super().save(*args, **kwargs) + + def sync(self): + MyTestJob.enqueue(instance=self) +``` + + +### System Jobs + +Some plugins may implement background jobs that are decoupled from the request/response cycle. Typical use cases would be housekeeping tasks or synchronization jobs. These can be registered as _system jobs_ using the `system_job()` decorator. The job interval must be passed as an integer (in minutes) when registering a system job. System jobs are scheduled automatically when the RQ worker (`manage.py rqworker`) is run. + +#### Example + ```python title="jobs.py" -from netbox.jobs import JobRunner - +from core.choices import JobIntervalChoices +from netbox.jobs import JobRunner, system_job +from .models import MyModel +# Specify a predefined choice or an integer indicating +# the number of minutes between job executions +@system_job(interval=JobIntervalChoices.INTERVAL_HOURLY) class MyHousekeepingJob(JobRunner): class Meta: - name = "Housekeeping" + name = "My Housekeeping Job" def run(self, *args, **kwargs): - # your logic goes here + MyModel.objects.filter(foo='bar').delete() + +system_jobs = ( + MyHousekeepingJob, +) ``` -```python title="__init__.py" -from netbox.plugins import PluginConfig - -class MyPluginConfig(PluginConfig): - def ready(self): - from .jobs import MyHousekeepingJob - MyHousekeepingJob.setup(interval=60) -``` +!!! note + Ensure that any system jobs are imported on initialization. Otherwise, they won't be registered. This can be achieved by extending the PluginConfig's `ready()` method. ## Task queues diff --git a/docs/plugins/development/data-backends.md b/docs/plugins/development/data-backends.md index 8b7226a41..0c6d44d95 100644 --- a/docs/plugins/development/data-backends.md +++ b/docs/plugins/development/data-backends.md @@ -18,6 +18,6 @@ backends = [MyDataBackend] ``` !!! tip - The path to the list of search indexes can be modified by setting `data_backends` in the PluginConfig instance. + The path to the list of data backends can be modified by setting `data_backends` in the PluginConfig instance. ::: netbox.data_backends.DataBackend diff --git a/netbox/core/choices.py b/netbox/core/choices.py index 01a072ce1..442acc26b 100644 --- a/netbox/core/choices.py +++ b/netbox/core/choices.py @@ -72,6 +72,20 @@ class JobStatusChoices(ChoiceSet): ) +class JobIntervalChoices(ChoiceSet): + INTERVAL_MINUTELY = 1 + INTERVAL_HOURLY = 60 + INTERVAL_DAILY = 60 * 24 + INTERVAL_WEEKLY = 60 * 24 * 7 + + CHOICES = ( + (INTERVAL_MINUTELY, _('Minutely')), + (INTERVAL_HOURLY, _('Hourly')), + (INTERVAL_DAILY, _('Daily')), + (INTERVAL_WEEKLY, _('Weekly')), + ) + + # # ObjectChanges # diff --git a/netbox/core/management/commands/rqworker.py b/netbox/core/management/commands/rqworker.py index e1fb6fd11..b2879c3d8 100644 --- a/netbox/core/management/commands/rqworker.py +++ b/netbox/core/management/commands/rqworker.py @@ -2,6 +2,8 @@ import logging from django_rq.management.commands.rqworker import Command as _Command +from netbox.registry import registry + DEFAULT_QUEUES = ('high', 'default', 'low') @@ -14,6 +16,15 @@ class Command(_Command): of only the 'default' queue). """ def handle(self, *args, **options): + # Setup system jobs. + for job, kwargs in registry['system_jobs'].items(): + try: + interval = kwargs['interval'] + except KeyError: + raise TypeError("System job must specify an interval (in minutes).") + logger.debug(f"Scheduling system job {job.name} (interval={interval})") + job.enqueue_once(**kwargs) + # Run the worker with scheduler functionality options['with_scheduler'] = True diff --git a/netbox/netbox/jobs.py b/netbox/netbox/jobs.py index ae8f2f109..965ebc9e9 100644 --- a/netbox/netbox/jobs.py +++ b/netbox/netbox/jobs.py @@ -2,6 +2,7 @@ import logging from abc import ABC, abstractmethod from datetime import timedelta +from django.core.exceptions import ImproperlyConfigured from django.utils.functional import classproperty from django_pglocks import advisory_lock from rq.timeouts import JobTimeoutException @@ -9,12 +10,30 @@ from rq.timeouts import JobTimeoutException from core.choices import JobStatusChoices from core.models import Job, ObjectType from netbox.constants import ADVISORY_LOCK_KEYS +from netbox.registry import registry __all__ = ( 'JobRunner', + 'system_job', ) +def system_job(interval): + """ + Decorator for registering a `JobRunner` class as system background job. + """ + if type(interval) is not int: + raise ImproperlyConfigured("System job interval must be an integer (minutes).") + + def _wrapper(cls): + registry['system_jobs'][cls] = { + 'interval': interval + } + return cls + + return _wrapper + + class JobRunner(ABC): """ Background Job helper class. @@ -129,7 +148,7 @@ class JobRunner(ABC): if job: # If the job parameters haven't changed, don't schedule a new job and keep the current schedule. Otherwise, # delete the existing job and schedule a new job instead. - if (schedule_at and job.scheduled == schedule_at) and (job.interval == interval): + if (not schedule_at or job.scheduled == schedule_at) and (job.interval == interval): return job job.delete() diff --git a/netbox/netbox/registry.py b/netbox/netbox/registry.py index 0920cbccf..48d7921f2 100644 --- a/netbox/netbox/registry.py +++ b/netbox/netbox/registry.py @@ -30,6 +30,7 @@ registry = Registry({ 'models': collections.defaultdict(set), 'plugins': dict(), 'search': dict(), + 'system_jobs': dict(), 'tables': collections.defaultdict(dict), 'views': collections.defaultdict(dict), 'widgets': dict(), diff --git a/netbox/netbox/tests/dummy_plugin/__init__.py b/netbox/netbox/tests/dummy_plugin/__init__.py index 6ab62d638..2ca7c290c 100644 --- a/netbox/netbox/tests/dummy_plugin/__init__.py +++ b/netbox/netbox/tests/dummy_plugin/__init__.py @@ -21,5 +21,10 @@ class DummyPluginConfig(PluginConfig): 'netbox.tests.dummy_plugin.events.process_events_queue' ] + def ready(self): + super().ready() + + from . import jobs # noqa: F401 + config = DummyPluginConfig diff --git a/netbox/netbox/tests/dummy_plugin/jobs.py b/netbox/netbox/tests/dummy_plugin/jobs.py new file mode 100644 index 000000000..3b9dc7a5f --- /dev/null +++ b/netbox/netbox/tests/dummy_plugin/jobs.py @@ -0,0 +1,9 @@ +from core.choices import JobIntervalChoices +from netbox.jobs import JobRunner, system_job + + +@system_job(interval=JobIntervalChoices.INTERVAL_HOURLY) +class DummySystemJob(JobRunner): + + def run(self, *args, **kwargs): + pass diff --git a/netbox/netbox/tests/test_jobs.py b/netbox/netbox/tests/test_jobs.py index 52a7bd97a..e3e24a235 100644 --- a/netbox/netbox/tests/test_jobs.py +++ b/netbox/netbox/tests/test_jobs.py @@ -90,6 +90,15 @@ class EnqueueTest(JobRunnerTestCase): self.assertEqual(job1, job2) self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1) + def test_enqueue_once_twice_same_no_schedule_at(self): + instance = DataSource() + schedule_at = self.get_schedule_at() + job1 = TestJobRunner.enqueue_once(instance, schedule_at=schedule_at) + job2 = TestJobRunner.enqueue_once(instance) + + self.assertEqual(job1, job2) + self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1) + def test_enqueue_once_twice_different_schedule_at(self): instance = DataSource() job1 = TestJobRunner.enqueue_once(instance, schedule_at=self.get_schedule_at()) @@ -127,3 +136,30 @@ class EnqueueTest(JobRunnerTestCase): self.assertNotEqual(job1, job2) self.assertRaises(Job.DoesNotExist, job1.refresh_from_db) self.assertEqual(TestJobRunner.get_jobs(instance).count(), 1) + + +class SystemJobTest(JobRunnerTestCase): + """ + Test that system jobs can be scheduled. + + General functionality already tested by `JobRunnerTest` and `EnqueueTest`. + """ + + def test_scheduling(self): + # Can job be enqueued? + job = TestJobRunner.enqueue(schedule_at=self.get_schedule_at()) + self.assertIsInstance(job, Job) + self.assertEqual(TestJobRunner.get_jobs().count(), 1) + + # Can job be deleted again? + job.delete() + self.assertRaises(Job.DoesNotExist, job.refresh_from_db) + self.assertEqual(TestJobRunner.get_jobs().count(), 0) + + def test_enqueue_once(self): + schedule_at = self.get_schedule_at() + job1 = TestJobRunner.enqueue_once(schedule_at=schedule_at) + job2 = TestJobRunner.enqueue_once(schedule_at=schedule_at) + + self.assertEqual(job1, job2) + self.assertEqual(TestJobRunner.get_jobs().count(), 1) diff --git a/netbox/netbox/tests/test_plugins.py b/netbox/netbox/tests/test_plugins.py index 16778667d..db82d0a75 100644 --- a/netbox/netbox/tests/test_plugins.py +++ b/netbox/netbox/tests/test_plugins.py @@ -5,8 +5,10 @@ from django.core.exceptions import ImproperlyConfigured from django.test import Client, TestCase, override_settings from django.urls import reverse +from core.choices import JobIntervalChoices from netbox.tests.dummy_plugin import config as dummy_config from netbox.tests.dummy_plugin.data_backends import DummyBackend +from netbox.tests.dummy_plugin.jobs import DummySystemJob from netbox.plugins.navigation import PluginMenu from netbox.plugins.utils import get_plugin_config from netbox.graphql.schema import Query @@ -130,6 +132,13 @@ class PluginTest(TestCase): self.assertIn('dummy', registry['data_backends']) self.assertIs(registry['data_backends']['dummy'], DummyBackend) + def test_system_jobs(self): + """ + Check registered system jobs. + """ + self.assertIn(DummySystemJob, registry['system_jobs']) + self.assertEqual(registry['system_jobs'][DummySystemJob]['interval'], JobIntervalChoices.INTERVAL_HOURLY) + def test_queues(self): """ Check that plugin queues are registered with the accurate name. From 812ce8471a17656a82f6599e018e5b5319febfaf Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Thu, 7 Nov 2024 07:28:02 -0800 Subject: [PATCH 24/65] 10711 Add Scope to WirelessLAN (#17877) * 7699 Add Scope to Cluster * 7699 Serializer * 7699 filterset * 7699 bulk_edit * 7699 bulk_import * 7699 model_form * 7699 graphql, tables * 7699 fixes * 7699 fixes * 7699 fixes * 7699 fixes * 7699 fix tests * 7699 fix graphql tests for clusters reference * 7699 fix dcim tests * 7699 fix ipam tests * 7699 fix tests * 7699 use mixin for model * 7699 change mixin name * 7699 scope form * 7699 scope form * 7699 scoped form, fitlerset * 7699 review changes * 7699 move ScopedFilterset * 7699 move CachedScopeMixin * 7699 review changes * 10711 Add Scope to WirelessLAN * 10711 Add Scope to WirelessLAN * 10711 Add Scope to WirelessLAN * 10711 Add Scope to WirelessLAN * 10711 Add Scope to WirelessLAN * 7699 review changes * 7699 refactor mixins * 7699 _sitegroup -> _site_group * 7699 update docstring * fix model * remove old constants, update filtersets * 10711 fix GraphQL * 10711 fix API * 10711 add tests * 10711 review changes * 10711 add tests * 10711 add scope to detail template * 10711 add api test * Extend CSV test data --------- Co-authored-by: Jeremy Stretch --- docs/models/wireless/wirelesslan.md | 4 + netbox/templates/wireless/wirelesslan.html | 8 ++ .../wireless/api/serializers_/wirelesslans.py | 28 ++++++- netbox/wireless/filtersets.py | 5 +- netbox/wireless/forms/bulk_edit.py | 6 +- netbox/wireless/forms/bulk_import.py | 12 ++- netbox/wireless/forms/filtersets.py | 27 +++++++ netbox/wireless/forms/model_forms.py | 6 +- netbox/wireless/graphql/types.py | 13 +++- ...__location_wirelesslan__region_and_more.py | 77 ++++++++++++++++++ netbox/wireless/models.py | 5 +- netbox/wireless/tables/wirelesslan.py | 9 ++- netbox/wireless/tests/test_api.py | 10 ++- netbox/wireless/tests/test_filtersets.py | 78 +++++++++++++++++-- netbox/wireless/tests/test_views.py | 19 +++-- 15 files changed, 277 insertions(+), 30 deletions(-) create mode 100644 netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py diff --git a/docs/models/wireless/wirelesslan.md b/docs/models/wireless/wirelesslan.md index 0f50fa75f..a448c42a2 100644 --- a/docs/models/wireless/wirelesslan.md +++ b/docs/models/wireless/wirelesslan.md @@ -43,3 +43,7 @@ The security cipher used to apply wireless authentication. Options include: ### Pre-Shared Key The security key configured on each client to grant access to the secured wireless LAN. This applies only to certain authentication types. + +### Scope + +The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) with which this wireless LAN is associated. diff --git a/netbox/templates/wireless/wirelesslan.html b/netbox/templates/wireless/wirelesslan.html index 493c36132..54473ea54 100644 --- a/netbox/templates/wireless/wirelesslan.html +++ b/netbox/templates/wireless/wirelesslan.html @@ -22,6 +22,14 @@ {% trans "Status" %} {% badge object.get_status_display bg_color=object.get_status_color %} + + {% trans "Scope" %} + {% if object.scope %} + {{ object.scope|linkify }} ({% trans object.scope_type.name %}) + {% else %} + {{ ''|placeholder }} + {% endif %} + {% trans "Description" %} {{ object.description|placeholder }} diff --git a/netbox/wireless/api/serializers_/wirelesslans.py b/netbox/wireless/api/serializers_/wirelesslans.py index 6c5deeb26..637089277 100644 --- a/netbox/wireless/api/serializers_/wirelesslans.py +++ b/netbox/wireless/api/serializers_/wirelesslans.py @@ -1,9 +1,13 @@ from rest_framework import serializers +from dcim.constants import LOCATION_SCOPE_TYPES +from django.contrib.contenttypes.models import ContentType +from drf_spectacular.utils import extend_schema_field from ipam.api.serializers_.vlans import VLANSerializer -from netbox.api.fields import ChoiceField +from netbox.api.fields import ChoiceField, ContentTypeField from netbox.api.serializers import NestedGroupModelSerializer, NetBoxModelSerializer from tenancy.api.serializers_.tenants import TenantSerializer +from utilities.api import get_serializer_for_model from wireless.choices import * from wireless.models import WirelessLAN, WirelessLANGroup from .nested import NestedWirelessLANGroupSerializer @@ -34,12 +38,30 @@ class WirelessLANSerializer(NetBoxModelSerializer): tenant = TenantSerializer(nested=True, required=False, allow_null=True) auth_type = ChoiceField(choices=WirelessAuthTypeChoices, required=False, allow_blank=True) auth_cipher = ChoiceField(choices=WirelessAuthCipherChoices, required=False, allow_blank=True) + scope_type = ContentTypeField( + queryset=ContentType.objects.filter( + model__in=LOCATION_SCOPE_TYPES + ), + allow_null=True, + required=False, + default=None + ) + scope_id = serializers.IntegerField(allow_null=True, required=False, default=None) + scope = serializers.SerializerMethodField(read_only=True) class Meta: model = WirelessLAN fields = [ - 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'tenant', - 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', + 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', 'scope_id', 'scope', + 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'ssid', 'description') + + @extend_schema_field(serializers.JSONField(allow_null=True)) + def get_scope(self, obj): + if obj.scope_id is None: + return None + serializer = get_serializer_for_model(obj.scope) + context = {'request': self.context['request']} + return serializer(obj.scope, nested=True, context=context).data diff --git a/netbox/wireless/filtersets.py b/netbox/wireless/filtersets.py index 537b2ec5c..5a4195e6c 100644 --- a/netbox/wireless/filtersets.py +++ b/netbox/wireless/filtersets.py @@ -2,6 +2,7 @@ import django_filters from django.db.models import Q from dcim.choices import LinkStatusChoices +from dcim.filtersets import ScopedFilterSet from dcim.models import Interface from ipam.models import VLAN from netbox.filtersets import OrganizationalModelFilterSet, NetBoxModelFilterSet @@ -43,7 +44,7 @@ class WirelessLANGroupFilterSet(OrganizationalModelFilterSet): fields = ('id', 'name', 'slug', 'description') -class WirelessLANFilterSet(NetBoxModelFilterSet, TenancyFilterSet): +class WirelessLANFilterSet(NetBoxModelFilterSet, ScopedFilterSet, TenancyFilterSet): group_id = TreeNodeMultipleChoiceFilter( queryset=WirelessLANGroup.objects.all(), field_name='group', @@ -74,7 +75,7 @@ class WirelessLANFilterSet(NetBoxModelFilterSet, TenancyFilterSet): class Meta: model = WirelessLAN - fields = ('id', 'ssid', 'auth_psk', 'description') + fields = ('id', 'ssid', 'auth_psk', 'scope_id', 'description') def search(self, queryset, name, value): if not value.strip(): diff --git a/netbox/wireless/forms/bulk_edit.py b/netbox/wireless/forms/bulk_edit.py index c8b378104..5cd3a157a 100644 --- a/netbox/wireless/forms/bulk_edit.py +++ b/netbox/wireless/forms/bulk_edit.py @@ -2,6 +2,7 @@ from django import forms from django.utils.translation import gettext_lazy as _ from dcim.choices import LinkStatusChoices +from dcim.forms.mixins import ScopedBulkEditForm from ipam.models import VLAN from netbox.choices import * from netbox.forms import NetBoxModelBulkEditForm @@ -39,7 +40,7 @@ class WirelessLANGroupBulkEditForm(NetBoxModelBulkEditForm): nullable_fields = ('parent', 'description') -class WirelessLANBulkEditForm(NetBoxModelBulkEditForm): +class WirelessLANBulkEditForm(ScopedBulkEditForm, NetBoxModelBulkEditForm): status = forms.ChoiceField( label=_('Status'), choices=add_blank_choice(WirelessLANStatusChoices), @@ -89,10 +90,11 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm): model = WirelessLAN fieldsets = ( FieldSet('group', 'ssid', 'status', 'vlan', 'tenant', 'description'), + FieldSet('scope_type', 'scope', name=_('Scope')), FieldSet('auth_type', 'auth_cipher', 'auth_psk', name=_('Authentication')), ) nullable_fields = ( - 'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'comments', + 'ssid', 'group', 'vlan', 'tenant', 'description', 'auth_type', 'auth_cipher', 'auth_psk', 'scope', 'comments', ) diff --git a/netbox/wireless/forms/bulk_import.py b/netbox/wireless/forms/bulk_import.py index cff3e49af..5bf2d7dcd 100644 --- a/netbox/wireless/forms/bulk_import.py +++ b/netbox/wireless/forms/bulk_import.py @@ -1,12 +1,13 @@ from django.utils.translation import gettext_lazy as _ from dcim.choices import LinkStatusChoices +from dcim.forms.mixins import ScopedImportForm from dcim.models import Interface from ipam.models import VLAN from netbox.choices import * from netbox.forms import NetBoxModelImportForm from tenancy.models import Tenant -from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField +from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField from wireless.choices import * from wireless.models import * @@ -32,7 +33,7 @@ class WirelessLANGroupImportForm(NetBoxModelImportForm): fields = ('name', 'slug', 'parent', 'description', 'tags') -class WirelessLANImportForm(NetBoxModelImportForm): +class WirelessLANImportForm(ScopedImportForm, NetBoxModelImportForm): group = CSVModelChoiceField( label=_('Group'), queryset=WirelessLANGroup.objects.all(), @@ -75,9 +76,12 @@ class WirelessLANImportForm(NetBoxModelImportForm): class Meta: model = WirelessLAN fields = ( - 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', - 'comments', 'tags', + 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', 'scope_id', + 'description', 'comments', 'tags', ) + labels = { + 'scope_id': _('Scope ID'), + } class WirelessLinkImportForm(NetBoxModelImportForm): diff --git a/netbox/wireless/forms/filtersets.py b/netbox/wireless/forms/filtersets.py index 6439a2516..f62a3be06 100644 --- a/netbox/wireless/forms/filtersets.py +++ b/netbox/wireless/forms/filtersets.py @@ -2,6 +2,7 @@ from django import forms from django.utils.translation import gettext_lazy as _ from dcim.choices import LinkStatusChoices +from dcim.models import Location, Region, Site, SiteGroup from netbox.choices import * from netbox.forms import NetBoxModelFilterSetForm from tenancy.forms import TenancyFilterForm @@ -33,6 +34,7 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): fieldsets = ( FieldSet('q', 'filter_id', 'tag'), FieldSet('ssid', 'group_id', 'status', name=_('Attributes')), + FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Scope')), FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), FieldSet('auth_type', 'auth_cipher', 'auth_psk', name=_('Authentication')), ) @@ -65,6 +67,31 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): label=_('Pre-shared key'), required=False ) + region_id = DynamicModelMultipleChoiceField( + queryset=Region.objects.all(), + required=False, + label=_('Region') + ) + site_group_id = DynamicModelMultipleChoiceField( + queryset=SiteGroup.objects.all(), + required=False, + label=_('Site group') + ) + site_id = DynamicModelMultipleChoiceField( + queryset=Site.objects.all(), + required=False, + null_option='None', + query_params={ + 'region_id': '$region_id', + 'site_group_id': '$site_group_id', + }, + label=_('Site') + ) + location_id = DynamicModelMultipleChoiceField( + queryset=Location.objects.all(), + required=False, + label=_('Location') + ) tag = TagFilterField(model) diff --git a/netbox/wireless/forms/model_forms.py b/netbox/wireless/forms/model_forms.py index 7c2594271..877324b8c 100644 --- a/netbox/wireless/forms/model_forms.py +++ b/netbox/wireless/forms/model_forms.py @@ -2,6 +2,7 @@ from django.forms import PasswordInput from django.utils.translation import gettext_lazy as _ from dcim.models import Device, Interface, Location, Site +from dcim.forms.mixins import ScopedForm from ipam.models import VLAN from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm @@ -35,7 +36,7 @@ class WirelessLANGroupForm(NetBoxModelForm): ] -class WirelessLANForm(TenancyForm, NetBoxModelForm): +class WirelessLANForm(ScopedForm, TenancyForm, NetBoxModelForm): group = DynamicModelChoiceField( label=_('Group'), queryset=WirelessLANGroup.objects.all(), @@ -51,6 +52,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm): fieldsets = ( FieldSet('ssid', 'group', 'vlan', 'status', 'description', 'tags', name=_('Wireless LAN')), + FieldSet('scope_type', 'scope', name=_('Scope')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')), FieldSet('auth_type', 'auth_cipher', 'auth_psk', name=_('Authentication')), ) @@ -59,7 +61,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm): model = WirelessLAN fields = [ 'ssid', 'group', 'status', 'vlan', 'tenant_group', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', - 'description', 'comments', 'tags', + 'scope_type', 'description', 'comments', 'tags', ] widgets = { 'auth_psk': PasswordInput( diff --git a/netbox/wireless/graphql/types.py b/netbox/wireless/graphql/types.py index b24525fbe..aa44e9b9f 100644 --- a/netbox/wireless/graphql/types.py +++ b/netbox/wireless/graphql/types.py @@ -1,4 +1,4 @@ -from typing import Annotated, List +from typing import Annotated, List, Union import strawberry import strawberry_django @@ -28,7 +28,7 @@ class WirelessLANGroupType(OrganizationalObjectType): @strawberry_django.type( models.WirelessLAN, - fields='__all__', + exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'), filters=WirelessLANFilter ) class WirelessLANType(NetBoxObjectType): @@ -38,6 +38,15 @@ class WirelessLANType(NetBoxObjectType): interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]] + @strawberry_django.field + def scope(self) -> Annotated[Union[ + Annotated["LocationType", strawberry.lazy('dcim.graphql.types')], + Annotated["RegionType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')], + Annotated["SiteType", strawberry.lazy('dcim.graphql.types')], + ], strawberry.union("WirelessLANScopeType")] | None: + return self.scope + @strawberry_django.type( models.WirelessLink, diff --git a/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py b/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py new file mode 100644 index 000000000..ea4470641 --- /dev/null +++ b/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py @@ -0,0 +1,77 @@ +# Generated by Django 5.0.9 on 2024-11-04 16:00 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('dcim', '0196_qinq_svlan'), + ('wireless', '0010_charfield_null_choices'), + ] + + operations = [ + migrations.AddField( + model_name='wirelesslan', + name='_location', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.location', + ), + ), + migrations.AddField( + model_name='wirelesslan', + name='_region', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.region', + ), + ), + migrations.AddField( + model_name='wirelesslan', + name='_site', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.site', + ), + ), + migrations.AddField( + model_name='wirelesslan', + name='_site_group', + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='_%(class)ss', + to='dcim.sitegroup', + ), + ), + migrations.AddField( + model_name='wirelesslan', + name='scope_id', + field=models.PositiveBigIntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='wirelesslan', + name='scope_type', + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location'))), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ] diff --git a/netbox/wireless/models.py b/netbox/wireless/models.py index 88c60d494..d78c893a6 100644 --- a/netbox/wireless/models.py +++ b/netbox/wireless/models.py @@ -4,6 +4,7 @@ from django.utils.translation import gettext_lazy as _ from dcim.choices import LinkStatusChoices from dcim.constants import WIRELESS_IFACE_TYPES +from dcim.models.mixins import CachedScopeMixin from netbox.models import NestedGroupModel, PrimaryModel from netbox.models.mixins import DistanceMixin from .choices import * @@ -71,7 +72,7 @@ class WirelessLANGroup(NestedGroupModel): verbose_name_plural = _('wireless LAN groups') -class WirelessLAN(WirelessAuthenticationBase, PrimaryModel): +class WirelessLAN(WirelessAuthenticationBase, CachedScopeMixin, PrimaryModel): """ A wireless network formed among an arbitrary number of access point and clients. """ @@ -107,7 +108,7 @@ class WirelessLAN(WirelessAuthenticationBase, PrimaryModel): null=True ) - clone_fields = ('ssid', 'group', 'tenant', 'description') + clone_fields = ('ssid', 'group', 'scope_type', 'scope_id', 'tenant', 'description') class Meta: ordering = ('ssid', 'pk') diff --git a/netbox/wireless/tables/wirelesslan.py b/netbox/wireless/tables/wirelesslan.py index 87ad4ac51..40f52f8a5 100644 --- a/netbox/wireless/tables/wirelesslan.py +++ b/netbox/wireless/tables/wirelesslan.py @@ -51,6 +51,13 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable): status = columns.ChoiceFieldColumn( verbose_name=_('Status'), ) + scope_type = columns.ContentTypeColumn( + verbose_name=_('Scope Type'), + ) + scope = tables.Column( + verbose_name=_('Scope'), + linkify=True + ) interface_count = tables.Column( verbose_name=_('Interfaces') ) @@ -65,7 +72,7 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable): model = WirelessLAN fields = ( 'pk', 'ssid', 'group', 'status', 'tenant', 'tenant_group', 'vlan', 'interface_count', 'auth_type', - 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'created', 'last_updated', + 'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'ssid', 'group', 'status', 'description', 'vlan', 'auth_type', 'interface_count') diff --git a/netbox/wireless/tests/test_api.py b/netbox/wireless/tests/test_api.py index 4b7545888..f768eafaf 100644 --- a/netbox/wireless/tests/test_api.py +++ b/netbox/wireless/tests/test_api.py @@ -1,7 +1,7 @@ from django.urls import reverse from dcim.choices import InterfaceTypeChoices -from dcim.models import Interface +from dcim.models import Interface, Site from tenancy.models import Tenant from utilities.testing import APITestCase, APIViewTestCases, create_test_device from wireless.choices import * @@ -53,6 +53,12 @@ class WirelessLANTest(APIViewTestCases.APIViewTestCase): @classmethod def setUpTestData(cls): + sites = ( + Site(name='Site 1', slug='site-1'), + Site(name='Site 2', slug='site-2'), + ) + Site.objects.bulk_create(sites) + tenants = ( Tenant(name='Tenant 1', slug='tenant-1'), Tenant(name='Tenant 2', slug='tenant-2'), @@ -94,6 +100,8 @@ class WirelessLANTest(APIViewTestCases.APIViewTestCase): 'status': WirelessLANStatusChoices.STATUS_DISABLED, 'tenant': tenants[0].pk, 'auth_type': WirelessAuthTypeChoices.TYPE_WPA_ENTERPRISE, + 'scope_type': 'dcim.site', + 'scope_id': sites[1].pk, }, ] diff --git a/netbox/wireless/tests/test_filtersets.py b/netbox/wireless/tests/test_filtersets.py index 5c932928c..76ef4e220 100644 --- a/netbox/wireless/tests/test_filtersets.py +++ b/netbox/wireless/tests/test_filtersets.py @@ -1,7 +1,7 @@ from django.test import TestCase from dcim.choices import InterfaceTypeChoices, LinkStatusChoices -from dcim.models import Interface +from dcim.models import Interface, Location, Region, Site, SiteGroup from ipam.models import VLAN from netbox.choices import DistanceUnitChoices from tenancy.models import Tenant @@ -110,6 +110,36 @@ class WirelessLANTestCase(TestCase, ChangeLoggedFilterSetTests): ) VLAN.objects.bulk_create(vlans) + regions = ( + Region(name='Test Region 1', slug='test-region-1'), + Region(name='Test Region 2', slug='test-region-2'), + Region(name='Test Region 3', slug='test-region-3'), + ) + for r in regions: + r.save() + + site_groups = ( + SiteGroup(name='Site Group 1', slug='site-group-1'), + SiteGroup(name='Site Group 2', slug='site-group-2'), + SiteGroup(name='Site Group 3', slug='site-group-3'), + ) + for site_group in site_groups: + site_group.save() + + sites = ( + Site(name='Test Site 1', slug='test-site-1', region=regions[0], group=site_groups[0]), + Site(name='Test Site 2', slug='test-site-2', region=regions[1], group=site_groups[1]), + Site(name='Test Site 3', slug='test-site-3', region=regions[2], group=site_groups[2]), + ) + Site.objects.bulk_create(sites) + + locations = ( + Location(name='Location 1', slug='location-1', site=sites[0]), + Location(name='Location 2', slug='location-2', site=sites[2]), + ) + for location in locations: + location.save() + tenants = ( Tenant(name='Tenant 1', slug='tenant-1'), Tenant(name='Tenant 2', slug='tenant-2'), @@ -127,7 +157,8 @@ class WirelessLANTestCase(TestCase, ChangeLoggedFilterSetTests): auth_type=WirelessAuthTypeChoices.TYPE_OPEN, auth_cipher=WirelessAuthCipherChoices.CIPHER_AUTO, auth_psk='PSK1', - description='foobar1' + description='foobar1', + scope=sites[0] ), WirelessLAN( ssid='WLAN2', @@ -138,7 +169,8 @@ class WirelessLANTestCase(TestCase, ChangeLoggedFilterSetTests): auth_type=WirelessAuthTypeChoices.TYPE_WEP, auth_cipher=WirelessAuthCipherChoices.CIPHER_TKIP, auth_psk='PSK2', - description='foobar2' + description='foobar2', + scope=locations[0] ), WirelessLAN( ssid='WLAN3', @@ -149,12 +181,14 @@ class WirelessLANTestCase(TestCase, ChangeLoggedFilterSetTests): auth_type=WirelessAuthTypeChoices.TYPE_WPA_PERSONAL, auth_cipher=WirelessAuthCipherChoices.CIPHER_AES, auth_psk='PSK3', - description='foobar3' + description='foobar3', + scope=locations[1] ), ) - WirelessLAN.objects.bulk_create(wireless_lans) + for wireless_lan in wireless_lans: + wireless_lan.save() - device = create_test_device('Device 1') + device = create_test_device('Device 1', site=sites[0]) interfaces = ( Interface(device=device, name='Interface 1', type=InterfaceTypeChoices.TYPE_80211N), Interface(device=device, name='Interface 2', type=InterfaceTypeChoices.TYPE_80211N), @@ -217,6 +251,38 @@ class WirelessLANTestCase(TestCase, ChangeLoggedFilterSetTests): params = {'interface_id': [interfaces[0].pk, interfaces[1].pk]} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + def test_region(self): + regions = Region.objects.all()[:2] + params = {'region_id': [regions[0].pk, regions[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'region': [regions[0].slug, regions[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_site_group(self): + site_groups = SiteGroup.objects.all()[:2] + params = {'site_group_id': [site_groups[0].pk, site_groups[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'site_group': [site_groups[0].slug, site_groups[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_site(self): + sites = Site.objects.all()[:2] + params = {'site_id': [sites[0].pk, sites[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'site': [sites[0].slug, sites[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_location(self): + locations = Location.objects.all()[:1] + params = {'location_id': [locations[0].pk,]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + params = {'location': [locations[0].slug,]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + + def test_scope_type(self): + params = {'scope_type': 'dcim.location'} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + class WirelessLinkTestCase(TestCase, ChangeLoggedFilterSetTests): queryset = WirelessLink.objects.all() diff --git a/netbox/wireless/tests/test_views.py b/netbox/wireless/tests/test_views.py index d28d9fde3..713ba81d7 100644 --- a/netbox/wireless/tests/test_views.py +++ b/netbox/wireless/tests/test_views.py @@ -1,7 +1,8 @@ +from django.contrib.contenttypes.models import ContentType from wireless.choices import * from wireless.models import * from dcim.choices import InterfaceTypeChoices, LinkStatusChoices -from dcim.models import Interface +from dcim.models import Interface, Site from netbox.choices import DistanceUnitChoices from tenancy.models import Tenant from utilities.testing import ViewTestCases, create_tags, create_test_device @@ -56,6 +57,12 @@ class WirelessLANTestCase(ViewTestCases.PrimaryObjectViewTestCase): @classmethod def setUpTestData(cls): + sites = ( + Site(name='Site 1', slug='site-1'), + Site(name='Site 2', slug='site-2'), + ) + Site.objects.bulk_create(sites) + tenants = ( Tenant(name='Tenant 1', slug='tenant-1'), Tenant(name='Tenant 2', slug='tenant-2'), @@ -98,15 +105,17 @@ class WirelessLANTestCase(ViewTestCases.PrimaryObjectViewTestCase): 'ssid': 'WLAN2', 'group': groups[1].pk, 'status': WirelessLANStatusChoices.STATUS_DISABLED, + 'scope_type': ContentType.objects.get_for_model(Site).pk, + 'scope': sites[1].pk, 'tenant': tenants[1].pk, 'tags': [t.pk for t in tags], } cls.csv_data = ( - "group,ssid,status,tenant", - f"Wireless LAN Group 2,WLAN4,{WirelessLANStatusChoices.STATUS_ACTIVE},{tenants[0].name}", - f"Wireless LAN Group 2,WLAN5,{WirelessLANStatusChoices.STATUS_DISABLED},{tenants[1].name}", - f"Wireless LAN Group 2,WLAN6,{WirelessLANStatusChoices.STATUS_RESERVED},{tenants[2].name}", + "group,ssid,status,tenant,scope_type,scope_id", + f"Wireless LAN Group 2,WLAN4,{WirelessLANStatusChoices.STATUS_ACTIVE},{tenants[0].name},,", + f"Wireless LAN Group 2,WLAN5,{WirelessLANStatusChoices.STATUS_DISABLED},{tenants[1].name},dcim.site,{sites[0].pk}", + f"Wireless LAN Group 2,WLAN6,{WirelessLANStatusChoices.STATUS_RESERVED},{tenants[2].name},dcim.site,{sites[1].pk}", ) cls.csv_update_data = ( From a1830488910ff58c8fb05b43a7f3bccd685143ef Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 7 Nov 2024 10:24:15 -0500 Subject: [PATCH 25/65] Closes #17951: Extend Ruff ruleset --- .../0047_circuittermination__termination.py | 1 + netbox/circuits/tests/test_views.py | 2 +- netbox/extras/forms/bulk_import.py | 2 +- .../extras/management/commands/runscript.py | 2 +- netbox/extras/migrations/0109_script_model.py | 4 ++-- netbox/ipam/lookups.py | 4 ++-- netbox/ipam/tests/test_ordering.py | 6 +++--- netbox/netbox/authentication/__init__.py | 2 +- netbox/netbox/tests/test_plugins.py | 1 - netbox/netbox/views/errors.py | 2 +- netbox/utilities/error_handlers.py | 2 +- netbox/utilities/tests/test_counters.py | 2 +- .../api/serializers_/clusters.py | 2 -- netbox/virtualization/graphql/types.py | 2 +- .../migrations/0044_cluster_scope.py | 20 +++++++++---------- ruff.toml | 2 ++ 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/netbox/circuits/migrations/0047_circuittermination__termination.py b/netbox/circuits/migrations/0047_circuittermination__termination.py index cb2c9ca07..0cf2b424f 100644 --- a/netbox/circuits/migrations/0047_circuittermination__termination.py +++ b/netbox/circuits/migrations/0047_circuittermination__termination.py @@ -21,6 +21,7 @@ def copy_site_assignments(apps, schema_editor): termination_id=models.F('provider_network_id') ) + class Migration(migrations.Migration): dependencies = [ diff --git a/netbox/circuits/tests/test_views.py b/netbox/circuits/tests/test_views.py index a87e327af..f6c626443 100644 --- a/netbox/circuits/tests/test_views.py +++ b/netbox/circuits/tests/test_views.py @@ -341,7 +341,7 @@ class ProviderNetworkTestCase(ViewTestCases.PrimaryObjectViewTestCase): } -class TestCase(ViewTestCases.PrimaryObjectViewTestCase): +class TestCase(ViewTestCases.PrimaryObjectViewTestCase): model = CircuitTermination @classmethod diff --git a/netbox/extras/forms/bulk_import.py b/netbox/extras/forms/bulk_import.py index 258df8264..655a5d6ca 100644 --- a/netbox/extras/forms/bulk_import.py +++ b/netbox/extras/forms/bulk_import.py @@ -223,7 +223,7 @@ class EventRuleImportForm(NetBoxModelImportForm): from extras.scripts import get_module_and_script module_name, script_name = action_object.split('.', 1) try: - module, script = get_module_and_script(module_name, script_name) + script = get_module_and_script(module_name, script_name)[1] except ObjectDoesNotExist: raise forms.ValidationError(_("Script {name} not found").format(name=action_object)) self.instance.action_object = script diff --git a/netbox/extras/management/commands/runscript.py b/netbox/extras/management/commands/runscript.py index d5fb435ad..847d89396 100644 --- a/netbox/extras/management/commands/runscript.py +++ b/netbox/extras/management/commands/runscript.py @@ -38,7 +38,7 @@ class Command(BaseCommand): data = {} module_name, script_name = script.split('.', 1) - module, script_obj = get_module_and_script(module_name, script_name) + script_obj = get_module_and_script(module_name, script_name)[1] script = script_obj.python_class # Take user from command line if provided and exists, other diff --git a/netbox/extras/migrations/0109_script_model.py b/netbox/extras/migrations/0109_script_model.py index 6bfd2c14c..2fa0bf8aa 100644 --- a/netbox/extras/migrations/0109_script_model.py +++ b/netbox/extras/migrations/0109_script_model.py @@ -30,7 +30,7 @@ def get_python_name(scriptmodule): """ Return the Python name of a ScriptModule's file on disk. """ - path, filename = os.path.split(scriptmodule.file_path) + filename = os.path.split(scriptmodule.file_path)[0] return os.path.splitext(filename)[0] @@ -128,7 +128,7 @@ def update_event_rules(apps, schema_editor): for eventrule in EventRule.objects.filter(action_object_type=scriptmodule_ct): name = eventrule.action_parameters.get('script_name') - obj, created = Script.objects.get_or_create( + obj, __ = Script.objects.get_or_create( module_id=eventrule.action_object_id, name=name, defaults={'is_executable': False} diff --git a/netbox/ipam/lookups.py b/netbox/ipam/lookups.py index c6abb5a26..c493b7876 100644 --- a/netbox/ipam/lookups.py +++ b/netbox/ipam/lookups.py @@ -108,8 +108,8 @@ class NetIn(Lookup): return self.rhs def as_sql(self, qn, connection): - lhs, lhs_params = self.process_lhs(qn, connection) - rhs, rhs_params = self.process_rhs(qn, connection) + lhs = self.process_lhs(qn, connection)[0] + rhs_params = self.process_rhs(qn, connection)[1] with_mask, without_mask = [], [] for address in rhs_params[0]: if '/' in address: diff --git a/netbox/ipam/tests/test_ordering.py b/netbox/ipam/tests/test_ordering.py index 8d69af847..fea6b55e2 100644 --- a/netbox/ipam/tests/test_ordering.py +++ b/netbox/ipam/tests/test_ordering.py @@ -42,7 +42,7 @@ class PrefixOrderingTestCase(OrderingTestBase): """ This is a very basic test, which tests both prefixes without VRFs and prefixes with VRFs """ - vrf1, vrf2, vrf3 = list(VRF.objects.all()) + vrf1, vrf2 = VRF.objects.all()[:2] prefixes = ( Prefix(status=PrefixStatusChoices.STATUS_CONTAINER, vrf=None, prefix=netaddr.IPNetwork('192.168.0.0/16')), Prefix(status=PrefixStatusChoices.STATUS_ACTIVE, vrf=None, prefix=netaddr.IPNetwork('192.168.0.0/24')), @@ -106,7 +106,7 @@ class PrefixOrderingTestCase(OrderingTestBase): VRF A:10.1.1.0/24 None: 192.168.0.0/16 """ - vrf1, vrf2, vrf3 = list(VRF.objects.all()) + vrf1 = VRF.objects.first() prefixes = [ Prefix(status=PrefixStatusChoices.STATUS_CONTAINER, vrf=None, prefix=netaddr.IPNetwork('10.0.0.0/8')), Prefix(status=PrefixStatusChoices.STATUS_CONTAINER, vrf=None, prefix=netaddr.IPNetwork('10.0.0.0/16')), @@ -130,7 +130,7 @@ class IPAddressOrderingTestCase(OrderingTestBase): """ This function tests ordering with the inclusion of vrfs """ - vrf1, vrf2, vrf3 = list(VRF.objects.all()) + vrf1, vrf2 = VRF.objects.all()[:2] addresses = ( IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf1, address=netaddr.IPNetwork('10.0.0.1/24')), IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf1, address=netaddr.IPNetwork('10.0.1.1/24')), diff --git a/netbox/netbox/authentication/__init__.py b/netbox/netbox/authentication/__init__.py index 7c2df4200..83f699e42 100644 --- a/netbox/netbox/authentication/__init__.py +++ b/netbox/netbox/authentication/__init__.py @@ -107,7 +107,7 @@ class ObjectPermissionMixin: return perms def has_perm(self, user_obj, perm, obj=None): - app_label, action, model_name = resolve_permission(perm) + app_label, __, model_name = resolve_permission(perm) # Superusers implicitly have all permissions if user_obj.is_active and user_obj.is_superuser: diff --git a/netbox/netbox/tests/test_plugins.py b/netbox/netbox/tests/test_plugins.py index db82d0a75..264c8e6f9 100644 --- a/netbox/netbox/tests/test_plugins.py +++ b/netbox/netbox/tests/test_plugins.py @@ -213,7 +213,6 @@ class PluginTest(TestCase): self.assertEqual(get_plugin_config(plugin, 'bar'), None) self.assertEqual(get_plugin_config(plugin, 'bar', default=456), 456) - def test_events_pipeline(self): """ Check that events pipeline is registered. diff --git a/netbox/netbox/views/errors.py b/netbox/netbox/views/errors.py index 9e8ed5a3a..5872a59cd 100644 --- a/netbox/netbox/views/errors.py +++ b/netbox/netbox/views/errors.py @@ -49,7 +49,7 @@ def handler_500(request, template_name=ERROR_500_TEMPLATE_NAME): template = loader.get_template(template_name) except TemplateDoesNotExist: return HttpResponseServerError('

Server Error (500)

', content_type='text/html') - type_, error, traceback = sys.exc_info() + type_, error = sys.exc_info()[:2] return HttpResponseServerError(template.render({ 'error': error, diff --git a/netbox/utilities/error_handlers.py b/netbox/utilities/error_handlers.py index 5d2a46424..397098ded 100644 --- a/netbox/utilities/error_handlers.py +++ b/netbox/utilities/error_handlers.py @@ -49,7 +49,7 @@ def handle_rest_api_exception(request, *args, **kwargs): """ Handle exceptions and return a useful error message for REST API requests. """ - type_, error, traceback = sys.exc_info() + type_, error = sys.exc_info()[:2] data = { 'error': str(error), 'exception': type_.__name__, diff --git a/netbox/utilities/tests/test_counters.py b/netbox/utilities/tests/test_counters.py index 45823065e..668965e8a 100644 --- a/netbox/utilities/tests/test_counters.py +++ b/netbox/utilities/tests/test_counters.py @@ -83,7 +83,7 @@ class CountersTest(TestCase): @override_settings(EXEMPT_VIEW_PERMISSIONS=['*']) def test_mptt_child_delete(self): - device1, device2 = Device.objects.all() + device1 = Device.objects.first() inventory_item1 = InventoryItem.objects.create(device=device1, name='Inventory Item 1') InventoryItem.objects.create(device=device1, name='Inventory Item 2', parent=inventory_item1) device1.refresh_from_db() diff --git a/netbox/virtualization/api/serializers_/clusters.py b/netbox/virtualization/api/serializers_/clusters.py index 101a5b5a3..c0b636e33 100644 --- a/netbox/virtualization/api/serializers_/clusters.py +++ b/netbox/virtualization/api/serializers_/clusters.py @@ -80,5 +80,3 @@ class ClusterSerializer(NetBoxModelSerializer): serializer = get_serializer_for_model(obj.scope) context = {'request': self.context['request']} return serializer(obj.scope, nested=True, context=context).data - - diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index f51e0e3f5..6052c8936 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -48,7 +48,7 @@ class ClusterType(VLANGroupsMixin, NetBoxObjectType): Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')], Annotated["SiteType", strawberry.lazy('dcim.graphql.types')], ], strawberry.union("ClusterScopeType")] | None: - return self.scope + return self.scope @strawberry_django.type( diff --git a/netbox/virtualization/migrations/0044_cluster_scope.py b/netbox/virtualization/migrations/0044_cluster_scope.py index 63a888ac3..b7af25f8b 100644 --- a/netbox/virtualization/migrations/0044_cluster_scope.py +++ b/netbox/virtualization/migrations/0044_cluster_scope.py @@ -3,17 +3,17 @@ from django.db import migrations, models def copy_site_assignments(apps, schema_editor): - """ - Copy site ForeignKey values to the scope GFK. - """ - ContentType = apps.get_model('contenttypes', 'ContentType') - Cluster = apps.get_model('virtualization', 'Cluster') - Site = apps.get_model('dcim', 'Site') + """ + Copy site ForeignKey values to the scope GFK. + """ + ContentType = apps.get_model('contenttypes', 'ContentType') + Cluster = apps.get_model('virtualization', 'Cluster') + Site = apps.get_model('dcim', 'Site') - Cluster.objects.filter(site__isnull=False).update( - scope_type=ContentType.objects.get_for_model(Site), - scope_id=models.F('site_id') - ) + Cluster.objects.filter(site__isnull=False).update( + scope_type=ContentType.objects.get_for_model(Site), + scope_id=models.F('site_id') + ) class Migration(migrations.Migration): diff --git a/ruff.toml b/ruff.toml index 854404469..94a0e1c61 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,2 +1,4 @@ [lint] +extend-select = ["E1", "E2", "E3", "W"] ignore = ["E501", "F403", "F405"] +preview = true From 03d413565f289f3f410ec4e76e938a1613e3cfe0 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 7 Nov 2024 14:10:15 -0500 Subject: [PATCH 26/65] Fix linter error --- netbox/wireless/forms/bulk_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/wireless/forms/bulk_import.py b/netbox/wireless/forms/bulk_import.py index 5bf2d7dcd..f23ccf203 100644 --- a/netbox/wireless/forms/bulk_import.py +++ b/netbox/wireless/forms/bulk_import.py @@ -7,7 +7,7 @@ from ipam.models import VLAN from netbox.choices import * from netbox.forms import NetBoxModelImportForm from tenancy.models import Tenant -from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField +from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField from wireless.choices import * from wireless.models import * From 75aeaab8eebb3920ead490da242ec6d8a9e0009c Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 15 Nov 2024 04:55:32 -0800 Subject: [PATCH 27/65] 12596 Add Allocated Resources to Cluster API (#17956) * 12596 Add Allocated Resources to Cluster API * 12596 Add Allocated Resources to Cluster API * 12596 Add Allocated Resources to Cluster API * 12596 Add Allocated Resources to Cluster API * 12596 review changes * 12596 review changes --- netbox/virtualization/api/serializers_/clusters.py | 10 +++++++++- netbox/virtualization/api/views.py | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/netbox/virtualization/api/serializers_/clusters.py b/netbox/virtualization/api/serializers_/clusters.py index c0b636e33..450924fef 100644 --- a/netbox/virtualization/api/serializers_/clusters.py +++ b/netbox/virtualization/api/serializers_/clusters.py @@ -59,6 +59,14 @@ class ClusterSerializer(NetBoxModelSerializer): ) scope_id = serializers.IntegerField(allow_null=True, required=False, default=None) scope = serializers.SerializerMethodField(read_only=True) + allocated_vcpus = serializers.DecimalField( + read_only=True, + max_digits=8, + decimal_places=2, + + ) + allocated_memory = serializers.IntegerField(read_only=True) + allocated_disk = serializers.IntegerField(read_only=True) # Related object counts device_count = RelatedObjectCountField('devices') @@ -69,7 +77,7 @@ class ClusterSerializer(NetBoxModelSerializer): fields = [ 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'scope_id', 'scope', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', - 'virtualmachine_count', + 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk' ] brief_fields = ('id', 'url', 'display', 'name', 'description', 'virtualmachine_count') diff --git a/netbox/virtualization/api/views.py b/netbox/virtualization/api/views.py index fdf1d71be..93980ce28 100644 --- a/netbox/virtualization/api/views.py +++ b/netbox/virtualization/api/views.py @@ -1,3 +1,4 @@ +from django.db.models import Sum from rest_framework.routers import APIRootView from extras.api.mixins import ConfigContextQuerySetMixin, RenderConfigMixin @@ -33,7 +34,11 @@ class ClusterGroupViewSet(NetBoxModelViewSet): class ClusterViewSet(NetBoxModelViewSet): - queryset = Cluster.objects.all() + queryset = Cluster.objects.prefetch_related('virtual_machines').annotate( + allocated_vcpus=Sum('virtual_machines__vcpus'), + allocated_memory=Sum('virtual_machines__memory'), + allocated_disk=Sum('virtual_machines__disk'), + ) serializer_class = serializers.ClusterSerializer filterset_class = filtersets.ClusterFilterSet From 6ab0792f02495903045fbc8bb8efb0618e88f631 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 15 Nov 2024 06:32:09 -0800 Subject: [PATCH 28/65] Closes #11279: Replace `_name` natural key sorting with collation (#18009) * 11279 add collation * 11279 add collation * 11279 add collation * 11279 add collation * 11279 fix tables /tests * 11279 fix tests * 11279 refactor VirtualDisk * Clean up migrations * Misc cleanup * Correct errant file inclusion --------- Co-authored-by: Jeremy Stretch --- .../migrations/0049_natural_ordering.py | 22 ++ netbox/circuits/models/providers.py | 6 +- netbox/core/tests/test_changelog.py | 28 -- netbox/dcim/graphql/types.py | 20 +- .../migrations/0197_natural_sort_collation.py | 17 + .../dcim/migrations/0198_natural_ordering.py | 318 ++++++++++++++++++ .../dcim/models/device_component_templates.py | 14 +- netbox/dcim/models/device_components.py | 12 +- netbox/dcim/models/devices.py | 19 +- netbox/dcim/models/power.py | 6 +- netbox/dcim/models/racks.py | 10 +- netbox/dcim/models/sites.py | 11 +- netbox/dcim/tables/devices.py | 18 +- netbox/dcim/tables/devicetypes.py | 8 +- netbox/dcim/tables/racks.py | 1 - netbox/dcim/views.py | 7 +- .../ipam/migrations/0076_natural_ordering.py | 32 ++ netbox/ipam/models/asns.py | 3 +- netbox/ipam/models/vlans.py | 3 +- netbox/ipam/models/vrfs.py | 6 +- .../migrations/0017_natural_ordering.py | 27 ++ netbox/tenancy/models/contacts.py | 3 +- netbox/tenancy/models/tenants.py | 6 +- netbox/utilities/fields.py | 3 +- netbox/virtualization/graphql/types.py | 3 +- .../migrations/0046_natural_ordering.py | 43 +++ netbox/virtualization/models/clusters.py | 3 +- .../virtualization/models/virtualmachines.py | 34 +- .../virtualization/tables/virtualmachines.py | 1 - .../vpn/migrations/0007_natural_ordering.py | 47 +++ netbox/vpn/models/crypto.py | 15 +- netbox/vpn/models/l2vpn.py | 3 +- netbox/vpn/models/tunnels.py | 3 +- .../migrations/0012_natural_ordering.py | 17 + netbox/wireless/models.py | 3 +- 35 files changed, 622 insertions(+), 150 deletions(-) create mode 100644 netbox/circuits/migrations/0049_natural_ordering.py create mode 100644 netbox/dcim/migrations/0197_natural_sort_collation.py create mode 100644 netbox/dcim/migrations/0198_natural_ordering.py create mode 100644 netbox/ipam/migrations/0076_natural_ordering.py create mode 100644 netbox/tenancy/migrations/0017_natural_ordering.py create mode 100644 netbox/virtualization/migrations/0046_natural_ordering.py create mode 100644 netbox/vpn/migrations/0007_natural_ordering.py create mode 100644 netbox/wireless/migrations/0012_natural_ordering.py diff --git a/netbox/circuits/migrations/0049_natural_ordering.py b/netbox/circuits/migrations/0049_natural_ordering.py new file mode 100644 index 000000000..1b4f565e8 --- /dev/null +++ b/netbox/circuits/migrations/0049_natural_ordering.py @@ -0,0 +1,22 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0048_circuitterminations_cached_relations'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterField( + model_name='provider', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='providernetwork', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + ] diff --git a/netbox/circuits/models/providers.py b/netbox/circuits/models/providers.py index f0fe77b1a..be81caa54 100644 --- a/netbox/circuits/models/providers.py +++ b/netbox/circuits/models/providers.py @@ -21,7 +21,8 @@ class Provider(ContactsMixin, PrimaryModel): verbose_name=_('name'), max_length=100, unique=True, - help_text=_('Full name of the provider') + help_text=_('Full name of the provider'), + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), @@ -95,7 +96,8 @@ class ProviderNetwork(PrimaryModel): """ name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) provider = models.ForeignKey( to='circuits.Provider', diff --git a/netbox/core/tests/test_changelog.py b/netbox/core/tests/test_changelog.py index c58968ee8..4914dbaf3 100644 --- a/netbox/core/tests/test_changelog.py +++ b/netbox/core/tests/test_changelog.py @@ -76,10 +76,6 @@ class ChangeLogViewTest(ModelViewTestCase): self.assertEqual(oc.postchange_data['custom_fields']['cf2'], form_data['cf_cf2']) self.assertEqual(oc.postchange_data['tags'], ['Tag 1', 'Tag 2']) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.postchange_data) - self.assertNotIn('_name', oc.postchange_data_clean) - def test_update_object(self): site = Site(name='Site 1', slug='site-1') site.save() @@ -117,12 +113,6 @@ class ChangeLogViewTest(ModelViewTestCase): self.assertEqual(oc.postchange_data['custom_fields']['cf2'], form_data['cf_cf2']) self.assertEqual(oc.postchange_data['tags'], ['Tag 3']) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.prechange_data) - self.assertNotIn('_name', oc.prechange_data_clean) - self.assertIn('_name', oc.postchange_data) - self.assertNotIn('_name', oc.postchange_data_clean) - def test_delete_object(self): site = Site( name='Site 1', @@ -153,10 +143,6 @@ class ChangeLogViewTest(ModelViewTestCase): self.assertEqual(oc.prechange_data['tags'], ['Tag 1', 'Tag 2']) self.assertEqual(oc.postchange_data, None) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.prechange_data) - self.assertNotIn('_name', oc.prechange_data_clean) - def test_bulk_update_objects(self): sites = ( Site(name='Site 1', slug='site-1', status=SiteStatusChoices.STATUS_ACTIVE), @@ -353,10 +339,6 @@ class ChangeLogAPITest(APITestCase): self.assertEqual(oc.postchange_data['custom_fields'], data['custom_fields']) self.assertEqual(oc.postchange_data['tags'], ['Tag 1', 'Tag 2']) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.postchange_data) - self.assertNotIn('_name', oc.postchange_data_clean) - def test_update_object(self): site = Site(name='Site 1', slug='site-1') site.save() @@ -389,12 +371,6 @@ class ChangeLogAPITest(APITestCase): self.assertEqual(oc.postchange_data['custom_fields'], data['custom_fields']) self.assertEqual(oc.postchange_data['tags'], ['Tag 3']) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.prechange_data) - self.assertNotIn('_name', oc.prechange_data_clean) - self.assertIn('_name', oc.postchange_data) - self.assertNotIn('_name', oc.postchange_data_clean) - def test_delete_object(self): site = Site( name='Site 1', @@ -423,10 +399,6 @@ class ChangeLogAPITest(APITestCase): self.assertEqual(oc.prechange_data['tags'], ['Tag 1', 'Tag 2']) self.assertEqual(oc.postchange_data, None) - # Check that private attributes were included in raw data but not display data - self.assertIn('_name', oc.prechange_data) - self.assertNotIn('_name', oc.prechange_data_clean) - def test_bulk_create_objects(self): data = ( { diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index 6493ec6b1..fc5f35780 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -76,7 +76,6 @@ class ComponentType( """ Base type for device/VM components """ - _name: str device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] @@ -93,7 +92,6 @@ class ComponentTemplateType( """ Base type for device/VM components """ - _name: str device_type: Annotated["DeviceTypeType", strawberry.lazy('dcim.graphql.types')] @@ -181,7 +179,7 @@ class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin filters=ConsolePortTemplateFilter ) class ConsolePortTemplateType(ModularComponentTemplateType): - _name: str + pass @strawberry_django.type( @@ -199,7 +197,7 @@ class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpoin filters=ConsoleServerPortTemplateFilter ) class ConsoleServerPortTemplateType(ModularComponentTemplateType): - _name: str + pass @strawberry_django.type( @@ -208,7 +206,6 @@ class ConsoleServerPortTemplateType(ModularComponentTemplateType): filters=DeviceFilter ) class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): - _name: str console_port_count: BigInt console_server_port_count: BigInt power_port_count: BigInt @@ -273,7 +270,7 @@ class DeviceBayType(ComponentType): filters=DeviceBayTemplateFilter ) class DeviceBayTemplateType(ComponentTemplateType): - _name: str + pass @strawberry_django.type( @@ -282,7 +279,6 @@ class DeviceBayTemplateType(ComponentTemplateType): filters=InventoryItemTemplateFilter ) class InventoryItemTemplateType(ComponentTemplateType): - _name: str role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] @@ -366,7 +362,6 @@ class FrontPortType(ModularComponentType, CabledObjectMixin): filters=FrontPortTemplateFilter ) class FrontPortTemplateType(ModularComponentTemplateType): - _name: str color: str rear_port: Annotated["RearPortTemplateType", strawberry.lazy('dcim.graphql.types')] @@ -377,6 +372,7 @@ class FrontPortTemplateType(ModularComponentTemplateType): filters=InterfaceFilter ) class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin): + _name: str mac_address: str | None wwn: str | None parent: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None @@ -527,7 +523,7 @@ class ModuleBayType(ModularComponentType): filters=ModuleBayTemplateFilter ) class ModuleBayTemplateType(ModularComponentTemplateType): - _name: str + pass @strawberry_django.type( @@ -588,7 +584,6 @@ class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin filters=PowerOutletTemplateFilter ) class PowerOutletTemplateType(ModularComponentTemplateType): - _name: str power_port: Annotated["PowerPortTemplateType", strawberry.lazy('dcim.graphql.types')] | None @@ -620,8 +615,6 @@ class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin): filters=PowerPortTemplateFilter ) class PowerPortTemplateType(ModularComponentTemplateType): - _name: str - poweroutlet_templates: List[Annotated["PowerOutletTemplateType", strawberry.lazy('dcim.graphql.types')]] @@ -640,7 +633,6 @@ class RackTypeType(NetBoxObjectType): filters=RackFilter ) class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): - _name: str site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')] location: Annotated["LocationType", strawberry.lazy('dcim.graphql.types')] | None tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None @@ -693,7 +685,6 @@ class RearPortType(ModularComponentType, CabledObjectMixin): filters=RearPortTemplateFilter ) class RearPortTemplateType(ModularComponentTemplateType): - _name: str color: str frontport_templates: List[Annotated["FrontPortTemplateType", strawberry.lazy('dcim.graphql.types')]] @@ -729,7 +720,6 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): filters=SiteFilter ) class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType): - _name: str time_zone: str | None region: Annotated["RegionType", strawberry.lazy('dcim.graphql.types')] | None group: Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')] | None diff --git a/netbox/dcim/migrations/0197_natural_sort_collation.py b/netbox/dcim/migrations/0197_natural_sort_collation.py new file mode 100644 index 000000000..a77632b37 --- /dev/null +++ b/netbox/dcim/migrations/0197_natural_sort_collation.py @@ -0,0 +1,17 @@ +from django.contrib.postgres.operations import CreateCollation +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0196_qinq_svlan'), + ] + + operations = [ + CreateCollation( + "natural_sort", + provider="icu", + locale="und-u-kn-true", + ), + ] diff --git a/netbox/dcim/migrations/0198_natural_ordering.py b/netbox/dcim/migrations/0198_natural_ordering.py new file mode 100644 index 000000000..83e94a195 --- /dev/null +++ b/netbox/dcim/migrations/0198_natural_ordering.py @@ -0,0 +1,318 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterModelOptions( + name='site', + options={'ordering': ('name',)}, + ), + migrations.AlterField( + model_name='site', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterModelOptions( + name='consoleport', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='consoleporttemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='consoleserverport', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='consoleserverporttemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='device', + options={'ordering': ('name', 'pk')}, + ), + migrations.AlterModelOptions( + name='devicebay', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='devicebaytemplate', + options={'ordering': ('device_type', 'name')}, + ), + migrations.AlterModelOptions( + name='frontport', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='frontporttemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='interfacetemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='inventoryitem', + options={'ordering': ('device__id', 'parent__id', 'name')}, + ), + migrations.AlterModelOptions( + name='inventoryitemtemplate', + options={'ordering': ('device_type__id', 'parent__id', 'name')}, + ), + migrations.AlterModelOptions( + name='modulebay', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='modulebaytemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='poweroutlet', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='poweroutlettemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='powerport', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='powerporttemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.AlterModelOptions( + name='rack', + options={'ordering': ('site', 'location', 'name', 'pk')}, + ), + migrations.AlterModelOptions( + name='rearport', + options={'ordering': ('device', 'name')}, + ), + migrations.AlterModelOptions( + name='rearporttemplate', + options={'ordering': ('device_type', 'module_type', 'name')}, + ), + migrations.RemoveField( + model_name='consoleport', + name='_name', + ), + migrations.RemoveField( + model_name='consoleporttemplate', + name='_name', + ), + migrations.RemoveField( + model_name='consoleserverport', + name='_name', + ), + migrations.RemoveField( + model_name='consoleserverporttemplate', + name='_name', + ), + migrations.RemoveField( + model_name='device', + name='_name', + ), + migrations.RemoveField( + model_name='devicebay', + name='_name', + ), + migrations.RemoveField( + model_name='devicebaytemplate', + name='_name', + ), + migrations.RemoveField( + model_name='frontport', + name='_name', + ), + migrations.RemoveField( + model_name='frontporttemplate', + name='_name', + ), + migrations.RemoveField( + model_name='inventoryitem', + name='_name', + ), + migrations.RemoveField( + model_name='inventoryitemtemplate', + name='_name', + ), + migrations.RemoveField( + model_name='modulebay', + name='_name', + ), + migrations.RemoveField( + model_name='modulebaytemplate', + name='_name', + ), + migrations.RemoveField( + model_name='poweroutlet', + name='_name', + ), + migrations.RemoveField( + model_name='poweroutlettemplate', + name='_name', + ), + migrations.RemoveField( + model_name='powerport', + name='_name', + ), + migrations.RemoveField( + model_name='powerporttemplate', + name='_name', + ), + migrations.RemoveField( + model_name='rack', + name='_name', + ), + migrations.RemoveField( + model_name='rearport', + name='_name', + ), + migrations.RemoveField( + model_name='rearporttemplate', + name='_name', + ), + migrations.RemoveField( + model_name='site', + name='_name', + ), + migrations.AlterField( + model_name='consoleport', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='consoleporttemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='consoleserverport', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='consoleserverporttemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='device', + name='name', + field=models.CharField(blank=True, db_collation='natural_sort', max_length=64, null=True), + ), + migrations.AlterField( + model_name='devicebay', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='devicebaytemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='frontport', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='frontporttemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='interface', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='interfacetemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='inventoryitem', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='inventoryitemtemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='modulebay', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='modulebaytemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='poweroutlet', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='poweroutlettemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='powerport', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='powerporttemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='rack', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='rearport', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='rearporttemplate', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='powerfeed', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='powerpanel', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='virtualchassis', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='virtualdevicecontext', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + ] diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py index 00555d49e..ddd4d2426 100644 --- a/netbox/dcim/models/device_component_templates.py +++ b/netbox/dcim/models/device_component_templates.py @@ -44,12 +44,8 @@ class ComponentTemplateModel(ChangeLoggedModel, TrackingModelMixin): max_length=64, help_text=_( "{module} is accepted as a substitution for the module bay position when attached to a module type." - ) - ) - _name = NaturalOrderingField( - target_field='name', - max_length=100, - blank=True + ), + db_collation="natural_sort" ) label = models.CharField( verbose_name=_('label'), @@ -65,7 +61,7 @@ class ComponentTemplateModel(ChangeLoggedModel, TrackingModelMixin): class Meta: abstract = True - ordering = ('device_type', '_name') + ordering = ('device_type', 'name') constraints = ( models.UniqueConstraint( fields=('device_type', 'name'), @@ -125,7 +121,7 @@ class ModularComponentTemplateModel(ComponentTemplateModel): class Meta: abstract = True - ordering = ('device_type', 'module_type', '_name') + ordering = ('device_type', 'module_type', 'name') constraints = ( models.UniqueConstraint( fields=('device_type', 'name'), @@ -782,7 +778,7 @@ class InventoryItemTemplate(MPTTModel, ComponentTemplateModel): component_model = InventoryItem class Meta: - ordering = ('device_type__id', 'parent__id', '_name') + ordering = ('device_type__id', 'parent__id', 'name') indexes = ( models.Index(fields=('component_type', 'component_id')), ) diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 36fd02add..31278a13c 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -50,12 +50,8 @@ class ComponentModel(NetBoxModel): ) name = models.CharField( verbose_name=_('name'), - max_length=64 - ) - _name = NaturalOrderingField( - target_field='name', - max_length=100, - blank=True + max_length=64, + db_collation="natural_sort" ) label = models.CharField( verbose_name=_('label'), @@ -71,7 +67,7 @@ class ComponentModel(NetBoxModel): class Meta: abstract = True - ordering = ('device', '_name') + ordering = ('device', 'name') constraints = ( models.UniqueConstraint( fields=('device', 'name'), @@ -1301,7 +1297,7 @@ class InventoryItem(MPTTModel, ComponentModel, TrackingModelMixin): clone_fields = ('device', 'parent', 'role', 'manufacturer', 'status', 'part_id') class Meta: - ordering = ('device__id', 'parent__id', '_name') + ordering = ('device__id', 'parent__id', 'name') indexes = ( models.Index(fields=('component_type', 'component_id')), ) diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index 47f4ee6c9..a836c5d37 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -23,7 +23,7 @@ from netbox.config import ConfigItem from netbox.models import OrganizationalModel, PrimaryModel from netbox.models.mixins import WeightMixin from netbox.models.features import ContactsMixin, ImageAttachmentsMixin -from utilities.fields import ColorField, CounterCacheField, NaturalOrderingField +from utilities.fields import ColorField, CounterCacheField from utilities.tracking import TrackingModelMixin from .device_components import * from .mixins import RenderConfigMixin @@ -582,13 +582,8 @@ class Device( verbose_name=_('name'), max_length=64, blank=True, - null=True - ) - _name = NaturalOrderingField( - target_field='name', - max_length=100, - blank=True, - null=True + null=True, + db_collation="natural_sort" ) serial = models.CharField( max_length=50, @@ -775,7 +770,7 @@ class Device( ) class Meta: - ordering = ('_name', 'pk') # Name may be null + ordering = ('name', 'pk') # Name may be null constraints = ( models.UniqueConstraint( Lower('name'), 'site', 'tenant', @@ -1320,7 +1315,8 @@ class VirtualChassis(PrimaryModel): ) name = models.CharField( verbose_name=_('name'), - max_length=64 + max_length=64, + db_collation="natural_sort" ) domain = models.CharField( verbose_name=_('domain'), @@ -1382,7 +1378,8 @@ class VirtualDeviceContext(PrimaryModel): ) name = models.CharField( verbose_name=_('name'), - max_length=64 + max_length=64, + db_collation="natural_sort" ) status = models.CharField( verbose_name=_('status'), diff --git a/netbox/dcim/models/power.py b/netbox/dcim/models/power.py index d0c6b18b6..284cfe832 100644 --- a/netbox/dcim/models/power.py +++ b/netbox/dcim/models/power.py @@ -36,7 +36,8 @@ class PowerPanel(ContactsMixin, ImageAttachmentsMixin, PrimaryModel): ) name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) prerequisite_models = ( @@ -86,7 +87,8 @@ class PowerFeed(PrimaryModel, PathEndpoint, CabledObjectModel): ) name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) status = models.CharField( verbose_name=_('status'), diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 013dfb619..08b7f5a35 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -19,7 +19,7 @@ from netbox.models.mixins import WeightMixin from netbox.models.features import ContactsMixin, ImageAttachmentsMixin from utilities.conversion import to_grams from utilities.data import array_to_string, drange -from utilities.fields import ColorField, NaturalOrderingField +from utilities.fields import ColorField from .device_components import PowerPort from .devices import Device, Module from .power import PowerFeed @@ -255,12 +255,8 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): ) name = models.CharField( verbose_name=_('name'), - max_length=100 - ) - _name = NaturalOrderingField( - target_field='name', max_length=100, - blank=True + db_collation="natural_sort" ) facility_id = models.CharField( max_length=50, @@ -340,7 +336,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): ) class Meta: - ordering = ('site', 'location', '_name', 'pk') # (site, location, name) may be non-unique + ordering = ('site', 'location', 'name', 'pk') # (site, location, name) may be non-unique constraints = ( # Name and facility_id must be unique *only* within a Location models.UniqueConstraint( diff --git a/netbox/dcim/models/sites.py b/netbox/dcim/models/sites.py index a290f4119..0985a8d7a 100644 --- a/netbox/dcim/models/sites.py +++ b/netbox/dcim/models/sites.py @@ -8,7 +8,6 @@ from dcim.choices import * from dcim.constants import * from netbox.models import NestedGroupModel, PrimaryModel from netbox.models.features import ContactsMixin, ImageAttachmentsMixin -from utilities.fields import NaturalOrderingField __all__ = ( 'Location', @@ -143,12 +142,8 @@ class Site(ContactsMixin, ImageAttachmentsMixin, PrimaryModel): verbose_name=_('name'), max_length=100, unique=True, - help_text=_("Full name of the site") - ) - _name = NaturalOrderingField( - target_field='name', - max_length=100, - blank=True + help_text=_("Full name of the site"), + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), @@ -245,7 +240,7 @@ class Site(ContactsMixin, ImageAttachmentsMixin, PrimaryModel): ) class Meta: - ordering = ('_name',) + ordering = ('name',) verbose_name = _('site') verbose_name_plural = _('sites') diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index fed33401c..b7634626d 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -132,7 +132,6 @@ class PlatformTable(NetBoxTable): class DeviceTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): name = tables.TemplateColumn( verbose_name=_('Name'), - order_by=('_name',), template_code=DEVICE_LINK, linkify=True ) @@ -288,7 +287,6 @@ class DeviceComponentTable(NetBoxTable): name = tables.Column( verbose_name=_('Name'), linkify=True, - order_by=('_name',) ) device_status = columns.ChoiceFieldColumn( accessor=tables.A('device__status'), @@ -391,7 +389,6 @@ class DeviceConsolePortTable(ConsolePortTable): name = tables.TemplateColumn( verbose_name=_('Name'), template_code=' {{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -433,7 +430,6 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable): verbose_name=_('Name'), template_code=' ' '{{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -482,7 +478,6 @@ class DevicePowerPortTable(PowerPortTable): verbose_name=_('Name'), template_code=' ' '{{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -531,7 +526,6 @@ class DevicePowerOutletTable(PowerOutletTable): name = tables.TemplateColumn( verbose_name=_('Name'), template_code=' {{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -550,6 +544,11 @@ class DevicePowerOutletTable(PowerOutletTable): class BaseInterfaceTable(NetBoxTable): + name = tables.Column( + verbose_name=_('Name'), + linkify=True, + order_by=('_name',) + ) enabled = columns.BooleanColumn( verbose_name=_('Enabled'), ) @@ -597,7 +596,7 @@ class BaseInterfaceTable(NetBoxTable): return ",".join([str(obj) for obj in value.all()]) -class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpointTable): +class InterfaceTable(BaseInterfaceTable, ModularDeviceComponentTable, PathEndpointTable): device = tables.Column( verbose_name=_('Device'), linkify={ @@ -736,7 +735,6 @@ class DeviceFrontPortTable(FrontPortTable): verbose_name=_('Name'), template_code=' ' '{{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -783,7 +781,6 @@ class DeviceRearPortTable(RearPortTable): verbose_name=_('Name'), template_code=' ' '{{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -846,7 +843,6 @@ class DeviceDeviceBayTable(DeviceBayTable): verbose_name=_('Name'), template_code=' {{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) actions = columns.ActionsColumn( @@ -915,7 +911,6 @@ class DeviceModuleBayTable(ModuleBayTable): name = columns.MPTTColumn( verbose_name=_('Name'), linkify=True, - order_by=Accessor('_name') ) actions = columns.ActionsColumn( extra_buttons=MODULEBAY_BUTTONS @@ -982,7 +977,6 @@ class DeviceInventoryItemTable(InventoryItemTable): verbose_name=_('Name'), template_code='' '{{ value }}', - order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} ) diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index e8a4e35f1..a7f8f08e8 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -163,9 +163,7 @@ class ComponentTemplateTable(NetBoxTable): id = tables.Column( verbose_name=_('ID') ) - name = tables.Column( - order_by=('_name',) - ) + name = tables.Column() class Meta(NetBoxTable.Meta): exclude = ('id', ) @@ -220,6 +218,10 @@ class PowerOutletTemplateTable(ComponentTemplateTable): class InterfaceTemplateTable(ComponentTemplateTable): + name = tables.Column( + verbose_name=_('Name'), + order_by=('_name',) + ) enabled = columns.BooleanColumn( verbose_name=_('Enabled'), ) diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index a6b704161..dbd99ca24 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -111,7 +111,6 @@ class RackTypeTable(NetBoxTable): class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): name = tables.Column( verbose_name=_('Name'), - order_by=('_name',), linkify=True ) location = tables.Column( diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 9a821a384..7a5a771a9 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -688,8 +688,7 @@ class RackElevationListView(generic.ObjectListView): sort = request.GET.get('sort', 'name') if sort not in ORDERING_CHOICES: sort = 'name' - sort_field = sort.replace("name", "_name") # Use natural ordering - racks = racks.order_by(sort_field) + racks = racks.order_by(sort) # Pagination per_page = get_paginate_count(request) @@ -731,8 +730,8 @@ class RackView(GetRelatedModelsMixin, generic.ObjectView): peer_racks = peer_racks.filter(location=instance.location) else: peer_racks = peer_racks.filter(location__isnull=True) - next_rack = peer_racks.filter(_name__gt=instance._name).first() - prev_rack = peer_racks.filter(_name__lt=instance._name).reverse().first() + next_rack = peer_racks.filter(name__gt=instance.name).first() + prev_rack = peer_racks.filter(name__lt=instance.name).reverse().first() # Determine any additional parameters to pass when embedding the rack elevations svg_extra = '&'.join([ diff --git a/netbox/ipam/migrations/0076_natural_ordering.py b/netbox/ipam/migrations/0076_natural_ordering.py new file mode 100644 index 000000000..8c7bfaea1 --- /dev/null +++ b/netbox/ipam/migrations/0076_natural_ordering.py @@ -0,0 +1,32 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ipam', '0075_vlan_qinq'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterField( + model_name='asnrange', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='routetarget', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=21, unique=True), + ), + migrations.AlterField( + model_name='vlangroup', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='vrf', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + ] diff --git a/netbox/ipam/models/asns.py b/netbox/ipam/models/asns.py index eb47426b2..c1d251301 100644 --- a/netbox/ipam/models/asns.py +++ b/netbox/ipam/models/asns.py @@ -16,7 +16,8 @@ class ASNRange(OrganizationalModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), diff --git a/netbox/ipam/models/vlans.py b/netbox/ipam/models/vlans.py index 7832cfc67..fa31fd608 100644 --- a/netbox/ipam/models/vlans.py +++ b/netbox/ipam/models/vlans.py @@ -35,7 +35,8 @@ class VLANGroup(OrganizationalModel): """ name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), diff --git a/netbox/ipam/models/vrfs.py b/netbox/ipam/models/vrfs.py index 26afb7927..6a8b8d649 100644 --- a/netbox/ipam/models/vrfs.py +++ b/netbox/ipam/models/vrfs.py @@ -18,7 +18,8 @@ class VRF(PrimaryModel): """ name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) rd = models.CharField( max_length=VRF_RD_MAX_LENGTH, @@ -74,7 +75,8 @@ class RouteTarget(PrimaryModel): verbose_name=_('name'), max_length=VRF_RD_MAX_LENGTH, # Same format options as VRF RD (RFC 4360 section 4) unique=True, - help_text=_('Route target value (formatted in accordance with RFC 4360)') + help_text=_('Route target value (formatted in accordance with RFC 4360)'), + db_collation="natural_sort" ) tenant = models.ForeignKey( to='tenancy.Tenant', diff --git a/netbox/tenancy/migrations/0017_natural_ordering.py b/netbox/tenancy/migrations/0017_natural_ordering.py new file mode 100644 index 000000000..de1fb49aa --- /dev/null +++ b/netbox/tenancy/migrations/0017_natural_ordering.py @@ -0,0 +1,27 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tenancy', '0016_charfield_null_choices'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterField( + model_name='contact', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='tenant', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.AlterField( + model_name='tenantgroup', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + ] diff --git a/netbox/tenancy/models/contacts.py b/netbox/tenancy/models/contacts.py index 24ffef0cf..3969c8317 100644 --- a/netbox/tenancy/models/contacts.py +++ b/netbox/tenancy/models/contacts.py @@ -56,7 +56,8 @@ class Contact(PrimaryModel): ) name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) title = models.CharField( verbose_name=_('title'), diff --git a/netbox/tenancy/models/tenants.py b/netbox/tenancy/models/tenants.py index 7a2d9c2f8..55f0c5933 100644 --- a/netbox/tenancy/models/tenants.py +++ b/netbox/tenancy/models/tenants.py @@ -18,7 +18,8 @@ class TenantGroup(NestedGroupModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), @@ -39,7 +40,8 @@ class Tenant(ContactsMixin, PrimaryModel): """ name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), diff --git a/netbox/utilities/fields.py b/netbox/utilities/fields.py index ee71223cb..1d16a1d3f 100644 --- a/netbox/utilities/fields.py +++ b/netbox/utilities/fields.py @@ -5,7 +5,6 @@ from django.db import models from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ -from utilities.ordering import naturalize from .forms.widgets import ColorSelect from .validators import ColorValidator @@ -40,7 +39,7 @@ class NaturalOrderingField(models.CharField): """ description = "Stores a representation of its target field suitable for natural ordering" - def __init__(self, target_field, naturalize_function=naturalize, *args, **kwargs): + def __init__(self, target_field, naturalize_function, *args, **kwargs): self.target_field = target_field self.naturalize_function = naturalize_function super().__init__(*args, **kwargs) diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index 6052c8936..8476eac7e 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -25,7 +25,6 @@ class ComponentType(NetBoxObjectType): """ Base type for device/VM components """ - _name: str virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] @@ -77,7 +76,6 @@ class ClusterTypeType(OrganizationalObjectType): filters=VirtualMachineFilter ) class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType): - _name: str interface_count: BigInt virtual_disk_count: BigInt interface_count: BigInt @@ -102,6 +100,7 @@ class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType): filters=VMInterfaceFilter ) class VMInterfaceType(IPAddressesMixin, ComponentType): + _name: str mac_address: str | None parent: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None diff --git a/netbox/virtualization/migrations/0046_natural_ordering.py b/netbox/virtualization/migrations/0046_natural_ordering.py new file mode 100644 index 000000000..9284b6331 --- /dev/null +++ b/netbox/virtualization/migrations/0046_natural_ordering.py @@ -0,0 +1,43 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('virtualization', '0045_clusters_cached_relations'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterModelOptions( + name='virtualmachine', + options={'ordering': ('name', 'pk')}, + ), + migrations.AlterModelOptions( + name='virtualdisk', + options={'ordering': ('virtual_machine', 'name')}, + ), + migrations.RemoveField( + model_name='virtualmachine', + name='_name', + ), + migrations.AlterField( + model_name='virtualdisk', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='virtualmachine', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=64), + ), + migrations.AlterField( + model_name='cluster', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100), + ), + migrations.RemoveField( + model_name='virtualdisk', + name='_name', + ), + ] diff --git a/netbox/virtualization/models/clusters.py b/netbox/virtualization/models/clusters.py index 601ee7f23..9f7b97e29 100644 --- a/netbox/virtualization/models/clusters.py +++ b/netbox/virtualization/models/clusters.py @@ -50,7 +50,8 @@ class Cluster(ContactsMixin, CachedScopeMixin, PrimaryModel): """ name = models.CharField( verbose_name=_('name'), - max_length=100 + max_length=100, + db_collation="natural_sort" ) type = models.ForeignKey( verbose_name=_('type'), diff --git a/netbox/virtualization/models/virtualmachines.py b/netbox/virtualization/models/virtualmachines.py index 4ee41e403..ebfb2d6c5 100644 --- a/netbox/virtualization/models/virtualmachines.py +++ b/netbox/virtualization/models/virtualmachines.py @@ -69,12 +69,8 @@ class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, Co ) name = models.CharField( verbose_name=_('name'), - max_length=64 - ) - _name = NaturalOrderingField( - target_field='name', - max_length=100, - blank=True + max_length=64, + db_collation="natural_sort" ) status = models.CharField( max_length=50, @@ -152,7 +148,7 @@ class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, Co ) class Meta: - ordering = ('_name', 'pk') # Name may be non-unique + ordering = ('name', 'pk') # Name may be non-unique constraints = ( models.UniqueConstraint( Lower('name'), 'cluster', 'tenant', @@ -273,13 +269,8 @@ class ComponentModel(NetBoxModel): ) name = models.CharField( verbose_name=_('name'), - max_length=64 - ) - _name = NaturalOrderingField( - target_field='name', - naturalize_function=naturalize_interface, - max_length=100, - blank=True + max_length=64, + db_collation="natural_sort" ) description = models.CharField( verbose_name=_('description'), @@ -289,7 +280,6 @@ class ComponentModel(NetBoxModel): class Meta: abstract = True - ordering = ('virtual_machine', CollateAsChar('_name')) constraints = ( models.UniqueConstraint( fields=('virtual_machine', 'name'), @@ -311,10 +301,9 @@ class ComponentModel(NetBoxModel): class VMInterface(ComponentModel, BaseInterface, TrackingModelMixin): - virtual_machine = models.ForeignKey( - to='virtualization.VirtualMachine', - on_delete=models.CASCADE, - related_name='interfaces' # Override ComponentModel + name = models.CharField( + verbose_name=_('name'), + max_length=64, ) _name = NaturalOrderingField( target_field='name', @@ -322,6 +311,11 @@ class VMInterface(ComponentModel, BaseInterface, TrackingModelMixin): max_length=100, blank=True ) + virtual_machine = models.ForeignKey( + to='virtualization.VirtualMachine', + on_delete=models.CASCADE, + related_name='interfaces' # Override ComponentModel + ) ip_addresses = GenericRelation( to='ipam.IPAddress', content_type_field='assigned_object_type', @@ -358,6 +352,7 @@ class VMInterface(ComponentModel, BaseInterface, TrackingModelMixin): class Meta(ComponentModel.Meta): verbose_name = _('interface') verbose_name_plural = _('interfaces') + ordering = ('virtual_machine', CollateAsChar('_name')) def clean(self): super().clean() @@ -416,3 +411,4 @@ class VirtualDisk(ComponentModel, TrackingModelMixin): class Meta(ComponentModel.Meta): verbose_name = _('virtual disk') verbose_name_plural = _('virtual disks') + ordering = ('virtual_machine', 'name') diff --git a/netbox/virtualization/tables/virtualmachines.py b/netbox/virtualization/tables/virtualmachines.py index 4a3138711..26d32f8cf 100644 --- a/netbox/virtualization/tables/virtualmachines.py +++ b/netbox/virtualization/tables/virtualmachines.py @@ -53,7 +53,6 @@ VMINTERFACE_BUTTONS = """ class VirtualMachineTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): name = tables.Column( verbose_name=_('Name'), - order_by=('_name',), linkify=True ) status = columns.ChoiceFieldColumn( diff --git a/netbox/vpn/migrations/0007_natural_ordering.py b/netbox/vpn/migrations/0007_natural_ordering.py new file mode 100644 index 000000000..01dd4620f --- /dev/null +++ b/netbox/vpn/migrations/0007_natural_ordering.py @@ -0,0 +1,47 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('vpn', '0006_charfield_null_choices'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterField( + model_name='ikepolicy', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='ikeproposal', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='ipsecpolicy', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='ipsecprofile', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='ipsecproposal', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='l2vpn', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + migrations.AlterField( + model_name='tunnel', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + ] diff --git a/netbox/vpn/models/crypto.py b/netbox/vpn/models/crypto.py index 2b721ec29..8e991b578 100644 --- a/netbox/vpn/models/crypto.py +++ b/netbox/vpn/models/crypto.py @@ -22,7 +22,8 @@ class IKEProposal(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) authentication_method = models.CharField( verbose_name=('authentication method'), @@ -67,7 +68,8 @@ class IKEPolicy(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) version = models.PositiveSmallIntegerField( verbose_name=_('version'), @@ -125,7 +127,8 @@ class IPSecProposal(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) encryption_algorithm = models.CharField( verbose_name=_('encryption'), @@ -176,7 +179,8 @@ class IPSecPolicy(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) proposals = models.ManyToManyField( to='vpn.IPSecProposal', @@ -211,7 +215,8 @@ class IPSecProfile(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) mode = models.CharField( verbose_name=_('mode'), diff --git a/netbox/vpn/models/l2vpn.py b/netbox/vpn/models/l2vpn.py index b799ab32d..3e562531d 100644 --- a/netbox/vpn/models/l2vpn.py +++ b/netbox/vpn/models/l2vpn.py @@ -20,7 +20,8 @@ class L2VPN(ContactsMixin, PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), diff --git a/netbox/vpn/models/tunnels.py b/netbox/vpn/models/tunnels.py index 3a0f1dc14..714024a81 100644 --- a/netbox/vpn/models/tunnels.py +++ b/netbox/vpn/models/tunnels.py @@ -31,7 +31,8 @@ class Tunnel(PrimaryModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) status = models.CharField( verbose_name=_('status'), diff --git a/netbox/wireless/migrations/0012_natural_ordering.py b/netbox/wireless/migrations/0012_natural_ordering.py new file mode 100644 index 000000000..da818bdd9 --- /dev/null +++ b/netbox/wireless/migrations/0012_natural_ordering.py @@ -0,0 +1,17 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('wireless', '0011_wirelesslan__location_wirelesslan__region_and_more'), + ('dcim', '0197_natural_sort_collation'), + ] + + operations = [ + migrations.AlterField( + model_name='wirelesslangroup', + name='name', + field=models.CharField(db_collation='natural_sort', max_length=100, unique=True), + ), + ] diff --git a/netbox/wireless/models.py b/netbox/wireless/models.py index d78c893a6..61ff72bc1 100644 --- a/netbox/wireless/models.py +++ b/netbox/wireless/models.py @@ -52,7 +52,8 @@ class WirelessLANGroup(NestedGroupModel): name = models.CharField( verbose_name=_('name'), max_length=100, - unique=True + unique=True, + db_collation="natural_sort" ) slug = models.SlugField( verbose_name=_('slug'), From 9fe6685562d0b6918c7acb6a83678bc399a3fd8a Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 15 Nov 2024 11:55:46 -0800 Subject: [PATCH 29/65] 17929 Add Scope Mixins to Prefix (#17930) * 17929 Add Scope Mixins to Prefix * 17929 Add Scope Mixins to Prefix * 17929 fixes for tests * 17929 merge latest scope changes * 12596 review changes * 12596 review changes * 12596 review changes * 12596 review changes * 12596 review changes * 12596 review changes * 17929 fix migrations --- netbox/dcim/api/serializers_/sites.py | 8 +-- netbox/dcim/base_filtersets.py | 67 ++++++++++++++++++ netbox/dcim/filtersets.py | 58 ---------------- netbox/dcim/graphql/types.py | 8 +-- netbox/dcim/models/mixins.py | 4 -- netbox/ipam/api/serializers_/ip.py | 5 +- netbox/ipam/apps.py | 2 +- netbox/ipam/constants.py | 5 -- netbox/ipam/filtersets.py | 56 +-------------- netbox/ipam/forms/bulk_edit.py | 30 +------- netbox/ipam/forms/bulk_import.py | 10 +-- netbox/ipam/forms/model_forms.py | 46 +------------ netbox/ipam/graphql/types.py | 2 +- .../0072_prefix_cached_relations.py | 14 ++-- netbox/ipam/models/ip.py | 69 +------------------ netbox/utilities/api.py | 2 +- netbox/virtualization/filtersets.py | 3 +- ...location_alter_cluster__region_and_more.py | 41 +++++++++++ ...l_ordering.py => 0047_natural_ordering.py} | 2 +- netbox/wireless/filtersets.py | 2 +- ...12_alter_wirelesslan__location_and_more.py | 41 +++++++++++ ...l_ordering.py => 0013_natural_ordering.py} | 2 +- 22 files changed, 187 insertions(+), 290 deletions(-) create mode 100644 netbox/dcim/base_filtersets.py create mode 100644 netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py rename netbox/virtualization/migrations/{0046_natural_ordering.py => 0047_natural_ordering.py} (93%) create mode 100644 netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py rename netbox/wireless/migrations/{0012_natural_ordering.py => 0013_natural_ordering.py} (82%) diff --git a/netbox/dcim/api/serializers_/sites.py b/netbox/dcim/api/serializers_/sites.py index 7cd89e38c..b818cd954 100644 --- a/netbox/dcim/api/serializers_/sites.py +++ b/netbox/dcim/api/serializers_/sites.py @@ -21,7 +21,7 @@ __all__ = ( class RegionSerializer(NestedGroupModelSerializer): parent = NestedRegionSerializer(required=False, allow_null=True, default=None) site_count = serializers.IntegerField(read_only=True, default=0) - prefix_count = RelatedObjectCountField('_prefixes') + prefix_count = RelatedObjectCountField('prefix_set') class Meta: model = Region @@ -35,7 +35,7 @@ class RegionSerializer(NestedGroupModelSerializer): class SiteGroupSerializer(NestedGroupModelSerializer): parent = NestedSiteGroupSerializer(required=False, allow_null=True, default=None) site_count = serializers.IntegerField(read_only=True, default=0) - prefix_count = RelatedObjectCountField('_prefixes') + prefix_count = RelatedObjectCountField('prefix_set') class Meta: model = SiteGroup @@ -63,7 +63,7 @@ class SiteSerializer(NetBoxModelSerializer): # Related object counts circuit_count = RelatedObjectCountField('circuit_terminations') device_count = RelatedObjectCountField('devices') - prefix_count = RelatedObjectCountField('_prefixes') + prefix_count = RelatedObjectCountField('prefix_set') rack_count = RelatedObjectCountField('racks') vlan_count = RelatedObjectCountField('vlans') virtualmachine_count = RelatedObjectCountField('virtual_machines') @@ -86,7 +86,7 @@ class LocationSerializer(NestedGroupModelSerializer): tenant = TenantSerializer(nested=True, required=False, allow_null=True) rack_count = serializers.IntegerField(read_only=True, default=0) device_count = serializers.IntegerField(read_only=True, default=0) - prefix_count = RelatedObjectCountField('_prefixes') + prefix_count = RelatedObjectCountField('prefix_set') class Meta: model = Location diff --git a/netbox/dcim/base_filtersets.py b/netbox/dcim/base_filtersets.py new file mode 100644 index 000000000..c007c0120 --- /dev/null +++ b/netbox/dcim/base_filtersets.py @@ -0,0 +1,67 @@ +import django_filters + +from django.utils.translation import gettext as _ +from netbox.filtersets import BaseFilterSet +from utilities.filters import ContentTypeFilter, TreeNodeMultipleChoiceFilter +from .models import * + +__all__ = ( + 'ScopedFilterSet', +) + + +class ScopedFilterSet(BaseFilterSet): + """ + Provides additional filtering functionality for location, site, etc.. for Scoped models. + """ + scope_type = ContentTypeFilter() + region_id = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + label=_('Region (ID)'), + ) + region = TreeNodeMultipleChoiceFilter( + queryset=Region.objects.all(), + field_name='_region', + lookup_expr='in', + to_field_name='slug', + label=_('Region (slug)'), + ) + site_group_id = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + label=_('Site group (ID)'), + ) + site_group = TreeNodeMultipleChoiceFilter( + queryset=SiteGroup.objects.all(), + field_name='_site_group', + lookup_expr='in', + to_field_name='slug', + label=_('Site group (slug)'), + ) + site_id = django_filters.ModelMultipleChoiceFilter( + queryset=Site.objects.all(), + field_name='_site', + label=_('Site (ID)'), + ) + site = django_filters.ModelMultipleChoiceFilter( + field_name='_site__slug', + queryset=Site.objects.all(), + to_field_name='slug', + label=_('Site (slug)'), + ) + location_id = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + label=_('Location (ID)'), + ) + location = TreeNodeMultipleChoiceFilter( + queryset=Location.objects.all(), + field_name='_location', + lookup_expr='in', + to_field_name='slug', + label=_('Location (slug)'), + ) diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index df66ad77b..0371f882b 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -73,7 +73,6 @@ __all__ = ( 'RearPortFilterSet', 'RearPortTemplateFilterSet', 'RegionFilterSet', - 'ScopedFilterSet', 'SiteFilterSet', 'SiteGroupFilterSet', 'VirtualChassisFilterSet', @@ -2345,60 +2344,3 @@ class InterfaceConnectionFilterSet(ConnectionFilterSet): class Meta: model = Interface fields = tuple() - - -class ScopedFilterSet(BaseFilterSet): - """ - Provides additional filtering functionality for location, site, etc.. for Scoped models. - """ - scope_type = ContentTypeFilter() - region_id = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='_region', - lookup_expr='in', - label=_('Region (ID)'), - ) - region = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='_region', - lookup_expr='in', - to_field_name='slug', - label=_('Region (slug)'), - ) - site_group_id = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='_site_group', - lookup_expr='in', - label=_('Site group (ID)'), - ) - site_group = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='_site_group', - lookup_expr='in', - to_field_name='slug', - label=_('Site group (slug)'), - ) - site_id = django_filters.ModelMultipleChoiceFilter( - queryset=Site.objects.all(), - field_name='_site', - label=_('Site (ID)'), - ) - site = django_filters.ModelMultipleChoiceFilter( - field_name='_site__slug', - queryset=Site.objects.all(), - to_field_name='slug', - label=_('Site (slug)'), - ) - location_id = TreeNodeMultipleChoiceFilter( - queryset=Location.objects.all(), - field_name='_location', - lookup_expr='in', - label=_('Location (ID)'), - ) - location = TreeNodeMultipleChoiceFilter( - queryset=Location.objects.all(), - field_name='_location', - lookup_expr='in', - to_field_name='slug', - label=_('Location (slug)'), - ) diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index fc5f35780..cc1bcac0f 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -461,7 +461,7 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi @strawberry_django.field def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: - return self._clusters.all() + return self.cluster_set.all() @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: @@ -707,7 +707,7 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): @strawberry_django.field def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: - return self._clusters.all() + return self.cluster_set.all() @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: @@ -739,7 +739,7 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje @strawberry_django.field def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: - return self._clusters.all() + return self.cluster_set.all() @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: @@ -763,7 +763,7 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): @strawberry_django.field def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]: - return self._clusters.all() + return self.cluster_set.all() @strawberry_django.field def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: diff --git a/netbox/dcim/models/mixins.py b/netbox/dcim/models/mixins.py index 1df3364c4..ac4d7dab9 100644 --- a/netbox/dcim/models/mixins.py +++ b/netbox/dcim/models/mixins.py @@ -59,28 +59,24 @@ class CachedScopeMixin(models.Model): _location = models.ForeignKey( to='dcim.Location', on_delete=models.CASCADE, - related_name='_%(class)ss', blank=True, null=True ) _site = models.ForeignKey( to='dcim.Site', on_delete=models.CASCADE, - related_name='_%(class)ss', blank=True, null=True ) _region = models.ForeignKey( to='dcim.Region', on_delete=models.CASCADE, - related_name='_%(class)ss', blank=True, null=True ) _site_group = models.ForeignKey( to='dcim.SiteGroup', on_delete=models.CASCADE, - related_name='_%(class)ss', blank=True, null=True ) diff --git a/netbox/ipam/api/serializers_/ip.py b/netbox/ipam/api/serializers_/ip.py index 0c3c141af..bfc7ac546 100644 --- a/netbox/ipam/api/serializers_/ip.py +++ b/netbox/ipam/api/serializers_/ip.py @@ -2,8 +2,9 @@ from django.contrib.contenttypes.models import ContentType from drf_spectacular.utils import extend_schema_field from rest_framework import serializers +from dcim.constants import LOCATION_SCOPE_TYPES from ipam.choices import * -from ipam.constants import IPADDRESS_ASSIGNMENT_MODELS, PREFIX_SCOPE_TYPES +from ipam.constants import IPADDRESS_ASSIGNMENT_MODELS from ipam.models import Aggregate, IPAddress, IPRange, Prefix from netbox.api.fields import ChoiceField, ContentTypeField from netbox.api.serializers import NetBoxModelSerializer @@ -47,7 +48,7 @@ class PrefixSerializer(NetBoxModelSerializer): vrf = VRFSerializer(nested=True, required=False, allow_null=True) scope_type = ContentTypeField( queryset=ContentType.objects.filter( - model__in=PREFIX_SCOPE_TYPES + model__in=LOCATION_SCOPE_TYPES ), allow_null=True, required=False, diff --git a/netbox/ipam/apps.py b/netbox/ipam/apps.py index e0463dfce..ae88d69a9 100644 --- a/netbox/ipam/apps.py +++ b/netbox/ipam/apps.py @@ -18,7 +18,7 @@ class IPAMConfig(AppConfig): # Register denormalized fields denormalized.register(Prefix, '_site', { '_region': 'region', - '_sitegroup': 'group', + '_site_group': 'group', }) denormalized.register(Prefix, '_location', { '_site': 'site', diff --git a/netbox/ipam/constants.py b/netbox/ipam/constants.py index c07b8441f..6dffd3287 100644 --- a/netbox/ipam/constants.py +++ b/netbox/ipam/constants.py @@ -23,11 +23,6 @@ VRF_RD_MAX_LENGTH = 21 PREFIX_LENGTH_MIN = 1 PREFIX_LENGTH_MAX = 127 # IPv6 -# models values for ContentTypes which may be Prefix scope types -PREFIX_SCOPE_TYPES = ( - 'region', 'sitegroup', 'site', 'location', -) - # # IPAddresses diff --git a/netbox/ipam/filtersets.py b/netbox/ipam/filtersets.py index 88c869a50..c762c15fe 100644 --- a/netbox/ipam/filtersets.py +++ b/netbox/ipam/filtersets.py @@ -1,5 +1,6 @@ import django_filters import netaddr +from dcim.base_filtersets import ScopedFilterSet from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.db.models import Q @@ -9,7 +10,7 @@ from drf_spectacular.utils import extend_schema_field from netaddr.core import AddrFormatError from circuits.models import Provider -from dcim.models import Device, Interface, Location, Region, Site, SiteGroup +from dcim.models import Device, Interface, Region, Site, SiteGroup from netbox.filtersets import ChangeLoggedModelFilterSet, OrganizationalModelFilterSet, NetBoxModelFilterSet from tenancy.filtersets import TenancyFilterSet from utilities.filters import ( @@ -273,7 +274,7 @@ class RoleFilterSet(OrganizationalModelFilterSet): fields = ('id', 'name', 'slug', 'description', 'weight') -class PrefixFilterSet(NetBoxModelFilterSet, TenancyFilterSet): +class PrefixFilterSet(NetBoxModelFilterSet, ScopedFilterSet, TenancyFilterSet): family = django_filters.NumberFilter( field_name='prefix', lookup_expr='family' @@ -334,57 +335,6 @@ class PrefixFilterSet(NetBoxModelFilterSet, TenancyFilterSet): to_field_name='rd', label=_('VRF (RD)'), ) - scope_type = ContentTypeFilter() - region_id = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='_region', - lookup_expr='in', - label=_('Region (ID)'), - ) - region = TreeNodeMultipleChoiceFilter( - queryset=Region.objects.all(), - field_name='_region', - lookup_expr='in', - to_field_name='slug', - label=_('Region (slug)'), - ) - site_group_id = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='_sitegroup', - lookup_expr='in', - label=_('Site group (ID)'), - ) - site_group = TreeNodeMultipleChoiceFilter( - queryset=SiteGroup.objects.all(), - field_name='_sitegroup', - lookup_expr='in', - to_field_name='slug', - label=_('Site group (slug)'), - ) - site_id = django_filters.ModelMultipleChoiceFilter( - queryset=Site.objects.all(), - field_name='_site', - label=_('Site (ID)'), - ) - site = django_filters.ModelMultipleChoiceFilter( - field_name='_site__slug', - queryset=Site.objects.all(), - to_field_name='slug', - label=_('Site (slug)'), - ) - location_id = TreeNodeMultipleChoiceFilter( - queryset=Location.objects.all(), - field_name='_location', - lookup_expr='in', - label=_('Location (ID)'), - ) - location = TreeNodeMultipleChoiceFilter( - queryset=Location.objects.all(), - field_name='_location', - lookup_expr='in', - to_field_name='slug', - label=_('Location (slug)'), - ) vlan_id = django_filters.ModelMultipleChoiceFilter( queryset=VLAN.objects.all(), label=_('VLAN (ID)'), diff --git a/netbox/ipam/forms/bulk_edit.py b/netbox/ipam/forms/bulk_edit.py index c323a41c1..7f3216cfd 100644 --- a/netbox/ipam/forms/bulk_edit.py +++ b/netbox/ipam/forms/bulk_edit.py @@ -3,6 +3,7 @@ from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ +from dcim.forms.mixins import ScopedBulkEditForm from dcim.models import Region, Site, SiteGroup from ipam.choices import * from ipam.constants import * @@ -205,20 +206,7 @@ class RoleBulkEditForm(NetBoxModelBulkEditForm): nullable_fields = ('description',) -class PrefixBulkEditForm(NetBoxModelBulkEditForm): - scope_type = ContentTypeChoiceField( - queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES), - widget=HTMXSelect(method='post', attrs={'hx-select': '#form_fields'}), - required=False, - label=_('Scope type') - ) - scope = DynamicModelChoiceField( - label=_('Scope'), - queryset=Site.objects.none(), # Initial queryset - required=False, - disabled=True, - selector=True - ) +class PrefixBulkEditForm(ScopedBulkEditForm, NetBoxModelBulkEditForm): vlan_group = DynamicModelChoiceField( queryset=VLANGroup.objects.all(), required=False, @@ -286,20 +274,6 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm): 'vlan', 'vrf', 'tenant', 'role', 'scope', 'description', 'comments', ) - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - if scope_type_id := get_field_value(self, 'scope_type'): - try: - scope_type = ContentType.objects.get(pk=scope_type_id) - model = scope_type.model_class() - self.fields['scope'].queryset = model.objects.all() - self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower - self.fields['scope'].disabled = False - self.fields['scope'].label = _(bettertitle(model._meta.verbose_name)) - except ObjectDoesNotExist: - pass - class IPRangeBulkEditForm(NetBoxModelBulkEditForm): vrf = DynamicModelChoiceField( diff --git a/netbox/ipam/forms/bulk_import.py b/netbox/ipam/forms/bulk_import.py index 3be4ccc59..7e1382be9 100644 --- a/netbox/ipam/forms/bulk_import.py +++ b/netbox/ipam/forms/bulk_import.py @@ -3,6 +3,7 @@ from django.contrib.contenttypes.models import ContentType from django.utils.translation import gettext_lazy as _ from dcim.models import Device, Interface, Site +from dcim.forms.mixins import ScopedImportForm from ipam.choices import * from ipam.constants import * from ipam.models import * @@ -154,7 +155,7 @@ class RoleImportForm(NetBoxModelImportForm): fields = ('name', 'slug', 'weight', 'description', 'tags') -class PrefixImportForm(NetBoxModelImportForm): +class PrefixImportForm(ScopedImportForm, NetBoxModelImportForm): vrf = CSVModelChoiceField( label=_('VRF'), queryset=VRF.objects.all(), @@ -169,11 +170,6 @@ class PrefixImportForm(NetBoxModelImportForm): to_field_name='name', help_text=_('Assigned tenant') ) - scope_type = CSVContentTypeField( - queryset=ContentType.objects.filter(model__in=PREFIX_SCOPE_TYPES), - required=False, - label=_('Scope type (app & model)') - ) vlan_group = CSVModelChoiceField( label=_('VLAN group'), queryset=VLANGroup.objects.all(), @@ -208,7 +204,7 @@ class PrefixImportForm(NetBoxModelImportForm): 'mark_utilized', 'description', 'comments', 'tags', ) labels = { - 'scope_id': 'Scope ID', + 'scope_id': _('Scope ID'), } def __init__(self, data=None, *args, **kwargs): diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index 3d0cd3dd1..56a6dc3d9 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -4,6 +4,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.utils.translation import gettext_lazy as _ from dcim.models import Device, Interface, Site +from dcim.forms.mixins import ScopedForm from ipam.choices import * from ipam.constants import * from ipam.formfields import IPNetworkFormField @@ -197,25 +198,12 @@ class RoleForm(NetBoxModelForm): ] -class PrefixForm(TenancyForm, NetBoxModelForm): +class PrefixForm(TenancyForm, ScopedForm, NetBoxModelForm): vrf = DynamicModelChoiceField( queryset=VRF.objects.all(), required=False, label=_('VRF') ) - scope_type = ContentTypeChoiceField( - queryset=ContentType.objects.filter(model__in=PREFIX_SCOPE_TYPES), - widget=HTMXSelect(), - required=False, - label=_('Scope type') - ) - scope = DynamicModelChoiceField( - label=_('Scope'), - queryset=Site.objects.none(), # Initial queryset - required=False, - disabled=True, - selector=True - ) vlan = DynamicModelChoiceField( queryset=VLAN.objects.all(), required=False, @@ -248,36 +236,6 @@ class PrefixForm(TenancyForm, NetBoxModelForm): 'tenant', 'description', 'comments', 'tags', ] - def __init__(self, *args, **kwargs): - instance = kwargs.get('instance') - initial = kwargs.get('initial', {}) - - if instance is not None and instance.scope: - initial['scope'] = instance.scope - kwargs['initial'] = initial - - super().__init__(*args, **kwargs) - - if scope_type_id := get_field_value(self, 'scope_type'): - try: - scope_type = ContentType.objects.get(pk=scope_type_id) - model = scope_type.model_class() - self.fields['scope'].queryset = model.objects.all() - self.fields['scope'].widget.attrs['selector'] = model._meta.label_lower - self.fields['scope'].disabled = False - self.fields['scope'].label = _(bettertitle(model._meta.verbose_name)) - except ObjectDoesNotExist: - pass - - if self.instance and scope_type_id != self.instance.scope_type_id: - self.initial['scope'] = None - - def clean(self): - super().clean() - - # Assign the selected scope (if any) - self.instance.scope = self.cleaned_data.get('scope') - class IPRangeForm(TenancyForm, NetBoxModelForm): vrf = DynamicModelChoiceField( diff --git a/netbox/ipam/graphql/types.py b/netbox/ipam/graphql/types.py index 2ef63cf0c..5a4813e0c 100644 --- a/netbox/ipam/graphql/types.py +++ b/netbox/ipam/graphql/types.py @@ -154,7 +154,7 @@ class IPRangeType(NetBoxObjectType): @strawberry_django.type( models.Prefix, - exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_sitegroup'), + exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'), filters=PrefixFilter ) class PrefixType(NetBoxObjectType, BaseIPAddressFamilyType): diff --git a/netbox/ipam/migrations/0072_prefix_cached_relations.py b/netbox/ipam/migrations/0072_prefix_cached_relations.py index 2b457ebda..4b438f7d5 100644 --- a/netbox/ipam/migrations/0072_prefix_cached_relations.py +++ b/netbox/ipam/migrations/0072_prefix_cached_relations.py @@ -11,11 +11,11 @@ def populate_denormalized_fields(apps, schema_editor): prefixes = Prefix.objects.filter(site__isnull=False).prefetch_related('site') for prefix in prefixes: prefix._region_id = prefix.site.region_id - prefix._sitegroup_id = prefix.site.group_id + prefix._site_group_id = prefix.site.group_id prefix._site_id = prefix.site_id # Note: Location cannot be set prior to migration - Prefix.objects.bulk_update(prefixes, ['_region', '_sitegroup', '_site']) + Prefix.objects.bulk_update(prefixes, ['_region', '_site_group', '_site']) class Migration(migrations.Migration): @@ -29,22 +29,22 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prefix', name='_location', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_prefixes', to='dcim.location'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location'), ), migrations.AddField( model_name='prefix', name='_region', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_prefixes', to='dcim.region'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.region'), ), migrations.AddField( model_name='prefix', name='_site', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_prefixes', to='dcim.site'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.site'), ), migrations.AddField( model_name='prefix', - name='_sitegroup', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_prefixes', to='dcim.sitegroup'), + name='_site_group', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.sitegroup'), ), # Populate denormalized FK values diff --git a/netbox/ipam/models/ip.py b/netbox/ipam/models/ip.py index b17e26169..dcecbcdea 100644 --- a/netbox/ipam/models/ip.py +++ b/netbox/ipam/models/ip.py @@ -1,5 +1,4 @@ import netaddr -from django.apps import apps from django.contrib.contenttypes.fields import GenericForeignKey from django.core.exceptions import ValidationError from django.db import models @@ -9,6 +8,7 @@ from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ from core.models import ObjectType +from dcim.models.mixins import CachedScopeMixin from ipam.choices import * from ipam.constants import * from ipam.fields import IPNetworkField, IPAddressField @@ -198,7 +198,7 @@ class Role(OrganizationalModel): return self.name -class Prefix(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): +class Prefix(ContactsMixin, GetAvailablePrefixesMixin, CachedScopeMixin, PrimaryModel): """ A Prefix represents an IPv4 or IPv6 network, including mask length. Prefixes can optionally be scoped to certain areas and/or assigned to VRFs. A Prefix must be assigned a status and may optionally be assigned a used-define Role. @@ -208,22 +208,6 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): verbose_name=_('prefix'), help_text=_('IPv4 or IPv6 network with mask') ) - scope_type = models.ForeignKey( - to='contenttypes.ContentType', - on_delete=models.PROTECT, - limit_choices_to=Q(model__in=PREFIX_SCOPE_TYPES), - related_name='+', - blank=True, - null=True - ) - scope_id = models.PositiveBigIntegerField( - blank=True, - null=True - ) - scope = GenericForeignKey( - ct_field='scope_type', - fk_field='scope_id' - ) vrf = models.ForeignKey( to='ipam.VRF', on_delete=models.PROTECT, @@ -272,36 +256,6 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): help_text=_("Treat as fully utilized") ) - # Cached associations to enable efficient filtering - _location = models.ForeignKey( - to='dcim.Location', - on_delete=models.CASCADE, - related_name='_prefixes', - blank=True, - null=True - ) - _site = models.ForeignKey( - to='dcim.Site', - on_delete=models.CASCADE, - related_name='_prefixes', - blank=True, - null=True - ) - _region = models.ForeignKey( - to='dcim.Region', - on_delete=models.CASCADE, - related_name='_prefixes', - blank=True, - null=True - ) - _sitegroup = models.ForeignKey( - to='dcim.SiteGroup', - on_delete=models.CASCADE, - related_name='_prefixes', - blank=True, - null=True - ) - # Cached depth & child counts _depth = models.PositiveSmallIntegerField( default=0, @@ -368,25 +322,6 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): super().save(*args, **kwargs) - def cache_related_objects(self): - self._region = self._sitegroup = self._site = self._location = None - if self.scope_type: - scope_type = self.scope_type.model_class() - if scope_type == apps.get_model('dcim', 'region'): - self._region = self.scope - elif scope_type == apps.get_model('dcim', 'sitegroup'): - self._sitegroup = self.scope - elif scope_type == apps.get_model('dcim', 'site'): - self._region = self.scope.region - self._sitegroup = self.scope.group - self._site = self.scope - elif scope_type == apps.get_model('dcim', 'location'): - self._region = self.scope.site.region - self._sitegroup = self.scope.site.group - self._site = self.scope.site - self._location = self.scope - cache_related_objects.alters_data = True - @property def family(self): return self.prefix.version if self.prefix else None diff --git a/netbox/utilities/api.py b/netbox/utilities/api.py index 11b914811..6793c0526 100644 --- a/netbox/utilities/api.py +++ b/netbox/utilities/api.py @@ -129,7 +129,7 @@ def get_annotations_for_serializer(serializer_class, fields_to_include=None): for field_name, field in serializer_class._declared_fields.items(): if field_name in fields_to_include and type(field) is RelatedObjectCountField: - related_field = model._meta.get_field(field.relation).field + related_field = getattr(model, field.relation).field annotations[field_name] = count_related(related_field.model, related_field.name) return annotations diff --git a/netbox/virtualization/filtersets.py b/netbox/virtualization/filtersets.py index ac72bea12..ab25492b5 100644 --- a/netbox/virtualization/filtersets.py +++ b/netbox/virtualization/filtersets.py @@ -2,7 +2,8 @@ import django_filters from django.db.models import Q from django.utils.translation import gettext as _ -from dcim.filtersets import CommonInterfaceFilterSet, ScopedFilterSet +from dcim.filtersets import CommonInterfaceFilterSet +from dcim.base_filtersets import ScopedFilterSet from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup from extras.filtersets import LocalConfigContextFilterSet from extras.models import ConfigTemplate diff --git a/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py b/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py new file mode 100644 index 000000000..7b1168da0 --- /dev/null +++ b/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py @@ -0,0 +1,41 @@ +# Generated by Django 5.0.9 on 2024-11-14 19:04 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0196_qinq_svlan'), + ('virtualization', '0045_clusters_cached_relations'), + ] + + operations = [ + migrations.AlterField( + model_name='cluster', + name='_location', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location' + ), + ), + migrations.AlterField( + model_name='cluster', + name='_region', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.region' + ), + ), + migrations.AlterField( + model_name='cluster', + name='_site', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.site'), + ), + migrations.AlterField( + model_name='cluster', + name='_site_group', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.sitegroup' + ), + ), + ] diff --git a/netbox/virtualization/migrations/0046_natural_ordering.py b/netbox/virtualization/migrations/0047_natural_ordering.py similarity index 93% rename from netbox/virtualization/migrations/0046_natural_ordering.py rename to netbox/virtualization/migrations/0047_natural_ordering.py index 9284b6331..4454cfe2d 100644 --- a/netbox/virtualization/migrations/0046_natural_ordering.py +++ b/netbox/virtualization/migrations/0047_natural_ordering.py @@ -4,7 +4,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('virtualization', '0045_clusters_cached_relations'), + ('virtualization', '0046_alter_cluster__location_alter_cluster__region_and_more'), ('dcim', '0197_natural_sort_collation'), ] diff --git a/netbox/wireless/filtersets.py b/netbox/wireless/filtersets.py index 5a4195e6c..cc5aefbd8 100644 --- a/netbox/wireless/filtersets.py +++ b/netbox/wireless/filtersets.py @@ -2,7 +2,7 @@ import django_filters from django.db.models import Q from dcim.choices import LinkStatusChoices -from dcim.filtersets import ScopedFilterSet +from dcim.base_filtersets import ScopedFilterSet from dcim.models import Interface from ipam.models import VLAN from netbox.filtersets import OrganizationalModelFilterSet, NetBoxModelFilterSet diff --git a/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py b/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py new file mode 100644 index 000000000..7edaff92b --- /dev/null +++ b/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py @@ -0,0 +1,41 @@ +# Generated by Django 5.0.9 on 2024-11-14 19:04 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0196_qinq_svlan'), + ('wireless', '0011_wirelesslan__location_wirelesslan__region_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='wirelesslan', + name='_location', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location' + ), + ), + migrations.AlterField( + model_name='wirelesslan', + name='_region', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.region' + ), + ), + migrations.AlterField( + model_name='wirelesslan', + name='_site', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.site'), + ), + migrations.AlterField( + model_name='wirelesslan', + name='_site_group', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.sitegroup' + ), + ), + ] diff --git a/netbox/wireless/migrations/0012_natural_ordering.py b/netbox/wireless/migrations/0013_natural_ordering.py similarity index 82% rename from netbox/wireless/migrations/0012_natural_ordering.py rename to netbox/wireless/migrations/0013_natural_ordering.py index da818bdd9..e33c87c60 100644 --- a/netbox/wireless/migrations/0012_natural_ordering.py +++ b/netbox/wireless/migrations/0013_natural_ordering.py @@ -4,7 +4,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('wireless', '0011_wirelesslan__location_wirelesslan__region_and_more'), + ('wireless', '0012_alter_wirelesslan__location_and_more'), ('dcim', '0197_natural_sort_collation'), ] From b4f15092dbb849ee85fd2dd8caf988ea4bd7eadb Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 18 Nov 2024 14:44:57 -0500 Subject: [PATCH 30/65] Closes #5858: Implement a quick-add UI widget for related objects (#18016) * WIP * Misc cleanup * Add warning re: nested quick-adds --- netbox/circuits/forms/model_forms.py | 14 +++-- netbox/dcim/forms/model_forms.py | 21 +++++--- netbox/ipam/forms/model_forms.py | 14 +++-- netbox/netbox/views/generic/object_views.py | 41 +++++++++++---- netbox/project-static/dist/netbox.js | Bin 390388 -> 390918 bytes netbox/project-static/dist/netbox.js.map | Bin 527142 -> 527957 bytes netbox/project-static/src/buttons/reslug.ts | 48 +++++++++--------- netbox/project-static/src/htmx.ts | 11 ++-- netbox/project-static/src/quickAdd.ts | 39 ++++++++++++++ netbox/templates/htmx/quick_add.html | 28 ++++++++++ netbox/templates/htmx/quick_add_created.html | 22 ++++++++ netbox/tenancy/forms/forms.py | 1 + netbox/utilities/forms/fields/dynamic.py | 12 ++++- .../templates/widgets/apiselect.html | 27 +++++++--- netbox/virtualization/forms/model_forms.py | 6 ++- netbox/vpn/forms/model_forms.py | 9 ++-- netbox/wireless/forms/model_forms.py | 3 +- 17 files changed, 228 insertions(+), 68 deletions(-) create mode 100644 netbox/project-static/src/quickAdd.ts create mode 100644 netbox/templates/htmx/quick_add.html create mode 100644 netbox/templates/htmx/quick_add_created.html diff --git a/netbox/circuits/forms/model_forms.py b/netbox/circuits/forms/model_forms.py index 10cd06563..9eeb0f588 100644 --- a/netbox/circuits/forms/model_forms.py +++ b/netbox/circuits/forms/model_forms.py @@ -50,7 +50,9 @@ class ProviderForm(NetBoxModelForm): class ProviderAccountForm(NetBoxModelForm): provider = DynamicModelChoiceField( label=_('Provider'), - queryset=Provider.objects.all() + queryset=Provider.objects.all(), + selector=True, + quick_add=True ) comments = CommentField() @@ -64,7 +66,9 @@ class ProviderAccountForm(NetBoxModelForm): class ProviderNetworkForm(NetBoxModelForm): provider = DynamicModelChoiceField( label=_('Provider'), - queryset=Provider.objects.all() + queryset=Provider.objects.all(), + selector=True, + quick_add=True ) comments = CommentField() @@ -97,7 +101,8 @@ class CircuitForm(TenancyForm, NetBoxModelForm): provider = DynamicModelChoiceField( label=_('Provider'), queryset=Provider.objects.all(), - selector=True + selector=True, + quick_add=True ) provider_account = DynamicModelChoiceField( label=_('Provider account'), @@ -108,7 +113,8 @@ class CircuitForm(TenancyForm, NetBoxModelForm): } ) type = DynamicModelChoiceField( - queryset=CircuitType.objects.all() + queryset=CircuitType.objects.all(), + quick_add=True ) comments = CommentField() diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 2fcdbe5fd..b004798af 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -112,12 +112,14 @@ class SiteForm(TenancyForm, NetBoxModelForm): region = DynamicModelChoiceField( label=_('Region'), queryset=Region.objects.all(), - required=False + required=False, + quick_add=True ) group = DynamicModelChoiceField( label=_('Group'), queryset=SiteGroup.objects.all(), - required=False + required=False, + quick_add=True ) asns = DynamicModelMultipleChoiceField( queryset=ASN.objects.all(), @@ -206,7 +208,8 @@ class RackRoleForm(NetBoxModelForm): class RackTypeForm(NetBoxModelForm): manufacturer = DynamicModelChoiceField( label=_('Manufacturer'), - queryset=Manufacturer.objects.all() + queryset=Manufacturer.objects.all(), + quick_add=True ) comments = CommentField() slug = SlugField( @@ -348,7 +351,8 @@ class ManufacturerForm(NetBoxModelForm): class DeviceTypeForm(NetBoxModelForm): manufacturer = DynamicModelChoiceField( label=_('Manufacturer'), - queryset=Manufacturer.objects.all() + queryset=Manufacturer.objects.all(), + quick_add=True ) default_platform = DynamicModelChoiceField( label=_('Default platform'), @@ -436,7 +440,8 @@ class PlatformForm(NetBoxModelForm): manufacturer = DynamicModelChoiceField( label=_('Manufacturer'), queryset=Manufacturer.objects.all(), - required=False + required=False, + quick_add=True ) config_template = DynamicModelChoiceField( label=_('Config template'), @@ -508,7 +513,8 @@ class DeviceForm(TenancyForm, NetBoxModelForm): ) role = DynamicModelChoiceField( label=_('Device role'), - queryset=DeviceRole.objects.all() + queryset=DeviceRole.objects.all(), + quick_add=True ) platform = DynamicModelChoiceField( label=_('Platform'), @@ -750,7 +756,8 @@ class PowerFeedForm(TenancyForm, NetBoxModelForm): power_panel = DynamicModelChoiceField( label=_('Power panel'), queryset=PowerPanel.objects.all(), - selector=True + selector=True, + quick_add=True ) rack = DynamicModelChoiceField( label=_('Rack'), diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index 56a6dc3d9..53ffe8f3f 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -109,7 +109,8 @@ class RIRForm(NetBoxModelForm): class AggregateForm(TenancyForm, NetBoxModelForm): rir = DynamicModelChoiceField( queryset=RIR.objects.all(), - label=_('RIR') + label=_('RIR'), + quick_add=True ) comments = CommentField() @@ -132,6 +133,7 @@ class ASNRangeForm(TenancyForm, NetBoxModelForm): rir = DynamicModelChoiceField( queryset=RIR.objects.all(), label=_('RIR'), + quick_add=True ) slug = SlugField() fieldsets = ( @@ -150,6 +152,7 @@ class ASNForm(TenancyForm, NetBoxModelForm): rir = DynamicModelChoiceField( queryset=RIR.objects.all(), label=_('RIR'), + quick_add=True ) sites = DynamicModelMultipleChoiceField( queryset=Site.objects.all(), @@ -216,7 +219,8 @@ class PrefixForm(TenancyForm, ScopedForm, NetBoxModelForm): role = DynamicModelChoiceField( label=_('Role'), queryset=Role.objects.all(), - required=False + required=False, + quick_add=True ) comments = CommentField() @@ -246,7 +250,8 @@ class IPRangeForm(TenancyForm, NetBoxModelForm): role = DynamicModelChoiceField( label=_('Role'), queryset=Role.objects.all(), - required=False + required=False, + quick_add=True ) comments = CommentField() @@ -639,7 +644,8 @@ class VLANForm(TenancyForm, NetBoxModelForm): role = DynamicModelChoiceField( label=_('Role'), queryset=Role.objects.all(), - required=False + required=False, + quick_add=True ) qinq_svlan = DynamicModelChoiceField( label=_('Q-in-Q SVLAN'), diff --git a/netbox/netbox/views/generic/object_views.py b/netbox/netbox/views/generic/object_views.py index 0686e52b7..fb554ca4f 100644 --- a/netbox/netbox/views/generic/object_views.py +++ b/netbox/netbox/views/generic/object_views.py @@ -233,18 +233,23 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView): form = self.form(instance=obj, initial=initial_data) restrict_form_fields(form, request.user) - # If this is an HTMX request, return only the rendered form HTML - if htmx_partial(request): - return render(request, self.htmx_template_name, { - 'model': model, - 'object': obj, - 'form': form, - }) - - return render(request, self.template_name, { + context = { 'model': model, 'object': obj, 'form': form, + } + + # If the form is being displayed within a "quick add" widget, + # use the appropriate template + if request.GET.get('_quickadd'): + return render(request, 'htmx/quick_add.html', context) + + # If this is an HTMX request, return only the rendered form HTML + if htmx_partial(request): + return render(request, self.htmx_template_name, context) + + return render(request, self.template_name, { + **context, 'return_url': self.get_return_url(request, obj), 'prerequisite_model': get_prerequisite_model(self.queryset), **self.get_extra_context(request, obj), @@ -259,6 +264,7 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView): """ logger = logging.getLogger('netbox.views.ObjectEditView') obj = self.get_object(**kwargs) + model = self.queryset.model # Take a snapshot for change logging (if editing an existing object) if obj.pk and hasattr(obj, 'snapshot'): @@ -292,6 +298,12 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView): msg = f'{msg} {obj}' messages.success(request, msg) + # Object was created via "quick add" modal + if '_quickadd' in request.POST: + return render(request, 'htmx/quick_add_created.html', { + 'object': obj, + }) + # If adding another object, redirect back to the edit form if '_addanother' in request.POST: redirect_url = request.path @@ -324,12 +336,19 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView): else: logger.debug("Form validation failed") - return render(request, self.template_name, { + context = { + 'model': model, 'object': obj, 'form': form, 'return_url': self.get_return_url(request, obj), **self.get_extra_context(request, obj), - }) + } + + # Form was submitted via a "quick add" widget + if '_quickadd' in request.POST: + return render(request, 'htmx/quick_add.html', context) + + return render(request, self.template_name, context) class ObjectDeleteView(GetReturnURLMixin, BaseObjectView): diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index 969d5c73a704424190120ac1a6c96af13085b025..5e24ee6250e4ad778886c374c7ca972faf2e3ce6 100644 GIT binary patch delta 9318 zcmZ{Kdwf*ong8c~-We_dLLedG8j>M|88`{yswNEAB$Gfcgakr@5GFGxGY96Dxh0bj z(V_@cML>B_D=OVq+p1vM^GnHWtdn_GO^qpmLvEY!9C8=Sn36c;E;#f= zsqh|pt4j17v58Np$A9D%G4seGDj4bZ+ciz`9BH9L!hhsHX@f`{St{#A;K;SIc6``x z_ZkBnj>^Fy#ed`_c|bIs-fk(qL%5FIcz4NIm*yBux}!ziA*btzes?3-*5kAA>o{JC zU+?jy_`U1+T>L(Be5P=ne(QL_bP!+uq&C;3IlWqWJn9a`w73=yITY9F_Q!V@VARVm zEFXm?|Fs!Y#Lm-;KmDI9(Qvx#tIa|*+`d=5EE@D}Lj1T$?9?aN#Cy|0f3aLtN=wwQ z#JF;`_(;Uqu}0WLRBu=#4vVD?v2raGQloWkjSWtlO=;Ea4Kbxzb0{rZc}$JRwU94X z?$><&0RG~orS|riy@B&;M3rdZ^);d~&zvHrM&qm1o^VvPH-wZ1{gE2cf=%htC4RdS z+xgv%;+pA@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Jx z<#xlmlW&tvBil00%CA}h?^UBxZ@NWpHO7J5m>qr!IsWIj0iLS(*?n?b_E{-au446e zS&}39(c5L?=qkg)N~{aAUy^KzUa(*OUJPH7F}{3X;#adc2$`Do9S7wgBg5W%hin+o zjJQ{-`Hef|Sg_9Dfq<#w8F$Jb7!ly}?(r)}h-yXE1+mVbdT{KDM;^<`|mM^=nn`Bg2gZ{hlTF6}T+n41$dlfX!!TL-8}c*b6Zn*gmZ7DV#)KorCnj1(>no}( z%~P@Fy+O+w4Er=_`4C{N|8BEonzhjWul6({W~m&#)YQsFq)uvCqz=a{OQFQ0G0S>x zk6A{cU$WI==p0XqIKI`gF$<$Eu~{D+w=_#Ux+Z0rJ` zgA^xPUK&`Z5_!6-nK4f=NapW5vvV7;4J*dgK)aubH?ftgSSF|_}*unWhQWp z=hN?4uNu&9viX^_)?%LjuJuOTnLqum^|!>8XRP`B@cY(c?9_C`H{Q1{K!5B9))XY( z_kpz{`(!!xHRwa@W+SxHA6c(nUT50lvT#`OPo`Vn5K^{;l;)7Ku1o0&DUG2GPECV= z7lU368XsX^I%^q!aMDi(aO7j_;9)B=mknsmMnC>d!1_2PgFL)ajx>-pGprTEE={EI z=bu;?j8=n6GWgX+)|$t&zTuqJW?UU#`>Az`Rl~wAb74MmH7;E={nwvbD=hy9;IP`3 diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map index 0f4ac63d3d6199f281667fc18788c7e456278a22..a05e8edb51d286b535fab2371e7b9ad18b49d4b0 100644 GIT binary patch delta 1286 zcmZWpJ#W)s5LSw*jTrb+DX0ulr3}zlR2@J9!Ek=#q-ij&6@_4glsd7Sx^E9>&(c>DM!yUQGD~Q@^N4T)TA&0no<-27IfhQ_`(1v3JLPHAxZ!y z=d1!%)I=G>Ivq=#v@rmtsDKRhNwJfsin3@Tv#0`8ky0))Pf1dl%di3AUZ!w0##Mz& z6?|iyL2S+C6sHAX88oL&H#!+%p34HA>&6^48W}md`4XXBycvx=i74PS@$sIrlqtj) zhRTe(N(FW$UKlFb%xe5-sNA?*q*#>S_gO?HPRmtf+Gu)s*0l9)Lb)Iwm3f&BzHvGbaV$bal? z^3JO9!J0C=!c+Oly0Ak(WxJEM?7t4he@4Rw@#7hFae!O5pt!9Ad1NJ9=2fF?B*$Qh zXyuB)x2z&b>r=D@=wu|j8ly08FJlxclnN8ecweZL3{5<9032djV&Ma{414(G@@7hl z&2O10sJcL;E@AqTSY?4RCYex1ps`M9TqPLRWOF;bxhSaOR}Lx;olApOwwx4V?W#|w@L2vG)GX?(ktaEW(*0i}eI8x8YZ#3<`c2XLDIHz47ebuza F)E}CVZ*>3w delta 593 zcmYjNO-lk%6h)nKC>NEq5DG+a_dp_|O%ZqAjFZYVO(tTrF@4C8jN+)ZF+nF>w{bQt zBeyMrS@#2?RkZ2{v})b1_ugc>xR=ZQIOp8+ejk4v$DeA+VJ|uAB?B~qG(ui4DZHEq zTJFI>c<5&UG>lY$63PSQ5dk26r2yW=d{mwr82|>NBTHsS85!jODoCSU%t}HN?qZ~a zl1Bg7#WY(kpfW(&PZS}ARiyUW^^BO}XflQ89H7uj+3|@udQD;+8p43DCB&t$3uI#e z8#7r=nQFmlx}m^~-;}a*0*U}dw%d|($bB0Mc=OPo8h|grFDb0SZw%c{IYK;;b&nlk zV~vX`@PDV{8%Ib4ad$Lv1R4w8#992j>u*cI|5BKWD~U-?amhvgi9s9i=Pvh{_)hcO zkftr_M2Sh=QjeIf9Q*5(CQawyIs-SS;M_)2;vM%g7G4jWd4pJZ|2djANxhmt@q}IP z)TB('button#reslug')) { + const form = slugButton.form; + if (form == null) continue; + const slugField = form.querySelector('#id_slug') as HTMLInputElement; + if (slugField == null) continue; + const sourceId = slugField.getAttribute('slug-source'); + const sourceField = form.querySelector(`#id_${sourceId}`) as HTMLInputElement; - if (sourceField === null) { - console.error('Unable to find field for slug field.'); - return; - } + const slugLengthAttr = slugField.getAttribute('maxlength'); + let slugLength = 50; - const slugLengthAttr = slugField.getAttribute('maxlength'); - let slugLength = 50; - - if (slugLengthAttr) { - slugLength = Number(slugLengthAttr); - } - sourceField.addEventListener('blur', () => { - if (!slugField.value) { - slugField.value = slugify(sourceField.value, slugLength); + if (slugLengthAttr) { + slugLength = Number(slugLengthAttr); } - }); - slugButton.addEventListener('click', () => { - slugField.value = slugify(sourceField.value, slugLength); - }); + sourceField.addEventListener('blur', () => { + if (!slugField.value) { + slugField.value = slugify(sourceField.value, slugLength); + } + }); + slugButton.addEventListener('click', () => { + slugField.value = slugify(sourceField.value, slugLength); + }); + } } diff --git a/netbox/project-static/src/htmx.ts b/netbox/project-static/src/htmx.ts index f4092036b..6a772011b 100644 --- a/netbox/project-static/src/htmx.ts +++ b/netbox/project-static/src/htmx.ts @@ -4,11 +4,16 @@ import { initSelects } from './select'; import { initObjectSelector } from './objectSelector'; import { initBootstrap } from './bs'; import { initMessages } from './messages'; +import { initQuickAdd } from './quickAdd'; function initDepedencies(): void { - for (const init of [initButtons, initClipboard, initSelects, initObjectSelector, initBootstrap, initMessages]) { - init(); - } + initButtons(); + initClipboard(); + initSelects(); + initObjectSelector(); + initQuickAdd(); + initBootstrap(); + initMessages(); } /** diff --git a/netbox/project-static/src/quickAdd.ts b/netbox/project-static/src/quickAdd.ts new file mode 100644 index 000000000..e038f5d19 --- /dev/null +++ b/netbox/project-static/src/quickAdd.ts @@ -0,0 +1,39 @@ +import { Modal } from 'bootstrap'; + +function handleQuickAddObject(): void { + const quick_add = document.getElementById('quick-add-object'); + if (quick_add == null) return; + + const object_id = quick_add.getAttribute('data-object-id'); + if (object_id == null) return; + const object_repr = quick_add.getAttribute('data-object-repr'); + if (object_repr == null) return; + + const target_id = quick_add.getAttribute('data-target-id'); + if (target_id == null) return; + const target = document.getElementById(target_id); + if (target == null) return; + + //@ts-expect-error tomselect added on init + target.tomselect.addOption({ + id: object_id, + display: object_repr, + }); + //@ts-expect-error tomselect added on init + target.tomselect.addItem(object_id); + + const modal_element = document.getElementById('htmx-modal'); + if (modal_element) { + const modal = Modal.getInstance(modal_element); + if (modal) { + modal.hide(); + } + } +} + +export function initQuickAdd(): void { + const quick_add_modal = document.getElementById('htmx-modal-content'); + if (quick_add_modal) { + quick_add_modal.addEventListener('htmx:afterSwap', () => handleQuickAddObject()); + } +} diff --git a/netbox/templates/htmx/quick_add.html b/netbox/templates/htmx/quick_add.html new file mode 100644 index 000000000..9473e14a1 --- /dev/null +++ b/netbox/templates/htmx/quick_add.html @@ -0,0 +1,28 @@ +{% load form_helpers %} +{% load helpers %} +{% load i18n %} + + + diff --git a/netbox/templates/htmx/quick_add_created.html b/netbox/templates/htmx/quick_add_created.html new file mode 100644 index 000000000..3b1a24c48 --- /dev/null +++ b/netbox/templates/htmx/quick_add_created.html @@ -0,0 +1,22 @@ +{% load form_helpers %} +{% load helpers %} +{% load i18n %} + + + diff --git a/netbox/tenancy/forms/forms.py b/netbox/tenancy/forms/forms.py index 114253e7a..0edb36348 100644 --- a/netbox/tenancy/forms/forms.py +++ b/netbox/tenancy/forms/forms.py @@ -25,6 +25,7 @@ class TenancyForm(forms.Form): label=_('Tenant'), queryset=Tenant.objects.all(), required=False, + quick_add=True, query_params={ 'group_id': '$tenant_group' } diff --git a/netbox/utilities/forms/fields/dynamic.py b/netbox/utilities/forms/fields/dynamic.py index 6666c0e4d..13d5ffc70 100644 --- a/netbox/utilities/forms/fields/dynamic.py +++ b/netbox/utilities/forms/fields/dynamic.py @@ -2,7 +2,7 @@ import django_filters from django import forms from django.conf import settings from django.forms import BoundField -from django.urls import reverse +from django.urls import reverse, reverse_lazy from utilities.forms import widgets from utilities.views import get_viewname @@ -66,6 +66,8 @@ class DynamicModelChoiceMixin: choice (DEPRECATED: pass `context={'disabled': '$fieldname'}` instead) context: A mapping of
+ {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% plugin_left_page object %} + +
+ {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
+ +
+
+ {% plugin_full_width_page object %} +
+
+{% endblock %} diff --git a/netbox/templates/virtualization/vminterface.html b/netbox/templates/virtualization/vminterface.html index 13cc8aa2f..88c9379cf 100644 --- a/netbox/templates/virtualization/vminterface.html +++ b/netbox/templates/virtualization/vminterface.html @@ -14,73 +14,85 @@ {% block content %}
-
-

{% trans "Interface" %}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% trans "Virtual Machine" %}{{ object.virtual_machine|linkify }}
{% trans "Name" %}{{ object.name }}
{% trans "Enabled" %} - {% if object.enabled %} - - {% else %} - - {% endif %} -
{% trans "Parent" %}{{ object.parent|linkify|placeholder }}
{% trans "Bridge" %}{{ object.bridge|linkify|placeholder }}
{% trans "VRF" %}{{ object.vrf|linkify|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
{% trans "MTU" %}{{ object.mtu|placeholder }}
{% trans "MAC Address" %}{{ object.mac_address|placeholder }}
{% trans "802.1Q Mode" %}{{ object.get_mode_display|placeholder }}
{% trans "Tunnel" %}{{ object.tunnel_termination.tunnel|linkify|placeholder }}
{% trans "VLAN Translation" %}{{ object.vlan_translation_policy|linkify|placeholder }}
-
- {% include 'inc/panels/tags.html' %} - {% plugin_left_page object %} +
+

{% trans "Interface" %}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{% trans "Virtual Machine" %}{{ object.virtual_machine|linkify }}
{% trans "Name" %}{{ object.name }}
{% trans "Enabled" %} + {% if object.enabled %} + + {% else %} + + {% endif %} +
{% trans "Parent" %}{{ object.parent|linkify|placeholder }}
{% trans "Bridge" %}{{ object.bridge|linkify|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
{% trans "MTU" %}{{ object.mtu|placeholder }}
{% trans "802.1Q Mode" %}{{ object.get_mode_display|placeholder }}
{% trans "Tunnel" %}{{ object.tunnel_termination.tunnel|linkify|placeholder }}
-
- {% include 'inc/panels/custom_fields.html' %} - {% include 'ipam/inc/panels/fhrp_groups.html' %} - {% plugin_right_page object %} + {% include 'inc/panels/tags.html' %} + {% plugin_left_page object %} +
+
+ {% include 'inc/panels/custom_fields.html' %} +
+

{% trans "Addressing" %}

+ + + + + + + + + + + + + +
{% trans "MAC Address" %} + {% if object.mac_address %} + {{ object.mac_address }} + {% trans "Primary" %} + {% else %} + {{ ''|placeholder }} + {% endif %} +
{% trans "VRF" %}{{ object.vrf|linkify|placeholder }}
{% trans "VLAN Translation" %}{{ object.vlan_translation_policy|linkify|placeholder }}
+ {% include 'ipam/inc/panels/fhrp_groups.html' %} + {% plugin_right_page object %} +
@@ -99,6 +111,24 @@
+
+
+
+

+ {% trans "MAC Addresses" %} + {% if perms.ipam.add_macaddress %} + + {% endif %} +

+ {% htmx_table 'dcim:macaddress_list' vminterface_id=object.pk %} +
+
+
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %} diff --git a/netbox/utilities/tests/test_filters.py b/netbox/utilities/tests/test_filters.py index 53e6eb985..031f31a12 100644 --- a/netbox/utilities/tests/test_filters.py +++ b/netbox/utilities/tests/test_filters.py @@ -9,7 +9,7 @@ from dcim.choices import * from dcim.fields import MACAddressField from dcim.filtersets import DeviceFilterSet, SiteFilterSet, InterfaceFilterSet from dcim.models import ( - Device, DeviceRole, DeviceType, Interface, Manufacturer, Platform, Rack, Region, Site + Device, DeviceRole, DeviceType, Interface, MACAddress, Manufacturer, Platform, Rack, Region, Site ) from extras.filters import TagFilter from extras.models import TaggedItem @@ -433,16 +433,33 @@ class DynamicFilterLookupExpressionTest(TestCase): ) Device.objects.bulk_create(devices) + mac_addresses = ( + MACAddress(mac_address='00-00-00-00-00-01'), + MACAddress(mac_address='aa-00-00-00-00-01'), + MACAddress(mac_address='00-00-00-00-00-02'), + MACAddress(mac_address='bb-00-00-00-00-02'), + MACAddress(mac_address='00-00-00-00-00-03'), + MACAddress(mac_address='cc-00-00-00-00-03'), + ) + MACAddress.objects.bulk_create(mac_addresses) + interfaces = ( - Interface(device=devices[0], name='Interface 1', mac_address='00-00-00-00-00-01'), - Interface(device=devices[0], name='Interface 2', mac_address='aa-00-00-00-00-01'), - Interface(device=devices[1], name='Interface 3', mac_address='00-00-00-00-00-02'), - Interface(device=devices[1], name='Interface 4', mac_address='bb-00-00-00-00-02'), - Interface(device=devices[2], name='Interface 5', mac_address='00-00-00-00-00-03'), - Interface(device=devices[2], name='Interface 6', mac_address='cc-00-00-00-00-03', rf_role=WirelessRoleChoices.ROLE_AP), + Interface(device=devices[0], name='Interface 1'), + Interface(device=devices[0], name='Interface 2'), + Interface(device=devices[1], name='Interface 3'), + Interface(device=devices[1], name='Interface 4'), + Interface(device=devices[2], name='Interface 5'), + Interface(device=devices[2], name='Interface 6', rf_role=WirelessRoleChoices.ROLE_AP), ) Interface.objects.bulk_create(interfaces) + interfaces[0].mac_addresses.set([mac_addresses[0]]) + interfaces[1].mac_addresses.set([mac_addresses[1]]) + interfaces[2].mac_addresses.set([mac_addresses[2]]) + interfaces[3].mac_addresses.set([mac_addresses[3]]) + interfaces[4].mac_addresses.set([mac_addresses[4]]) + interfaces[5].mac_addresses.set([mac_addresses[5]]) + def test_site_name_negation(self): params = {'name__n': ['Site 1']} self.assertEqual(SiteFilterSet(params, Site.objects.all()).qs.count(), 2) diff --git a/netbox/virtualization/api/serializers_/virtualmachines.py b/netbox/virtualization/api/serializers_/virtualmachines.py index 9b7000def..dfc205b7c 100644 --- a/netbox/virtualization/api/serializers_/virtualmachines.py +++ b/netbox/virtualization/api/serializers_/virtualmachines.py @@ -2,6 +2,7 @@ from drf_spectacular.utils import extend_schema_field from rest_framework import serializers from dcim.api.serializers_.devices import DeviceSerializer +from dcim.api.serializers_.device_components import MACAddressSerializer from dcim.api.serializers_.platforms import PlatformSerializer from dcim.api.serializers_.roles import DeviceRoleSerializer from dcim.api.serializers_.sites import SiteSerializer @@ -95,19 +96,18 @@ class VMInterfaceSerializer(NetBoxModelSerializer): l2vpn_termination = L2VPNTerminationSerializer(nested=True, read_only=True, allow_null=True) count_ipaddresses = serializers.IntegerField(read_only=True) count_fhrp_groups = serializers.IntegerField(read_only=True) - mac_address = serializers.CharField( - required=False, - default=None, - allow_null=True - ) + # Maintains backward compatibility with NetBox IP Address {% endif %} + {% if perms.dcim.add_macaddress %} +
  • MAC Address
  • + {% endif %} {% if perms.vpn.add_l2vpntermination %}
  • L2VPN Termination
  • {% endif %} @@ -150,8 +153,8 @@ class VMInterfaceTable(BaseInterfaceTable): model = VMInterface fields = ( 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', - 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', - 'created', 'last_updated', + 'vrf', 'primary_mac_address', 'l2vpn', 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', + 'tagged_vlans', 'qinq_svlan', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description') diff --git a/netbox/virtualization/tests/test_filtersets.py b/netbox/virtualization/tests/test_filtersets.py index 5a5bf2325..eef5d6b52 100644 --- a/netbox/virtualization/tests/test_filtersets.py +++ b/netbox/virtualization/tests/test_filtersets.py @@ -1,7 +1,7 @@ from django.test import TestCase from dcim.choices import InterfaceModeChoices -from dcim.models import Device, DeviceRole, Platform, Region, Site, SiteGroup +from dcim.models import Device, DeviceRole, MACAddress, Platform, Region, Site, SiteGroup from ipam.choices import VLANQinQRoleChoices from ipam.models import IPAddress, VLAN, VLANTranslationPolicy, VRF from tenancy.models import Tenant, TenantGroup @@ -366,13 +366,24 @@ class VirtualMachineTestCase(TestCase, ChangeLoggedFilterSetTests): ) VirtualMachine.objects.bulk_create(vms) + mac_addresses = ( + MACAddress(mac_address='00-00-00-00-00-01'), + MACAddress(mac_address='00-00-00-00-00-02'), + MACAddress(mac_address='00-00-00-00-00-03'), + ) + MACAddress.objects.bulk_create(mac_addresses) + interfaces = ( - VMInterface(virtual_machine=vms[0], name='Interface 1', mac_address='00-00-00-00-00-01'), - VMInterface(virtual_machine=vms[1], name='Interface 2', mac_address='00-00-00-00-00-02'), - VMInterface(virtual_machine=vms[2], name='Interface 3', mac_address='00-00-00-00-00-03'), + VMInterface(virtual_machine=vms[0], name='Interface 1'), + VMInterface(virtual_machine=vms[1], name='Interface 2'), + VMInterface(virtual_machine=vms[2], name='Interface 3'), ) VMInterface.objects.bulk_create(interfaces) + interfaces[0].mac_addresses.set([mac_addresses[0]]) + interfaces[1].mac_addresses.set([mac_addresses[1]]) + interfaces[2].mac_addresses.set([mac_addresses[2]]) + # Assign primary IPs for filtering ipaddresses = ( IPAddress(address='192.0.2.1/24', assigned_object=interfaces[0]), @@ -579,13 +590,19 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): ) VLANTranslationPolicy.objects.bulk_create(vlan_translation_policies) + mac_addresses = ( + MACAddress(mac_address='00-00-00-00-00-01'), + MACAddress(mac_address='00-00-00-00-00-02'), + MACAddress(mac_address='00-00-00-00-00-03'), + ) + MACAddress.objects.bulk_create(mac_addresses) + interfaces = ( VMInterface( virtual_machine=vms[0], name='Interface 1', enabled=True, mtu=100, - mac_address='00-00-00-00-00-01', vrf=vrfs[0], description='foobar1', vlan_translation_policy=vlan_translation_policies[0], @@ -595,7 +612,6 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): name='Interface 2', enabled=True, mtu=200, - mac_address='00-00-00-00-00-02', vrf=vrfs[1], description='foobar2', vlan_translation_policy=vlan_translation_policies[0], @@ -605,7 +621,6 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): name='Interface 3', enabled=False, mtu=300, - mac_address='00-00-00-00-00-03', vrf=vrfs[2], description='foobar3', mode=InterfaceModeChoices.MODE_Q_IN_Q, @@ -614,6 +629,10 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests): ) VMInterface.objects.bulk_create(interfaces) + interfaces[0].mac_addresses.set([mac_addresses[0]]) + interfaces[1].mac_addresses.set([mac_addresses[1]]) + interfaces[2].mac_addresses.set([mac_addresses[2]]) + def test_q(self): params = {'q': 'foobar1'} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) diff --git a/netbox/virtualization/tests/test_views.py b/netbox/virtualization/tests/test_views.py index b9cb7b437..dfd7e041c 100644 --- a/netbox/virtualization/tests/test_views.py +++ b/netbox/virtualization/tests/test_views.py @@ -1,7 +1,6 @@ from django.contrib.contenttypes.models import ContentType from django.test import override_settings from django.urls import reverse -from netaddr import EUI from dcim.choices import InterfaceModeChoices from dcim.models import DeviceRole, Platform, Site @@ -331,7 +330,6 @@ class VMInterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase): 'name': 'Interface X', 'enabled': False, 'bridge': interfaces[1].pk, - 'mac_address': EUI('01-02-03-04-05-06'), 'mtu': 65000, 'description': 'New description', 'mode': InterfaceModeChoices.MODE_TAGGED, @@ -346,7 +344,6 @@ class VMInterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase): 'name': 'Interface [4-6]', 'enabled': False, 'bridge': interfaces[3].pk, - 'mac_address': EUI('01-02-03-04-05-06'), 'mtu': 2000, 'description': 'New description', 'mode': InterfaceModeChoices.MODE_TAGGED, From 737631482107817b715771666418bb874c303ed7 Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Fri, 15 Nov 2024 12:37:10 -0500 Subject: [PATCH 32/65] Access _site of cluster instead of site --- netbox/virtualization/forms/bulk_edit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/virtualization/forms/bulk_edit.py b/netbox/virtualization/forms/bulk_edit.py index aaeb259b9..5e7593a09 100644 --- a/netbox/virtualization/forms/bulk_edit.py +++ b/netbox/virtualization/forms/bulk_edit.py @@ -279,7 +279,7 @@ class VMInterfaceBulkEditForm(NetBoxModelBulkEditForm): # Check interface sites. First interface should set site, further interfaces will either continue the # loop or reset back to no site and break the loop. for interface in interfaces: - vm_site = interface.virtual_machine.site or interface.virtual_machine.cluster.site + vm_site = interface.virtual_machine.site or interface.virtual_machine.cluster._site if site is None: site = vm_site elif vm_site is not site: From d2168b107fdee8cd88cfc9329103ff5c7a38bf48 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 19 Nov 2024 10:58:39 -0500 Subject: [PATCH 33/65] Closes #13086: Virtual circuits (#17933) * WIP * Add API tests * Add remaining tests * Add model docs * Show virtual circuit connections on interfaces * Misc cleanup per PR feedback * Renumber migration * Support nested terminations for virtual circuit bulk import --- docs/models/circuits/virtualcircuit.md | 33 ++ .../circuits/virtualcircuittermination.md | 21 ++ mkdocs.yml | 2 + netbox/circuits/api/serializers_/circuits.py | 39 ++- netbox/circuits/api/urls.py | 4 + netbox/circuits/api/views.py | 20 ++ netbox/circuits/choices.py | 16 + netbox/circuits/filtersets.py | 109 +++++- netbox/circuits/forms/bulk_edit.py | 65 +++- netbox/circuits/forms/bulk_import.py | 74 ++++ netbox/circuits/forms/filtersets.py | 78 ++++- netbox/circuits/forms/model_forms.py | 76 ++++- netbox/circuits/graphql/filters.py | 16 +- netbox/circuits/graphql/schema.py | 6 + netbox/circuits/graphql/types.py | 31 ++ .../migrations/0050_virtual_circuits.py | 67 ++++ netbox/circuits/models/__init__.py | 1 + netbox/circuits/models/virtual_circuits.py | 164 +++++++++ netbox/circuits/search.py | 20 ++ netbox/circuits/tables/__init__.py | 1 + netbox/circuits/tables/virtual_circuits.py | 95 ++++++ netbox/circuits/tests/test_api.py | 240 ++++++++++++- netbox/circuits/tests/test_filtersets.py | 293 +++++++++++++++- netbox/circuits/tests/test_views.py | 321 +++++++++++++++++- netbox/circuits/urls.py | 16 + netbox/circuits/views.py | 106 ++++++ netbox/dcim/filtersets.py | 12 +- netbox/dcim/models/device_components.py | 8 + netbox/dcim/tables/devices.py | 8 + netbox/dcim/tables/template_code.py | 14 + netbox/extras/tests/test_filtersets.py | 2 + netbox/netbox/navigation/menu.py | 7 + .../templates/circuits/providernetwork.html | 13 + netbox/templates/circuits/virtualcircuit.html | 84 +++++ .../circuits/virtualcircuittermination.html | 81 +++++ netbox/templates/dcim/interface.html | 36 +- 36 files changed, 2164 insertions(+), 15 deletions(-) create mode 100644 docs/models/circuits/virtualcircuit.md create mode 100644 docs/models/circuits/virtualcircuittermination.md create mode 100644 netbox/circuits/migrations/0050_virtual_circuits.py create mode 100644 netbox/circuits/models/virtual_circuits.py create mode 100644 netbox/circuits/tables/virtual_circuits.py create mode 100644 netbox/templates/circuits/virtualcircuit.html create mode 100644 netbox/templates/circuits/virtualcircuittermination.html diff --git a/docs/models/circuits/virtualcircuit.md b/docs/models/circuits/virtualcircuit.md new file mode 100644 index 000000000..a379b6330 --- /dev/null +++ b/docs/models/circuits/virtualcircuit.md @@ -0,0 +1,33 @@ +# Virtual Circuits + +A virtual circuit can connect two or more interfaces atop a set of decoupled physical connections. For example, it's very common to form a virtual connection between two virtual interfaces, each of which is bound to a physical interface on its respective device and physically connected to a [provider network](./providernetwork.md) via an independent [physical circuit](./circuit.md). + +## Fields + +### Provider Network + +The [provider network](./providernetwork.md) across which the virtual circuit is formed. + +### Provider Account + +The [provider account](./provideraccount.md) with which the virtual circuit is associated (if any). + +### Circuit ID + +The unique identifier assigned to the virtual circuit by its [provider](./provider.md). + +### Status + +The operational status of the virtual circuit. By default, the following statuses are available: + +| Name | +|----------------| +| Planned | +| Provisioning | +| Active | +| Offline | +| Deprovisioning | +| Decommissioned | + +!!! tip "Custom circuit statuses" + Additional circuit statuses may be defined by setting `Circuit.status` under the [`FIELD_CHOICES`](../../configuration/data-validation.md#field_choices) configuration parameter. diff --git a/docs/models/circuits/virtualcircuittermination.md b/docs/models/circuits/virtualcircuittermination.md new file mode 100644 index 000000000..82ea43eef --- /dev/null +++ b/docs/models/circuits/virtualcircuittermination.md @@ -0,0 +1,21 @@ +# Virtual Circuit Terminations + +This model represents the connection of a virtual [interface](../dcim/interface.md) to a [virtual circuit](./virtualcircuit.md). + +## Fields + +### Virtual Circuit + +The [virtual circuit](./virtualcircuit.md) to which the interface is connected. + +### Interface + +The [interface](../dcim/interface.md) connected to the virtual circuit. + +### Role + +The functional role of the termination. This depends on the virtual circuit's topology, which is typically either peer-to-peer or hub-and-spoke (multipoint). Valid choices include: + +* Peer +* Hub +* Spoke diff --git a/mkdocs.yml b/mkdocs.yml index 00e03a4ce..a66baa286 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -174,6 +174,8 @@ nav: - Provider: 'models/circuits/provider.md' - Provider Account: 'models/circuits/provideraccount.md' - Provider Network: 'models/circuits/providernetwork.md' + - Virtual Circuit: 'models/circuits/virtualcircuit.md' + - Virtual Circuit Termination: 'models/circuits/virtualcircuittermination.md' - Core: - DataFile: 'models/core/datafile.md' - DataSource: 'models/core/datasource.md' diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index 96a686a65..a68e49483 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -2,9 +2,13 @@ from django.contrib.contenttypes.models import ContentType from drf_spectacular.utils import extend_schema_field from rest_framework import serializers -from circuits.choices import CircuitPriorityChoices, CircuitStatusChoices +from circuits.choices import CircuitPriorityChoices, CircuitStatusChoices, VirtualCircuitTerminationRoleChoices from circuits.constants import CIRCUIT_TERMINATION_TERMINATION_TYPES -from circuits.models import Circuit, CircuitGroup, CircuitGroupAssignment, CircuitTermination, CircuitType +from circuits.models import ( + Circuit, CircuitGroup, CircuitGroupAssignment, CircuitTermination, CircuitType, VirtualCircuit, + VirtualCircuitTermination, +) +from dcim.api.serializers_.device_components import InterfaceSerializer from dcim.api.serializers_.cables import CabledObjectSerializer from netbox.api.fields import ChoiceField, ContentTypeField, RelatedObjectCountField from netbox.api.serializers import NetBoxModelSerializer, WritableNestedSerializer @@ -20,6 +24,8 @@ __all__ = ( 'CircuitGroupSerializer', 'CircuitTerminationSerializer', 'CircuitTypeSerializer', + 'VirtualCircuitSerializer', + 'VirtualCircuitTerminationSerializer', ) @@ -156,3 +162,32 @@ class CircuitGroupAssignmentSerializer(CircuitGroupAssignmentSerializer_): 'id', 'url', 'display_url', 'display', 'group', 'circuit', 'priority', 'tags', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'group', 'circuit', 'priority') + + +class VirtualCircuitSerializer(NetBoxModelSerializer): + provider_network = ProviderNetworkSerializer(nested=True) + provider_account = ProviderAccountSerializer(nested=True, required=False, allow_null=True, default=None) + status = ChoiceField(choices=CircuitStatusChoices, required=False) + tenant = TenantSerializer(nested=True, required=False, allow_null=True) + + class Meta: + model = VirtualCircuit + fields = [ + 'id', 'url', 'display_url', 'display', 'cid', 'provider_network', 'provider_account', 'status', 'tenant', + 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + ] + brief_fields = ('id', 'url', 'display', 'provider_network', 'cid', 'description') + + +class VirtualCircuitTerminationSerializer(NetBoxModelSerializer, CabledObjectSerializer): + virtual_circuit = VirtualCircuitSerializer(nested=True) + role = ChoiceField(choices=VirtualCircuitTerminationRoleChoices, required=False) + interface = InterfaceSerializer(nested=True) + + class Meta: + model = VirtualCircuitTermination + fields = [ + 'id', 'url', 'display_url', 'display', 'virtual_circuit', 'role', 'interface', 'description', 'tags', + 'custom_fields', 'created', 'last_updated', + ] + brief_fields = ('id', 'url', 'display', 'virtual_circuit', 'role', 'interface', 'description') diff --git a/netbox/circuits/api/urls.py b/netbox/circuits/api/urls.py index 00af3dec6..6f257f694 100644 --- a/netbox/circuits/api/urls.py +++ b/netbox/circuits/api/urls.py @@ -17,5 +17,9 @@ router.register('circuit-terminations', views.CircuitTerminationViewSet) router.register('circuit-groups', views.CircuitGroupViewSet) router.register('circuit-group-assignments', views.CircuitGroupAssignmentViewSet) +# Virtual circuits +router.register('virtual-circuits', views.VirtualCircuitViewSet) +router.register('virtual-circuit-terminations', views.VirtualCircuitTerminationViewSet) + app_name = 'circuits-api' urlpatterns = router.urls diff --git a/netbox/circuits/api/views.py b/netbox/circuits/api/views.py index 8cce013d7..3b49075be 100644 --- a/netbox/circuits/api/views.py +++ b/netbox/circuits/api/views.py @@ -93,3 +93,23 @@ class ProviderNetworkViewSet(NetBoxModelViewSet): queryset = ProviderNetwork.objects.all() serializer_class = serializers.ProviderNetworkSerializer filterset_class = filtersets.ProviderNetworkFilterSet + + +# +# Virtual circuits +# + +class VirtualCircuitViewSet(NetBoxModelViewSet): + queryset = VirtualCircuit.objects.all() + serializer_class = serializers.VirtualCircuitSerializer + filterset_class = filtersets.VirtualCircuitFilterSet + + +# +# Virtual circuit terminations +# + +class VirtualCircuitTerminationViewSet(PassThroughPortMixin, NetBoxModelViewSet): + queryset = VirtualCircuitTermination.objects.all() + serializer_class = serializers.VirtualCircuitTerminationSerializer + filterset_class = filtersets.VirtualCircuitTerminationFilterSet diff --git a/netbox/circuits/choices.py b/netbox/circuits/choices.py index 8c25c7459..4d6132d7a 100644 --- a/netbox/circuits/choices.py +++ b/netbox/circuits/choices.py @@ -92,3 +92,19 @@ class CircuitPriorityChoices(ChoiceSet): (PRIORITY_TERTIARY, _('Tertiary')), (PRIORITY_INACTIVE, _('Inactive')), ] + + +# +# Virtual circuits +# + +class VirtualCircuitTerminationRoleChoices(ChoiceSet): + ROLE_PEER = 'peer' + ROLE_HUB = 'hub' + ROLE_SPOKE = 'spoke' + + CHOICES = [ + (ROLE_PEER, _('Peer'), 'green'), + (ROLE_HUB, _('Hub'), 'blue'), + (ROLE_SPOKE, _('Spoke'), 'orange'), + ] diff --git a/netbox/circuits/filtersets.py b/netbox/circuits/filtersets.py index 4a2a972f3..be36d45ac 100644 --- a/netbox/circuits/filtersets.py +++ b/netbox/circuits/filtersets.py @@ -3,7 +3,7 @@ from django.db.models import Q from django.utils.translation import gettext as _ from dcim.filtersets import CabledObjectFilterSet -from dcim.models import Location, Region, Site, SiteGroup +from dcim.models import Interface, Location, Region, Site, SiteGroup from ipam.models import ASN from netbox.filtersets import NetBoxModelFilterSet, OrganizationalModelFilterSet from tenancy.filtersets import ContactModelFilterSet, TenancyFilterSet @@ -20,6 +20,8 @@ __all__ = ( 'ProviderNetworkFilterSet', 'ProviderAccountFilterSet', 'ProviderFilterSet', + 'VirtualCircuitFilterSet', + 'VirtualCircuitTerminationFilterSet', ) @@ -404,3 +406,108 @@ class CircuitGroupAssignmentFilterSet(NetBoxModelFilterSet): Q(circuit__cid__icontains=value) | Q(group__name__icontains=value) ) + + +class VirtualCircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet): + provider_id = django_filters.ModelMultipleChoiceFilter( + field_name='provider_network__provider', + queryset=Provider.objects.all(), + label=_('Provider (ID)'), + ) + provider = django_filters.ModelMultipleChoiceFilter( + field_name='provider_network__provider__slug', + queryset=Provider.objects.all(), + to_field_name='slug', + label=_('Provider (slug)'), + ) + provider_account_id = django_filters.ModelMultipleChoiceFilter( + field_name='provider_account', + queryset=ProviderAccount.objects.all(), + label=_('Provider account (ID)'), + ) + provider_account = django_filters.ModelMultipleChoiceFilter( + field_name='provider_account__account', + queryset=Provider.objects.all(), + to_field_name='account', + label=_('Provider account (account)'), + ) + provider_network_id = django_filters.ModelMultipleChoiceFilter( + queryset=ProviderNetwork.objects.all(), + label=_('Provider network (ID)'), + ) + status = django_filters.MultipleChoiceFilter( + choices=CircuitStatusChoices, + null_value=None + ) + + class Meta: + model = VirtualCircuit + fields = ('id', 'cid', 'description') + + def search(self, queryset, name, value): + if not value.strip(): + return queryset + return queryset.filter( + Q(cid__icontains=value) | + Q(description__icontains=value) | + Q(comments__icontains=value) + ).distinct() + + +class VirtualCircuitTerminationFilterSet(NetBoxModelFilterSet): + q = django_filters.CharFilter( + method='search', + label=_('Search'), + ) + virtual_circuit_id = django_filters.ModelMultipleChoiceFilter( + queryset=VirtualCircuit.objects.all(), + label=_('Virtual circuit'), + ) + role = django_filters.MultipleChoiceFilter( + choices=VirtualCircuitTerminationRoleChoices, + null_value=None + ) + provider_id = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit__provider_network__provider', + queryset=Provider.objects.all(), + label=_('Provider (ID)'), + ) + provider = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit__provider_network__provider__slug', + queryset=Provider.objects.all(), + to_field_name='slug', + label=_('Provider (slug)'), + ) + provider_account_id = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit__provider_account', + queryset=ProviderAccount.objects.all(), + label=_('Provider account (ID)'), + ) + provider_account = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit__provider_account__account', + queryset=ProviderAccount.objects.all(), + to_field_name='account', + label=_('Provider account (account)'), + ) + provider_network_id = django_filters.ModelMultipleChoiceFilter( + queryset=ProviderNetwork.objects.all(), + field_name='virtual_circuit__provider_network', + label=_('Provider network (ID)'), + ) + interface_id = django_filters.ModelMultipleChoiceFilter( + queryset=Interface.objects.all(), + field_name='interface', + label=_('Interface (ID)'), + ) + + class Meta: + model = VirtualCircuitTermination + fields = ('id', 'interface_id', 'description') + + def search(self, queryset, name, value): + if not value.strip(): + return queryset + return queryset.filter( + Q(virtual_circuit__cid__icontains=value) | + Q(description__icontains=value) + ).distinct() diff --git a/netbox/circuits/forms/bulk_edit.py b/netbox/circuits/forms/bulk_edit.py index e3f0b5d0c..021635a1a 100644 --- a/netbox/circuits/forms/bulk_edit.py +++ b/netbox/circuits/forms/bulk_edit.py @@ -3,7 +3,9 @@ from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ -from circuits.choices import CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices +from circuits.choices import ( + CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices, VirtualCircuitTerminationRoleChoices, +) from circuits.constants import CIRCUIT_TERMINATION_TERMINATION_TYPES from circuits.models import * from dcim.models import Site @@ -28,6 +30,8 @@ __all__ = ( 'ProviderBulkEditForm', 'ProviderAccountBulkEditForm', 'ProviderNetworkBulkEditForm', + 'VirtualCircuitBulkEditForm', + 'VirtualCircuitTerminationBulkEditForm', ) @@ -291,3 +295,62 @@ class CircuitGroupAssignmentBulkEditForm(NetBoxModelBulkEditForm): FieldSet('circuit', 'priority'), ) nullable_fields = ('priority',) + + +class VirtualCircuitBulkEditForm(NetBoxModelBulkEditForm): + provider_network = DynamicModelChoiceField( + label=_('Provider network'), + queryset=ProviderNetwork.objects.all(), + required=False + ) + provider_account = DynamicModelChoiceField( + label=_('Provider account'), + queryset=ProviderAccount.objects.all(), + required=False + ) + status = forms.ChoiceField( + label=_('Status'), + choices=add_blank_choice(CircuitStatusChoices), + required=False, + initial='' + ) + tenant = DynamicModelChoiceField( + label=_('Tenant'), + queryset=Tenant.objects.all(), + required=False + ) + description = forms.CharField( + label=_('Description'), + max_length=100, + required=False + ) + comments = CommentField() + + model = VirtualCircuit + fieldsets = ( + FieldSet('provider_network', 'provider_account', 'status', 'description', name=_('Virtual circuit')), + FieldSet('tenant', name=_('Tenancy')), + ) + nullable_fields = ( + 'provider_account', 'tenant', 'description', 'comments', + ) + + +class VirtualCircuitTerminationBulkEditForm(NetBoxModelBulkEditForm): + role = forms.ChoiceField( + label=_('Role'), + choices=add_blank_choice(VirtualCircuitTerminationRoleChoices), + required=False, + initial='' + ) + description = forms.CharField( + label=_('Description'), + max_length=200, + required=False + ) + + model = VirtualCircuitTermination + fieldsets = ( + FieldSet('role', 'description'), + ) + nullable_fields = ('description',) diff --git a/netbox/circuits/forms/bulk_import.py b/netbox/circuits/forms/bulk_import.py index eab87b1f5..7f5ffde6e 100644 --- a/netbox/circuits/forms/bulk_import.py +++ b/netbox/circuits/forms/bulk_import.py @@ -5,6 +5,7 @@ from django.utils.translation import gettext_lazy as _ from circuits.choices import * from circuits.constants import * from circuits.models import * +from dcim.models import Interface from netbox.choices import DistanceUnitChoices from netbox.forms import NetBoxModelImportForm from tenancy.models import Tenant @@ -20,6 +21,9 @@ __all__ = ( 'ProviderImportForm', 'ProviderAccountImportForm', 'ProviderNetworkImportForm', + 'VirtualCircuitImportForm', + 'VirtualCircuitTerminationImportForm', + 'VirtualCircuitTerminationImportRelatedForm', ) @@ -179,3 +183,73 @@ class CircuitGroupAssignmentImportForm(NetBoxModelImportForm): class Meta: model = CircuitGroupAssignment fields = ('circuit', 'group', 'priority') + + +class VirtualCircuitImportForm(NetBoxModelImportForm): + provider_network = CSVModelChoiceField( + label=_('Provider network'), + queryset=ProviderNetwork.objects.all(), + to_field_name='name', + help_text=_('The network to which this virtual circuit belongs') + ) + provider_account = CSVModelChoiceField( + label=_('Provider account'), + queryset=ProviderAccount.objects.all(), + to_field_name='account', + help_text=_('Assigned provider account (if any)'), + required=False + ) + status = CSVChoiceField( + label=_('Status'), + choices=CircuitStatusChoices, + help_text=_('Operational status') + ) + tenant = CSVModelChoiceField( + label=_('Tenant'), + queryset=Tenant.objects.all(), + required=False, + to_field_name='name', + help_text=_('Assigned tenant') + ) + + class Meta: + model = VirtualCircuit + fields = [ + 'cid', 'provider_network', 'provider_account', 'status', 'tenant', 'description', 'comments', 'tags', + ] + + +class BaseVirtualCircuitTerminationImportForm(forms.ModelForm): + virtual_circuit = CSVModelChoiceField( + label=_('Virtual circuit'), + queryset=VirtualCircuit.objects.all(), + to_field_name='cid', + ) + role = CSVChoiceField( + label=_('Role'), + choices=VirtualCircuitTerminationRoleChoices, + help_text=_('Operational role') + ) + interface = CSVModelChoiceField( + label=_('Interface'), + queryset=Interface.objects.all(), + to_field_name='pk', + ) + + +class VirtualCircuitTerminationImportRelatedForm(BaseVirtualCircuitTerminationImportForm): + + class Meta: + model = VirtualCircuitTermination + fields = [ + 'virtual_circuit', 'role', 'interface', 'description', + ] + + +class VirtualCircuitTerminationImportForm(NetBoxModelImportForm, BaseVirtualCircuitTerminationImportForm): + + class Meta: + model = VirtualCircuitTermination + fields = [ + 'virtual_circuit', 'role', 'interface', 'description', 'tags', + ] diff --git a/netbox/circuits/forms/filtersets.py b/netbox/circuits/forms/filtersets.py index b585ce079..00dc6bc5b 100644 --- a/netbox/circuits/forms/filtersets.py +++ b/netbox/circuits/forms/filtersets.py @@ -1,7 +1,10 @@ from django import forms from django.utils.translation import gettext as _ -from circuits.choices import CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices, CircuitTerminationSideChoices +from circuits.choices import ( + CircuitCommitRateChoices, CircuitPriorityChoices, CircuitStatusChoices, CircuitTerminationSideChoices, + VirtualCircuitTerminationRoleChoices, +) from circuits.models import * from dcim.models import Location, Region, Site, SiteGroup from ipam.models import ASN @@ -22,6 +25,8 @@ __all__ = ( 'ProviderFilterForm', 'ProviderAccountFilterForm', 'ProviderNetworkFilterForm', + 'VirtualCircuitFilterForm', + 'VirtualCircuitTerminationFilterForm', ) @@ -292,3 +297,74 @@ class CircuitGroupAssignmentFilterForm(NetBoxModelFilterSetForm): required=False ) tag = TagFilterField(model) + + +class VirtualCircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilterSetForm): + model = VirtualCircuit + fieldsets = ( + FieldSet('q', 'filter_id', 'tag'), + FieldSet('provider_id', 'provider_account_id', 'provider_network_id', name=_('Provider')), + FieldSet('status', name=_('Attributes')), + FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), + ) + selector_fields = ('filter_id', 'q', 'provider_id', 'provider_network_id') + provider_id = DynamicModelMultipleChoiceField( + queryset=Provider.objects.all(), + required=False, + label=_('Provider') + ) + provider_account_id = DynamicModelMultipleChoiceField( + queryset=ProviderAccount.objects.all(), + required=False, + query_params={ + 'provider_id': '$provider_id' + }, + label=_('Provider account') + ) + provider_network_id = DynamicModelMultipleChoiceField( + queryset=ProviderNetwork.objects.all(), + required=False, + query_params={ + 'provider_id': '$provider_id' + }, + label=_('Provider network') + ) + status = forms.MultipleChoiceField( + label=_('Status'), + choices=CircuitStatusChoices, + required=False + ) + tag = TagFilterField(model) + + +class VirtualCircuitTerminationFilterForm(NetBoxModelFilterSetForm): + model = VirtualCircuitTermination + fieldsets = ( + FieldSet('q', 'filter_id', 'tag'), + FieldSet('virtual_circuit_id', 'role', name=_('Virtual circuit')), + FieldSet('provider_id', 'provider_account_id', 'provider_network_id', name=_('Provider')), + ) + virtual_circuit_id = DynamicModelMultipleChoiceField( + queryset=VirtualCircuit.objects.all(), + required=False, + label=_('Virtual circuit') + ) + role = forms.MultipleChoiceField( + label=_('Role'), + choices=VirtualCircuitTerminationRoleChoices, + required=False + ) + provider_network_id = DynamicModelMultipleChoiceField( + queryset=ProviderNetwork.objects.all(), + required=False, + query_params={ + 'provider_id': '$provider_id' + }, + label=_('Provider network') + ) + provider_id = DynamicModelMultipleChoiceField( + queryset=Provider.objects.all(), + required=False, + label=_('Provider') + ) + tag = TagFilterField(model) diff --git a/netbox/circuits/forms/model_forms.py b/netbox/circuits/forms/model_forms.py index 9eeb0f588..e43c37525 100644 --- a/netbox/circuits/forms/model_forms.py +++ b/netbox/circuits/forms/model_forms.py @@ -1,16 +1,21 @@ +from django import forms from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import gettext_lazy as _ -from circuits.choices import CircuitCommitRateChoices, CircuitTerminationPortSpeedChoices +from circuits.choices import ( + CircuitCommitRateChoices, CircuitTerminationPortSpeedChoices, VirtualCircuitTerminationRoleChoices, +) from circuits.constants import * from circuits.models import * -from dcim.models import Site +from dcim.models import Interface, Site from ipam.models import ASN from netbox.forms import NetBoxModelForm from tenancy.forms import TenancyForm from utilities.forms import get_field_value -from utilities.forms.fields import CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField +from utilities.forms.fields import ( + CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField, +) from utilities.forms.rendering import FieldSet, InlineFields from utilities.forms.widgets import DatePicker, HTMXSelect, NumberWithOptions from utilities.templatetags.builtins.filters import bettertitle @@ -24,6 +29,8 @@ __all__ = ( 'ProviderForm', 'ProviderAccountForm', 'ProviderNetworkForm', + 'VirtualCircuitForm', + 'VirtualCircuitTerminationForm', ) @@ -255,3 +262,66 @@ class CircuitGroupAssignmentForm(NetBoxModelForm): fields = [ 'group', 'circuit', 'priority', 'tags', ] + + +class VirtualCircuitForm(TenancyForm, NetBoxModelForm): + provider_network = DynamicModelChoiceField( + label=_('Provider network'), + queryset=ProviderNetwork.objects.all(), + selector=True + ) + provider_account = DynamicModelChoiceField( + label=_('Provider account'), + queryset=ProviderAccount.objects.all(), + required=False + ) + comments = CommentField() + + fieldsets = ( + FieldSet( + 'provider_network', 'provider_account', 'cid', 'status', 'description', 'tags', name=_('Virtual circuit'), + ), + FieldSet('tenant_group', 'tenant', name=_('Tenancy')), + ) + + class Meta: + model = VirtualCircuit + fields = [ + 'cid', 'provider_network', 'provider_account', 'status', 'description', 'tenant_group', 'tenant', + 'comments', 'tags', + ] + + +class VirtualCircuitTerminationForm(NetBoxModelForm): + virtual_circuit = DynamicModelChoiceField( + label=_('Virtual circuit'), + queryset=VirtualCircuit.objects.all(), + selector=True + ) + role = forms.ChoiceField( + choices=VirtualCircuitTerminationRoleChoices, + widget=HTMXSelect(), + label=_('Role') + ) + interface = DynamicModelChoiceField( + label=_('Interface'), + queryset=Interface.objects.all(), + selector=True, + query_params={ + 'kind': 'virtual', + 'virtual_circuit_termination_id': 'null', + }, + context={ + 'parent': 'device', + } + ) + + fieldsets = ( + FieldSet('virtual_circuit', 'role', 'interface', 'description', 'tags'), + ) + + class Meta: + model = VirtualCircuitTermination + fields = [ + 'virtual_circuit', 'role', 'interface', 'description', 'tags', + ] diff --git a/netbox/circuits/graphql/filters.py b/netbox/circuits/graphql/filters.py index b8398b2b9..36ddc25b2 100644 --- a/netbox/circuits/graphql/filters.py +++ b/netbox/circuits/graphql/filters.py @@ -4,14 +4,16 @@ from circuits import filtersets, models from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin __all__ = ( - 'CircuitTerminationFilter', 'CircuitFilter', 'CircuitGroupAssignmentFilter', 'CircuitGroupFilter', + 'CircuitTerminationFilter', 'CircuitTypeFilter', 'ProviderFilter', 'ProviderAccountFilter', 'ProviderNetworkFilter', + 'VirtualCircuitFilter', + 'VirtualCircuitTerminationFilter', ) @@ -61,3 +63,15 @@ class ProviderAccountFilter(BaseFilterMixin): @autotype_decorator(filtersets.ProviderNetworkFilterSet) class ProviderNetworkFilter(BaseFilterMixin): pass + + +@strawberry_django.filter(models.VirtualCircuit, lookups=True) +@autotype_decorator(filtersets.VirtualCircuitFilterSet) +class VirtualCircuitFilter(BaseFilterMixin): + pass + + +@strawberry_django.filter(models.VirtualCircuitTermination, lookups=True) +@autotype_decorator(filtersets.VirtualCircuitTerminationFilterSet) +class VirtualCircuitTerminationFilter(BaseFilterMixin): + pass diff --git a/netbox/circuits/graphql/schema.py b/netbox/circuits/graphql/schema.py index ac23421ce..9c683ce45 100644 --- a/netbox/circuits/graphql/schema.py +++ b/netbox/circuits/graphql/schema.py @@ -31,3 +31,9 @@ class CircuitsQuery: provider_network: ProviderNetworkType = strawberry_django.field() provider_network_list: List[ProviderNetworkType] = strawberry_django.field() + + virtual_circuit: VirtualCircuitType = strawberry_django.field() + virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field() + + virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field() + virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field() diff --git a/netbox/circuits/graphql/types.py b/netbox/circuits/graphql/types.py index b52f9d18d..f2703b207 100644 --- a/netbox/circuits/graphql/types.py +++ b/netbox/circuits/graphql/types.py @@ -19,6 +19,8 @@ __all__ = ( 'ProviderType', 'ProviderAccountType', 'ProviderNetworkType', + 'VirtualCircuitTerminationType', + 'VirtualCircuitType', ) @@ -120,3 +122,32 @@ class CircuitGroupType(OrganizationalObjectType): class CircuitGroupAssignmentType(TagsMixin, BaseObjectType): group: Annotated["CircuitGroupType", strawberry.lazy('circuits.graphql.types')] circuit: Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')] + + +@strawberry_django.type( + models.VirtualCircuitTermination, + fields='__all__', + filters=VirtualCircuitTerminationFilter +) +class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType): + virtual_circuit: Annotated[ + "VirtualCircuitType", + strawberry.lazy('circuits.graphql.types') + ] = strawberry_django.field(select_related=["virtual_circuit"]) + interface: Annotated[ + "InterfaceType", + strawberry.lazy('dcim.graphql.types') + ] = strawberry_django.field(select_related=["interface"]) + + +@strawberry_django.type( + models.VirtualCircuit, + fields='__all__', + filters=VirtualCircuitFilter +) +class VirtualCircuitType(NetBoxObjectType): + provider_network: ProviderNetworkType = strawberry_django.field(select_related=["provider_network"]) + provider_account: ProviderAccountType | None + tenant: TenantType | None + + terminations: List[VirtualCircuitTerminationType] diff --git a/netbox/circuits/migrations/0050_virtual_circuits.py b/netbox/circuits/migrations/0050_virtual_circuits.py new file mode 100644 index 000000000..df719b517 --- /dev/null +++ b/netbox/circuits/migrations/0050_virtual_circuits.py @@ -0,0 +1,67 @@ +import django.db.models.deletion +import taggit.managers +from django.db import migrations, models + +import utilities.json + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0049_natural_ordering'), + ('dcim', '0196_qinq_svlan'), + ('extras', '0122_charfield_null_choices'), + ('tenancy', '0016_charfield_null_choices'), + ] + + operations = [ + migrations.CreateModel( + name='VirtualCircuit', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), + ('created', models.DateTimeField(auto_now_add=True, null=True)), + ('last_updated', models.DateTimeField(auto_now=True, null=True)), + ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ('description', models.CharField(blank=True, max_length=200)), + ('comments', models.TextField(blank=True)), + ('cid', models.CharField(max_length=100)), + ('status', models.CharField(default='active', max_length=50)), + ('provider_account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='circuits.provideraccount')), + ('provider_network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='circuits.providernetwork')), + ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), + ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='tenancy.tenant')), + ], + options={ + 'verbose_name': 'circuit', + 'verbose_name_plural': 'circuits', + 'ordering': ['provider_network', 'provider_account', 'cid'], + }, + ), + migrations.CreateModel( + name='VirtualCircuitTermination', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), + ('created', models.DateTimeField(auto_now_add=True, null=True)), + ('last_updated', models.DateTimeField(auto_now=True, null=True)), + ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ('role', models.CharField(default='peer', max_length=50)), + ('description', models.CharField(blank=True, max_length=200)), + ('interface', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='virtual_circuit_termination', to='dcim.interface')), + ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), + ('virtual_circuit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='circuits.virtualcircuit')), + ], + options={ + 'verbose_name': 'virtual circuit termination', + 'verbose_name_plural': 'virtual circuit terminations', + 'ordering': ['virtual_circuit', 'role', 'pk'], + }, + ), + migrations.AddConstraint( + model_name='virtualcircuit', + constraint=models.UniqueConstraint(fields=('provider_network', 'cid'), name='circuits_virtualcircuit_unique_provider_network_cid'), + ), + migrations.AddConstraint( + model_name='virtualcircuit', + constraint=models.UniqueConstraint(fields=('provider_account', 'cid'), name='circuits_virtualcircuit_unique_provideraccount_cid'), + ), + ] diff --git a/netbox/circuits/models/__init__.py b/netbox/circuits/models/__init__.py index 7bbaf75d3..77382358b 100644 --- a/netbox/circuits/models/__init__.py +++ b/netbox/circuits/models/__init__.py @@ -1,2 +1,3 @@ from .circuits import * from .providers import * +from .virtual_circuits import * diff --git a/netbox/circuits/models/virtual_circuits.py b/netbox/circuits/models/virtual_circuits.py new file mode 100644 index 000000000..ced68c105 --- /dev/null +++ b/netbox/circuits/models/virtual_circuits.py @@ -0,0 +1,164 @@ +from functools import cached_property + +from django.core.exceptions import ValidationError +from django.db import models +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + +from circuits.choices import * +from netbox.models import ChangeLoggedModel, PrimaryModel +from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin + +__all__ = ( + 'VirtualCircuit', + 'VirtualCircuitTermination', +) + + +class VirtualCircuit(PrimaryModel): + """ + A virtual connection between two or more endpoints, delivered across one or more physical circuits. + """ + cid = models.CharField( + max_length=100, + verbose_name=_('circuit ID'), + help_text=_('Unique circuit ID') + ) + provider_network = models.ForeignKey( + to='circuits.ProviderNetwork', + on_delete=models.PROTECT, + related_name='virtual_circuits' + ) + provider_account = models.ForeignKey( + to='circuits.ProviderAccount', + on_delete=models.PROTECT, + related_name='virtual_circuits', + blank=True, + null=True + ) + status = models.CharField( + verbose_name=_('status'), + max_length=50, + choices=CircuitStatusChoices, + default=CircuitStatusChoices.STATUS_ACTIVE + ) + tenant = models.ForeignKey( + to='tenancy.Tenant', + on_delete=models.PROTECT, + related_name='virtual_circuits', + blank=True, + null=True + ) + + clone_fields = ( + 'provider_network', 'provider_account', 'status', 'tenant', 'description', + ) + prerequisite_models = ( + 'circuits.ProviderNetwork', + ) + + class Meta: + ordering = ['provider_network', 'provider_account', 'cid'] + constraints = ( + models.UniqueConstraint( + fields=('provider_network', 'cid'), + name='%(app_label)s_%(class)s_unique_provider_network_cid' + ), + models.UniqueConstraint( + fields=('provider_account', 'cid'), + name='%(app_label)s_%(class)s_unique_provideraccount_cid' + ), + ) + verbose_name = _('virtual circuit') + verbose_name_plural = _('virtual circuits') + + def __str__(self): + return self.cid + + def get_status_color(self): + return CircuitStatusChoices.colors.get(self.status) + + def clean(self): + super().clean() + + if self.provider_account and self.provider_network.provider != self.provider_account.provider: + raise ValidationError({ + 'provider_account': "The assigned account must belong to the provider of the assigned network." + }) + + @property + def provider(self): + return self.provider_network.provider + + +class VirtualCircuitTermination( + CustomFieldsMixin, + CustomLinksMixin, + TagsMixin, + ChangeLoggedModel +): + virtual_circuit = models.ForeignKey( + to='circuits.VirtualCircuit', + on_delete=models.CASCADE, + related_name='terminations' + ) + role = models.CharField( + verbose_name=_('role'), + max_length=50, + choices=VirtualCircuitTerminationRoleChoices, + default=VirtualCircuitTerminationRoleChoices.ROLE_PEER + ) + interface = models.OneToOneField( + to='dcim.Interface', + on_delete=models.CASCADE, + related_name='virtual_circuit_termination' + ) + description = models.CharField( + verbose_name=_('description'), + max_length=200, + blank=True + ) + + class Meta: + ordering = ['virtual_circuit', 'role', 'pk'] + verbose_name = _('virtual circuit termination') + verbose_name_plural = _('virtual circuit terminations') + + def __str__(self): + return f'{self.virtual_circuit}: {self.get_role_display()} termination' + + def get_absolute_url(self): + return reverse('circuits:virtualcircuittermination', args=[self.pk]) + + def get_role_color(self): + return VirtualCircuitTerminationRoleChoices.colors.get(self.role) + + def to_objectchange(self, action): + objectchange = super().to_objectchange(action) + objectchange.related_object = self.virtual_circuit + return objectchange + + @property + def parent_object(self): + return self.virtual_circuit + + @cached_property + def peer_terminations(self): + if self.role == VirtualCircuitTerminationRoleChoices.ROLE_PEER: + return self.virtual_circuit.terminations.exclude(pk=self.pk).filter( + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER + ) + if self.role == VirtualCircuitTerminationRoleChoices.ROLE_HUB: + return self.virtual_circuit.terminations.filter( + role=VirtualCircuitTerminationRoleChoices.ROLE_SPOKE + ) + if self.role == VirtualCircuitTerminationRoleChoices.ROLE_SPOKE: + return self.virtual_circuit.terminations.filter( + role=VirtualCircuitTerminationRoleChoices.ROLE_HUB + ) + + def clean(self): + super().clean() + + if self.interface and not self.interface.is_virtual: + raise ValidationError("Virtual circuits may be terminated only to virtual interfaces.") diff --git a/netbox/circuits/search.py b/netbox/circuits/search.py index 7a5711f03..80725c1b8 100644 --- a/netbox/circuits/search.py +++ b/netbox/circuits/search.py @@ -80,3 +80,23 @@ class ProviderNetworkIndex(SearchIndex): ('comments', 5000), ) display_attrs = ('provider', 'service_id', 'description') + + +@register_search +class VirtualCircuitIndex(SearchIndex): + model = models.VirtualCircuit + fields = ( + ('cid', 100), + ('description', 500), + ('comments', 5000), + ) + display_attrs = ('provider', 'provider_network', 'provider_account', 'status', 'tenant', 'description') + + +@register_search +class VirtualCircuitTerminationIndex(SearchIndex): + model = models.VirtualCircuitTermination + fields = ( + ('description', 500), + ) + display_attrs = ('virtual_circuit', 'role', 'description') diff --git a/netbox/circuits/tables/__init__.py b/netbox/circuits/tables/__init__.py index b61c13cae..a436eb88d 100644 --- a/netbox/circuits/tables/__init__.py +++ b/netbox/circuits/tables/__init__.py @@ -1,3 +1,4 @@ from .circuits import * from .columns import * from .providers import * +from .virtual_circuits import * diff --git a/netbox/circuits/tables/virtual_circuits.py b/netbox/circuits/tables/virtual_circuits.py new file mode 100644 index 000000000..b7617f297 --- /dev/null +++ b/netbox/circuits/tables/virtual_circuits.py @@ -0,0 +1,95 @@ +import django_tables2 as tables +from django.utils.translation import gettext_lazy as _ + +from circuits.models import * +from netbox.tables import NetBoxTable, columns +from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin + +__all__ = ( + 'VirtualCircuitTable', + 'VirtualCircuitTerminationTable', +) + + +class VirtualCircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): + cid = tables.Column( + linkify=True, + verbose_name=_('Circuit ID') + ) + provider = tables.Column( + accessor=tables.A('provider_network__provider'), + verbose_name=_('Provider'), + linkify=True + ) + provider_network = tables.Column( + linkify=True, + verbose_name=_('Provider network') + ) + provider_account = tables.Column( + linkify=True, + verbose_name=_('Account') + ) + status = columns.ChoiceFieldColumn() + termination_count = columns.LinkedCountColumn( + viewname='circuits:virtualcircuittermination_list', + url_params={'virtual_circuit_id': 'pk'}, + verbose_name=_('Terminations') + ) + comments = columns.MarkdownColumn( + verbose_name=_('Comments') + ) + tags = columns.TagColumn( + url_name='circuits:virtualcircuit_list' + ) + + class Meta(NetBoxTable.Meta): + model = VirtualCircuit + fields = ( + 'pk', 'id', 'cid', 'provider', 'provider_account', 'provider_network', 'status', 'tenant', 'tenant_group', + 'description', 'comments', 'tags', 'created', 'last_updated', + ) + default_columns = ( + 'pk', 'cid', 'provider', 'provider_account', 'provider_network', 'status', 'tenant', 'termination_count', + 'description', + ) + + +class VirtualCircuitTerminationTable(NetBoxTable): + virtual_circuit = tables.Column( + verbose_name=_('Virtual circuit'), + linkify=True + ) + provider = tables.Column( + accessor=tables.A('virtual_circuit__provider_network__provider'), + verbose_name=_('Provider'), + linkify=True + ) + provider_network = tables.Column( + accessor=tables.A('virtual_circuit__provider_network'), + linkify=True, + verbose_name=_('Provider network') + ) + provider_account = tables.Column( + linkify=True, + verbose_name=_('Account') + ) + role = columns.ChoiceFieldColumn() + device = tables.Column( + accessor=tables.A('interface__device'), + linkify=True, + verbose_name=_('Device') + ) + interface = tables.Column( + verbose_name=_('Interface'), + linkify=True + ) + + class Meta(NetBoxTable.Meta): + model = VirtualCircuitTermination + fields = ( + 'pk', 'id', 'virtual_circuit', 'provider', 'provider_network', 'provider_account', 'role', 'interfaces', + 'description', 'created', 'last_updated', 'actions', + ) + default_columns = ( + 'pk', 'id', 'virtual_circuit', 'role', 'device', 'interface', 'description', + ) diff --git a/netbox/circuits/tests/test_api.py b/netbox/circuits/tests/test_api.py index 1b2e9f3f8..12c6b2a93 100644 --- a/netbox/circuits/tests/test_api.py +++ b/netbox/circuits/tests/test_api.py @@ -2,7 +2,8 @@ from django.urls import reverse from circuits.choices import * from circuits.models import * -from dcim.models import Site +from dcim.choices import InterfaceTypeChoices +from dcim.models import Device, DeviceRole, DeviceType, Interface, Manufacturer, Site from ipam.models import ASN, RIR from utilities.testing import APITestCase, APIViewTestCases @@ -397,3 +398,240 @@ class ProviderNetworkTest(APIViewTestCases.APIViewTestCase): 'provider': providers[1].pk, 'description': 'New description', } + + +class VirtualCircuitTest(APIViewTestCases.APIViewTestCase): + model = VirtualCircuit + brief_fields = ['cid', 'description', 'display', 'id', 'provider_network', 'url'] + bulk_update_data = { + 'status': 'planned', + } + + @classmethod + def setUpTestData(cls): + provider = Provider.objects.create(name='Provider 1', slug='provider-1') + provider_network = ProviderNetwork.objects.create(provider=provider, name='Provider Network 1') + provider_account = ProviderAccount.objects.create(provider=provider, account='Provider Account 1') + + virtual_circuits = ( + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 1' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 2' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 3' + ), + ) + VirtualCircuit.objects.bulk_create(virtual_circuits) + + cls.create_data = [ + { + 'cid': 'Virtual Circuit 4', + 'provider_network': provider_network.pk, + 'provider_account': provider_account.pk, + 'status': CircuitStatusChoices.STATUS_PLANNED, + }, + { + 'cid': 'Virtual Circuit 5', + 'provider_network': provider_network.pk, + 'provider_account': provider_account.pk, + 'status': CircuitStatusChoices.STATUS_PLANNED, + }, + { + 'cid': 'Virtual Circuit 6', + 'provider_network': provider_network.pk, + 'provider_account': provider_account.pk, + 'status': CircuitStatusChoices.STATUS_PLANNED, + }, + ] + + +class VirtualCircuitTerminationTest(APIViewTestCases.APIViewTestCase): + model = VirtualCircuitTermination + brief_fields = ['description', 'display', 'id', 'interface', 'role', 'url', 'virtual_circuit'] + bulk_update_data = { + 'description': 'New description', + } + + @classmethod + def setUpTestData(cls): + manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1') + device_type = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type 1') + device_role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') + site = Site.objects.create(name='Site 1', slug='site-1') + + devices = ( + Device(site=site, name='hub', device_type=device_type, role=device_role), + Device(site=site, name='spoke1', device_type=device_type, role=device_role), + Device(site=site, name='spoke2', device_type=device_type, role=device_role), + Device(site=site, name='spoke3', device_type=device_type, role=device_role), + ) + Device.objects.bulk_create(devices) + + physical_interfaces = ( + Interface(device=devices[0], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[1], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[2], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[3], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + ) + Interface.objects.bulk_create(physical_interfaces) + + virtual_interfaces = ( + # Point-to-point VCs + Interface( + device=devices[0], + name='eth0.1', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[0], + name='eth0.2', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[0], + name='eth0.3', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[1], + name='eth0.1', + parent=physical_interfaces[1], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[2], + name='eth0.1', + parent=physical_interfaces[2], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[3], + name='eth0.1', + parent=physical_interfaces[3], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + + # Hub and spoke VCs + Interface( + device=devices[0], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[1], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[2], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[3], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + ) + Interface.objects.bulk_create(virtual_interfaces) + + provider = Provider.objects.create(name='Provider 1', slug='provider-1') + provider_network = ProviderNetwork.objects.create(provider=provider, name='Provider Network 1') + provider_account = ProviderAccount.objects.create(provider=provider, account='Provider Account 1') + + virtual_circuits = ( + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 1' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 2' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 3' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 4' + ), + ) + VirtualCircuit.objects.bulk_create(virtual_circuits) + + virtual_circuit_terminations = ( + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[0] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[3] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[1] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[4] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[2] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[5] + ), + ) + VirtualCircuitTermination.objects.bulk_create(virtual_circuit_terminations) + + cls.create_data = [ + { + 'virtual_circuit': virtual_circuits[3].pk, + 'role': VirtualCircuitTerminationRoleChoices.ROLE_HUB, + 'interface': virtual_interfaces[6].pk + }, + { + 'virtual_circuit': virtual_circuits[3].pk, + 'role': VirtualCircuitTerminationRoleChoices.ROLE_SPOKE, + 'interface': virtual_interfaces[7].pk + }, + { + 'virtual_circuit': virtual_circuits[3].pk, + 'role': VirtualCircuitTerminationRoleChoices.ROLE_SPOKE, + 'interface': virtual_interfaces[8].pk + }, + { + 'virtual_circuit': virtual_circuits[3].pk, + 'role': VirtualCircuitTerminationRoleChoices.ROLE_SPOKE, + 'interface': virtual_interfaces[9].pk + }, + ] diff --git a/netbox/circuits/tests/test_filtersets.py b/netbox/circuits/tests/test_filtersets.py index 0dbc7172b..01b5e3105 100644 --- a/netbox/circuits/tests/test_filtersets.py +++ b/netbox/circuits/tests/test_filtersets.py @@ -3,7 +3,8 @@ from django.test import TestCase from circuits.choices import * from circuits.filtersets import * from circuits.models import * -from dcim.models import Cable, Region, Site, SiteGroup +from dcim.choices import InterfaceTypeChoices +from dcim.models import Cable, Device, DeviceRole, DeviceType, Interface, Manufacturer, Region, Site, SiteGroup from ipam.models import ASN, RIR from netbox.choices import DistanceUnitChoices from tenancy.models import Tenant, TenantGroup @@ -678,3 +679,293 @@ class ProviderAccountTestCase(TestCase, ChangeLoggedFilterSetTests): self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) params = {'provider': [providers[0].slug, providers[1].slug]} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + +class VirtualCircuitTestCase(TestCase, ChangeLoggedFilterSetTests): + queryset = VirtualCircuit.objects.all() + filterset = VirtualCircuitFilterSet + + @classmethod + def setUpTestData(cls): + + tenant_groups = ( + TenantGroup(name='Tenant group 1', slug='tenant-group-1'), + TenantGroup(name='Tenant group 2', slug='tenant-group-2'), + TenantGroup(name='Tenant group 3', slug='tenant-group-3'), + ) + for tenantgroup in tenant_groups: + tenantgroup.save() + + tenants = ( + Tenant(name='Tenant 1', slug='tenant-1', group=tenant_groups[0]), + Tenant(name='Tenant 2', slug='tenant-2', group=tenant_groups[1]), + Tenant(name='Tenant 3', slug='tenant-3', group=tenant_groups[2]), + ) + Tenant.objects.bulk_create(tenants) + + providers = ( + Provider(name='Provider 1', slug='provider-1'), + Provider(name='Provider 2', slug='provider-2'), + Provider(name='Provider 3', slug='provider-3'), + ) + Provider.objects.bulk_create(providers) + + provider_accounts = ( + ProviderAccount(name='Provider Account 1', provider=providers[0], account='A'), + ProviderAccount(name='Provider Account 2', provider=providers[1], account='B'), + ProviderAccount(name='Provider Account 3', provider=providers[2], account='C'), + ) + ProviderAccount.objects.bulk_create(provider_accounts) + + provider_networks = ( + ProviderNetwork(name='Provider Network 1', provider=providers[0]), + ProviderNetwork(name='Provider Network 2', provider=providers[1]), + ProviderNetwork(name='Provider Network 3', provider=providers[2]), + ) + ProviderNetwork.objects.bulk_create(provider_networks) + + virutal_circuits = ( + VirtualCircuit( + provider_network=provider_networks[0], + provider_account=provider_accounts[0], + tenant=tenants[0], + cid='Virtual Circuit 1', + status=CircuitStatusChoices.STATUS_PLANNED, + description='virtualcircuit1', + ), + VirtualCircuit( + provider_network=provider_networks[1], + provider_account=provider_accounts[1], + tenant=tenants[1], + cid='Virtual Circuit 2', + status=CircuitStatusChoices.STATUS_ACTIVE, + description='virtualcircuit2', + ), + VirtualCircuit( + provider_network=provider_networks[2], + provider_account=provider_accounts[2], + tenant=tenants[2], + cid='Virtual Circuit 3', + status=CircuitStatusChoices.STATUS_DEPROVISIONING, + description='virtualcircuit3', + ), + ) + VirtualCircuit.objects.bulk_create(virutal_circuits) + + def test_q(self): + params = {'q': 'virtualcircuit1'} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + + def test_cid(self): + params = {'cid': ['Virtual Circuit 1', 'Virtual Circuit 2']} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_provider(self): + providers = Provider.objects.all()[:2] + params = {'provider_id': [providers[0].pk, providers[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'provider': [providers[0].slug, providers[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_provider_account(self): + provider_accounts = ProviderAccount.objects.all()[:2] + params = {'provider_account_id': [provider_accounts[0].pk, provider_accounts[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_provider_network(self): + provider_networks = ProviderNetwork.objects.all()[:2] + params = {'provider_network_id': [provider_networks[0].pk, provider_networks[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_status(self): + params = {'status': [CircuitStatusChoices.STATUS_ACTIVE, CircuitStatusChoices.STATUS_PLANNED]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_description(self): + params = {'description': ['virtualcircuit1', 'virtualcircuit2']} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_tenant(self): + tenants = Tenant.objects.all()[:2] + params = {'tenant_id': [tenants[0].pk, tenants[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'tenant': [tenants[0].slug, tenants[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_tenant_group(self): + tenant_groups = TenantGroup.objects.all()[:2] + params = {'tenant_group_id': [tenant_groups[0].pk, tenant_groups[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + params = {'tenant_group': [tenant_groups[0].slug, tenant_groups[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + +class VirtualCircuitTerminationTestCase(TestCase, ChangeLoggedFilterSetTests): + queryset = VirtualCircuitTermination.objects.all() + filterset = VirtualCircuitTerminationFilterSet + + @classmethod + def setUpTestData(cls): + manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1') + device_type = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type 1') + device_role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') + site = Site.objects.create(name='Site 1', slug='site-1') + + devices = ( + Device(site=site, name='Device 1', device_type=device_type, role=device_role), + Device(site=site, name='Device 2', device_type=device_type, role=device_role), + Device(site=site, name='Device 3', device_type=device_type, role=device_role), + ) + Device.objects.bulk_create(devices) + + virtual_interfaces = ( + # Device 1 + Interface( + device=devices[0], + name='eth0.1', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[0], + name='eth0.2', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + # Device 2 + Interface( + device=devices[1], + name='eth0.1', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[1], + name='eth0.2', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + # Device 3 + Interface( + device=devices[2], + name='eth0.1', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[2], + name='eth0.2', + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + ) + Interface.objects.bulk_create(virtual_interfaces) + + providers = ( + Provider(name='Provider 1', slug='provider-1'), + Provider(name='Provider 2', slug='provider-2'), + Provider(name='Provider 3', slug='provider-3'), + ) + Provider.objects.bulk_create(providers) + provider_networks = ( + ProviderNetwork(provider=providers[0], name='Provider Network 1'), + ProviderNetwork(provider=providers[1], name='Provider Network 2'), + ProviderNetwork(provider=providers[2], name='Provider Network 3'), + ) + ProviderNetwork.objects.bulk_create(provider_networks) + provider_accounts = ( + ProviderAccount(provider=providers[0], account='Provider Account 1'), + ProviderAccount(provider=providers[1], account='Provider Account 2'), + ProviderAccount(provider=providers[2], account='Provider Account 3'), + ) + ProviderAccount.objects.bulk_create(provider_accounts) + + virtual_circuits = ( + VirtualCircuit( + provider_network=provider_networks[0], + provider_account=provider_accounts[0], + cid='Virtual Circuit 1' + ), + VirtualCircuit( + provider_network=provider_networks[1], + provider_account=provider_accounts[1], + cid='Virtual Circuit 2' + ), + VirtualCircuit( + provider_network=provider_networks[2], + provider_account=provider_accounts[2], + cid='Virtual Circuit 3' + ), + ) + VirtualCircuit.objects.bulk_create(virtual_circuits) + + virtual_circuit_terminations = ( + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_HUB, + interface=virtual_interfaces[0], + description='termination1' + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_SPOKE, + interface=virtual_interfaces[3], + description='termination2' + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[1], + description='termination3' + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[4], + description='termination4' + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[2], + description='termination5' + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[5], + description='termination6' + ), + ) + VirtualCircuitTermination.objects.bulk_create(virtual_circuit_terminations) + + def test_q(self): + params = {'q': 'termination1'} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1) + + def test_description(self): + params = {'description': ['termination1', 'termination2']} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) + + def test_virtual_circuit_id(self): + virtual_circuits = VirtualCircuit.objects.filter()[:2] + params = {'virtual_circuit_id': [virtual_circuits[0].pk, virtual_circuits[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + + def test_provider(self): + providers = Provider.objects.all()[:2] + params = {'provider_id': [providers[0].pk, providers[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + params = {'provider': [providers[0].slug, providers[1].slug]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + + def test_provider_network(self): + provider_networks = ProviderNetwork.objects.all()[:2] + params = {'provider_network_id': [provider_networks[0].pk, provider_networks[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + + def test_provider_account(self): + provider_accounts = ProviderAccount.objects.all()[:2] + params = {'provider_account_id': [provider_accounts[0].pk, provider_accounts[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + params = {'provider_account': [provider_accounts[0].account, provider_accounts[1].account]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4) + + def test_interface(self): + interfaces = Interface.objects.all()[:2] + params = {'interface_id': [interfaces[0].pk, interfaces[1].pk]} + self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) diff --git a/netbox/circuits/tests/test_views.py b/netbox/circuits/tests/test_views.py index f6c626443..321c2daa7 100644 --- a/netbox/circuits/tests/test_views.py +++ b/netbox/circuits/tests/test_views.py @@ -7,7 +7,8 @@ from django.urls import reverse from circuits.choices import * from circuits.models import * from core.models import ObjectType -from dcim.models import Cable, Interface, Site +from dcim.choices import InterfaceTypeChoices +from dcim.models import Cable, Device, DeviceRole, DeviceType, Interface, Manufacturer, Site from ipam.models import ASN, RIR from netbox.choices import ImportFormatChoices from users.models import ObjectPermission @@ -341,7 +342,7 @@ class ProviderNetworkTestCase(ViewTestCases.PrimaryObjectViewTestCase): } -class TestCase(ViewTestCases.PrimaryObjectViewTestCase): +class CircuitTerminationTestCase(ViewTestCases.PrimaryObjectViewTestCase): model = CircuitTermination @classmethod @@ -518,3 +519,319 @@ class CircuitGroupAssignmentTestCase( cls.bulk_edit_data = { 'priority': CircuitPriorityChoices.PRIORITY_INACTIVE, } + + +class VirtualCircuitTestCase(ViewTestCases.PrimaryObjectViewTestCase): + model = VirtualCircuit + + def setUp(self): + super().setUp() + + self.add_permissions( + 'circuits.add_virtualcircuittermination', + ) + + @classmethod + def setUpTestData(cls): + provider = Provider.objects.create(name='Provider 1', slug='provider-1') + provider_networks = ( + ProviderNetwork(provider=provider, name='Provider Network 1'), + ProviderNetwork(provider=provider, name='Provider Network 2'), + ) + ProviderNetwork.objects.bulk_create(provider_networks) + provider_accounts = ( + ProviderAccount(provider=provider, account='Provider Account 1'), + ProviderAccount(provider=provider, account='Provider Account 2'), + ) + ProviderAccount.objects.bulk_create(provider_accounts) + + virtual_circuits = ( + VirtualCircuit( + provider_network=provider_networks[0], + provider_account=provider_accounts[0], + cid='Virtual Circuit 1' + ), + VirtualCircuit( + provider_network=provider_networks[0], + provider_account=provider_accounts[0], + cid='Virtual Circuit 2' + ), + VirtualCircuit( + provider_network=provider_networks[0], + provider_account=provider_accounts[0], + cid='Virtual Circuit 3' + ), + ) + VirtualCircuit.objects.bulk_create(virtual_circuits) + + device = create_test_device('Device 1') + interfaces = ( + Interface(device=device, name='Interface 1', type=InterfaceTypeChoices.TYPE_VIRTUAL), + Interface(device=device, name='Interface 2', type=InterfaceTypeChoices.TYPE_VIRTUAL), + Interface(device=device, name='Interface 3', type=InterfaceTypeChoices.TYPE_VIRTUAL), + ) + Interface.objects.bulk_create(interfaces) + + tags = create_tags('Alpha', 'Bravo', 'Charlie') + + cls.form_data = { + 'cid': 'Virtual Circuit X', + 'provider_network': provider_networks[1].pk, + 'provider_account': provider_accounts[1].pk, + 'status': CircuitStatusChoices.STATUS_PLANNED, + 'description': 'A new virtual circuit', + 'comments': 'Some comments', + 'tags': [t.pk for t in tags], + } + + cls.csv_data = ( + "cid,provider_network,provider_account,status", + f"Virtual Circuit 4,Provider Network 1,Provider Account 1,{CircuitStatusChoices.STATUS_PLANNED}", + f"Virtual Circuit 5,Provider Network 1,Provider Account 1,{CircuitStatusChoices.STATUS_PLANNED}", + f"Virtual Circuit 6,Provider Network 1,Provider Account 1,{CircuitStatusChoices.STATUS_PLANNED}", + ) + + cls.csv_update_data = ( + "id,cid,description,status", + f"{virtual_circuits[0].pk},Virtual Circuit A,New description,{CircuitStatusChoices.STATUS_DECOMMISSIONED}", + f"{virtual_circuits[1].pk},Virtual Circuit B,New description,{CircuitStatusChoices.STATUS_DECOMMISSIONED}", + f"{virtual_circuits[2].pk},Virtual Circuit C,New description,{CircuitStatusChoices.STATUS_DECOMMISSIONED}", + ) + + cls.bulk_edit_data = { + 'provider_network': provider_networks[1].pk, + 'provider_account': provider_accounts[1].pk, + 'status': CircuitStatusChoices.STATUS_DECOMMISSIONED, + 'description': 'New description', + 'comments': 'New comments', + } + + @override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], EXEMPT_EXCLUDE_MODELS=[]) + def test_bulk_import_objects_with_terminations(self): + interfaces = Interface.objects.filter(type=InterfaceTypeChoices.TYPE_VIRTUAL) + json_data = f""" + [ + {{ + "cid": "Virtual Circuit 7", + "provider_network": "Provider Network 1", + "status": "active", + "terminations": [ + {{ + "role": "hub", + "interface": {interfaces[0].pk} + }}, + {{ + "role": "spoke", + "interface": {interfaces[1].pk} + }}, + {{ + "role": "spoke", + "interface": {interfaces[2].pk} + }} + ] + }} + ] + """ + + initial_count = self._get_queryset().count() + data = { + 'data': json_data, + 'format': ImportFormatChoices.JSON, + } + + # Assign model-level permission + obj_perm = ObjectPermission( + name='Test permission', + actions=['add'] + ) + obj_perm.save() + obj_perm.users.add(self.user) + obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) + + # Try GET with model-level permission + self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + + # Test POST with permission + self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertEqual(self._get_queryset().count(), initial_count + 1) + + +class VirtualCircuitTerminationTestCase(ViewTestCases.PrimaryObjectViewTestCase): + model = VirtualCircuitTermination + + @classmethod + def setUpTestData(cls): + manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1') + device_type = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type 1') + device_role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') + site = Site.objects.create(name='Site 1', slug='site-1') + + devices = ( + Device(site=site, name='hub', device_type=device_type, role=device_role), + Device(site=site, name='spoke1', device_type=device_type, role=device_role), + Device(site=site, name='spoke2', device_type=device_type, role=device_role), + Device(site=site, name='spoke3', device_type=device_type, role=device_role), + ) + Device.objects.bulk_create(devices) + + physical_interfaces = ( + Interface(device=devices[0], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[1], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[2], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface(device=devices[3], name='eth0', type=InterfaceTypeChoices.TYPE_1GE_FIXED), + ) + Interface.objects.bulk_create(physical_interfaces) + + virtual_interfaces = ( + # Point-to-point VCs + Interface( + device=devices[0], + name='eth0.1', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[0], + name='eth0.2', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[0], + name='eth0.3', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[1], + name='eth0.1', + parent=physical_interfaces[1], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[2], + name='eth0.1', + parent=physical_interfaces[2], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[3], + name='eth0.1', + parent=physical_interfaces[3], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + + # Hub and spoke VCs + Interface( + device=devices[0], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[1], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[2], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + Interface( + device=devices[3], + name='eth0.9', + parent=physical_interfaces[0], + type=InterfaceTypeChoices.TYPE_VIRTUAL + ), + ) + Interface.objects.bulk_create(virtual_interfaces) + + provider = Provider.objects.create(name='Provider 1', slug='provider-1') + provider_network = ProviderNetwork.objects.create(provider=provider, name='Provider Network 1') + provider_account = ProviderAccount.objects.create(provider=provider, account='Provider Account 1') + + virtual_circuits = ( + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 1' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 2' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 3' + ), + VirtualCircuit( + provider_network=provider_network, + provider_account=provider_account, + cid='Virtual Circuit 4' + ), + ) + VirtualCircuit.objects.bulk_create(virtual_circuits) + + virtual_circuit_terminations = ( + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[0] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[0], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[3] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[1] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[1], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[4] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[2] + ), + VirtualCircuitTermination( + virtual_circuit=virtual_circuits[2], + role=VirtualCircuitTerminationRoleChoices.ROLE_PEER, + interface=virtual_interfaces[5] + ), + ) + VirtualCircuitTermination.objects.bulk_create(virtual_circuit_terminations) + + cls.form_data = { + 'virtual_circuit': virtual_circuits[3].pk, + 'role': VirtualCircuitTerminationRoleChoices.ROLE_HUB, + 'interface': virtual_interfaces[6].pk + } + + cls.csv_data = ( + "virtual_circuit,role,interface,description", + f"Virtual Circuit 4,{VirtualCircuitTerminationRoleChoices.ROLE_HUB},{virtual_interfaces[6].pk},Hub", + f"Virtual Circuit 4,{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},{virtual_interfaces[7].pk},Spoke 1", + f"Virtual Circuit 4,{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},{virtual_interfaces[8].pk},Spoke 2", + f"Virtual Circuit 4,{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},{virtual_interfaces[9].pk},Spoke 3", + ) + + cls.csv_update_data = ( + "id,role,description", + f"{virtual_circuit_terminations[0].pk},{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},New description", + f"{virtual_circuit_terminations[1].pk},{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},New description", + f"{virtual_circuit_terminations[2].pk},{VirtualCircuitTerminationRoleChoices.ROLE_SPOKE},New description", + ) + + cls.bulk_edit_data = { + 'description': 'New description', + } diff --git a/netbox/circuits/urls.py b/netbox/circuits/urls.py index 2171d49be..bd9ca6989 100644 --- a/netbox/circuits/urls.py +++ b/netbox/circuits/urls.py @@ -70,4 +70,20 @@ urlpatterns = [ path('circuit-group-assignments/edit/', views.CircuitGroupAssignmentBulkEditView.as_view(), name='circuitgroupassignment_bulk_edit'), path('circuit-group-assignments/delete/', views.CircuitGroupAssignmentBulkDeleteView.as_view(), name='circuitgroupassignment_bulk_delete'), path('circuit-group-assignments//', include(get_model_urls('circuits', 'circuitgroupassignment'))), + + # Virtual circuits + path('virtual-circuits/', views.VirtualCircuitListView.as_view(), name='virtualcircuit_list'), + path('virtual-circuits/add/', views.VirtualCircuitEditView.as_view(), name='virtualcircuit_add'), + path('virtual-circuits/import/', views.VirtualCircuitBulkImportView.as_view(), name='virtualcircuit_import'), + path('virtual-circuits/edit/', views.VirtualCircuitBulkEditView.as_view(), name='virtualcircuit_bulk_edit'), + path('virtual-circuits/delete/', views.VirtualCircuitBulkDeleteView.as_view(), name='virtualcircuit_bulk_delete'), + path('virtual-circuits//', include(get_model_urls('circuits', 'virtualcircuit'))), + + # Virtual circuit terminations + path('virtual-circuit-terminations/', views.VirtualCircuitTerminationListView.as_view(), name='virtualcircuittermination_list'), + path('virtual-circuit-terminations/add/', views.VirtualCircuitTerminationEditView.as_view(), name='virtualcircuittermination_add'), + path('virtual-circuit-terminations/import/', views.VirtualCircuitTerminationBulkImportView.as_view(), name='virtualcircuittermination_import'), + path('virtual-circuit-terminations/edit/', views.VirtualCircuitTerminationBulkEditView.as_view(), name='virtualcircuittermination_bulk_edit'), + path('virtual-circuit-terminations/delete/', views.VirtualCircuitTerminationBulkDeleteView.as_view(), name='virtualcircuittermination_bulk_delete'), + path('virtual-circuit-terminations//', include(get_model_urls('circuits', 'virtualcircuittermination'))), ] diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 4059065bf..34a1deb6a 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -537,3 +537,109 @@ class CircuitGroupAssignmentBulkDeleteView(generic.BulkDeleteView): queryset = CircuitGroupAssignment.objects.all() filterset = filtersets.CircuitGroupAssignmentFilterSet table = tables.CircuitGroupAssignmentTable + + +# +# Virtual circuits +# + +class VirtualCircuitListView(generic.ObjectListView): + queryset = VirtualCircuit.objects.annotate( + termination_count=count_related(VirtualCircuitTermination, 'virtual_circuit') + ) + filterset = filtersets.VirtualCircuitFilterSet + filterset_form = forms.VirtualCircuitFilterForm + table = tables.VirtualCircuitTable + + +@register_model_view(VirtualCircuit) +class VirtualCircuitView(generic.ObjectView): + queryset = VirtualCircuit.objects.all() + + +@register_model_view(VirtualCircuit, 'edit') +class VirtualCircuitEditView(generic.ObjectEditView): + queryset = VirtualCircuit.objects.all() + form = forms.VirtualCircuitForm + + +@register_model_view(VirtualCircuit, 'delete') +class VirtualCircuitDeleteView(generic.ObjectDeleteView): + queryset = VirtualCircuit.objects.all() + + +class VirtualCircuitBulkImportView(generic.BulkImportView): + queryset = VirtualCircuit.objects.all() + model_form = forms.VirtualCircuitImportForm + additional_permissions = [ + 'circuits.add_virtualcircuittermination', + ] + related_object_forms = { + 'terminations': forms.VirtualCircuitTerminationImportRelatedForm, + } + + def prep_related_object_data(self, parent, data): + data.update({'virtual_circuit': parent}) + return data + + +class VirtualCircuitBulkEditView(generic.BulkEditView): + queryset = VirtualCircuit.objects.annotate( + termination_count=count_related(VirtualCircuitTermination, 'virtual_circuit') + ) + filterset = filtersets.VirtualCircuitFilterSet + table = tables.VirtualCircuitTable + form = forms.VirtualCircuitBulkEditForm + + +class VirtualCircuitBulkDeleteView(generic.BulkDeleteView): + queryset = VirtualCircuit.objects.annotate( + termination_count=count_related(VirtualCircuitTermination, 'virtual_circuit') + ) + filterset = filtersets.VirtualCircuitFilterSet + table = tables.VirtualCircuitTable + + +# +# Virtual circuit terminations +# + +class VirtualCircuitTerminationListView(generic.ObjectListView): + queryset = VirtualCircuitTermination.objects.all() + filterset = filtersets.VirtualCircuitTerminationFilterSet + filterset_form = forms.VirtualCircuitTerminationFilterForm + table = tables.VirtualCircuitTerminationTable + + +@register_model_view(VirtualCircuitTermination) +class VirtualCircuitTerminationView(generic.ObjectView): + queryset = VirtualCircuitTermination.objects.all() + + +@register_model_view(VirtualCircuitTermination, 'edit') +class VirtualCircuitTerminationEditView(generic.ObjectEditView): + queryset = VirtualCircuitTermination.objects.all() + form = forms.VirtualCircuitTerminationForm + + +@register_model_view(VirtualCircuitTermination, 'delete') +class VirtualCircuitTerminationDeleteView(generic.ObjectDeleteView): + queryset = VirtualCircuitTermination.objects.all() + + +class VirtualCircuitTerminationBulkImportView(generic.BulkImportView): + queryset = VirtualCircuitTermination.objects.all() + model_form = forms.VirtualCircuitTerminationImportForm + + +class VirtualCircuitTerminationBulkEditView(generic.BulkEditView): + queryset = VirtualCircuitTermination.objects.all() + filterset = filtersets.VirtualCircuitTerminationFilterSet + table = tables.VirtualCircuitTerminationTable + form = forms.VirtualCircuitTerminationBulkEditForm + + +class VirtualCircuitTerminationBulkDeleteView(generic.BulkDeleteView): + queryset = VirtualCircuitTermination.objects.all() + filterset = filtersets.VirtualCircuitTerminationFilterSet + table = tables.VirtualCircuitTerminationTable diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index cb8d91c89..f4d65d4bc 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -4,7 +4,7 @@ from django.utils.translation import gettext as _ from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import extend_schema_field -from circuits.models import CircuitTermination +from circuits.models import CircuitTermination, VirtualCircuit, VirtualCircuitTermination from extras.filtersets import LocalConfigContextFilterSet from extras.models import ConfigTemplate from ipam.filtersets import PrimaryIPFilterSet @@ -1842,6 +1842,16 @@ class InterfaceFilterSet( queryset=WirelessLink.objects.all(), label=_('Wireless link') ) + virtual_circuit_id = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit_termination__virtual_circuit', + queryset=VirtualCircuit.objects.all(), + label=_('Virtual circuit (ID)'), + ) + virtual_circuit_termination_id = django_filters.ModelMultipleChoiceFilter( + field_name='virtual_circuit_termination', + queryset=VirtualCircuitTermination.objects.all(), + label=_('Virtual circuit termination (ID)'), + ) class Meta: model = Interface diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 9b108bcca..ce9e5607f 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -998,6 +998,14 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd def l2vpn_termination(self): return self.l2vpn_terminations.first() + @cached_property + def connected_endpoints(self): + # If this is a virtual interface, return the remote endpoint of the connected + # virtual circuit, if any. + if self.is_virtual and hasattr(self, 'virtual_circuit_termination'): + return self.virtual_circuit_termination.peer_terminations + return super().connected_endpoints + # # Pass-through ports diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index d226c7335..494d83114 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -649,6 +649,14 @@ class InterfaceTable(BaseInterfaceTable, ModularDeviceComponentTable, PathEndpoi url_name='dcim:interface_list' ) + # Override PathEndpointTable.connection to accommodate virtual circuits + connection = columns.TemplateColumn( + accessor='_path__destinations', + template_code=INTERFACE_LINKTERMINATION, + verbose_name=_('Connection'), + orderable=False + ) + class Meta(DeviceComponentTable.Meta): model = models.Interface fields = ( diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index dc9724e3c..e6f2c8817 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -10,6 +10,20 @@ LINKTERMINATION = """ {% endfor %} """ +INTERFACE_LINKTERMINATION = """ +{% load i18n %} +{% if record.is_virtual and record.virtual_circuit_termination %} + {% for termination in record.connected_endpoints %} + {{ termination.interface.parent_object }} + + {{ termination.interface }} + {% trans "via" %} + {{ termination.parent_object }} + {% if not forloop.last %}
    {% endif %} + {% endfor %} +{% else %}""" + LINKTERMINATION + """{% endif %} +""" + CABLE_LENGTH = """ {% load helpers %} {% if record.length %}{{ record.length|floatformat:"-2" }} {{ record.length_unit }}{% endif %} diff --git a/netbox/extras/tests/test_filtersets.py b/netbox/extras/tests/test_filtersets.py index b3d576cb9..c94e36e4b 100644 --- a/netbox/extras/tests/test_filtersets.py +++ b/netbox/extras/tests/test_filtersets.py @@ -1168,6 +1168,8 @@ class TagTestCase(TestCase, ChangeLoggedFilterSetTests): 'tunnelgroup', 'tunneltermination', 'virtualchassis', + 'virtualcircuit', + 'virtualcircuittermination', 'virtualdevicecontext', 'virtualdisk', 'virtualmachine', diff --git a/netbox/netbox/navigation/menu.py b/netbox/netbox/navigation/menu.py index 1c4f9bf88..ba20e5f98 100644 --- a/netbox/netbox/navigation/menu.py +++ b/netbox/netbox/navigation/menu.py @@ -284,6 +284,13 @@ CIRCUITS_MENU = Menu( get_model_item('circuits', 'circuittermination', _('Circuit Terminations')), ), ), + MenuGroup( + label=_('Virtual Circuits'), + items=( + get_model_item('circuits', 'virtualcircuit', _('Virtual Circuits')), + get_model_item('circuits', 'virtualcircuittermination', _('Virtual Circuit Terminations')), + ), + ), MenuGroup( label=_('Providers'), items=( diff --git a/netbox/templates/circuits/providernetwork.html b/netbox/templates/circuits/providernetwork.html index 000548734..5fd92615d 100644 --- a/netbox/templates/circuits/providernetwork.html +++ b/netbox/templates/circuits/providernetwork.html @@ -50,6 +50,19 @@

    {% trans "Circuits" %}

    {% htmx_table 'circuits:circuit_list' provider_network_id=object.pk %}
    +
    +

    + {% trans "Virtual Circuits" %} + {% if perms.circuits.add_virtualcircuit %} + + {% endif %} +

    + {% htmx_table 'circuits:virtualcircuit_list' provider_network_id=object.pk %} +
    {% plugin_full_width_page object %}
    diff --git a/netbox/templates/circuits/virtualcircuit.html b/netbox/templates/circuits/virtualcircuit.html new file mode 100644 index 000000000..400f90524 --- /dev/null +++ b/netbox/templates/circuits/virtualcircuit.html @@ -0,0 +1,84 @@ +{% extends 'generic/object.html' %} +{% load helpers %} +{% load plugins %} +{% load i18n %} + +{% block breadcrumbs %} + {{ block.super }} + + +{% endblock %} + +{% block content %} +
    +
    +
    +

    {% trans "Virtual circuit" %}

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {% trans "Provider" %}{{ object.provider|linkify }}
    {% trans "Provider Network" %}{{ object.provider_network|linkify }}
    {% trans "Provider account" %}{{ object.provider_account|linkify|placeholder }}
    {% trans "Circuit ID" %}{{ object.cid }}
    {% trans "Status" %}{% badge object.get_status_display bg_color=object.get_status_color %}
    {% trans "Tenant" %} + {% if object.tenant.group %} + {{ object.tenant.group|linkify }} / + {% endif %} + {{ object.tenant|linkify|placeholder }} +
    {% trans "Description" %}{{ object.description|placeholder }}
    +
    + {% include 'inc/panels/tags.html' %} + {% plugin_left_page object %} +
    +
    + {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
    +
    +
    +
    +
    +

    + {% trans "Terminations" %} + {% if perms.circuits.add_virtualcircuittermination %} + + {% endif %} +

    + {% htmx_table 'circuits:virtualcircuittermination_list' virtual_circuit_id=object.pk %} +
    + {% plugin_full_width_page object %} +
    +
    +{% endblock %} diff --git a/netbox/templates/circuits/virtualcircuittermination.html b/netbox/templates/circuits/virtualcircuittermination.html new file mode 100644 index 000000000..c08e3c604 --- /dev/null +++ b/netbox/templates/circuits/virtualcircuittermination.html @@ -0,0 +1,81 @@ +{% extends 'generic/object.html' %} +{% load helpers %} +{% load plugins %} +{% load i18n %} + +{% block breadcrumbs %} + {{ block.super }} + + + +{% endblock %} + +{% block content %} +
    +
    +
    +

    {% trans "Virtual Circuit Termination" %}

    + + + + + + + + + + + + + + + + + + + + + +
    {% trans "Provider" %}{{ object.virtual_circuit.provider|linkify }}
    {% trans "Provider Network" %}{{ object.virtual_circuit.provider_network|linkify }}
    {% trans "Provider account" %}{{ object.virtual_circuit.provider_account|linkify|placeholder }}
    {% trans "Virtual circuit" %}{{ object.virtual_circuit|linkify }}
    {% trans "Role" %}{% badge object.get_role_display bg_color=object.get_role_color %}
    +
    + {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/custom_fields.html' %} + {% plugin_left_page object %} +
    +
    +
    +

    {% trans "Interface" %}

    + + + + + + + + + + + + + + + + + +
    {% trans "Device" %}{{ object.interface.device|linkify }}
    {% trans "Interface" %}{{ object.interface|linkify }}
    {% trans "Type" %}{{ object.interface.get_type_display }}
    {% trans "Description" %}{{ object.interface.description|placeholder }}
    +
    + {% plugin_right_page object %} +
    +
    +
    +
    + {% plugin_full_width_page object %} +
    +
    +{% endblock %} diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index f364b12bc..b0d307bee 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -152,7 +152,41 @@ - {% if not object.is_virtual %} + {% if object.is_virtual and object.virtual_circuit_termination %} +
    +

    {% trans "Virtual Circuit" %}

    + + + + + + + + + + + + + + + + + + + + + +
    {% trans "Provider" %}{{ object.virtual_circuit_termination.virtual_circuit.provider|linkify }}
    {% trans "Provider Network" %}{{ object.virtual_circuit_termination.virtual_circuit.provider_network|linkify }}
    {% trans "Circuit ID" %}{{ object.virtual_circuit_termination.virtual_circuit|linkify }}
    {% trans "Role" %}{{ object.virtual_circuit_termination.get_role_display }}
    {% trans "Connections" %} + {% for termination in object.virtual_circuit_termination.peer_terminations %} + {{ termination.interface.parent_object }} + + {{ termination.interface }} + ({{ termination.get_role_display }}) + {% if not forloop.last %}
    {% endif %} + {% endfor %} +
    +
    + {% elif not object.is_virtual %}

    {% trans "Connection" %}

    {% if object.mark_connected %} From a0b4b0afe01ef2da913148208bcfaff6ede9463f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Nov 2024 15:54:37 -0500 Subject: [PATCH 34/65] Closes #18023: Employ `register_model_view()` for list views (#18029) * Extend register_model_view() to enable registering list views * Register circuits list views with register_model_view() * Register core list views with register_model_view() * Fix bulk_edit & bulk_delete URL paths * Register dcim list views with register_model_view() (WIP) * Register dcim list views with register_model_view() * Register extras list views with register_model_view() * Register ipam list views with register_model_view() * Register tenancy list views with register_model_view() * Register users list views with register_model_view() * Register virtualization list views with register_model_view() * Register vpn list views with register_model_view() * Register wireless list views with register_model_view() * Add change note for register_model_view() --- docs/plugins/development/views.md | 3 + netbox/circuits/urls.py | 63 ++---- netbox/circuits/views.py | 40 ++++ netbox/core/urls.py | 29 +-- netbox/core/views.py | 16 ++ netbox/dcim/urls.py | 340 ++++++------------------------ netbox/dcim/views.py | 325 +++++++++++++++++++++++----- netbox/extras/urls.py | 112 +++------- netbox/extras/views.py | 93 ++++++-- netbox/ipam/urls.py | 126 ++--------- netbox/ipam/views.py | 88 ++++++++ netbox/tenancy/urls.py | 44 +--- netbox/tenancy/views.py | 44 +++- netbox/users/urls.py | 29 +-- netbox/users/views.py | 29 ++- netbox/utilities/urls.py | 11 +- netbox/utilities/views.py | 6 +- netbox/virtualization/urls.py | 56 ++--- netbox/virtualization/views.py | 32 +++ netbox/vpn/urls.py | 72 +------ netbox/vpn/views.py | 52 +++++ netbox/wireless/urls.py | 23 +- netbox/wireless/views.py | 15 ++ 23 files changed, 845 insertions(+), 803 deletions(-) diff --git a/docs/plugins/development/views.md b/docs/plugins/development/views.md index 1f5f164fd..3b6213917 100644 --- a/docs/plugins/development/views.md +++ b/docs/plugins/development/views.md @@ -185,6 +185,9 @@ class MyView(generic.ObjectView): ) ``` +!!! note "Changed in NetBox v4.2" + The `register_model_view()` function was extended in NetBox v4.2 to support registration of list views by passing `detail=False`. + ::: utilities.views.register_model_view ::: utilities.views.ViewTab diff --git a/netbox/circuits/urls.py b/netbox/circuits/urls.py index bd9ca6989..b4746038d 100644 --- a/netbox/circuits/urls.py +++ b/netbox/circuits/urls.py @@ -5,70 +5,33 @@ from . import views app_name = 'circuits' urlpatterns = [ - - # Providers - path('providers/', views.ProviderListView.as_view(), name='provider_list'), - path('providers/add/', views.ProviderEditView.as_view(), name='provider_add'), - path('providers/import/', views.ProviderBulkImportView.as_view(), name='provider_import'), - path('providers/edit/', views.ProviderBulkEditView.as_view(), name='provider_bulk_edit'), - path('providers/delete/', views.ProviderBulkDeleteView.as_view(), name='provider_bulk_delete'), + path('providers/', include(get_model_urls('circuits', 'provider', detail=False))), path('providers//', include(get_model_urls('circuits', 'provider'))), - # Provider accounts - path('provider-accounts/', views.ProviderAccountListView.as_view(), name='provideraccount_list'), - path('provider-accounts/add/', views.ProviderAccountEditView.as_view(), name='provideraccount_add'), - path('provider-accounts/import/', views.ProviderAccountBulkImportView.as_view(), name='provideraccount_import'), - path('provider-accounts/edit/', views.ProviderAccountBulkEditView.as_view(), name='provideraccount_bulk_edit'), - path('provider-accounts/delete/', views.ProviderAccountBulkDeleteView.as_view(), name='provideraccount_bulk_delete'), + path('provider-accounts/', include(get_model_urls('circuits', 'provideraccount', detail=False))), path('provider-accounts//', include(get_model_urls('circuits', 'provideraccount'))), - # Provider networks - path('provider-networks/', views.ProviderNetworkListView.as_view(), name='providernetwork_list'), - path('provider-networks/add/', views.ProviderNetworkEditView.as_view(), name='providernetwork_add'), - path('provider-networks/import/', views.ProviderNetworkBulkImportView.as_view(), name='providernetwork_import'), - path('provider-networks/edit/', views.ProviderNetworkBulkEditView.as_view(), name='providernetwork_bulk_edit'), - path('provider-networks/delete/', views.ProviderNetworkBulkDeleteView.as_view(), name='providernetwork_bulk_delete'), + path('provider-networks/', include(get_model_urls('circuits', 'providernetwork', detail=False))), path('provider-networks//', include(get_model_urls('circuits', 'providernetwork'))), - # Circuit types - path('circuit-types/', views.CircuitTypeListView.as_view(), name='circuittype_list'), - path('circuit-types/add/', views.CircuitTypeEditView.as_view(), name='circuittype_add'), - path('circuit-types/import/', views.CircuitTypeBulkImportView.as_view(), name='circuittype_import'), - path('circuit-types/edit/', views.CircuitTypeBulkEditView.as_view(), name='circuittype_bulk_edit'), - path('circuit-types/delete/', views.CircuitTypeBulkDeleteView.as_view(), name='circuittype_bulk_delete'), + path('circuit-types/', include(get_model_urls('circuits', 'circuittype', detail=False))), path('circuit-types//', include(get_model_urls('circuits', 'circuittype'))), - # Circuits - path('circuits/', views.CircuitListView.as_view(), name='circuit_list'), - path('circuits/add/', views.CircuitEditView.as_view(), name='circuit_add'), - path('circuits/import/', views.CircuitBulkImportView.as_view(), name='circuit_import'), - path('circuits/edit/', views.CircuitBulkEditView.as_view(), name='circuit_bulk_edit'), - path('circuits/delete/', views.CircuitBulkDeleteView.as_view(), name='circuit_bulk_delete'), - path('circuits//terminations/swap/', views.CircuitSwapTerminations.as_view(), name='circuit_terminations_swap'), + path('circuits/', include(get_model_urls('circuits', 'circuit', detail=False))), + path( + 'circuits//terminations/swap/', + views.CircuitSwapTerminations.as_view(), + name='circuit_terminations_swap' + ), path('circuits//', include(get_model_urls('circuits', 'circuit'))), - # Circuit terminations - path('circuit-terminations/', views.CircuitTerminationListView.as_view(), name='circuittermination_list'), - path('circuit-terminations/add/', views.CircuitTerminationEditView.as_view(), name='circuittermination_add'), - path('circuit-terminations/import/', views.CircuitTerminationBulkImportView.as_view(), name='circuittermination_import'), - path('circuit-terminations/edit/', views.CircuitTerminationBulkEditView.as_view(), name='circuittermination_bulk_edit'), - path('circuit-terminations/delete/', views.CircuitTerminationBulkDeleteView.as_view(), name='circuittermination_bulk_delete'), + path('circuit-terminations/', include(get_model_urls('circuits', 'circuittermination', detail=False))), path('circuit-terminations//', include(get_model_urls('circuits', 'circuittermination'))), - # Circuit Groups - path('circuit-groups/', views.CircuitGroupListView.as_view(), name='circuitgroup_list'), - path('circuit-groups/add/', views.CircuitGroupEditView.as_view(), name='circuitgroup_add'), - path('circuit-groups/import/', views.CircuitGroupBulkImportView.as_view(), name='circuitgroup_import'), - path('circuit-groups/edit/', views.CircuitGroupBulkEditView.as_view(), name='circuitgroup_bulk_edit'), - path('circuit-groups/delete/', views.CircuitGroupBulkDeleteView.as_view(), name='circuitgroup_bulk_delete'), + path('circuit-groups/', include(get_model_urls('circuits', 'circuitgroup', detail=False))), path('circuit-groups//', include(get_model_urls('circuits', 'circuitgroup'))), - # Circuit Group Assignments - path('circuit-group-assignments/', views.CircuitGroupAssignmentListView.as_view(), name='circuitgroupassignment_list'), - path('circuit-group-assignments/add/', views.CircuitGroupAssignmentEditView.as_view(), name='circuitgroupassignment_add'), - path('circuit-group-assignments/import/', views.CircuitGroupAssignmentBulkImportView.as_view(), name='circuitgroupassignment_import'), - path('circuit-group-assignments/edit/', views.CircuitGroupAssignmentBulkEditView.as_view(), name='circuitgroupassignment_bulk_edit'), - path('circuit-group-assignments/delete/', views.CircuitGroupAssignmentBulkDeleteView.as_view(), name='circuitgroupassignment_bulk_delete'), + path('circuit-group-assignments/', include(get_model_urls('circuits', 'circuitgroupassignment', detail=False))), path('circuit-group-assignments//', include(get_model_urls('circuits', 'circuitgroupassignment'))), # Virtual circuits diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 34a1deb6a..7410d0a8f 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -17,6 +17,7 @@ from .models import * # Providers # +@register_model_view(Provider, 'list', path='', detail=False) class ProviderListView(generic.ObjectListView): queryset = Provider.objects.annotate( count_circuits=count_related(Circuit, 'provider') @@ -36,6 +37,7 @@ class ProviderView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Provider, 'add', detail=False) @register_model_view(Provider, 'edit') class ProviderEditView(generic.ObjectEditView): queryset = Provider.objects.all() @@ -47,11 +49,13 @@ class ProviderDeleteView(generic.ObjectDeleteView): queryset = Provider.objects.all() +@register_model_view(Provider, 'import', detail=False) class ProviderBulkImportView(generic.BulkImportView): queryset = Provider.objects.all() model_form = forms.ProviderImportForm +@register_model_view(Provider, 'bulk_edit', path='edit', detail=False) class ProviderBulkEditView(generic.BulkEditView): queryset = Provider.objects.annotate( count_circuits=count_related(Circuit, 'provider') @@ -61,6 +65,7 @@ class ProviderBulkEditView(generic.BulkEditView): form = forms.ProviderBulkEditForm +@register_model_view(Provider, 'bulk_delete', path='delete', detail=False) class ProviderBulkDeleteView(generic.BulkDeleteView): queryset = Provider.objects.annotate( count_circuits=count_related(Circuit, 'provider') @@ -78,6 +83,7 @@ class ProviderContactsView(ObjectContactsView): # ProviderAccounts # +@register_model_view(ProviderAccount, 'list', path='', detail=False) class ProviderAccountListView(generic.ObjectListView): queryset = ProviderAccount.objects.annotate( count_circuits=count_related(Circuit, 'provider_account') @@ -97,6 +103,7 @@ class ProviderAccountView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ProviderAccount, 'add', detail=False) @register_model_view(ProviderAccount, 'edit') class ProviderAccountEditView(generic.ObjectEditView): queryset = ProviderAccount.objects.all() @@ -108,12 +115,14 @@ class ProviderAccountDeleteView(generic.ObjectDeleteView): queryset = ProviderAccount.objects.all() +@register_model_view(ProviderAccount, 'import', detail=False) class ProviderAccountBulkImportView(generic.BulkImportView): queryset = ProviderAccount.objects.all() model_form = forms.ProviderAccountImportForm table = tables.ProviderAccountTable +@register_model_view(ProviderAccount, 'bulk_edit', path='edit', detail=False) class ProviderAccountBulkEditView(generic.BulkEditView): queryset = ProviderAccount.objects.annotate( count_circuits=count_related(Circuit, 'provider_account') @@ -123,6 +132,7 @@ class ProviderAccountBulkEditView(generic.BulkEditView): form = forms.ProviderAccountBulkEditForm +@register_model_view(ProviderAccount, 'bulk_delete', path='delete', detail=False) class ProviderAccountBulkDeleteView(generic.BulkDeleteView): queryset = ProviderAccount.objects.annotate( count_circuits=count_related(Circuit, 'provider_account') @@ -140,6 +150,7 @@ class ProviderAccountContactsView(ObjectContactsView): # Provider networks # +@register_model_view(ProviderNetwork, 'list', path='', detail=False) class ProviderNetworkListView(generic.ObjectListView): queryset = ProviderNetwork.objects.all() filterset = filtersets.ProviderNetworkFilterSet @@ -166,6 +177,7 @@ class ProviderNetworkView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ProviderNetwork, 'add', detail=False) @register_model_view(ProviderNetwork, 'edit') class ProviderNetworkEditView(generic.ObjectEditView): queryset = ProviderNetwork.objects.all() @@ -177,11 +189,13 @@ class ProviderNetworkDeleteView(generic.ObjectDeleteView): queryset = ProviderNetwork.objects.all() +@register_model_view(ProviderNetwork, 'import', detail=False) class ProviderNetworkBulkImportView(generic.BulkImportView): queryset = ProviderNetwork.objects.all() model_form = forms.ProviderNetworkImportForm +@register_model_view(ProviderNetwork, 'bulk_edit', path='edit', detail=False) class ProviderNetworkBulkEditView(generic.BulkEditView): queryset = ProviderNetwork.objects.all() filterset = filtersets.ProviderNetworkFilterSet @@ -189,6 +203,7 @@ class ProviderNetworkBulkEditView(generic.BulkEditView): form = forms.ProviderNetworkBulkEditForm +@register_model_view(ProviderNetwork, 'bulk_delete', path='delete', detail=False) class ProviderNetworkBulkDeleteView(generic.BulkDeleteView): queryset = ProviderNetwork.objects.all() filterset = filtersets.ProviderNetworkFilterSet @@ -199,6 +214,7 @@ class ProviderNetworkBulkDeleteView(generic.BulkDeleteView): # Circuit Types # +@register_model_view(CircuitType, 'list', path='', detail=False) class CircuitTypeListView(generic.ObjectListView): queryset = CircuitType.objects.annotate( circuit_count=count_related(Circuit, 'type') @@ -218,6 +234,7 @@ class CircuitTypeView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(CircuitType, 'add', detail=False) @register_model_view(CircuitType, 'edit') class CircuitTypeEditView(generic.ObjectEditView): queryset = CircuitType.objects.all() @@ -229,11 +246,13 @@ class CircuitTypeDeleteView(generic.ObjectDeleteView): queryset = CircuitType.objects.all() +@register_model_view(CircuitType, 'import', detail=False) class CircuitTypeBulkImportView(generic.BulkImportView): queryset = CircuitType.objects.all() model_form = forms.CircuitTypeImportForm +@register_model_view(CircuitType, 'bulk_edit', path='edit', detail=False) class CircuitTypeBulkEditView(generic.BulkEditView): queryset = CircuitType.objects.annotate( circuit_count=count_related(Circuit, 'type') @@ -243,6 +262,7 @@ class CircuitTypeBulkEditView(generic.BulkEditView): form = forms.CircuitTypeBulkEditForm +@register_model_view(CircuitType, 'bulk_delete', path='delete', detail=False) class CircuitTypeBulkDeleteView(generic.BulkDeleteView): queryset = CircuitType.objects.annotate( circuit_count=count_related(Circuit, 'type') @@ -255,6 +275,7 @@ class CircuitTypeBulkDeleteView(generic.BulkDeleteView): # Circuits # +@register_model_view(Circuit, 'list', path='', detail=False) class CircuitListView(generic.ObjectListView): queryset = Circuit.objects.prefetch_related( 'tenant__group', 'termination_a__termination', 'termination_z__termination', @@ -269,6 +290,7 @@ class CircuitView(generic.ObjectView): queryset = Circuit.objects.all() +@register_model_view(Circuit, 'add', detail=False) @register_model_view(Circuit, 'edit') class CircuitEditView(generic.ObjectEditView): queryset = Circuit.objects.all() @@ -280,6 +302,7 @@ class CircuitDeleteView(generic.ObjectDeleteView): queryset = Circuit.objects.all() +@register_model_view(Circuit, 'import', detail=False) class CircuitBulkImportView(generic.BulkImportView): queryset = Circuit.objects.all() model_form = forms.CircuitImportForm @@ -295,6 +318,7 @@ class CircuitBulkImportView(generic.BulkImportView): return data +@register_model_view(Circuit, 'bulk_edit', path='edit', detail=False) class CircuitBulkEditView(generic.BulkEditView): queryset = Circuit.objects.prefetch_related( 'tenant__group', 'termination_a__termination', 'termination_z__termination', @@ -304,6 +328,7 @@ class CircuitBulkEditView(generic.BulkEditView): form = forms.CircuitBulkEditForm +@register_model_view(Circuit, 'bulk_delete', path='delete', detail=False) class CircuitBulkDeleteView(generic.BulkDeleteView): queryset = Circuit.objects.prefetch_related( 'tenant__group', 'termination_a__termination', 'termination_z__termination', @@ -397,6 +422,7 @@ class CircuitContactsView(ObjectContactsView): # Circuit terminations # +@register_model_view(CircuitTermination, 'list', path='', detail=False) class CircuitTerminationListView(generic.ObjectListView): queryset = CircuitTermination.objects.all() filterset = filtersets.CircuitTerminationFilterSet @@ -409,6 +435,7 @@ class CircuitTerminationView(generic.ObjectView): queryset = CircuitTermination.objects.all() +@register_model_view(CircuitTermination, 'add', detail=False) @register_model_view(CircuitTermination, 'edit') class CircuitTerminationEditView(generic.ObjectEditView): queryset = CircuitTermination.objects.all() @@ -420,11 +447,13 @@ class CircuitTerminationDeleteView(generic.ObjectDeleteView): queryset = CircuitTermination.objects.all() +@register_model_view(CircuitTermination, 'import', detail=False) class CircuitTerminationBulkImportView(generic.BulkImportView): queryset = CircuitTermination.objects.all() model_form = forms.CircuitTerminationImportForm +@register_model_view(CircuitTermination, 'bulk_edit', path='edit', detail=False) class CircuitTerminationBulkEditView(generic.BulkEditView): queryset = CircuitTermination.objects.all() filterset = filtersets.CircuitTerminationFilterSet @@ -432,6 +461,7 @@ class CircuitTerminationBulkEditView(generic.BulkEditView): form = forms.CircuitTerminationBulkEditForm +@register_model_view(CircuitTermination, 'bulk_delete', path='delete', detail=False) class CircuitTerminationBulkDeleteView(generic.BulkDeleteView): queryset = CircuitTermination.objects.all() filterset = filtersets.CircuitTerminationFilterSet @@ -446,6 +476,7 @@ register_model_view(CircuitTermination, 'trace', kwargs={'model': CircuitTermina # Circuit Groups # +@register_model_view(CircuitGroup, 'list', path='', detail=False) class CircuitGroupListView(generic.ObjectListView): queryset = CircuitGroup.objects.annotate( circuit_group_assignment_count=count_related(CircuitGroupAssignment, 'group') @@ -465,6 +496,7 @@ class CircuitGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(CircuitGroup, 'add', detail=False) @register_model_view(CircuitGroup, 'edit') class CircuitGroupEditView(generic.ObjectEditView): queryset = CircuitGroup.objects.all() @@ -476,11 +508,13 @@ class CircuitGroupDeleteView(generic.ObjectDeleteView): queryset = CircuitGroup.objects.all() +@register_model_view(CircuitGroup, 'import', detail=False) class CircuitGroupBulkImportView(generic.BulkImportView): queryset = CircuitGroup.objects.all() model_form = forms.CircuitGroupImportForm +@register_model_view(CircuitGroup, 'bulk_edit', path='edit', detail=False) class CircuitGroupBulkEditView(generic.BulkEditView): queryset = CircuitGroup.objects.all() filterset = filtersets.CircuitGroupFilterSet @@ -488,6 +522,7 @@ class CircuitGroupBulkEditView(generic.BulkEditView): form = forms.CircuitGroupBulkEditForm +@register_model_view(CircuitGroup, 'bulk_delete', path='delete', detail=False) class CircuitGroupBulkDeleteView(generic.BulkDeleteView): queryset = CircuitGroup.objects.all() filterset = filtersets.CircuitGroupFilterSet @@ -498,6 +533,7 @@ class CircuitGroupBulkDeleteView(generic.BulkDeleteView): # Circuit Groups # +@register_model_view(CircuitGroupAssignment, 'list', path='', detail=False) class CircuitGroupAssignmentListView(generic.ObjectListView): queryset = CircuitGroupAssignment.objects.all() filterset = filtersets.CircuitGroupAssignmentFilterSet @@ -510,6 +546,7 @@ class CircuitGroupAssignmentView(generic.ObjectView): queryset = CircuitGroupAssignment.objects.all() +@register_model_view(CircuitGroupAssignment, 'add', detail=False) @register_model_view(CircuitGroupAssignment, 'edit') class CircuitGroupAssignmentEditView(generic.ObjectEditView): queryset = CircuitGroupAssignment.objects.all() @@ -521,11 +558,13 @@ class CircuitGroupAssignmentDeleteView(generic.ObjectDeleteView): queryset = CircuitGroupAssignment.objects.all() +@register_model_view(CircuitGroupAssignment, 'import', detail=False) class CircuitGroupAssignmentBulkImportView(generic.BulkImportView): queryset = CircuitGroupAssignment.objects.all() model_form = forms.CircuitGroupAssignmentImportForm +@register_model_view(CircuitGroupAssignment, 'bulk_edit', path='edit', detail=False) class CircuitGroupAssignmentBulkEditView(generic.BulkEditView): queryset = CircuitGroupAssignment.objects.all() filterset = filtersets.CircuitGroupAssignmentFilterSet @@ -533,6 +572,7 @@ class CircuitGroupAssignmentBulkEditView(generic.BulkEditView): form = forms.CircuitGroupAssignmentBulkEditForm +@register_model_view(CircuitGroupAssignment, 'bulk_delete', path='delete', detail=False) class CircuitGroupAssignmentBulkDeleteView(generic.BulkDeleteView): queryset = CircuitGroupAssignment.objects.all() filterset = filtersets.CircuitGroupAssignmentFilterSet diff --git a/netbox/core/urls.py b/netbox/core/urls.py index fd6ec8996..5db165a8b 100644 --- a/netbox/core/urls.py +++ b/netbox/core/urls.py @@ -6,27 +6,16 @@ from . import views app_name = 'core' urlpatterns = ( - # Data sources - path('data-sources/', views.DataSourceListView.as_view(), name='datasource_list'), - path('data-sources/add/', views.DataSourceEditView.as_view(), name='datasource_add'), - path('data-sources/import/', views.DataSourceBulkImportView.as_view(), name='datasource_import'), - path('data-sources/edit/', views.DataSourceBulkEditView.as_view(), name='datasource_bulk_edit'), - path('data-sources/delete/', views.DataSourceBulkDeleteView.as_view(), name='datasource_bulk_delete'), + path('data-sources/', include(get_model_urls('core', 'datasource', detail=False))), path('data-sources//', include(get_model_urls('core', 'datasource'))), - # Data files - path('data-files/', views.DataFileListView.as_view(), name='datafile_list'), - path('data-files/delete/', views.DataFileBulkDeleteView.as_view(), name='datafile_bulk_delete'), + path('data-files/', include(get_model_urls('core', 'datafile', detail=False))), path('data-files//', include(get_model_urls('core', 'datafile'))), - # Job results - path('jobs/', views.JobListView.as_view(), name='job_list'), - path('jobs/delete/', views.JobBulkDeleteView.as_view(), name='job_bulk_delete'), - path('jobs//', views.JobView.as_view(), name='job'), - path('jobs//delete/', views.JobDeleteView.as_view(), name='job_delete'), + path('jobs/', include(get_model_urls('core', 'job', detail=False))), + path('jobs//', include(get_model_urls('core', 'job'))), - # Change logging - path('changelog/', views.ObjectChangeListView.as_view(), name='objectchange_list'), + path('changelog/', include(get_model_urls('core', 'objectchange', detail=False))), path('changelog//', include(get_model_urls('core', 'objectchange'))), # Background Tasks @@ -40,17 +29,11 @@ urlpatterns = ( path('background-workers//', views.WorkerListView.as_view(), name='worker_list'), path('background-workers//', views.WorkerView.as_view(), name='worker'), - # Config revisions - path('config-revisions/', views.ConfigRevisionListView.as_view(), name='configrevision_list'), - path('config-revisions/add/', views.ConfigRevisionEditView.as_view(), name='configrevision_add'), - path('config-revisions/delete/', views.ConfigRevisionBulkDeleteView.as_view(), name='configrevision_bulk_delete'), - path('config-revisions//restore/', views.ConfigRevisionRestoreView.as_view(), name='configrevision_restore'), + path('config-revisions/', include(get_model_urls('core', 'configrevision', detail=False))), path('config-revisions//', include(get_model_urls('core', 'configrevision'))), - # System path('system/', views.SystemView.as_view(), name='system'), - # Plugins path('plugins/', views.PluginListView.as_view(), name='plugin_list'), path('plugins//', views.PluginView.as_view(), name='plugin'), ) diff --git a/netbox/core/views.py b/netbox/core/views.py index 3c5319626..96e57f97f 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -46,6 +46,7 @@ from .tables import CatalogPluginTable, PluginVersionTable # Data sources # +@register_model_view(DataSource, 'list', path='', detail=False) class DataSourceListView(generic.ObjectListView): queryset = DataSource.objects.annotate( file_count=count_related(DataFile, 'source') @@ -92,6 +93,7 @@ class DataSourceSyncView(BaseObjectView): return redirect(datasource.get_absolute_url()) +@register_model_view(DataSource, 'add', detail=False) @register_model_view(DataSource, 'edit') class DataSourceEditView(generic.ObjectEditView): queryset = DataSource.objects.all() @@ -103,11 +105,13 @@ class DataSourceDeleteView(generic.ObjectDeleteView): queryset = DataSource.objects.all() +@register_model_view(DataSource, 'import', detail=False) class DataSourceBulkImportView(generic.BulkImportView): queryset = DataSource.objects.all() model_form = forms.DataSourceImportForm +@register_model_view(DataSource, 'bulk_edit', path='edit', detail=False) class DataSourceBulkEditView(generic.BulkEditView): queryset = DataSource.objects.annotate( count_files=count_related(DataFile, 'source') @@ -117,6 +121,7 @@ class DataSourceBulkEditView(generic.BulkEditView): form = forms.DataSourceBulkEditForm +@register_model_view(DataSource, 'bulk_delete', path='delete', detail=False) class DataSourceBulkDeleteView(generic.BulkDeleteView): queryset = DataSource.objects.annotate( count_files=count_related(DataFile, 'source') @@ -129,6 +134,7 @@ class DataSourceBulkDeleteView(generic.BulkDeleteView): # Data files # +@register_model_view(DataFile, 'list', path='', detail=False) class DataFileListView(generic.ObjectListView): queryset = DataFile.objects.defer('data') filterset = filtersets.DataFileFilterSet @@ -149,6 +155,7 @@ class DataFileDeleteView(generic.ObjectDeleteView): queryset = DataFile.objects.all() +@register_model_view(DataFile, 'bulk_delete', path='delete', detail=False) class DataFileBulkDeleteView(generic.BulkDeleteView): queryset = DataFile.objects.defer('data') filterset = filtersets.DataFileFilterSet @@ -159,6 +166,7 @@ class DataFileBulkDeleteView(generic.BulkDeleteView): # Jobs # +@register_model_view(Job, 'list', path='', detail=False) class JobListView(generic.ObjectListView): queryset = Job.objects.all() filterset = filtersets.JobFilterSet @@ -170,14 +178,17 @@ class JobListView(generic.ObjectListView): } +@register_model_view(Job) class JobView(generic.ObjectView): queryset = Job.objects.all() +@register_model_view(Job, 'delete') class JobDeleteView(generic.ObjectDeleteView): queryset = Job.objects.all() +@register_model_view(Job, 'bulk_delete', path='delete', detail=False) class JobBulkDeleteView(generic.BulkDeleteView): queryset = Job.objects.all() filterset = filtersets.JobFilterSet @@ -188,6 +199,7 @@ class JobBulkDeleteView(generic.BulkDeleteView): # Change logging # +@register_model_view(ObjectChange, 'list', path='', detail=False) class ObjectChangeListView(generic.ObjectListView): queryset = ObjectChange.objects.valid_models() filterset = filtersets.ObjectChangeFilterSet @@ -257,6 +269,7 @@ class ObjectChangeView(generic.ObjectView): # Config Revisions # +@register_model_view(ConfigRevision, 'list', path='', detail=False) class ConfigRevisionListView(generic.ObjectListView): queryset = ConfigRevision.objects.all() filterset = filtersets.ConfigRevisionFilterSet @@ -269,6 +282,7 @@ class ConfigRevisionView(generic.ObjectView): queryset = ConfigRevision.objects.all() +@register_model_view(ConfigRevision, 'add', detail=False) class ConfigRevisionEditView(generic.ObjectEditView): queryset = ConfigRevision.objects.all() form = forms.ConfigRevisionForm @@ -279,12 +293,14 @@ class ConfigRevisionDeleteView(generic.ObjectDeleteView): queryset = ConfigRevision.objects.all() +@register_model_view(ConfigRevision, 'bulk_delete', path='delete', detail=False) class ConfigRevisionBulkDeleteView(generic.BulkDeleteView): queryset = ConfigRevision.objects.all() filterset = filtersets.ConfigRevisionFilterSet table = tables.ConfigRevisionTable +@register_model_view(ConfigRevision, 'restore') class ConfigRevisionRestoreView(ContentTypePermissionRequiredMixin, View): def get_required_permission(self): diff --git a/netbox/dcim/urls.py b/netbox/dcim/urls.py index 1a6a2f77d..bcfd32707 100644 --- a/netbox/dcim/urls.py +++ b/netbox/dcim/urls.py @@ -6,335 +6,144 @@ from . import views app_name = 'dcim' urlpatterns = [ - # Regions - path('regions/', views.RegionListView.as_view(), name='region_list'), - path('regions/add/', views.RegionEditView.as_view(), name='region_add'), - path('regions/import/', views.RegionBulkImportView.as_view(), name='region_import'), - path('regions/edit/', views.RegionBulkEditView.as_view(), name='region_bulk_edit'), - path('regions/delete/', views.RegionBulkDeleteView.as_view(), name='region_bulk_delete'), + path('regions/', include(get_model_urls('dcim', 'region', detail=False))), path('regions//', include(get_model_urls('dcim', 'region'))), - # Site groups - path('site-groups/', views.SiteGroupListView.as_view(), name='sitegroup_list'), - path('site-groups/add/', views.SiteGroupEditView.as_view(), name='sitegroup_add'), - path('site-groups/import/', views.SiteGroupBulkImportView.as_view(), name='sitegroup_import'), - path('site-groups/edit/', views.SiteGroupBulkEditView.as_view(), name='sitegroup_bulk_edit'), - path('site-groups/delete/', views.SiteGroupBulkDeleteView.as_view(), name='sitegroup_bulk_delete'), + path('site-groups/', include(get_model_urls('dcim', 'sitegroup', detail=False))), path('site-groups//', include(get_model_urls('dcim', 'sitegroup'))), - # Sites - path('sites/', views.SiteListView.as_view(), name='site_list'), - path('sites/add/', views.SiteEditView.as_view(), name='site_add'), - path('sites/import/', views.SiteBulkImportView.as_view(), name='site_import'), - path('sites/edit/', views.SiteBulkEditView.as_view(), name='site_bulk_edit'), - path('sites/delete/', views.SiteBulkDeleteView.as_view(), name='site_bulk_delete'), + path('sites/', include(get_model_urls('dcim', 'site', detail=False))), path('sites//', include(get_model_urls('dcim', 'site'))), - # Locations - path('locations/', views.LocationListView.as_view(), name='location_list'), - path('locations/add/', views.LocationEditView.as_view(), name='location_add'), - path('locations/import/', views.LocationBulkImportView.as_view(), name='location_import'), - path('locations/edit/', views.LocationBulkEditView.as_view(), name='location_bulk_edit'), - path('locations/delete/', views.LocationBulkDeleteView.as_view(), name='location_bulk_delete'), + path('locations/', include(get_model_urls('dcim', 'location', detail=False))), path('locations//', include(get_model_urls('dcim', 'location'))), - # Rack roles - path('rack-roles/', views.RackRoleListView.as_view(), name='rackrole_list'), - path('rack-roles/add/', views.RackRoleEditView.as_view(), name='rackrole_add'), - path('rack-roles/import/', views.RackRoleBulkImportView.as_view(), name='rackrole_import'), - path('rack-roles/edit/', views.RackRoleBulkEditView.as_view(), name='rackrole_bulk_edit'), - path('rack-roles/delete/', views.RackRoleBulkDeleteView.as_view(), name='rackrole_bulk_delete'), + path('rack-roles/', include(get_model_urls('dcim', 'rackrole', detail=False))), path('rack-roles//', include(get_model_urls('dcim', 'rackrole'))), - # Rack reservations - path('rack-reservations/', views.RackReservationListView.as_view(), name='rackreservation_list'), - path('rack-reservations/add/', views.RackReservationEditView.as_view(), name='rackreservation_add'), - path('rack-reservations/import/', views.RackReservationImportView.as_view(), name='rackreservation_import'), - path('rack-reservations/edit/', views.RackReservationBulkEditView.as_view(), name='rackreservation_bulk_edit'), - path('rack-reservations/delete/', views.RackReservationBulkDeleteView.as_view(), name='rackreservation_bulk_delete'), + path('rack-reservations/', include(get_model_urls('dcim', 'rackreservation', detail=False))), path('rack-reservations//', include(get_model_urls('dcim', 'rackreservation'))), - # Racks - path('racks/', views.RackListView.as_view(), name='rack_list'), - path('rack-elevations/', views.RackElevationListView.as_view(), name='rack_elevation_list'), - path('racks/add/', views.RackEditView.as_view(), name='rack_add'), - path('racks/import/', views.RackBulkImportView.as_view(), name='rack_import'), - path('racks/edit/', views.RackBulkEditView.as_view(), name='rack_bulk_edit'), - path('racks/delete/', views.RackBulkDeleteView.as_view(), name='rack_bulk_delete'), + path('racks/', include(get_model_urls('dcim', 'rack', detail=False))), path('racks//', include(get_model_urls('dcim', 'rack'))), + path('rack-elevations/', views.RackElevationListView.as_view(), name='rack_elevation_list'), - # Rack Types - path('rack-types/', views.RackTypeListView.as_view(), name='racktype_list'), - path('rack-types/add/', views.RackTypeEditView.as_view(), name='racktype_add'), - path('rack-types/import/', views.RackTypeBulkImportView.as_view(), name='racktype_import'), - path('rack-types/edit/', views.RackTypeBulkEditView.as_view(), name='racktype_bulk_edit'), - path('rack-types/delete/', views.RackTypeBulkDeleteView.as_view(), name='racktype_bulk_delete'), + path('rack-types/', include(get_model_urls('dcim', 'racktype', detail=False))), path('rack-types//', include(get_model_urls('dcim', 'racktype'))), - # Manufacturers - path('manufacturers/', views.ManufacturerListView.as_view(), name='manufacturer_list'), - path('manufacturers/add/', views.ManufacturerEditView.as_view(), name='manufacturer_add'), - path('manufacturers/import/', views.ManufacturerBulkImportView.as_view(), name='manufacturer_import'), - path('manufacturers/edit/', views.ManufacturerBulkEditView.as_view(), name='manufacturer_bulk_edit'), - path('manufacturers/delete/', views.ManufacturerBulkDeleteView.as_view(), name='manufacturer_bulk_delete'), + path('manufacturers/', include(get_model_urls('dcim', 'manufacturer', detail=False))), path('manufacturers//', include(get_model_urls('dcim', 'manufacturer'))), - # Device types - path('device-types/', views.DeviceTypeListView.as_view(), name='devicetype_list'), - path('device-types/add/', views.DeviceTypeEditView.as_view(), name='devicetype_add'), - path('device-types/import/', views.DeviceTypeImportView.as_view(), name='devicetype_import'), - path('device-types/edit/', views.DeviceTypeBulkEditView.as_view(), name='devicetype_bulk_edit'), - path('device-types/delete/', views.DeviceTypeBulkDeleteView.as_view(), name='devicetype_bulk_delete'), + path('device-types/', include(get_model_urls('dcim', 'devicetype', detail=False))), path('device-types//', include(get_model_urls('dcim', 'devicetype'))), - # Module types - path('module-types/', views.ModuleTypeListView.as_view(), name='moduletype_list'), - path('module-types/add/', views.ModuleTypeEditView.as_view(), name='moduletype_add'), - path('module-types/import/', views.ModuleTypeImportView.as_view(), name='moduletype_import'), - path('module-types/edit/', views.ModuleTypeBulkEditView.as_view(), name='moduletype_bulk_edit'), - path('module-types/delete/', views.ModuleTypeBulkDeleteView.as_view(), name='moduletype_bulk_delete'), + path('module-types/', include(get_model_urls('dcim', 'moduletype', detail=False))), path('module-types//', include(get_model_urls('dcim', 'moduletype'))), - # Console port templates - path('console-port-templates/add/', views.ConsolePortTemplateCreateView.as_view(), name='consoleporttemplate_add'), - path('console-port-templates/edit/', views.ConsolePortTemplateBulkEditView.as_view(), name='consoleporttemplate_bulk_edit'), - path('console-port-templates/rename/', views.ConsolePortTemplateBulkRenameView.as_view(), name='consoleporttemplate_bulk_rename'), - path('console-port-templates/delete/', views.ConsolePortTemplateBulkDeleteView.as_view(), name='consoleporttemplate_bulk_delete'), + path('console-port-templates/', include(get_model_urls('dcim', 'consoleporttemplate', detail=False))), path('console-port-templates//', include(get_model_urls('dcim', 'consoleporttemplate'))), - # Console server port templates - path('console-server-port-templates/add/', views.ConsoleServerPortTemplateCreateView.as_view(), name='consoleserverporttemplate_add'), - path('console-server-port-templates/edit/', views.ConsoleServerPortTemplateBulkEditView.as_view(), name='consoleserverporttemplate_bulk_edit'), - path('console-server-port-templates/rename/', views.ConsoleServerPortTemplateBulkRenameView.as_view(), name='consoleserverporttemplate_bulk_rename'), - path('console-server-port-templates/delete/', views.ConsoleServerPortTemplateBulkDeleteView.as_view(), name='consoleserverporttemplate_bulk_delete'), + path('console-server-port-templates/', include(get_model_urls('dcim', 'consoleserverporttemplate', detail=False))), path('console-server-port-templates//', include(get_model_urls('dcim', 'consoleserverporttemplate'))), - # Power port templates - path('power-port-templates/add/', views.PowerPortTemplateCreateView.as_view(), name='powerporttemplate_add'), - path('power-port-templates/edit/', views.PowerPortTemplateBulkEditView.as_view(), name='powerporttemplate_bulk_edit'), - path('power-port-templates/rename/', views.PowerPortTemplateBulkRenameView.as_view(), name='powerporttemplate_bulk_rename'), - path('power-port-templates/delete/', views.PowerPortTemplateBulkDeleteView.as_view(), name='powerporttemplate_bulk_delete'), + path('power-port-templates/', include(get_model_urls('dcim', 'powerporttemplate', detail=False))), path('power-port-templates//', include(get_model_urls('dcim', 'powerporttemplate'))), - # Power outlet templates - path('power-outlet-templates/add/', views.PowerOutletTemplateCreateView.as_view(), name='poweroutlettemplate_add'), - path('power-outlet-templates/edit/', views.PowerOutletTemplateBulkEditView.as_view(), name='poweroutlettemplate_bulk_edit'), - path('power-outlet-templates/rename/', views.PowerOutletTemplateBulkRenameView.as_view(), name='poweroutlettemplate_bulk_rename'), - path('power-outlet-templates/delete/', views.PowerOutletTemplateBulkDeleteView.as_view(), name='poweroutlettemplate_bulk_delete'), + path('power-outlet-templates/', include(get_model_urls('dcim', 'poweroutlettemplate', detail=False))), path('power-outlet-templates//', include(get_model_urls('dcim', 'poweroutlettemplate'))), - # Interface templates - path('interface-templates/add/', views.InterfaceTemplateCreateView.as_view(), name='interfacetemplate_add'), - path('interface-templates/edit/', views.InterfaceTemplateBulkEditView.as_view(), name='interfacetemplate_bulk_edit'), - path('interface-templates/rename/', views.InterfaceTemplateBulkRenameView.as_view(), name='interfacetemplate_bulk_rename'), - path('interface-templates/delete/', views.InterfaceTemplateBulkDeleteView.as_view(), name='interfacetemplate_bulk_delete'), + path('interface-templates/', include(get_model_urls('dcim', 'interfacetemplate', detail=False))), path('interface-templates//', include(get_model_urls('dcim', 'interfacetemplate'))), - # Front port templates - path('front-port-templates/add/', views.FrontPortTemplateCreateView.as_view(), name='frontporttemplate_add'), - path('front-port-templates/edit/', views.FrontPortTemplateBulkEditView.as_view(), name='frontporttemplate_bulk_edit'), - path('front-port-templates/rename/', views.FrontPortTemplateBulkRenameView.as_view(), name='frontporttemplate_bulk_rename'), - path('front-port-templates/delete/', views.FrontPortTemplateBulkDeleteView.as_view(), name='frontporttemplate_bulk_delete'), + path('front-port-templates/', include(get_model_urls('dcim', 'frontporttemplate', detail=False))), path('front-port-templates//', include(get_model_urls('dcim', 'frontporttemplate'))), - # Rear port templates - path('rear-port-templates/add/', views.RearPortTemplateCreateView.as_view(), name='rearporttemplate_add'), - path('rear-port-templates/edit/', views.RearPortTemplateBulkEditView.as_view(), name='rearporttemplate_bulk_edit'), - path('rear-port-templates/rename/', views.RearPortTemplateBulkRenameView.as_view(), name='rearporttemplate_bulk_rename'), - path('rear-port-templates/delete/', views.RearPortTemplateBulkDeleteView.as_view(), name='rearporttemplate_bulk_delete'), + path('rear-port-templates/', include(get_model_urls('dcim', 'rearporttemplate', detail=False))), path('rear-port-templates//', include(get_model_urls('dcim', 'rearporttemplate'))), - # Device bay templates - path('device-bay-templates/add/', views.DeviceBayTemplateCreateView.as_view(), name='devicebaytemplate_add'), - path('device-bay-templates/edit/', views.DeviceBayTemplateBulkEditView.as_view(), name='devicebaytemplate_bulk_edit'), - path('device-bay-templates/rename/', views.DeviceBayTemplateBulkRenameView.as_view(), name='devicebaytemplate_bulk_rename'), - path('device-bay-templates/delete/', views.DeviceBayTemplateBulkDeleteView.as_view(), name='devicebaytemplate_bulk_delete'), + path('device-bay-templates/', include(get_model_urls('dcim', 'devicebaytemplate', detail=False))), path('device-bay-templates//', include(get_model_urls('dcim', 'devicebaytemplate'))), - # Module bay templates - path('module-bay-templates/add/', views.ModuleBayTemplateCreateView.as_view(), name='modulebaytemplate_add'), - path('module-bay-templates/edit/', views.ModuleBayTemplateBulkEditView.as_view(), name='modulebaytemplate_bulk_edit'), - path('module-bay-templates/rename/', views.ModuleBayTemplateBulkRenameView.as_view(), name='modulebaytemplate_bulk_rename'), - path('module-bay-templates/delete/', views.ModuleBayTemplateBulkDeleteView.as_view(), name='modulebaytemplate_bulk_delete'), + path('module-bay-templates/', include(get_model_urls('dcim', 'modulebaytemplate', detail=False))), path('module-bay-templates//', include(get_model_urls('dcim', 'modulebaytemplate'))), - # Inventory item templates - path('inventory-item-templates/add/', views.InventoryItemTemplateCreateView.as_view(), name='inventoryitemtemplate_add'), - path('inventory-item-templates/edit/', views.InventoryItemTemplateBulkEditView.as_view(), name='inventoryitemtemplate_bulk_edit'), - path('inventory-item-templates/rename/', views.InventoryItemTemplateBulkRenameView.as_view(), name='inventoryitemtemplate_bulk_rename'), - path('inventory-item-templates/delete/', views.InventoryItemTemplateBulkDeleteView.as_view(), name='inventoryitemtemplate_bulk_delete'), + path('inventory-item-templates/', include(get_model_urls('dcim', 'inventoryitemtemplate', detail=False))), path('inventory-item-templates//', include(get_model_urls('dcim', 'inventoryitemtemplate'))), - # Device roles - path('device-roles/', views.DeviceRoleListView.as_view(), name='devicerole_list'), - path('device-roles/add/', views.DeviceRoleEditView.as_view(), name='devicerole_add'), - path('device-roles/import/', views.DeviceRoleBulkImportView.as_view(), name='devicerole_import'), - path('device-roles/edit/', views.DeviceRoleBulkEditView.as_view(), name='devicerole_bulk_edit'), - path('device-roles/delete/', views.DeviceRoleBulkDeleteView.as_view(), name='devicerole_bulk_delete'), + path('device-roles/', include(get_model_urls('dcim', 'devicerole', detail=False))), path('device-roles//', include(get_model_urls('dcim', 'devicerole'))), - # Platforms - path('platforms/', views.PlatformListView.as_view(), name='platform_list'), - path('platforms/add/', views.PlatformEditView.as_view(), name='platform_add'), - path('platforms/import/', views.PlatformBulkImportView.as_view(), name='platform_import'), - path('platforms/edit/', views.PlatformBulkEditView.as_view(), name='platform_bulk_edit'), - path('platforms/delete/', views.PlatformBulkDeleteView.as_view(), name='platform_bulk_delete'), + path('platforms/', include(get_model_urls('dcim', 'platform', detail=False))), path('platforms//', include(get_model_urls('dcim', 'platform'))), - # Devices - path('devices/', views.DeviceListView.as_view(), name='device_list'), - path('devices/add/', views.DeviceEditView.as_view(), name='device_add'), - path('devices/import/', views.DeviceBulkImportView.as_view(), name='device_import'), - path('devices/edit/', views.DeviceBulkEditView.as_view(), name='device_bulk_edit'), - path('devices/rename/', views.DeviceBulkRenameView.as_view(), name='device_bulk_rename'), - path('devices/delete/', views.DeviceBulkDeleteView.as_view(), name='device_bulk_delete'), + path('devices/', include(get_model_urls('dcim', 'device', detail=False))), path('devices//', include(get_model_urls('dcim', 'device'))), - # Virtual Device Context - path('virtual-device-contexts/', views.VirtualDeviceContextListView.as_view(), name='virtualdevicecontext_list'), - path('virtual-device-contexts/add/', views.VirtualDeviceContextEditView.as_view(), name='virtualdevicecontext_add'), - path('virtual-device-contexts/import/', views.VirtualDeviceContextBulkImportView.as_view(), name='virtualdevicecontext_import'), - path('virtual-device-contexts/edit/', views.VirtualDeviceContextBulkEditView.as_view(), name='virtualdevicecontext_bulk_edit'), - path('virtual-device-contexts/delete/', views.VirtualDeviceContextBulkDeleteView.as_view(), name='virtualdevicecontext_bulk_delete'), + path('virtual-device-contexts/', include(get_model_urls('dcim', 'virtualdevicecontext', detail=False))), path('virtual-device-contexts//', include(get_model_urls('dcim', 'virtualdevicecontext'))), - # Modules - path('modules/', views.ModuleListView.as_view(), name='module_list'), - path('modules/add/', views.ModuleEditView.as_view(), name='module_add'), - path('modules/import/', views.ModuleBulkImportView.as_view(), name='module_import'), - path('modules/edit/', views.ModuleBulkEditView.as_view(), name='module_bulk_edit'), - path('modules/delete/', views.ModuleBulkDeleteView.as_view(), name='module_bulk_delete'), + path('modules/', include(get_model_urls('dcim', 'module', detail=False))), path('modules//', include(get_model_urls('dcim', 'module'))), - # Console ports - path('console-ports/', views.ConsolePortListView.as_view(), name='consoleport_list'), - path('console-ports/add/', views.ConsolePortCreateView.as_view(), name='consoleport_add'), - path('console-ports/import/', views.ConsolePortBulkImportView.as_view(), name='consoleport_import'), - path('console-ports/edit/', views.ConsolePortBulkEditView.as_view(), name='consoleport_bulk_edit'), - path('console-ports/rename/', views.ConsolePortBulkRenameView.as_view(), name='consoleport_bulk_rename'), - path('console-ports/disconnect/', views.ConsolePortBulkDisconnectView.as_view(), name='consoleport_bulk_disconnect'), - path('console-ports/delete/', views.ConsolePortBulkDeleteView.as_view(), name='consoleport_bulk_delete'), + path('console-ports/', include(get_model_urls('dcim', 'consoleport', detail=False))), path('console-ports//', include(get_model_urls('dcim', 'consoleport'))), - path('devices/console-ports/add/', views.DeviceBulkAddConsolePortView.as_view(), name='device_bulk_add_consoleport'), + path( + 'devices/console-ports/add/', + views.DeviceBulkAddConsolePortView.as_view(), + name='device_bulk_add_consoleport' + ), - # Console server ports - path('console-server-ports/', views.ConsoleServerPortListView.as_view(), name='consoleserverport_list'), - path('console-server-ports/add/', views.ConsoleServerPortCreateView.as_view(), name='consoleserverport_add'), - path('console-server-ports/import/', views.ConsoleServerPortBulkImportView.as_view(), name='consoleserverport_import'), - path('console-server-ports/edit/', views.ConsoleServerPortBulkEditView.as_view(), name='consoleserverport_bulk_edit'), - path('console-server-ports/rename/', views.ConsoleServerPortBulkRenameView.as_view(), name='consoleserverport_bulk_rename'), - path('console-server-ports/disconnect/', views.ConsoleServerPortBulkDisconnectView.as_view(), name='consoleserverport_bulk_disconnect'), - path('console-server-ports/delete/', views.ConsoleServerPortBulkDeleteView.as_view(), name='consoleserverport_bulk_delete'), + path('console-server-ports/', include(get_model_urls('dcim', 'consoleserverport', detail=False))), path('console-server-ports//', include(get_model_urls('dcim', 'consoleserverport'))), - path('devices/console-server-ports/add/', views.DeviceBulkAddConsoleServerPortView.as_view(), name='device_bulk_add_consoleserverport'), + path( + 'devices/console-server-ports/add/', + views.DeviceBulkAddConsoleServerPortView.as_view(), + name='device_bulk_add_consoleserverport' + ), - # Power ports - path('power-ports/', views.PowerPortListView.as_view(), name='powerport_list'), - path('power-ports/add/', views.PowerPortCreateView.as_view(), name='powerport_add'), - path('power-ports/import/', views.PowerPortBulkImportView.as_view(), name='powerport_import'), - path('power-ports/edit/', views.PowerPortBulkEditView.as_view(), name='powerport_bulk_edit'), - path('power-ports/rename/', views.PowerPortBulkRenameView.as_view(), name='powerport_bulk_rename'), - path('power-ports/disconnect/', views.PowerPortBulkDisconnectView.as_view(), name='powerport_bulk_disconnect'), - path('power-ports/delete/', views.PowerPortBulkDeleteView.as_view(), name='powerport_bulk_delete'), + path('power-ports/', include(get_model_urls('dcim', 'powerport', detail=False))), path('power-ports//', include(get_model_urls('dcim', 'powerport'))), path('devices/power-ports/add/', views.DeviceBulkAddPowerPortView.as_view(), name='device_bulk_add_powerport'), - # Power outlets - path('power-outlets/', views.PowerOutletListView.as_view(), name='poweroutlet_list'), - path('power-outlets/add/', views.PowerOutletCreateView.as_view(), name='poweroutlet_add'), - path('power-outlets/import/', views.PowerOutletBulkImportView.as_view(), name='poweroutlet_import'), - path('power-outlets/edit/', views.PowerOutletBulkEditView.as_view(), name='poweroutlet_bulk_edit'), - path('power-outlets/rename/', views.PowerOutletBulkRenameView.as_view(), name='poweroutlet_bulk_rename'), - path('power-outlets/disconnect/', views.PowerOutletBulkDisconnectView.as_view(), name='poweroutlet_bulk_disconnect'), - path('power-outlets/delete/', views.PowerOutletBulkDeleteView.as_view(), name='poweroutlet_bulk_delete'), + path('power-outlets/', include(get_model_urls('dcim', 'poweroutlet', detail=False))), path('power-outlets//', include(get_model_urls('dcim', 'poweroutlet'))), - path('devices/power-outlets/add/', views.DeviceBulkAddPowerOutletView.as_view(), name='device_bulk_add_poweroutlet'), + path( + 'devices/power-outlets/add/', + views.DeviceBulkAddPowerOutletView.as_view(), + name='device_bulk_add_poweroutlet' + ), - # MAC addresses - path('mac-addresses/', views.MACAddressListView.as_view(), name='macaddress_list'), - path('mac-addresses/add/', views.MACAddressEditView.as_view(), name='macaddress_add'), - path('mac-addresses/import/', views.MACAddressBulkImportView.as_view(), name='macaddress_import'), - path('mac-addresses/edit/', views.MACAddressBulkEditView.as_view(), name='macaddress_bulk_edit'), - path('mac-addresses/delete/', views.MACAddressBulkDeleteView.as_view(), name='macaddress_bulk_delete'), - path('mac-addresses//', include(get_model_urls('dcim', 'macaddress'))), - - # Interfaces - path('interfaces/', views.InterfaceListView.as_view(), name='interface_list'), - path('interfaces/add/', views.InterfaceCreateView.as_view(), name='interface_add'), - path('interfaces/import/', views.InterfaceBulkImportView.as_view(), name='interface_import'), - path('interfaces/edit/', views.InterfaceBulkEditView.as_view(), name='interface_bulk_edit'), - path('interfaces/rename/', views.InterfaceBulkRenameView.as_view(), name='interface_bulk_rename'), - path('interfaces/disconnect/', views.InterfaceBulkDisconnectView.as_view(), name='interface_bulk_disconnect'), - path('interfaces/delete/', views.InterfaceBulkDeleteView.as_view(), name='interface_bulk_delete'), + path('interfaces/', include(get_model_urls('dcim', 'interface', detail=False))), path('interfaces//', include(get_model_urls('dcim', 'interface'))), path('devices/interfaces/add/', views.DeviceBulkAddInterfaceView.as_view(), name='device_bulk_add_interface'), - # Front ports - path('front-ports/', views.FrontPortListView.as_view(), name='frontport_list'), - path('front-ports/add/', views.FrontPortCreateView.as_view(), name='frontport_add'), - path('front-ports/import/', views.FrontPortBulkImportView.as_view(), name='frontport_import'), - path('front-ports/edit/', views.FrontPortBulkEditView.as_view(), name='frontport_bulk_edit'), - path('front-ports/rename/', views.FrontPortBulkRenameView.as_view(), name='frontport_bulk_rename'), - path('front-ports/disconnect/', views.FrontPortBulkDisconnectView.as_view(), name='frontport_bulk_disconnect'), - path('front-ports/delete/', views.FrontPortBulkDeleteView.as_view(), name='frontport_bulk_delete'), + path('front-ports/', include(get_model_urls('dcim', 'frontport', detail=False))), path('front-ports//', include(get_model_urls('dcim', 'frontport'))), - # path('devices/front-ports/add/', views.DeviceBulkAddFrontPortView.as_view(), name='device_bulk_add_frontport'), - # Rear ports - path('rear-ports/', views.RearPortListView.as_view(), name='rearport_list'), - path('rear-ports/add/', views.RearPortCreateView.as_view(), name='rearport_add'), - path('rear-ports/import/', views.RearPortBulkImportView.as_view(), name='rearport_import'), - path('rear-ports/edit/', views.RearPortBulkEditView.as_view(), name='rearport_bulk_edit'), - path('rear-ports/rename/', views.RearPortBulkRenameView.as_view(), name='rearport_bulk_rename'), - path('rear-ports/disconnect/', views.RearPortBulkDisconnectView.as_view(), name='rearport_bulk_disconnect'), - path('rear-ports/delete/', views.RearPortBulkDeleteView.as_view(), name='rearport_bulk_delete'), + path('rear-ports/', include(get_model_urls('dcim', 'rearport', detail=False))), path('rear-ports//', include(get_model_urls('dcim', 'rearport'))), path('devices/rear-ports/add/', views.DeviceBulkAddRearPortView.as_view(), name='device_bulk_add_rearport'), - # Module bays - path('module-bays/', views.ModuleBayListView.as_view(), name='modulebay_list'), - path('module-bays/add/', views.ModuleBayCreateView.as_view(), name='modulebay_add'), - path('module-bays/import/', views.ModuleBayBulkImportView.as_view(), name='modulebay_import'), - path('module-bays/edit/', views.ModuleBayBulkEditView.as_view(), name='modulebay_bulk_edit'), - path('module-bays/rename/', views.ModuleBayBulkRenameView.as_view(), name='modulebay_bulk_rename'), - path('module-bays/delete/', views.ModuleBayBulkDeleteView.as_view(), name='modulebay_bulk_delete'), + path('module-bays/', include(get_model_urls('dcim', 'modulebay', detail=False))), path('module-bays//', include(get_model_urls('dcim', 'modulebay'))), path('devices/module-bays/add/', views.DeviceBulkAddModuleBayView.as_view(), name='device_bulk_add_modulebay'), - # Device bays - path('device-bays/', views.DeviceBayListView.as_view(), name='devicebay_list'), - path('device-bays/add/', views.DeviceBayCreateView.as_view(), name='devicebay_add'), - path('device-bays/import/', views.DeviceBayBulkImportView.as_view(), name='devicebay_import'), - path('device-bays/edit/', views.DeviceBayBulkEditView.as_view(), name='devicebay_bulk_edit'), - path('device-bays/rename/', views.DeviceBayBulkRenameView.as_view(), name='devicebay_bulk_rename'), - path('device-bays/delete/', views.DeviceBayBulkDeleteView.as_view(), name='devicebay_bulk_delete'), + path('device-bays/', include(get_model_urls('dcim', 'devicebay', detail=False))), path('device-bays//', include(get_model_urls('dcim', 'devicebay'))), path('devices/device-bays/add/', views.DeviceBulkAddDeviceBayView.as_view(), name='device_bulk_add_devicebay'), - # Inventory items - path('inventory-items/', views.InventoryItemListView.as_view(), name='inventoryitem_list'), - path('inventory-items/add/', views.InventoryItemCreateView.as_view(), name='inventoryitem_add'), - path('inventory-items/import/', views.InventoryItemBulkImportView.as_view(), name='inventoryitem_import'), - path('inventory-items/edit/', views.InventoryItemBulkEditView.as_view(), name='inventoryitem_bulk_edit'), - path('inventory-items/rename/', views.InventoryItemBulkRenameView.as_view(), name='inventoryitem_bulk_rename'), - path('inventory-items/delete/', views.InventoryItemBulkDeleteView.as_view(), name='inventoryitem_bulk_delete'), + path('inventory-items/', include(get_model_urls('dcim', 'inventoryitem', detail=False))), path('inventory-items//', include(get_model_urls('dcim', 'inventoryitem'))), - path('devices/inventory-items/add/', views.DeviceBulkAddInventoryItemView.as_view(), name='device_bulk_add_inventoryitem'), + path( + 'devices/inventory-items/add/', + views.DeviceBulkAddInventoryItemView.as_view(), + name='device_bulk_add_inventoryitem' + ), - # Inventory item roles - path('inventory-item-roles/', views.InventoryItemRoleListView.as_view(), name='inventoryitemrole_list'), - path('inventory-item-roles/add/', views.InventoryItemRoleEditView.as_view(), name='inventoryitemrole_add'), - path('inventory-item-roles/import/', views.InventoryItemRoleBulkImportView.as_view(), name='inventoryitemrole_import'), - path('inventory-item-roles/edit/', views.InventoryItemRoleBulkEditView.as_view(), name='inventoryitemrole_bulk_edit'), - path('inventory-item-roles/delete/', views.InventoryItemRoleBulkDeleteView.as_view(), name='inventoryitemrole_bulk_delete'), + path('inventory-item-roles/', include(get_model_urls('dcim', 'inventoryitemrole', detail=False))), path('inventory-item-roles//', include(get_model_urls('dcim', 'inventoryitemrole'))), - # Cables - path('cables/', views.CableListView.as_view(), name='cable_list'), - path('cables/add/', views.CableEditView.as_view(), name='cable_add'), - path('cables/import/', views.CableBulkImportView.as_view(), name='cable_import'), - path('cables/edit/', views.CableBulkEditView.as_view(), name='cable_bulk_edit'), - path('cables/delete/', views.CableBulkDeleteView.as_view(), name='cable_bulk_delete'), + path('cables/', include(get_model_urls('dcim', 'cable', detail=False))), path('cables//', include(get_model_urls('dcim', 'cable'))), # Console/power/interface connections (read-only) @@ -342,30 +151,21 @@ urlpatterns = [ path('power-connections/', views.PowerConnectionsListView.as_view(), name='power_connections_list'), path('interface-connections/', views.InterfaceConnectionsListView.as_view(), name='interface_connections_list'), - # Virtual chassis - path('virtual-chassis/', views.VirtualChassisListView.as_view(), name='virtualchassis_list'), - path('virtual-chassis/add/', views.VirtualChassisCreateView.as_view(), name='virtualchassis_add'), - path('virtual-chassis/import/', views.VirtualChassisBulkImportView.as_view(), name='virtualchassis_import'), - path('virtual-chassis/edit/', views.VirtualChassisBulkEditView.as_view(), name='virtualchassis_bulk_edit'), - path('virtual-chassis/delete/', views.VirtualChassisBulkDeleteView.as_view(), name='virtualchassis_bulk_delete'), + path('virtual-chassis/', include(get_model_urls('dcim', 'virtualchassis', detail=False))), path('virtual-chassis//', include(get_model_urls('dcim', 'virtualchassis'))), - path('virtual-chassis-members//delete/', views.VirtualChassisRemoveMemberView.as_view(), name='virtualchassis_remove_member'), + path( + 'virtual-chassis-members//delete/', + views.VirtualChassisRemoveMemberView.as_view(), + name='virtualchassis_remove_member' + ), - # Power panels - path('power-panels/', views.PowerPanelListView.as_view(), name='powerpanel_list'), - path('power-panels/add/', views.PowerPanelEditView.as_view(), name='powerpanel_add'), - path('power-panels/import/', views.PowerPanelBulkImportView.as_view(), name='powerpanel_import'), - path('power-panels/edit/', views.PowerPanelBulkEditView.as_view(), name='powerpanel_bulk_edit'), - path('power-panels/delete/', views.PowerPanelBulkDeleteView.as_view(), name='powerpanel_bulk_delete'), + path('power-panels/', include(get_model_urls('dcim', 'powerpanel', detail=False))), path('power-panels//', include(get_model_urls('dcim', 'powerpanel'))), - # Power feeds - path('power-feeds/', views.PowerFeedListView.as_view(), name='powerfeed_list'), - path('power-feeds/add/', views.PowerFeedEditView.as_view(), name='powerfeed_add'), - path('power-feeds/import/', views.PowerFeedBulkImportView.as_view(), name='powerfeed_import'), - path('power-feeds/edit/', views.PowerFeedBulkEditView.as_view(), name='powerfeed_bulk_edit'), - path('power-feeds/disconnect/', views.PowerFeedBulkDisconnectView.as_view(), name='powerfeed_bulk_disconnect'), - path('power-feeds/delete/', views.PowerFeedBulkDeleteView.as_view(), name='powerfeed_bulk_delete'), + path('power-feeds/', include(get_model_urls('dcim', 'powerfeed', detail=False))), path('power-feeds//', include(get_model_urls('dcim', 'powerfeed'))), + path('mac-addresses/', include(get_model_urls('dcim', 'macaddress', detail=False))), + path('mac-addresses//', include(get_model_urls('dcim', 'macaddress'))), + ] diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 4bd0ea877..fa9fb667f 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -215,6 +215,7 @@ class PathTraceView(generic.ObjectView): # Regions # +@register_model_view(Region, 'list', path='', detail=False) class RegionListView(generic.ObjectListView): queryset = Region.objects.add_related_count( Region.objects.all(), @@ -251,6 +252,7 @@ class RegionView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Region, 'add', detail=False) @register_model_view(Region, 'edit') class RegionEditView(generic.ObjectEditView): queryset = Region.objects.all() @@ -262,11 +264,13 @@ class RegionDeleteView(generic.ObjectDeleteView): queryset = Region.objects.all() +@register_model_view(Region, 'import', detail=False) class RegionBulkImportView(generic.BulkImportView): queryset = Region.objects.all() model_form = forms.RegionImportForm +@register_model_view(Region, 'bulk_edit', path='edit', detail=False) class RegionBulkEditView(generic.BulkEditView): queryset = Region.objects.add_related_count( Region.objects.all(), @@ -280,6 +284,7 @@ class RegionBulkEditView(generic.BulkEditView): form = forms.RegionBulkEditForm +@register_model_view(Region, 'bulk_delete', path='delete', detail=False) class RegionBulkDeleteView(generic.BulkDeleteView): queryset = Region.objects.add_related_count( Region.objects.all(), @@ -301,6 +306,7 @@ class RegionContactsView(ObjectContactsView): # Site groups # +@register_model_view(SiteGroup, 'list', path='', detail=False) class SiteGroupListView(generic.ObjectListView): queryset = SiteGroup.objects.add_related_count( SiteGroup.objects.all(), @@ -337,6 +343,7 @@ class SiteGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(SiteGroup, 'add', detail=False) @register_model_view(SiteGroup, 'edit') class SiteGroupEditView(generic.ObjectEditView): queryset = SiteGroup.objects.all() @@ -348,11 +355,13 @@ class SiteGroupDeleteView(generic.ObjectDeleteView): queryset = SiteGroup.objects.all() +@register_model_view(SiteGroup, 'import', detail=False) class SiteGroupBulkImportView(generic.BulkImportView): queryset = SiteGroup.objects.all() model_form = forms.SiteGroupImportForm +@register_model_view(SiteGroup, 'bulk_edit', path='edit', detail=False) class SiteGroupBulkEditView(generic.BulkEditView): queryset = SiteGroup.objects.add_related_count( SiteGroup.objects.all(), @@ -366,6 +375,7 @@ class SiteGroupBulkEditView(generic.BulkEditView): form = forms.SiteGroupBulkEditForm +@register_model_view(SiteGroup, 'bulk_delete', path='delete', detail=False) class SiteGroupBulkDeleteView(generic.BulkDeleteView): queryset = SiteGroup.objects.add_related_count( SiteGroup.objects.all(), @@ -387,6 +397,7 @@ class SiteGroupContactsView(ObjectContactsView): # Sites # +@register_model_view(Site, 'list', path='', detail=False) class SiteListView(generic.ObjectListView): queryset = Site.objects.annotate( device_count=count_related(Device, 'site') @@ -421,6 +432,7 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Site, 'add', detail=False) @register_model_view(Site, 'edit') class SiteEditView(generic.ObjectEditView): queryset = Site.objects.all() @@ -432,11 +444,13 @@ class SiteDeleteView(generic.ObjectDeleteView): queryset = Site.objects.all() +@register_model_view(Site, 'import', detail=False) class SiteBulkImportView(generic.BulkImportView): queryset = Site.objects.all() model_form = forms.SiteImportForm +@register_model_view(Site, 'bulk_edit', path='edit', detail=False) class SiteBulkEditView(generic.BulkEditView): queryset = Site.objects.all() filterset = filtersets.SiteFilterSet @@ -444,6 +458,7 @@ class SiteBulkEditView(generic.BulkEditView): form = forms.SiteBulkEditForm +@register_model_view(Site, 'bulk_delete', path='delete', detail=False) class SiteBulkDeleteView(generic.BulkDeleteView): queryset = Site.objects.all() filterset = filtersets.SiteFilterSet @@ -459,6 +474,7 @@ class SiteContactsView(ObjectContactsView): # Locations # +@register_model_view(Location, 'list', path='', detail=False) class LocationListView(generic.ObjectListView): queryset = Location.objects.add_related_count( Location.objects.add_related_count( @@ -499,6 +515,7 @@ class LocationView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Location, 'add', detail=False) @register_model_view(Location, 'edit') class LocationEditView(generic.ObjectEditView): queryset = Location.objects.all() @@ -510,11 +527,13 @@ class LocationDeleteView(generic.ObjectDeleteView): queryset = Location.objects.all() +@register_model_view(Location, 'import', detail=False) class LocationBulkImportView(generic.BulkImportView): queryset = Location.objects.all() model_form = forms.LocationImportForm +@register_model_view(Location, 'bulk_edit', path='edit', detail=False) class LocationBulkEditView(generic.BulkEditView): queryset = Location.objects.add_related_count( Location.objects.all(), @@ -528,6 +547,7 @@ class LocationBulkEditView(generic.BulkEditView): form = forms.LocationBulkEditForm +@register_model_view(Location, 'bulk_delete', path='delete', detail=False) class LocationBulkDeleteView(generic.BulkDeleteView): queryset = Location.objects.add_related_count( Location.objects.all(), @@ -549,6 +569,7 @@ class LocationContactsView(ObjectContactsView): # Rack roles # +@register_model_view(RackRole, 'list', path='', detail=False) class RackRoleListView(generic.ObjectListView): queryset = RackRole.objects.annotate( rack_count=count_related(Rack, 'role') @@ -568,6 +589,7 @@ class RackRoleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(RackRole, 'add', detail=False) @register_model_view(RackRole, 'edit') class RackRoleEditView(generic.ObjectEditView): queryset = RackRole.objects.all() @@ -579,11 +601,13 @@ class RackRoleDeleteView(generic.ObjectDeleteView): queryset = RackRole.objects.all() +@register_model_view(RackRole, 'import', detail=False) class RackRoleBulkImportView(generic.BulkImportView): queryset = RackRole.objects.all() model_form = forms.RackRoleImportForm +@register_model_view(RackRole, 'bulk_edit', path='edit', detail=False) class RackRoleBulkEditView(generic.BulkEditView): queryset = RackRole.objects.annotate( rack_count=count_related(Rack, 'role') @@ -593,6 +617,7 @@ class RackRoleBulkEditView(generic.BulkEditView): form = forms.RackRoleBulkEditForm +@register_model_view(RackRole, 'bulk_delete', path='delete', detail=False) class RackRoleBulkDeleteView(generic.BulkDeleteView): queryset = RackRole.objects.annotate( rack_count=count_related(Rack, 'role') @@ -605,6 +630,7 @@ class RackRoleBulkDeleteView(generic.BulkDeleteView): # RackTypes # +@register_model_view(RackType, 'list', path='', detail=False) class RackTypeListView(generic.ObjectListView): queryset = RackType.objects.annotate( instance_count=count_related(Rack, 'rack_type') @@ -624,6 +650,7 @@ class RackTypeView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(RackType, 'add', detail=False) @register_model_view(RackType, 'edit') class RackTypeEditView(generic.ObjectEditView): queryset = RackType.objects.all() @@ -635,11 +662,13 @@ class RackTypeDeleteView(generic.ObjectDeleteView): queryset = RackType.objects.all() +@register_model_view(RackType, 'import', detail=False) class RackTypeBulkImportView(generic.BulkImportView): queryset = RackType.objects.all() model_form = forms.RackTypeImportForm +@register_model_view(RackType, 'bulk_edit', path='edit', detail=False) class RackTypeBulkEditView(generic.BulkEditView): queryset = RackType.objects.all() filterset = filtersets.RackTypeFilterSet @@ -647,6 +676,7 @@ class RackTypeBulkEditView(generic.BulkEditView): form = forms.RackTypeBulkEditForm +@register_model_view(RackType, 'bulk_delete', path='delete', detail=False) class RackTypeBulkDeleteView(generic.BulkDeleteView): queryset = RackType.objects.all() filterset = filtersets.RackTypeFilterSet @@ -657,6 +687,7 @@ class RackTypeBulkDeleteView(generic.BulkDeleteView): # Racks # +@register_model_view(Rack, 'list', path='', detail=False) class RackListView(generic.ObjectListView): queryset = Rack.objects.annotate( device_count=count_related(Device, 'rack') @@ -787,6 +818,7 @@ class RackNonRackedView(generic.ObjectChildrenView): ) +@register_model_view(Rack, 'add', detail=False) @register_model_view(Rack, 'edit') class RackEditView(generic.ObjectEditView): queryset = Rack.objects.all() @@ -798,11 +830,13 @@ class RackDeleteView(generic.ObjectDeleteView): queryset = Rack.objects.all() +@register_model_view(Rack, 'import', detail=False) class RackBulkImportView(generic.BulkImportView): queryset = Rack.objects.all() model_form = forms.RackImportForm +@register_model_view(Rack, 'bulk_edit', path='edit', detail=False) class RackBulkEditView(generic.BulkEditView): queryset = Rack.objects.all() filterset = filtersets.RackFilterSet @@ -810,6 +844,7 @@ class RackBulkEditView(generic.BulkEditView): form = forms.RackBulkEditForm +@register_model_view(Rack, 'bulk_delete', path='delete', detail=False) class RackBulkDeleteView(generic.BulkDeleteView): queryset = Rack.objects.all() filterset = filtersets.RackFilterSet @@ -825,6 +860,7 @@ class RackContactsView(ObjectContactsView): # Rack reservations # +@register_model_view(RackReservation, 'list', path='', detail=False) class RackReservationListView(generic.ObjectListView): queryset = RackReservation.objects.all() filterset = filtersets.RackReservationFilterSet @@ -837,6 +873,7 @@ class RackReservationView(generic.ObjectView): queryset = RackReservation.objects.all() +@register_model_view(RackReservation, 'add', detail=False) @register_model_view(RackReservation, 'edit') class RackReservationEditView(generic.ObjectEditView): queryset = RackReservation.objects.all() @@ -855,6 +892,7 @@ class RackReservationDeleteView(generic.ObjectDeleteView): queryset = RackReservation.objects.all() +@register_model_view(RackReservation, 'import', detail=False) class RackReservationImportView(generic.BulkImportView): queryset = RackReservation.objects.all() model_form = forms.RackReservationImportForm @@ -870,6 +908,7 @@ class RackReservationImportView(generic.BulkImportView): return instance +@register_model_view(RackReservation, 'bulk_edit', path='edit', detail=False) class RackReservationBulkEditView(generic.BulkEditView): queryset = RackReservation.objects.all() filterset = filtersets.RackReservationFilterSet @@ -877,6 +916,7 @@ class RackReservationBulkEditView(generic.BulkEditView): form = forms.RackReservationBulkEditForm +@register_model_view(RackReservation, 'bulk_delete', path='delete', detail=False) class RackReservationBulkDeleteView(generic.BulkDeleteView): queryset = RackReservation.objects.all() filterset = filtersets.RackReservationFilterSet @@ -887,6 +927,7 @@ class RackReservationBulkDeleteView(generic.BulkDeleteView): # Manufacturers # +@register_model_view(Manufacturer, 'list', path='', detail=False) class ManufacturerListView(generic.ObjectListView): queryset = Manufacturer.objects.annotate( devicetype_count=count_related(DeviceType, 'manufacturer'), @@ -909,6 +950,7 @@ class ManufacturerView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Manufacturer, 'add', detail=False) @register_model_view(Manufacturer, 'edit') class ManufacturerEditView(generic.ObjectEditView): queryset = Manufacturer.objects.all() @@ -920,11 +962,13 @@ class ManufacturerDeleteView(generic.ObjectDeleteView): queryset = Manufacturer.objects.all() +@register_model_view(Manufacturer, 'import', detail=False) class ManufacturerBulkImportView(generic.BulkImportView): queryset = Manufacturer.objects.all() model_form = forms.ManufacturerImportForm +@register_model_view(Manufacturer, 'bulk_edit', path='edit', detail=False) class ManufacturerBulkEditView(generic.BulkEditView): queryset = Manufacturer.objects.annotate( devicetype_count=count_related(DeviceType, 'manufacturer'), @@ -937,6 +981,7 @@ class ManufacturerBulkEditView(generic.BulkEditView): form = forms.ManufacturerBulkEditForm +@register_model_view(Manufacturer, 'bulk_delete', path='delete', detail=False) class ManufacturerBulkDeleteView(generic.BulkDeleteView): queryset = Manufacturer.objects.annotate( devicetype_count=count_related(DeviceType, 'manufacturer'), @@ -957,6 +1002,7 @@ class ManufacturerContactsView(ObjectContactsView): # Device types # +@register_model_view(DeviceType, 'list', path='', detail=False) class DeviceTypeListView(generic.ObjectListView): queryset = DeviceType.objects.annotate( instance_count=count_related(Device, 'device_type') @@ -980,6 +1026,7 @@ class DeviceTypeView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(DeviceType, 'add', detail=False) @register_model_view(DeviceType, 'edit') class DeviceTypeEditView(generic.ObjectEditView): queryset = DeviceType.objects.all() @@ -1141,6 +1188,7 @@ class DeviceTypeInventoryItemsView(DeviceTypeComponentsView): ) +@register_model_view(DeviceType, 'import', detail=False) class DeviceTypeImportView(generic.BulkImportView): additional_permissions = [ 'dcim.add_devicetype', @@ -1175,6 +1223,7 @@ class DeviceTypeImportView(generic.BulkImportView): return data +@register_model_view(DeviceType, 'bulk_edit', path='edit', detail=False) class DeviceTypeBulkEditView(generic.BulkEditView): queryset = DeviceType.objects.annotate( instance_count=count_related(Device, 'device_type') @@ -1184,6 +1233,7 @@ class DeviceTypeBulkEditView(generic.BulkEditView): form = forms.DeviceTypeBulkEditForm +@register_model_view(DeviceType, 'bulk_delete', path='delete', detail=False) class DeviceTypeBulkDeleteView(generic.BulkDeleteView): queryset = DeviceType.objects.annotate( instance_count=count_related(Device, 'device_type') @@ -1196,6 +1246,7 @@ class DeviceTypeBulkDeleteView(generic.BulkDeleteView): # Module types # +@register_model_view(ModuleType, 'list', path='', detail=False) class ModuleTypeListView(generic.ObjectListView): queryset = ModuleType.objects.annotate( instance_count=count_related(Module, 'module_type') @@ -1219,6 +1270,7 @@ class ModuleTypeView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ModuleType, 'add', detail=False) @register_model_view(ModuleType, 'edit') class ModuleTypeEditView(generic.ObjectEditView): queryset = ModuleType.objects.all() @@ -1350,6 +1402,7 @@ class ModuleTypeModuleBaysView(ModuleTypeComponentsView): ) +@register_model_view(ModuleType, 'import', detail=False) class ModuleTypeImportView(generic.BulkImportView): additional_permissions = [ 'dcim.add_moduletype', @@ -1378,6 +1431,7 @@ class ModuleTypeImportView(generic.BulkImportView): return data +@register_model_view(ModuleType, 'bulk_edit', path='edit', detail=False) class ModuleTypeBulkEditView(generic.BulkEditView): queryset = ModuleType.objects.annotate( instance_count=count_related(Module, 'module_type') @@ -1387,6 +1441,7 @@ class ModuleTypeBulkEditView(generic.BulkEditView): form = forms.ModuleTypeBulkEditForm +@register_model_view(ModuleType, 'bulk_delete', path='delete', detail=False) class ModuleTypeBulkDeleteView(generic.BulkDeleteView): queryset = ModuleType.objects.annotate( instance_count=count_related(Module, 'module_type') @@ -1399,6 +1454,7 @@ class ModuleTypeBulkDeleteView(generic.BulkDeleteView): # Console port templates # +@register_model_view(ConsolePortTemplate, 'add', detail=False) class ConsolePortTemplateCreateView(generic.ComponentCreateView): queryset = ConsolePortTemplate.objects.all() form = forms.ConsolePortTemplateCreateForm @@ -1416,16 +1472,19 @@ class ConsolePortTemplateDeleteView(generic.ObjectDeleteView): queryset = ConsolePortTemplate.objects.all() +@register_model_view(ConsolePortTemplate, 'bulk_edit', path='edit', detail=False) class ConsolePortTemplateBulkEditView(generic.BulkEditView): queryset = ConsolePortTemplate.objects.all() table = tables.ConsolePortTemplateTable form = forms.ConsolePortTemplateBulkEditForm +@register_model_view(ConsolePortTemplate, 'bulk_rename', path='rename', detail=False) class ConsolePortTemplateBulkRenameView(generic.BulkRenameView): queryset = ConsolePortTemplate.objects.all() +@register_model_view(ConsolePortTemplate, 'bulk_delete', path='delete', detail=False) class ConsolePortTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ConsolePortTemplate.objects.all() table = tables.ConsolePortTemplateTable @@ -1435,6 +1494,7 @@ class ConsolePortTemplateBulkDeleteView(generic.BulkDeleteView): # Console server port templates # +@register_model_view(ConsoleServerPortTemplate, 'add', detail=False) class ConsoleServerPortTemplateCreateView(generic.ComponentCreateView): queryset = ConsoleServerPortTemplate.objects.all() form = forms.ConsoleServerPortTemplateCreateForm @@ -1452,16 +1512,19 @@ class ConsoleServerPortTemplateDeleteView(generic.ObjectDeleteView): queryset = ConsoleServerPortTemplate.objects.all() +@register_model_view(ConsoleServerPortTemplate, 'bulk_edit', path='edit', detail=False) class ConsoleServerPortTemplateBulkEditView(generic.BulkEditView): queryset = ConsoleServerPortTemplate.objects.all() table = tables.ConsoleServerPortTemplateTable form = forms.ConsoleServerPortTemplateBulkEditForm +@register_model_view(ConsoleServerPortTemplate, 'bulk_rename', detail=False) class ConsoleServerPortTemplateBulkRenameView(generic.BulkRenameView): queryset = ConsoleServerPortTemplate.objects.all() +@register_model_view(ConsoleServerPortTemplate, 'bulk_delete', path='delete', detail=False) class ConsoleServerPortTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ConsoleServerPortTemplate.objects.all() table = tables.ConsoleServerPortTemplateTable @@ -1471,6 +1534,7 @@ class ConsoleServerPortTemplateBulkDeleteView(generic.BulkDeleteView): # Power port templates # +@register_model_view(PowerPortTemplate, 'add', detail=False) class PowerPortTemplateCreateView(generic.ComponentCreateView): queryset = PowerPortTemplate.objects.all() form = forms.PowerPortTemplateCreateForm @@ -1488,16 +1552,19 @@ class PowerPortTemplateDeleteView(generic.ObjectDeleteView): queryset = PowerPortTemplate.objects.all() +@register_model_view(PowerPortTemplate, 'bulk_edit', path='edit', detail=False) class PowerPortTemplateBulkEditView(generic.BulkEditView): queryset = PowerPortTemplate.objects.all() table = tables.PowerPortTemplateTable form = forms.PowerPortTemplateBulkEditForm +@register_model_view(PowerPortTemplate, 'bulk_rename', path='rename', detail=False) class PowerPortTemplateBulkRenameView(generic.BulkRenameView): queryset = PowerPortTemplate.objects.all() +@register_model_view(PowerPortTemplate, 'bulk_delete', path='delete', detail=False) class PowerPortTemplateBulkDeleteView(generic.BulkDeleteView): queryset = PowerPortTemplate.objects.all() table = tables.PowerPortTemplateTable @@ -1507,6 +1574,7 @@ class PowerPortTemplateBulkDeleteView(generic.BulkDeleteView): # Power outlet templates # +@register_model_view(PowerOutletTemplate, 'add', detail=False) class PowerOutletTemplateCreateView(generic.ComponentCreateView): queryset = PowerOutletTemplate.objects.all() form = forms.PowerOutletTemplateCreateForm @@ -1524,16 +1592,19 @@ class PowerOutletTemplateDeleteView(generic.ObjectDeleteView): queryset = PowerOutletTemplate.objects.all() +@register_model_view(PowerOutletTemplate, 'bulk_edit', path='edit', detail=False) class PowerOutletTemplateBulkEditView(generic.BulkEditView): queryset = PowerOutletTemplate.objects.all() table = tables.PowerOutletTemplateTable form = forms.PowerOutletTemplateBulkEditForm +@register_model_view(PowerOutletTemplate, 'bulk_rename', path='rename', detail=False) class PowerOutletTemplateBulkRenameView(generic.BulkRenameView): queryset = PowerOutletTemplate.objects.all() +@register_model_view(PowerOutletTemplate, 'bulk_delete', path='delete', detail=False) class PowerOutletTemplateBulkDeleteView(generic.BulkDeleteView): queryset = PowerOutletTemplate.objects.all() table = tables.PowerOutletTemplateTable @@ -1543,6 +1614,7 @@ class PowerOutletTemplateBulkDeleteView(generic.BulkDeleteView): # Interface templates # +@register_model_view(InterfaceTemplate, 'add', detail=False) class InterfaceTemplateCreateView(generic.ComponentCreateView): queryset = InterfaceTemplate.objects.all() form = forms.InterfaceTemplateCreateForm @@ -1560,16 +1632,19 @@ class InterfaceTemplateDeleteView(generic.ObjectDeleteView): queryset = InterfaceTemplate.objects.all() +@register_model_view(InterfaceTemplate, 'bulk_edit', path='edit', detail=False) class InterfaceTemplateBulkEditView(generic.BulkEditView): queryset = InterfaceTemplate.objects.all() table = tables.InterfaceTemplateTable form = forms.InterfaceTemplateBulkEditForm +@register_model_view(InterfaceTemplate, 'bulk_rename', path='rename', detail=False) class InterfaceTemplateBulkRenameView(generic.BulkRenameView): queryset = InterfaceTemplate.objects.all() +@register_model_view(InterfaceTemplate, 'bulk_delete', path='delete', detail=False) class InterfaceTemplateBulkDeleteView(generic.BulkDeleteView): queryset = InterfaceTemplate.objects.all() table = tables.InterfaceTemplateTable @@ -1579,6 +1654,7 @@ class InterfaceTemplateBulkDeleteView(generic.BulkDeleteView): # Front port templates # +@register_model_view(FrontPortTemplate, 'add', detail=False) class FrontPortTemplateCreateView(generic.ComponentCreateView): queryset = FrontPortTemplate.objects.all() form = forms.FrontPortTemplateCreateForm @@ -1596,16 +1672,19 @@ class FrontPortTemplateDeleteView(generic.ObjectDeleteView): queryset = FrontPortTemplate.objects.all() +@register_model_view(FrontPortTemplate, 'bulk_edit', path='edit', detail=False) class FrontPortTemplateBulkEditView(generic.BulkEditView): queryset = FrontPortTemplate.objects.all() table = tables.FrontPortTemplateTable form = forms.FrontPortTemplateBulkEditForm +@register_model_view(FrontPortTemplate, 'bulk_rename', path='rename', detail=False) class FrontPortTemplateBulkRenameView(generic.BulkRenameView): queryset = FrontPortTemplate.objects.all() +@register_model_view(FrontPortTemplate, 'bulk_delete', path='delete', detail=False) class FrontPortTemplateBulkDeleteView(generic.BulkDeleteView): queryset = FrontPortTemplate.objects.all() table = tables.FrontPortTemplateTable @@ -1615,6 +1694,7 @@ class FrontPortTemplateBulkDeleteView(generic.BulkDeleteView): # Rear port templates # +@register_model_view(RearPortTemplate, 'add', detail=False) class RearPortTemplateCreateView(generic.ComponentCreateView): queryset = RearPortTemplate.objects.all() form = forms.RearPortTemplateCreateForm @@ -1632,16 +1712,19 @@ class RearPortTemplateDeleteView(generic.ObjectDeleteView): queryset = RearPortTemplate.objects.all() +@register_model_view(RearPortTemplate, 'bulk_edit', path='edit', detail=False) class RearPortTemplateBulkEditView(generic.BulkEditView): queryset = RearPortTemplate.objects.all() table = tables.RearPortTemplateTable form = forms.RearPortTemplateBulkEditForm +@register_model_view(RearPortTemplate, 'bulk_rename', path='rename', detail=False) class RearPortTemplateBulkRenameView(generic.BulkRenameView): queryset = RearPortTemplate.objects.all() +@register_model_view(RearPortTemplate, 'bulk_delete', path='delete', detail=False) class RearPortTemplateBulkDeleteView(generic.BulkDeleteView): queryset = RearPortTemplate.objects.all() table = tables.RearPortTemplateTable @@ -1651,6 +1734,7 @@ class RearPortTemplateBulkDeleteView(generic.BulkDeleteView): # Module bay templates # +@register_model_view(ModuleBayTemplate, 'add', detail=False) class ModuleBayTemplateCreateView(generic.ComponentCreateView): queryset = ModuleBayTemplate.objects.all() form = forms.ModuleBayTemplateCreateForm @@ -1668,16 +1752,19 @@ class ModuleBayTemplateDeleteView(generic.ObjectDeleteView): queryset = ModuleBayTemplate.objects.all() +@register_model_view(ModuleBayTemplate, 'bulk_edit', path='edit', detail=False) class ModuleBayTemplateBulkEditView(generic.BulkEditView): queryset = ModuleBayTemplate.objects.all() table = tables.ModuleBayTemplateTable form = forms.ModuleBayTemplateBulkEditForm +@register_model_view(ModuleBayTemplate, 'bulk_rename', path='rename', detail=False) class ModuleBayTemplateBulkRenameView(generic.BulkRenameView): queryset = ModuleBayTemplate.objects.all() +@register_model_view(ModuleBayTemplate, 'bulk_delete', path='delete', detail=False) class ModuleBayTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ModuleBayTemplate.objects.all() table = tables.ModuleBayTemplateTable @@ -1687,6 +1774,7 @@ class ModuleBayTemplateBulkDeleteView(generic.BulkDeleteView): # Device bay templates # +@register_model_view(DeviceBayTemplate, 'add', detail=False) class DeviceBayTemplateCreateView(generic.ComponentCreateView): queryset = DeviceBayTemplate.objects.all() form = forms.DeviceBayTemplateCreateForm @@ -1704,16 +1792,19 @@ class DeviceBayTemplateDeleteView(generic.ObjectDeleteView): queryset = DeviceBayTemplate.objects.all() +@register_model_view(DeviceBayTemplate, 'bulk_edit', path='edit', detail=False) class DeviceBayTemplateBulkEditView(generic.BulkEditView): queryset = DeviceBayTemplate.objects.all() table = tables.DeviceBayTemplateTable form = forms.DeviceBayTemplateBulkEditForm +@register_model_view(DeviceBayTemplate, 'bulk_rename', path='rename', detail=False) class DeviceBayTemplateBulkRenameView(generic.BulkRenameView): queryset = DeviceBayTemplate.objects.all() +@register_model_view(DeviceBayTemplate, 'bulk_delete', path='delete', detail=False) class DeviceBayTemplateBulkDeleteView(generic.BulkDeleteView): queryset = DeviceBayTemplate.objects.all() table = tables.DeviceBayTemplateTable @@ -1723,6 +1814,7 @@ class DeviceBayTemplateBulkDeleteView(generic.BulkDeleteView): # Inventory item templates # +@register_model_view(InventoryItemTemplate, 'add', detail=False) class InventoryItemTemplateCreateView(generic.ComponentCreateView): queryset = InventoryItemTemplate.objects.all() form = forms.InventoryItemTemplateCreateForm @@ -1751,16 +1843,19 @@ class InventoryItemTemplateDeleteView(generic.ObjectDeleteView): queryset = InventoryItemTemplate.objects.all() +@register_model_view(InventoryItemTemplate, 'bulk_edit', path='edit', detail=False) class InventoryItemTemplateBulkEditView(generic.BulkEditView): queryset = InventoryItemTemplate.objects.all() table = tables.InventoryItemTemplateTable form = forms.InventoryItemTemplateBulkEditForm +@register_model_view(InventoryItemTemplate, 'bulk_rename', path='rename', detail=False) class InventoryItemTemplateBulkRenameView(generic.BulkRenameView): queryset = InventoryItemTemplate.objects.all() +@register_model_view(InventoryItemTemplate, 'bulk_delete', path='delete', detail=False) class InventoryItemTemplateBulkDeleteView(generic.BulkDeleteView): queryset = InventoryItemTemplate.objects.all() table = tables.InventoryItemTemplateTable @@ -1770,6 +1865,7 @@ class InventoryItemTemplateBulkDeleteView(generic.BulkDeleteView): # Device roles # +@register_model_view(DeviceRole, 'list', path='', detail=False) class DeviceRoleListView(generic.ObjectListView): queryset = DeviceRole.objects.annotate( device_count=count_related(Device, 'role'), @@ -1790,6 +1886,7 @@ class DeviceRoleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(DeviceRole, 'add', detail=False) @register_model_view(DeviceRole, 'edit') class DeviceRoleEditView(generic.ObjectEditView): queryset = DeviceRole.objects.all() @@ -1801,11 +1898,13 @@ class DeviceRoleDeleteView(generic.ObjectDeleteView): queryset = DeviceRole.objects.all() +@register_model_view(DeviceRole, 'import', detail=False) class DeviceRoleBulkImportView(generic.BulkImportView): queryset = DeviceRole.objects.all() model_form = forms.DeviceRoleImportForm +@register_model_view(DeviceRole, 'bulk_edit', path='edit', detail=False) class DeviceRoleBulkEditView(generic.BulkEditView): queryset = DeviceRole.objects.annotate( device_count=count_related(Device, 'role'), @@ -1816,6 +1915,7 @@ class DeviceRoleBulkEditView(generic.BulkEditView): form = forms.DeviceRoleBulkEditForm +@register_model_view(DeviceRole, 'bulk_delete', path='delete', detail=False) class DeviceRoleBulkDeleteView(generic.BulkDeleteView): queryset = DeviceRole.objects.annotate( device_count=count_related(Device, 'role'), @@ -1829,6 +1929,7 @@ class DeviceRoleBulkDeleteView(generic.BulkDeleteView): # Platforms # +@register_model_view(Platform, 'list', path='', detail=False) class PlatformListView(generic.ObjectListView): queryset = Platform.objects.annotate( device_count=count_related(Device, 'platform'), @@ -1849,6 +1950,7 @@ class PlatformView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Platform, 'add', detail=False) @register_model_view(Platform, 'edit') class PlatformEditView(generic.ObjectEditView): queryset = Platform.objects.all() @@ -1860,11 +1962,13 @@ class PlatformDeleteView(generic.ObjectDeleteView): queryset = Platform.objects.all() +@register_model_view(Platform, 'import', detail=False) class PlatformBulkImportView(generic.BulkImportView): queryset = Platform.objects.all() model_form = forms.PlatformImportForm +@register_model_view(Platform, 'bulk_edit', path='edit', detail=False) class PlatformBulkEditView(generic.BulkEditView): queryset = Platform.objects.all() filterset = filtersets.PlatformFilterSet @@ -1872,6 +1976,7 @@ class PlatformBulkEditView(generic.BulkEditView): form = forms.PlatformBulkEditForm +@register_model_view(Platform, 'bulk_delete', path='delete', detail=False) class PlatformBulkDeleteView(generic.BulkDeleteView): queryset = Platform.objects.all() filterset = filtersets.PlatformFilterSet @@ -1882,6 +1987,7 @@ class PlatformBulkDeleteView(generic.BulkDeleteView): # Devices # +@register_model_view(Device, 'list', path='', detail=False) class DeviceListView(generic.ObjectListView): queryset = Device.objects.all() filterset = filtersets.DeviceFilterSet @@ -1909,6 +2015,7 @@ class DeviceView(generic.ObjectView): } +@register_model_view(Device, 'add', detail=False) @register_model_view(Device, 'edit') class DeviceEditView(generic.ObjectEditView): queryset = Device.objects.all() @@ -2176,6 +2283,7 @@ class DeviceVirtualMachinesView(generic.ObjectChildrenView): return self.child_model.objects.restrict(request.user, 'view').filter(cluster=parent.cluster, device=parent) +@register_model_view(Device, 'import', detail=False) class DeviceBulkImportView(generic.BulkImportView): queryset = Device.objects.all() model_form = forms.DeviceImportForm @@ -2192,6 +2300,7 @@ class DeviceBulkImportView(generic.BulkImportView): return obj +@register_model_view(Device, 'bulk_edit', path='edit', detail=False) class DeviceBulkEditView(generic.BulkEditView): queryset = Device.objects.prefetch_related('device_type__manufacturer') filterset = filtersets.DeviceFilterSet @@ -2199,12 +2308,14 @@ class DeviceBulkEditView(generic.BulkEditView): form = forms.DeviceBulkEditForm +@register_model_view(Device, 'bulk_delete', path='delete', detail=False) class DeviceBulkDeleteView(generic.BulkDeleteView): queryset = Device.objects.prefetch_related('device_type__manufacturer') filterset = filtersets.DeviceFilterSet table = tables.DeviceTable +@register_model_view(Device, 'bulk_rename', path='rename', detail=False) class DeviceBulkRenameView(generic.BulkRenameView): queryset = Device.objects.all() filterset = filtersets.DeviceFilterSet @@ -2220,6 +2331,7 @@ class DeviceContactsView(ObjectContactsView): # Modules # +@register_model_view(Module, 'list', path='', detail=False) class ModuleListView(generic.ObjectListView): queryset = Module.objects.prefetch_related('module_type__manufacturer') filterset = filtersets.ModuleFilterSet @@ -2237,6 +2349,7 @@ class ModuleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Module, 'add', detail=False) @register_model_view(Module, 'edit') class ModuleEditView(generic.ObjectEditView): queryset = Module.objects.all() @@ -2248,11 +2361,13 @@ class ModuleDeleteView(generic.ObjectDeleteView): queryset = Module.objects.all() +@register_model_view(Module, 'import', detail=False) class ModuleBulkImportView(generic.BulkImportView): queryset = Module.objects.all() model_form = forms.ModuleImportForm +@register_model_view(Module, 'bulk_edit', path='edit', detail=False) class ModuleBulkEditView(generic.BulkEditView): queryset = Module.objects.prefetch_related('module_type__manufacturer') filterset = filtersets.ModuleFilterSet @@ -2260,6 +2375,7 @@ class ModuleBulkEditView(generic.BulkEditView): form = forms.ModuleBulkEditForm +@register_model_view(Module, 'bulk_delete', path='delete', detail=False) class ModuleBulkDeleteView(generic.BulkDeleteView): queryset = Module.objects.prefetch_related('module_type__manufacturer') filterset = filtersets.ModuleFilterSet @@ -2270,6 +2386,7 @@ class ModuleBulkDeleteView(generic.BulkDeleteView): # Console ports # +@register_model_view(ConsolePort, 'list', path='', detail=False) class ConsolePortListView(generic.ObjectListView): queryset = ConsolePort.objects.all() filterset = filtersets.ConsolePortFilterSet @@ -2287,6 +2404,7 @@ class ConsolePortView(generic.ObjectView): queryset = ConsolePort.objects.all() +@register_model_view(ConsolePort, 'add', detail=False) class ConsolePortCreateView(generic.ComponentCreateView): queryset = ConsolePort.objects.all() form = forms.ConsolePortCreateForm @@ -2304,11 +2422,13 @@ class ConsolePortDeleteView(generic.ObjectDeleteView): queryset = ConsolePort.objects.all() +@register_model_view(ConsolePort, 'import', detail=False) class ConsolePortBulkImportView(generic.BulkImportView): queryset = ConsolePort.objects.all() model_form = forms.ConsolePortImportForm +@register_model_view(ConsolePort, 'bulk_edit', path='edit', detail=False) class ConsolePortBulkEditView(generic.BulkEditView): queryset = ConsolePort.objects.all() filterset = filtersets.ConsolePortFilterSet @@ -2316,14 +2436,17 @@ class ConsolePortBulkEditView(generic.BulkEditView): form = forms.ConsolePortBulkEditForm +@register_model_view(ConsolePort, 'bulk_rename', path='rename', detail=False) class ConsolePortBulkRenameView(generic.BulkRenameView): queryset = ConsolePort.objects.all() +@register_model_view(ConsolePort, 'bulk_disconnect', path='disconnect', detail=False) class ConsolePortBulkDisconnectView(BulkDisconnectView): queryset = ConsolePort.objects.all() +@register_model_view(ConsolePort, 'bulk_delete', path='delete', detail=False) class ConsolePortBulkDeleteView(generic.BulkDeleteView): queryset = ConsolePort.objects.all() filterset = filtersets.ConsolePortFilterSet @@ -2338,6 +2461,7 @@ register_model_view(ConsolePort, 'trace', kwargs={'model': ConsolePort})(PathTra # Console server ports # +@register_model_view(ConsoleServerPort, 'list', path='', detail=False) class ConsoleServerPortListView(generic.ObjectListView): queryset = ConsoleServerPort.objects.all() filterset = filtersets.ConsoleServerPortFilterSet @@ -2355,6 +2479,7 @@ class ConsoleServerPortView(generic.ObjectView): queryset = ConsoleServerPort.objects.all() +@register_model_view(ConsoleServerPort, 'add', detail=False) class ConsoleServerPortCreateView(generic.ComponentCreateView): queryset = ConsoleServerPort.objects.all() form = forms.ConsoleServerPortCreateForm @@ -2372,11 +2497,13 @@ class ConsoleServerPortDeleteView(generic.ObjectDeleteView): queryset = ConsoleServerPort.objects.all() +@register_model_view(ConsoleServerPort, 'import', detail=False) class ConsoleServerPortBulkImportView(generic.BulkImportView): queryset = ConsoleServerPort.objects.all() model_form = forms.ConsoleServerPortImportForm +@register_model_view(ConsoleServerPort, 'bulk_edit', path='edit', detail=False) class ConsoleServerPortBulkEditView(generic.BulkEditView): queryset = ConsoleServerPort.objects.all() filterset = filtersets.ConsoleServerPortFilterSet @@ -2384,14 +2511,17 @@ class ConsoleServerPortBulkEditView(generic.BulkEditView): form = forms.ConsoleServerPortBulkEditForm +@register_model_view(ConsoleServerPort, 'bulk_rename', path='rename', detail=False) class ConsoleServerPortBulkRenameView(generic.BulkRenameView): queryset = ConsoleServerPort.objects.all() +@register_model_view(ConsoleServerPort, 'bulk_disconnect', path='disconnect', detail=False) class ConsoleServerPortBulkDisconnectView(BulkDisconnectView): queryset = ConsoleServerPort.objects.all() +@register_model_view(ConsoleServerPort, 'bulk_delete', path='delete', detail=False) class ConsoleServerPortBulkDeleteView(generic.BulkDeleteView): queryset = ConsoleServerPort.objects.all() filterset = filtersets.ConsoleServerPortFilterSet @@ -2406,6 +2536,7 @@ register_model_view(ConsoleServerPort, 'trace', kwargs={'model': ConsoleServerPo # Power ports # +@register_model_view(PowerPort, 'list', path='', detail=False) class PowerPortListView(generic.ObjectListView): queryset = PowerPort.objects.all() filterset = filtersets.PowerPortFilterSet @@ -2423,6 +2554,7 @@ class PowerPortView(generic.ObjectView): queryset = PowerPort.objects.all() +@register_model_view(PowerPort, 'add', detail=False) class PowerPortCreateView(generic.ComponentCreateView): queryset = PowerPort.objects.all() form = forms.PowerPortCreateForm @@ -2440,11 +2572,13 @@ class PowerPortDeleteView(generic.ObjectDeleteView): queryset = PowerPort.objects.all() +@register_model_view(PowerPort, 'import', detail=False) class PowerPortBulkImportView(generic.BulkImportView): queryset = PowerPort.objects.all() model_form = forms.PowerPortImportForm +@register_model_view(PowerPort, 'bulk_edit', path='edit', detail=False) class PowerPortBulkEditView(generic.BulkEditView): queryset = PowerPort.objects.all() filterset = filtersets.PowerPortFilterSet @@ -2452,14 +2586,17 @@ class PowerPortBulkEditView(generic.BulkEditView): form = forms.PowerPortBulkEditForm +@register_model_view(PowerPort, 'bulk_rename', path='rename', detail=False) class PowerPortBulkRenameView(generic.BulkRenameView): queryset = PowerPort.objects.all() +@register_model_view(PowerPort, 'bulk_disconnect', path='disconnect', detail=False) class PowerPortBulkDisconnectView(BulkDisconnectView): queryset = PowerPort.objects.all() +@register_model_view(PowerPort, 'bulk_delete', path='delete', detail=False) class PowerPortBulkDeleteView(generic.BulkDeleteView): queryset = PowerPort.objects.all() filterset = filtersets.PowerPortFilterSet @@ -2474,6 +2611,7 @@ register_model_view(PowerPort, 'trace', kwargs={'model': PowerPort})(PathTraceVi # Power outlets # +@register_model_view(PowerOutlet, 'list', path='', detail=False) class PowerOutletListView(generic.ObjectListView): queryset = PowerOutlet.objects.all() filterset = filtersets.PowerOutletFilterSet @@ -2491,6 +2629,7 @@ class PowerOutletView(generic.ObjectView): queryset = PowerOutlet.objects.all() +@register_model_view(PowerOutlet, 'add', detail=False) class PowerOutletCreateView(generic.ComponentCreateView): queryset = PowerOutlet.objects.all() form = forms.PowerOutletCreateForm @@ -2508,11 +2647,13 @@ class PowerOutletDeleteView(generic.ObjectDeleteView): queryset = PowerOutlet.objects.all() +@register_model_view(PowerOutlet, 'import', detail=False) class PowerOutletBulkImportView(generic.BulkImportView): queryset = PowerOutlet.objects.all() model_form = forms.PowerOutletImportForm +@register_model_view(PowerOutlet, 'bulk_edit', path='edit', detail=False) class PowerOutletBulkEditView(generic.BulkEditView): queryset = PowerOutlet.objects.all() filterset = filtersets.PowerOutletFilterSet @@ -2520,14 +2661,17 @@ class PowerOutletBulkEditView(generic.BulkEditView): form = forms.PowerOutletBulkEditForm +@register_model_view(PowerOutlet, 'bulk_rename', path='rename', detail=False) class PowerOutletBulkRenameView(generic.BulkRenameView): queryset = PowerOutlet.objects.all() +@register_model_view(PowerOutlet, 'bulk_disconnect', path='disconnect', detail=False) class PowerOutletBulkDisconnectView(BulkDisconnectView): queryset = PowerOutlet.objects.all() +@register_model_view(PowerOutlet, 'bulk_delete', path='delete', detail=False) class PowerOutletBulkDeleteView(generic.BulkDeleteView): queryset = PowerOutlet.objects.all() filterset = filtersets.PowerOutletFilterSet @@ -2538,55 +2682,11 @@ class PowerOutletBulkDeleteView(generic.BulkDeleteView): register_model_view(PowerOutlet, 'trace', kwargs={'model': PowerOutlet})(PathTraceView) -# -# MAC addresses -# - -class MACAddressListView(generic.ObjectListView): - queryset = MACAddress.objects.all() - filterset = filtersets.MACAddressFilterSet - filterset_form = forms.MACAddressFilterForm - table = tables.MACAddressTable - - -@register_model_view(MACAddress) -class MACAddressView(generic.ObjectView): - queryset = MACAddress.objects.all() - - -@register_model_view(MACAddress, 'edit') -class MACAddressEditView(generic.ObjectEditView): - queryset = MACAddress.objects.all() - form = forms.MACAddressForm - - -@register_model_view(MACAddress, 'delete') -class MACAddressDeleteView(generic.ObjectDeleteView): - queryset = MACAddress.objects.all() - - -class MACAddressBulkImportView(generic.BulkImportView): - queryset = MACAddress.objects.all() - model_form = forms.MACAddressImportForm - - -class MACAddressBulkEditView(generic.BulkEditView): - queryset = MACAddress.objects.all() - filterset = filtersets.MACAddressFilterSet - table = tables.MACAddressTable - form = forms.MACAddressBulkEditForm - - -class MACAddressBulkDeleteView(generic.BulkDeleteView): - queryset = MACAddress.objects.all() - filterset = filtersets.MACAddressFilterSet - table = tables.MACAddressTable - - # # Interfaces # +@register_model_view(Interface, 'list', path='', detail=False) class InterfaceListView(generic.ObjectListView): queryset = Interface.objects.all() filterset = filtersets.InterfaceFilterSet @@ -2661,6 +2761,7 @@ class InterfaceView(generic.ObjectView): } +@register_model_view(Interface, 'add', detail=False) class InterfaceCreateView(generic.ComponentCreateView): queryset = Interface.objects.all() form = forms.InterfaceCreateForm @@ -2678,11 +2779,13 @@ class InterfaceDeleteView(generic.ObjectDeleteView): queryset = Interface.objects.all() +@register_model_view(Interface, 'import', detail=False) class InterfaceBulkImportView(generic.BulkImportView): queryset = Interface.objects.all() model_form = forms.InterfaceImportForm +@register_model_view(Interface, 'bulk_edit', path='edit', detail=False) class InterfaceBulkEditView(generic.BulkEditView): queryset = Interface.objects.all() filterset = filtersets.InterfaceFilterSet @@ -2690,14 +2793,17 @@ class InterfaceBulkEditView(generic.BulkEditView): form = forms.InterfaceBulkEditForm +@register_model_view(Interface, 'bulk_rename', path='rename', detail=False) class InterfaceBulkRenameView(generic.BulkRenameView): queryset = Interface.objects.all() +@register_model_view(Interface, 'bulk_disconnect', path='disconnect', detail=False) class InterfaceBulkDisconnectView(BulkDisconnectView): queryset = Interface.objects.all() +@register_model_view(Interface, 'bulk_delete', path='delete', detail=False) class InterfaceBulkDeleteView(generic.BulkDeleteView): # Ensure child interfaces are deleted prior to their parents queryset = Interface.objects.order_by('device', 'parent', CollateAsChar('_name')) @@ -2713,6 +2819,7 @@ register_model_view(Interface, 'trace', kwargs={'model': Interface})(PathTraceVi # Front ports # +@register_model_view(FrontPort, 'list', path='', detail=False) class FrontPortListView(generic.ObjectListView): queryset = FrontPort.objects.all() filterset = filtersets.FrontPortFilterSet @@ -2730,6 +2837,7 @@ class FrontPortView(generic.ObjectView): queryset = FrontPort.objects.all() +@register_model_view(FrontPort, 'add', detail=False) class FrontPortCreateView(generic.ComponentCreateView): queryset = FrontPort.objects.all() form = forms.FrontPortCreateForm @@ -2747,11 +2855,13 @@ class FrontPortDeleteView(generic.ObjectDeleteView): queryset = FrontPort.objects.all() +@register_model_view(FrontPort, 'import', detail=False) class FrontPortBulkImportView(generic.BulkImportView): queryset = FrontPort.objects.all() model_form = forms.FrontPortImportForm +@register_model_view(FrontPort, 'bulk_edit', path='edit', detail=False) class FrontPortBulkEditView(generic.BulkEditView): queryset = FrontPort.objects.all() filterset = filtersets.FrontPortFilterSet @@ -2759,14 +2869,17 @@ class FrontPortBulkEditView(generic.BulkEditView): form = forms.FrontPortBulkEditForm +@register_model_view(FrontPort, 'bulk_rename', path='rename', detail=False) class FrontPortBulkRenameView(generic.BulkRenameView): queryset = FrontPort.objects.all() +@register_model_view(FrontPort, 'bulk_disconnect', path='disconnect', detail=False) class FrontPortBulkDisconnectView(BulkDisconnectView): queryset = FrontPort.objects.all() +@register_model_view(FrontPort, 'bulk_delete', path='delete', detail=False) class FrontPortBulkDeleteView(generic.BulkDeleteView): queryset = FrontPort.objects.all() filterset = filtersets.FrontPortFilterSet @@ -2781,6 +2894,7 @@ register_model_view(FrontPort, 'trace', kwargs={'model': FrontPort})(PathTraceVi # Rear ports # +@register_model_view(RearPort, 'list', path='', detail=False) class RearPortListView(generic.ObjectListView): queryset = RearPort.objects.all() filterset = filtersets.RearPortFilterSet @@ -2798,6 +2912,7 @@ class RearPortView(generic.ObjectView): queryset = RearPort.objects.all() +@register_model_view(RearPort, 'add', detail=False) class RearPortCreateView(generic.ComponentCreateView): queryset = RearPort.objects.all() form = forms.RearPortCreateForm @@ -2815,11 +2930,13 @@ class RearPortDeleteView(generic.ObjectDeleteView): queryset = RearPort.objects.all() +@register_model_view(RearPort, 'import', detail=False) class RearPortBulkImportView(generic.BulkImportView): queryset = RearPort.objects.all() model_form = forms.RearPortImportForm +@register_model_view(RearPort, 'bulk_edit', path='edit', detail=False) class RearPortBulkEditView(generic.BulkEditView): queryset = RearPort.objects.all() filterset = filtersets.RearPortFilterSet @@ -2827,14 +2944,17 @@ class RearPortBulkEditView(generic.BulkEditView): form = forms.RearPortBulkEditForm +@register_model_view(RearPort, 'bulk_rename', path='rename', detail=False) class RearPortBulkRenameView(generic.BulkRenameView): queryset = RearPort.objects.all() +@register_model_view(RearPort, 'bulk_disconnect', path='disconnect', detail=False) class RearPortBulkDisconnectView(BulkDisconnectView): queryset = RearPort.objects.all() +@register_model_view(RearPort, 'bulk_delete', path='delete', detail=False) class RearPortBulkDeleteView(generic.BulkDeleteView): queryset = RearPort.objects.all() filterset = filtersets.RearPortFilterSet @@ -2849,6 +2969,7 @@ register_model_view(RearPort, 'trace', kwargs={'model': RearPort})(PathTraceView # Module bays # +@register_model_view(ModuleBay, 'list', path='', detail=False) class ModuleBayListView(generic.ObjectListView): queryset = ModuleBay.objects.select_related('installed_module__module_type') filterset = filtersets.ModuleBayFilterSet @@ -2866,6 +2987,7 @@ class ModuleBayView(generic.ObjectView): queryset = ModuleBay.objects.all() +@register_model_view(ModuleBay, 'add', detail=False) class ModuleBayCreateView(generic.ComponentCreateView): queryset = ModuleBay.objects.all() form = forms.ModuleBayCreateForm @@ -2883,11 +3005,13 @@ class ModuleBayDeleteView(generic.ObjectDeleteView): queryset = ModuleBay.objects.all() +@register_model_view(ModuleBay, 'import', detail=False) class ModuleBayBulkImportView(generic.BulkImportView): queryset = ModuleBay.objects.all() model_form = forms.ModuleBayImportForm +@register_model_view(ModuleBay, 'bulk_edit', path='edit', detail=False) class ModuleBayBulkEditView(generic.BulkEditView): queryset = ModuleBay.objects.all() filterset = filtersets.ModuleBayFilterSet @@ -2895,10 +3019,12 @@ class ModuleBayBulkEditView(generic.BulkEditView): form = forms.ModuleBayBulkEditForm +@register_model_view(ModuleBay, 'bulk_rename', path='rename', detail=False) class ModuleBayBulkRenameView(generic.BulkRenameView): queryset = ModuleBay.objects.all() +@register_model_view(ModuleBay, 'bulk_delete', path='delete', detail=False) class ModuleBayBulkDeleteView(generic.BulkDeleteView): queryset = ModuleBay.objects.all() filterset = filtersets.ModuleBayFilterSet @@ -2909,6 +3035,7 @@ class ModuleBayBulkDeleteView(generic.BulkDeleteView): # Device bays # +@register_model_view(DeviceBay, 'list', path='', detail=False) class DeviceBayListView(generic.ObjectListView): queryset = DeviceBay.objects.all() filterset = filtersets.DeviceBayFilterSet @@ -2926,6 +3053,7 @@ class DeviceBayView(generic.ObjectView): queryset = DeviceBay.objects.all() +@register_model_view(DeviceBay, 'add', detail=False) class DeviceBayCreateView(generic.ComponentCreateView): queryset = DeviceBay.objects.all() form = forms.DeviceBayCreateForm @@ -3024,11 +3152,13 @@ class DeviceBayDepopulateView(generic.ObjectEditView): }) +@register_model_view(DeviceBay, 'import', detail=False) class DeviceBayBulkImportView(generic.BulkImportView): queryset = DeviceBay.objects.all() model_form = forms.DeviceBayImportForm +@register_model_view(DeviceBay, 'bulk_edit', path='edit', detail=False) class DeviceBayBulkEditView(generic.BulkEditView): queryset = DeviceBay.objects.all() filterset = filtersets.DeviceBayFilterSet @@ -3036,10 +3166,12 @@ class DeviceBayBulkEditView(generic.BulkEditView): form = forms.DeviceBayBulkEditForm +@register_model_view(DeviceBay, 'bulk_rename', path='rename', detail=False) class DeviceBayBulkRenameView(generic.BulkRenameView): queryset = DeviceBay.objects.all() +@register_model_view(DeviceBay, 'bulk_delete', path='delete', detail=False) class DeviceBayBulkDeleteView(generic.BulkDeleteView): queryset = DeviceBay.objects.all() filterset = filtersets.DeviceBayFilterSet @@ -3050,6 +3182,7 @@ class DeviceBayBulkDeleteView(generic.BulkDeleteView): # Inventory items # +@register_model_view(InventoryItem, 'list', path='', detail=False) class InventoryItemListView(generic.ObjectListView): queryset = InventoryItem.objects.all() filterset = filtersets.InventoryItemFilterSet @@ -3073,6 +3206,7 @@ class InventoryItemEditView(generic.ObjectEditView): form = forms.InventoryItemForm +@register_model_view(InventoryItem, 'add', detail=False) class InventoryItemCreateView(generic.ComponentCreateView): queryset = InventoryItem.objects.all() form = forms.InventoryItemCreateForm @@ -3084,11 +3218,13 @@ class InventoryItemDeleteView(generic.ObjectDeleteView): queryset = InventoryItem.objects.all() +@register_model_view(InventoryItem, 'import', detail=False) class InventoryItemBulkImportView(generic.BulkImportView): queryset = InventoryItem.objects.all() model_form = forms.InventoryItemImportForm +@register_model_view(InventoryItem, 'bulk_edit', path='edit', detail=False) class InventoryItemBulkEditView(generic.BulkEditView): queryset = InventoryItem.objects.all() filterset = filtersets.InventoryItemFilterSet @@ -3096,10 +3232,12 @@ class InventoryItemBulkEditView(generic.BulkEditView): form = forms.InventoryItemBulkEditForm +@register_model_view(InventoryItem, 'bulk_rename', path='rename', detail=False) class InventoryItemBulkRenameView(generic.BulkRenameView): queryset = InventoryItem.objects.all() +@register_model_view(InventoryItem, 'bulk_delete', path='delete', detail=False) class InventoryItemBulkDeleteView(generic.BulkDeleteView): queryset = InventoryItem.objects.all() filterset = filtersets.InventoryItemFilterSet @@ -3129,6 +3267,7 @@ class InventoryItemChildrenView(generic.ObjectChildrenView): # Inventory item roles # +@register_model_view(InventoryItemRole, 'list', path='', detail=False) class InventoryItemRoleListView(generic.ObjectListView): queryset = InventoryItemRole.objects.annotate( inventoryitem_count=count_related(InventoryItem, 'role'), @@ -3148,6 +3287,7 @@ class InventoryItemRoleView(generic.ObjectView): } +@register_model_view(InventoryItemRole, 'add', detail=False) @register_model_view(InventoryItemRole, 'edit') class InventoryItemRoleEditView(generic.ObjectEditView): queryset = InventoryItemRole.objects.all() @@ -3159,11 +3299,13 @@ class InventoryItemRoleDeleteView(generic.ObjectDeleteView): queryset = InventoryItemRole.objects.all() +@register_model_view(InventoryItemRole, 'import', detail=False) class InventoryItemRoleBulkImportView(generic.BulkImportView): queryset = InventoryItemRole.objects.all() model_form = forms.InventoryItemRoleImportForm +@register_model_view(InventoryItemRole, 'bulk_edit', path='edit', detail=False) class InventoryItemRoleBulkEditView(generic.BulkEditView): queryset = InventoryItemRole.objects.annotate( inventoryitem_count=count_related(InventoryItem, 'role'), @@ -3173,6 +3315,7 @@ class InventoryItemRoleBulkEditView(generic.BulkEditView): form = forms.InventoryItemRoleBulkEditForm +@register_model_view(InventoryItemRole, 'bulk_delete', path='delete', detail=False) class InventoryItemRoleBulkDeleteView(generic.BulkDeleteView): queryset = InventoryItemRole.objects.annotate( inventoryitem_count=count_related(InventoryItem, 'role'), @@ -3240,17 +3383,6 @@ class DeviceBulkAddInterfaceView(generic.BulkComponentCreateView): default_return_url = 'dcim:device_list' -# class DeviceBulkAddFrontPortView(generic.BulkComponentCreateView): -# parent_model = Device -# parent_field = 'device' -# form = forms.FrontPortBulkCreateForm -# queryset = FrontPort.objects.all() -# model_form = forms.FrontPortForm -# filterset = filtersets.DeviceFilterSet -# table = tables.DeviceTable -# default_return_url = 'dcim:device_list' - - class DeviceBulkAddRearPortView(generic.BulkComponentCreateView): parent_model = Device parent_field = 'device' @@ -3299,6 +3431,7 @@ class DeviceBulkAddInventoryItemView(generic.BulkComponentCreateView): # Cables # +@register_model_view(Cable, 'list', path='', detail=False) class CableListView(generic.ObjectListView): queryset = Cable.objects.prefetch_related( 'terminations__termination', 'terminations___device', 'terminations___rack', 'terminations___location', @@ -3314,6 +3447,7 @@ class CableView(generic.ObjectView): queryset = Cable.objects.all() +@register_model_view(Cable, 'add', detail=False) @register_model_view(Cable, 'edit') class CableEditView(generic.ObjectEditView): queryset = Cable.objects.all() @@ -3361,11 +3495,13 @@ class CableDeleteView(generic.ObjectDeleteView): queryset = Cable.objects.all() +@register_model_view(Cable, 'import', detail=False) class CableBulkImportView(generic.BulkImportView): queryset = Cable.objects.all() model_form = forms.CableImportForm +@register_model_view(Cable, 'bulk_edit', path='edit', detail=False) class CableBulkEditView(generic.BulkEditView): queryset = Cable.objects.prefetch_related( 'terminations__termination', 'terminations___device', 'terminations___rack', 'terminations___location', @@ -3376,6 +3512,7 @@ class CableBulkEditView(generic.BulkEditView): form = forms.CableBulkEditForm +@register_model_view(Cable, 'bulk_delete', path='delete', detail=False) class CableBulkDeleteView(generic.BulkDeleteView): queryset = Cable.objects.prefetch_related( 'terminations__termination', 'terminations___device', 'terminations___rack', 'terminations___location', @@ -3441,6 +3578,7 @@ class InterfaceConnectionsListView(generic.ObjectListView): # Virtual chassis # +@register_model_view(VirtualChassis, 'list', path='', detail=False) class VirtualChassisListView(generic.ObjectListView): queryset = VirtualChassis.objects.all() table = tables.VirtualChassisTable @@ -3460,6 +3598,7 @@ class VirtualChassisView(generic.ObjectView): } +@register_model_view(VirtualChassis, 'add', detail=False) class VirtualChassisCreateView(generic.ObjectEditView): queryset = VirtualChassis.objects.all() form = forms.VirtualChassisCreateForm @@ -3655,11 +3794,13 @@ class VirtualChassisRemoveMemberView(ObjectPermissionRequiredMixin, GetReturnURL }) +@register_model_view(VirtualChassis, 'import', detail=False) class VirtualChassisBulkImportView(generic.BulkImportView): queryset = VirtualChassis.objects.all() model_form = forms.VirtualChassisImportForm +@register_model_view(VirtualChassis, 'bulk_edit', path='edit', detail=False) class VirtualChassisBulkEditView(generic.BulkEditView): queryset = VirtualChassis.objects.all() filterset = filtersets.VirtualChassisFilterSet @@ -3667,6 +3808,7 @@ class VirtualChassisBulkEditView(generic.BulkEditView): form = forms.VirtualChassisBulkEditForm +@register_model_view(VirtualChassis, 'bulk_delete', path='delete', detail=False) class VirtualChassisBulkDeleteView(generic.BulkDeleteView): queryset = VirtualChassis.objects.all() filterset = filtersets.VirtualChassisFilterSet @@ -3677,6 +3819,7 @@ class VirtualChassisBulkDeleteView(generic.BulkDeleteView): # Power panels # +@register_model_view(PowerPanel, 'list', path='', detail=False) class PowerPanelListView(generic.ObjectListView): queryset = PowerPanel.objects.annotate( powerfeed_count=count_related(PowerFeed, 'power_panel') @@ -3696,6 +3839,7 @@ class PowerPanelView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(PowerPanel, 'add', detail=False) @register_model_view(PowerPanel, 'edit') class PowerPanelEditView(generic.ObjectEditView): queryset = PowerPanel.objects.all() @@ -3707,11 +3851,13 @@ class PowerPanelDeleteView(generic.ObjectDeleteView): queryset = PowerPanel.objects.all() +@register_model_view(PowerPanel, 'import', detail=False) class PowerPanelBulkImportView(generic.BulkImportView): queryset = PowerPanel.objects.all() model_form = forms.PowerPanelImportForm +@register_model_view(PowerPanel, 'bulk_edit', path='edit', detail=False) class PowerPanelBulkEditView(generic.BulkEditView): queryset = PowerPanel.objects.all() filterset = filtersets.PowerPanelFilterSet @@ -3719,6 +3865,7 @@ class PowerPanelBulkEditView(generic.BulkEditView): form = forms.PowerPanelBulkEditForm +@register_model_view(PowerPanel, 'bulk_delete', path='delete', detail=False) class PowerPanelBulkDeleteView(generic.BulkDeleteView): queryset = PowerPanel.objects.annotate( powerfeed_count=count_related(PowerFeed, 'power_panel') @@ -3736,6 +3883,7 @@ class PowerPanelContactsView(ObjectContactsView): # Power feeds # +@register_model_view(PowerFeed, 'list', path='', detail=False) class PowerFeedListView(generic.ObjectListView): queryset = PowerFeed.objects.all() filterset = filtersets.PowerFeedFilterSet @@ -3748,6 +3896,7 @@ class PowerFeedView(generic.ObjectView): queryset = PowerFeed.objects.all() +@register_model_view(PowerFeed, 'add', detail=False) @register_model_view(PowerFeed, 'edit') class PowerFeedEditView(generic.ObjectEditView): queryset = PowerFeed.objects.all() @@ -3759,11 +3908,13 @@ class PowerFeedDeleteView(generic.ObjectDeleteView): queryset = PowerFeed.objects.all() +@register_model_view(PowerFeed, 'import', detail=False) class PowerFeedBulkImportView(generic.BulkImportView): queryset = PowerFeed.objects.all() model_form = forms.PowerFeedImportForm +@register_model_view(PowerFeed, 'bulk_edit', path='edit', detail=False) class PowerFeedBulkEditView(generic.BulkEditView): queryset = PowerFeed.objects.all() filterset = filtersets.PowerFeedFilterSet @@ -3771,10 +3922,12 @@ class PowerFeedBulkEditView(generic.BulkEditView): form = forms.PowerFeedBulkEditForm +@register_model_view(PowerFeed, 'bulk_disconnect', path='disconnect', detail=False) class PowerFeedBulkDisconnectView(BulkDisconnectView): queryset = PowerFeed.objects.all() +@register_model_view(PowerFeed, 'bulk_delete', path='delete', detail=False) class PowerFeedBulkDeleteView(generic.BulkDeleteView): queryset = PowerFeed.objects.all() filterset = filtersets.PowerFeedFilterSet @@ -3785,7 +3938,11 @@ class PowerFeedBulkDeleteView(generic.BulkDeleteView): register_model_view(PowerFeed, 'trace', kwargs={'model': PowerFeed})(PathTraceView) -# VDC +# +# Virtual device contexts +# + +@register_model_view(VirtualDeviceContext, 'list', path='', detail=False) class VirtualDeviceContextListView(generic.ObjectListView): queryset = VirtualDeviceContext.objects.annotate( interface_count=count_related(Interface, 'vdcs'), @@ -3811,6 +3968,7 @@ class VirtualDeviceContextView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(VirtualDeviceContext, 'add', detail=False) @register_model_view(VirtualDeviceContext, 'edit') class VirtualDeviceContextEditView(generic.ObjectEditView): queryset = VirtualDeviceContext.objects.all() @@ -3822,11 +3980,13 @@ class VirtualDeviceContextDeleteView(generic.ObjectDeleteView): queryset = VirtualDeviceContext.objects.all() +@register_model_view(VirtualDeviceContext, 'import', detail=False) class VirtualDeviceContextBulkImportView(generic.BulkImportView): queryset = VirtualDeviceContext.objects.all() model_form = forms.VirtualDeviceContextImportForm +@register_model_view(VirtualDeviceContext, 'bulk_edit', path='edit', detail=False) class VirtualDeviceContextBulkEditView(generic.BulkEditView): queryset = VirtualDeviceContext.objects.all() filterset = filtersets.VirtualDeviceContextFilterSet @@ -3834,7 +3994,58 @@ class VirtualDeviceContextBulkEditView(generic.BulkEditView): form = forms.VirtualDeviceContextBulkEditForm +@register_model_view(VirtualDeviceContext, 'bulk_delete', path='delete', detail=False) class VirtualDeviceContextBulkDeleteView(generic.BulkDeleteView): queryset = VirtualDeviceContext.objects.all() filterset = filtersets.VirtualDeviceContextFilterSet table = tables.VirtualDeviceContextTable + + +# +# MAC addresses +# + +@register_model_view(MACAddress, 'list', path='', detail=False) +class MACAddressListView(generic.ObjectListView): + queryset = MACAddress.objects.all() + filterset = filtersets.MACAddressFilterSet + filterset_form = forms.MACAddressFilterForm + table = tables.MACAddressTable + + +@register_model_view(MACAddress) +class MACAddressView(generic.ObjectView): + queryset = MACAddress.objects.all() + + +@register_model_view(MACAddress, 'add', detail=False) +@register_model_view(MACAddress, 'edit') +class MACAddressEditView(generic.ObjectEditView): + queryset = MACAddress.objects.all() + form = forms.MACAddressForm + + +@register_model_view(MACAddress, 'delete') +class MACAddressDeleteView(generic.ObjectDeleteView): + queryset = MACAddress.objects.all() + + +@register_model_view(MACAddress, 'import', detail=False) +class MACAddressBulkImportView(generic.BulkImportView): + queryset = MACAddress.objects.all() + model_form = forms.MACAddressImportForm + + +@register_model_view(MACAddress, 'bulk_edit', path='edit', detail=False) +class MACAddressBulkEditView(generic.BulkEditView): + queryset = MACAddress.objects.all() + filterset = filtersets.MACAddressFilterSet + table = tables.MACAddressTable + form = forms.MACAddressBulkEditForm + + +@register_model_view(MACAddress, 'bulk_delete', path='delete', detail=False) +class MACAddressBulkDeleteView(generic.BulkDeleteView): + queryset = MACAddress.objects.all() + filterset = filtersets.MACAddressFilterSet + table = tables.MACAddressTable diff --git a/netbox/extras/urls.py b/netbox/extras/urls.py index b13af1db9..32633493f 100644 --- a/netbox/extras/urls.py +++ b/netbox/extras/urls.py @@ -7,128 +7,68 @@ from utilities.urls import get_model_urls app_name = 'extras' urlpatterns = [ - # Custom fields - path('custom-fields/', views.CustomFieldListView.as_view(), name='customfield_list'), - path('custom-fields/add/', views.CustomFieldEditView.as_view(), name='customfield_add'), - path('custom-fields/import/', views.CustomFieldBulkImportView.as_view(), name='customfield_import'), - path('custom-fields/edit/', views.CustomFieldBulkEditView.as_view(), name='customfield_bulk_edit'), - path('custom-fields/delete/', views.CustomFieldBulkDeleteView.as_view(), name='customfield_bulk_delete'), + path('custom-fields/', include(get_model_urls('extras', 'customfield', detail=False))), path('custom-fields//', include(get_model_urls('extras', 'customfield'))), - # Custom field choices - path('custom-field-choices/', views.CustomFieldChoiceSetListView.as_view(), name='customfieldchoiceset_list'), - path('custom-field-choices/add/', views.CustomFieldChoiceSetEditView.as_view(), name='customfieldchoiceset_add'), - path('custom-field-choices/import/', views.CustomFieldChoiceSetBulkImportView.as_view(), name='customfieldchoiceset_import'), - path('custom-field-choices/edit/', views.CustomFieldChoiceSetBulkEditView.as_view(), name='customfieldchoiceset_bulk_edit'), - path('custom-field-choices/delete/', views.CustomFieldChoiceSetBulkDeleteView.as_view(), name='customfieldchoiceset_bulk_delete'), + path('custom-field-choices/', include(get_model_urls('extras', 'customfieldchoiceset', detail=False))), path('custom-field-choices//', include(get_model_urls('extras', 'customfieldchoiceset'))), - # Custom links - path('custom-links/', views.CustomLinkListView.as_view(), name='customlink_list'), - path('custom-links/add/', views.CustomLinkEditView.as_view(), name='customlink_add'), - path('custom-links/import/', views.CustomLinkBulkImportView.as_view(), name='customlink_import'), - path('custom-links/edit/', views.CustomLinkBulkEditView.as_view(), name='customlink_bulk_edit'), - path('custom-links/delete/', views.CustomLinkBulkDeleteView.as_view(), name='customlink_bulk_delete'), + path('custom-links/', include(get_model_urls('extras', 'customlink', detail=False))), path('custom-links//', include(get_model_urls('extras', 'customlink'))), - # Export templates - path('export-templates/', views.ExportTemplateListView.as_view(), name='exporttemplate_list'), - path('export-templates/add/', views.ExportTemplateEditView.as_view(), name='exporttemplate_add'), - path('export-templates/import/', views.ExportTemplateBulkImportView.as_view(), name='exporttemplate_import'), - path('export-templates/edit/', views.ExportTemplateBulkEditView.as_view(), name='exporttemplate_bulk_edit'), - path('export-templates/delete/', views.ExportTemplateBulkDeleteView.as_view(), name='exporttemplate_bulk_delete'), - path('export-templates/sync/', views.ExportTemplateBulkSyncDataView.as_view(), name='exporttemplate_bulk_sync'), + path('export-templates/', include(get_model_urls('extras', 'exporttemplate', detail=False))), path('export-templates//', include(get_model_urls('extras', 'exporttemplate'))), - # Saved filters - path('saved-filters/', views.SavedFilterListView.as_view(), name='savedfilter_list'), - path('saved-filters/add/', views.SavedFilterEditView.as_view(), name='savedfilter_add'), - path('saved-filters/import/', views.SavedFilterBulkImportView.as_view(), name='savedfilter_import'), - path('saved-filters/edit/', views.SavedFilterBulkEditView.as_view(), name='savedfilter_bulk_edit'), - path('saved-filters/delete/', views.SavedFilterBulkDeleteView.as_view(), name='savedfilter_bulk_delete'), + path('saved-filters/', include(get_model_urls('extras', 'savedfilter', detail=False))), path('saved-filters//', include(get_model_urls('extras', 'savedfilter'))), - # Bookmarks - path('bookmarks/add/', views.BookmarkCreateView.as_view(), name='bookmark_add'), - path('bookmarks/delete/', views.BookmarkBulkDeleteView.as_view(), name='bookmark_bulk_delete'), + path('bookmarks/', include(get_model_urls('extras', 'bookmark', detail=False))), path('bookmarks//', include(get_model_urls('extras', 'bookmark'))), - # Notification groups - path('notification-groups/', views.NotificationGroupListView.as_view(), name='notificationgroup_list'), - path('notification-groups/add/', views.NotificationGroupEditView.as_view(), name='notificationgroup_add'), - path('notification-groups/import/', views.NotificationGroupBulkImportView.as_view(), name='notificationgroup_import'), - path('notification-groups/edit/', views.NotificationGroupBulkEditView.as_view(), name='notificationgroup_bulk_edit'), - path('notification-groups/delete/', views.NotificationGroupBulkDeleteView.as_view(), name='notificationgroup_bulk_delete'), + path('notification-groups/', include(get_model_urls('extras', 'notificationgroup', detail=False))), path('notification-groups//', include(get_model_urls('extras', 'notificationgroup'))), - # Notifications path('notifications/', views.NotificationsView.as_view(), name='notifications'), - path('notifications/delete/', views.NotificationBulkDeleteView.as_view(), name='notification_bulk_delete'), + path('notifications/', include(get_model_urls('extras', 'notification', detail=False))), path('notifications//', include(get_model_urls('extras', 'notification'))), - # Subscriptions - path('subscriptions/add/', views.SubscriptionCreateView.as_view(), name='subscription_add'), - path('subscriptions/delete/', views.SubscriptionBulkDeleteView.as_view(), name='subscription_bulk_delete'), + path('subscriptions/', include(get_model_urls('extras', 'subscription', detail=False))), path('subscriptions//', include(get_model_urls('extras', 'subscription'))), - # Webhooks - path('webhooks/', views.WebhookListView.as_view(), name='webhook_list'), - path('webhooks/add/', views.WebhookEditView.as_view(), name='webhook_add'), - path('webhooks/import/', views.WebhookBulkImportView.as_view(), name='webhook_import'), - path('webhooks/edit/', views.WebhookBulkEditView.as_view(), name='webhook_bulk_edit'), - path('webhooks/delete/', views.WebhookBulkDeleteView.as_view(), name='webhook_bulk_delete'), + path('webhooks/', include(get_model_urls('extras', 'webhook', detail=False))), path('webhooks//', include(get_model_urls('extras', 'webhook'))), - # Event rules - path('event-rules/', views.EventRuleListView.as_view(), name='eventrule_list'), - path('event-rules/add/', views.EventRuleEditView.as_view(), name='eventrule_add'), - path('event-rules/import/', views.EventRuleBulkImportView.as_view(), name='eventrule_import'), - path('event-rules/edit/', views.EventRuleBulkEditView.as_view(), name='eventrule_bulk_edit'), - path('event-rules/delete/', views.EventRuleBulkDeleteView.as_view(), name='eventrule_bulk_delete'), + path('event-rules/', include(get_model_urls('extras', 'eventrule', detail=False))), path('event-rules//', include(get_model_urls('extras', 'eventrule'))), - # Tags - path('tags/', views.TagListView.as_view(), name='tag_list'), - path('tags/add/', views.TagEditView.as_view(), name='tag_add'), - path('tags/import/', views.TagBulkImportView.as_view(), name='tag_import'), - path('tags/edit/', views.TagBulkEditView.as_view(), name='tag_bulk_edit'), - path('tags/delete/', views.TagBulkDeleteView.as_view(), name='tag_bulk_delete'), + path('tags/', include(get_model_urls('extras', 'tag', detail=False))), path('tags//', include(get_model_urls('extras', 'tag'))), - # Config contexts - path('config-contexts/', views.ConfigContextListView.as_view(), name='configcontext_list'), - path('config-contexts/add/', views.ConfigContextEditView.as_view(), name='configcontext_add'), - path('config-contexts/edit/', views.ConfigContextBulkEditView.as_view(), name='configcontext_bulk_edit'), - path('config-contexts/delete/', views.ConfigContextBulkDeleteView.as_view(), name='configcontext_bulk_delete'), - path('config-contexts/sync/', views.ConfigContextBulkSyncDataView.as_view(), name='configcontext_bulk_sync'), + path('config-contexts/', include(get_model_urls('extras', 'configcontext', detail=False))), path('config-contexts//', include(get_model_urls('extras', 'configcontext'))), - # Config templates - path('config-templates/', views.ConfigTemplateListView.as_view(), name='configtemplate_list'), - path('config-templates/add/', views.ConfigTemplateEditView.as_view(), name='configtemplate_add'), - path('config-templates/edit/', views.ConfigTemplateBulkEditView.as_view(), name='configtemplate_bulk_edit'), - path('config-templates/delete/', views.ConfigTemplateBulkDeleteView.as_view(), name='configtemplate_bulk_delete'), - path('config-templates/sync/', views.ConfigTemplateBulkSyncDataView.as_view(), name='configtemplate_bulk_sync'), + path('config-templates/', include(get_model_urls('extras', 'configtemplate', detail=False))), path('config-templates//', include(get_model_urls('extras', 'configtemplate'))), - # Image attachments - path('image-attachments/', views.ImageAttachmentListView.as_view(), name='imageattachment_list'), - path('image-attachments/add/', views.ImageAttachmentEditView.as_view(), name='imageattachment_add'), + path('image-attachments/', include(get_model_urls('extras', 'imageattachment', detail=False))), path('image-attachments//', include(get_model_urls('extras', 'imageattachment'))), - # Journal entries - path('journal-entries/', views.JournalEntryListView.as_view(), name='journalentry_list'), - path('journal-entries/add/', views.JournalEntryEditView.as_view(), name='journalentry_add'), - path('journal-entries/edit/', views.JournalEntryBulkEditView.as_view(), name='journalentry_bulk_edit'), - path('journal-entries/delete/', views.JournalEntryBulkDeleteView.as_view(), name='journalentry_bulk_delete'), - path('journal-entries/import/', views.JournalEntryBulkImportView.as_view(), name='journalentry_import'), + path('journal-entries/', include(get_model_urls('extras', 'journalentry', detail=False))), path('journal-entries//', include(get_model_urls('extras', 'journalentry'))), # User dashboard path('dashboard/reset/', views.DashboardResetView.as_view(), name='dashboard_reset'), path('dashboard/widgets/add/', views.DashboardWidgetAddView.as_view(), name='dashboardwidget_add'), - path('dashboard/widgets//configure/', views.DashboardWidgetConfigView.as_view(), name='dashboardwidget_config'), - path('dashboard/widgets//delete/', views.DashboardWidgetDeleteView.as_view(), name='dashboardwidget_delete'), + path( + 'dashboard/widgets//configure/', + views.DashboardWidgetConfigView.as_view(), + name='dashboardwidget_config' + ), + path( + 'dashboard/widgets//delete/', + views.DashboardWidgetDeleteView.as_view(), + name='dashboardwidget_delete' + ), # Scripts path('scripts/', views.ScriptListView.as_view(), name='script_list'), diff --git a/netbox/extras/views.py b/netbox/extras/views.py index 0d98b1324..286f3bab9 100644 --- a/netbox/extras/views.py +++ b/netbox/extras/views.py @@ -42,6 +42,7 @@ from .tables import ReportResultsTable, ScriptResultsTable # Custom fields # +@register_model_view(CustomField, 'list', path='', detail=False) class CustomFieldListView(generic.ObjectListView): queryset = CustomField.objects.select_related('choice_set') filterset = filtersets.CustomFieldFilterSet @@ -69,6 +70,7 @@ class CustomFieldView(generic.ObjectView): } +@register_model_view(CustomField, 'add', detail=False) @register_model_view(CustomField, 'edit') class CustomFieldEditView(generic.ObjectEditView): queryset = CustomField.objects.select_related('choice_set') @@ -80,11 +82,13 @@ class CustomFieldDeleteView(generic.ObjectDeleteView): queryset = CustomField.objects.select_related('choice_set') +@register_model_view(CustomField, 'import', detail=False) class CustomFieldBulkImportView(generic.BulkImportView): queryset = CustomField.objects.select_related('choice_set') model_form = forms.CustomFieldImportForm +@register_model_view(CustomField, 'bulk_edit', path='edit', detail=False) class CustomFieldBulkEditView(generic.BulkEditView): queryset = CustomField.objects.select_related('choice_set') filterset = filtersets.CustomFieldFilterSet @@ -92,6 +96,7 @@ class CustomFieldBulkEditView(generic.BulkEditView): form = forms.CustomFieldBulkEditForm +@register_model_view(CustomField, 'bulk_delete', path='delete', detail=False) class CustomFieldBulkDeleteView(generic.BulkDeleteView): queryset = CustomField.objects.select_related('choice_set') filterset = filtersets.CustomFieldFilterSet @@ -102,6 +107,7 @@ class CustomFieldBulkDeleteView(generic.BulkDeleteView): # Custom field choices # +@register_model_view(CustomFieldChoiceSet, 'list', path='', detail=False) class CustomFieldChoiceSetListView(generic.ObjectListView): queryset = CustomFieldChoiceSet.objects.all() filterset = filtersets.CustomFieldChoiceSetFilterSet @@ -133,6 +139,7 @@ class CustomFieldChoiceSetView(generic.ObjectView): } +@register_model_view(CustomFieldChoiceSet, 'add', detail=False) @register_model_view(CustomFieldChoiceSet, 'edit') class CustomFieldChoiceSetEditView(generic.ObjectEditView): queryset = CustomFieldChoiceSet.objects.all() @@ -144,11 +151,13 @@ class CustomFieldChoiceSetDeleteView(generic.ObjectDeleteView): queryset = CustomFieldChoiceSet.objects.all() +@register_model_view(CustomFieldChoiceSet, 'import', detail=False) class CustomFieldChoiceSetBulkImportView(generic.BulkImportView): queryset = CustomFieldChoiceSet.objects.all() model_form = forms.CustomFieldChoiceSetImportForm +@register_model_view(CustomFieldChoiceSet, 'bulk_edit', path='edit', detail=False) class CustomFieldChoiceSetBulkEditView(generic.BulkEditView): queryset = CustomFieldChoiceSet.objects.all() filterset = filtersets.CustomFieldChoiceSetFilterSet @@ -156,6 +165,7 @@ class CustomFieldChoiceSetBulkEditView(generic.BulkEditView): form = forms.CustomFieldChoiceSetBulkEditForm +@register_model_view(CustomFieldChoiceSet, 'bulk_delete', path='delete', detail=False) class CustomFieldChoiceSetBulkDeleteView(generic.BulkDeleteView): queryset = CustomFieldChoiceSet.objects.all() filterset = filtersets.CustomFieldChoiceSetFilterSet @@ -166,6 +176,7 @@ class CustomFieldChoiceSetBulkDeleteView(generic.BulkDeleteView): # Custom links # +@register_model_view(CustomLink, 'list', path='', detail=False) class CustomLinkListView(generic.ObjectListView): queryset = CustomLink.objects.all() filterset = filtersets.CustomLinkFilterSet @@ -178,6 +189,7 @@ class CustomLinkView(generic.ObjectView): queryset = CustomLink.objects.all() +@register_model_view(CustomLink, 'add', detail=False) @register_model_view(CustomLink, 'edit') class CustomLinkEditView(generic.ObjectEditView): queryset = CustomLink.objects.all() @@ -189,11 +201,13 @@ class CustomLinkDeleteView(generic.ObjectDeleteView): queryset = CustomLink.objects.all() +@register_model_view(CustomLink, 'import', detail=False) class CustomLinkBulkImportView(generic.BulkImportView): queryset = CustomLink.objects.all() model_form = forms.CustomLinkImportForm +@register_model_view(CustomLink, 'bulk_edit', path='edit', detail=False) class CustomLinkBulkEditView(generic.BulkEditView): queryset = CustomLink.objects.all() filterset = filtersets.CustomLinkFilterSet @@ -201,6 +215,7 @@ class CustomLinkBulkEditView(generic.BulkEditView): form = forms.CustomLinkBulkEditForm +@register_model_view(CustomLink, 'bulk_delete', path='delete', detail=False) class CustomLinkBulkDeleteView(generic.BulkDeleteView): queryset = CustomLink.objects.all() filterset = filtersets.CustomLinkFilterSet @@ -211,6 +226,7 @@ class CustomLinkBulkDeleteView(generic.BulkDeleteView): # Export templates # +@register_model_view(ExportTemplate, 'list', path='', detail=False) class ExportTemplateListView(generic.ObjectListView): queryset = ExportTemplate.objects.all() filterset = filtersets.ExportTemplateFilterSet @@ -228,6 +244,7 @@ class ExportTemplateView(generic.ObjectView): queryset = ExportTemplate.objects.all() +@register_model_view(ExportTemplate, 'add', detail=False) @register_model_view(ExportTemplate, 'edit') class ExportTemplateEditView(generic.ObjectEditView): queryset = ExportTemplate.objects.all() @@ -239,11 +256,13 @@ class ExportTemplateDeleteView(generic.ObjectDeleteView): queryset = ExportTemplate.objects.all() +@register_model_view(ExportTemplate, 'import', detail=False) class ExportTemplateBulkImportView(generic.BulkImportView): queryset = ExportTemplate.objects.all() model_form = forms.ExportTemplateImportForm +@register_model_view(ExportTemplate, 'bulk_edit', path='edit', detail=False) class ExportTemplateBulkEditView(generic.BulkEditView): queryset = ExportTemplate.objects.all() filterset = filtersets.ExportTemplateFilterSet @@ -251,12 +270,14 @@ class ExportTemplateBulkEditView(generic.BulkEditView): form = forms.ExportTemplateBulkEditForm +@register_model_view(ExportTemplate, 'bulk_delete', path='delete', detail=False) class ExportTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ExportTemplate.objects.all() filterset = filtersets.ExportTemplateFilterSet table = tables.ExportTemplateTable +@register_model_view(ExportTemplate, 'bulk_sync', path='sync', detail=False) class ExportTemplateBulkSyncDataView(generic.BulkSyncDataView): queryset = ExportTemplate.objects.all() @@ -283,6 +304,7 @@ class SavedFilterMixin: ) +@register_model_view(SavedFilter, 'list', path='', detail=False) class SavedFilterListView(SavedFilterMixin, generic.ObjectListView): filterset = filtersets.SavedFilterFilterSet filterset_form = forms.SavedFilterFilterForm @@ -294,6 +316,7 @@ class SavedFilterView(SavedFilterMixin, generic.ObjectView): queryset = SavedFilter.objects.all() +@register_model_view(SavedFilter, 'add', detail=False) @register_model_view(SavedFilter, 'edit') class SavedFilterEditView(SavedFilterMixin, generic.ObjectEditView): queryset = SavedFilter.objects.all() @@ -310,11 +333,13 @@ class SavedFilterDeleteView(SavedFilterMixin, generic.ObjectDeleteView): queryset = SavedFilter.objects.all() +@register_model_view(SavedFilter, 'import', detail=False) class SavedFilterBulkImportView(SavedFilterMixin, generic.BulkImportView): queryset = SavedFilter.objects.all() model_form = forms.SavedFilterImportForm +@register_model_view(SavedFilter, 'bulk_edit', path='edit', detail=False) class SavedFilterBulkEditView(SavedFilterMixin, generic.BulkEditView): queryset = SavedFilter.objects.all() filterset = filtersets.SavedFilterFilterSet @@ -322,6 +347,7 @@ class SavedFilterBulkEditView(SavedFilterMixin, generic.BulkEditView): form = forms.SavedFilterBulkEditForm +@register_model_view(SavedFilter, 'bulk_delete', path='delete', detail=False) class SavedFilterBulkDeleteView(SavedFilterMixin, generic.BulkDeleteView): queryset = SavedFilter.objects.all() filterset = filtersets.SavedFilterFilterSet @@ -332,6 +358,7 @@ class SavedFilterBulkDeleteView(SavedFilterMixin, generic.BulkDeleteView): # Bookmarks # +@register_model_view(Bookmark, 'add', detail=False) class BookmarkCreateView(generic.ObjectEditView): form = forms.BookmarkForm @@ -350,6 +377,7 @@ class BookmarkDeleteView(generic.ObjectDeleteView): return Bookmark.objects.filter(user=request.user) +@register_model_view(Bookmark, 'bulk_delete', path='delete', detail=False) class BookmarkBulkDeleteView(generic.BulkDeleteView): table = tables.BookmarkTable @@ -361,6 +389,7 @@ class BookmarkBulkDeleteView(generic.BulkDeleteView): # Notification groups # +@register_model_view(NotificationGroup, 'list', path='', detail=False) class NotificationGroupListView(generic.ObjectListView): queryset = NotificationGroup.objects.all() filterset = filtersets.NotificationGroupFilterSet @@ -373,6 +402,7 @@ class NotificationGroupView(generic.ObjectView): queryset = NotificationGroup.objects.all() +@register_model_view(NotificationGroup, 'add', detail=False) @register_model_view(NotificationGroup, 'edit') class NotificationGroupEditView(generic.ObjectEditView): queryset = NotificationGroup.objects.all() @@ -384,11 +414,13 @@ class NotificationGroupDeleteView(generic.ObjectDeleteView): queryset = NotificationGroup.objects.all() +@register_model_view(NotificationGroup, 'import', detail=False) class NotificationGroupBulkImportView(generic.BulkImportView): queryset = NotificationGroup.objects.all() model_form = forms.NotificationGroupImportForm +@register_model_view(NotificationGroup, 'bulk_edit', path='edit', detail=False) class NotificationGroupBulkEditView(generic.BulkEditView): queryset = NotificationGroup.objects.all() filterset = filtersets.NotificationGroupFilterSet @@ -396,6 +428,7 @@ class NotificationGroupBulkEditView(generic.BulkEditView): form = forms.NotificationGroupBulkEditForm +@register_model_view(NotificationGroup, 'bulk_delete', path='delete', detail=False) class NotificationGroupBulkDeleteView(generic.BulkDeleteView): queryset = NotificationGroup.objects.all() filterset = filtersets.NotificationGroupFilterSet @@ -459,6 +492,7 @@ class NotificationDeleteView(generic.ObjectDeleteView): return Notification.objects.filter(user=request.user) +@register_model_view(Notification, 'bulk_delete', path='delete', detail=False) class NotificationBulkDeleteView(generic.BulkDeleteView): table = tables.NotificationTable @@ -470,6 +504,7 @@ class NotificationBulkDeleteView(generic.BulkDeleteView): # Subscriptions # +@register_model_view(Subscription, 'add', detail=False) class SubscriptionCreateView(generic.ObjectEditView): form = forms.SubscriptionForm @@ -488,6 +523,7 @@ class SubscriptionDeleteView(generic.ObjectDeleteView): return Subscription.objects.filter(user=request.user) +@register_model_view(Subscription, 'bulk_delete', path='delete', detail=False) class SubscriptionBulkDeleteView(generic.BulkDeleteView): table = tables.SubscriptionTable @@ -499,6 +535,7 @@ class SubscriptionBulkDeleteView(generic.BulkDeleteView): # Webhooks # +@register_model_view(Webhook, 'list', path='', detail=False) class WebhookListView(generic.ObjectListView): queryset = Webhook.objects.all() filterset = filtersets.WebhookFilterSet @@ -511,6 +548,7 @@ class WebhookView(generic.ObjectView): queryset = Webhook.objects.all() +@register_model_view(Webhook, 'add', detail=False) @register_model_view(Webhook, 'edit') class WebhookEditView(generic.ObjectEditView): queryset = Webhook.objects.all() @@ -522,11 +560,13 @@ class WebhookDeleteView(generic.ObjectDeleteView): queryset = Webhook.objects.all() +@register_model_view(Webhook, 'import', detail=False) class WebhookBulkImportView(generic.BulkImportView): queryset = Webhook.objects.all() model_form = forms.WebhookImportForm +@register_model_view(Webhook, 'bulk_edit', path='edit', detail=False) class WebhookBulkEditView(generic.BulkEditView): queryset = Webhook.objects.all() filterset = filtersets.WebhookFilterSet @@ -534,6 +574,7 @@ class WebhookBulkEditView(generic.BulkEditView): form = forms.WebhookBulkEditForm +@register_model_view(Webhook, 'bulk_delete', path='delete', detail=False) class WebhookBulkDeleteView(generic.BulkDeleteView): queryset = Webhook.objects.all() filterset = filtersets.WebhookFilterSet @@ -544,6 +585,7 @@ class WebhookBulkDeleteView(generic.BulkDeleteView): # Event Rules # +@register_model_view(EventRule, 'list', path='', detail=False) class EventRuleListView(generic.ObjectListView): queryset = EventRule.objects.all() filterset = filtersets.EventRuleFilterSet @@ -556,6 +598,7 @@ class EventRuleView(generic.ObjectView): queryset = EventRule.objects.all() +@register_model_view(EventRule, 'add', detail=False) @register_model_view(EventRule, 'edit') class EventRuleEditView(generic.ObjectEditView): queryset = EventRule.objects.all() @@ -567,11 +610,13 @@ class EventRuleDeleteView(generic.ObjectDeleteView): queryset = EventRule.objects.all() +@register_model_view(EventRule, 'import', detail=False) class EventRuleBulkImportView(generic.BulkImportView): queryset = EventRule.objects.all() model_form = forms.EventRuleImportForm +@register_model_view(EventRule, 'bulk_edit', path='edit', detail=False) class EventRuleBulkEditView(generic.BulkEditView): queryset = EventRule.objects.all() filterset = filtersets.EventRuleFilterSet @@ -579,6 +624,7 @@ class EventRuleBulkEditView(generic.BulkEditView): form = forms.EventRuleBulkEditForm +@register_model_view(EventRule, 'bulk_delete', path='delete', detail=False) class EventRuleBulkDeleteView(generic.BulkDeleteView): queryset = EventRule.objects.all() filterset = filtersets.EventRuleFilterSet @@ -589,6 +635,7 @@ class EventRuleBulkDeleteView(generic.BulkDeleteView): # Tags # +@register_model_view(Tag, 'list', path='', detail=False) class TagListView(generic.ObjectListView): queryset = Tag.objects.annotate( items=count_related(TaggedItem, 'tag') @@ -624,6 +671,7 @@ class TagView(generic.ObjectView): } +@register_model_view(Tag, 'add', detail=False) @register_model_view(Tag, 'edit') class TagEditView(generic.ObjectEditView): queryset = Tag.objects.all() @@ -635,11 +683,13 @@ class TagDeleteView(generic.ObjectDeleteView): queryset = Tag.objects.all() +@register_model_view(Tag, 'import', detail=False) class TagBulkImportView(generic.BulkImportView): queryset = Tag.objects.all() model_form = forms.TagImportForm +@register_model_view(Tag, 'bulk_edit', path='edit', detail=False) class TagBulkEditView(generic.BulkEditView): queryset = Tag.objects.annotate( items=count_related(TaggedItem, 'tag') @@ -648,6 +698,7 @@ class TagBulkEditView(generic.BulkEditView): form = forms.TagBulkEditForm +@register_model_view(Tag, 'bulk_delete', path='delete', detail=False) class TagBulkDeleteView(generic.BulkDeleteView): queryset = Tag.objects.annotate( items=count_related(TaggedItem, 'tag') @@ -659,6 +710,7 @@ class TagBulkDeleteView(generic.BulkDeleteView): # Config contexts # +@register_model_view(ConfigContext, 'list', path='', detail=False) class ConfigContextListView(generic.ObjectListView): queryset = ConfigContext.objects.all() filterset = filtersets.ConfigContextFilterSet @@ -711,30 +763,34 @@ class ConfigContextView(generic.ObjectView): } +@register_model_view(ConfigContext, 'add', detail=False) @register_model_view(ConfigContext, 'edit') class ConfigContextEditView(generic.ObjectEditView): queryset = ConfigContext.objects.all() form = forms.ConfigContextForm -class ConfigContextBulkEditView(generic.BulkEditView): - queryset = ConfigContext.objects.all() - filterset = filtersets.ConfigContextFilterSet - table = tables.ConfigContextTable - form = forms.ConfigContextBulkEditForm - - @register_model_view(ConfigContext, 'delete') class ConfigContextDeleteView(generic.ObjectDeleteView): queryset = ConfigContext.objects.all() +@register_model_view(ConfigContext, 'bulk_edit', path='edit', detail=False) +class ConfigContextBulkEditView(generic.BulkEditView): + queryset = ConfigContext.objects.all() + filterset = filtersets.ConfigContextFilterSet + table = tables.ConfigContextTable + form = forms.ConfigContextBulkEditForm + + +@register_model_view(ConfigContext, 'bulk_delete', path='delete', detail=False) class ConfigContextBulkDeleteView(generic.BulkDeleteView): queryset = ConfigContext.objects.all() filterset = filtersets.ConfigContextFilterSet table = tables.ConfigContextTable +@register_model_view(ConfigContext, 'bulk_sync', path='sync', detail=False) class ConfigContextBulkSyncDataView(generic.BulkSyncDataView): queryset = ConfigContext.objects.all() @@ -768,6 +824,7 @@ class ObjectConfigContextView(generic.ObjectView): # Config templates # +@register_model_view(ConfigTemplate, 'list', path='', detail=False) class ConfigTemplateListView(generic.ObjectListView): queryset = ConfigTemplate.objects.annotate( device_count=count_related(Device, 'config_template'), @@ -790,6 +847,7 @@ class ConfigTemplateView(generic.ObjectView): queryset = ConfigTemplate.objects.all() +@register_model_view(ConfigTemplate, 'add', detail=False) @register_model_view(ConfigTemplate, 'edit') class ConfigTemplateEditView(generic.ObjectEditView): queryset = ConfigTemplate.objects.all() @@ -801,11 +859,13 @@ class ConfigTemplateDeleteView(generic.ObjectDeleteView): queryset = ConfigTemplate.objects.all() +@register_model_view(ConfigTemplate, 'import', detail=False) class ConfigTemplateBulkImportView(generic.BulkImportView): queryset = ConfigTemplate.objects.all() model_form = forms.ConfigTemplateImportForm +@register_model_view(ConfigTemplate, 'bulk_edit', path='edit', detail=False) class ConfigTemplateBulkEditView(generic.BulkEditView): queryset = ConfigTemplate.objects.all() filterset = filtersets.ConfigTemplateFilterSet @@ -813,12 +873,14 @@ class ConfigTemplateBulkEditView(generic.BulkEditView): form = forms.ConfigTemplateBulkEditForm +@register_model_view(ConfigTemplate, 'bulk_delete', path='delete', detail=False) class ConfigTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ConfigTemplate.objects.all() filterset = filtersets.ConfigTemplateFilterSet table = tables.ConfigTemplateTable +@register_model_view(ConfigTemplate, 'bulk_sync', path='sync', detail=False) class ConfigTemplateBulkSyncDataView(generic.BulkSyncDataView): queryset = ConfigTemplate.objects.all() @@ -827,6 +889,7 @@ class ConfigTemplateBulkSyncDataView(generic.BulkSyncDataView): # Image attachments # +@register_model_view(ImageAttachment, 'list', path='', detail=False) class ImageAttachmentListView(generic.ObjectListView): queryset = ImageAttachment.objects.all() filterset = filtersets.ImageAttachmentFilterSet @@ -837,6 +900,7 @@ class ImageAttachmentListView(generic.ObjectListView): } +@register_model_view(ImageAttachment, 'add', detail=False) @register_model_view(ImageAttachment, 'edit') class ImageAttachmentEditView(generic.ObjectEditView): queryset = ImageAttachment.objects.all() @@ -871,6 +935,7 @@ class ImageAttachmentDeleteView(generic.ObjectDeleteView): # Journal entries # +@register_model_view(JournalEntry, 'list', path='', detail=False) class JournalEntryListView(generic.ObjectListView): queryset = JournalEntry.objects.all() filterset = filtersets.JournalEntryFilterSet @@ -889,6 +954,7 @@ class JournalEntryView(generic.ObjectView): queryset = JournalEntry.objects.all() +@register_model_view(JournalEntry, 'add', detail=False) @register_model_view(JournalEntry, 'edit') class JournalEntryEditView(generic.ObjectEditView): queryset = JournalEntry.objects.all() @@ -917,6 +983,13 @@ class JournalEntryDeleteView(generic.ObjectDeleteView): return reverse(viewname, kwargs={'pk': obj.pk}) +@register_model_view(JournalEntry, 'import', detail=False) +class JournalEntryBulkImportView(generic.BulkImportView): + queryset = JournalEntry.objects.all() + model_form = forms.JournalEntryImportForm + + +@register_model_view(JournalEntry, 'bulk_edit', path='edit', detail=False) class JournalEntryBulkEditView(generic.BulkEditView): queryset = JournalEntry.objects.all() filterset = filtersets.JournalEntryFilterSet @@ -924,17 +997,13 @@ class JournalEntryBulkEditView(generic.BulkEditView): form = forms.JournalEntryBulkEditForm +@register_model_view(JournalEntry, 'bulk_delete', path='delete', detail=False) class JournalEntryBulkDeleteView(generic.BulkDeleteView): queryset = JournalEntry.objects.all() filterset = filtersets.JournalEntryFilterSet table = tables.JournalEntryTable -class JournalEntryBulkImportView(generic.BulkImportView): - queryset = JournalEntry.objects.all() - model_form = forms.JournalEntryImportForm - - # # Dashboard & widgets # diff --git a/netbox/ipam/urls.py b/netbox/ipam/urls.py index d40f9c5dc..c55e874a1 100644 --- a/netbox/ipam/urls.py +++ b/netbox/ipam/urls.py @@ -1,150 +1,62 @@ from django.urls import include, path from utilities.urls import get_model_urls -from . import views +from . import views # noqa F401 app_name = 'ipam' urlpatterns = [ - # ASN ranges - path('asn-ranges/', views.ASNRangeListView.as_view(), name='asnrange_list'), - path('asn-ranges/add/', views.ASNRangeEditView.as_view(), name='asnrange_add'), - path('asn-ranges/import/', views.ASNRangeBulkImportView.as_view(), name='asnrange_import'), - path('asn-ranges/edit/', views.ASNRangeBulkEditView.as_view(), name='asnrange_bulk_edit'), - path('asn-ranges/delete/', views.ASNRangeBulkDeleteView.as_view(), name='asnrange_bulk_delete'), + path('asn-ranges/', include(get_model_urls('ipam', 'asnrange', detail=False))), path('asn-ranges//', include(get_model_urls('ipam', 'asnrange'))), - # ASNs - path('asns/', views.ASNListView.as_view(), name='asn_list'), - path('asns/add/', views.ASNEditView.as_view(), name='asn_add'), - path('asns/import/', views.ASNBulkImportView.as_view(), name='asn_import'), - path('asns/edit/', views.ASNBulkEditView.as_view(), name='asn_bulk_edit'), - path('asns/delete/', views.ASNBulkDeleteView.as_view(), name='asn_bulk_delete'), + path('asns/', include(get_model_urls('ipam', 'asn', detail=False))), path('asns//', include(get_model_urls('ipam', 'asn'))), - # VRFs - path('vrfs/', views.VRFListView.as_view(), name='vrf_list'), - path('vrfs/add/', views.VRFEditView.as_view(), name='vrf_add'), - path('vrfs/import/', views.VRFBulkImportView.as_view(), name='vrf_import'), - path('vrfs/edit/', views.VRFBulkEditView.as_view(), name='vrf_bulk_edit'), - path('vrfs/delete/', views.VRFBulkDeleteView.as_view(), name='vrf_bulk_delete'), + path('vrfs/', include(get_model_urls('ipam', 'vrf', detail=False))), path('vrfs//', include(get_model_urls('ipam', 'vrf'))), - # Route targets - path('route-targets/', views.RouteTargetListView.as_view(), name='routetarget_list'), - path('route-targets/add/', views.RouteTargetEditView.as_view(), name='routetarget_add'), - path('route-targets/import/', views.RouteTargetBulkImportView.as_view(), name='routetarget_import'), - path('route-targets/edit/', views.RouteTargetBulkEditView.as_view(), name='routetarget_bulk_edit'), - path('route-targets/delete/', views.RouteTargetBulkDeleteView.as_view(), name='routetarget_bulk_delete'), + path('route-targets/', include(get_model_urls('ipam', 'routetarget', detail=False))), path('route-targets//', include(get_model_urls('ipam', 'routetarget'))), - # RIRs - path('rirs/', views.RIRListView.as_view(), name='rir_list'), - path('rirs/add/', views.RIREditView.as_view(), name='rir_add'), - path('rirs/import/', views.RIRBulkImportView.as_view(), name='rir_import'), - path('rirs/edit/', views.RIRBulkEditView.as_view(), name='rir_bulk_edit'), - path('rirs/delete/', views.RIRBulkDeleteView.as_view(), name='rir_bulk_delete'), + path('rirs/', include(get_model_urls('ipam', 'rir', detail=False))), path('rirs//', include(get_model_urls('ipam', 'rir'))), - # Aggregates - path('aggregates/', views.AggregateListView.as_view(), name='aggregate_list'), - path('aggregates/add/', views.AggregateEditView.as_view(), name='aggregate_add'), - path('aggregates/import/', views.AggregateBulkImportView.as_view(), name='aggregate_import'), - path('aggregates/edit/', views.AggregateBulkEditView.as_view(), name='aggregate_bulk_edit'), - path('aggregates/delete/', views.AggregateBulkDeleteView.as_view(), name='aggregate_bulk_delete'), + path('aggregates/', include(get_model_urls('ipam', 'aggregate', detail=False))), path('aggregates//', include(get_model_urls('ipam', 'aggregate'))), - # Roles - path('roles/', views.RoleListView.as_view(), name='role_list'), - path('roles/add/', views.RoleEditView.as_view(), name='role_add'), - path('roles/import/', views.RoleBulkImportView.as_view(), name='role_import'), - path('roles/edit/', views.RoleBulkEditView.as_view(), name='role_bulk_edit'), - path('roles/delete/', views.RoleBulkDeleteView.as_view(), name='role_bulk_delete'), + path('roles/', include(get_model_urls('ipam', 'role', detail=False))), path('roles//', include(get_model_urls('ipam', 'role'))), - # Prefixes - path('prefixes/', views.PrefixListView.as_view(), name='prefix_list'), - path('prefixes/add/', views.PrefixEditView.as_view(), name='prefix_add'), - path('prefixes/import/', views.PrefixBulkImportView.as_view(), name='prefix_import'), - path('prefixes/edit/', views.PrefixBulkEditView.as_view(), name='prefix_bulk_edit'), - path('prefixes/delete/', views.PrefixBulkDeleteView.as_view(), name='prefix_bulk_delete'), + path('prefixes/', include(get_model_urls('ipam', 'prefix', detail=False))), path('prefixes//', include(get_model_urls('ipam', 'prefix'))), - # IP ranges - path('ip-ranges/', views.IPRangeListView.as_view(), name='iprange_list'), - path('ip-ranges/add/', views.IPRangeEditView.as_view(), name='iprange_add'), - path('ip-ranges/import/', views.IPRangeBulkImportView.as_view(), name='iprange_import'), - path('ip-ranges/edit/', views.IPRangeBulkEditView.as_view(), name='iprange_bulk_edit'), - path('ip-ranges/delete/', views.IPRangeBulkDeleteView.as_view(), name='iprange_bulk_delete'), + path('ip-ranges/', include(get_model_urls('ipam', 'iprange', detail=False))), path('ip-ranges//', include(get_model_urls('ipam', 'iprange'))), - # IP addresses - path('ip-addresses/', views.IPAddressListView.as_view(), name='ipaddress_list'), - path('ip-addresses/add/', views.IPAddressEditView.as_view(), name='ipaddress_add'), - path('ip-addresses/bulk-add/', views.IPAddressBulkCreateView.as_view(), name='ipaddress_bulk_add'), - path('ip-addresses/import/', views.IPAddressBulkImportView.as_view(), name='ipaddress_import'), - path('ip-addresses/edit/', views.IPAddressBulkEditView.as_view(), name='ipaddress_bulk_edit'), - path('ip-addresses/delete/', views.IPAddressBulkDeleteView.as_view(), name='ipaddress_bulk_delete'), - path('ip-addresses/assign/', views.IPAddressAssignView.as_view(), name='ipaddress_assign'), + path('ip-addresses/', include(get_model_urls('ipam', 'ipaddress', detail=False))), path('ip-addresses//', include(get_model_urls('ipam', 'ipaddress'))), - # FHRP groups - path('fhrp-groups/', views.FHRPGroupListView.as_view(), name='fhrpgroup_list'), - path('fhrp-groups/add/', views.FHRPGroupEditView.as_view(), name='fhrpgroup_add'), - path('fhrp-groups/import/', views.FHRPGroupBulkImportView.as_view(), name='fhrpgroup_import'), - path('fhrp-groups/edit/', views.FHRPGroupBulkEditView.as_view(), name='fhrpgroup_bulk_edit'), - path('fhrp-groups/delete/', views.FHRPGroupBulkDeleteView.as_view(), name='fhrpgroup_bulk_delete'), + path('fhrp-groups/', include(get_model_urls('ipam', 'fhrpgroup', detail=False))), path('fhrp-groups//', include(get_model_urls('ipam', 'fhrpgroup'))), - # FHRP group assignments - path('fhrp-group-assignments/add/', views.FHRPGroupAssignmentEditView.as_view(), name='fhrpgroupassignment_add'), + path('fhrp-group-assignments/', include(get_model_urls('ipam', 'fhrpgroupassignment', detail=False))), path('fhrp-group-assignments//', include(get_model_urls('ipam', 'fhrpgroupassignment'))), - # VLAN groups - path('vlan-groups/', views.VLANGroupListView.as_view(), name='vlangroup_list'), - path('vlan-groups/add/', views.VLANGroupEditView.as_view(), name='vlangroup_add'), - path('vlan-groups/import/', views.VLANGroupBulkImportView.as_view(), name='vlangroup_import'), - path('vlan-groups/edit/', views.VLANGroupBulkEditView.as_view(), name='vlangroup_bulk_edit'), - path('vlan-groups/delete/', views.VLANGroupBulkDeleteView.as_view(), name='vlangroup_bulk_delete'), + path('vlan-groups/', include(get_model_urls('ipam', 'vlangroup', detail=False))), path('vlan-groups//', include(get_model_urls('ipam', 'vlangroup'))), - # VLANs - path('vlans/', views.VLANListView.as_view(), name='vlan_list'), - path('vlans/add/', views.VLANEditView.as_view(), name='vlan_add'), - path('vlans/import/', views.VLANBulkImportView.as_view(), name='vlan_import'), - path('vlans/edit/', views.VLANBulkEditView.as_view(), name='vlan_bulk_edit'), - path('vlans/delete/', views.VLANBulkDeleteView.as_view(), name='vlan_bulk_delete'), + path('vlans/', include(get_model_urls('ipam', 'vlan', detail=False))), path('vlans//', include(get_model_urls('ipam', 'vlan'))), - # VLAN Translation Policies - path('vlan-translation-policies/', views.VLANTranslationPolicyListView.as_view(), name='vlantranslationpolicy_list'), - path('vlan-translation-policies/add/', views.VLANTranslationPolicyEditView.as_view(), name='vlantranslationpolicy_add'), - path('vlan-translation-policies/import/', views.VLANTranslationPolicyBulkImportView.as_view(), name='vlantranslationpolicy_import'), - path('vlan-translation-policies/edit/', views.VLANTranslationPolicyBulkEditView.as_view(), name='vlantranslationpolicy_bulk_edit'), - path('vlan-translation-policies/delete/', views.VLANTranslationPolicyBulkDeleteView.as_view(), name='vlantranslationpolicy_bulk_delete'), + path('vlan-translation-policies/', include(get_model_urls('ipam', 'vlantranslationpolicy', detail=False))), path('vlan-translation-policies//', include(get_model_urls('ipam', 'vlantranslationpolicy'))), - # VLAN Translation Rules - path('vlan-translation-rules/', views.VLANTranslationRuleListView.as_view(), name='vlantranslationrule_list'), - path('vlan-translation-rules/add/', views.VLANTranslationRuleEditView.as_view(), name='vlantranslationrule_add'), - path('vlan-translation-rules/import/', views.VLANTranslationRuleBulkImportView.as_view(), name='vlantranslationrule_import'), - path('vlan-translation-rules/edit/', views.VLANTranslationRuleBulkEditView.as_view(), name='vlantranslationrule_bulk_edit'), - path('vlan-translation-rules/delete/', views.VLANTranslationRuleBulkDeleteView.as_view(), name='vlantranslationrule_bulk_delete'), + path('vlan-translation-rules/', include(get_model_urls('ipam', 'vlantranslationrule', detail=False))), path('vlan-translation-rules//', include(get_model_urls('ipam', 'vlantranslationrule'))), - # Service templates - path('service-templates/', views.ServiceTemplateListView.as_view(), name='servicetemplate_list'), - path('service-templates/add/', views.ServiceTemplateEditView.as_view(), name='servicetemplate_add'), - path('service-templates/import/', views.ServiceTemplateBulkImportView.as_view(), name='servicetemplate_import'), - path('service-templates/edit/', views.ServiceTemplateBulkEditView.as_view(), name='servicetemplate_bulk_edit'), - path('service-templates/delete/', views.ServiceTemplateBulkDeleteView.as_view(), name='servicetemplate_bulk_delete'), + path('service-templates/', include(get_model_urls('ipam', 'servicetemplate', detail=False))), path('service-templates//', include(get_model_urls('ipam', 'servicetemplate'))), - # Services - path('services/', views.ServiceListView.as_view(), name='service_list'), - path('services/add/', views.ServiceCreateView.as_view(), name='service_add'), - path('services/import/', views.ServiceBulkImportView.as_view(), name='service_import'), - path('services/edit/', views.ServiceBulkEditView.as_view(), name='service_bulk_edit'), - path('services/delete/', views.ServiceBulkDeleteView.as_view(), name='service_bulk_delete'), + path('services/', include(get_model_urls('ipam', 'service', detail=False))), path('services//', include(get_model_urls('ipam', 'service'))), ] diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index bbd19c433..327c05f3d 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -29,6 +29,7 @@ from .utils import add_requested_prefixes, add_available_ipaddresses, add_availa # VRFs # +@register_model_view(VRF, 'list', path='', detail=False) class VRFListView(generic.ObjectListView): queryset = VRF.objects.all() filterset = filtersets.VRFFilterSet @@ -57,6 +58,7 @@ class VRFView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(VRF, 'add', detail=False) @register_model_view(VRF, 'edit') class VRFEditView(generic.ObjectEditView): queryset = VRF.objects.all() @@ -68,11 +70,13 @@ class VRFDeleteView(generic.ObjectDeleteView): queryset = VRF.objects.all() +@register_model_view(VRF, 'import', detail=False) class VRFBulkImportView(generic.BulkImportView): queryset = VRF.objects.all() model_form = forms.VRFImportForm +@register_model_view(VRF, 'bulk_edit', path='edit', detail=False) class VRFBulkEditView(generic.BulkEditView): queryset = VRF.objects.all() filterset = filtersets.VRFFilterSet @@ -80,6 +84,7 @@ class VRFBulkEditView(generic.BulkEditView): form = forms.VRFBulkEditForm +@register_model_view(VRF, 'bulk_delete', path='delete', detail=False) class VRFBulkDeleteView(generic.BulkDeleteView): queryset = VRF.objects.all() filterset = filtersets.VRFFilterSet @@ -90,6 +95,7 @@ class VRFBulkDeleteView(generic.BulkDeleteView): # Route targets # +@register_model_view(RouteTarget, 'list', path='', detail=False) class RouteTargetListView(generic.ObjectListView): queryset = RouteTarget.objects.all() filterset = filtersets.RouteTargetFilterSet @@ -102,6 +108,7 @@ class RouteTargetView(generic.ObjectView): queryset = RouteTarget.objects.all() +@register_model_view(RouteTarget, 'add', detail=False) @register_model_view(RouteTarget, 'edit') class RouteTargetEditView(generic.ObjectEditView): queryset = RouteTarget.objects.all() @@ -113,11 +120,13 @@ class RouteTargetDeleteView(generic.ObjectDeleteView): queryset = RouteTarget.objects.all() +@register_model_view(RouteTarget, 'import', detail=False) class RouteTargetBulkImportView(generic.BulkImportView): queryset = RouteTarget.objects.all() model_form = forms.RouteTargetImportForm +@register_model_view(RouteTarget, 'bulk_edit', path='edit', detail=False) class RouteTargetBulkEditView(generic.BulkEditView): queryset = RouteTarget.objects.all() filterset = filtersets.RouteTargetFilterSet @@ -125,6 +134,7 @@ class RouteTargetBulkEditView(generic.BulkEditView): form = forms.RouteTargetBulkEditForm +@register_model_view(RouteTarget, 'bulk_delete', path='delete', detail=False) class RouteTargetBulkDeleteView(generic.BulkDeleteView): queryset = RouteTarget.objects.all() filterset = filtersets.RouteTargetFilterSet @@ -135,6 +145,7 @@ class RouteTargetBulkDeleteView(generic.BulkDeleteView): # RIRs # +@register_model_view(RIR, 'list', path='', detail=False) class RIRListView(generic.ObjectListView): queryset = RIR.objects.annotate( aggregate_count=count_related(Aggregate, 'rir') @@ -154,6 +165,7 @@ class RIRView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(RIR, 'add', detail=False) @register_model_view(RIR, 'edit') class RIREditView(generic.ObjectEditView): queryset = RIR.objects.all() @@ -165,11 +177,13 @@ class RIRDeleteView(generic.ObjectDeleteView): queryset = RIR.objects.all() +@register_model_view(RIR, 'import', detail=False) class RIRBulkImportView(generic.BulkImportView): queryset = RIR.objects.all() model_form = forms.RIRImportForm +@register_model_view(RIR, 'bulk_edit', path='edit', detail=False) class RIRBulkEditView(generic.BulkEditView): queryset = RIR.objects.annotate( aggregate_count=count_related(Aggregate, 'rir') @@ -179,6 +193,7 @@ class RIRBulkEditView(generic.BulkEditView): form = forms.RIRBulkEditForm +@register_model_view(RIR, 'bulk_delete', path='delete', detail=False) class RIRBulkDeleteView(generic.BulkDeleteView): queryset = RIR.objects.annotate( aggregate_count=count_related(Aggregate, 'rir') @@ -191,6 +206,7 @@ class RIRBulkDeleteView(generic.BulkDeleteView): # ASN ranges # +@register_model_view(ASNRange, 'list', path='', detail=False) class ASNRangeListView(generic.ObjectListView): queryset = ASNRange.objects.annotate_asn_counts() filterset = filtersets.ASNRangeFilterSet @@ -224,6 +240,7 @@ class ASNRangeASNsView(generic.ObjectChildrenView): ) +@register_model_view(ASNRange, 'add', detail=False) @register_model_view(ASNRange, 'edit') class ASNRangeEditView(generic.ObjectEditView): queryset = ASNRange.objects.all() @@ -235,11 +252,13 @@ class ASNRangeDeleteView(generic.ObjectDeleteView): queryset = ASNRange.objects.all() +@register_model_view(ASNRange, 'import', detail=False) class ASNRangeBulkImportView(generic.BulkImportView): queryset = ASNRange.objects.all() model_form = forms.ASNRangeImportForm +@register_model_view(ASNRange, 'bulk_edit', path='edit', detail=False) class ASNRangeBulkEditView(generic.BulkEditView): queryset = ASNRange.objects.annotate_asn_counts() filterset = filtersets.ASNRangeFilterSet @@ -247,6 +266,7 @@ class ASNRangeBulkEditView(generic.BulkEditView): form = forms.ASNRangeBulkEditForm +@register_model_view(ASNRange, 'bulk_delete', path='delete', detail=False) class ASNRangeBulkDeleteView(generic.BulkDeleteView): queryset = ASNRange.objects.annotate_asn_counts() filterset = filtersets.ASNRangeFilterSet @@ -257,6 +277,7 @@ class ASNRangeBulkDeleteView(generic.BulkDeleteView): # ASNs # +@register_model_view(ASN, 'list', path='', detail=False) class ASNListView(generic.ObjectListView): queryset = ASN.objects.annotate( site_count=count_related(Site, 'asns'), @@ -284,6 +305,7 @@ class ASNView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ASN, 'add', detail=False) @register_model_view(ASN, 'edit') class ASNEditView(generic.ObjectEditView): queryset = ASN.objects.all() @@ -295,11 +317,13 @@ class ASNDeleteView(generic.ObjectDeleteView): queryset = ASN.objects.all() +@register_model_view(ASN, 'import', detail=False) class ASNBulkImportView(generic.BulkImportView): queryset = ASN.objects.all() model_form = forms.ASNImportForm +@register_model_view(ASN, 'bulk_edit', path='edit', detail=False) class ASNBulkEditView(generic.BulkEditView): queryset = ASN.objects.annotate( site_count=count_related(Site, 'asns') @@ -309,6 +333,7 @@ class ASNBulkEditView(generic.BulkEditView): form = forms.ASNBulkEditForm +@register_model_view(ASN, 'bulk_delete', path='delete', detail=False) class ASNBulkDeleteView(generic.BulkDeleteView): queryset = ASN.objects.annotate( site_count=count_related(Site, 'asns') @@ -321,6 +346,7 @@ class ASNBulkDeleteView(generic.BulkDeleteView): # Aggregates # +@register_model_view(Aggregate, 'list', path='', detail=False) class AggregateListView(generic.ObjectListView): queryset = Aggregate.objects.annotate( child_count=RawSQL('SELECT COUNT(*) FROM ipam_prefix WHERE ipam_prefix.prefix <<= ipam_aggregate.prefix', ()) @@ -371,6 +397,7 @@ class AggregatePrefixesView(generic.ObjectChildrenView): } +@register_model_view(Aggregate, 'add', detail=False) @register_model_view(Aggregate, 'edit') class AggregateEditView(generic.ObjectEditView): queryset = Aggregate.objects.all() @@ -382,11 +409,13 @@ class AggregateDeleteView(generic.ObjectDeleteView): queryset = Aggregate.objects.all() +@register_model_view(Aggregate, 'import', detail=False) class AggregateBulkImportView(generic.BulkImportView): queryset = Aggregate.objects.all() model_form = forms.AggregateImportForm +@register_model_view(Aggregate, 'bulk_edit', path='edit', detail=False) class AggregateBulkEditView(generic.BulkEditView): queryset = Aggregate.objects.annotate( child_count=RawSQL('SELECT COUNT(*) FROM ipam_prefix WHERE ipam_prefix.prefix <<= ipam_aggregate.prefix', ()) @@ -396,6 +425,7 @@ class AggregateBulkEditView(generic.BulkEditView): form = forms.AggregateBulkEditForm +@register_model_view(Aggregate, 'bulk_delete', path='delete', detail=False) class AggregateBulkDeleteView(generic.BulkDeleteView): queryset = Aggregate.objects.annotate( child_count=RawSQL('SELECT COUNT(*) FROM ipam_prefix WHERE ipam_prefix.prefix <<= ipam_aggregate.prefix', ()) @@ -413,6 +443,7 @@ class AggregateContactsView(ObjectContactsView): # Prefix/VLAN roles # +@register_model_view(Role, 'list', path='', detail=False) class RoleListView(generic.ObjectListView): queryset = Role.objects.annotate( prefix_count=count_related(Prefix, 'role'), @@ -434,6 +465,7 @@ class RoleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Role, 'add', detail=False) @register_model_view(Role, 'edit') class RoleEditView(generic.ObjectEditView): queryset = Role.objects.all() @@ -445,11 +477,13 @@ class RoleDeleteView(generic.ObjectDeleteView): queryset = Role.objects.all() +@register_model_view(Role, 'import', detail=False) class RoleBulkImportView(generic.BulkImportView): queryset = Role.objects.all() model_form = forms.RoleImportForm +@register_model_view(Role, 'bulk_edit', path='edit', detail=False) class RoleBulkEditView(generic.BulkEditView): queryset = Role.objects.all() filterset = filtersets.RoleFilterSet @@ -457,6 +491,7 @@ class RoleBulkEditView(generic.BulkEditView): form = forms.RoleBulkEditForm +@register_model_view(Role, 'bulk_delete', path='delete', detail=False) class RoleBulkDeleteView(generic.BulkDeleteView): queryset = Role.objects.all() filterset = filtersets.RoleFilterSet @@ -467,6 +502,7 @@ class RoleBulkDeleteView(generic.BulkDeleteView): # Prefixes # +@register_model_view(Prefix, 'list', path='', detail=False) class PrefixListView(generic.ObjectListView): queryset = Prefix.objects.all() filterset = filtersets.PrefixFilterSet @@ -615,6 +651,7 @@ class PrefixIPAddressesView(generic.ObjectChildrenView): } +@register_model_view(Prefix, 'add', detail=False) @register_model_view(Prefix, 'edit') class PrefixEditView(generic.ObjectEditView): queryset = Prefix.objects.all() @@ -626,11 +663,13 @@ class PrefixDeleteView(generic.ObjectDeleteView): queryset = Prefix.objects.all() +@register_model_view(Prefix, 'import', detail=False) class PrefixBulkImportView(generic.BulkImportView): queryset = Prefix.objects.all() model_form = forms.PrefixImportForm +@register_model_view(Prefix, 'bulk_edit', path='edit', detail=False) class PrefixBulkEditView(generic.BulkEditView): queryset = Prefix.objects.prefetch_related('vrf__tenant') filterset = filtersets.PrefixFilterSet @@ -638,6 +677,7 @@ class PrefixBulkEditView(generic.BulkEditView): form = forms.PrefixBulkEditForm +@register_model_view(Prefix, 'bulk_delete', path='delete', detail=False) class PrefixBulkDeleteView(generic.BulkDeleteView): queryset = Prefix.objects.prefetch_related('vrf__tenant') filterset = filtersets.PrefixFilterSet @@ -653,6 +693,7 @@ class PrefixContactsView(ObjectContactsView): # IP Ranges # +@register_model_view(IPRange, 'list', path='', detail=False) class IPRangeListView(generic.ObjectListView): queryset = IPRange.objects.all() filterset = filtersets.IPRangeFilterSet @@ -704,6 +745,7 @@ class IPRangeIPAddressesView(generic.ObjectChildrenView): return parent.get_child_ips().restrict(request.user, 'view') +@register_model_view(IPRange, 'add', detail=False) @register_model_view(IPRange, 'edit') class IPRangeEditView(generic.ObjectEditView): queryset = IPRange.objects.all() @@ -715,11 +757,13 @@ class IPRangeDeleteView(generic.ObjectDeleteView): queryset = IPRange.objects.all() +@register_model_view(IPRange, 'import', detail=False) class IPRangeBulkImportView(generic.BulkImportView): queryset = IPRange.objects.all() model_form = forms.IPRangeImportForm +@register_model_view(IPRange, 'bulk_edit', path='edit', detail=False) class IPRangeBulkEditView(generic.BulkEditView): queryset = IPRange.objects.all() filterset = filtersets.IPRangeFilterSet @@ -727,6 +771,7 @@ class IPRangeBulkEditView(generic.BulkEditView): form = forms.IPRangeBulkEditForm +@register_model_view(IPRange, 'bulk_delete', path='delete', detail=False) class IPRangeBulkDeleteView(generic.BulkDeleteView): queryset = IPRange.objects.all() filterset = filtersets.IPRangeFilterSet @@ -742,6 +787,7 @@ class IPRangeContactsView(ObjectContactsView): # IP addresses # +@register_model_view(IPAddress, 'list', path='', detail=False) class IPAddressListView(generic.ObjectListView): queryset = IPAddress.objects.all() filterset = filtersets.IPAddressFilterSet @@ -788,6 +834,7 @@ class IPAddressView(generic.ObjectView): } +@register_model_view(IPAddress, 'add', detail=False) @register_model_view(IPAddress, 'edit') class IPAddressEditView(generic.ObjectEditView): queryset = IPAddress.objects.all() @@ -818,6 +865,7 @@ class IPAddressEditView(generic.ObjectEditView): # TODO: Standardize or remove this view +@register_model_view(IPAddress, 'assign', path='assign', detail=False) class IPAddressAssignView(generic.ObjectView): """ Search for IPAddresses to be assigned to an Interface. @@ -862,6 +910,7 @@ class IPAddressDeleteView(generic.ObjectDeleteView): queryset = IPAddress.objects.all() +@register_model_view(IPAddress, 'bulk_add', path='bulk-add', detail=False) class IPAddressBulkCreateView(generic.BulkCreateView): queryset = IPAddress.objects.all() form = forms.IPAddressBulkCreateForm @@ -870,11 +919,13 @@ class IPAddressBulkCreateView(generic.BulkCreateView): template_name = 'ipam/ipaddress_bulk_add.html' +@register_model_view(IPAddress, 'import', detail=False) class IPAddressBulkImportView(generic.BulkImportView): queryset = IPAddress.objects.all() model_form = forms.IPAddressImportForm +@register_model_view(IPAddress, 'bulk_edit', path='edit', detail=False) class IPAddressBulkEditView(generic.BulkEditView): queryset = IPAddress.objects.prefetch_related('vrf__tenant') filterset = filtersets.IPAddressFilterSet @@ -882,6 +933,7 @@ class IPAddressBulkEditView(generic.BulkEditView): form = forms.IPAddressBulkEditForm +@register_model_view(IPAddress, 'bulk_delete', path='delete', detail=False) class IPAddressBulkDeleteView(generic.BulkDeleteView): queryset = IPAddress.objects.prefetch_related('vrf__tenant') filterset = filtersets.IPAddressFilterSet @@ -915,6 +967,7 @@ class IPAddressContactsView(ObjectContactsView): # VLAN groups # +@register_model_view(VLANGroup, 'list', path='', detail=False) class VLANGroupListView(generic.ObjectListView): queryset = VLANGroup.objects.annotate_utilization() filterset = filtersets.VLANGroupFilterSet @@ -932,6 +985,7 @@ class VLANGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(VLANGroup, 'add', detail=False) @register_model_view(VLANGroup, 'edit') class VLANGroupEditView(generic.ObjectEditView): queryset = VLANGroup.objects.all() @@ -943,11 +997,13 @@ class VLANGroupDeleteView(generic.ObjectDeleteView): queryset = VLANGroup.objects.all() +@register_model_view(VLANGroup, 'import', detail=False) class VLANGroupBulkImportView(generic.BulkImportView): queryset = VLANGroup.objects.all() model_form = forms.VLANGroupImportForm +@register_model_view(VLANGroup, 'bulk_edit', path='edit', detail=False) class VLANGroupBulkEditView(generic.BulkEditView): queryset = VLANGroup.objects.annotate_utilization().prefetch_related('tags') filterset = filtersets.VLANGroupFilterSet @@ -955,6 +1011,7 @@ class VLANGroupBulkEditView(generic.BulkEditView): form = forms.VLANGroupBulkEditForm +@register_model_view(VLANGroup, 'bulk_delete', path='delete', detail=False) class VLANGroupBulkDeleteView(generic.BulkDeleteView): queryset = VLANGroup.objects.annotate_utilization().prefetch_related('tags') filterset = filtersets.VLANGroupFilterSet @@ -991,6 +1048,7 @@ class VLANGroupVLANsView(generic.ObjectChildrenView): # VLAN Translation Policies # +@register_model_view(VLANTranslationPolicy, 'list', path='', detail=False) class VLANTranslationPolicyListView(generic.ObjectListView): queryset = VLANTranslationPolicy.objects.all() filterset = filtersets.VLANTranslationPolicyFilterSet @@ -1012,6 +1070,7 @@ class VLANTranslationPolicyView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(VLANTranslationPolicy, 'add', detail=False) @register_model_view(VLANTranslationPolicy, 'edit') class VLANTranslationPolicyEditView(generic.ObjectEditView): queryset = VLANTranslationPolicy.objects.all() @@ -1023,11 +1082,13 @@ class VLANTranslationPolicyDeleteView(generic.ObjectDeleteView): queryset = VLANTranslationPolicy.objects.all() +@register_model_view(VLANTranslationPolicy, 'import', detail=False) class VLANTranslationPolicyBulkImportView(generic.BulkImportView): queryset = VLANTranslationPolicy.objects.all() model_form = forms.VLANTranslationPolicyImportForm +@register_model_view(VLANTranslationPolicy, 'bulk_edit', path='edit', detail=False) class VLANTranslationPolicyBulkEditView(generic.BulkEditView): queryset = VLANTranslationPolicy.objects.all() filterset = filtersets.VLANTranslationPolicyFilterSet @@ -1035,6 +1096,7 @@ class VLANTranslationPolicyBulkEditView(generic.BulkEditView): form = forms.VLANTranslationPolicyBulkEditForm +@register_model_view(VLANTranslationPolicy, 'bulk_delete', path='delete', detail=False) class VLANTranslationPolicyBulkDeleteView(generic.BulkDeleteView): queryset = VLANTranslationPolicy.objects.all() filterset = filtersets.VLANTranslationPolicyFilterSet @@ -1045,6 +1107,7 @@ class VLANTranslationPolicyBulkDeleteView(generic.BulkDeleteView): # VLAN Translation Rules # +@register_model_view(VLANTranslationRule, 'list', path='', detail=False) class VLANTranslationRuleListView(generic.ObjectListView): queryset = VLANTranslationRule.objects.all() filterset = filtersets.VLANTranslationRuleFilterSet @@ -1062,6 +1125,7 @@ class VLANTranslationRuleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(VLANTranslationRule, 'add', detail=False) @register_model_view(VLANTranslationRule, 'edit') class VLANTranslationRuleEditView(generic.ObjectEditView): queryset = VLANTranslationRule.objects.all() @@ -1073,11 +1137,13 @@ class VLANTranslationRuleDeleteView(generic.ObjectDeleteView): queryset = VLANTranslationRule.objects.all() +@register_model_view(VLANTranslationRule, 'import', detail=False) class VLANTranslationRuleBulkImportView(generic.BulkImportView): queryset = VLANTranslationRule.objects.all() model_form = forms.VLANTranslationRuleImportForm +@register_model_view(VLANTranslationRule, 'bulk_edit', path='edit', detail=False) class VLANTranslationRuleBulkEditView(generic.BulkEditView): queryset = VLANTranslationRule.objects.all() filterset = filtersets.VLANTranslationRuleFilterSet @@ -1085,6 +1151,7 @@ class VLANTranslationRuleBulkEditView(generic.BulkEditView): form = forms.VLANTranslationRuleBulkEditForm +@register_model_view(VLANTranslationRule, 'bulk_delete', path='delete', detail=False) class VLANTranslationRuleBulkDeleteView(generic.BulkDeleteView): queryset = VLANTranslationRule.objects.all() filterset = filtersets.VLANTranslationRuleFilterSet @@ -1095,6 +1162,7 @@ class VLANTranslationRuleBulkDeleteView(generic.BulkDeleteView): # FHRP groups # +@register_model_view(FHRPGroup, 'list', path='', detail=False) class FHRPGroupListView(generic.ObjectListView): queryset = FHRPGroup.objects.annotate( member_count=count_related(FHRPGroupAssignment, 'group') @@ -1122,6 +1190,7 @@ class FHRPGroupView(generic.ObjectView): } +@register_model_view(FHRPGroup, 'add', detail=False) @register_model_view(FHRPGroup, 'edit') class FHRPGroupEditView(generic.ObjectEditView): queryset = FHRPGroup.objects.all() @@ -1149,11 +1218,13 @@ class FHRPGroupDeleteView(generic.ObjectDeleteView): queryset = FHRPGroup.objects.all() +@register_model_view(FHRPGroup, 'import', detail=False) class FHRPGroupBulkImportView(generic.BulkImportView): queryset = FHRPGroup.objects.all() model_form = forms.FHRPGroupImportForm +@register_model_view(FHRPGroup, 'bulk_edit', path='edit', detail=False) class FHRPGroupBulkEditView(generic.BulkEditView): queryset = FHRPGroup.objects.all() filterset = filtersets.FHRPGroupFilterSet @@ -1161,6 +1232,7 @@ class FHRPGroupBulkEditView(generic.BulkEditView): form = forms.FHRPGroupBulkEditForm +@register_model_view(FHRPGroup, 'bulk_delete', path='delete', detail=False) class FHRPGroupBulkDeleteView(generic.BulkDeleteView): queryset = FHRPGroup.objects.all() filterset = filtersets.FHRPGroupFilterSet @@ -1171,6 +1243,7 @@ class FHRPGroupBulkDeleteView(generic.BulkDeleteView): # FHRP group assignments # +@register_model_view(FHRPGroupAssignment, 'add', detail=False) @register_model_view(FHRPGroupAssignment, 'edit') class FHRPGroupAssignmentEditView(generic.ObjectEditView): queryset = FHRPGroupAssignment.objects.all() @@ -1199,6 +1272,7 @@ class FHRPGroupAssignmentDeleteView(generic.ObjectDeleteView): # VLANs # +@register_model_view(VLAN, 'list', path='', detail=False) class VLANListView(generic.ObjectListView): queryset = VLAN.objects.all() filterset = filtersets.VLANFilterSet @@ -1257,6 +1331,7 @@ class VLANVMInterfacesView(generic.ObjectChildrenView): return parent.get_vminterfaces().restrict(request.user, 'view') +@register_model_view(VLAN, 'add', detail=False) @register_model_view(VLAN, 'edit') class VLANEditView(generic.ObjectEditView): queryset = VLAN.objects.all() @@ -1269,11 +1344,13 @@ class VLANDeleteView(generic.ObjectDeleteView): queryset = VLAN.objects.all() +@register_model_view(VLAN, 'import', detail=False) class VLANBulkImportView(generic.BulkImportView): queryset = VLAN.objects.all() model_form = forms.VLANImportForm +@register_model_view(VLAN, 'bulk_edit', path='edit', detail=False) class VLANBulkEditView(generic.BulkEditView): queryset = VLAN.objects.all() filterset = filtersets.VLANFilterSet @@ -1281,6 +1358,7 @@ class VLANBulkEditView(generic.BulkEditView): form = forms.VLANBulkEditForm +@register_model_view(VLAN, 'bulk_delete', path='delete', detail=False) class VLANBulkDeleteView(generic.BulkDeleteView): queryset = VLAN.objects.all() filterset = filtersets.VLANFilterSet @@ -1291,6 +1369,7 @@ class VLANBulkDeleteView(generic.BulkDeleteView): # Service templates # +@register_model_view(ServiceTemplate, 'list', path='', detail=False) class ServiceTemplateListView(generic.ObjectListView): queryset = ServiceTemplate.objects.all() filterset = filtersets.ServiceTemplateFilterSet @@ -1303,6 +1382,7 @@ class ServiceTemplateView(generic.ObjectView): queryset = ServiceTemplate.objects.all() +@register_model_view(ServiceTemplate, 'add', detail=False) @register_model_view(ServiceTemplate, 'edit') class ServiceTemplateEditView(generic.ObjectEditView): queryset = ServiceTemplate.objects.all() @@ -1314,11 +1394,13 @@ class ServiceTemplateDeleteView(generic.ObjectDeleteView): queryset = ServiceTemplate.objects.all() +@register_model_view(ServiceTemplate, 'import', detail=False) class ServiceTemplateBulkImportView(generic.BulkImportView): queryset = ServiceTemplate.objects.all() model_form = forms.ServiceTemplateImportForm +@register_model_view(ServiceTemplate, 'bulk_edit', path='edit', detail=False) class ServiceTemplateBulkEditView(generic.BulkEditView): queryset = ServiceTemplate.objects.all() filterset = filtersets.ServiceTemplateFilterSet @@ -1326,6 +1408,7 @@ class ServiceTemplateBulkEditView(generic.BulkEditView): form = forms.ServiceTemplateBulkEditForm +@register_model_view(ServiceTemplate, 'bulk_delete', path='delete', detail=False) class ServiceTemplateBulkDeleteView(generic.BulkDeleteView): queryset = ServiceTemplate.objects.all() filterset = filtersets.ServiceTemplateFilterSet @@ -1336,6 +1419,7 @@ class ServiceTemplateBulkDeleteView(generic.BulkDeleteView): # Services # +@register_model_view(Service, 'list', path='', detail=False) class ServiceListView(generic.ObjectListView): queryset = Service.objects.prefetch_related('device', 'virtual_machine') filterset = filtersets.ServiceFilterSet @@ -1348,6 +1432,7 @@ class ServiceView(generic.ObjectView): queryset = Service.objects.all() +@register_model_view(Service, 'add', detail=False) class ServiceCreateView(generic.ObjectEditView): queryset = Service.objects.all() form = forms.ServiceCreateForm @@ -1364,11 +1449,13 @@ class ServiceDeleteView(generic.ObjectDeleteView): queryset = Service.objects.all() +@register_model_view(Service, 'import', detail=False) class ServiceBulkImportView(generic.BulkImportView): queryset = Service.objects.all() model_form = forms.ServiceImportForm +@register_model_view(Service, 'bulk_edit', path='edit', detail=False) class ServiceBulkEditView(generic.BulkEditView): queryset = Service.objects.prefetch_related('device', 'virtual_machine') filterset = filtersets.ServiceFilterSet @@ -1376,6 +1463,7 @@ class ServiceBulkEditView(generic.BulkEditView): form = forms.ServiceBulkEditForm +@register_model_view(Service, 'bulk_delete', path='delete', detail=False) class ServiceBulkDeleteView(generic.BulkDeleteView): queryset = Service.objects.prefetch_related('device', 'virtual_machine') filterset = filtersets.ServiceFilterSet diff --git a/netbox/tenancy/urls.py b/netbox/tenancy/urls.py index ad9908c62..cd0caabdc 100644 --- a/netbox/tenancy/urls.py +++ b/netbox/tenancy/urls.py @@ -1,57 +1,27 @@ from django.urls import include, path from utilities.urls import get_model_urls -from . import views +from . import views # noqa F401 app_name = 'tenancy' urlpatterns = [ - # Tenant groups - path('tenant-groups/', views.TenantGroupListView.as_view(), name='tenantgroup_list'), - path('tenant-groups/add/', views.TenantGroupEditView.as_view(), name='tenantgroup_add'), - path('tenant-groups/import/', views.TenantGroupBulkImportView.as_view(), name='tenantgroup_import'), - path('tenant-groups/edit/', views.TenantGroupBulkEditView.as_view(), name='tenantgroup_bulk_edit'), - path('tenant-groups/delete/', views.TenantGroupBulkDeleteView.as_view(), name='tenantgroup_bulk_delete'), + path('tenant-groups/', include(get_model_urls('tenancy', 'tenantgroup', detail=False))), path('tenant-groups//', include(get_model_urls('tenancy', 'tenantgroup'))), - # Tenants - path('tenants/', views.TenantListView.as_view(), name='tenant_list'), - path('tenants/add/', views.TenantEditView.as_view(), name='tenant_add'), - path('tenants/import/', views.TenantBulkImportView.as_view(), name='tenant_import'), - path('tenants/edit/', views.TenantBulkEditView.as_view(), name='tenant_bulk_edit'), - path('tenants/delete/', views.TenantBulkDeleteView.as_view(), name='tenant_bulk_delete'), + path('tenants/', include(get_model_urls('tenancy', 'tenant', detail=False))), path('tenants//', include(get_model_urls('tenancy', 'tenant'))), - # Contact groups - path('contact-groups/', views.ContactGroupListView.as_view(), name='contactgroup_list'), - path('contact-groups/add/', views.ContactGroupEditView.as_view(), name='contactgroup_add'), - path('contact-groups/import/', views.ContactGroupBulkImportView.as_view(), name='contactgroup_import'), - path('contact-groups/edit/', views.ContactGroupBulkEditView.as_view(), name='contactgroup_bulk_edit'), - path('contact-groups/delete/', views.ContactGroupBulkDeleteView.as_view(), name='contactgroup_bulk_delete'), + path('contact-groups/', include(get_model_urls('tenancy', 'contactgroup', detail=False))), path('contact-groups//', include(get_model_urls('tenancy', 'contactgroup'))), - # Contact roles - path('contact-roles/', views.ContactRoleListView.as_view(), name='contactrole_list'), - path('contact-roles/add/', views.ContactRoleEditView.as_view(), name='contactrole_add'), - path('contact-roles/import/', views.ContactRoleBulkImportView.as_view(), name='contactrole_import'), - path('contact-roles/edit/', views.ContactRoleBulkEditView.as_view(), name='contactrole_bulk_edit'), - path('contact-roles/delete/', views.ContactRoleBulkDeleteView.as_view(), name='contactrole_bulk_delete'), + path('contact-roles/', include(get_model_urls('tenancy', 'contactrole', detail=False))), path('contact-roles//', include(get_model_urls('tenancy', 'contactrole'))), - # Contacts - path('contacts/', views.ContactListView.as_view(), name='contact_list'), - path('contacts/add/', views.ContactEditView.as_view(), name='contact_add'), - path('contacts/import/', views.ContactBulkImportView.as_view(), name='contact_import'), - path('contacts/edit/', views.ContactBulkEditView.as_view(), name='contact_bulk_edit'), - path('contacts/delete/', views.ContactBulkDeleteView.as_view(), name='contact_bulk_delete'), + path('contacts/', include(get_model_urls('tenancy', 'contact', detail=False))), path('contacts//', include(get_model_urls('tenancy', 'contact'))), - # Contact assignments - path('contact-assignments/', views.ContactAssignmentListView.as_view(), name='contactassignment_list'), - path('contact-assignments/add/', views.ContactAssignmentEditView.as_view(), name='contactassignment_add'), - path('contact-assignments/import/', views.ContactAssignmentBulkImportView.as_view(), name='contactassignment_import'), - path('contact-assignments/edit/', views.ContactAssignmentBulkEditView.as_view(), name='contactassignment_bulk_edit'), - path('contact-assignments/delete/', views.ContactAssignmentBulkDeleteView.as_view(), name='contactassignment_bulk_delete'), + path('contact-assignments/', include(get_model_urls('tenancy', 'contactassignment', detail=False))), path('contact-assignments//', include(get_model_urls('tenancy', 'contactassignment'))), ] diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index 96b2cb071..6f16842f6 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -37,11 +37,12 @@ class ObjectContactsView(generic.ObjectChildrenView): return table + # # Tenant groups # - +@register_model_view(TenantGroup, 'list', path='', detail=False) class TenantGroupListView(generic.ObjectListView): queryset = TenantGroup.objects.add_related_count( TenantGroup.objects.all(), @@ -67,6 +68,7 @@ class TenantGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(TenantGroup, 'add', detail=False) @register_model_view(TenantGroup, 'edit') class TenantGroupEditView(generic.ObjectEditView): queryset = TenantGroup.objects.all() @@ -78,11 +80,13 @@ class TenantGroupDeleteView(generic.ObjectDeleteView): queryset = TenantGroup.objects.all() +@register_model_view(TenantGroup, 'import', detail=False) class TenantGroupBulkImportView(generic.BulkImportView): queryset = TenantGroup.objects.all() model_form = forms.TenantGroupImportForm +@register_model_view(TenantGroup, 'bulk_edit', path='edit', detail=False) class TenantGroupBulkEditView(generic.BulkEditView): queryset = TenantGroup.objects.add_related_count( TenantGroup.objects.all(), @@ -96,6 +100,7 @@ class TenantGroupBulkEditView(generic.BulkEditView): form = forms.TenantGroupBulkEditForm +@register_model_view(TenantGroup, 'bulk_delete', path='delete', detail=False) class TenantGroupBulkDeleteView(generic.BulkDeleteView): queryset = TenantGroup.objects.add_related_count( TenantGroup.objects.all(), @@ -112,6 +117,7 @@ class TenantGroupBulkDeleteView(generic.BulkDeleteView): # Tenants # +@register_model_view(Tenant, 'list', path='', detail=False) class TenantListView(generic.ObjectListView): queryset = Tenant.objects.all() filterset = filtersets.TenantFilterSet @@ -129,6 +135,7 @@ class TenantView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(Tenant, 'add', detail=False) @register_model_view(Tenant, 'edit') class TenantEditView(generic.ObjectEditView): queryset = Tenant.objects.all() @@ -140,11 +147,13 @@ class TenantDeleteView(generic.ObjectDeleteView): queryset = Tenant.objects.all() +@register_model_view(Tenant, 'import', detail=False) class TenantBulkImportView(generic.BulkImportView): queryset = Tenant.objects.all() model_form = forms.TenantImportForm +@register_model_view(Tenant, 'bulk_edit', path='edit', detail=False) class TenantBulkEditView(generic.BulkEditView): queryset = Tenant.objects.all() filterset = filtersets.TenantFilterSet @@ -152,6 +161,7 @@ class TenantBulkEditView(generic.BulkEditView): form = forms.TenantBulkEditForm +@register_model_view(Tenant, 'bulk_delete', path='delete', detail=False) class TenantBulkDeleteView(generic.BulkDeleteView): queryset = Tenant.objects.all() filterset = filtersets.TenantFilterSet @@ -167,6 +177,7 @@ class TenantContactsView(ObjectContactsView): # Contact groups # +@register_model_view(ContactGroup, 'list', path='', detail=False) class ContactGroupListView(generic.ObjectListView): queryset = ContactGroup.objects.add_related_count( ContactGroup.objects.all(), @@ -192,6 +203,7 @@ class ContactGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ContactGroup, 'add', detail=False) @register_model_view(ContactGroup, 'edit') class ContactGroupEditView(generic.ObjectEditView): queryset = ContactGroup.objects.all() @@ -203,11 +215,13 @@ class ContactGroupDeleteView(generic.ObjectDeleteView): queryset = ContactGroup.objects.all() +@register_model_view(ContactGroup, 'import', detail=False) class ContactGroupBulkImportView(generic.BulkImportView): queryset = ContactGroup.objects.all() model_form = forms.ContactGroupImportForm +@register_model_view(ContactGroup, 'bulk_edit', path='edit', detail=False) class ContactGroupBulkEditView(generic.BulkEditView): queryset = ContactGroup.objects.add_related_count( ContactGroup.objects.all(), @@ -221,6 +235,7 @@ class ContactGroupBulkEditView(generic.BulkEditView): form = forms.ContactGroupBulkEditForm +@register_model_view(ContactGroup, 'bulk_delete', path='delete', detail=False) class ContactGroupBulkDeleteView(generic.BulkDeleteView): queryset = ContactGroup.objects.add_related_count( ContactGroup.objects.all(), @@ -237,6 +252,7 @@ class ContactGroupBulkDeleteView(generic.BulkDeleteView): # Contact roles # +@register_model_view(ContactRole, 'list', path='', detail=False) class ContactRoleListView(generic.ObjectListView): queryset = ContactRole.objects.all() filterset = filtersets.ContactRoleFilterSet @@ -254,6 +270,7 @@ class ContactRoleView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ContactRole, 'add', detail=False) @register_model_view(ContactRole, 'edit') class ContactRoleEditView(generic.ObjectEditView): queryset = ContactRole.objects.all() @@ -265,11 +282,13 @@ class ContactRoleDeleteView(generic.ObjectDeleteView): queryset = ContactRole.objects.all() +@register_model_view(ContactRole, 'import', detail=False) class ContactRoleBulkImportView(generic.BulkImportView): queryset = ContactRole.objects.all() model_form = forms.ContactRoleImportForm +@register_model_view(ContactRole, 'bulk_edit', path='edit', detail=False) class ContactRoleBulkEditView(generic.BulkEditView): queryset = ContactRole.objects.all() filterset = filtersets.ContactRoleFilterSet @@ -277,6 +296,7 @@ class ContactRoleBulkEditView(generic.BulkEditView): form = forms.ContactRoleBulkEditForm +@register_model_view(ContactRole, 'bulk_delete', path='delete', detail=False) class ContactRoleBulkDeleteView(generic.BulkDeleteView): queryset = ContactRole.objects.all() filterset = filtersets.ContactRoleFilterSet @@ -287,6 +307,7 @@ class ContactRoleBulkDeleteView(generic.BulkDeleteView): # Contacts # +@register_model_view(Contact, 'list', path='', detail=False) class ContactListView(generic.ObjectListView): queryset = Contact.objects.annotate( assignment_count=count_related(ContactAssignment, 'contact') @@ -301,6 +322,7 @@ class ContactView(generic.ObjectView): queryset = Contact.objects.all() +@register_model_view(Contact, 'add', detail=False) @register_model_view(Contact, 'edit') class ContactEditView(generic.ObjectEditView): queryset = Contact.objects.all() @@ -312,11 +334,13 @@ class ContactDeleteView(generic.ObjectDeleteView): queryset = Contact.objects.all() +@register_model_view(Contact, 'import', detail=False) class ContactBulkImportView(generic.BulkImportView): queryset = Contact.objects.all() model_form = forms.ContactImportForm +@register_model_view(Contact, 'bulk_edit', path='edit', detail=False) class ContactBulkEditView(generic.BulkEditView): queryset = Contact.objects.annotate( assignment_count=count_related(ContactAssignment, 'contact') @@ -326,6 +350,7 @@ class ContactBulkEditView(generic.BulkEditView): form = forms.ContactBulkEditForm +@register_model_view(Contact, 'bulk_delete', path='delete', detail=False) class ContactBulkDeleteView(generic.BulkDeleteView): queryset = Contact.objects.annotate( assignment_count=count_related(ContactAssignment, 'contact') @@ -333,11 +358,12 @@ class ContactBulkDeleteView(generic.BulkDeleteView): filterset = filtersets.ContactFilterSet table = tables.ContactTable + # # Contact assignments # - +@register_model_view(ContactAssignment, 'list', path='', detail=False) class ContactAssignmentListView(generic.ObjectListView): queryset = ContactAssignment.objects.all() filterset = filtersets.ContactAssignmentFilterSet @@ -351,6 +377,7 @@ class ContactAssignmentListView(generic.ObjectListView): } +@register_model_view(ContactAssignment, 'add', detail=False) @register_model_view(ContactAssignment, 'edit') class ContactAssignmentEditView(generic.ObjectEditView): queryset = ContactAssignment.objects.all() @@ -370,6 +397,13 @@ class ContactAssignmentEditView(generic.ObjectEditView): } +@register_model_view(ContactAssignment, 'import', detail=False) +class ContactAssignmentBulkImportView(generic.BulkImportView): + queryset = ContactAssignment.objects.all() + model_form = forms.ContactAssignmentImportForm + + +@register_model_view(ContactAssignment, 'bulk_edit', path='edit', detail=False) class ContactAssignmentBulkEditView(generic.BulkEditView): queryset = ContactAssignment.objects.all() filterset = filtersets.ContactAssignmentFilterSet @@ -377,11 +411,7 @@ class ContactAssignmentBulkEditView(generic.BulkEditView): form = forms.ContactAssignmentBulkEditForm -class ContactAssignmentBulkImportView(generic.BulkImportView): - queryset = ContactAssignment.objects.all() - model_form = forms.ContactAssignmentImportForm - - +@register_model_view(ContactAssignment, 'bulk_delete', path='delete', detail=False) class ContactAssignmentBulkDeleteView(generic.BulkDeleteView): queryset = ContactAssignment.objects.all() filterset = filtersets.ContactAssignmentFilterSet diff --git a/netbox/users/urls.py b/netbox/users/urls.py index 0540eae1f..83f120702 100644 --- a/netbox/users/urls.py +++ b/netbox/users/urls.py @@ -1,40 +1,21 @@ from django.urls import include, path from utilities.urls import get_model_urls -from . import views +from . import views # noqa F401 app_name = 'users' urlpatterns = [ - # Tokens - path('tokens/', views.TokenListView.as_view(), name='token_list'), - path('tokens/add/', views.TokenEditView.as_view(), name='token_add'), - path('tokens/import/', views.TokenBulkImportView.as_view(), name='token_import'), - path('tokens/edit/', views.TokenBulkEditView.as_view(), name='token_bulk_edit'), - path('tokens/delete/', views.TokenBulkDeleteView.as_view(), name='token_bulk_delete'), + path('tokens/', include(get_model_urls('users', 'token', detail=False))), path('tokens//', include(get_model_urls('users', 'token'))), - # Users - path('users/', views.UserListView.as_view(), name='user_list'), - path('users/add/', views.UserEditView.as_view(), name='user_add'), - path('users/edit/', views.UserBulkEditView.as_view(), name='user_bulk_edit'), - path('users/import/', views.UserBulkImportView.as_view(), name='user_import'), - path('users/delete/', views.UserBulkDeleteView.as_view(), name='user_bulk_delete'), + path('users/', include(get_model_urls('users', 'user', detail=False))), path('users//', include(get_model_urls('users', 'user'))), - # Groups - path('groups/', views.GroupListView.as_view(), name='group_list'), - path('groups/add/', views.GroupEditView.as_view(), name='group_add'), - path('groups/edit/', views.GroupBulkEditView.as_view(), name='group_bulk_edit'), - path('groups/import/', views.GroupBulkImportView.as_view(), name='group_import'), - path('groups/delete/', views.GroupBulkDeleteView.as_view(), name='group_bulk_delete'), + path('groups/', include(get_model_urls('users', 'group', detail=False))), path('groups//', include(get_model_urls('users', 'group'))), - # Permissions - path('permissions/', views.ObjectPermissionListView.as_view(), name='objectpermission_list'), - path('permissions/add/', views.ObjectPermissionEditView.as_view(), name='objectpermission_add'), - path('permissions/edit/', views.ObjectPermissionBulkEditView.as_view(), name='objectpermission_bulk_edit'), - path('permissions/delete/', views.ObjectPermissionBulkDeleteView.as_view(), name='objectpermission_bulk_delete'), + path('permissions/', include(get_model_urls('users', 'objectpermission', detail=False))), path('permissions//', include(get_model_urls('users', 'objectpermission'))), ] diff --git a/netbox/users/views.py b/netbox/users/views.py index b2f9a8d04..904a44674 100644 --- a/netbox/users/views.py +++ b/netbox/users/views.py @@ -12,6 +12,7 @@ from .models import Group, User, ObjectPermission, Token # Tokens # +@register_model_view(Token, 'list', path='', detail=False) class TokenListView(generic.ObjectListView): queryset = Token.objects.all() filterset = filtersets.TokenFilterSet @@ -24,6 +25,7 @@ class TokenView(generic.ObjectView): queryset = Token.objects.all() +@register_model_view(Token, 'add', detail=False) @register_model_view(Token, 'edit') class TokenEditView(generic.ObjectEditView): queryset = Token.objects.all() @@ -36,17 +38,20 @@ class TokenDeleteView(generic.ObjectDeleteView): queryset = Token.objects.all() +@register_model_view(Token, 'import', detail=False) class TokenBulkImportView(generic.BulkImportView): queryset = Token.objects.all() model_form = forms.TokenImportForm +@register_model_view(Token, 'bulk_edit', path='edit', detail=False) class TokenBulkEditView(generic.BulkEditView): queryset = Token.objects.all() table = tables.TokenTable form = forms.TokenBulkEditForm +@register_model_view(Token, 'bulk_delete', path='delete', detail=False) class TokenBulkDeleteView(generic.BulkDeleteView): queryset = Token.objects.all() table = tables.TokenTable @@ -56,6 +61,7 @@ class TokenBulkDeleteView(generic.BulkDeleteView): # Users # +@register_model_view(User, 'list', path='', detail=False) class UserListView(generic.ObjectListView): queryset = User.objects.all() filterset = filtersets.UserFilterSet @@ -77,6 +83,7 @@ class UserView(generic.ObjectView): } +@register_model_view(User, 'add', detail=False) @register_model_view(User, 'edit') class UserEditView(generic.ObjectEditView): queryset = User.objects.all() @@ -88,6 +95,13 @@ class UserDeleteView(generic.ObjectDeleteView): queryset = User.objects.all() +@register_model_view(User, 'import', detail=False) +class UserBulkImportView(generic.BulkImportView): + queryset = User.objects.all() + model_form = forms.UserImportForm + + +@register_model_view(User, 'bulk_edit', path='edit', detail=False) class UserBulkEditView(generic.BulkEditView): queryset = User.objects.all() filterset = filtersets.UserFilterSet @@ -95,11 +109,7 @@ class UserBulkEditView(generic.BulkEditView): form = forms.UserBulkEditForm -class UserBulkImportView(generic.BulkImportView): - queryset = User.objects.all() - model_form = forms.UserImportForm - - +@register_model_view(User, 'bulk_delete', path='delete', detail=False) class UserBulkDeleteView(generic.BulkDeleteView): queryset = User.objects.all() filterset = filtersets.UserFilterSet @@ -110,6 +120,7 @@ class UserBulkDeleteView(generic.BulkDeleteView): # Groups # +@register_model_view(Group, 'list', path='', detail=False) class GroupListView(generic.ObjectListView): queryset = Group.objects.annotate(users_count=Count('user')).order_by('name') filterset = filtersets.GroupFilterSet @@ -123,6 +134,7 @@ class GroupView(generic.ObjectView): template_name = 'users/group.html' +@register_model_view(Group, 'add', detail=False) @register_model_view(Group, 'edit') class GroupEditView(generic.ObjectEditView): queryset = Group.objects.all() @@ -134,11 +146,13 @@ class GroupDeleteView(generic.ObjectDeleteView): queryset = Group.objects.all() +@register_model_view(Group, 'import', detail=False) class GroupBulkImportView(generic.BulkImportView): queryset = Group.objects.all() model_form = forms.GroupImportForm +@register_model_view(Group, 'bulk_edit', path='edit', detail=False) class GroupBulkEditView(generic.BulkEditView): queryset = Group.objects.all() filterset = filtersets.GroupFilterSet @@ -146,6 +160,7 @@ class GroupBulkEditView(generic.BulkEditView): form = forms.GroupBulkEditForm +@register_model_view(Group, 'bulk_delete', path='delete', detail=False) class GroupBulkDeleteView(generic.BulkDeleteView): queryset = Group.objects.annotate(users_count=Count('user')).order_by('name') filterset = filtersets.GroupFilterSet @@ -156,6 +171,7 @@ class GroupBulkDeleteView(generic.BulkDeleteView): # ObjectPermissions # +@register_model_view(ObjectPermission, 'list', path='', detail=False) class ObjectPermissionListView(generic.ObjectListView): queryset = ObjectPermission.objects.all() filterset = filtersets.ObjectPermissionFilterSet @@ -169,6 +185,7 @@ class ObjectPermissionView(generic.ObjectView): template_name = 'users/objectpermission.html' +@register_model_view(ObjectPermission, 'add', detail=False) @register_model_view(ObjectPermission, 'edit') class ObjectPermissionEditView(generic.ObjectEditView): queryset = ObjectPermission.objects.all() @@ -180,6 +197,7 @@ class ObjectPermissionDeleteView(generic.ObjectDeleteView): queryset = ObjectPermission.objects.all() +@register_model_view(ObjectPermission, 'bulk_edit', path='edit', detail=False) class ObjectPermissionBulkEditView(generic.BulkEditView): queryset = ObjectPermission.objects.all() filterset = filtersets.ObjectPermissionFilterSet @@ -187,6 +205,7 @@ class ObjectPermissionBulkEditView(generic.BulkEditView): form = forms.ObjectPermissionBulkEditForm +@register_model_view(ObjectPermission, 'bulk_delete', path='delete', detail=False) class ObjectPermissionBulkDeleteView(generic.BulkDeleteView): queryset = ObjectPermission.objects.all() filterset = filtersets.ObjectPermissionFilterSet diff --git a/netbox/utilities/urls.py b/netbox/utilities/urls.py index a1132d81c..77968eb87 100644 --- a/netbox/utilities/urls.py +++ b/netbox/utilities/urls.py @@ -9,22 +9,27 @@ __all__ = ( ) -def get_model_urls(app_label, model_name): +def get_model_urls(app_label, model_name, detail=True): """ Return a list of URL paths for detail views registered to the given model. Args: app_label: App/plugin name model_name: Model name + detail: If True (default), return only URL views for an individual object. + Otherwise, return only list views. """ paths = [] # Retrieve registered views for this model try: - views = registry['views'][app_label][model_name] + views = [ + view for view in registry['views'][app_label][model_name] + if view['detail'] == detail + ] except KeyError: # No views have been registered for this model - views = [] + return [] for config in views: # Import the view class or function diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index f7181ea92..b3334ca87 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -272,7 +272,7 @@ def get_viewname(model, action=None, rest_api=False): return viewname -def register_model_view(model, name='', path=None, kwargs=None): +def register_model_view(model, name='', path=None, detail=True, kwargs=None): """ This decorator can be used to "attach" a view to any model in NetBox. This is typically used to inject additional tabs within a model's detail view. For example, to add a custom tab to NetBox's dcim.Site model: @@ -289,6 +289,7 @@ def register_model_view(model, name='', path=None, kwargs=None): name: The string used to form the view's name for URL resolution (e.g. via `reverse()`). This will be appended to the name of the base view for the model using an underscore. If blank, the model name will be used. path: The URL path by which the view can be reached (optional). If not provided, `name` will be used. + detail: True if the path applied to an individual object; False if it attaches to the base (list) path. kwargs: A dictionary of keyword arguments for the view to include when registering its URL path (optional). """ def _wrapper(cls): @@ -301,7 +302,8 @@ def register_model_view(model, name='', path=None, kwargs=None): registry['views'][app_label][model_name].append({ 'name': name, 'view': cls, - 'path': path or name, + 'path': path if path is not None else name, + 'detail': detail, 'kwargs': kwargs or {}, }) diff --git a/netbox/virtualization/urls.py b/netbox/virtualization/urls.py index 6d90645a3..2aeeead77 100644 --- a/netbox/virtualization/urls.py +++ b/netbox/virtualization/urls.py @@ -6,57 +6,33 @@ from . import views app_name = 'virtualization' urlpatterns = [ - # Cluster types - path('cluster-types/', views.ClusterTypeListView.as_view(), name='clustertype_list'), - path('cluster-types/add/', views.ClusterTypeEditView.as_view(), name='clustertype_add'), - path('cluster-types/import/', views.ClusterTypeBulkImportView.as_view(), name='clustertype_import'), - path('cluster-types/edit/', views.ClusterTypeBulkEditView.as_view(), name='clustertype_bulk_edit'), - path('cluster-types/delete/', views.ClusterTypeBulkDeleteView.as_view(), name='clustertype_bulk_delete'), + path('cluster-types/', include(get_model_urls('virtualization', 'clustertype', detail=False))), path('cluster-types//', include(get_model_urls('virtualization', 'clustertype'))), - # Cluster groups - path('cluster-groups/', views.ClusterGroupListView.as_view(), name='clustergroup_list'), - path('cluster-groups/add/', views.ClusterGroupEditView.as_view(), name='clustergroup_add'), - path('cluster-groups/import/', views.ClusterGroupBulkImportView.as_view(), name='clustergroup_import'), - path('cluster-groups/edit/', views.ClusterGroupBulkEditView.as_view(), name='clustergroup_bulk_edit'), - path('cluster-groups/delete/', views.ClusterGroupBulkDeleteView.as_view(), name='clustergroup_bulk_delete'), + path('cluster-groups/', include(get_model_urls('virtualization', 'clustergroup', detail=False))), path('cluster-groups//', include(get_model_urls('virtualization', 'clustergroup'))), - # Clusters - path('clusters/', views.ClusterListView.as_view(), name='cluster_list'), - path('clusters/add/', views.ClusterEditView.as_view(), name='cluster_add'), - path('clusters/import/', views.ClusterBulkImportView.as_view(), name='cluster_import'), - path('clusters/edit/', views.ClusterBulkEditView.as_view(), name='cluster_bulk_edit'), - path('clusters/delete/', views.ClusterBulkDeleteView.as_view(), name='cluster_bulk_delete'), + path('clusters/', include(get_model_urls('virtualization', 'cluster', detail=False))), path('clusters//', include(get_model_urls('virtualization', 'cluster'))), - # Virtual machines - path('virtual-machines/', views.VirtualMachineListView.as_view(), name='virtualmachine_list'), - path('virtual-machines/add/', views.VirtualMachineEditView.as_view(), name='virtualmachine_add'), - path('virtual-machines/import/', views.VirtualMachineBulkImportView.as_view(), name='virtualmachine_import'), - path('virtual-machines/edit/', views.VirtualMachineBulkEditView.as_view(), name='virtualmachine_bulk_edit'), - path('virtual-machines/delete/', views.VirtualMachineBulkDeleteView.as_view(), name='virtualmachine_bulk_delete'), + path('virtual-machines/', include(get_model_urls('virtualization', 'virtualmachine', detail=False))), path('virtual-machines//', include(get_model_urls('virtualization', 'virtualmachine'))), - # VM interfaces - path('interfaces/', views.VMInterfaceListView.as_view(), name='vminterface_list'), - path('interfaces/add/', views.VMInterfaceCreateView.as_view(), name='vminterface_add'), - path('interfaces/import/', views.VMInterfaceBulkImportView.as_view(), name='vminterface_import'), - path('interfaces/edit/', views.VMInterfaceBulkEditView.as_view(), name='vminterface_bulk_edit'), - path('interfaces/rename/', views.VMInterfaceBulkRenameView.as_view(), name='vminterface_bulk_rename'), - path('interfaces/delete/', views.VMInterfaceBulkDeleteView.as_view(), name='vminterface_bulk_delete'), + path('interfaces/', include(get_model_urls('virtualization', 'vminterface', detail=False))), path('interfaces//', include(get_model_urls('virtualization', 'vminterface'))), - path('virtual-machines/interfaces/add/', views.VirtualMachineBulkAddInterfaceView.as_view(), name='virtualmachine_bulk_add_vminterface'), + path( + 'virtual-machines/interfaces/add/', + views.VirtualMachineBulkAddInterfaceView.as_view(), + name='virtualmachine_bulk_add_vminterface' + ), - # Virtual disks - path('virtual-disks/', views.VirtualDiskListView.as_view(), name='virtualdisk_list'), - path('virtual-disks/add/', views.VirtualDiskCreateView.as_view(), name='virtualdisk_add'), - path('virtual-disks/import/', views.VirtualDiskBulkImportView.as_view(), name='virtualdisk_import'), - path('virtual-disks/edit/', views.VirtualDiskBulkEditView.as_view(), name='virtualdisk_bulk_edit'), - path('virtual-disks/rename/', views.VirtualDiskBulkRenameView.as_view(), name='virtualdisk_bulk_rename'), - path('virtual-disks/delete/', views.VirtualDiskBulkDeleteView.as_view(), name='virtualdisk_bulk_delete'), + path('virtual-disks/', include(get_model_urls('virtualization', 'virtualdisk', detail=False))), path('virtual-disks//', include(get_model_urls('virtualization', 'virtualdisk'))), - path('virtual-machines/disks/add/', views.VirtualMachineBulkAddVirtualDiskView.as_view(), name='virtualmachine_bulk_add_virtualdisk'), + path( + 'virtual-machines/disks/add/', + views.VirtualMachineBulkAddVirtualDiskView.as_view(), + name='virtualmachine_bulk_add_virtualdisk' + ), # TODO: Remove in v4.2 # Redirect old (pre-v4.1) URLs for VirtualDisk views diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 35f2f8f75..605de0911 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -31,6 +31,7 @@ from .models import * # Cluster types # +@register_model_view(ClusterType, 'list', path='', detail=False) class ClusterTypeListView(generic.ObjectListView): queryset = ClusterType.objects.annotate( cluster_count=count_related(Cluster, 'type') @@ -50,6 +51,7 @@ class ClusterTypeView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ClusterType, 'add', detail=False) @register_model_view(ClusterType, 'edit') class ClusterTypeEditView(generic.ObjectEditView): queryset = ClusterType.objects.all() @@ -61,11 +63,13 @@ class ClusterTypeDeleteView(generic.ObjectDeleteView): queryset = ClusterType.objects.all() +@register_model_view(ClusterType, 'import', detail=False) class ClusterTypeBulkImportView(generic.BulkImportView): queryset = ClusterType.objects.all() model_form = forms.ClusterTypeImportForm +@register_model_view(ClusterType, 'bulk_edit', path='edit', detail=False) class ClusterTypeBulkEditView(generic.BulkEditView): queryset = ClusterType.objects.annotate( cluster_count=count_related(Cluster, 'type') @@ -75,6 +79,7 @@ class ClusterTypeBulkEditView(generic.BulkEditView): form = forms.ClusterTypeBulkEditForm +@register_model_view(ClusterType, 'bulk_delete', path='delete', detail=False) class ClusterTypeBulkDeleteView(generic.BulkDeleteView): queryset = ClusterType.objects.annotate( cluster_count=count_related(Cluster, 'type') @@ -87,6 +92,7 @@ class ClusterTypeBulkDeleteView(generic.BulkDeleteView): # Cluster groups # +@register_model_view(ClusterGroup, 'list', path='', detail=False) class ClusterGroupListView(generic.ObjectListView): queryset = ClusterGroup.objects.annotate( cluster_count=count_related(Cluster, 'group') @@ -106,6 +112,7 @@ class ClusterGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(ClusterGroup, 'add', detail=False) @register_model_view(ClusterGroup, 'edit') class ClusterGroupEditView(generic.ObjectEditView): queryset = ClusterGroup.objects.all() @@ -117,6 +124,7 @@ class ClusterGroupDeleteView(generic.ObjectDeleteView): queryset = ClusterGroup.objects.all() +@register_model_view(ClusterGroup, 'import', detail=False) class ClusterGroupBulkImportView(generic.BulkImportView): queryset = ClusterGroup.objects.annotate( cluster_count=count_related(Cluster, 'group') @@ -124,6 +132,7 @@ class ClusterGroupBulkImportView(generic.BulkImportView): model_form = forms.ClusterGroupImportForm +@register_model_view(ClusterGroup, 'bulk_edit', path='edit', detail=False) class ClusterGroupBulkEditView(generic.BulkEditView): queryset = ClusterGroup.objects.annotate( cluster_count=count_related(Cluster, 'group') @@ -133,6 +142,7 @@ class ClusterGroupBulkEditView(generic.BulkEditView): form = forms.ClusterGroupBulkEditForm +@register_model_view(ClusterGroup, 'bulk_delete', path='delete', detail=False) class ClusterGroupBulkDeleteView(generic.BulkDeleteView): queryset = ClusterGroup.objects.annotate( cluster_count=count_related(Cluster, 'group') @@ -150,6 +160,7 @@ class ClusterGroupContactsView(ObjectContactsView): # Clusters # +@register_model_view(Cluster, 'list', path='', detail=False) class ClusterListView(generic.ObjectListView): permission_required = 'virtualization.view_cluster' queryset = Cluster.objects.annotate( @@ -213,6 +224,7 @@ class ClusterDevicesView(generic.ObjectChildrenView): return Device.objects.restrict(request.user, 'view').filter(cluster=parent) +@register_model_view(Cluster, 'add', detail=False) @register_model_view(Cluster, 'edit') class ClusterEditView(generic.ObjectEditView): queryset = Cluster.objects.all() @@ -224,11 +236,13 @@ class ClusterDeleteView(generic.ObjectDeleteView): queryset = Cluster.objects.all() +@register_model_view(Cluster, 'import', detail=False) class ClusterBulkImportView(generic.BulkImportView): queryset = Cluster.objects.all() model_form = forms.ClusterImportForm +@register_model_view(Cluster, 'bulk_edit', path='edit', detail=False) class ClusterBulkEditView(generic.BulkEditView): queryset = Cluster.objects.all() filterset = filtersets.ClusterFilterSet @@ -236,6 +250,7 @@ class ClusterBulkEditView(generic.BulkEditView): form = forms.ClusterBulkEditForm +@register_model_view(Cluster, 'bulk_delete', path='delete', detail=False) class ClusterBulkDeleteView(generic.BulkDeleteView): queryset = Cluster.objects.all() filterset = filtersets.ClusterFilterSet @@ -337,6 +352,7 @@ class ClusterContactsView(ObjectContactsView): # Virtual machines # +@register_model_view(VirtualMachine, 'list', path='', detail=False) class VirtualMachineListView(generic.ObjectListView): queryset = VirtualMachine.objects.prefetch_related('primary_ip4', 'primary_ip6') filterset = filtersets.VirtualMachineFilterSet @@ -457,6 +473,7 @@ class VirtualMachineRenderConfigView(generic.ObjectView): } +@register_model_view(VirtualMachine, 'add', detail=False) @register_model_view(VirtualMachine, 'edit') class VirtualMachineEditView(generic.ObjectEditView): queryset = VirtualMachine.objects.all() @@ -468,11 +485,13 @@ class VirtualMachineDeleteView(generic.ObjectDeleteView): queryset = VirtualMachine.objects.all() +@register_model_view(VirtualMachine, 'import', detail=False) class VirtualMachineBulkImportView(generic.BulkImportView): queryset = VirtualMachine.objects.all() model_form = forms.VirtualMachineImportForm +@register_model_view(VirtualMachine, 'bulk_edit', path='edit', detail=False) class VirtualMachineBulkEditView(generic.BulkEditView): queryset = VirtualMachine.objects.prefetch_related('primary_ip4', 'primary_ip6') filterset = filtersets.VirtualMachineFilterSet @@ -480,6 +499,7 @@ class VirtualMachineBulkEditView(generic.BulkEditView): form = forms.VirtualMachineBulkEditForm +@register_model_view(VirtualMachine, 'bulk_delete', path='delete', detail=False) class VirtualMachineBulkDeleteView(generic.BulkDeleteView): queryset = VirtualMachine.objects.prefetch_related('primary_ip4', 'primary_ip6') filterset = filtersets.VirtualMachineFilterSet @@ -495,6 +515,7 @@ class VirtualMachineContactsView(ObjectContactsView): # VM interfaces # +@register_model_view(VMInterface, 'list', path='', detail=False) class VMInterfaceListView(generic.ObjectListView): queryset = VMInterface.objects.all() filterset = filtersets.VMInterfaceFilterSet @@ -545,6 +566,7 @@ class VMInterfaceView(generic.ObjectView): } +@register_model_view(VMInterface, 'add', detail=False) class VMInterfaceCreateView(generic.ComponentCreateView): queryset = VMInterface.objects.all() form = forms.VMInterfaceCreateForm @@ -562,11 +584,13 @@ class VMInterfaceDeleteView(generic.ObjectDeleteView): queryset = VMInterface.objects.all() +@register_model_view(VMInterface, 'import', detail=False) class VMInterfaceBulkImportView(generic.BulkImportView): queryset = VMInterface.objects.all() model_form = forms.VMInterfaceImportForm +@register_model_view(VMInterface, 'bulk_edit', path='edit', detail=False) class VMInterfaceBulkEditView(generic.BulkEditView): queryset = VMInterface.objects.all() filterset = filtersets.VMInterfaceFilterSet @@ -574,11 +598,13 @@ class VMInterfaceBulkEditView(generic.BulkEditView): form = forms.VMInterfaceBulkEditForm +@register_model_view(VMInterface, 'bulk_rename', path='rename', detail=False) class VMInterfaceBulkRenameView(generic.BulkRenameView): queryset = VMInterface.objects.all() form = forms.VMInterfaceBulkRenameForm +@register_model_view(VMInterface, 'bulk_delete', path='delete', detail=False) class VMInterfaceBulkDeleteView(generic.BulkDeleteView): # Ensure child interfaces are deleted prior to their parents queryset = VMInterface.objects.order_by('virtual_machine', 'parent', CollateAsChar('_name')) @@ -590,6 +616,7 @@ class VMInterfaceBulkDeleteView(generic.BulkDeleteView): # Virtual disks # +@register_model_view(VirtualDisk, 'list', path='', detail=False) class VirtualDiskListView(generic.ObjectListView): queryset = VirtualDisk.objects.all() filterset = filtersets.VirtualDiskFilterSet @@ -602,6 +629,7 @@ class VirtualDiskView(generic.ObjectView): queryset = VirtualDisk.objects.all() +@register_model_view(VirtualDisk, 'add', detail=False) class VirtualDiskCreateView(generic.ComponentCreateView): queryset = VirtualDisk.objects.all() form = forms.VirtualDiskCreateForm @@ -619,11 +647,13 @@ class VirtualDiskDeleteView(generic.ObjectDeleteView): queryset = VirtualDisk.objects.all() +@register_model_view(VirtualDisk, 'import', detail=False) class VirtualDiskBulkImportView(generic.BulkImportView): queryset = VirtualDisk.objects.all() model_form = forms.VirtualDiskImportForm +@register_model_view(VirtualDisk, 'bulk_edit', path='edit', detail=False) class VirtualDiskBulkEditView(generic.BulkEditView): queryset = VirtualDisk.objects.all() filterset = filtersets.VirtualDiskFilterSet @@ -631,11 +661,13 @@ class VirtualDiskBulkEditView(generic.BulkEditView): form = forms.VirtualDiskBulkEditForm +@register_model_view(VirtualDisk, 'bulk_rename', path='rename', detail=False) class VirtualDiskBulkRenameView(generic.BulkRenameView): queryset = VirtualDisk.objects.all() form = forms.VirtualDiskBulkRenameForm +@register_model_view(VirtualDisk, 'bulk_delete', path='delete', detail=False) class VirtualDiskBulkDeleteView(generic.BulkDeleteView): queryset = VirtualDisk.objects.all() filterset = filtersets.VirtualDiskFilterSet diff --git a/netbox/vpn/urls.py b/netbox/vpn/urls.py index 552f0e185..1169dcd15 100644 --- a/netbox/vpn/urls.py +++ b/netbox/vpn/urls.py @@ -1,89 +1,39 @@ from django.urls import include, path from utilities.urls import get_model_urls -from . import views +from . import views # noqa F401 app_name = 'vpn' urlpatterns = [ - # Tunnel groups - path('tunnel-groups/', views.TunnelGroupListView.as_view(), name='tunnelgroup_list'), - path('tunnel-groups/add/', views.TunnelGroupEditView.as_view(), name='tunnelgroup_add'), - path('tunnel-groups/import/', views.TunnelGroupBulkImportView.as_view(), name='tunnelgroup_import'), - path('tunnel-groups/edit/', views.TunnelGroupBulkEditView.as_view(), name='tunnelgroup_bulk_edit'), - path('tunnel-groups/delete/', views.TunnelGroupBulkDeleteView.as_view(), name='tunnelgroup_bulk_delete'), + path('tunnel-groups/', include(get_model_urls('vpn', 'tunnelgroup', detail=False))), path('tunnel-groups//', include(get_model_urls('vpn', 'tunnelgroup'))), - # Tunnels - path('tunnels/', views.TunnelListView.as_view(), name='tunnel_list'), - path('tunnels/add/', views.TunnelEditView.as_view(), name='tunnel_add'), - path('tunnels/import/', views.TunnelBulkImportView.as_view(), name='tunnel_import'), - path('tunnels/edit/', views.TunnelBulkEditView.as_view(), name='tunnel_bulk_edit'), - path('tunnels/delete/', views.TunnelBulkDeleteView.as_view(), name='tunnel_bulk_delete'), + path('tunnels/', include(get_model_urls('vpn', 'tunnel', detail=False))), path('tunnels//', include(get_model_urls('vpn', 'tunnel'))), - # Tunnel terminations - path('tunnel-terminations/', views.TunnelTerminationListView.as_view(), name='tunneltermination_list'), - path('tunnel-terminations/add/', views.TunnelTerminationEditView.as_view(), name='tunneltermination_add'), - path('tunnel-terminations/import/', views.TunnelTerminationBulkImportView.as_view(), name='tunneltermination_import'), - path('tunnel-terminations/edit/', views.TunnelTerminationBulkEditView.as_view(), name='tunneltermination_bulk_edit'), - path('tunnel-terminations/delete/', views.TunnelTerminationBulkDeleteView.as_view(), name='tunneltermination_bulk_delete'), + path('tunnel-terminations/', include(get_model_urls('vpn', 'tunneltermination', detail=False))), path('tunnel-terminations//', include(get_model_urls('vpn', 'tunneltermination'))), - # IKE proposals - path('ike-proposals/', views.IKEProposalListView.as_view(), name='ikeproposal_list'), - path('ike-proposals/add/', views.IKEProposalEditView.as_view(), name='ikeproposal_add'), - path('ike-proposals/import/', views.IKEProposalBulkImportView.as_view(), name='ikeproposal_import'), - path('ike-proposals/edit/', views.IKEProposalBulkEditView.as_view(), name='ikeproposal_bulk_edit'), - path('ike-proposals/delete/', views.IKEProposalBulkDeleteView.as_view(), name='ikeproposal_bulk_delete'), + path('ike-proposals/', include(get_model_urls('vpn', 'ikeproposal', detail=False))), path('ike-proposals//', include(get_model_urls('vpn', 'ikeproposal'))), - # IKE policies - path('ike-policies/', views.IKEPolicyListView.as_view(), name='ikepolicy_list'), - path('ike-policies/add/', views.IKEPolicyEditView.as_view(), name='ikepolicy_add'), - path('ike-policies/import/', views.IKEPolicyBulkImportView.as_view(), name='ikepolicy_import'), - path('ike-policies/edit/', views.IKEPolicyBulkEditView.as_view(), name='ikepolicy_bulk_edit'), - path('ike-policies/delete/', views.IKEPolicyBulkDeleteView.as_view(), name='ikepolicy_bulk_delete'), + path('ike-policies/', include(get_model_urls('vpn', 'ikepolicy', detail=False))), path('ike-policies//', include(get_model_urls('vpn', 'ikepolicy'))), - # IPSec proposals - path('ipsec-proposals/', views.IPSecProposalListView.as_view(), name='ipsecproposal_list'), - path('ipsec-proposals/add/', views.IPSecProposalEditView.as_view(), name='ipsecproposal_add'), - path('ipsec-proposals/import/', views.IPSecProposalBulkImportView.as_view(), name='ipsecproposal_import'), - path('ipsec-proposals/edit/', views.IPSecProposalBulkEditView.as_view(), name='ipsecproposal_bulk_edit'), - path('ipsec-proposals/delete/', views.IPSecProposalBulkDeleteView.as_view(), name='ipsecproposal_bulk_delete'), + path('ipsec-proposals/', include(get_model_urls('vpn', 'ipsecproposal', detail=False))), path('ipsec-proposals//', include(get_model_urls('vpn', 'ipsecproposal'))), - # IPSec policies - path('ipsec-policies/', views.IPSecPolicyListView.as_view(), name='ipsecpolicy_list'), - path('ipsec-policies/add/', views.IPSecPolicyEditView.as_view(), name='ipsecpolicy_add'), - path('ipsec-policies/import/', views.IPSecPolicyBulkImportView.as_view(), name='ipsecpolicy_import'), - path('ipsec-policies/edit/', views.IPSecPolicyBulkEditView.as_view(), name='ipsecpolicy_bulk_edit'), - path('ipsec-policies/delete/', views.IPSecPolicyBulkDeleteView.as_view(), name='ipsecpolicy_bulk_delete'), + path('ipsec-policies/', include(get_model_urls('vpn', 'ipsecpolicy', detail=False))), path('ipsec-policies//', include(get_model_urls('vpn', 'ipsecpolicy'))), - # IPSec profiles - path('ipsec-profiles/', views.IPSecProfileListView.as_view(), name='ipsecprofile_list'), - path('ipsec-profiles/add/', views.IPSecProfileEditView.as_view(), name='ipsecprofile_add'), - path('ipsec-profiles/import/', views.IPSecProfileBulkImportView.as_view(), name='ipsecprofile_import'), - path('ipsec-profiles/edit/', views.IPSecProfileBulkEditView.as_view(), name='ipsecprofile_bulk_edit'), - path('ipsec-profiles/delete/', views.IPSecProfileBulkDeleteView.as_view(), name='ipsecprofile_bulk_delete'), + path('ipsec-profiles/', include(get_model_urls('vpn', 'ipsecprofile', detail=False))), path('ipsec-profiles//', include(get_model_urls('vpn', 'ipsecprofile'))), - # L2VPN - path('l2vpns/', views.L2VPNListView.as_view(), name='l2vpn_list'), - path('l2vpns/add/', views.L2VPNEditView.as_view(), name='l2vpn_add'), - path('l2vpns/import/', views.L2VPNBulkImportView.as_view(), name='l2vpn_import'), - path('l2vpns/edit/', views.L2VPNBulkEditView.as_view(), name='l2vpn_bulk_edit'), - path('l2vpns/delete/', views.L2VPNBulkDeleteView.as_view(), name='l2vpn_bulk_delete'), + path('l2vpns/', include(get_model_urls('vpn', 'l2vpn', detail=False))), path('l2vpns//', include(get_model_urls('vpn', 'l2vpn'))), - # L2VPN terminations - path('l2vpn-terminations/', views.L2VPNTerminationListView.as_view(), name='l2vpntermination_list'), - path('l2vpn-terminations/add/', views.L2VPNTerminationEditView.as_view(), name='l2vpntermination_add'), - path('l2vpn-terminations/import/', views.L2VPNTerminationBulkImportView.as_view(), name='l2vpntermination_import'), - path('l2vpn-terminations/edit/', views.L2VPNTerminationBulkEditView.as_view(), name='l2vpntermination_bulk_edit'), - path('l2vpn-terminations/delete/', views.L2VPNTerminationBulkDeleteView.as_view(), name='l2vpntermination_bulk_delete'), + path('l2vpn-terminations/', include(get_model_urls('vpn', 'l2vpntermination', detail=False))), path('l2vpn-terminations//', include(get_model_urls('vpn', 'l2vpntermination'))), ] diff --git a/netbox/vpn/views.py b/netbox/vpn/views.py index ac8ce3667..f1546bfbe 100644 --- a/netbox/vpn/views.py +++ b/netbox/vpn/views.py @@ -11,6 +11,7 @@ from .models import * # Tunnel groups # +@register_model_view(TunnelGroup, 'list', path='', detail=False) class TunnelGroupListView(generic.ObjectListView): queryset = TunnelGroup.objects.annotate( tunnel_count=count_related(Tunnel, 'group') @@ -30,6 +31,7 @@ class TunnelGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(TunnelGroup, 'add', detail=False) @register_model_view(TunnelGroup, 'edit') class TunnelGroupEditView(generic.ObjectEditView): queryset = TunnelGroup.objects.all() @@ -41,11 +43,13 @@ class TunnelGroupDeleteView(generic.ObjectDeleteView): queryset = TunnelGroup.objects.all() +@register_model_view(TunnelGroup, 'import', detail=False) class TunnelGroupBulkImportView(generic.BulkImportView): queryset = TunnelGroup.objects.all() model_form = forms.TunnelGroupImportForm +@register_model_view(TunnelGroup, 'bulk_edit', path='edit', detail=False) class TunnelGroupBulkEditView(generic.BulkEditView): queryset = TunnelGroup.objects.annotate( tunnel_count=count_related(Tunnel, 'group') @@ -55,6 +59,7 @@ class TunnelGroupBulkEditView(generic.BulkEditView): form = forms.TunnelGroupBulkEditForm +@register_model_view(TunnelGroup, 'bulk_delete', path='delete', detail=False) class TunnelGroupBulkDeleteView(generic.BulkDeleteView): queryset = TunnelGroup.objects.annotate( tunnel_count=count_related(Tunnel, 'group') @@ -67,6 +72,7 @@ class TunnelGroupBulkDeleteView(generic.BulkDeleteView): # Tunnels # +@register_model_view(Tunnel, 'list', path='', detail=False) class TunnelListView(generic.ObjectListView): queryset = Tunnel.objects.annotate( count_terminations=count_related(TunnelTermination, 'tunnel') @@ -81,6 +87,7 @@ class TunnelView(generic.ObjectView): queryset = Tunnel.objects.all() +@register_model_view(Tunnel, 'add', detail=False) @register_model_view(Tunnel, 'edit') class TunnelEditView(generic.ObjectEditView): queryset = Tunnel.objects.all() @@ -100,11 +107,13 @@ class TunnelDeleteView(generic.ObjectDeleteView): queryset = Tunnel.objects.all() +@register_model_view(Tunnel, 'import', detail=False) class TunnelBulkImportView(generic.BulkImportView): queryset = Tunnel.objects.all() model_form = forms.TunnelImportForm +@register_model_view(Tunnel, 'bulk_edit', path='edit', detail=False) class TunnelBulkEditView(generic.BulkEditView): queryset = Tunnel.objects.annotate( count_terminations=count_related(TunnelTermination, 'tunnel') @@ -114,6 +123,7 @@ class TunnelBulkEditView(generic.BulkEditView): form = forms.TunnelBulkEditForm +@register_model_view(Tunnel, 'bulk_delete', path='delete', detail=False) class TunnelBulkDeleteView(generic.BulkDeleteView): queryset = Tunnel.objects.annotate( count_terminations=count_related(TunnelTermination, 'tunnel') @@ -126,6 +136,7 @@ class TunnelBulkDeleteView(generic.BulkDeleteView): # Tunnel terminations # +@register_model_view(TunnelTermination, 'list', path='', detail=False) class TunnelTerminationListView(generic.ObjectListView): queryset = TunnelTermination.objects.all() filterset = filtersets.TunnelTerminationFilterSet @@ -138,6 +149,7 @@ class TunnelTerminationView(generic.ObjectView): queryset = TunnelTermination.objects.all() +@register_model_view(TunnelTermination, 'add', detail=False) @register_model_view(TunnelTermination, 'edit') class TunnelTerminationEditView(generic.ObjectEditView): queryset = TunnelTermination.objects.all() @@ -149,11 +161,13 @@ class TunnelTerminationDeleteView(generic.ObjectDeleteView): queryset = TunnelTermination.objects.all() +@register_model_view(TunnelTermination, 'import', detail=False) class TunnelTerminationBulkImportView(generic.BulkImportView): queryset = TunnelTermination.objects.all() model_form = forms.TunnelTerminationImportForm +@register_model_view(TunnelTermination, 'bulk_edit', path='edit', detail=False) class TunnelTerminationBulkEditView(generic.BulkEditView): queryset = TunnelTermination.objects.all() filterset = filtersets.TunnelTerminationFilterSet @@ -161,6 +175,7 @@ class TunnelTerminationBulkEditView(generic.BulkEditView): form = forms.TunnelTerminationBulkEditForm +@register_model_view(TunnelTermination, 'bulk_delete', path='delete', detail=False) class TunnelTerminationBulkDeleteView(generic.BulkDeleteView): queryset = TunnelTermination.objects.all() filterset = filtersets.TunnelTerminationFilterSet @@ -171,6 +186,7 @@ class TunnelTerminationBulkDeleteView(generic.BulkDeleteView): # IKE proposals # +@register_model_view(IKEProposal, 'list', path='', detail=False) class IKEProposalListView(generic.ObjectListView): queryset = IKEProposal.objects.all() filterset = filtersets.IKEProposalFilterSet @@ -183,6 +199,7 @@ class IKEProposalView(generic.ObjectView): queryset = IKEProposal.objects.all() +@register_model_view(IKEProposal, 'add', detail=False) @register_model_view(IKEProposal, 'edit') class IKEProposalEditView(generic.ObjectEditView): queryset = IKEProposal.objects.all() @@ -194,11 +211,13 @@ class IKEProposalDeleteView(generic.ObjectDeleteView): queryset = IKEProposal.objects.all() +@register_model_view(IKEProposal, 'import', detail=False) class IKEProposalBulkImportView(generic.BulkImportView): queryset = IKEProposal.objects.all() model_form = forms.IKEProposalImportForm +@register_model_view(IKEProposal, 'bulk_edit', path='edit', detail=False) class IKEProposalBulkEditView(generic.BulkEditView): queryset = IKEProposal.objects.all() filterset = filtersets.IKEProposalFilterSet @@ -206,6 +225,7 @@ class IKEProposalBulkEditView(generic.BulkEditView): form = forms.IKEProposalBulkEditForm +@register_model_view(IKEProposal, 'bulk_delete', path='delete', detail=False) class IKEProposalBulkDeleteView(generic.BulkDeleteView): queryset = IKEProposal.objects.all() filterset = filtersets.IKEProposalFilterSet @@ -216,6 +236,7 @@ class IKEProposalBulkDeleteView(generic.BulkDeleteView): # IKE policies # +@register_model_view(IKEPolicy, 'list', path='', detail=False) class IKEPolicyListView(generic.ObjectListView): queryset = IKEPolicy.objects.all() filterset = filtersets.IKEPolicyFilterSet @@ -228,6 +249,7 @@ class IKEPolicyView(generic.ObjectView): queryset = IKEPolicy.objects.all() +@register_model_view(IKEPolicy, 'add', detail=False) @register_model_view(IKEPolicy, 'edit') class IKEPolicyEditView(generic.ObjectEditView): queryset = IKEPolicy.objects.all() @@ -239,11 +261,13 @@ class IKEPolicyDeleteView(generic.ObjectDeleteView): queryset = IKEPolicy.objects.all() +@register_model_view(IKEPolicy, 'import', detail=False) class IKEPolicyBulkImportView(generic.BulkImportView): queryset = IKEPolicy.objects.all() model_form = forms.IKEPolicyImportForm +@register_model_view(IKEPolicy, 'bulk_edit', path='edit', detail=False) class IKEPolicyBulkEditView(generic.BulkEditView): queryset = IKEPolicy.objects.all() filterset = filtersets.IKEPolicyFilterSet @@ -251,6 +275,7 @@ class IKEPolicyBulkEditView(generic.BulkEditView): form = forms.IKEPolicyBulkEditForm +@register_model_view(IKEPolicy, 'bulk_delete', path='delete', detail=False) class IKEPolicyBulkDeleteView(generic.BulkDeleteView): queryset = IKEPolicy.objects.all() filterset = filtersets.IKEPolicyFilterSet @@ -261,6 +286,7 @@ class IKEPolicyBulkDeleteView(generic.BulkDeleteView): # IPSec proposals # +@register_model_view(IPSecProposal, 'list', path='', detail=False) class IPSecProposalListView(generic.ObjectListView): queryset = IPSecProposal.objects.all() filterset = filtersets.IPSecProposalFilterSet @@ -273,6 +299,7 @@ class IPSecProposalView(generic.ObjectView): queryset = IPSecProposal.objects.all() +@register_model_view(IPSecProposal, 'add', detail=False) @register_model_view(IPSecProposal, 'edit') class IPSecProposalEditView(generic.ObjectEditView): queryset = IPSecProposal.objects.all() @@ -284,11 +311,13 @@ class IPSecProposalDeleteView(generic.ObjectDeleteView): queryset = IPSecProposal.objects.all() +@register_model_view(IPSecProposal, 'import', detail=False) class IPSecProposalBulkImportView(generic.BulkImportView): queryset = IPSecProposal.objects.all() model_form = forms.IPSecProposalImportForm +@register_model_view(IPSecProposal, 'bulk_edit', path='edit', detail=False) class IPSecProposalBulkEditView(generic.BulkEditView): queryset = IPSecProposal.objects.all() filterset = filtersets.IPSecProposalFilterSet @@ -296,6 +325,7 @@ class IPSecProposalBulkEditView(generic.BulkEditView): form = forms.IPSecProposalBulkEditForm +@register_model_view(IPSecProposal, 'bulk_delete', path='delete', detail=False) class IPSecProposalBulkDeleteView(generic.BulkDeleteView): queryset = IPSecProposal.objects.all() filterset = filtersets.IPSecProposalFilterSet @@ -306,6 +336,7 @@ class IPSecProposalBulkDeleteView(generic.BulkDeleteView): # IPSec policies # +@register_model_view(IPSecPolicy, 'list', path='', detail=False) class IPSecPolicyListView(generic.ObjectListView): queryset = IPSecPolicy.objects.all() filterset = filtersets.IPSecPolicyFilterSet @@ -318,6 +349,7 @@ class IPSecPolicyView(generic.ObjectView): queryset = IPSecPolicy.objects.all() +@register_model_view(IPSecPolicy, 'add', detail=False) @register_model_view(IPSecPolicy, 'edit') class IPSecPolicyEditView(generic.ObjectEditView): queryset = IPSecPolicy.objects.all() @@ -329,11 +361,13 @@ class IPSecPolicyDeleteView(generic.ObjectDeleteView): queryset = IPSecPolicy.objects.all() +@register_model_view(IPSecPolicy, 'import', detail=False) class IPSecPolicyBulkImportView(generic.BulkImportView): queryset = IPSecPolicy.objects.all() model_form = forms.IPSecPolicyImportForm +@register_model_view(IPSecPolicy, 'bulk_edit', path='edit', detail=False) class IPSecPolicyBulkEditView(generic.BulkEditView): queryset = IPSecPolicy.objects.all() filterset = filtersets.IPSecPolicyFilterSet @@ -341,6 +375,7 @@ class IPSecPolicyBulkEditView(generic.BulkEditView): form = forms.IPSecPolicyBulkEditForm +@register_model_view(IPSecPolicy, 'bulk_delete', path='delete', detail=False) class IPSecPolicyBulkDeleteView(generic.BulkDeleteView): queryset = IPSecPolicy.objects.all() filterset = filtersets.IPSecPolicyFilterSet @@ -351,6 +386,7 @@ class IPSecPolicyBulkDeleteView(generic.BulkDeleteView): # IPSec profiles # +@register_model_view(IPSecProfile, 'list', path='', detail=False) class IPSecProfileListView(generic.ObjectListView): queryset = IPSecProfile.objects.all() filterset = filtersets.IPSecProfileFilterSet @@ -363,6 +399,7 @@ class IPSecProfileView(generic.ObjectView): queryset = IPSecProfile.objects.all() +@register_model_view(IPSecProfile, 'add', detail=False) @register_model_view(IPSecProfile, 'edit') class IPSecProfileEditView(generic.ObjectEditView): queryset = IPSecProfile.objects.all() @@ -374,11 +411,13 @@ class IPSecProfileDeleteView(generic.ObjectDeleteView): queryset = IPSecProfile.objects.all() +@register_model_view(IPSecProfile, 'import', detail=False) class IPSecProfileBulkImportView(generic.BulkImportView): queryset = IPSecProfile.objects.all() model_form = forms.IPSecProfileImportForm +@register_model_view(IPSecProfile, 'bulk_edit', path='edit', detail=False) class IPSecProfileBulkEditView(generic.BulkEditView): queryset = IPSecProfile.objects.all() filterset = filtersets.IPSecProfileFilterSet @@ -386,14 +425,18 @@ class IPSecProfileBulkEditView(generic.BulkEditView): form = forms.IPSecProfileBulkEditForm +@register_model_view(IPSecProfile, 'bulk_delete', path='delete', detail=False) class IPSecProfileBulkDeleteView(generic.BulkDeleteView): queryset = IPSecProfile.objects.all() filterset = filtersets.IPSecProfileFilterSet table = tables.IPSecProfileTable +# # L2VPN +# +@register_model_view(L2VPN, 'list', path='', detail=False) class L2VPNListView(generic.ObjectListView): queryset = L2VPN.objects.all() table = tables.L2VPNTable @@ -421,6 +464,7 @@ class L2VPNView(generic.ObjectView): } +@register_model_view(L2VPN, 'add', detail=False) @register_model_view(L2VPN, 'edit') class L2VPNEditView(generic.ObjectEditView): queryset = L2VPN.objects.all() @@ -432,11 +476,13 @@ class L2VPNDeleteView(generic.ObjectDeleteView): queryset = L2VPN.objects.all() +@register_model_view(L2VPN, 'import', detail=False) class L2VPNBulkImportView(generic.BulkImportView): queryset = L2VPN.objects.all() model_form = forms.L2VPNImportForm +@register_model_view(L2VPN, 'bulk_edit', path='edit', detail=False) class L2VPNBulkEditView(generic.BulkEditView): queryset = L2VPN.objects.all() filterset = filtersets.L2VPNFilterSet @@ -444,6 +490,7 @@ class L2VPNBulkEditView(generic.BulkEditView): form = forms.L2VPNBulkEditForm +@register_model_view(L2VPN, 'bulk_delete', path='delete', detail=False) class L2VPNBulkDeleteView(generic.BulkDeleteView): queryset = L2VPN.objects.all() filterset = filtersets.L2VPNFilterSet @@ -459,6 +506,7 @@ class L2VPNContactsView(ObjectContactsView): # L2VPN terminations # +@register_model_view(L2VPNTermination, 'list', path='', detail=False) class L2VPNTerminationListView(generic.ObjectListView): queryset = L2VPNTermination.objects.all() table = tables.L2VPNTerminationTable @@ -471,6 +519,7 @@ class L2VPNTerminationView(generic.ObjectView): queryset = L2VPNTermination.objects.all() +@register_model_view(L2VPNTermination, 'add', detail=False) @register_model_view(L2VPNTermination, 'edit') class L2VPNTerminationEditView(generic.ObjectEditView): queryset = L2VPNTermination.objects.all() @@ -482,11 +531,13 @@ class L2VPNTerminationDeleteView(generic.ObjectDeleteView): queryset = L2VPNTermination.objects.all() +@register_model_view(L2VPNTermination, 'import', detail=False) class L2VPNTerminationBulkImportView(generic.BulkImportView): queryset = L2VPNTermination.objects.all() model_form = forms.L2VPNTerminationImportForm +@register_model_view(L2VPNTermination, 'bulk_edit', path='edit', detail=False) class L2VPNTerminationBulkEditView(generic.BulkEditView): queryset = L2VPNTermination.objects.all() filterset = filtersets.L2VPNTerminationFilterSet @@ -494,6 +545,7 @@ class L2VPNTerminationBulkEditView(generic.BulkEditView): form = forms.L2VPNTerminationBulkEditForm +@register_model_view(L2VPNTermination, 'bulk_delete', path='delete', detail=False) class L2VPNTerminationBulkDeleteView(generic.BulkDeleteView): queryset = L2VPNTermination.objects.all() filterset = filtersets.L2VPNTerminationFilterSet diff --git a/netbox/wireless/urls.py b/netbox/wireless/urls.py index cf8ea5716..ee69c46de 100644 --- a/netbox/wireless/urls.py +++ b/netbox/wireless/urls.py @@ -1,33 +1,18 @@ from django.urls import include, path from utilities.urls import get_model_urls -from . import views +from . import views # noqa F401 app_name = 'wireless' urlpatterns = ( - # Wireless LAN groups - path('wireless-lan-groups/', views.WirelessLANGroupListView.as_view(), name='wirelesslangroup_list'), - path('wireless-lan-groups/add/', views.WirelessLANGroupEditView.as_view(), name='wirelesslangroup_add'), - path('wireless-lan-groups/import/', views.WirelessLANGroupBulkImportView.as_view(), name='wirelesslangroup_import'), - path('wireless-lan-groups/edit/', views.WirelessLANGroupBulkEditView.as_view(), name='wirelesslangroup_bulk_edit'), - path('wireless-lan-groups/delete/', views.WirelessLANGroupBulkDeleteView.as_view(), name='wirelesslangroup_bulk_delete'), + path('wireless-lan-groups/', include(get_model_urls('wireless', 'wirelesslangroup', detail=False))), path('wireless-lan-groups//', include(get_model_urls('wireless', 'wirelesslangroup'))), - # Wireless LANs - path('wireless-lans/', views.WirelessLANListView.as_view(), name='wirelesslan_list'), - path('wireless-lans/add/', views.WirelessLANEditView.as_view(), name='wirelesslan_add'), - path('wireless-lans/import/', views.WirelessLANBulkImportView.as_view(), name='wirelesslan_import'), - path('wireless-lans/edit/', views.WirelessLANBulkEditView.as_view(), name='wirelesslan_bulk_edit'), - path('wireless-lans/delete/', views.WirelessLANBulkDeleteView.as_view(), name='wirelesslan_bulk_delete'), + path('wireless-lans/', include(get_model_urls('wireless', 'wirelesslan', detail=False))), path('wireless-lans//', include(get_model_urls('wireless', 'wirelesslan'))), - # Wireless links - path('wireless-links/', views.WirelessLinkListView.as_view(), name='wirelesslink_list'), - path('wireless-links/add/', views.WirelessLinkEditView.as_view(), name='wirelesslink_add'), - path('wireless-links/import/', views.WirelessLinkBulkImportView.as_view(), name='wirelesslink_import'), - path('wireless-links/edit/', views.WirelessLinkBulkEditView.as_view(), name='wirelesslink_bulk_edit'), - path('wireless-links/delete/', views.WirelessLinkBulkDeleteView.as_view(), name='wirelesslink_bulk_delete'), + path('wireless-links/', include(get_model_urls('wireless', 'wirelesslink', detail=False))), path('wireless-links//', include(get_model_urls('wireless', 'wirelesslink'))), ) diff --git a/netbox/wireless/views.py b/netbox/wireless/views.py index 5063f0fee..6c5ae6f94 100644 --- a/netbox/wireless/views.py +++ b/netbox/wireless/views.py @@ -10,6 +10,7 @@ from .models import * # Wireless LAN groups # +@register_model_view(WirelessLANGroup, 'list', path='', detail=False) class WirelessLANGroupListView(generic.ObjectListView): queryset = WirelessLANGroup.objects.add_related_count( WirelessLANGroup.objects.all(), @@ -35,6 +36,7 @@ class WirelessLANGroupView(GetRelatedModelsMixin, generic.ObjectView): } +@register_model_view(WirelessLANGroup, 'add', detail=False) @register_model_view(WirelessLANGroup, 'edit') class WirelessLANGroupEditView(generic.ObjectEditView): queryset = WirelessLANGroup.objects.all() @@ -46,11 +48,13 @@ class WirelessLANGroupDeleteView(generic.ObjectDeleteView): queryset = WirelessLANGroup.objects.all() +@register_model_view(WirelessLANGroup, 'import', detail=False) class WirelessLANGroupBulkImportView(generic.BulkImportView): queryset = WirelessLANGroup.objects.all() model_form = forms.WirelessLANGroupImportForm +@register_model_view(WirelessLANGroup, 'bulk_edit', path='edit', detail=False) class WirelessLANGroupBulkEditView(generic.BulkEditView): queryset = WirelessLANGroup.objects.add_related_count( WirelessLANGroup.objects.all(), @@ -64,6 +68,7 @@ class WirelessLANGroupBulkEditView(generic.BulkEditView): form = forms.WirelessLANGroupBulkEditForm +@register_model_view(WirelessLANGroup, 'bulk_delete', path='delete', detail=False) class WirelessLANGroupBulkDeleteView(generic.BulkDeleteView): queryset = WirelessLANGroup.objects.add_related_count( WirelessLANGroup.objects.all(), @@ -80,6 +85,7 @@ class WirelessLANGroupBulkDeleteView(generic.BulkDeleteView): # Wireless LANs # +@register_model_view(WirelessLAN, 'list', path='', detail=False) class WirelessLANListView(generic.ObjectListView): queryset = WirelessLAN.objects.annotate( interface_count=count_related(Interface, 'wireless_lans') @@ -105,6 +111,7 @@ class WirelessLANView(generic.ObjectView): } +@register_model_view(WirelessLAN, 'add', detail=False) @register_model_view(WirelessLAN, 'edit') class WirelessLANEditView(generic.ObjectEditView): queryset = WirelessLAN.objects.all() @@ -116,11 +123,13 @@ class WirelessLANDeleteView(generic.ObjectDeleteView): queryset = WirelessLAN.objects.all() +@register_model_view(WirelessLAN, 'import', detail=False) class WirelessLANBulkImportView(generic.BulkImportView): queryset = WirelessLAN.objects.all() model_form = forms.WirelessLANImportForm +@register_model_view(WirelessLAN, 'bulk_edit', path='edit', detail=False) class WirelessLANBulkEditView(generic.BulkEditView): queryset = WirelessLAN.objects.all() filterset = filtersets.WirelessLANFilterSet @@ -128,6 +137,7 @@ class WirelessLANBulkEditView(generic.BulkEditView): form = forms.WirelessLANBulkEditForm +@register_model_view(WirelessLAN, 'bulk_delete', path='delete', detail=False) class WirelessLANBulkDeleteView(generic.BulkDeleteView): queryset = WirelessLAN.objects.all() filterset = filtersets.WirelessLANFilterSet @@ -138,6 +148,7 @@ class WirelessLANBulkDeleteView(generic.BulkDeleteView): # Wireless Links # +@register_model_view(WirelessLink, 'list', path='', detail=False) class WirelessLinkListView(generic.ObjectListView): queryset = WirelessLink.objects.all() filterset = filtersets.WirelessLinkFilterSet @@ -150,6 +161,7 @@ class WirelessLinkView(generic.ObjectView): queryset = WirelessLink.objects.all() +@register_model_view(WirelessLink, 'add', detail=False) @register_model_view(WirelessLink, 'edit') class WirelessLinkEditView(generic.ObjectEditView): queryset = WirelessLink.objects.all() @@ -161,11 +173,13 @@ class WirelessLinkDeleteView(generic.ObjectDeleteView): queryset = WirelessLink.objects.all() +@register_model_view(WirelessLink, 'import', detail=False) class WirelessLinkBulkImportView(generic.BulkImportView): queryset = WirelessLink.objects.all() model_form = forms.WirelessLinkImportForm +@register_model_view(WirelessLink, 'bulk_edit', path='edit', detail=False) class WirelessLinkBulkEditView(generic.BulkEditView): queryset = WirelessLink.objects.all() filterset = filtersets.WirelessLinkFilterSet @@ -173,6 +187,7 @@ class WirelessLinkBulkEditView(generic.BulkEditView): form = forms.WirelessLinkBulkEditForm +@register_model_view(WirelessLink, 'bulk_delete', path='delete', detail=False) class WirelessLinkBulkDeleteView(generic.BulkDeleteView): queryset = WirelessLink.objects.all() filterset = filtersets.WirelessLinkFilterSet From 343a4af59167f93cf546ffca659b115acd267e03 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 21 Nov 2024 15:58:11 -0500 Subject: [PATCH 35/65] Closes #18022: Extend linter (ruff) to enforce line length limit (120 chars) (#18067) * Enable E501 rule * Configure ruff formatter * Reformat migration files to fix line length violations * Fix various E501 errors * Move table template code to template_code.py & ignore E501 errors * Reformat raw SQL --- netbox/circuits/api/serializers_/circuits.py | 11 +- netbox/circuits/filtersets.py | 8 +- netbox/circuits/forms/filtersets.py | 5 +- netbox/circuits/migrations/0001_squashed.py | 11 +- .../circuits/migrations/0002_squashed_0029.py | 71 +- .../circuits/migrations/0003_squashed_0037.py | 3 +- .../circuits/migrations/0038_squashed_0042.py | 45 +- .../migrations/0044_circuit_groups.py | 1 - .../migrations/0045_circuit_distance.py | 1 - .../migrations/0046_charfield_null_choices.py | 6 +- .../0047_circuittermination__termination.py | 16 +- ...48_circuitterminations_cached_relations.py | 8 +- .../migrations/0049_natural_ordering.py | 1 - .../migrations/0050_virtual_circuits.py | 68 +- netbox/circuits/models/circuits.py | 4 +- netbox/circuits/tables/circuits.py | 3 +- netbox/circuits/tests/test_api.py | 12 +- netbox/circuits/tests/test_filtersets.py | 144 +++- netbox/circuits/tests/test_views.py | 12 +- netbox/circuits/urls.py | 30 +- netbox/core/api/schema.py | 5 +- netbox/core/api/serializers_/jobs.py | 4 +- netbox/core/migrations/0001_squashed_0005.py | 96 ++- .../0006_datasource_type_remove_choices.py | 1 - .../migrations/0007_job_add_error_field.py | 1 - .../core/migrations/0008_contenttype_proxy.py | 4 +- netbox/core/migrations/0009_configrevision.py | 1 - netbox/core/migrations/0010_gfk_indexes.py | 1 - .../core/migrations/0011_move_objectchange.py | 43 +- .../0012_job_object_type_optional.py | 3 +- netbox/core/models/files.py | 9 +- netbox/core/models/jobs.py | 12 +- netbox/core/urls.py | 24 +- .../api/serializers_/device_components.py | 6 +- netbox/dcim/filtersets.py | 4 +- netbox/dcim/forms/bulk_import.py | 14 +- netbox/dcim/forms/common.py | 5 +- netbox/dcim/forms/connections.py | 10 +- netbox/dcim/forms/model_forms.py | 26 +- netbox/dcim/forms/object_create.py | 3 +- netbox/dcim/forms/object_import.py | 3 +- netbox/dcim/graphql/types.py | 16 +- netbox/dcim/migrations/0001_squashed.py | 291 ++++++- netbox/dcim/migrations/0002_squashed.py | 273 ++++-- netbox/dcim/migrations/0003_squashed_0130.py | 265 +++++- netbox/dcim/migrations/0131_squashed_0159.py | 536 ++++++++++-- netbox/dcim/migrations/0160_squashed_0166.py | 230 +++++- netbox/dcim/migrations/0167_squashed_0182.py | 159 +++- .../0184_protect_child_interfaces.py | 9 +- netbox/dcim/migrations/0185_gfk_indexes.py | 1 - .../dcim/migrations/0186_location_facility.py | 1 - .../0187_alter_device_vc_position.py | 1 - netbox/dcim/migrations/0188_racktype.py | 48 +- .../0189_moduletype_rack_airflow.py | 1 - netbox/dcim/migrations/0190_nested_modules.py | 42 +- .../migrations/0191_module_bay_rebuild.py | 6 +- .../migrations/0192_inventoryitem_status.py | 1 - .../dcim/migrations/0193_poweroutlet_color.py | 1 - .../migrations/0194_charfield_null_choices.py | 6 +- .../0195_interface_vlan_translation_policy.py | 5 +- netbox/dcim/migrations/0196_qinq_svlan.py | 17 +- .../migrations/0197_natural_sort_collation.py | 7 +- .../dcim/migrations/0198_natural_ordering.py | 1 - netbox/dcim/migrations/0199_macaddress.py | 29 +- .../migrations/0200_populate_mac_addresses.py | 12 +- .../dcim/models/device_component_templates.py | 24 +- netbox/dcim/models/devices.py | 22 +- netbox/dcim/models/racks.py | 4 +- netbox/dcim/svg/racks.py | 5 +- netbox/dcim/tables/devices.py | 14 +- netbox/dcim/tests/test_api.py | 87 +- netbox/dcim/tests/test_cablepaths.py | 262 ++++-- netbox/dcim/tests/test_filtersets.py | 782 ++++++++++++++++-- netbox/dcim/tests/test_models.py | 27 +- netbox/dcim/tests/test_views.py | 169 +++- netbox/dcim/views.py | 16 +- netbox/extras/management/commands/reindex.py | 3 +- netbox/extras/migrations/0001_squashed.py | 114 ++- .../extras/migrations/0002_squashed_0059.py | 1 - .../extras/migrations/0060_squashed_0086.py | 127 ++- .../extras/migrations/0087_squashed_0098.py | 47 +- .../migrations/0099_cachedvalue_ordering.py | 1 - .../migrations/0100_customfield_ui_attrs.py | 6 +- netbox/extras/migrations/0101_eventrule.py | 12 +- .../migrations/0102_move_configrevision.py | 6 +- netbox/extras/migrations/0103_gfk_indexes.py | 13 +- .../0105_customfield_min_max_values.py | 1 - .../0106_bookmark_user_cascade_deletion.py | 1 - ...7_cachedvalue_extras_cachedvalue_object.py | 1 - .../0108_convert_reports_to_scripts.py | 6 +- netbox/extras/migrations/0109_script_model.py | 46 +- ...0110_remove_eventrule_action_parameters.py | 1 - .../migrations/0111_rename_content_types.py | 32 +- .../0112_tag_update_object_types.py | 1 - .../0113_customfield_rename_object_type.py | 1 - .../0114_customfield_add_comments.py | 1 - .../0115_convert_dashboard_widgets.py | 6 +- .../0116_custom_link_button_color.py | 6 +- .../migrations/0117_move_objectchange.py | 80 +- .../migrations/0118_customfield_uniqueness.py | 1 - .../extras/migrations/0119_notifications.py | 42 +- .../migrations/0120_eventrule_event_types.py | 11 +- .../0121_customfield_related_object_filter.py | 1 - .../migrations/0122_charfield_null_choices.py | 6 +- netbox/extras/models/models.py | 5 +- netbox/extras/tests/test_customfields.py | 91 +- netbox/ipam/forms/model_forms.py | 7 +- netbox/ipam/graphql/types.py | 5 +- netbox/ipam/migrations/0001_squashed.py | 140 +++- netbox/ipam/migrations/0002_squashed_0046.py | 108 ++- netbox/ipam/migrations/0047_squashed_0053.py | 98 ++- netbox/ipam/migrations/0054_squashed_0067.py | 147 +++- netbox/ipam/migrations/0068_move_l2vpn.py | 6 +- netbox/ipam/migrations/0069_gfk_indexes.py | 5 +- .../0070_vlangroup_vlan_id_ranges.py | 12 +- netbox/ipam/migrations/0071_prefix_scope.py | 12 +- .../0072_prefix_cached_relations.py | 20 +- .../migrations/0073_charfield_null_choices.py | 6 +- ...antranslationpolicy_vlantranslationrule.py | 53 +- netbox/ipam/migrations/0075_vlan_qinq.py | 9 +- .../ipam/migrations/0076_natural_ordering.py | 1 - netbox/ipam/models/ip.py | 38 +- netbox/ipam/tables/ip.py | 56 +- netbox/ipam/tables/template_code.py | 88 ++ netbox/ipam/tables/vlans.py | 35 +- netbox/ipam/tests/test_api.py | 15 +- netbox/ipam/tests/test_filtersets.py | 238 +++++- netbox/ipam/tests/test_models.py | 70 +- netbox/ipam/tests/test_ordering.py | 71 +- netbox/ipam/tests/test_views.py | 20 +- netbox/netbox/filtersets.py | 4 +- netbox/netbox/tables/columns.py | 6 +- netbox/netbox/views/generic/bulk_views.py | 3 +- netbox/netbox/views/generic/feature_views.py | 7 +- .../tenancy/migrations/0001_squashed_0012.py | 23 +- .../tenancy/migrations/0002_squashed_0011.py | 90 +- .../0012_contactassignment_custom_fields.py | 1 - netbox/tenancy/migrations/0013_gfk_indexes.py | 1 - .../0014_contactassignment_ordering.py | 1 - ...5_contactassignment_rename_content_type.py | 8 +- .../migrations/0016_charfield_null_choices.py | 6 +- .../migrations/0017_natural_ordering.py | 1 - netbox/tenancy/tables/columns.py | 21 +- netbox/tenancy/tables/template_code.py | 19 + netbox/tenancy/tests/test_api.py | 21 +- netbox/users/migrations/0001_squashed_0011.py | 78 +- netbox/users/migrations/0002_squashed_0004.py | 10 +- .../users/migrations/0005_alter_user_table.py | 24 +- .../migrations/0006_custom_group_model.py | 36 +- ...07_objectpermission_update_object_types.py | 20 +- .../0008_flip_objectpermission_assignments.py | 89 +- .../migrations/0009_update_group_perms.py | 6 +- netbox/users/tests/test_filtersets.py | 12 +- netbox/users/tests/test_views.py | 13 +- netbox/utilities/socks.py | 5 +- netbox/utilities/testing/api.py | 5 +- netbox/utilities/tests/test_filters.py | 43 +- .../api/serializers_/clusters.py | 6 +- .../api/serializers_/virtualmachines.py | 8 +- netbox/virtualization/forms/bulk_import.py | 4 +- .../migrations/0001_squashed_0022.py | 160 +++- .../migrations/0023_squashed_0036.py | 82 +- .../0037_protect_child_interfaces.py | 9 +- .../migrations/0038_virtualdisk.py | 30 +- .../0039_virtualmachine_serial_number.py | 1 - .../migrations/0040_convert_disk_size.py | 6 +- .../migrations/0041_charfield_null_choices.py | 6 +- ...042_vminterface_vlan_translation_policy.py | 5 +- .../migrations/0043_qinq_svlan.py | 17 +- .../migrations/0044_cluster_scope.py | 11 +- .../0045_clusters_cached_relations.py | 8 +- ...location_alter_cluster__region_and_more.py | 1 - .../migrations/0047_natural_ordering.py | 1 - .../migrations/0048_populate_mac_addresses.py | 12 +- netbox/virtualization/tables/clusters.py | 4 +- netbox/virtualization/tables/template_code.py | 32 + .../virtualization/tables/virtualmachines.py | 34 +- netbox/virtualization/tests/test_api.py | 43 +- netbox/virtualization/tests/test_views.py | 51 +- netbox/virtualization/views.py | 6 +- netbox/vpn/api/serializers_/crypto.py | 3 +- netbox/vpn/migrations/0001_initial.py | 125 ++- netbox/vpn/migrations/0002_move_l2vpn.py | 63 +- ..._ipaddress_multiple_tunnel_terminations.py | 9 +- .../migrations/0004_alter_ikepolicy_mode.py | 1 - netbox/vpn/migrations/0005_rename_indexes.py | 65 +- .../migrations/0006_charfield_null_choices.py | 6 +- .../vpn/migrations/0007_natural_ordering.py | 1 - .../wireless/api/serializers_/wirelesslans.py | 6 +- netbox/wireless/forms/bulk_import.py | 4 +- .../wireless/migrations/0001_squashed_0008.py | 119 ++- .../migrations/0009_wirelesslink_distance.py | 1 - .../migrations/0010_charfield_null_choices.py | 6 +- ...__location_wirelesslan__region_and_more.py | 1 - ...12_alter_wirelesslan__location_and_more.py | 1 - .../migrations/0013_natural_ordering.py | 1 - netbox/wireless/tables/wirelesslan.py | 3 +- netbox/wireless/tests/test_filtersets.py | 14 +- netbox/wireless/tests/test_views.py | 29 +- ruff.toml | 15 +- 200 files changed, 5928 insertions(+), 1670 deletions(-) create mode 100644 netbox/ipam/tables/template_code.py create mode 100644 netbox/tenancy/tables/template_code.py create mode 100644 netbox/virtualization/tables/template_code.py diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index a68e49483..70644a7b7 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -59,8 +59,8 @@ class CircuitCircuitTerminationSerializer(WritableNestedSerializer): class Meta: model = CircuitTermination fields = [ - 'id', 'url', 'display_url', 'display', 'termination_type', 'termination_id', 'termination', 'provider_network', 'port_speed', 'upstream_speed', - 'xconnect_id', 'description', + 'id', 'url', 'display_url', 'display', 'termination_type', 'termination_id', 'termination', + 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', ] @extend_schema_field(serializers.JSONField(allow_null=True)) @@ -138,9 +138,10 @@ class CircuitTerminationSerializer(NetBoxModelSerializer, CabledObjectSerializer class Meta: model = CircuitTermination fields = [ - 'id', 'url', 'display_url', 'display', 'circuit', 'term_side', 'termination_type', 'termination_id', 'termination', 'provider_network', 'port_speed', - 'upstream_speed', 'xconnect_id', 'pp_info', 'description', 'mark_connected', 'cable', 'cable_end', - 'link_peers', 'link_peers_type', 'tags', 'custom_fields', 'created', 'last_updated', '_occupied', + 'id', 'url', 'display_url', 'display', 'circuit', 'term_side', 'termination_type', 'termination_id', + 'termination', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', + 'mark_connected', 'cable', 'cable_end', 'link_peers', 'link_peers_type', 'tags', 'custom_fields', 'created', + 'last_updated', '_occupied', ] brief_fields = ('id', 'url', 'display', 'circuit', 'term_side', 'description', 'cable', '_occupied') diff --git a/netbox/circuits/filtersets.py b/netbox/circuits/filtersets.py index be36d45ac..825df9558 100644 --- a/netbox/circuits/filtersets.py +++ b/netbox/circuits/filtersets.py @@ -241,7 +241,9 @@ class CircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte class Meta: model = Circuit - fields = ('id', 'cid', 'description', 'install_date', 'termination_date', 'commit_rate', 'distance', 'distance_unit') + fields = ( + 'id', 'cid', 'description', 'install_date', 'termination_date', 'commit_rate', 'distance', 'distance_unit', + ) def search(self, queryset, name, value): if not value.strip(): @@ -336,8 +338,8 @@ class CircuitTerminationFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet): class Meta: model = CircuitTermination fields = ( - 'id', 'termination_id', 'term_side', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', 'mark_connected', - 'pp_info', 'cable_end', + 'id', 'termination_id', 'term_side', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', + 'mark_connected', 'pp_info', 'cable_end', ) def search(self, queryset, name, value): diff --git a/netbox/circuits/forms/filtersets.py b/netbox/circuits/forms/filtersets.py index 00dc6bc5b..47ce24d97 100644 --- a/netbox/circuits/forms/filtersets.py +++ b/netbox/circuits/forms/filtersets.py @@ -121,7 +121,10 @@ class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi fieldsets = ( FieldSet('q', 'filter_id', 'tag'), FieldSet('provider_id', 'provider_account_id', 'provider_network_id', name=_('Provider')), - FieldSet('type_id', 'status', 'install_date', 'termination_date', 'commit_rate', 'distance', 'distance_unit', name=_('Attributes')), + FieldSet( + 'type_id', 'status', 'install_date', 'termination_date', 'commit_rate', 'distance', 'distance_unit', + name=_('Attributes') + ), FieldSet('region_id', 'site_group_id', 'site_id', name=_('Location')), FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')), diff --git a/netbox/circuits/migrations/0001_squashed.py b/netbox/circuits/migrations/0001_squashed.py index 96fa3c086..0b3d729e6 100644 --- a/netbox/circuits/migrations/0001_squashed.py +++ b/netbox/circuits/migrations/0001_squashed.py @@ -5,11 +5,9 @@ import django.db.models.deletion class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] replaces = [ ('circuits', '0001_initial'), @@ -98,7 +96,12 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=100)), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), - ('provider', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='networks', to='circuits.provider')), + ( + 'provider', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='networks', to='circuits.provider' + ), + ), ], options={ 'ordering': ('provider', 'name'), diff --git a/netbox/circuits/migrations/0002_squashed_0029.py b/netbox/circuits/migrations/0002_squashed_0029.py index 11fcbd6e6..cb61d8feb 100644 --- a/netbox/circuits/migrations/0002_squashed_0029.py +++ b/netbox/circuits/migrations/0002_squashed_0029.py @@ -4,7 +4,6 @@ import taggit.managers class Migration(migrations.Migration): - dependencies = [ ('dcim', '0001_initial'), ('contenttypes', '0002_remove_content_type_name'), @@ -58,32 +57,56 @@ class Migration(migrations.Migration): migrations.AddField( model_name='circuittermination', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='circuittermination', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='circuittermination', name='circuit', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='circuits.circuit'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='circuits.circuit' + ), ), migrations.AddField( model_name='circuittermination', name='provider_network', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuit_terminations', to='circuits.providernetwork'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='circuit_terminations', + to='circuits.providernetwork', + ), ), migrations.AddField( model_name='circuittermination', name='site', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuit_terminations', to='dcim.site'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='circuit_terminations', + to='dcim.site', + ), ), migrations.AddField( model_name='circuit', name='provider', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.provider'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.provider' + ), ), migrations.AddField( model_name='circuit', @@ -93,26 +116,50 @@ class Migration(migrations.Migration): migrations.AddField( model_name='circuit', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='circuits', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='circuit', name='termination_a', - field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='circuits.circuittermination'), + field=models.ForeignKey( + blank=True, + editable=False, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='circuits.circuittermination', + ), ), migrations.AddField( model_name='circuit', name='termination_z', - field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='circuits.circuittermination'), + field=models.ForeignKey( + blank=True, + editable=False, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='circuits.circuittermination', + ), ), migrations.AddField( model_name='circuit', name='type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.circuittype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.circuittype' + ), ), migrations.AddConstraint( model_name='providernetwork', - constraint=models.UniqueConstraint(fields=('provider', 'name'), name='circuits_providernetwork_provider_name'), + constraint=models.UniqueConstraint( + fields=('provider', 'name'), name='circuits_providernetwork_provider_name' + ), ), migrations.AlterUniqueTogether( name='providernetwork', diff --git a/netbox/circuits/migrations/0003_squashed_0037.py b/netbox/circuits/migrations/0003_squashed_0037.py index 69c3e1c68..c536e422f 100644 --- a/netbox/circuits/migrations/0003_squashed_0037.py +++ b/netbox/circuits/migrations/0003_squashed_0037.py @@ -5,7 +5,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('circuits', '0003_extend_tag_support'), ('circuits', '0004_rename_cable_peer'), @@ -14,7 +13,7 @@ class Migration(migrations.Migration): ('circuits', '0034_created_datetimefield'), ('circuits', '0035_provider_asns'), ('circuits', '0036_circuit_termination_date_tags_custom_fields'), - ('circuits', '0037_new_cabling_models') + ('circuits', '0037_new_cabling_models'), ] dependencies = [ diff --git a/netbox/circuits/migrations/0038_squashed_0042.py b/netbox/circuits/migrations/0038_squashed_0042.py index f57fde3db..fa944b763 100644 --- a/netbox/circuits/migrations/0038_squashed_0042.py +++ b/netbox/circuits/migrations/0038_squashed_0042.py @@ -6,13 +6,12 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('circuits', '0038_cabling_cleanup'), ('circuits', '0039_unique_constraints'), ('circuits', '0040_provider_remove_deprecated_fields'), ('circuits', '0041_standardize_description_comments'), - ('circuits', '0042_provideraccount') + ('circuits', '0042_provideraccount'), ] dependencies = [ @@ -51,11 +50,15 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='circuittermination', - constraint=models.UniqueConstraint(fields=('circuit', 'term_side'), name='circuits_circuittermination_unique_circuit_term_side'), + constraint=models.UniqueConstraint( + fields=('circuit', 'term_side'), name='circuits_circuittermination_unique_circuit_term_side' + ), ), migrations.AddConstraint( model_name='providernetwork', - constraint=models.UniqueConstraint(fields=('provider', 'name'), name='circuits_providernetwork_unique_provider_name'), + constraint=models.UniqueConstraint( + fields=('provider', 'name'), name='circuits_providernetwork_unique_provider_name' + ), ), migrations.RemoveField( model_name='provider', @@ -84,12 +87,20 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('account', models.CharField(max_length=100)), ('name', models.CharField(blank=True, max_length=100)), - ('provider', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='accounts', to='circuits.provider')), + ( + 'provider', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='accounts', to='circuits.provider' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -98,11 +109,17 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='provideraccount', - constraint=models.UniqueConstraint(condition=models.Q(('name', ''), _negated=True), fields=('provider', 'name'), name='circuits_provideraccount_unique_provider_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('name', ''), _negated=True), + fields=('provider', 'name'), + name='circuits_provideraccount_unique_provider_name', + ), ), migrations.AddConstraint( model_name='provideraccount', - constraint=models.UniqueConstraint(fields=('provider', 'account'), name='circuits_provideraccount_unique_provider_account'), + constraint=models.UniqueConstraint( + fields=('provider', 'account'), name='circuits_provideraccount_unique_provider_account' + ), ), migrations.RemoveField( model_name='provider', @@ -111,7 +128,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='circuit', name='provider_account', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.provideraccount'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='circuits', + to='circuits.provideraccount', + ), preserve_default=False, ), migrations.AlterModelOptions( @@ -120,6 +143,8 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='circuit', - constraint=models.UniqueConstraint(fields=('provider_account', 'cid'), name='circuits_circuit_unique_provideraccount_cid'), + constraint=models.UniqueConstraint( + fields=('provider_account', 'cid'), name='circuits_circuit_unique_provideraccount_cid' + ), ), ] diff --git a/netbox/circuits/migrations/0044_circuit_groups.py b/netbox/circuits/migrations/0044_circuit_groups.py index 98c3b8f3d..08f6bc158 100644 --- a/netbox/circuits/migrations/0044_circuit_groups.py +++ b/netbox/circuits/migrations/0044_circuit_groups.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('circuits', '0043_circuittype_color'), ('extras', '0119_notifications'), diff --git a/netbox/circuits/migrations/0045_circuit_distance.py b/netbox/circuits/migrations/0045_circuit_distance.py index 6c970339d..9e512e7ee 100644 --- a/netbox/circuits/migrations/0045_circuit_distance.py +++ b/netbox/circuits/migrations/0045_circuit_distance.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('circuits', '0044_circuit_groups'), ] diff --git a/netbox/circuits/migrations/0046_charfield_null_choices.py b/netbox/circuits/migrations/0046_charfield_null_choices.py index 4ec21b750..2a8bcde90 100644 --- a/netbox/circuits/migrations/0046_charfield_null_choices.py +++ b/netbox/circuits/migrations/0046_charfield_null_choices.py @@ -15,7 +15,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('circuits', '0045_circuit_distance'), ] @@ -36,8 +35,5 @@ class Migration(migrations.Migration): name='cable_end', field=models.CharField(blank=True, max_length=1, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/circuits/migrations/0047_circuittermination__termination.py b/netbox/circuits/migrations/0047_circuittermination__termination.py index 0cf2b424f..f78e17ec3 100644 --- a/netbox/circuits/migrations/0047_circuittermination__termination.py +++ b/netbox/circuits/migrations/0047_circuittermination__termination.py @@ -11,19 +11,17 @@ def copy_site_assignments(apps, schema_editor): Site = apps.get_model('dcim', 'Site') CircuitTermination.objects.filter(site__isnull=False).update( - termination_type=ContentType.objects.get_for_model(Site), - termination_id=models.F('site_id') + termination_type=ContentType.objects.get_for_model(Site), termination_id=models.F('site_id') ) ProviderNetwork = apps.get_model('circuits', 'ProviderNetwork') CircuitTermination.objects.filter(provider_network__isnull=False).update( termination_type=ContentType.objects.get_for_model(ProviderNetwork), - termination_id=models.F('provider_network_id') + termination_id=models.F('provider_network_id'), ) class Migration(migrations.Migration): - dependencies = [ ('circuits', '0046_charfield_null_choices'), ('contenttypes', '0002_remove_content_type_name'), @@ -41,17 +39,15 @@ class Migration(migrations.Migration): name='termination_type', field=models.ForeignKey( blank=True, - limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location', 'providernetwork'))), + limit_choices_to=models.Q( + ('model__in', ('region', 'sitegroup', 'site', 'location', 'providernetwork')) + ), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype', ), ), - # Copy over existing site assignments - migrations.RunPython( - code=copy_site_assignments, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=copy_site_assignments, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py b/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py index 628579228..fc1cef0e5 100644 --- a/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py +++ b/netbox/circuits/migrations/0048_circuitterminations_cached_relations.py @@ -20,7 +20,6 @@ def populate_denormalized_fields(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('circuits', '0047_circuittermination__termination'), ] @@ -70,13 +69,8 @@ class Migration(migrations.Migration): to='dcim.sitegroup', ), ), - # Populate denormalized FK values - migrations.RunPython( - code=populate_denormalized_fields, - reverse_code=migrations.RunPython.noop - ), - + migrations.RunPython(code=populate_denormalized_fields, reverse_code=migrations.RunPython.noop), # Delete the site ForeignKey migrations.RemoveField( model_name='circuittermination', diff --git a/netbox/circuits/migrations/0049_natural_ordering.py b/netbox/circuits/migrations/0049_natural_ordering.py index 1b4f565e8..556d6ec7c 100644 --- a/netbox/circuits/migrations/0049_natural_ordering.py +++ b/netbox/circuits/migrations/0049_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('circuits', '0048_circuitterminations_cached_relations'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/circuits/migrations/0050_virtual_circuits.py b/netbox/circuits/migrations/0050_virtual_circuits.py index df719b517..eb451b4ec 100644 --- a/netbox/circuits/migrations/0050_virtual_circuits.py +++ b/netbox/circuits/migrations/0050_virtual_circuits.py @@ -6,7 +6,6 @@ import utilities.json class Migration(migrations.Migration): - dependencies = [ ('circuits', '0049_natural_ordering'), ('dcim', '0196_qinq_svlan'), @@ -21,15 +20,43 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('cid', models.CharField(max_length=100)), ('status', models.CharField(default='active', max_length=50)), - ('provider_account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='circuits.provideraccount')), - ('provider_network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='circuits.providernetwork')), + ( + 'provider_account', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_circuits', + to='circuits.provideraccount', + ), + ), + ( + 'provider_network', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_circuits', + to='circuits.providernetwork', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_circuits', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_circuits', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'circuit', @@ -43,12 +70,29 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('role', models.CharField(default='peer', max_length=50)), ('description', models.CharField(blank=True, max_length=200)), - ('interface', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='virtual_circuit_termination', to='dcim.interface')), + ( + 'interface', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name='virtual_circuit_termination', + to='dcim.interface', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('virtual_circuit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='circuits.virtualcircuit')), + ( + 'virtual_circuit', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='terminations', + to='circuits.virtualcircuit', + ), + ), ], options={ 'verbose_name': 'virtual circuit termination', @@ -58,10 +102,14 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='virtualcircuit', - constraint=models.UniqueConstraint(fields=('provider_network', 'cid'), name='circuits_virtualcircuit_unique_provider_network_cid'), + constraint=models.UniqueConstraint( + fields=('provider_network', 'cid'), name='circuits_virtualcircuit_unique_provider_network_cid' + ), ), migrations.AddConstraint( model_name='virtualcircuit', - constraint=models.UniqueConstraint(fields=('provider_account', 'cid'), name='circuits_virtualcircuit_unique_provideraccount_cid'), + constraint=models.UniqueConstraint( + fields=('provider_account', 'cid'), name='circuits_virtualcircuit_unique_provideraccount_cid' + ), ), ] diff --git a/netbox/circuits/models/circuits.py b/netbox/circuits/models/circuits.py index 85b22eaa5..5e910b5d5 100644 --- a/netbox/circuits/models/circuits.py +++ b/netbox/circuits/models/circuits.py @@ -11,7 +11,9 @@ from circuits.constants import * from dcim.models import CabledObjectModel from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel from netbox.models.mixins import DistanceMixin -from netbox.models.features import ContactsMixin, CustomFieldsMixin, CustomLinksMixin, ExportTemplatesMixin, ImageAttachmentsMixin, TagsMixin +from netbox.models.features import ( + ContactsMixin, CustomFieldsMixin, CustomLinksMixin, ExportTemplatesMixin, ImageAttachmentsMixin, TagsMixin, +) from utilities.fields import ColorField __all__ = ( diff --git a/netbox/circuits/tables/circuits.py b/netbox/circuits/tables/circuits.py index ab9c661e6..dedb1534b 100644 --- a/netbox/circuits/tables/circuits.py +++ b/netbox/circuits/tables/circuits.py @@ -42,7 +42,8 @@ class CircuitTypeTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = CircuitType fields = ( - 'pk', 'id', 'name', 'circuit_count', 'color', 'description', 'slug', 'tags', 'created', 'last_updated', 'actions', + 'pk', 'id', 'name', 'circuit_count', 'color', 'description', 'slug', 'tags', 'created', 'last_updated', + 'actions', ) default_columns = ('pk', 'name', 'circuit_count', 'description', 'slug') diff --git a/netbox/circuits/tests/test_api.py b/netbox/circuits/tests/test_api.py index 12c6b2a93..92fbbdedf 100644 --- a/netbox/circuits/tests/test_api.py +++ b/netbox/circuits/tests/test_api.py @@ -121,9 +121,15 @@ class CircuitTest(APIViewTestCases.APIViewTestCase): CircuitType.objects.bulk_create(circuit_types) circuits = ( - Circuit(cid='Circuit 1', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0]), - Circuit(cid='Circuit 2', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0]), - Circuit(cid='Circuit 3', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0]), + Circuit( + cid='Circuit 1', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0] + ), + Circuit( + cid='Circuit 2', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0] + ), + Circuit( + cid='Circuit 3', provider=providers[0], provider_account=provider_accounts[0], type=circuit_types[0] + ), ) Circuit.objects.bulk_create(circuits) diff --git a/netbox/circuits/tests/test_filtersets.py b/netbox/circuits/tests/test_filtersets.py index 01b5e3105..6b7866665 100644 --- a/netbox/circuits/tests/test_filtersets.py +++ b/netbox/circuits/tests/test_filtersets.py @@ -226,12 +226,80 @@ class CircuitTestCase(TestCase, ChangeLoggedFilterSetTests): ProviderNetwork.objects.bulk_create(provider_networks) circuits = ( - Circuit(provider=providers[0], provider_account=provider_accounts[0], tenant=tenants[0], type=circuit_types[0], cid='Test Circuit 1', install_date='2020-01-01', termination_date='2021-01-01', commit_rate=1000, status=CircuitStatusChoices.STATUS_ACTIVE, description='foobar1', distance=10, distance_unit=DistanceUnitChoices.UNIT_FOOT), - Circuit(provider=providers[0], provider_account=provider_accounts[0], tenant=tenants[0], type=circuit_types[0], cid='Test Circuit 2', install_date='2020-01-02', termination_date='2021-01-02', commit_rate=2000, status=CircuitStatusChoices.STATUS_ACTIVE, description='foobar2', distance=20, distance_unit=DistanceUnitChoices.UNIT_METER), - Circuit(provider=providers[0], provider_account=provider_accounts[1], tenant=tenants[1], type=circuit_types[0], cid='Test Circuit 3', install_date='2020-01-03', termination_date='2021-01-03', commit_rate=3000, status=CircuitStatusChoices.STATUS_PLANNED, distance=30, distance_unit=DistanceUnitChoices.UNIT_METER), - Circuit(provider=providers[1], provider_account=provider_accounts[1], tenant=tenants[1], type=circuit_types[1], cid='Test Circuit 4', install_date='2020-01-04', termination_date='2021-01-04', commit_rate=4000, status=CircuitStatusChoices.STATUS_PLANNED), - Circuit(provider=providers[1], provider_account=provider_accounts[2], tenant=tenants[2], type=circuit_types[1], cid='Test Circuit 5', install_date='2020-01-05', termination_date='2021-01-05', commit_rate=5000, status=CircuitStatusChoices.STATUS_OFFLINE), - Circuit(provider=providers[1], provider_account=provider_accounts[2], tenant=tenants[2], type=circuit_types[1], cid='Test Circuit 6', install_date='2020-01-06', termination_date='2021-01-06', commit_rate=6000, status=CircuitStatusChoices.STATUS_OFFLINE), + Circuit( + provider=providers[0], + provider_account=provider_accounts[0], + tenant=tenants[0], + type=circuit_types[0], + cid='Test Circuit 1', + install_date='2020-01-01', + termination_date='2021-01-01', + commit_rate=1000, + status=CircuitStatusChoices.STATUS_ACTIVE, + description='foobar1', + distance=10, + distance_unit=DistanceUnitChoices.UNIT_FOOT, + ), + Circuit( + provider=providers[0], + provider_account=provider_accounts[0], + tenant=tenants[0], + type=circuit_types[0], + cid='Test Circuit 2', + install_date='2020-01-02', + termination_date='2021-01-02', + commit_rate=2000, + status=CircuitStatusChoices.STATUS_ACTIVE, + description='foobar2', + distance=20, + distance_unit=DistanceUnitChoices.UNIT_METER, + ), + Circuit( + provider=providers[0], + provider_account=provider_accounts[1], + tenant=tenants[1], + type=circuit_types[0], + cid='Test Circuit 3', + install_date='2020-01-03', + termination_date='2021-01-03', + commit_rate=3000, + status=CircuitStatusChoices.STATUS_PLANNED, + distance=30, + distance_unit=DistanceUnitChoices.UNIT_METER, + ), + Circuit( + provider=providers[1], + provider_account=provider_accounts[1], + tenant=tenants[1], + type=circuit_types[1], + cid='Test Circuit 4', + install_date='2020-01-04', + termination_date='2021-01-04', + commit_rate=4000, + status=CircuitStatusChoices.STATUS_PLANNED, + ), + Circuit( + provider=providers[1], + provider_account=provider_accounts[2], + tenant=tenants[2], + type=circuit_types[1], + cid='Test Circuit 5', + install_date='2020-01-05', + termination_date='2021-01-05', + commit_rate=5000, + status=CircuitStatusChoices.STATUS_OFFLINE, + ), + Circuit( + provider=providers[1], + provider_account=provider_accounts[2], + tenant=tenants[2], + type=circuit_types[1], + cid='Test Circuit 6', + install_date='2020-01-06', + termination_date='2021-01-06', + commit_rate=6000, + status=CircuitStatusChoices.STATUS_OFFLINE, + ), ) Circuit.objects.bulk_create(circuits) @@ -387,18 +455,64 @@ class CircuitTerminationTestCase(TestCase, ChangeLoggedFilterSetTests): ) Circuit.objects.bulk_create(circuits) - circuit_terminations = (( - CircuitTermination(circuit=circuits[0], termination=sites[0], term_side='A', port_speed=1000, upstream_speed=1000, xconnect_id='ABC', description='foobar1'), - CircuitTermination(circuit=circuits[0], termination=sites[1], term_side='Z', port_speed=1000, upstream_speed=1000, xconnect_id='DEF', description='foobar2'), - CircuitTermination(circuit=circuits[1], termination=sites[1], term_side='A', port_speed=2000, upstream_speed=2000, xconnect_id='GHI'), - CircuitTermination(circuit=circuits[1], termination=sites[2], term_side='Z', port_speed=2000, upstream_speed=2000, xconnect_id='JKL'), - CircuitTermination(circuit=circuits[2], termination=sites[2], term_side='A', port_speed=3000, upstream_speed=3000, xconnect_id='MNO'), - CircuitTermination(circuit=circuits[2], termination=sites[0], term_side='Z', port_speed=3000, upstream_speed=3000, xconnect_id='PQR'), + circuit_terminations = ( + CircuitTermination( + circuit=circuits[0], + termination=sites[0], + term_side='A', + port_speed=1000, + upstream_speed=1000, + xconnect_id='ABC', + description='foobar1', + ), + CircuitTermination( + circuit=circuits[0], + termination=sites[1], + term_side='Z', + port_speed=1000, + upstream_speed=1000, + xconnect_id='DEF', + description='foobar2', + ), + CircuitTermination( + circuit=circuits[1], + termination=sites[1], + term_side='A', + port_speed=2000, + upstream_speed=2000, + xconnect_id='GHI', + ), + CircuitTermination( + circuit=circuits[1], + termination=sites[2], + term_side='Z', + port_speed=2000, + upstream_speed=2000, + xconnect_id='JKL', + ), + CircuitTermination( + circuit=circuits[2], + termination=sites[2], + term_side='A', + port_speed=3000, + upstream_speed=3000, + xconnect_id='MNO', + ), + CircuitTermination( + circuit=circuits[2], + termination=sites[0], + term_side='Z', + port_speed=3000, + upstream_speed=3000, + xconnect_id='PQR', + ), CircuitTermination(circuit=circuits[3], termination=provider_networks[0], term_side='A'), CircuitTermination(circuit=circuits[4], termination=provider_networks[1], term_side='A'), CircuitTermination(circuit=circuits[5], termination=provider_networks[2], term_side='A'), - CircuitTermination(circuit=circuits[6], termination=provider_networks[0], term_side='A', mark_connected=True), - )) + CircuitTermination( + circuit=circuits[6], termination=provider_networks[0], term_side='A', mark_connected=True + ), + ) for ct in circuit_terminations: ct.save() diff --git a/netbox/circuits/tests/test_views.py b/netbox/circuits/tests/test_views.py index 321c2daa7..3a9bd4dff 100644 --- a/netbox/circuits/tests/test_views.py +++ b/netbox/circuits/tests/test_views.py @@ -141,9 +141,15 @@ class CircuitTestCase(ViewTestCases.PrimaryObjectViewTestCase): CircuitType.objects.bulk_create(circuittypes) circuits = ( - Circuit(cid='Circuit 1', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0]), - Circuit(cid='Circuit 2', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0]), - Circuit(cid='Circuit 3', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0]), + Circuit( + cid='Circuit 1', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0] + ), + Circuit( + cid='Circuit 2', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0] + ), + Circuit( + cid='Circuit 3', provider=providers[0], provider_account=provider_accounts[0], type=circuittypes[0] + ), ) Circuit.objects.bulk_create(circuits) diff --git a/netbox/circuits/urls.py b/netbox/circuits/urls.py index b4746038d..56ba5eb8a 100644 --- a/netbox/circuits/urls.py +++ b/netbox/circuits/urls.py @@ -43,10 +43,30 @@ urlpatterns = [ path('virtual-circuits//', include(get_model_urls('circuits', 'virtualcircuit'))), # Virtual circuit terminations - path('virtual-circuit-terminations/', views.VirtualCircuitTerminationListView.as_view(), name='virtualcircuittermination_list'), - path('virtual-circuit-terminations/add/', views.VirtualCircuitTerminationEditView.as_view(), name='virtualcircuittermination_add'), - path('virtual-circuit-terminations/import/', views.VirtualCircuitTerminationBulkImportView.as_view(), name='virtualcircuittermination_import'), - path('virtual-circuit-terminations/edit/', views.VirtualCircuitTerminationBulkEditView.as_view(), name='virtualcircuittermination_bulk_edit'), - path('virtual-circuit-terminations/delete/', views.VirtualCircuitTerminationBulkDeleteView.as_view(), name='virtualcircuittermination_bulk_delete'), + path( + 'virtual-circuit-terminations/', + views.VirtualCircuitTerminationListView.as_view(), + name='virtualcircuittermination_list', + ), + path( + 'virtual-circuit-terminations/add/', + views.VirtualCircuitTerminationEditView.as_view(), + name='virtualcircuittermination_add', + ), + path( + 'virtual-circuit-terminations/import/', + views.VirtualCircuitTerminationBulkImportView.as_view(), + name='virtualcircuittermination_import', + ), + path( + 'virtual-circuit-terminations/edit/', + views.VirtualCircuitTerminationBulkEditView.as_view(), + name='virtualcircuittermination_bulk_edit', + ), + path( + 'virtual-circuit-terminations/delete/', + views.VirtualCircuitTerminationBulkDeleteView.as_view(), + name='virtualcircuittermination_bulk_delete', + ), path('virtual-circuit-terminations//', include(get_model_urls('circuits', 'virtualcircuittermination'))), ] diff --git a/netbox/core/api/schema.py b/netbox/core/api/schema.py index 1ac822b8c..fad907ac1 100644 --- a/netbox/core/api/schema.py +++ b/netbox/core/api/schema.py @@ -35,7 +35,10 @@ class ChoiceFieldFix(OpenApiSerializerFieldExtension): elif direction == "response": value = build_cf - label = {**build_basic_type(OpenApiTypes.STR), "enum": list(OrderedDict.fromkeys(self.target.choices.values()))} + label = { + **build_basic_type(OpenApiTypes.STR), + "enum": list(OrderedDict.fromkeys(self.target.choices.values())) + } return build_object_type( properties={ diff --git a/netbox/core/api/serializers_/jobs.py b/netbox/core/api/serializers_/jobs.py index 544dddb56..306287e88 100644 --- a/netbox/core/api/serializers_/jobs.py +++ b/netbox/core/api/serializers_/jobs.py @@ -22,7 +22,7 @@ class JobSerializer(BaseModelSerializer): class Meta: model = Job fields = [ - 'id', 'url', 'display_url', 'display', 'object_type', 'object_id', 'name', 'status', 'created', 'scheduled', 'interval', - 'started', 'completed', 'user', 'data', 'error', 'job_id', + 'id', 'url', 'display_url', 'display', 'object_type', 'object_id', 'name', 'status', 'created', 'scheduled', + 'interval', 'started', 'completed', 'user', 'data', 'error', 'job_id', ] brief_fields = ('url', 'created', 'completed', 'user', 'status') diff --git a/netbox/core/migrations/0001_squashed_0005.py b/netbox/core/migrations/0001_squashed_0005.py index 971370bf2..b89fa3b25 100644 --- a/netbox/core/migrations/0001_squashed_0005.py +++ b/netbox/core/migrations/0001_squashed_0005.py @@ -8,13 +8,12 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('core', '0001_initial'), ('core', '0002_managedfile'), ('core', '0003_job'), ('core', '0004_replicate_jobresults'), - ('core', '0005_job_created_auto_now') + ('core', '0005_job_created_auto_now'), ] dependencies = [ @@ -30,7 +29,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), @@ -55,9 +57,28 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(editable=False)), ('path', models.CharField(editable=False, max_length=1000)), ('size', models.PositiveIntegerField(editable=False)), - ('hash', models.CharField(editable=False, max_length=64, validators=[django.core.validators.RegexValidator(message='Length must be 64 hexadecimal characters.', regex='^[0-9a-f]{64}$')])), + ( + 'hash', + models.CharField( + editable=False, + max_length=64, + validators=[ + django.core.validators.RegexValidator( + message='Length must be 64 hexadecimal characters.', regex='^[0-9a-f]{64}$' + ) + ], + ), + ), ('data', models.BinaryField()), - ('source', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='datafiles', to='core.datasource')), + ( + 'source', + models.ForeignKey( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + related_name='datafiles', + to='core.datasource', + ), + ), ], options={ 'ordering': ('source', 'path'), @@ -76,8 +97,18 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('object_id', models.PositiveBigIntegerField()), - ('datafile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='core.datafile')), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype')), + ( + 'datafile', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='+', to='core.datafile' + ), + ), + ( + 'object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype' + ), + ), ], options={ 'indexes': [models.Index(fields=['object_type', 'object_id'], name='core_autosy_object__c17bac_idx')], @@ -97,8 +128,26 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(blank=True, editable=False, null=True)), ('file_root', models.CharField(max_length=1000)), ('file_path', models.FilePathField(editable=False)), - ('data_file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.datafile')), - ('data_source', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.datasource')), + ( + 'data_file', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='core.datafile', + ), + ), + ( + 'data_source', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='core.datasource', + ), + ), ('auto_sync_enabled', models.BooleanField(default=False)), ], options={ @@ -108,7 +157,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='managedfile', - constraint=models.UniqueConstraint(fields=('file_root', 'file_path'), name='core_managedfile_unique_root_path'), + constraint=models.UniqueConstraint( + fields=('file_root', 'file_path'), name='core_managedfile_unique_root_path' + ), ), migrations.CreateModel( name='Job', @@ -118,14 +169,33 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=200)), ('created', models.DateTimeField()), ('scheduled', models.DateTimeField(blank=True, null=True)), - ('interval', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), + ( + 'interval', + models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), ('started', models.DateTimeField(blank=True, null=True)), ('completed', models.DateTimeField(blank=True, null=True)), ('status', models.CharField(default='pending', max_length=30)), ('data', models.JSONField(blank=True, null=True)), ('job_id', models.UUIDField(unique=True)), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='jobs', to='contenttypes.contenttype')), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ( + 'object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='jobs', to='contenttypes.contenttype' + ), + ), + ( + 'user', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'ordering': ['-created'], diff --git a/netbox/core/migrations/0006_datasource_type_remove_choices.py b/netbox/core/migrations/0006_datasource_type_remove_choices.py index 0ad8d8854..7c9914298 100644 --- a/netbox/core/migrations/0006_datasource_type_remove_choices.py +++ b/netbox/core/migrations/0006_datasource_type_remove_choices.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0005_job_created_auto_now'), ] diff --git a/netbox/core/migrations/0007_job_add_error_field.py b/netbox/core/migrations/0007_job_add_error_field.py index e2e173bfd..3b0e02b56 100644 --- a/netbox/core/migrations/0007_job_add_error_field.py +++ b/netbox/core/migrations/0007_job_add_error_field.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0006_datasource_type_remove_choices'), ] diff --git a/netbox/core/migrations/0008_contenttype_proxy.py b/netbox/core/migrations/0008_contenttype_proxy.py index dee82a969..9acaf3ad7 100644 --- a/netbox/core/migrations/0008_contenttype_proxy.py +++ b/netbox/core/migrations/0008_contenttype_proxy.py @@ -3,7 +3,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('core', '0007_job_add_error_field'), @@ -12,8 +11,7 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( name='ObjectType', - fields=[ - ], + fields=[], options={ 'proxy': True, 'indexes': [], diff --git a/netbox/core/migrations/0009_configrevision.py b/netbox/core/migrations/0009_configrevision.py index e7f817a16..6acd4531d 100644 --- a/netbox/core/migrations/0009_configrevision.py +++ b/netbox/core/migrations/0009_configrevision.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0008_contenttype_proxy'), ] diff --git a/netbox/core/migrations/0010_gfk_indexes.py b/netbox/core/migrations/0010_gfk_indexes.py index d51bc67ad..1e593a0c7 100644 --- a/netbox/core/migrations/0010_gfk_indexes.py +++ b/netbox/core/migrations/0010_gfk_indexes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0009_configrevision'), ] diff --git a/netbox/core/migrations/0011_move_objectchange.py b/netbox/core/migrations/0011_move_objectchange.py index 2b41133ec..673763ce4 100644 --- a/netbox/core/migrations/0011_move_objectchange.py +++ b/netbox/core/migrations/0011_move_objectchange.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('core', '0010_gfk_indexes'), @@ -27,15 +26,49 @@ class Migration(migrations.Migration): ('object_repr', models.CharField(editable=False, max_length=200)), ('prechange_data', models.JSONField(blank=True, editable=False, null=True)), ('postchange_data', models.JSONField(blank=True, editable=False, null=True)), - ('changed_object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('related_object_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='changes', to=settings.AUTH_USER_MODEL)), + ( + 'changed_object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'related_object_type', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'user', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='changes', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'verbose_name': 'object change', 'verbose_name_plural': 'object changes', 'ordering': ['-time'], - 'indexes': [models.Index(fields=['changed_object_type', 'changed_object_id'], name='core_object_changed_c227ce_idx'), models.Index(fields=['related_object_type', 'related_object_id'], name='core_object_related_3375d6_idx')], + 'indexes': [ + models.Index( + fields=['changed_object_type', 'changed_object_id'], + name='core_object_changed_c227ce_idx', + ), + models.Index( + fields=['related_object_type', 'related_object_id'], + name='core_object_related_3375d6_idx', + ), + ], }, ), ], diff --git a/netbox/core/migrations/0012_job_object_type_optional.py b/netbox/core/migrations/0012_job_object_type_optional.py index 3c6664afc..3798b1285 100644 --- a/netbox/core/migrations/0012_job_object_type_optional.py +++ b/netbox/core/migrations/0012_job_object_type_optional.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('core', '0011_move_objectchange'), @@ -18,7 +17,7 @@ class Migration(migrations.Migration): null=True, on_delete=django.db.models.deletion.CASCADE, related_name='jobs', - to='contenttypes.contenttype' + to='contenttypes.contenttype', ), ), ] diff --git a/netbox/core/models/files.py b/netbox/core/models/files.py index 7b626a441..cc446bac7 100644 --- a/netbox/core/models/files.py +++ b/netbox/core/models/files.py @@ -93,9 +93,14 @@ class ManagedFile(SyncedDataMixin, models.Model): self.file_path = os.path.basename(self.data_path) # Ensure that the file root and path make a unique pair - if self._meta.model.objects.filter(file_root=self.file_root, file_path=self.file_path).exclude(pk=self.pk).exists(): + if self._meta.model.objects.filter( + file_root=self.file_root, file_path=self.file_path + ).exclude(pk=self.pk).exists(): raise ValidationError( - f"A {self._meta.verbose_name.lower()} with this file path already exists ({self.file_root}/{self.file_path}).") + _("A {model} with this file path already exists ({path}).").format( + model=self._meta.verbose_name.lower(), + path=f"{self.file_root}/{self.file_path}" + )) def delete(self, *args, **kwargs): # Delete file from disk diff --git a/netbox/core/models/jobs.py b/netbox/core/models/jobs.py index 82bfd72c8..5caa9cc2d 100644 --- a/netbox/core/models/jobs.py +++ b/netbox/core/models/jobs.py @@ -203,7 +203,17 @@ class Job(models.Model): job_end.send(self) @classmethod - def enqueue(cls, func, instance=None, name='', user=None, schedule_at=None, interval=None, immediate=False, **kwargs): + def enqueue( + cls, + func, + instance=None, + name='', + user=None, + schedule_at=None, + interval=None, + immediate=False, + **kwargs + ): """ Create a Job instance and enqueue a job using the given callable diff --git a/netbox/core/urls.py b/netbox/core/urls.py index 5db165a8b..b922c8bed 100644 --- a/netbox/core/urls.py +++ b/netbox/core/urls.py @@ -20,11 +20,27 @@ urlpatterns = ( # Background Tasks path('background-queues/', views.BackgroundQueueListView.as_view(), name='background_queue_list'), - path('background-queues///', views.BackgroundTaskListView.as_view(), name='background_task_list'), + path( + 'background-queues///', + views.BackgroundTaskListView.as_view(), + name='background_task_list' + ), path('background-tasks//', views.BackgroundTaskView.as_view(), name='background_task'), - path('background-tasks//delete/', views.BackgroundTaskDeleteView.as_view(), name='background_task_delete'), - path('background-tasks//requeue/', views.BackgroundTaskRequeueView.as_view(), name='background_task_requeue'), - path('background-tasks//enqueue/', views.BackgroundTaskEnqueueView.as_view(), name='background_task_enqueue'), + path( + 'background-tasks//delete/', + views.BackgroundTaskDeleteView.as_view(), + name='background_task_delete' + ), + path( + 'background-tasks//requeue/', + views.BackgroundTaskRequeueView.as_view(), + name='background_task_requeue' + ), + path( + 'background-tasks//enqueue/', + views.BackgroundTaskEnqueueView.as_view(), + name='background_task_enqueue' + ), path('background-tasks//stop/', views.BackgroundTaskStopView.as_view(), name='background_task_stop'), path('background-workers//', views.WorkerListView.as_view(), name='worker_list'), path('background-workers//', views.WorkerView.as_view(), name='worker'), diff --git a/netbox/dcim/api/serializers_/device_components.py b/netbox/dcim/api/serializers_/device_components.py index 12133ec65..a6767bb6f 100644 --- a/netbox/dcim/api/serializers_/device_components.py +++ b/netbox/dcim/api/serializers_/device_components.py @@ -351,9 +351,9 @@ class InventoryItemSerializer(NetBoxModelSerializer): class Meta: model = InventoryItem fields = [ - 'id', 'url', 'display_url', 'display', 'device', 'parent', 'name', 'label', 'status', 'role', 'manufacturer', - 'part_id', 'serial', 'asset_tag', 'discovered', 'description', 'component_type', 'component_id', - 'component', 'tags', 'custom_fields', 'created', 'last_updated', '_depth', + 'id', 'url', 'display_url', 'display', 'device', 'parent', 'name', 'label', 'status', 'role', + 'manufacturer', 'part_id', 'serial', 'asset_tag', 'discovered', 'description', 'component_type', + 'component_id', 'component', 'tags', 'custom_fields', 'created', 'last_updated', '_depth', ] brief_fields = ('id', 'url', 'display', 'device', 'name', 'description', '_depth') diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index f4d65d4bc..90a9993c2 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -312,8 +312,8 @@ class RackTypeFilterSet(NetBoxModelFilterSet): class Meta: model = RackType fields = ( - 'id', 'model', 'slug', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', - 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', + 'id', 'model', 'slug', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', + 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', ) def search(self, queryset, name, value): diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index b8a7a007c..a2352d806 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -428,7 +428,10 @@ class ModuleTypeImportForm(NetBoxModelImportForm): class Meta: model = ModuleType - fields = ['manufacturer', 'model', 'part_number', 'description', 'airflow', 'weight', 'weight_unit', 'comments', 'tags'] + fields = [ + 'manufacturer', 'model', 'part_number', 'description', 'airflow', 'weight', 'weight_unit', 'comments', + 'tags', + ] class DeviceRoleImportForm(NetBoxModelImportForm): @@ -800,7 +803,10 @@ class PowerOutletImportForm(NetBoxModelImportForm): class Meta: model = PowerOutlet - fields = ('device', 'name', 'label', 'type', 'color', 'mark_connected', 'power_port', 'feed_leg', 'description', 'tags') + fields = ( + 'device', 'name', 'label', 'type', 'color', 'mark_connected', 'power_port', 'feed_leg', 'description', + 'tags', + ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -1114,8 +1120,8 @@ class InventoryItemImportForm(NetBoxModelImportForm): class Meta: model = InventoryItem fields = ( - 'device', 'name', 'label', 'status', 'role', 'manufacturer', 'parent', 'part_id', 'serial', 'asset_tag', 'discovered', - 'description', 'tags', 'component_type', 'component_name', + 'device', 'name', 'label', 'status', 'role', 'manufacturer', 'parent', 'part_id', 'serial', 'asset_tag', + 'discovered', 'description', 'tags', 'component_type', 'component_name', ) def __init__(self, *args, **kwargs): diff --git a/netbox/dcim/forms/common.py b/netbox/dcim/forms/common.py index d30ac0784..04c53b384 100644 --- a/netbox/dcim/forms/common.py +++ b/netbox/dcim/forms/common.py @@ -136,7 +136,10 @@ class ModuleCommonForm(forms.Form): if len(module_bays) != template.name.count(MODULE_TOKEN): raise forms.ValidationError( - _("Cannot install module with placeholder values in a module bay tree {level} in tree but {tokens} placeholders given.").format( + _( + "Cannot install module with placeholder values in a module bay tree {level} in tree " + "but {tokens} placeholders given." + ).format( level=len(module_bays), tokens=template.name.count(MODULE_TOKEN) ) ) diff --git a/netbox/dcim/forms/connections.py b/netbox/dcim/forms/connections.py index 324f8ecfd..5e5d83b0b 100644 --- a/netbox/dcim/forms/connections.py +++ b/netbox/dcim/forms/connections.py @@ -111,9 +111,15 @@ def get_cable_form(a_type, b_type): if self.instance and self.instance.pk: # Initialize A/B terminations when modifying an existing Cable instance - if a_type and self.instance.a_terminations and a_ct == ContentType.objects.get_for_model(self.instance.a_terminations[0]): + if ( + a_type and self.instance.a_terminations and + a_ct == ContentType.objects.get_for_model(self.instance.a_terminations[0]) + ): self.initial['a_terminations'] = self.instance.a_terminations - if b_type and self.instance.b_terminations and b_ct == ContentType.objects.get_for_model(self.instance.b_terminations[0]): + if ( + b_type and self.instance.b_terminations and + b_ct == ContentType.objects.get_for_model(self.instance.b_terminations[0]) + ): self.initial['b_terminations'] = self.instance.b_terminations else: # Need to clear terminations if swapped type - but need to do it only diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 8a19b14e7..37cce9060 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -266,7 +266,10 @@ class RackForm(TenancyForm, NetBoxModelForm): comments = CommentField() fieldsets = ( - FieldSet('site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'airflow', 'tags', name=_('Rack')), + FieldSet( + 'site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'airflow', 'tags', + name=_('Rack') + ), FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')), ) @@ -1007,7 +1010,8 @@ class InterfaceTemplateForm(ModularComponentTemplateForm): class Meta: model = InterfaceTemplate fields = [ - 'device_type', 'module_type', 'name', 'label', 'type', 'mgmt_only', 'enabled', 'description', 'poe_mode', 'poe_type', 'bridge', 'rf_role', + 'device_type', 'module_type', 'name', 'label', 'type', 'mgmt_only', 'enabled', 'description', 'poe_mode', + 'poe_type', 'bridge', 'rf_role', ] @@ -1189,7 +1193,10 @@ class InventoryItemTemplateForm(ComponentTemplateForm): break elif component_type and component_id: # When adding the InventoryItem from a component page - if content_type := ContentType.objects.filter(MODULAR_COMPONENT_TEMPLATE_MODELS).filter(pk=component_type).first(): + content_type = ContentType.objects.filter( + MODULAR_COMPONENT_TEMPLATE_MODELS + ).filter(pk=component_type).first() + if content_type: if component := content_type.model_class().objects.filter(pk=component_id).first(): initial[content_type.model] = component @@ -1301,16 +1308,16 @@ class PowerOutletForm(ModularDeviceComponentForm): fieldsets = ( FieldSet( - 'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected', 'description', - 'tags', + 'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected', + 'description', 'tags', ), ) class Meta: model = PowerOutlet fields = [ - 'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected', 'description', - 'tags', + 'device', 'module', 'name', 'label', 'type', 'color', 'power_port', 'feed_leg', 'mark_connected', + 'description', 'tags', ] @@ -1611,7 +1618,10 @@ class InventoryItemForm(DeviceComponentForm): ) fieldsets = ( - FieldSet('device', 'parent', 'name', 'label', 'status', 'role', 'description', 'tags', name=_('Inventory Item')), + FieldSet( + 'device', 'parent', 'name', 'label', 'status', 'role', 'description', 'tags', + name=_('Inventory Item') + ), FieldSet('manufacturer', 'part_id', 'serial', 'asset_tag', name=_('Hardware')), FieldSet( TabbedGroups( diff --git a/netbox/dcim/forms/object_create.py b/netbox/dcim/forms/object_create.py index 85c613b8c..6f6cd8f7c 100644 --- a/netbox/dcim/forms/object_create.py +++ b/netbox/dcim/forms/object_create.py @@ -416,7 +416,8 @@ class VirtualChassisCreateForm(NetBoxModelForm): class Meta: model = VirtualChassis fields = [ - 'name', 'domain', 'description', 'region', 'site_group', 'site', 'rack', 'members', 'initial_position', 'tags', + 'name', 'domain', 'description', 'region', 'site_group', 'site', 'rack', 'members', 'initial_position', + 'tags', ] def clean(self): diff --git a/netbox/dcim/forms/object_import.py b/netbox/dcim/forms/object_import.py index d46ef83ad..821f91402 100644 --- a/netbox/dcim/forms/object_import.py +++ b/netbox/dcim/forms/object_import.py @@ -136,7 +136,8 @@ class FrontPortTemplateImportForm(forms.ModelForm): class Meta: model = FrontPortTemplate fields = [ - 'device_type', 'module_type', 'name', 'type', 'color', 'rear_port', 'rear_port_position', 'label', 'description', + 'device_type', 'module_type', 'name', 'type', 'color', 'rear_port', 'rear_port_position', 'label', + 'description', ] diff --git a/netbox/dcim/graphql/types.py b/netbox/dcim/graphql/types.py index 7aa4ef8a0..1020861f4 100644 --- a/netbox/dcim/graphql/types.py +++ b/netbox/dcim/graphql/types.py @@ -482,7 +482,9 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi return self.cluster_set.all() @strawberry_django.field - def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + def circuit_terminations(self) -> List[ + Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] + ]: return self.circuit_terminations.all() @@ -728,7 +730,9 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): return self.cluster_set.all() @strawberry_django.field - def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + def circuit_terminations(self) -> List[ + Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] + ]: return self.circuit_terminations.all() @@ -760,7 +764,9 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje return self.cluster_set.all() @strawberry_django.field - def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + def circuit_terminations(self) -> List[ + Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] + ]: return self.circuit_terminations.all() @@ -784,7 +790,9 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType): return self.cluster_set.all() @strawberry_django.field - def circuit_terminations(self) -> List[Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')]]: + def circuit_terminations(self) -> List[ + Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')] + ]: return self.circuit_terminations.all() diff --git a/netbox/dcim/migrations/0001_squashed.py b/netbox/dcim/migrations/0001_squashed.py index cf0ef4816..f08fe1d70 100644 --- a/netbox/dcim/migrations/0001_squashed.py +++ b/netbox/dcim/migrations/0001_squashed.py @@ -13,11 +13,9 @@ import utilities.validators class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] replaces = [ ('dcim', '0001_initial'), @@ -64,7 +62,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), @@ -83,7 +86,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(blank=True, max_length=50)), @@ -100,7 +108,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), @@ -119,7 +132,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(blank=True, max_length=50)), @@ -137,14 +155,34 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(primary_key=True, serialize=False)), ('local_context_data', models.JSONField(blank=True, null=True)), ('name', models.CharField(blank=True, max_length=64, null=True)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize, null=True)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize, null=True + ), + ), ('serial', models.CharField(blank=True, max_length=50)), ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)), - ('position', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), + ( + 'position', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), ('face', models.CharField(blank=True, max_length=50)), ('status', models.CharField(default='active', max_length=50)), - ('vc_position', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)])), - ('vc_priority', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)])), + ( + 'vc_position', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + ( + 'vc_priority', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), ('comments', models.TextField(blank=True)), ], options={ @@ -159,7 +197,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ], @@ -174,7 +217,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ], @@ -228,13 +276,27 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), ('mark_connected', models.BooleanField(default=False)), ('type', models.CharField(max_length=50)), - ('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])), + ( + 'rear_port_position', + models.PositiveSmallIntegerField( + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(1024), + ], + ), + ), ], options={ 'ordering': ('device', '_name'), @@ -247,11 +309,25 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(max_length=50)), - ('rear_port_position', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])), + ( + 'rear_port_position', + models.PositiveSmallIntegerField( + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(1024), + ], + ), + ), ], options={ 'ordering': ('device_type', '_name'), @@ -271,9 +347,24 @@ class Migration(migrations.Migration): ('mark_connected', models.BooleanField(default=False)), ('enabled', models.BooleanField(default=True)), ('mac_address', dcim.fields.MACAddressField(blank=True, null=True)), - ('mtu', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65536)])), + ( + 'mtu', + models.PositiveIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(65536), + ], + ), + ), ('mode', models.CharField(blank=True, max_length=50)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface + ), + ), ('type', models.CharField(max_length=50)), ('mgmt_only', models.BooleanField(default=False)), ], @@ -290,7 +381,12 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=64)), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface + ), + ), ('type', models.CharField(max_length=50)), ('mgmt_only', models.BooleanField(default=False)), ], @@ -306,7 +402,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('part_id', models.CharField(blank=True, max_length=50)), @@ -388,8 +489,19 @@ class Migration(migrations.Migration): ('supply', models.CharField(default='ac', max_length=50)), ('phase', models.CharField(default='single-phase', max_length=50)), ('voltage', models.SmallIntegerField(validators=[utilities.validators.ExclusionValidator([0])])), - ('amperage', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1)])), - ('max_utilization', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)])), + ( + 'amperage', + models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1)]), + ), + ( + 'max_utilization', + models.PositiveSmallIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ] + ), + ), ('available_power', models.PositiveIntegerField(default=0, editable=False)), ('comments', models.TextField(blank=True)), ], @@ -405,7 +517,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), @@ -424,7 +541,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(blank=True, max_length=50)), @@ -455,14 +577,29 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), ('mark_connected', models.BooleanField(default=False)), ('type', models.CharField(blank=True, max_length=50)), - ('maximum_draw', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), - ('allocated_draw', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), + ( + 'maximum_draw', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), + ( + 'allocated_draw', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), ], options={ 'ordering': ('device', '_name'), @@ -475,12 +612,27 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(blank=True, max_length=50)), - ('maximum_draw', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), - ('allocated_draw', models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])), + ( + 'maximum_draw', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), + ( + 'allocated_draw', + models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), + ), ], options={ 'ordering': ('device_type', '_name'), @@ -494,14 +646,28 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=100)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('facility_id', models.CharField(blank=True, max_length=50, null=True)), ('status', models.CharField(default='active', max_length=50)), ('serial', models.CharField(blank=True, max_length=50)), ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)), ('type', models.CharField(blank=True, max_length=50)), ('width', models.PositiveSmallIntegerField(default=19)), - ('u_height', models.PositiveSmallIntegerField(default=42, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)])), + ( + 'u_height', + models.PositiveSmallIntegerField( + default=42, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + ), + ), ('desc_units', models.BooleanField(default=False)), ('outer_width', models.PositiveSmallIntegerField(blank=True, null=True)), ('outer_depth', models.PositiveSmallIntegerField(blank=True, null=True)), @@ -519,7 +685,10 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('units', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveSmallIntegerField(), size=None)), + ( + 'units', + django.contrib.postgres.fields.ArrayField(base_field=models.PositiveSmallIntegerField(), size=None), + ), ('description', models.CharField(max_length=200)), ], options={ @@ -550,13 +719,27 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('_cable_peer_id', models.PositiveIntegerField(blank=True, null=True)), ('mark_connected', models.BooleanField(default=False)), ('type', models.CharField(max_length=50)), - ('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])), + ( + 'positions', + models.PositiveSmallIntegerField( + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(1024), + ], + ), + ), ], options={ 'ordering': ('device', '_name'), @@ -569,11 +752,25 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('type', models.CharField(max_length=50)), - ('positions', models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(1024)])), + ( + 'positions', + models.PositiveSmallIntegerField( + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(1024), + ], + ), + ), ], options={ 'ordering': ('device_type', '_name'), @@ -606,7 +803,12 @@ class Migration(migrations.Migration): ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=100, unique=True)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('slug', models.SlugField(max_length=100, unique=True)), ('status', models.CharField(default='active', max_length=50)), ('facility', models.CharField(blank=True, max_length=50)), @@ -654,7 +856,16 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), ('domain', models.CharField(blank=True, max_length=30)), - ('master', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vc_master_for', to='dcim.device')), + ( + 'master', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vc_master_for', + to='dcim.device', + ), + ), ], options={ 'verbose_name_plural': 'virtual chassis', diff --git a/netbox/dcim/migrations/0002_squashed.py b/netbox/dcim/migrations/0002_squashed.py index 786167680..2e830560f 100644 --- a/netbox/dcim/migrations/0002_squashed.py +++ b/netbox/dcim/migrations/0002_squashed.py @@ -6,7 +6,6 @@ import taggit.managers class Migration(migrations.Migration): - dependencies = [ ('dcim', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), @@ -28,17 +27,35 @@ class Migration(migrations.Migration): migrations.AddField( model_name='sitegroup', name='parent', - field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='dcim.sitegroup'), + field=mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='dcim.sitegroup', + ), ), migrations.AddField( model_name='site', name='group', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sites', to='dcim.sitegroup'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='sites', + to='dcim.sitegroup', + ), ), migrations.AddField( model_name='site', name='region', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sites', to='dcim.region'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='sites', + to='dcim.region', + ), ), migrations.AddField( model_name='site', @@ -48,32 +65,56 @@ class Migration(migrations.Migration): migrations.AddField( model_name='site', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='sites', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='sites', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='region', name='parent', - field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='dcim.region'), + field=mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='dcim.region', + ), ), migrations.AddField( model_name='rearporttemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='rearport', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='rearport', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='rearport', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='rearport', @@ -83,7 +124,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='rackreservation', name='rack', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reservations', to='dcim.rack'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='reservations', to='dcim.rack' + ), ), migrations.AddField( model_name='rackreservation', @@ -93,7 +136,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='rackreservation', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='rackreservations', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='rackreservations', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='rackreservation', @@ -103,12 +152,24 @@ class Migration(migrations.Migration): migrations.AddField( model_name='rack', name='location', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='racks', to='dcim.location'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='racks', + to='dcim.location', + ), ), migrations.AddField( model_name='rack', name='role', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='racks', to='dcim.rackrole'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='racks', + to='dcim.rackrole', + ), ), migrations.AddField( model_name='rack', @@ -123,32 +184,52 @@ class Migration(migrations.Migration): migrations.AddField( model_name='rack', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='racks', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='racks', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='powerporttemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='powerport', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='powerport', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='powerport', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='powerport', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='powerport', @@ -158,7 +239,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='powerpanel', name='location', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='dcim.location'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='dcim.location' + ), ), migrations.AddField( model_name='powerpanel', @@ -173,37 +256,63 @@ class Migration(migrations.Migration): migrations.AddField( model_name='poweroutlettemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='poweroutlettemplate', name='power_port', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='poweroutlet_templates', to='dcim.powerporttemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='poweroutlet_templates', + to='dcim.powerporttemplate', + ), ), migrations.AddField( model_name='poweroutlet', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='poweroutlet', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='poweroutlet', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='poweroutlet', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='poweroutlet', name='power_port', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='poweroutlets', to='dcim.powerport'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='poweroutlets', + to='dcim.powerport', + ), ), migrations.AddField( model_name='poweroutlet', @@ -213,27 +322,45 @@ class Migration(migrations.Migration): migrations.AddField( model_name='powerfeed', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='powerfeed', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='powerfeed', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='powerfeed', name='power_panel', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='powerfeeds', to='dcim.powerpanel'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='powerfeeds', to='dcim.powerpanel' + ), ), migrations.AddField( model_name='powerfeed', name='rack', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='powerfeeds', to='dcim.rack'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='powerfeeds', + to='dcim.rack', + ), ), migrations.AddField( model_name='powerfeed', @@ -243,32 +370,60 @@ class Migration(migrations.Migration): migrations.AddField( model_name='platform', name='manufacturer', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='platforms', to='dcim.manufacturer'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='platforms', + to='dcim.manufacturer', + ), ), migrations.AddField( model_name='location', name='parent', - field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='dcim.location'), + field=mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='dcim.location', + ), ), migrations.AddField( model_name='location', name='site', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='dcim.site'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='locations', to='dcim.site' + ), ), migrations.AddField( model_name='inventoryitem', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='inventoryitem', name='manufacturer', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='inventory_items', to='dcim.manufacturer'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='inventory_items', + to='dcim.manufacturer', + ), ), migrations.AddField( model_name='inventoryitem', name='parent', - field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child_items', to='dcim.inventoryitem'), + field=mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='child_items', + to='dcim.inventoryitem', + ), ), migrations.AddField( model_name='inventoryitem', @@ -278,36 +433,62 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interfacetemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='interface', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='interface', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='interface', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='interface', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='interface', name='lag', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='member_interfaces', to='dcim.interface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='member_interfaces', + to='dcim.interface', + ), ), migrations.AddField( model_name='interface', name='parent', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='child_interfaces', to='dcim.interface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='child_interfaces', + to='dcim.interface', + ), ), ] diff --git a/netbox/dcim/migrations/0003_squashed_0130.py b/netbox/dcim/migrations/0003_squashed_0130.py index 592aaf9a8..0248d9ba1 100644 --- a/netbox/dcim/migrations/0003_squashed_0130.py +++ b/netbox/dcim/migrations/0003_squashed_0130.py @@ -4,7 +4,6 @@ import taggit.managers class Migration(migrations.Migration): - dependencies = [ ('dcim', '0002_auto_20160622_1821'), ('virtualization', '0001_virtualization'), @@ -160,37 +159,61 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='untagged_vlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='interfaces_as_untagged', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='interfaces_as_untagged', + to='ipam.vlan', + ), ), migrations.AddField( model_name='frontporttemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='frontporttemplate', name='rear_port', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='frontport_templates', to='dcim.rearporttemplate'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='frontport_templates', + to='dcim.rearporttemplate', + ), ), migrations.AddField( model_name='frontport', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='frontport', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='frontport', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='frontport', name='rear_port', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='frontports', to='dcim.rearport'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='frontports', to='dcim.rearport' + ), ), migrations.AddField( model_name='frontport', @@ -200,7 +223,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='devicetype', name='manufacturer', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='device_types', to='dcim.manufacturer'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='device_types', to='dcim.manufacturer' + ), ), migrations.AddField( model_name='devicetype', @@ -210,17 +235,27 @@ class Migration(migrations.Migration): migrations.AddField( model_name='devicebaytemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='devicebay', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='devicebay', name='installed_device', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='parent_bay', to='dcim.device'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='parent_bay', + to='dcim.device', + ), ), migrations.AddField( model_name='devicebay', @@ -230,47 +265,89 @@ class Migration(migrations.Migration): migrations.AddField( model_name='device', name='cluster', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='devices', to='virtualization.cluster'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='devices', + to='virtualization.cluster', + ), ), migrations.AddField( model_name='device', name='device_role', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.devicerole'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.devicerole' + ), ), migrations.AddField( model_name='device', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='dcim.devicetype' + ), ), migrations.AddField( model_name='device', name='location', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.location'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='devices', + to='dcim.location', + ), ), migrations.AddField( model_name='device', name='platform', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='devices', to='dcim.platform'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='devices', + to='dcim.platform', + ), ), migrations.AddField( model_name='device', name='primary_ip4', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='primary_ip4_for', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='primary_ip4_for', + to='ipam.ipaddress', + ), ), migrations.AddField( model_name='device', name='primary_ip6', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='primary_ip6_for', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='primary_ip6_for', + to='ipam.ipaddress', + ), ), migrations.AddField( model_name='device', name='rack', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.rack'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='devices', + to='dcim.rack', + ), ), migrations.AddField( model_name='device', name='site', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.site'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='dcim.site' + ), ), migrations.AddField( model_name='device', @@ -280,37 +357,63 @@ class Migration(migrations.Migration): migrations.AddField( model_name='device', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='devices', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='devices', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='device', name='virtual_chassis', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='members', to='dcim.virtualchassis'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='members', + to='dcim.virtualchassis', + ), ), migrations.AddField( model_name='consoleserverporttemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='consoleserverport', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='consoleserverport', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='consoleserverport', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='consoleserverport', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='consoleserverport', @@ -320,27 +423,41 @@ class Migration(migrations.Migration): migrations.AddField( model_name='consoleporttemplate', name='device_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), ), migrations.AddField( model_name='consoleport', name='_cable_peer_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='consoleport', name='_path', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dcim.cablepath' + ), ), migrations.AddField( model_name='consoleport', name='cable', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.cable' + ), ), migrations.AddField( model_name='consoleport', name='device', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), ), migrations.AddField( model_name='consoleport', @@ -350,22 +467,34 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cablepath', name='destination_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='cablepath', name='origin_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype' + ), ), migrations.AddField( model_name='cable', name='_termination_a_device', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device' + ), ), migrations.AddField( model_name='cable', name='_termination_b_device', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device' + ), ), migrations.AddField( model_name='cable', @@ -375,12 +504,64 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cable', name='termination_a_type', - field=models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), models.Q(('app_label', 'dcim'), ('model__in', ('consoleport', 'consoleserverport', 'frontport', 'interface', 'powerfeed', 'poweroutlet', 'powerport', 'rearport'))), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), + models.Q( + ('app_label', 'dcim'), + ( + 'model__in', + ( + 'consoleport', + 'consoleserverport', + 'frontport', + 'interface', + 'powerfeed', + 'poweroutlet', + 'powerport', + 'rearport', + ), + ), + ), + _connector='OR', + ) + ), + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='cable', name='termination_b_type', - field=models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), models.Q(('app_label', 'dcim'), ('model__in', ('consoleport', 'consoleserverport', 'frontport', 'interface', 'powerfeed', 'poweroutlet', 'powerport', 'rearport'))), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), + models.Q( + ('app_label', 'dcim'), + ( + 'model__in', + ( + 'consoleport', + 'consoleserverport', + 'frontport', + 'interface', + 'powerfeed', + 'poweroutlet', + 'powerport', + 'rearport', + ), + ), + ), + _connector='OR', + ) + ), + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AlterUniqueTogether( name='rearporttemplate', @@ -456,7 +637,11 @@ class Migration(migrations.Migration): ), migrations.AlterUniqueTogether( name='device', - unique_together={('rack', 'position', 'face'), ('virtual_chassis', 'vc_position'), ('site', 'tenant', 'name')}, + unique_together={ + ('rack', 'position', 'face'), + ('virtual_chassis', 'vc_position'), + ('site', 'tenant', 'name'), + }, ), migrations.AlterUniqueTogether( name='consoleserverporttemplate', diff --git a/netbox/dcim/migrations/0131_squashed_0159.py b/netbox/dcim/migrations/0131_squashed_0159.py index f7e7cfdb2..3866e8cc8 100644 --- a/netbox/dcim/migrations/0131_squashed_0159.py +++ b/netbox/dcim/migrations/0131_squashed_0159.py @@ -10,7 +10,6 @@ import utilities.ordering class Migration(migrations.Migration): - replaces = [ ('dcim', '0131_consoleport_speed'), ('dcim', '0132_cable_length'), @@ -40,7 +39,7 @@ class Migration(migrations.Migration): ('dcim', '0156_location_status'), ('dcim', '0157_new_cabling_models'), ('dcim', '0158_populate_cable_terminations'), - ('dcim', '0159_populate_cable_paths') + ('dcim', '0159_populate_cable_paths'), ] dependencies = [ @@ -96,17 +95,35 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='bridge', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bridge_interfaces', to='dcim.interface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='bridge_interfaces', + to='dcim.interface', + ), ), migrations.AddField( model_name='location', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='locations', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='locations', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='cable', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='cables', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='cables', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='devicetype', @@ -148,7 +165,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='location', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('site', 'name'), name='dcim_location_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('site', 'name'), name='dcim_location_name' + ), ), migrations.AddConstraint( model_name='location', @@ -156,7 +175,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='location', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('site', 'slug'), name='dcim_location_slug'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('site', 'slug'), name='dcim_location_slug' + ), ), migrations.AddConstraint( model_name='region', @@ -164,7 +185,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='region', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('name',), name='dcim_region_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('name',), name='dcim_region_name' + ), ), migrations.AddConstraint( model_name='region', @@ -172,7 +195,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='region', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('slug',), name='dcim_region_slug'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('slug',), name='dcim_region_slug' + ), ), migrations.AddConstraint( model_name='sitegroup', @@ -180,7 +205,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='sitegroup', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('name',), name='dcim_sitegroup_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('name',), name='dcim_sitegroup_name' + ), ), migrations.AddConstraint( model_name='sitegroup', @@ -188,7 +215,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='sitegroup', - constraint=models.UniqueConstraint(condition=models.Q(('parent', None)), fields=('slug',), name='dcim_sitegroup_slug'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent', None)), fields=('slug',), name='dcim_sitegroup_slug' + ), ), migrations.AddField( model_name='devicerole', @@ -328,7 +357,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='tx_power', - field=models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(127)]), + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(127)] + ), ), migrations.AddField( model_name='interface', @@ -338,7 +369,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='wireless_link', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wireless.wirelesslink'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='wireless.wirelesslink', + ), ), migrations.AddField( model_name='site', @@ -348,12 +385,24 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='device', name='primary_ip4', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), ), migrations.AlterField( model_name='device', name='primary_ip6', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), ), migrations.RemoveField( model_name='site', @@ -372,7 +421,23 @@ class Migration(migrations.Migration): name='contact_phone', ), migrations.RunSQL( - sql="\n DO $$\n DECLARE\n idx record;\n BEGIN\n FOR idx IN\n SELECT indexname AS old_name,\n replace(indexname, 'module', 'inventoryitem') AS new_name\n FROM pg_indexes\n WHERE schemaname = 'public' AND\n tablename = 'dcim_inventoryitem' AND\n indexname LIKE 'dcim_module_%'\n LOOP\n EXECUTE format(\n 'ALTER INDEX %I RENAME TO %I;',\n idx.old_name,\n idx.new_name\n );\n END LOOP;\n END$$;\n ", + sql="""DO $$ + DECLARE idx record; + BEGIN + FOR idx IN + SELECT indexname AS old_name, replace(indexname, 'module', 'inventoryitem') AS new_name + FROM pg_indexes + WHERE schemaname = 'public' AND + tablename = 'dcim_inventoryitem' AND + indexname LIKE 'dcim_module_%' + LOOP + EXECUTE format( + 'ALTER INDEX %I RENAME TO %I;', + idx.old_name, + idx.new_name + ); + END LOOP; + END$$;""", ), migrations.AlterModelOptions( name='consoleporttemplate', @@ -405,49 +470,99 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='consoleporttemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='consoleserverporttemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='frontporttemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='interfacetemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='poweroutlettemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='powerporttemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AlterField( model_name='rearporttemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.CreateModel( name='ModuleType', fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('model', models.CharField(max_length=100)), ('part_number', models.CharField(blank=True, max_length=50)), ('comments', models.TextField(blank=True)), - ('manufacturer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='module_types', to='dcim.manufacturer')), + ( + 'manufacturer', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='module_types', to='dcim.manufacturer' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -460,14 +575,27 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('position', models.CharField(blank=True, max_length=30)), ('description', models.CharField(blank=True, max_length=200)), - ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device')), + ( + 'device', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.device' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -480,15 +608,35 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('local_context_data', models.JSONField(blank=True, null=True)), ('serial', models.CharField(blank=True, max_length=50)), ('asset_tag', models.CharField(blank=True, max_length=50, null=True, unique=True)), ('comments', models.TextField(blank=True)), - ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='modules', to='dcim.device')), - ('module_bay', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='installed_module', to='dcim.modulebay')), - ('module_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='dcim.moduletype')), + ( + 'device', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='modules', to='dcim.device' + ), + ), + ( + 'module_bay', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name='installed_module', + to='dcim.modulebay', + ), + ), + ( + 'module_type', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='dcim.moduletype' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -498,72 +646,156 @@ class Migration(migrations.Migration): migrations.AddField( model_name='consoleport', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='consoleporttemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='consoleserverport', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='consoleserverporttemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='frontport', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='frontporttemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='interface', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='interfacetemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='poweroutlet', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='poweroutlettemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='powerport', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='powerporttemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AddField( model_name='rearport', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='rearporttemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AlterUniqueTogether( name='consoleporttemplate', @@ -598,7 +830,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), @@ -613,7 +848,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inventoryitem', name='role', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='inventory_items', to='dcim.inventoryitemrole'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='inventory_items', + to='dcim.inventoryitemrole', + ), ), migrations.AddField( model_name='inventoryitem', @@ -623,12 +864,39 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inventoryitem', name='component_type', - field=models.ForeignKey(blank=True, limit_choices_to=models.Q(('app_label', 'dcim'), ('model__in', ('consoleport', 'consoleserverport', 'frontport', 'interface', 'poweroutlet', 'powerport', 'rearport'))), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + ('app_label', 'dcim'), + ( + 'model__in', + ( + 'consoleport', + 'consoleserverport', + 'frontport', + 'interface', + 'poweroutlet', + 'powerport', + 'rearport', + ), + ), + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='interface', name='vrf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='interfaces', to='ipam.vrf'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='interfaces', + to='ipam.vrf', + ), ), migrations.AddField( model_name='interface', @@ -952,7 +1220,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('description', models.CharField(blank=True, max_length=200)), ('component_id', models.PositiveBigIntegerField(blank=True, null=True)), @@ -961,11 +1234,67 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False)), ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), ('level', models.PositiveIntegerField(editable=False)), - ('component_type', models.ForeignKey(blank=True, limit_choices_to=models.Q(('app_label', 'dcim'), ('model__in', ('consoleporttemplate', 'consoleserverporttemplate', 'frontporttemplate', 'interfacetemplate', 'poweroutlettemplate', 'powerporttemplate', 'rearporttemplate'))), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('device_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype')), - ('manufacturer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='inventory_item_templates', to='dcim.manufacturer')), - ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child_items', to='dcim.inventoryitemtemplate')), - ('role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='inventory_item_templates', to='dcim.inventoryitemrole')), + ( + 'component_type', + models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + ('app_label', 'dcim'), + ( + 'model__in', + ( + 'consoleporttemplate', + 'consoleserverporttemplate', + 'frontporttemplate', + 'interfacetemplate', + 'poweroutlettemplate', + 'powerporttemplate', + 'rearporttemplate', + ), + ), + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'device_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), + ), + ( + 'manufacturer', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='inventory_item_templates', + to='dcim.manufacturer', + ), + ), + ( + 'parent', + mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='child_items', + to='dcim.inventoryitemtemplate', + ), + ), + ( + 'role', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='inventory_item_templates', + to='dcim.inventoryitemrole', + ), + ), ], options={ 'ordering': ('device_type__id', 'parent__id', '_name'), @@ -989,11 +1318,21 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), + ), ('label', models.CharField(blank=True, max_length=64)), ('position', models.CharField(blank=True, max_length=30)), ('description', models.CharField(blank=True, max_length=200)), - ('device_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype')), + ( + 'device_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype' + ), + ), ], options={ 'ordering': ('device_type', '_name'), @@ -1088,7 +1427,16 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='device', name='position', - field=models.DecimalField(blank=True, decimal_places=1, max_digits=4, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100.5)]), + field=models.DecimalField( + blank=True, + decimal_places=1, + max_digits=4, + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100.5), + ], + ), ), migrations.AddField( model_name='interface', @@ -1121,12 +1469,66 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('cable_end', models.CharField(max_length=1)), ('termination_id', models.PositiveBigIntegerField()), - ('cable', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='dcim.cable')), - ('termination_type', models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), models.Q(('app_label', 'dcim'), ('model__in', ('consoleport', 'consoleserverport', 'frontport', 'interface', 'powerfeed', 'poweroutlet', 'powerport', 'rearport'))), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('_device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.device')), - ('_rack', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.rack')), - ('_location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location')), - ('_site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.site')), + ( + 'cable', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='dcim.cable' + ), + ), + ( + 'termination_type', + models.ForeignKey( + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'circuits'), ('model__in', ('circuittermination',))), + models.Q( + ('app_label', 'dcim'), + ( + 'model__in', + ( + 'consoleport', + 'consoleserverport', + 'frontport', + 'interface', + 'powerfeed', + 'poweroutlet', + 'powerport', + 'rearport', + ), + ), + ), + _connector='OR', + ) + ), + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + '_device', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.device' + ), + ), + ( + '_rack', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.rack' + ), + ), + ( + '_location', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location' + ), + ), + ( + '_site', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.site' + ), + ), ], options={ 'ordering': ('cable', 'cable_end', 'pk'), @@ -1134,7 +1536,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='cabletermination', - constraint=models.UniqueConstraint(fields=('termination_type', 'termination_id'), name='dcim_cable_termination_unique_termination'), + constraint=models.UniqueConstraint( + fields=('termination_type', 'termination_id'), name='dcim_cable_termination_unique_termination' + ), ), migrations.RenameField( model_name='cablepath', diff --git a/netbox/dcim/migrations/0160_squashed_0166.py b/netbox/dcim/migrations/0160_squashed_0166.py index 440a8115e..0deb58bab 100644 --- a/netbox/dcim/migrations/0160_squashed_0166.py +++ b/netbox/dcim/migrations/0160_squashed_0166.py @@ -6,7 +6,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('dcim', '0160_populate_cable_ends'), ('dcim', '0161_cabling_cleanup'), @@ -14,7 +13,7 @@ class Migration(migrations.Migration): ('dcim', '0163_weight_fields'), ('dcim', '0164_rack_mounting_depth'), ('dcim', '0165_standardize_description_comments'), - ('dcim', '0166_virtualdevicecontext') + ('dcim', '0166_virtualdevicecontext'), ] dependencies = [ @@ -275,7 +274,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='cabletermination', - constraint=models.UniqueConstraint(fields=('termination_type', 'termination_id'), name='dcim_cabletermination_unique_termination'), + constraint=models.UniqueConstraint( + fields=('termination_type', 'termination_id'), name='dcim_cabletermination_unique_termination' + ), ), migrations.AddConstraint( model_name='consoleport', @@ -283,39 +284,64 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='consoleporttemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_consoleporttemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_consoleporttemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='consoleporttemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_consoleporttemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_consoleporttemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='consoleserverport', - constraint=models.UniqueConstraint(fields=('device', 'name'), name='dcim_consoleserverport_unique_device_name'), + constraint=models.UniqueConstraint( + fields=('device', 'name'), name='dcim_consoleserverport_unique_device_name' + ), ), migrations.AddConstraint( model_name='consoleserverporttemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_consoleserverporttemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_consoleserverporttemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='consoleserverporttemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_consoleserverporttemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_consoleserverporttemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='device', - constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), models.F('site'), models.F('tenant'), name='dcim_device_unique_name_site_tenant'), + constraint=models.UniqueConstraint( + django.db.models.functions.text.Lower('name'), + models.F('site'), + models.F('tenant'), + name='dcim_device_unique_name_site_tenant', + ), ), migrations.AddConstraint( model_name='device', - constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), models.F('site'), condition=models.Q(('tenant__isnull', True)), name='dcim_device_unique_name_site', violation_error_message='Device name must be unique per site.'), + constraint=models.UniqueConstraint( + django.db.models.functions.text.Lower('name'), + models.F('site'), + condition=models.Q(('tenant__isnull', True)), + name='dcim_device_unique_name_site', + violation_error_message='Device name must be unique per site.', + ), ), migrations.AddConstraint( model_name='device', - constraint=models.UniqueConstraint(fields=('rack', 'position', 'face'), name='dcim_device_unique_rack_position_face'), + constraint=models.UniqueConstraint( + fields=('rack', 'position', 'face'), name='dcim_device_unique_rack_position_face' + ), ), migrations.AddConstraint( model_name='device', - constraint=models.UniqueConstraint(fields=('virtual_chassis', 'vc_position'), name='dcim_device_unique_virtual_chassis_vc_position'), + constraint=models.UniqueConstraint( + fields=('virtual_chassis', 'vc_position'), name='dcim_device_unique_virtual_chassis_vc_position' + ), ), migrations.AddConstraint( model_name='devicebay', @@ -323,15 +349,21 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='devicebaytemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_devicebaytemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_devicebaytemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='devicetype', - constraint=models.UniqueConstraint(fields=('manufacturer', 'model'), name='dcim_devicetype_unique_manufacturer_model'), + constraint=models.UniqueConstraint( + fields=('manufacturer', 'model'), name='dcim_devicetype_unique_manufacturer_model' + ), ), migrations.AddConstraint( model_name='devicetype', - constraint=models.UniqueConstraint(fields=('manufacturer', 'slug'), name='dcim_devicetype_unique_manufacturer_slug'), + constraint=models.UniqueConstraint( + fields=('manufacturer', 'slug'), name='dcim_devicetype_unique_manufacturer_slug' + ), ), migrations.AddConstraint( model_name='frontport', @@ -339,19 +371,27 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='frontport', - constraint=models.UniqueConstraint(fields=('rear_port', 'rear_port_position'), name='dcim_frontport_unique_rear_port_position'), + constraint=models.UniqueConstraint( + fields=('rear_port', 'rear_port_position'), name='dcim_frontport_unique_rear_port_position' + ), ), migrations.AddConstraint( model_name='frontporttemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_frontporttemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_frontporttemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='frontporttemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_frontporttemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_frontporttemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='frontporttemplate', - constraint=models.UniqueConstraint(fields=('rear_port', 'rear_port_position'), name='dcim_frontporttemplate_unique_rear_port_position'), + constraint=models.UniqueConstraint( + fields=('rear_port', 'rear_port_position'), name='dcim_frontporttemplate_unique_rear_port_position' + ), ), migrations.AddConstraint( model_name='interface', @@ -359,27 +399,46 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='interfacetemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_interfacetemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_interfacetemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='interfacetemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_interfacetemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_interfacetemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='inventoryitem', - constraint=models.UniqueConstraint(fields=('device', 'parent', 'name'), name='dcim_inventoryitem_unique_device_parent_name'), + constraint=models.UniqueConstraint( + fields=('device', 'parent', 'name'), name='dcim_inventoryitem_unique_device_parent_name' + ), ), migrations.AddConstraint( model_name='inventoryitemtemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'parent', 'name'), name='dcim_inventoryitemtemplate_unique_device_type_parent_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'parent', 'name'), + name='dcim_inventoryitemtemplate_unique_device_type_parent_name', + ), ), migrations.AddConstraint( model_name='location', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('site', 'name'), name='dcim_location_name', violation_error_message='A location with this name already exists within the specified site.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('site', 'name'), + name='dcim_location_name', + violation_error_message='A location with this name already exists within the specified site.', + ), ), migrations.AddConstraint( model_name='location', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('site', 'slug'), name='dcim_location_slug', violation_error_message='A location with this slug already exists within the specified site.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('site', 'slug'), + name='dcim_location_slug', + violation_error_message='A location with this slug already exists within the specified site.', + ), ), migrations.AddConstraint( model_name='modulebay', @@ -387,15 +446,21 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='modulebaytemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_modulebaytemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_modulebaytemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='moduletype', - constraint=models.UniqueConstraint(fields=('manufacturer', 'model'), name='dcim_moduletype_unique_manufacturer_model'), + constraint=models.UniqueConstraint( + fields=('manufacturer', 'model'), name='dcim_moduletype_unique_manufacturer_model' + ), ), migrations.AddConstraint( model_name='powerfeed', - constraint=models.UniqueConstraint(fields=('power_panel', 'name'), name='dcim_powerfeed_unique_power_panel_name'), + constraint=models.UniqueConstraint( + fields=('power_panel', 'name'), name='dcim_powerfeed_unique_power_panel_name' + ), ), migrations.AddConstraint( model_name='poweroutlet', @@ -403,11 +468,15 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='poweroutlettemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_poweroutlettemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_poweroutlettemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='poweroutlettemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_poweroutlettemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_poweroutlettemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='powerpanel', @@ -419,11 +488,15 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='powerporttemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_powerporttemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_powerporttemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='powerporttemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_powerporttemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_powerporttemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='rack', @@ -431,7 +504,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='rack', - constraint=models.UniqueConstraint(fields=('location', 'facility_id'), name='dcim_rack_unique_location_facility_id'), + constraint=models.UniqueConstraint( + fields=('location', 'facility_id'), name='dcim_rack_unique_location_facility_id' + ), ), migrations.AddConstraint( model_name='rearport', @@ -439,27 +514,51 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='rearporttemplate', - constraint=models.UniqueConstraint(fields=('device_type', 'name'), name='dcim_rearporttemplate_unique_device_type_name'), + constraint=models.UniqueConstraint( + fields=('device_type', 'name'), name='dcim_rearporttemplate_unique_device_type_name' + ), ), migrations.AddConstraint( model_name='rearporttemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_rearporttemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_rearporttemplate_unique_module_type_name' + ), ), migrations.AddConstraint( model_name='region', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('name',), name='dcim_region_name', violation_error_message='A top-level region with this name already exists.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('name',), + name='dcim_region_name', + violation_error_message='A top-level region with this name already exists.', + ), ), migrations.AddConstraint( model_name='region', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('slug',), name='dcim_region_slug', violation_error_message='A top-level region with this slug already exists.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('slug',), + name='dcim_region_slug', + violation_error_message='A top-level region with this slug already exists.', + ), ), migrations.AddConstraint( model_name='sitegroup', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('name',), name='dcim_sitegroup_name', violation_error_message='A top-level site group with this name already exists.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('name',), + name='dcim_sitegroup_name', + violation_error_message='A top-level site group with this name already exists.', + ), ), migrations.AddConstraint( model_name='sitegroup', - constraint=models.UniqueConstraint(condition=models.Q(('parent__isnull', True)), fields=('slug',), name='dcim_sitegroup_slug', violation_error_message='A top-level site group with this slug already exists.'), + constraint=models.UniqueConstraint( + condition=models.Q(('parent__isnull', True)), + fields=('slug',), + name='dcim_sitegroup_slug', + violation_error_message='A top-level site group with this slug already exists.', + ), ), migrations.AddField( model_name='devicetype', @@ -592,17 +691,56 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('name', models.CharField(max_length=64)), ('status', models.CharField(max_length=50)), ('identifier', models.PositiveSmallIntegerField(blank=True, null=True)), ('comments', models.TextField(blank=True)), - ('device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vdcs', to='dcim.device')), - ('primary_ip4', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress')), - ('primary_ip6', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress')), + ( + 'device', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vdcs', + to='dcim.device', + ), + ), + ( + 'primary_ip4', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), + ), + ( + 'primary_ip6', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vdcs', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vdcs', + to='tenancy.tenant', + ), + ), ], options={ 'ordering': ['name'], @@ -615,7 +753,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='virtualdevicecontext', - constraint=models.UniqueConstraint(fields=('device', 'identifier'), name='dcim_virtualdevicecontext_device_identifier'), + constraint=models.UniqueConstraint( + fields=('device', 'identifier'), name='dcim_virtualdevicecontext_device_identifier' + ), ), migrations.AddConstraint( model_name='virtualdevicecontext', diff --git a/netbox/dcim/migrations/0167_squashed_0182.py b/netbox/dcim/migrations/0167_squashed_0182.py index 735cb3efa..d0ad5379f 100644 --- a/netbox/dcim/migrations/0167_squashed_0182.py +++ b/netbox/dcim/migrations/0167_squashed_0182.py @@ -6,7 +6,6 @@ import utilities.fields class Migration(migrations.Migration): - replaces = [ ('dcim', '0167_module_status'), ('dcim', '0168_interface_template_enabled'), @@ -24,7 +23,7 @@ class Migration(migrations.Migration): ('dcim', '0179_interfacetemplate_rf_role'), ('dcim', '0180_powerfeed_tenant'), ('dcim', '0181_rename_device_role_device_role'), - ('dcim', '0182_zero_length_cable_fix') + ('dcim', '0182_zero_length_cable_fix'), ] dependencies = [ @@ -48,27 +47,57 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interfacetemplate', name='bridge', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bridge_interfaces', to='dcim.interfacetemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='bridge_interfaces', + to='dcim.interfacetemplate', + ), ), migrations.AddField( model_name='devicetype', name='default_platform', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='dcim.platform'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='dcim.platform', + ), ), migrations.AddField( model_name='device', name='config_template', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='%(class)ss', to='extras.configtemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='%(class)ss', + to='extras.configtemplate', + ), ), migrations.AddField( model_name='devicerole', name='config_template', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='device_roles', to='extras.configtemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='device_roles', + to='extras.configtemplate', + ), ), migrations.AddField( model_name='platform', name='config_template', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='platforms', to='extras.configtemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='platforms', + to='extras.configtemplate', + ), ), migrations.AddField( model_name='cabletermination', @@ -83,22 +112,30 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='powerport', name='allocated_draw', - field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)]), + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), ), migrations.AlterField( model_name='powerport', name='maximum_draw', - field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)]), + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), ), migrations.AlterField( model_name='powerporttemplate', name='allocated_draw', - field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)]), + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), ), migrations.AlterField( model_name='powerporttemplate', name='maximum_draw', - field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)]), + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), ), migrations.RemoveField( model_name='platform', @@ -126,112 +163,160 @@ class Migration(migrations.Migration): migrations.AddField( model_name='device', name='oob_ip', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), ), migrations.AddField( model_name='device', name='console_port_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ConsolePort'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.ConsolePort' + ), ), migrations.AddField( model_name='device', name='console_server_port_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ConsoleServerPort'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.ConsoleServerPort' + ), ), migrations.AddField( model_name='device', name='power_port_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.PowerPort'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.PowerPort' + ), ), migrations.AddField( model_name='device', name='power_outlet_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.PowerOutlet'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.PowerOutlet' + ), ), migrations.AddField( model_name='device', name='interface_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.Interface'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.Interface' + ), ), migrations.AddField( model_name='device', name='front_port_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.FrontPort'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.FrontPort' + ), ), migrations.AddField( model_name='device', name='rear_port_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.RearPort'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.RearPort' + ), ), migrations.AddField( model_name='device', name='device_bay_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.DeviceBay'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.DeviceBay' + ), ), migrations.AddField( model_name='device', name='module_bay_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.ModuleBay'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.ModuleBay' + ), ), migrations.AddField( model_name='device', name='inventory_item_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device', to_model='dcim.InventoryItem'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device', to_model='dcim.InventoryItem' + ), ), migrations.AddField( model_name='devicetype', name='console_port_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ConsolePortTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.ConsolePortTemplate' + ), ), migrations.AddField( model_name='devicetype', name='console_server_port_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ConsoleServerPortTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.ConsoleServerPortTemplate' + ), ), migrations.AddField( model_name='devicetype', name='power_port_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.PowerPortTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.PowerPortTemplate' + ), ), migrations.AddField( model_name='devicetype', name='power_outlet_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.PowerOutletTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.PowerOutletTemplate' + ), ), migrations.AddField( model_name='devicetype', name='interface_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.InterfaceTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.InterfaceTemplate' + ), ), migrations.AddField( model_name='devicetype', name='front_port_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.FrontPortTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.FrontPortTemplate' + ), ), migrations.AddField( model_name='devicetype', name='rear_port_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.RearPortTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.RearPortTemplate' + ), ), migrations.AddField( model_name='devicetype', name='device_bay_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.DeviceBayTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.DeviceBayTemplate' + ), ), migrations.AddField( model_name='devicetype', name='module_bay_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.ModuleBayTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.ModuleBayTemplate' + ), ), migrations.AddField( model_name='devicetype', name='inventory_item_template_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='device_type', to_model='dcim.InventoryItemTemplate'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='device_type', to_model='dcim.InventoryItemTemplate' + ), ), migrations.AddField( model_name='virtualchassis', name='member_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='virtual_chassis', to_model='dcim.Device'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='virtual_chassis', to_model='dcim.Device' + ), ), migrations.AddField( model_name='interfacetemplate', @@ -241,7 +326,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='powerfeed', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='power_feeds', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='power_feeds', + to='tenancy.tenant', + ), ), migrations.RenameField( model_name='device', diff --git a/netbox/dcim/migrations/0184_protect_child_interfaces.py b/netbox/dcim/migrations/0184_protect_child_interfaces.py index 3459e23fc..58eca506d 100644 --- a/netbox/dcim/migrations/0184_protect_child_interfaces.py +++ b/netbox/dcim/migrations/0184_protect_child_interfaces.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ('dcim', '0183_devicetype_exclude_from_utilization'), ] @@ -14,6 +13,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='interface', name='parent', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.RESTRICT, related_name='child_interfaces', to='dcim.interface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.RESTRICT, + related_name='child_interfaces', + to='dcim.interface', + ), ), ] diff --git a/netbox/dcim/migrations/0185_gfk_indexes.py b/netbox/dcim/migrations/0185_gfk_indexes.py index 84cdc53ff..5c099b380 100644 --- a/netbox/dcim/migrations/0185_gfk_indexes.py +++ b/netbox/dcim/migrations/0185_gfk_indexes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0184_protect_child_interfaces'), ] diff --git a/netbox/dcim/migrations/0186_location_facility.py b/netbox/dcim/migrations/0186_location_facility.py index 759ee813b..3d22503b6 100644 --- a/netbox/dcim/migrations/0186_location_facility.py +++ b/netbox/dcim/migrations/0186_location_facility.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0185_gfk_indexes'), ] diff --git a/netbox/dcim/migrations/0187_alter_device_vc_position.py b/netbox/dcim/migrations/0187_alter_device_vc_position.py index d4a42dc20..10b636959 100644 --- a/netbox/dcim/migrations/0187_alter_device_vc_position.py +++ b/netbox/dcim/migrations/0187_alter_device_vc_position.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0186_location_facility'), ] diff --git a/netbox/dcim/migrations/0188_racktype.py b/netbox/dcim/migrations/0188_racktype.py index aa45246e5..a5265d030 100644 --- a/netbox/dcim/migrations/0188_racktype.py +++ b/netbox/dcim/migrations/0188_racktype.py @@ -9,7 +9,6 @@ import utilities.ordering class Migration(migrations.Migration): - dependencies = [ ('extras', '0118_customfield_uniqueness'), ('dcim', '0187_alter_device_vc_position'), @@ -22,36 +21,41 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField( - blank=True, - default=dict, - encoder=utilities.json.CustomFieldJSONEncoder - )), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('weight', models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True)), ('weight_unit', models.CharField(blank=True, max_length=50)), ('_abs_weight', models.PositiveBigIntegerField(blank=True, null=True)), - ('manufacturer', models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name='rack_types', - to='dcim.manufacturer' - )), + ( + 'manufacturer', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='rack_types', to='dcim.manufacturer' + ), + ), ('model', models.CharField(max_length=100)), ('slug', models.SlugField(max_length=100, unique=True)), ('form_factor', models.CharField(max_length=50)), ('width', models.PositiveSmallIntegerField(default=19)), - ('u_height', models.PositiveSmallIntegerField( - default=42, - validators=[ - django.core.validators.MinValueValidator(1), - django.core.validators.MaxValueValidator(100), - ] - )), - ('starting_unit', models.PositiveSmallIntegerField( - default=1, - validators=[django.core.validators.MinValueValidator(1)] - )), + ( + 'u_height', + models.PositiveSmallIntegerField( + default=42, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(100), + ], + ), + ), + ( + 'starting_unit', + models.PositiveSmallIntegerField( + default=1, validators=[django.core.validators.MinValueValidator(1)] + ), + ), ('desc_units', models.BooleanField(default=False)), ('outer_width', models.PositiveSmallIntegerField(blank=True, null=True)), ('outer_depth', models.PositiveSmallIntegerField(blank=True, null=True)), diff --git a/netbox/dcim/migrations/0189_moduletype_rack_airflow.py b/netbox/dcim/migrations/0189_moduletype_rack_airflow.py index 31787b67d..c356e32f7 100644 --- a/netbox/dcim/migrations/0189_moduletype_rack_airflow.py +++ b/netbox/dcim/migrations/0189_moduletype_rack_airflow.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0188_racktype'), ] diff --git a/netbox/dcim/migrations/0190_nested_modules.py b/netbox/dcim/migrations/0190_nested_modules.py index 9cef40efb..239e08639 100644 --- a/netbox/dcim/migrations/0190_nested_modules.py +++ b/netbox/dcim/migrations/0190_nested_modules.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0189_moduletype_rack_airflow'), ('extras', '0121_customfield_related_object_filter'), @@ -34,12 +33,25 @@ class Migration(migrations.Migration): migrations.AddField( model_name='modulebay', name='module', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.module'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.module', + ), ), migrations.AddField( model_name='modulebay', name='parent', - field=mptt.fields.TreeForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='dcim.modulebay'), + field=mptt.fields.TreeForeignKey( + blank=True, + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='dcim.modulebay', + ), ), migrations.AddField( model_name='modulebay', @@ -56,19 +68,35 @@ class Migration(migrations.Migration): migrations.AddField( model_name='modulebaytemplate', name='module_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.moduletype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.moduletype', + ), ), migrations.AlterField( model_name='modulebaytemplate', name='device_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='dcim.devicetype'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='dcim.devicetype', + ), ), migrations.AddConstraint( model_name='modulebay', - constraint=models.UniqueConstraint(fields=('device', 'module', 'name'), name='dcim_modulebay_unique_device_module_name'), + constraint=models.UniqueConstraint( + fields=('device', 'module', 'name'), name='dcim_modulebay_unique_device_module_name' + ), ), migrations.AddConstraint( model_name='modulebaytemplate', - constraint=models.UniqueConstraint(fields=('module_type', 'name'), name='dcim_modulebaytemplate_unique_module_type_name'), + constraint=models.UniqueConstraint( + fields=('module_type', 'name'), name='dcim_modulebaytemplate_unique_module_type_name' + ), ), ] diff --git a/netbox/dcim/migrations/0191_module_bay_rebuild.py b/netbox/dcim/migrations/0191_module_bay_rebuild.py index 260063213..4f8a461f2 100644 --- a/netbox/dcim/migrations/0191_module_bay_rebuild.py +++ b/netbox/dcim/migrations/0191_module_bay_rebuild.py @@ -13,14 +13,10 @@ def rebuild_mptt(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('dcim', '0190_nested_modules'), ] operations = [ - migrations.RunPython( - code=rebuild_mptt, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=rebuild_mptt, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/dcim/migrations/0192_inventoryitem_status.py b/netbox/dcim/migrations/0192_inventoryitem_status.py index 335ab2ca7..027f2daef 100644 --- a/netbox/dcim/migrations/0192_inventoryitem_status.py +++ b/netbox/dcim/migrations/0192_inventoryitem_status.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0191_module_bay_rebuild'), ] diff --git a/netbox/dcim/migrations/0193_poweroutlet_color.py b/netbox/dcim/migrations/0193_poweroutlet_color.py index 0a6c08b48..f7e3c430c 100644 --- a/netbox/dcim/migrations/0193_poweroutlet_color.py +++ b/netbox/dcim/migrations/0193_poweroutlet_color.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('dcim', '0192_inventoryitem_status'), ] diff --git a/netbox/dcim/migrations/0194_charfield_null_choices.py b/netbox/dcim/migrations/0194_charfield_null_choices.py index 8e507c050..83c056386 100644 --- a/netbox/dcim/migrations/0194_charfield_null_choices.py +++ b/netbox/dcim/migrations/0194_charfield_null_choices.py @@ -69,7 +69,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('dcim', '0193_poweroutlet_color'), ] @@ -280,8 +279,5 @@ class Migration(migrations.Migration): name='cable_end', field=models.CharField(blank=True, max_length=1, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/dcim/migrations/0195_interface_vlan_translation_policy.py b/netbox/dcim/migrations/0195_interface_vlan_translation_policy.py index 42ff1205a..9ec404886 100644 --- a/netbox/dcim/migrations/0195_interface_vlan_translation_policy.py +++ b/netbox/dcim/migrations/0195_interface_vlan_translation_policy.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0194_charfield_null_choices'), ('ipam', '0074_vlantranslationpolicy_vlantranslationrule'), @@ -15,6 +14,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='vlan_translation_policy', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlantranslationpolicy'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlantranslationpolicy' + ), ), ] diff --git a/netbox/dcim/migrations/0196_qinq_svlan.py b/netbox/dcim/migrations/0196_qinq_svlan.py index 9012d74f3..a03ad144a 100644 --- a/netbox/dcim/migrations/0196_qinq_svlan.py +++ b/netbox/dcim/migrations/0196_qinq_svlan.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0195_interface_vlan_translation_policy'), ('ipam', '0075_vlan_qinq'), @@ -13,7 +12,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='interface', name='qinq_svlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_svlan', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='%(class)ss_svlan', + to='ipam.vlan', + ), ), migrations.AlterField( model_name='interface', @@ -23,6 +28,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='interface', name='untagged_vlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_as_untagged', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='%(class)ss_as_untagged', + to='ipam.vlan', + ), ), ] diff --git a/netbox/dcim/migrations/0197_natural_sort_collation.py b/netbox/dcim/migrations/0197_natural_sort_collation.py index a77632b37..268bda7eb 100644 --- a/netbox/dcim/migrations/0197_natural_sort_collation.py +++ b/netbox/dcim/migrations/0197_natural_sort_collation.py @@ -3,15 +3,14 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('dcim', '0196_qinq_svlan'), ] operations = [ CreateCollation( - "natural_sort", - provider="icu", - locale="und-u-kn-true", + 'natural_sort', + provider='icu', + locale='und-u-kn-true', ), ] diff --git a/netbox/dcim/migrations/0198_natural_ordering.py b/netbox/dcim/migrations/0198_natural_ordering.py index 83e94a195..cf4361a2b 100644 --- a/netbox/dcim/migrations/0198_natural_ordering.py +++ b/netbox/dcim/migrations/0198_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0197_natural_sort_collation'), ] diff --git a/netbox/dcim/migrations/0199_macaddress.py b/netbox/dcim/migrations/0199_macaddress.py index 8068c7436..ae18d5f63 100644 --- a/netbox/dcim/migrations/0199_macaddress.py +++ b/netbox/dcim/migrations/0199_macaddress.py @@ -7,7 +7,6 @@ import utilities.json class Migration(migrations.Migration): - dependencies = [ ('dcim', '0198_natural_ordering'), ('extras', '0122_charfield_null_choices'), @@ -20,17 +19,33 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('mac_address', dcim.fields.MACAddressField()), ('assigned_object_id', models.PositiveBigIntegerField(blank=True, null=True)), - ('assigned_object_type', models.ForeignKey(blank=True, limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), + ( + 'assigned_object_type', + models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'dcim'), ('model', 'interface')), + models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), + _connector='OR', + ) + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], - options={ - 'abstract': False, - 'ordering': ('mac_address',) - }, + options={'abstract': False, 'ordering': ('mac_address',)}, ), ] diff --git a/netbox/dcim/migrations/0200_populate_mac_addresses.py b/netbox/dcim/migrations/0200_populate_mac_addresses.py index 1f3c5dee9..0cd18d78e 100644 --- a/netbox/dcim/migrations/0200_populate_mac_addresses.py +++ b/netbox/dcim/migrations/0200_populate_mac_addresses.py @@ -10,9 +10,7 @@ def populate_mac_addresses(apps, schema_editor): mac_addresses = [ MACAddress( - mac_address=interface.mac_address, - assigned_object_type=interface_ct, - assigned_object_id=interface.pk + mac_address=interface.mac_address, assigned_object_type=interface_ct, assigned_object_id=interface.pk ) for interface in Interface.objects.filter(mac_address__isnull=False) ] @@ -24,7 +22,6 @@ def populate_mac_addresses(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('dcim', '0199_macaddress'), ] @@ -38,13 +35,10 @@ class Migration(migrations.Migration): null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', - to='dcim.macaddress' + to='dcim.macaddress', ), ), - migrations.RunPython( - code=populate_mac_addresses, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=populate_mac_addresses, reverse_code=migrations.RunPython.noop), migrations.RemoveField( model_name='interface', name='mac_address', diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py index ddd4d2426..b4f057711 100644 --- a/netbox/dcim/models/device_component_templates.py +++ b/netbox/dcim/models/device_component_templates.py @@ -311,7 +311,9 @@ class PowerPortTemplate(ModularComponentTemplateModel): if self.maximum_draw is not None and self.allocated_draw is not None: if self.allocated_draw > self.maximum_draw: raise ValidationError({ - 'allocated_draw': _("Allocated draw cannot exceed the maximum draw ({maximum_draw}W).").format(maximum_draw=self.maximum_draw) + 'allocated_draw': _( + "Allocated draw cannot exceed the maximum draw ({maximum_draw}W)." + ).format(maximum_draw=self.maximum_draw) }) def to_yaml(self): @@ -365,11 +367,15 @@ class PowerOutletTemplate(ModularComponentTemplateModel): if self.power_port: if self.device_type and self.power_port.device_type != self.device_type: raise ValidationError( - _("Parent power port ({power_port}) must belong to the same device type").format(power_port=self.power_port) + _("Parent power port ({power_port}) must belong to the same device type").format( + power_port=self.power_port + ) ) if self.module_type and self.power_port.module_type != self.module_type: raise ValidationError( - _("Parent power port ({power_port}) must belong to the same module type").format(power_port=self.power_port) + _("Parent power port ({power_port}) must belong to the same module type").format( + power_port=self.power_port + ) ) def instantiate(self, **kwargs): @@ -467,11 +473,15 @@ class InterfaceTemplate(ModularComponentTemplateModel): raise ValidationError({'bridge': _("An interface cannot be bridged to itself.")}) if self.device_type and self.device_type != self.bridge.device_type: raise ValidationError({ - 'bridge': _("Bridge interface ({bridge}) must belong to the same device type").format(bridge=self.bridge) + 'bridge': _( + "Bridge interface ({bridge}) must belong to the same device type" + ).format(bridge=self.bridge) }) if self.module_type and self.module_type != self.bridge.module_type: raise ValidationError({ - 'bridge': _("Bridge interface ({bridge}) must belong to the same module type").format(bridge=self.bridge) + 'bridge': _( + "Bridge interface ({bridge}) must belong to the same module type" + ).format(bridge=self.bridge) }) if self.rf_role and self.type not in WIRELESS_IFACE_TYPES: @@ -714,7 +724,9 @@ class DeviceBayTemplate(ComponentTemplateModel): def clean(self): if self.device_type and self.device_type.subdevice_role != SubdeviceRoleChoices.ROLE_PARENT: raise ValidationError( - _("Subdevice role of device type ({device_type}) must be set to \"parent\" to allow device bays.").format(device_type=self.device_type) + _( + 'Subdevice role of device type ({device_type}) must be set to "parent" to allow device bays.' + ).format(device_type=self.device_type) ) def to_yaml(self): diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index b49d680a3..1fbffa54b 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -532,7 +532,10 @@ def update_interface_bridges(device, interface_templates, module=None): interface = Interface.objects.get(device=device, name=interface_template.resolve_name(module=module)) if interface_template.bridge: - interface.bridge = Interface.objects.get(device=device, name=interface_template.bridge.resolve_name(module=module)) + interface.bridge = Interface.objects.get( + device=device, + name=interface_template.bridge.resolve_name(module=module) + ) interface.full_clean() interface.save() @@ -909,7 +912,10 @@ class Device( }) if self.primary_ip4.assigned_object in vc_interfaces: pass - elif self.primary_ip4.nat_inside is not None and self.primary_ip4.nat_inside.assigned_object in vc_interfaces: + elif ( + self.primary_ip4.nat_inside is not None and + self.primary_ip4.nat_inside.assigned_object in vc_interfaces + ): pass else: raise ValidationError({ @@ -924,7 +930,10 @@ class Device( }) if self.primary_ip6.assigned_object in vc_interfaces: pass - elif self.primary_ip6.nat_inside is not None and self.primary_ip6.nat_inside.assigned_object in vc_interfaces: + elif ( + self.primary_ip6.nat_inside is not None and + self.primary_ip6.nat_inside.assigned_object in vc_interfaces + ): pass else: raise ValidationError({ @@ -978,9 +987,10 @@ class Device( if hasattr(self, 'vc_master_for') and self.vc_master_for and self.vc_master_for != self.virtual_chassis: raise ValidationError({ - 'virtual_chassis': _('Device cannot be removed from virtual chassis {virtual_chassis} because it is currently designated as its master.').format( - virtual_chassis=self.vc_master_for - ) + 'virtual_chassis': _( + 'Device cannot be removed from virtual chassis {virtual_chassis} because it is currently ' + 'designated as its master.' + ).format(virtual_chassis=self.vc_master_for) }) def _instantiate_components(self, queryset, bulk_create=True): diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 08b7f5a35..78eb0ea4a 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -379,7 +379,9 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): min_height = top_device.position + top_device.device_type.u_height - self.starting_unit if self.u_height < min_height: raise ValidationError({ - 'u_height': _("Rack must be at least {min_height}U tall to house currently installed devices.").format(min_height=min_height) + 'u_height': _( + "Rack must be at least {min_height}U tall to house currently installed devices." + ).format(min_height=min_height) }) # Validate that the Rack's starting unit is less than or equal to the position of the lowest mounted Device diff --git a/netbox/dcim/svg/racks.py b/netbox/dcim/svg/racks.py index 0f73095b5..81f8ad3a5 100644 --- a/netbox/dcim/svg/racks.py +++ b/netbox/dcim/svg/racks.py @@ -153,7 +153,10 @@ class RackElevationSVG: if self.rack.desc_units: y += int((position - self.rack.starting_unit) * self.unit_height) else: - y += int((self.rack.u_height - position + self.rack.starting_unit) * self.unit_height) - int(height * self.unit_height) + y += ( + int((self.rack.u_height - position + self.rack.starting_unit) * self.unit_height) - + int(height * self.unit_height) + ) return x, y diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 494d83114..59d0845d5 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -391,7 +391,8 @@ class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable): model = models.ConsolePort fields = ( 'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description', - 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'inventory_items', 'tags', 'created', 'last_updated', + 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'inventory_items', 'tags', 'created', + 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description') @@ -431,7 +432,8 @@ class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable): model = models.ConsoleServerPort fields = ( 'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'type', 'speed', 'description', - 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'inventory_items', 'tags', 'created', 'last_updated', + 'mark_connected', 'cable', 'cable_color', 'link_peer', 'connection', 'inventory_items', 'tags', 'created', + 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description') @@ -987,8 +989,8 @@ class InventoryItemTable(DeviceComponentTable): class Meta(NetBoxTable.Meta): model = models.InventoryItem fields = ( - 'pk', 'id', 'name', 'device', 'parent', 'component', 'label', 'status', 'role', 'manufacturer', 'part_id', 'serial', - 'asset_tag', 'description', 'discovered', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'device', 'parent', 'component', 'label', 'status', 'role', 'manufacturer', 'part_id', + 'serial', 'asset_tag', 'description', 'discovered', 'tags', 'created', 'last_updated', ) default_columns = ( 'pk', 'name', 'device', 'label', 'status', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', @@ -1006,8 +1008,8 @@ class DeviceInventoryItemTable(InventoryItemTable): class Meta(NetBoxTable.Meta): model = models.InventoryItem fields = ( - 'pk', 'id', 'name', 'label', 'status', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component', - 'description', 'discovered', 'tags', 'actions', + 'pk', 'id', 'name', 'label', 'status', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', + 'component', 'description', 'discovered', 'tags', 'actions', ) default_columns = ( 'pk', 'name', 'label', 'status', 'role', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'component', diff --git a/netbox/dcim/tests/test_api.py b/netbox/dcim/tests/test_api.py index f78722b67..c273e02dd 100644 --- a/netbox/dcim/tests/test_api.py +++ b/netbox/dcim/tests/test_api.py @@ -205,13 +205,41 @@ class LocationTest(APIViewTestCases.APIViewTestCase): Site.objects.bulk_create(sites) parent_locations = ( - Location.objects.create(site=sites[0], name='Parent Location 1', slug='parent-location-1', status=LocationStatusChoices.STATUS_ACTIVE), - Location.objects.create(site=sites[1], name='Parent Location 2', slug='parent-location-2', status=LocationStatusChoices.STATUS_ACTIVE), + Location.objects.create( + site=sites[0], + name='Parent Location 1', + slug='parent-location-1', + status=LocationStatusChoices.STATUS_ACTIVE, + ), + Location.objects.create( + site=sites[1], + name='Parent Location 2', + slug='parent-location-2', + status=LocationStatusChoices.STATUS_ACTIVE, + ), ) - Location.objects.create(site=sites[0], name='Location 1', slug='location-1', parent=parent_locations[0], status=LocationStatusChoices.STATUS_ACTIVE) - Location.objects.create(site=sites[0], name='Location 2', slug='location-2', parent=parent_locations[0], status=LocationStatusChoices.STATUS_ACTIVE) - Location.objects.create(site=sites[0], name='Location 3', slug='location-3', parent=parent_locations[0], status=LocationStatusChoices.STATUS_ACTIVE) + Location.objects.create( + site=sites[0], + name='Location 1', + slug='location-1', + parent=parent_locations[0], + status=LocationStatusChoices.STATUS_ACTIVE, + ) + Location.objects.create( + site=sites[0], + name='Location 2', + slug='location-2', + parent=parent_locations[0], + status=LocationStatusChoices.STATUS_ACTIVE, + ) + Location.objects.create( + site=sites[0], + name='Location 3', + slug='location-3', + parent=parent_locations[0], + status=LocationStatusChoices.STATUS_ACTIVE, + ) cls.create_data = [ { @@ -290,9 +318,24 @@ class RackTypeTest(APIViewTestCases.APIViewTestCase): Manufacturer.objects.bulk_create(manufacturers) rack_types = ( - RackType(manufacturer=manufacturers[0], model='Rack Type 1', slug='rack-type-1', form_factor=RackFormFactorChoices.TYPE_CABINET,), - RackType(manufacturer=manufacturers[0], model='Rack Type 2', slug='rack-type-2', form_factor=RackFormFactorChoices.TYPE_CABINET,), - RackType(manufacturer=manufacturers[0], model='Rack Type 3', slug='rack-type-3', form_factor=RackFormFactorChoices.TYPE_CABINET,), + RackType( + manufacturer=manufacturers[0], + model='Rack Type 1', + slug='rack-type-1', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), + RackType( + manufacturer=manufacturers[0], + model='Rack Type 2', + slug='rack-type-2', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), + RackType( + manufacturer=manufacturers[0], + model='Rack Type 3', + slug='rack-type-3', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), ) RackType.objects.bulk_create(rack_types) @@ -1050,10 +1093,18 @@ class InventoryItemTemplateTest(APIViewTestCases.APIViewTestCase): role = InventoryItemRole.objects.create(name='Inventory Item Role 1', slug='inventory-item-role-1') inventory_item_templates = ( - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 1', manufacturer=manufacturer, role=role), - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 2', manufacturer=manufacturer, role=role), - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 3', manufacturer=manufacturer, role=role), - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 4', manufacturer=manufacturer, role=role), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 1', manufacturer=manufacturer, role=role + ), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 2', manufacturer=manufacturer, role=role + ), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 3', manufacturer=manufacturer, role=role + ), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 4', manufacturer=manufacturer, role=role + ), ) for item in inventory_item_templates: item.save() @@ -1961,9 +2012,15 @@ class InventoryItemTest(APIViewTestCases.APIViewTestCase): ) Interface.objects.bulk_create(interfaces) - InventoryItem.objects.create(device=device, name='Inventory Item 1', role=roles[0], manufacturer=manufacturer, component=interfaces[0]) - InventoryItem.objects.create(device=device, name='Inventory Item 2', role=roles[0], manufacturer=manufacturer, component=interfaces[1]) - InventoryItem.objects.create(device=device, name='Inventory Item 3', role=roles[0], manufacturer=manufacturer, component=interfaces[2]) + InventoryItem.objects.create( + device=device, name='Inventory Item 1', role=roles[0], manufacturer=manufacturer, component=interfaces[0] + ) + InventoryItem.objects.create( + device=device, name='Inventory Item 2', role=roles[0], manufacturer=manufacturer, component=interfaces[1] + ) + InventoryItem.objects.create( + device=device, name='Inventory Item 3', role=roles[0], manufacturer=manufacturer, component=interfaces[2] + ) cls.create_data = [ { diff --git a/netbox/dcim/tests/test_cablepaths.py b/netbox/dcim/tests/test_cablepaths.py index b504d389a..1acc9a8a1 100644 --- a/netbox/dcim/tests/test_cablepaths.py +++ b/netbox/dcim/tests/test_cablepaths.py @@ -661,24 +661,64 @@ class CablePathTestCase(TestCase): ) cable5.save() path1 = self.assertPathExists( - ([interface1, interface2], cable1, frontport1_1, rearport1, cable3, rearport2, frontport2_1, cable4, [interface5, interface6]), + ( + [interface1, interface2], + cable1, + frontport1_1, + rearport1, + cable3, + rearport2, + frontport2_1, + cable4, + [interface5, interface6], + ), is_complete=True, - is_active=True + is_active=True, ) path2 = self.assertPathExists( - ([interface3, interface4], cable2, frontport1_2, rearport1, cable3, rearport2, frontport2_2, cable5, [interface7, interface8]), + ( + [interface3, interface4], + cable2, + frontport1_2, + rearport1, + cable3, + rearport2, + frontport2_2, + cable5, + [interface7, interface8], + ), is_complete=True, - is_active=True + is_active=True, ) path3 = self.assertPathExists( - ([interface5, interface6], cable4, frontport2_1, rearport2, cable3, rearport1, frontport1_1, cable1, [interface1, interface2]), + ( + [interface5, interface6], + cable4, + frontport2_1, + rearport2, + cable3, + rearport1, + frontport1_1, + cable1, + [interface1, interface2], + ), is_complete=True, - is_active=True + is_active=True, ) path4 = self.assertPathExists( - ([interface7, interface8], cable5, frontport2_2, rearport2, cable3, rearport1, frontport1_2, cable2, [interface3, interface4]), + ( + [interface7, interface8], + cable5, + frontport2_2, + rearport2, + cable3, + rearport1, + frontport1_2, + cable2, + [interface3, interface4], + ), is_complete=True, - is_active=True + is_active=True, ) self.assertEqual(CablePath.objects.count(), 4) @@ -1167,7 +1207,11 @@ class CablePathTestCase(TestCase): [IF1] --C1-- [CT1] """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) # Create cable 1 cable1 = Cable( @@ -1198,7 +1242,11 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') interface2 = Interface.objects.create(device=self.device, name='Interface 2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) # Create cable 1 cable1 = Cable( @@ -1214,7 +1262,11 @@ class CablePathTestCase(TestCase): ) # Create CT2 - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='Z' + ) # Check for partial path to site self.assertPathExists( @@ -1266,7 +1318,11 @@ class CablePathTestCase(TestCase): interface2 = Interface.objects.create(device=self.device, name='Interface 2') interface3 = Interface.objects.create(device=self.device, name='Interface 3') interface4 = Interface.objects.create(device=self.device, name='Interface 4') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) # Create cable 1 cable1 = Cable( @@ -1282,7 +1338,11 @@ class CablePathTestCase(TestCase): ) # Create CT2 - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='Z' + ) # Check for partial path to site self.assertPathExists( @@ -1299,14 +1359,28 @@ class CablePathTestCase(TestCase): # Check for complete path in each direction self.assertPathExists( - ([interface1, interface2], cable1, circuittermination1, circuittermination2, cable2, [interface3, interface4]), + ( + [interface1, interface2], + cable1, + circuittermination1, + circuittermination2, + cable2, + [interface3, interface4], + ), is_complete=True, - is_active=True + is_active=True, ) self.assertPathExists( - ([interface3, interface4], cable2, circuittermination2, circuittermination1, cable1, [interface1, interface2]), + ( + [interface3, interface4], + cable2, + circuittermination2, + circuittermination1, + cable1, + [interface1, interface2], + ), is_complete=True, - is_active=True + is_active=True, ) self.assertEqual(CablePath.objects.count(), 2) @@ -1335,8 +1409,16 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') site2 = Site.objects.create(name='Site 2', slug='site-2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=site2, term_side='Z') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=site2, + term_side='Z' + ) # Create cable 1 cable1 = Cable( @@ -1365,8 +1447,16 @@ class CablePathTestCase(TestCase): """ interface1 = Interface.objects.create(device=self.device, name='Interface 1') providernetwork = ProviderNetwork.objects.create(name='Provider Network 1', provider=self.circuit.provider) - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=providernetwork, term_side='Z') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=providernetwork, + term_side='Z' + ) # Create cable 1 cable1 = Cable( @@ -1413,8 +1503,15 @@ class CablePathTestCase(TestCase): frontport2_2 = FrontPort.objects.create( device=self.device, name='Front Port 2:2', rear_port=rearport2, rear_port_position=2 ) - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, term_side='Z' + ) # Create cables cable1 = Cable( @@ -1499,10 +1596,26 @@ class CablePathTestCase(TestCase): interface1 = Interface.objects.create(device=self.device, name='Interface 1') interface2 = Interface.objects.create(device=self.device, name='Interface 2') circuit2 = Circuit.objects.create(provider=self.circuit.provider, type=self.circuit.type, cid='Circuit 2') - circuittermination1 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='A') - circuittermination2 = CircuitTermination.objects.create(circuit=self.circuit, termination=self.site, term_side='Z') - circuittermination3 = CircuitTermination.objects.create(circuit=circuit2, termination=self.site, term_side='A') - circuittermination4 = CircuitTermination.objects.create(circuit=circuit2, termination=self.site, term_side='Z') + circuittermination1 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='A' + ) + circuittermination2 = CircuitTermination.objects.create( + circuit=self.circuit, + termination=self.site, + term_side='Z' + ) + circuittermination3 = CircuitTermination.objects.create( + circuit=circuit2, + termination=self.site, + term_side='A' + ) + circuittermination4 = CircuitTermination.objects.create( + circuit=circuit2, + termination=self.site, + term_side='Z' + ) # Create cables cable1 = Cable( @@ -1706,45 +1819,95 @@ class CablePathTestCase(TestCase): ) cable3.save() self.assertPathExists( - (interface1, cable1, (frontport1_1, frontport1_2), rearport1, cable3, rearport2, (frontport2_1, frontport2_2)), - is_complete=False + ( + interface1, + cable1, + (frontport1_1, frontport1_2), + rearport1, + cable3, + rearport2, + (frontport2_1, frontport2_2), + ), + is_complete=False, ) self.assertPathExists( - (interface2, cable2, (frontport1_3, frontport1_4), rearport1, cable3, rearport2, (frontport2_3, frontport2_4)), - is_complete=False + ( + interface2, + cable2, + (frontport1_3, frontport1_4), + rearport1, + cable3, + rearport2, + (frontport2_3, frontport2_4), + ), + is_complete=False, ) self.assertEqual(CablePath.objects.count(), 2) # Create cables 4-5 - cable4 = Cable( - a_terminations=[frontport2_1, frontport2_2], - b_terminations=[interface3] - ) + cable4 = Cable(a_terminations=[frontport2_1, frontport2_2], b_terminations=[interface3]) cable4.save() - cable5 = Cable( - a_terminations=[frontport2_3, frontport2_4], - b_terminations=[interface4] - ) + cable5 = Cable(a_terminations=[frontport2_3, frontport2_4], b_terminations=[interface4]) cable5.save() path1 = self.assertPathExists( - (interface1, cable1, (frontport1_1, frontport1_2), rearport1, cable3, rearport2, (frontport2_1, frontport2_2), cable4, interface3), + ( + interface1, + cable1, + (frontport1_1, frontport1_2), + rearport1, + cable3, + rearport2, + (frontport2_1, frontport2_2), + cable4, + interface3, + ), is_complete=True, - is_active=True + is_active=True, ) path2 = self.assertPathExists( - (interface2, cable2, (frontport1_3, frontport1_4), rearport1, cable3, rearport2, (frontport2_3, frontport2_4), cable5, interface4), + ( + interface2, + cable2, + (frontport1_3, frontport1_4), + rearport1, + cable3, + rearport2, + (frontport2_3, frontport2_4), + cable5, + interface4, + ), is_complete=True, - is_active=True + is_active=True, ) path3 = self.assertPathExists( - (interface3, cable4, (frontport2_1, frontport2_2), rearport2, cable3, rearport1, (frontport1_1, frontport1_2), cable1, interface1), + ( + interface3, + cable4, + (frontport2_1, frontport2_2), + rearport2, + cable3, + rearport1, + (frontport1_1, frontport1_2), + cable1, + interface1, + ), is_complete=True, - is_active=True + is_active=True, ) path4 = self.assertPathExists( - (interface4, cable5, (frontport2_3, frontport2_4), rearport2, cable3, rearport1, (frontport1_3, frontport1_4), cable2, interface2), + ( + interface4, + cable5, + (frontport2_3, frontport2_4), + rearport2, + cable3, + rearport1, + (frontport1_3, frontport1_4), + cable2, + interface2, + ), is_complete=True, - is_active=True + is_active=True, ) self.assertEqual(CablePath.objects.count(), 4) @@ -1809,7 +1972,10 @@ class CablePathTestCase(TestCase): ) cable1.save() self.assertPathExists( - (interface1, cable1, (frontport1, frontport3), (rearport1, rearport3), (cable2, cable4), (rearport2, rearport4), (frontport2, frontport4)), + ( + interface1, cable1, (frontport1, frontport3), (rearport1, rearport3), (cable2, cable4), + (rearport2, rearport4), (frontport2, frontport4) + ), is_complete=False ) self.assertEqual(CablePath.objects.count(), 1) diff --git a/netbox/dcim/tests/test_filtersets.py b/netbox/dcim/tests/test_filtersets.py index 897612b84..ede1e2a09 100644 --- a/netbox/dcim/tests/test_filtersets.py +++ b/netbox/dcim/tests/test_filtersets.py @@ -243,9 +243,41 @@ class SiteTestCase(TestCase, ChangeLoggedFilterSetTests): ASN.objects.bulk_create(asns) sites = ( - Site(name='Site 1', slug='site-1', region=regions[0], group=groups[0], tenant=tenants[0], status=SiteStatusChoices.STATUS_ACTIVE, facility='Facility 1', latitude=10, longitude=10, description='foobar1'), - Site(name='Site 2', slug='site-2', region=regions[1], group=groups[1], tenant=tenants[1], status=SiteStatusChoices.STATUS_PLANNED, facility='Facility 2', latitude=20, longitude=20, description='foobar2'), - Site(name='Site 3', slug='site-3', region=regions[2], group=groups[2], tenant=tenants[2], status=SiteStatusChoices.STATUS_RETIRED, facility='Facility 3', latitude=30, longitude=30), + Site( + name='Site 1', + slug='site-1', + region=regions[0], + group=groups[0], + tenant=tenants[0], + status=SiteStatusChoices.STATUS_ACTIVE, + facility='Facility 1', + latitude=10, + longitude=10, + description='foobar1', + ), + Site( + name='Site 2', + slug='site-2', + region=regions[1], + group=groups[1], + tenant=tenants[1], + status=SiteStatusChoices.STATUS_PLANNED, + facility='Facility 2', + latitude=20, + longitude=20, + description='foobar2', + ), + Site( + name='Site 3', + slug='site-3', + region=regions[2], + group=groups[2], + tenant=tenants[2], + status=SiteStatusChoices.STATUS_RETIRED, + facility='Facility 3', + latitude=30, + longitude=30, + ), ) Site.objects.bulk_create(sites) sites[0].asns.set([asns[0]]) @@ -361,9 +393,33 @@ class LocationTestCase(TestCase, ChangeLoggedFilterSetTests): location.save() locations = ( - Location(name='Location 1A', slug='location-1a', site=sites[0], parent=parent_locations[0], status=LocationStatusChoices.STATUS_PLANNED, facility='Facility 1', description='foobar1'), - Location(name='Location 2A', slug='location-2a', site=sites[1], parent=parent_locations[1], status=LocationStatusChoices.STATUS_STAGING, facility='Facility 2', description='foobar2'), - Location(name='Location 3A', slug='location-3a', site=sites[2], parent=parent_locations[2], status=LocationStatusChoices.STATUS_DECOMMISSIONING, facility='Facility 3', description='foobar3'), + Location( + name='Location 1A', + slug='location-1a', + site=sites[0], + parent=parent_locations[0], + status=LocationStatusChoices.STATUS_PLANNED, + facility='Facility 1', + description='foobar1', + ), + Location( + name='Location 2A', + slug='location-2a', + site=sites[1], + parent=parent_locations[1], + status=LocationStatusChoices.STATUS_STAGING, + facility='Facility 2', + description='foobar2', + ), + Location( + name='Location 3A', + slug='location-3a', + site=sites[2], + parent=parent_locations[2], + status=LocationStatusChoices.STATUS_DECOMMISSIONING, + facility='Facility 3', + description='foobar3', + ), ) for location in locations: location.save() @@ -1222,10 +1278,22 @@ class DeviceTypeTestCase(TestCase, ChangeLoggedFilterSetTests): RearPortTemplate(device_type=device_types[1], name='Rear Port 2', type=PortTypeChoices.TYPE_8P8C), ) RearPortTemplate.objects.bulk_create(rear_ports) - FrontPortTemplate.objects.bulk_create(( - FrontPortTemplate(device_type=device_types[0], name='Front Port 1', type=PortTypeChoices.TYPE_8P8C, rear_port=rear_ports[0]), - FrontPortTemplate(device_type=device_types[1], name='Front Port 2', type=PortTypeChoices.TYPE_8P8C, rear_port=rear_ports[1]), - )) + FrontPortTemplate.objects.bulk_create( + ( + FrontPortTemplate( + device_type=device_types[0], + name='Front Port 1', + type=PortTypeChoices.TYPE_8P8C, + rear_port=rear_ports[0], + ), + FrontPortTemplate( + device_type=device_types[1], + name='Front Port 2', + type=PortTypeChoices.TYPE_8P8C, + rear_port=rear_ports[1], + ), + ) + ) ModuleBayTemplate.objects.bulk_create(( ModuleBayTemplate(device_type=device_types[0], name='Module Bay 1'), ModuleBayTemplate(device_type=device_types[1], name='Module Bay 2'), @@ -1435,10 +1503,22 @@ class ModuleTypeTestCase(TestCase, ChangeLoggedFilterSetTests): RearPortTemplate(module_type=module_types[1], name='Rear Port 2', type=PortTypeChoices.TYPE_8P8C), ) RearPortTemplate.objects.bulk_create(rear_ports) - FrontPortTemplate.objects.bulk_create(( - FrontPortTemplate(module_type=module_types[0], name='Front Port 1', type=PortTypeChoices.TYPE_8P8C, rear_port=rear_ports[0]), - FrontPortTemplate(module_type=module_types[1], name='Front Port 2', type=PortTypeChoices.TYPE_8P8C, rear_port=rear_ports[1]), - )) + FrontPortTemplate.objects.bulk_create( + ( + FrontPortTemplate( + module_type=module_types[0], + name='Front Port 1', + type=PortTypeChoices.TYPE_8P8C, + rear_port=rear_ports[0], + ), + FrontPortTemplate( + module_type=module_types[1], + name='Front Port 2', + type=PortTypeChoices.TYPE_8P8C, + rear_port=rear_ports[1], + ), + ) + ) def test_q(self): params = {'q': 'foobar1'} @@ -1893,11 +1973,19 @@ class ModuleBayTemplateTestCase(TestCase, DeviceComponentTemplateFilterSetTests, ) ModuleType.objects.bulk_create(module_types) - ModuleBayTemplate.objects.bulk_create(( - ModuleBayTemplate(device_type=device_types[0], name='Module Bay 1', description='foobar1'), - ModuleBayTemplate(device_type=device_types[1], name='Module Bay 2', description='foobar2', module_type=module_types[0]), - ModuleBayTemplate(device_type=device_types[2], name='Module Bay 3', description='foobar3', module_type=module_types[1]), - )) + ModuleBayTemplate.objects.bulk_create( + ( + ModuleBayTemplate( + device_type=device_types[0], name='Module Bay 1', description='foobar1' + ), + ModuleBayTemplate( + device_type=device_types[1], name='Module Bay 2', description='foobar2', module_type=module_types[0] + ), + ModuleBayTemplate( + device_type=device_types[2], name='Module Bay 3', description='foobar3', module_type=module_types[1] + ), + ) + ) def test_name(self): params = {'name': ['Module Bay 1', 'Module Bay 2']} @@ -1996,9 +2084,15 @@ class InventoryItemTemplateTestCase(TestCase, DeviceComponentTemplateFilterSetTe item.save() child_inventory_item_templates = ( - InventoryItemTemplate(device_type=device_types[0], name='Inventory Item 1A', parent=inventory_item_templates[0]), - InventoryItemTemplate(device_type=device_types[1], name='Inventory Item 2A', parent=inventory_item_templates[1]), - InventoryItemTemplate(device_type=device_types[2], name='Inventory Item 3A', parent=inventory_item_templates[2]), + InventoryItemTemplate( + device_type=device_types[0], name='Inventory Item 1A', parent=inventory_item_templates[0] + ), + InventoryItemTemplate( + device_type=device_types[1], name='Inventory Item 2A', parent=inventory_item_templates[1] + ), + InventoryItemTemplate( + device_type=device_types[2], name='Inventory Item 3A', parent=inventory_item_templates[2] + ), ) for item in child_inventory_item_templates: item.save() @@ -2848,10 +2942,41 @@ class ConsolePortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedF Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[0], role=roles[0], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[0], + role=roles[0], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -3029,10 +3154,41 @@ class ConsoleServerPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeL Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[2], role=roles[2], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[2], + role=roles[2], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -3058,9 +3214,15 @@ class ConsoleServerPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeL ConsolePort.objects.bulk_create(console_ports) console_server_ports = ( - ConsoleServerPort(device=devices[0], module=modules[0], name='Console Server Port 1', label='A', description='First'), - ConsoleServerPort(device=devices[1], module=modules[1], name='Console Server Port 2', label='B', description='Second'), - ConsoleServerPort(device=devices[2], module=modules[2], name='Console Server Port 3', label='C', description='Third'), + ConsoleServerPort( + device=devices[0], module=modules[0], name='Console Server Port 1', label='A', description='First' + ), + ConsoleServerPort( + device=devices[1], module=modules[1], name='Console Server Port 2', label='B', description='Second' + ), + ConsoleServerPort( + device=devices[2], module=modules[2], name='Console Server Port 3', label='C', description='Third' + ), ) ConsoleServerPort.objects.bulk_create(console_server_ports) @@ -3210,10 +3372,41 @@ class PowerPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[2], role=roles[2], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[2], + role=roles[2], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -3239,9 +3432,33 @@ class PowerPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil PowerOutlet.objects.bulk_create(power_outlets) power_ports = ( - PowerPort(device=devices[0], module=modules[0], name='Power Port 1', label='A', maximum_draw=100, allocated_draw=50, description='First'), - PowerPort(device=devices[1], module=modules[1], name='Power Port 2', label='B', maximum_draw=200, allocated_draw=100, description='Second'), - PowerPort(device=devices[2], module=modules[2], name='Power Port 3', label='C', maximum_draw=300, allocated_draw=150, description='Third'), + PowerPort( + device=devices[0], + module=modules[0], + name='Power Port 1', + label='A', + maximum_draw=100, + allocated_draw=50, + description='First', + ), + PowerPort( + device=devices[1], + module=modules[1], + name='Power Port 2', + label='B', + maximum_draw=200, + allocated_draw=100, + description='Second', + ), + PowerPort( + device=devices[2], + module=modules[2], + name='Power Port 3', + label='C', + maximum_draw=300, + allocated_draw=150, + description='Third', + ), ) PowerPort.objects.bulk_create(power_ports) @@ -3399,10 +3616,41 @@ class PowerOutletTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedF Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[2], role=roles[2], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[2], + role=roles[2], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -3428,9 +3676,33 @@ class PowerOutletTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedF PowerPort.objects.bulk_create(power_ports) power_outlets = ( - PowerOutlet(device=devices[0], module=modules[0], name='Power Outlet 1', label='A', feed_leg=PowerOutletFeedLegChoices.FEED_LEG_A, description='First', color='ff0000'), - PowerOutlet(device=devices[1], module=modules[1], name='Power Outlet 2', label='B', feed_leg=PowerOutletFeedLegChoices.FEED_LEG_B, description='Second', color='00ff00'), - PowerOutlet(device=devices[2], module=modules[2], name='Power Outlet 3', label='C', feed_leg=PowerOutletFeedLegChoices.FEED_LEG_C, description='Third', color='0000ff'), + PowerOutlet( + device=devices[0], + module=modules[0], + name='Power Outlet 1', + label='A', + feed_leg=PowerOutletFeedLegChoices.FEED_LEG_A, + description='First', + color='ff0000', + ), + PowerOutlet( + device=devices[1], + module=modules[1], + name='Power Outlet 2', + label='B', + feed_leg=PowerOutletFeedLegChoices.FEED_LEG_B, + description='Second', + color='00ff00', + ), + PowerOutlet( + device=devices[2], + module=modules[2], + name='Power Outlet 3', + label='C', + feed_leg=PowerOutletFeedLegChoices.FEED_LEG_C, + description='Third', + color='0000ff', + ), ) PowerOutlet.objects.bulk_create(power_outlets) @@ -3672,8 +3944,12 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil # Virtual Device Context Creation vdcs = ( - VirtualDeviceContext(device=devices[4], name='VDC 1', identifier=1, status=VirtualDeviceContextStatusChoices.STATUS_ACTIVE), - VirtualDeviceContext(device=devices[4], name='VDC 2', identifier=2, status=VirtualDeviceContextStatusChoices.STATUS_PLANNED), + VirtualDeviceContext( + device=devices[4], name='VDC 1', identifier=1, status=VirtualDeviceContextStatusChoices.STATUS_ACTIVE + ), + VirtualDeviceContext( + device=devices[4], name='VDC 2', identifier=2, status=VirtualDeviceContextStatusChoices.STATUS_PLANNED + ), ) VirtualDeviceContext.objects.bulk_create(vdcs) @@ -3886,9 +4162,24 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil # Create child interfaces parent_interface = Interface.objects.first() child_interfaces = ( - Interface(device=parent_interface.device, name='Child 1', parent=parent_interface, type=InterfaceTypeChoices.TYPE_VIRTUAL), - Interface(device=parent_interface.device, name='Child 2', parent=parent_interface, type=InterfaceTypeChoices.TYPE_VIRTUAL), - Interface(device=parent_interface.device, name='Child 3', parent=parent_interface, type=InterfaceTypeChoices.TYPE_VIRTUAL), + Interface( + device=parent_interface.device, + name='Child 1', + parent=parent_interface, + type=InterfaceTypeChoices.TYPE_VIRTUAL, + ), + Interface( + device=parent_interface.device, + name='Child 2', + parent=parent_interface, + type=InterfaceTypeChoices.TYPE_VIRTUAL, + ), + Interface( + device=parent_interface.device, + name='Child 3', + parent=parent_interface, + type=InterfaceTypeChoices.TYPE_VIRTUAL, + ), ) Interface.objects.bulk_create(child_interfaces) @@ -3899,9 +4190,24 @@ class InterfaceTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil # Create bridged interfaces bridge_interface = Interface.objects.first() bridged_interfaces = ( - Interface(device=bridge_interface.device, name='Bridged 1', bridge=bridge_interface, type=InterfaceTypeChoices.TYPE_1GE_FIXED), - Interface(device=bridge_interface.device, name='Bridged 2', bridge=bridge_interface, type=InterfaceTypeChoices.TYPE_1GE_FIXED), - Interface(device=bridge_interface.device, name='Bridged 3', bridge=bridge_interface, type=InterfaceTypeChoices.TYPE_1GE_FIXED), + Interface( + device=bridge_interface.device, + name='Bridged 1', + bridge=bridge_interface, + type=InterfaceTypeChoices.TYPE_1GE_FIXED, + ), + Interface( + device=bridge_interface.device, + name='Bridged 2', + bridge=bridge_interface, + type=InterfaceTypeChoices.TYPE_1GE_FIXED, + ), + Interface( + device=bridge_interface.device, + name='Bridged 3', + bridge=bridge_interface, + type=InterfaceTypeChoices.TYPE_1GE_FIXED, + ), ) Interface.objects.bulk_create(bridged_interfaces) @@ -4134,10 +4440,41 @@ class FrontPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[2], role=roles[2], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[2], + role=roles[2], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -4167,12 +4504,63 @@ class FrontPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil RearPort.objects.bulk_create(rear_ports) front_ports = ( - FrontPort(device=devices[0], module=modules[0], name='Front Port 1', label='A', type=PortTypeChoices.TYPE_8P8C, color=ColorChoices.COLOR_RED, rear_port=rear_ports[0], rear_port_position=1, description='First'), - FrontPort(device=devices[1], module=modules[1], name='Front Port 2', label='B', type=PortTypeChoices.TYPE_110_PUNCH, color=ColorChoices.COLOR_GREEN, rear_port=rear_ports[1], rear_port_position=2, description='Second'), - FrontPort(device=devices[2], module=modules[2], name='Front Port 3', label='C', type=PortTypeChoices.TYPE_BNC, color=ColorChoices.COLOR_BLUE, rear_port=rear_ports[2], rear_port_position=3, description='Third'), - FrontPort(device=devices[3], name='Front Port 4', label='D', type=PortTypeChoices.TYPE_FC, rear_port=rear_ports[3], rear_port_position=1), - FrontPort(device=devices[3], name='Front Port 5', label='E', type=PortTypeChoices.TYPE_FC, rear_port=rear_ports[4], rear_port_position=1), - FrontPort(device=devices[3], name='Front Port 6', label='F', type=PortTypeChoices.TYPE_FC, rear_port=rear_ports[5], rear_port_position=1), + FrontPort( + device=devices[0], + module=modules[0], + name='Front Port 1', + label='A', + type=PortTypeChoices.TYPE_8P8C, + color=ColorChoices.COLOR_RED, + rear_port=rear_ports[0], + rear_port_position=1, + description='First', + ), + FrontPort( + device=devices[1], + module=modules[1], + name='Front Port 2', + label='B', + type=PortTypeChoices.TYPE_110_PUNCH, + color=ColorChoices.COLOR_GREEN, + rear_port=rear_ports[1], + rear_port_position=2, + description='Second', + ), + FrontPort( + device=devices[2], + module=modules[2], + name='Front Port 3', + label='C', + type=PortTypeChoices.TYPE_BNC, + color=ColorChoices.COLOR_BLUE, + rear_port=rear_ports[2], + rear_port_position=3, + description='Third', + ), + FrontPort( + device=devices[3], + name='Front Port 4', + label='D', + type=PortTypeChoices.TYPE_FC, + rear_port=rear_ports[3], + rear_port_position=1, + ), + FrontPort( + device=devices[3], + name='Front Port 5', + label='E', + type=PortTypeChoices.TYPE_FC, + rear_port=rear_ports[4], + rear_port_position=1, + ), + FrontPort( + device=devices[3], + name='Front Port 6', + label='F', + type=PortTypeChoices.TYPE_FC, + rear_port=rear_ports[5], + rear_port_position=1, + ), ) FrontPort.objects.bulk_create(front_ports) @@ -4324,10 +4712,41 @@ class RearPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFilt Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), - Device(name=None, device_type=device_types[2], role=roles[2], site=sites[3], status='offline'), # For cable connections + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), + # For cable connections + Device( + name=None, + device_type=device_types[2], + role=roles[2], + site=sites[3], + status='offline' + ), ) Device.objects.bulk_create(devices) @@ -4347,9 +4766,36 @@ class RearPortTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFilt Module.objects.bulk_create(modules) rear_ports = ( - RearPort(device=devices[0], module=modules[0], name='Rear Port 1', label='A', type=PortTypeChoices.TYPE_8P8C, color=ColorChoices.COLOR_RED, positions=1, description='First'), - RearPort(device=devices[1], module=modules[1], name='Rear Port 2', label='B', type=PortTypeChoices.TYPE_110_PUNCH, color=ColorChoices.COLOR_GREEN, positions=2, description='Second'), - RearPort(device=devices[2], module=modules[2], name='Rear Port 3', label='C', type=PortTypeChoices.TYPE_BNC, color=ColorChoices.COLOR_BLUE, positions=3, description='Third'), + RearPort( + device=devices[0], + module=modules[0], + name='Rear Port 1', + label='A', + type=PortTypeChoices.TYPE_8P8C, + color=ColorChoices.COLOR_RED, + positions=1, + description='First', + ), + RearPort( + device=devices[1], + module=modules[1], + name='Rear Port 2', + label='B', + type=PortTypeChoices.TYPE_110_PUNCH, + color=ColorChoices.COLOR_GREEN, + positions=2, + description='Second', + ), + RearPort( + device=devices[2], + module=modules[2], + name='Rear Port 3', + label='C', + type=PortTypeChoices.TYPE_BNC, + color=ColorChoices.COLOR_BLUE, + positions=3, + description='Third', + ), RearPort(device=devices[3], name='Rear Port 4', label='D', type=PortTypeChoices.TYPE_FC, positions=4), RearPort(device=devices[3], name='Rear Port 5', label='E', type=PortTypeChoices.TYPE_FC, positions=5), RearPort(device=devices[3], name='Rear Port 6', label='F', type=PortTypeChoices.TYPE_FC, positions=6), @@ -4506,9 +4952,33 @@ class ModuleBayTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), ) Device.objects.bulk_create(devices) @@ -4654,9 +5124,33 @@ class DeviceBayTestCase(TestCase, DeviceComponentFilterSetTests, ChangeLoggedFil Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0], status='active'), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1], status='planned'), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2], status='offline'), + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + status='active', + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + status='planned', + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + status='offline', + ), ) Device.objects.bulk_create(devices) @@ -4788,9 +5282,30 @@ class InventoryItemTestCase(TestCase, ChangeLoggedFilterSetTests): Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], site=sites[0], location=locations[0], rack=racks[0]), - Device(name='Device 2', device_type=device_types[1], role=roles[1], site=sites[1], location=locations[1], rack=racks[1]), - Device(name='Device 3', device_type=device_types[2], role=roles[2], site=sites[2], location=locations[2], rack=racks[2]), + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + site=sites[0], + location=locations[0], + rack=racks[0], + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + site=sites[1], + location=locations[1], + rack=racks[1], + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + site=sites[2], + location=locations[2], + rack=racks[2], + ), ) Device.objects.bulk_create(devices) @@ -4808,9 +5323,48 @@ class InventoryItemTestCase(TestCase, ChangeLoggedFilterSetTests): ) inventory_items = ( - InventoryItem(device=devices[0], role=roles[0], manufacturer=manufacturers[0], name='Inventory Item 1', label='A', part_id='1001', serial='ABC', asset_tag='1001', discovered=True, status=ModuleStatusChoices.STATUS_ACTIVE, description='First', component=components[0]), - InventoryItem(device=devices[1], role=roles[1], manufacturer=manufacturers[1], name='Inventory Item 2', label='B', part_id='1002', serial='DEF', asset_tag='1002', discovered=True, status=ModuleStatusChoices.STATUS_PLANNED, description='Second', component=components[1]), - InventoryItem(device=devices[2], role=roles[2], manufacturer=manufacturers[2], name='Inventory Item 3', label='C', part_id='1003', serial='GHI', asset_tag='1003', discovered=False, status=ModuleStatusChoices.STATUS_FAILED, description='Third', component=components[2]), + InventoryItem( + device=devices[0], + role=roles[0], + manufacturer=manufacturers[0], + name='Inventory Item 1', + label='A', + part_id='1001', + serial='ABC', + asset_tag='1001', + discovered=True, + status=ModuleStatusChoices.STATUS_ACTIVE, + description='First', + component=components[0], + ), + InventoryItem( + device=devices[1], + role=roles[1], + manufacturer=manufacturers[1], + name='Inventory Item 2', + label='B', + part_id='1002', + serial='DEF', + asset_tag='1002', + discovered=True, + status=ModuleStatusChoices.STATUS_PLANNED, + description='Second', + component=components[1], + ), + InventoryItem( + device=devices[2], + role=roles[2], + manufacturer=manufacturers[2], + name='Inventory Item 3', + label='C', + part_id='1003', + serial='GHI', + asset_tag='1003', + discovered=False, + status=ModuleStatusChoices.STATUS_FAILED, + description='Third', + component=components[2], + ), ) for i in inventory_items: i.save() @@ -5127,12 +5681,60 @@ class CableTestCase(TestCase, ChangeLoggedFilterSetTests): role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') devices = ( - Device(name='Device 1', device_type=device_type, role=role, site=sites[0], rack=racks[0], location=locations[0], position=1), - Device(name='Device 2', device_type=device_type, role=role, site=sites[0], rack=racks[0], location=locations[0], position=2), - Device(name='Device 3', device_type=device_type, role=role, site=sites[1], rack=racks[1], location=locations[1], position=1), - Device(name='Device 4', device_type=device_type, role=role, site=sites[1], rack=racks[1], location=locations[1], position=2), - Device(name='Device 5', device_type=device_type, role=role, site=sites[2], rack=racks[2], location=locations[2], position=1), - Device(name='Device 6', device_type=device_type, role=role, site=sites[2], rack=racks[2], location=locations[2], position=2), + Device( + name='Device 1', + device_type=device_type, + role=role, + site=sites[0], + rack=racks[0], + location=locations[0], + position=1, + ), + Device( + name='Device 2', + device_type=device_type, + role=role, + site=sites[0], + rack=racks[0], + location=locations[0], + position=2, + ), + Device( + name='Device 3', + device_type=device_type, + role=role, + site=sites[1], + rack=racks[1], + location=locations[1], + position=1, + ), + Device( + name='Device 4', + device_type=device_type, + role=role, + site=sites[1], + rack=racks[1], + location=locations[1], + position=2, + ), + Device( + name='Device 5', + device_type=device_type, + role=role, + site=sites[2], + rack=racks[2], + location=locations[2], + position=1, + ), + Device( + name='Device 6', + device_type=device_type, + role=role, + site=sites[2], + rack=racks[2], + location=locations[2], + position=2, + ), ) Device.objects.bulk_create(devices) diff --git a/netbox/dcim/tests/test_models.py b/netbox/dcim/tests/test_models.py index 8d43d67ea..ff1eddd56 100644 --- a/netbox/dcim/tests/test_models.py +++ b/netbox/dcim/tests/test_models.py @@ -612,14 +612,31 @@ class DeviceTestCase(TestCase): device_role = DeviceRole.objects.first() # Device with site only should pass - Device(name='device1', site=sites[0], device_type=device_type, role=device_role).full_clean() + Device( + name='device1', + site=sites[0], + device_type=device_type, + role=device_role + ).full_clean() # Device with site, cluster non-site should pass - Device(name='device1', site=sites[0], device_type=device_type, role=device_role, cluster=clusters[2]).full_clean() + Device( + name='device1', + site=sites[0], + device_type=device_type, + role=device_role, + cluster=clusters[2] + ).full_clean() # Device with mismatched site & cluster should fail with self.assertRaises(ValidationError): - Device(name='device1', site=sites[0], device_type=device_type, role=device_role, cluster=clusters[1]).full_clean() + Device( + name='device1', + site=sites[0], + device_type=device_type, + role=device_role, + cluster=clusters[1] + ).full_clean() class ModuleBayTestCase(TestCase): @@ -636,7 +653,9 @@ class ModuleBayTestCase(TestCase): # Create a CustomField with a default value & assign it to all component models location = Location.objects.create(name='Location 1', slug='location-1', site=site) rack = Rack.objects.create(name='Rack 1', site=site) - device = Device.objects.create(name='Device 1', device_type=device_type, role=device_role, site=site, location=location, rack=rack) + device = Device.objects.create( + name='Device 1', device_type=device_type, role=device_role, site=site, location=location, rack=rack + ) module_bays = ( ModuleBay(device=device, name='Module Bay 1', label='A', description='First'), diff --git a/netbox/dcim/tests/test_views.py b/netbox/dcim/tests/test_views.py index 9850081d1..c2c5b6a01 100644 --- a/netbox/dcim/tests/test_views.py +++ b/netbox/dcim/tests/test_views.py @@ -196,9 +196,27 @@ class LocationTestCase(ViewTestCases.OrganizationalObjectViewTestCase): tenant = Tenant.objects.create(name='Tenant 1', slug='tenant-1') locations = ( - Location(name='Location 1', slug='location-1', site=site, status=LocationStatusChoices.STATUS_ACTIVE, tenant=tenant), - Location(name='Location 2', slug='location-2', site=site, status=LocationStatusChoices.STATUS_ACTIVE, tenant=tenant), - Location(name='Location 3', slug='location-3', site=site, status=LocationStatusChoices.STATUS_ACTIVE, tenant=tenant), + Location( + name='Location 1', + slug='location-1', + site=site, + status=LocationStatusChoices.STATUS_ACTIVE, + tenant=tenant, + ), + Location( + name='Location 2', + slug='location-2', + site=site, + status=LocationStatusChoices.STATUS_ACTIVE, + tenant=tenant, + ), + Location( + name='Location 3', + slug='location-3', + site=site, + status=LocationStatusChoices.STATUS_ACTIVE, + tenant=tenant, + ), ) for location in locations: location.save() @@ -346,9 +364,24 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase): Manufacturer.objects.bulk_create(manufacturers) rack_types = ( - RackType(manufacturer=manufacturers[0], model='RackType 1', slug='rack-type-1', form_factor=RackFormFactorChoices.TYPE_CABINET,), - RackType(manufacturer=manufacturers[0], model='RackType 2', slug='rack-type-2', form_factor=RackFormFactorChoices.TYPE_CABINET,), - RackType(manufacturer=manufacturers[0], model='RackType 3', slug='rack-type-3', form_factor=RackFormFactorChoices.TYPE_CABINET,), + RackType( + manufacturer=manufacturers[0], + model='RackType 1', + slug='rack-type-1', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), + RackType( + manufacturer=manufacturers[0], + model='RackType 2', + slug='rack-type-2', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), + RackType( + manufacturer=manufacturers[0], + model='RackType 3', + slug='rack-type-3', + form_factor=RackFormFactorChoices.TYPE_CABINET, + ), ) RackType.objects.bulk_create(rack_types) @@ -692,9 +725,15 @@ class DeviceTypeTestCase( ) RearPortTemplate.objects.bulk_create(rear_ports) front_ports = ( - FrontPortTemplate(device_type=devicetype, name='Front Port 1', rear_port=rear_ports[0], rear_port_position=1), - FrontPortTemplate(device_type=devicetype, name='Front Port 2', rear_port=rear_ports[1], rear_port_position=1), - FrontPortTemplate(device_type=devicetype, name='Front Port 3', rear_port=rear_ports[2], rear_port_position=1), + FrontPortTemplate( + device_type=devicetype, name='Front Port 1', rear_port=rear_ports[0], rear_port_position=1 + ), + FrontPortTemplate( + device_type=devicetype, name='Front Port 2', rear_port=rear_ports[1], rear_port_position=1 + ), + FrontPortTemplate( + device_type=devicetype, name='Front Port 3', rear_port=rear_ports[2], rear_port_position=1 + ), ) FrontPortTemplate.objects.bulk_create(front_ports) @@ -1081,9 +1120,15 @@ class ModuleTypeTestCase( ) RearPortTemplate.objects.bulk_create(rear_ports) front_ports = ( - FrontPortTemplate(module_type=moduletype, name='Front Port 1', rear_port=rear_ports[0], rear_port_position=1), - FrontPortTemplate(module_type=moduletype, name='Front Port 2', rear_port=rear_ports[1], rear_port_position=1), - FrontPortTemplate(module_type=moduletype, name='Front Port 3', rear_port=rear_ports[2], rear_port_position=1), + FrontPortTemplate( + module_type=moduletype, name='Front Port 1', rear_port=rear_ports[0], rear_port_position=1 + ), + FrontPortTemplate( + module_type=moduletype, name='Front Port 2', rear_port=rear_ports[1], rear_port_position=1 + ), + FrontPortTemplate( + module_type=moduletype, name='Front Port 3', rear_port=rear_ports[2], rear_port_position=1 + ), ) FrontPortTemplate.objects.bulk_create(front_ports) @@ -1453,11 +1498,19 @@ class FrontPortTemplateTestCase(ViewTestCases.DeviceComponentTemplateViewTestCas ) RearPortTemplate.objects.bulk_create(rearports) - FrontPortTemplate.objects.bulk_create(( - FrontPortTemplate(device_type=devicetype, name='Front Port Template 1', rear_port=rearports[0], rear_port_position=1), - FrontPortTemplate(device_type=devicetype, name='Front Port Template 2', rear_port=rearports[1], rear_port_position=1), - FrontPortTemplate(device_type=devicetype, name='Front Port Template 3', rear_port=rearports[2], rear_port_position=1), - )) + FrontPortTemplate.objects.bulk_create( + ( + FrontPortTemplate( + device_type=devicetype, name='Front Port Template 1', rear_port=rearports[0], rear_port_position=1 + ), + FrontPortTemplate( + device_type=devicetype, name='Front Port Template 2', rear_port=rearports[1], rear_port_position=1 + ), + FrontPortTemplate( + device_type=devicetype, name='Front Port Template 3', rear_port=rearports[2], rear_port_position=1 + ), + ) + ) cls.form_data = { 'device_type': devicetype.pk, @@ -1550,7 +1603,12 @@ class DeviceBayTemplateTestCase(ViewTestCases.DeviceComponentTemplateViewTestCas @classmethod def setUpTestData(cls): manufacturer = Manufacturer.objects.create(name='Manufacturer 1', slug='manufacturer-1') - devicetype = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type 1', slug='device-type-1', subdevice_role=SubdeviceRoleChoices.ROLE_PARENT) + devicetype = DeviceType.objects.create( + manufacturer=manufacturer, + model='Device Type 1', + slug='device-type-1', + subdevice_role=SubdeviceRoleChoices.ROLE_PARENT + ) DeviceBayTemplate.objects.bulk_create(( DeviceBayTemplate(device_type=devicetype, name='Device Bay Template 1'), @@ -1584,12 +1642,20 @@ class InventoryItemTemplateTestCase(ViewTestCases.DeviceComponentTemplateViewTes Manufacturer(name='Manufacturer 2', slug='manufacturer-2'), ) Manufacturer.objects.bulk_create(manufacturers) - devicetype = DeviceType.objects.create(manufacturer=manufacturers[0], model='Device Type 1', slug='device-type-1') + devicetype = DeviceType.objects.create( + manufacturer=manufacturers[0], model='Device Type 1', slug='device-type-1' + ) inventory_item_templates = ( - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 1', manufacturer=manufacturers[0]), - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 2', manufacturer=manufacturers[0]), - InventoryItemTemplate(device_type=devicetype, name='Inventory Item Template 3', manufacturer=manufacturers[0]), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 1', manufacturer=manufacturers[0] + ), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 2', manufacturer=manufacturers[0] + ), + InventoryItemTemplate( + device_type=devicetype, name='Inventory Item Template 3', manufacturer=manufacturers[0] + ), ) for item in inventory_item_templates: item.save() @@ -1741,9 +1807,30 @@ class DeviceTestCase(ViewTestCases.PrimaryObjectViewTestCase): Platform.objects.bulk_create(platforms) devices = ( - Device(name='Device 1', site=sites[0], rack=racks[0], device_type=devicetypes[0], role=roles[0], platform=platforms[0]), - Device(name='Device 2', site=sites[0], rack=racks[0], device_type=devicetypes[0], role=roles[0], platform=platforms[0]), - Device(name='Device 3', site=sites[0], rack=racks[0], device_type=devicetypes[0], role=roles[0], platform=platforms[0]), + Device( + name='Device 1', + site=sites[0], + rack=racks[0], + device_type=devicetypes[0], + role=roles[0], + platform=platforms[0], + ), + Device( + name='Device 2', + site=sites[0], + rack=racks[0], + device_type=devicetypes[0], + role=roles[0], + platform=platforms[0], + ), + Device( + name='Device 3', + site=sites[0], + rack=racks[0], + device_type=devicetypes[0], + role=roles[0], + platform=platforms[0], + ), ) Device.objects.bulk_create(devices) @@ -1778,10 +1865,22 @@ class DeviceTestCase(ViewTestCases.PrimaryObjectViewTestCase): } cls.csv_data = ( - "role,manufacturer,device_type,status,name,site,location,rack,position,face,virtual_chassis,vc_position,vc_priority", - "Device Role 1,Manufacturer 1,Device Type 1,active,Device 4,Site 1,Location 1,Rack 1,10,front,Virtual Chassis 1,1,10", - "Device Role 1,Manufacturer 1,Device Type 1,active,Device 5,Site 1,Location 1,Rack 1,20,front,Virtual Chassis 1,2,20", - "Device Role 1,Manufacturer 1,Device Type 1,active,Device 6,Site 1,Location 1,Rack 1,30,front,Virtual Chassis 1,3,30", + ( + "role,manufacturer,device_type,status,name,site,location,rack,position,face,virtual_chassis," + "vc_position,vc_priority" + ), + ( + "Device Role 1,Manufacturer 1,Device Type 1,active,Device 4,Site 1,Location 1,Rack 1,10,front," + "Virtual Chassis 1,1,10" + ), + ( + "Device Role 1,Manufacturer 1,Device Type 1,active,Device 5,Site 1,Location 1,Rack 1,20,front," + "Virtual Chassis 1,2,20" + ), + ( + "Device Role 1,Manufacturer 1,Device Type 1,active,Device 6,Site 1,Location 1,Rack 1,30,front," + "Virtual Chassis 1,3,30" + ), ) cls.csv_update_data = ( @@ -2884,9 +2983,15 @@ class InventoryItemTestCase(ViewTestCases.DeviceComponentViewTestCase): ) InventoryItemRole.objects.bulk_create(roles) - inventory_item1 = InventoryItem.objects.create(device=device, name='Inventory Item 1', role=roles[0], manufacturer=manufacturer) - inventory_item2 = InventoryItem.objects.create(device=device, name='Inventory Item 2', role=roles[0], manufacturer=manufacturer) - inventory_item3 = InventoryItem.objects.create(device=device, name='Inventory Item 3', role=roles[0], manufacturer=manufacturer) + inventory_item1 = InventoryItem.objects.create( + device=device, name='Inventory Item 1', role=roles[0], manufacturer=manufacturer + ) + inventory_item2 = InventoryItem.objects.create( + device=device, name='Inventory Item 2', role=roles[0], manufacturer=manufacturer + ) + inventory_item3 = InventoryItem.objects.create( + device=device, name='Inventory Item 3', role=roles[0], manufacturer=manufacturer + ) tags = create_tags('Alpha', 'Bravo', 'Charlie') diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index f6e7b90be..731034dc1 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -244,7 +244,9 @@ class RegionView(GetRelatedModelsMixin, generic.ObjectView): (Location.objects.restrict(request.user, 'view').filter(site__region__in=regions), 'region_id'), (Rack.objects.restrict(request.user, 'view').filter(site__region__in=regions), 'region_id'), ( - Circuit.objects.restrict(request.user, 'view').filter(terminations___region=instance).distinct(), + Circuit.objects.restrict(request.user, 'view').filter( + terminations___region=instance + ).distinct(), 'region_id' ), ), @@ -335,7 +337,9 @@ class SiteGroupView(GetRelatedModelsMixin, generic.ObjectView): (Location.objects.restrict(request.user, 'view').filter(site__group__in=groups), 'site_group_id'), (Rack.objects.restrict(request.user, 'view').filter(site__group__in=groups), 'site_group_id'), ( - Circuit.objects.restrict(request.user, 'view').filter(terminations___site_group=instance).distinct(), + Circuit.objects.restrict(request.user, 'view').filter( + terminations___site_group=instance + ).distinct(), 'site_group_id' ), ), @@ -507,7 +511,9 @@ class LocationView(GetRelatedModelsMixin, generic.ObjectView): [CableTermination], ( ( - Circuit.objects.restrict(request.user, 'view').filter(terminations___location=instance).distinct(), + Circuit.objects.restrict(request.user, 'view').filter( + terminations___location=instance + ).distinct(), 'location_id' ), ), @@ -3729,7 +3735,9 @@ class VirtualChassisAddMemberView(ObjectPermissionRequiredMixin, GetReturnURLMix membership_form.save() messages.success(request, mark_safe( - _('Added member {device}').format(url=device.get_absolute_url(), device=escape(device)) + _('Added member {device}').format( + url=device.get_absolute_url(), device=escape(device) + ) )) if '_addanother' in request.POST: diff --git a/netbox/extras/management/commands/reindex.py b/netbox/extras/management/commands/reindex.py index 21442be93..5495bbf5f 100644 --- a/netbox/extras/management/commands/reindex.py +++ b/netbox/extras/management/commands/reindex.py @@ -53,7 +53,8 @@ class Command(BaseCommand): else: raise CommandError( - f"Invalid model: {label}. Model names must be in the format or .." + f"Invalid model: {label}. Model names must be in the format or " + f".." ) return indexers diff --git a/netbox/extras/migrations/0001_squashed.py b/netbox/extras/migrations/0001_squashed.py index 6f1f77e53..a2514fa5e 100644 --- a/netbox/extras/migrations/0001_squashed.py +++ b/netbox/extras/migrations/0001_squashed.py @@ -9,7 +9,6 @@ import utilities.validators class Migration(migrations.Migration): - initial = True dependencies = [ @@ -99,8 +98,22 @@ class Migration(migrations.Migration): fields=[ ('object_id', models.IntegerField(db_index=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_tagged_items', to='contenttypes.contenttype')), - ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_items', to='extras.tag')), + ( + 'content_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='%(app_label)s_%(class)s_tagged_items', + to='contenttypes.contenttype', + ), + ), + ( + 'tag', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='%(app_label)s_%(class)s_items', + to='extras.tag', + ), + ), ], ), migrations.CreateModel( @@ -116,9 +129,32 @@ class Migration(migrations.Migration): ('object_repr', models.CharField(editable=False, max_length=200)), ('prechange_data', models.JSONField(blank=True, editable=False, null=True)), ('postchange_data', models.JSONField(blank=True, editable=False, null=True)), - ('changed_object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('related_object_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='changes', to=settings.AUTH_USER_MODEL)), + ( + 'changed_object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype' + ), + ), + ( + 'related_object_type', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'user', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='changes', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'ordering': ['-time'], @@ -133,8 +169,16 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(auto_now_add=True)), ('kind', models.CharField(default='info', max_length=30)), ('comments', models.TextField()), - ('assigned_object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), - ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ( + 'assigned_object_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), + ( + 'created_by', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL + ), + ), ], options={ 'verbose_name_plural': 'journal entries', @@ -151,8 +195,24 @@ class Migration(migrations.Migration): ('status', models.CharField(default='pending', max_length=30)), ('data', models.JSONField(blank=True, null=True)), ('job_id', models.UUIDField(unique=True)), - ('obj_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_results', to='contenttypes.contenttype')), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ( + 'obj_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='job_results', + to='contenttypes.contenttype', + ), + ), + ( + 'user', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'ordering': ['obj_type', 'name', '-created'], @@ -163,12 +223,20 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(primary_key=True, serialize=False)), ('object_id', models.PositiveIntegerField()), - ('image', models.ImageField(height_field='image_height', upload_to=extras.utils.image_upload, width_field='image_width')), + ( + 'image', + models.ImageField( + height_field='image_height', upload_to=extras.utils.image_upload, width_field='image_width' + ), + ), ('image_height', models.PositiveSmallIntegerField()), ('image_width', models.PositiveSmallIntegerField()), ('name', models.CharField(blank=True, max_length=50)), ('created', models.DateTimeField(auto_now_add=True)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + 'content_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), ], options={ 'ordering': ('name', 'pk'), @@ -184,7 +252,10 @@ class Migration(migrations.Migration): ('mime_type', models.CharField(blank=True, max_length=50)), ('file_extension', models.CharField(blank=True, max_length=15)), ('as_attachment', models.BooleanField(default=True)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + 'content_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), ], options={ 'ordering': ['content_type', 'name'], @@ -201,7 +272,10 @@ class Migration(migrations.Migration): ('group_name', models.CharField(blank=True, max_length=50)), ('button_class', models.CharField(default='default', max_length=30)), ('new_window', models.BooleanField(default=False)), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + 'content_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), ], options={ 'ordering': ['group_name', 'weight', 'name'], @@ -221,8 +295,16 @@ class Migration(migrations.Migration): ('weight', models.PositiveSmallIntegerField(default=100)), ('validation_minimum', models.PositiveIntegerField(blank=True, null=True)), ('validation_maximum', models.PositiveIntegerField(blank=True, null=True)), - ('validation_regex', models.CharField(blank=True, max_length=500, validators=[utilities.validators.validate_regex])), - ('choices', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)), + ( + 'validation_regex', + models.CharField(blank=True, max_length=500, validators=[utilities.validators.validate_regex]), + ), + ( + 'choices', + django.contrib.postgres.fields.ArrayField( + base_field=models.CharField(max_length=100), blank=True, null=True, size=None + ), + ), ('content_types', models.ManyToManyField(related_name='custom_fields', to='contenttypes.ContentType')), ], options={ diff --git a/netbox/extras/migrations/0002_squashed_0059.py b/netbox/extras/migrations/0002_squashed_0059.py index a403a0e19..b664b286e 100644 --- a/netbox/extras/migrations/0002_squashed_0059.py +++ b/netbox/extras/migrations/0002_squashed_0059.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0002_auto_20160622_1821'), ('extras', '0001_initial'), diff --git a/netbox/extras/migrations/0060_squashed_0086.py b/netbox/extras/migrations/0060_squashed_0086.py index 0d5d03008..3bde7480f 100644 --- a/netbox/extras/migrations/0060_squashed_0086.py +++ b/netbox/extras/migrations/0060_squashed_0086.py @@ -12,7 +12,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('extras', '0060_customlink_button_class'), ('extras', '0061_extras_change_logging'), @@ -40,7 +39,7 @@ class Migration(migrations.Migration): ('extras', '0083_search'), ('extras', '0084_staging'), ('extras', '0085_synced_data'), - ('extras', '0086_configtemplate') + ('extras', '0086_configtemplate'), ] dependencies = [ @@ -114,7 +113,23 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='customfield', name='name', - field=models.CharField(max_length=50, unique=True, validators=[django.core.validators.RegexValidator(flags=re.RegexFlag['IGNORECASE'], message='Only alphanumeric characters and underscores are allowed.', regex='^[a-z0-9_]+$'), django.core.validators.RegexValidator(flags=re.RegexFlag['IGNORECASE'], inverse_match=True, message='Double underscores are not permitted in custom field names.', regex='__')]), + field=models.CharField( + max_length=50, + unique=True, + validators=[ + django.core.validators.RegexValidator( + flags=re.RegexFlag['IGNORECASE'], + message='Only alphanumeric characters and underscores are allowed.', + regex='^[a-z0-9_]+$', + ), + django.core.validators.RegexValidator( + flags=re.RegexFlag['IGNORECASE'], + inverse_match=True, + message='Double underscores are not permitted in custom field names.', + regex='__', + ), + ], + ), ), migrations.AlterField( model_name='customfield', @@ -134,7 +149,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='customfield', name='object_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype' + ), ), migrations.AddField( model_name='customlink', @@ -314,11 +331,16 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='exporttemplate', - constraint=models.UniqueConstraint(fields=('content_type', 'name'), name='extras_exporttemplate_unique_content_type_name'), + constraint=models.UniqueConstraint( + fields=('content_type', 'name'), name='extras_exporttemplate_unique_content_type_name' + ), ), migrations.AddConstraint( model_name='webhook', - constraint=models.UniqueConstraint(fields=('payload_url', 'type_create', 'type_update', 'type_delete'), name='extras_webhook_unique_payload_url_types'), + constraint=models.UniqueConstraint( + fields=('payload_url', 'type_create', 'type_update', 'type_delete'), + name='extras_webhook_unique_payload_url_types', + ), ), migrations.AddField( model_name='jobresult', @@ -328,7 +350,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='jobresult', name='interval', - field=models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)]), + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)] + ), ), migrations.AddField( model_name='jobresult', @@ -379,7 +403,12 @@ class Migration(migrations.Migration): ('shared', models.BooleanField(default=True)), ('parameters', models.JSONField()), ('content_types', models.ManyToManyField(related_name='saved_filters', to='contenttypes.contenttype')), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL + ), + ), ], options={ 'ordering': ('weight', 'name'), @@ -400,7 +429,12 @@ class Migration(migrations.Migration): ('type', models.CharField(max_length=30)), ('value', extras.fields.CachedValueField()), ('weight', models.PositiveSmallIntegerField(default=1000)), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype')), + ( + 'object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype' + ), + ), ], options={ 'ordering': ('weight', 'object_type', 'object_id'), @@ -414,7 +448,12 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('name', models.CharField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), - ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL + ), + ), ], options={ 'ordering': ('name',), @@ -429,8 +468,18 @@ class Migration(migrations.Migration): ('action', models.CharField(max_length=20)), ('object_id', models.PositiveBigIntegerField(blank=True, null=True)), ('data', models.JSONField(blank=True, null=True)), - ('branch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='staged_changes', to='extras.branch')), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype')), + ( + 'branch', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='staged_changes', to='extras.branch' + ), + ), + ( + 'object_type', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='+', to='contenttypes.contenttype' + ), + ), ], options={ 'ordering': ('pk',), @@ -439,7 +488,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='configcontext', name='data_file', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.datafile'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='core.datafile', + ), ), migrations.AddField( model_name='configcontext', @@ -449,7 +504,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='configcontext', name='data_source', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.datasource'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='core.datasource', + ), ), migrations.AddField( model_name='configcontext', @@ -464,7 +525,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='exporttemplate', name='data_file', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.datafile'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='core.datafile', + ), ), migrations.AddField( model_name='exporttemplate', @@ -474,7 +541,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='exporttemplate', name='data_source', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.datasource'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='core.datasource', + ), ), migrations.AddField( model_name='exporttemplate', @@ -498,8 +571,26 @@ class Migration(migrations.Migration): ('description', models.CharField(blank=True, max_length=200)), ('template_code', models.TextField()), ('environment_params', models.JSONField(blank=True, default=dict, null=True)), - ('data_file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.datafile')), - ('data_source', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.datasource')), + ( + 'data_file', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='core.datafile', + ), + ), + ( + 'data_source', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='core.datasource', + ), + ), ('auto_sync_enabled', models.BooleanField(default=False)), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], diff --git a/netbox/extras/migrations/0087_squashed_0098.py b/netbox/extras/migrations/0087_squashed_0098.py index bbe7f79f5..839f4cbe4 100644 --- a/netbox/extras/migrations/0087_squashed_0098.py +++ b/netbox/extras/migrations/0087_squashed_0098.py @@ -9,7 +9,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('extras', '0087_dashboard'), ('extras', '0088_jobresult_webhooks'), @@ -22,7 +21,7 @@ class Migration(migrations.Migration): ('extras', '0095_bookmarks'), ('extras', '0096_customfieldchoiceset'), ('extras', '0097_customfield_remove_choices'), - ('extras', '0098_webhook_custom_field_data_webhook_tags') + ('extras', '0098_webhook_custom_field_data_webhook_tags'), ] dependencies = [ @@ -39,7 +38,14 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('layout', models.JSONField(default=list)), ('config', models.JSONField(default=dict)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='dashboard', to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name='dashboard', + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.AddField( @@ -64,8 +70,7 @@ class Migration(migrations.Migration): ), migrations.CreateModel( name='ReportModule', - fields=[ - ], + fields=[], options={ 'proxy': True, 'ordering': ('file_root', 'file_path'), @@ -76,8 +81,7 @@ class Migration(migrations.Migration): ), migrations.CreateModel( name='ScriptModule', - fields=[ - ], + fields=[], options={ 'proxy': True, 'ordering': ('file_root', 'file_path'), @@ -108,7 +112,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True)), ('object_id', models.PositiveBigIntegerField()), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')), + ( + 'object_type', + models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype'), + ), ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), ], options={ @@ -117,7 +124,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='bookmark', - constraint=models.UniqueConstraint(fields=('object_type', 'object_id', 'user'), name='extras_bookmark_unique_per_object_and_user'), + constraint=models.UniqueConstraint( + fields=('object_type', 'object_id', 'user'), name='extras_bookmark_unique_per_object_and_user' + ), ), migrations.CreateModel( name='CustomFieldChoiceSet', @@ -128,7 +137,17 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), ('base_choices', models.CharField(blank=True, max_length=50)), - ('extra_choices', django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=2), blank=True, null=True, size=None)), + ( + 'extra_choices', + django.contrib.postgres.fields.ArrayField( + base_field=django.contrib.postgres.fields.ArrayField( + base_field=models.CharField(max_length=100), size=2 + ), + blank=True, + null=True, + size=None, + ), + ), ('order_alphabetically', models.BooleanField(default=False)), ], options={ @@ -138,7 +157,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='customfield', name='choice_set', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='choices_for', to='extras.customfieldchoiceset'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='choices_for', + to='extras.customfieldchoiceset', + ), ), migrations.RemoveField( model_name='customfield', diff --git a/netbox/extras/migrations/0099_cachedvalue_ordering.py b/netbox/extras/migrations/0099_cachedvalue_ordering.py index 242ffd983..36b91d59b 100644 --- a/netbox/extras/migrations/0099_cachedvalue_ordering.py +++ b/netbox/extras/migrations/0099_cachedvalue_ordering.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('extras', '0098_webhook_custom_field_data_webhook_tags'), ] diff --git a/netbox/extras/migrations/0100_customfield_ui_attrs.py b/netbox/extras/migrations/0100_customfield_ui_attrs.py index a4a713a86..b1a404d16 100644 --- a/netbox/extras/migrations/0100_customfield_ui_attrs.py +++ b/netbox/extras/migrations/0100_customfield_ui_attrs.py @@ -14,7 +14,6 @@ def update_ui_attrs(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0099_cachedvalue_ordering'), ] @@ -30,10 +29,7 @@ class Migration(migrations.Migration): name='ui_visible', field=models.CharField(default='always', max_length=50), ), - migrations.RunPython( - code=update_ui_attrs, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_ui_attrs, reverse_code=migrations.RunPython.noop), migrations.RemoveField( model_name='customfield', name='ui_visibility', diff --git a/netbox/extras/migrations/0101_eventrule.py b/netbox/extras/migrations/0101_eventrule.py index 3d236c847..605307c27 100644 --- a/netbox/extras/migrations/0101_eventrule.py +++ b/netbox/extras/migrations/0101_eventrule.py @@ -8,8 +8,8 @@ from extras.choices import * def move_webhooks(apps, schema_editor): - Webhook = apps.get_model("extras", "Webhook") - EventRule = apps.get_model("extras", "EventRule") + Webhook = apps.get_model('extras', 'Webhook') + EventRule = apps.get_model('extras', 'EventRule') webhook_ct = ContentType.objects.get_for_model(Webhook).pk for webhook in Webhook.objects.all(): @@ -39,7 +39,6 @@ class Migration(migrations.Migration): ] operations = [ - # Create the EventRule model migrations.CreateModel( name='EventRule', @@ -93,12 +92,12 @@ class Migration(migrations.Migration): ), migrations.AddIndex( model_name='eventrule', - index=models.Index(fields=['action_object_type', 'action_object_id'], name='extras_even_action__d9e2af_idx'), + index=models.Index( + fields=['action_object_type', 'action_object_id'], name='extras_even_action__d9e2af_idx' + ), ), - # Replicate Webhook data migrations.RunPython(move_webhooks), - # Remove obsolete fields from Webhook migrations.RemoveConstraint( model_name='webhook', @@ -136,7 +135,6 @@ class Migration(migrations.Migration): model_name='webhook', name='type_update', ), - # Add description field to Webhook migrations.AddField( model_name='webhook', diff --git a/netbox/extras/migrations/0102_move_configrevision.py b/netbox/extras/migrations/0102_move_configrevision.py index 36eef1205..64ff8c9ad 100644 --- a/netbox/extras/migrations/0102_move_configrevision.py +++ b/netbox/extras/migrations/0102_move_configrevision.py @@ -13,7 +13,6 @@ def update_content_type(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0101_eventrule'), ] @@ -32,8 +31,5 @@ class Migration(migrations.Migration): ), ], ), - migrations.RunPython( - code=update_content_type, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_content_type, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/migrations/0103_gfk_indexes.py b/netbox/extras/migrations/0103_gfk_indexes.py index 2ccbdb2ff..f32b2e116 100644 --- a/netbox/extras/migrations/0103_gfk_indexes.py +++ b/netbox/extras/migrations/0103_gfk_indexes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0102_move_configrevision'), ] @@ -20,15 +19,21 @@ class Migration(migrations.Migration): ), migrations.AddIndex( model_name='journalentry', - index=models.Index(fields=['assigned_object_type', 'assigned_object_id'], name='extras_jour_assigne_76510f_idx'), + index=models.Index( + fields=['assigned_object_type', 'assigned_object_id'], name='extras_jour_assigne_76510f_idx' + ), ), migrations.AddIndex( model_name='objectchange', - index=models.Index(fields=['changed_object_type', 'changed_object_id'], name='extras_obje_changed_927fe5_idx'), + index=models.Index( + fields=['changed_object_type', 'changed_object_id'], name='extras_obje_changed_927fe5_idx' + ), ), migrations.AddIndex( model_name='objectchange', - index=models.Index(fields=['related_object_type', 'related_object_id'], name='extras_obje_related_bfcdef_idx'), + index=models.Index( + fields=['related_object_type', 'related_object_id'], name='extras_obje_related_bfcdef_idx' + ), ), migrations.AddIndex( model_name='stagedchange', diff --git a/netbox/extras/migrations/0105_customfield_min_max_values.py b/netbox/extras/migrations/0105_customfield_min_max_values.py index bcf3f97bd..71a0dcc68 100644 --- a/netbox/extras/migrations/0105_customfield_min_max_values.py +++ b/netbox/extras/migrations/0105_customfield_min_max_values.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0104_stagedchange_remove_change_logging'), ] diff --git a/netbox/extras/migrations/0106_bookmark_user_cascade_deletion.py b/netbox/extras/migrations/0106_bookmark_user_cascade_deletion.py index d7bef2f0b..bc0e1bbd0 100644 --- a/netbox/extras/migrations/0106_bookmark_user_cascade_deletion.py +++ b/netbox/extras/migrations/0106_bookmark_user_cascade_deletion.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('extras', '0105_customfield_min_max_values'), diff --git a/netbox/extras/migrations/0107_cachedvalue_extras_cachedvalue_object.py b/netbox/extras/migrations/0107_cachedvalue_extras_cachedvalue_object.py index 15ce375a2..3f2907192 100644 --- a/netbox/extras/migrations/0107_cachedvalue_extras_cachedvalue_object.py +++ b/netbox/extras/migrations/0107_cachedvalue_extras_cachedvalue_object.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0106_bookmark_user_cascade_deletion'), ] diff --git a/netbox/extras/migrations/0108_convert_reports_to_scripts.py b/netbox/extras/migrations/0108_convert_reports_to_scripts.py index b547c41c3..948bac754 100644 --- a/netbox/extras/migrations/0108_convert_reports_to_scripts.py +++ b/netbox/extras/migrations/0108_convert_reports_to_scripts.py @@ -12,16 +12,12 @@ def convert_reportmodule_jobs(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0107_cachedvalue_extras_cachedvalue_object'), ] operations = [ - migrations.RunPython( - code=convert_reportmodule_jobs, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=convert_reportmodule_jobs, reverse_code=migrations.RunPython.noop), migrations.DeleteModel( name='Report', ), diff --git a/netbox/extras/migrations/0109_script_model.py b/netbox/extras/migrations/0109_script_model.py index 2fa0bf8aa..706a776af 100644 --- a/netbox/extras/migrations/0109_script_model.py +++ b/netbox/extras/migrations/0109_script_model.py @@ -55,9 +55,10 @@ def get_module_scripts(scriptmodule): """ Return a dictionary mapping of name and script class inside the passed ScriptModule. """ + def get_name(cls): # For child objects in submodules use the full import path w/o the root module as the name - return cls.full_name.split(".", maxsplit=1)[1] + return cls.full_name.split('.', maxsplit=1)[1] loader = SourceFileLoader(get_python_name(scriptmodule), get_full_path(scriptmodule)) try: @@ -100,17 +101,13 @@ def update_scripts(apps, schema_editor): ) # Update all Jobs associated with this ScriptModule & script name to point to the new Script object - Job.objects.filter( - object_type_id=scriptmodule_ct.id, - object_id=module.pk, - name=script_name - ).update(object_type_id=script_ct.id, object_id=script.pk) + Job.objects.filter(object_type_id=scriptmodule_ct.id, object_id=module.pk, name=script_name).update( + object_type_id=script_ct.id, object_id=script.pk + ) # Update all Jobs associated with this ScriptModule & script name to point to the new Script object - Job.objects.filter( - object_type_id=reportmodule_ct.id, - object_id=module.pk, - name=script_name - ).update(object_type_id=script_ct.id, object_id=script.pk) + Job.objects.filter(object_type_id=reportmodule_ct.id, object_id=module.pk, name=script_name).update( + object_type_id=script_ct.id, object_id=script.pk + ) def update_event_rules(apps, schema_editor): @@ -129,15 +126,12 @@ def update_event_rules(apps, schema_editor): for eventrule in EventRule.objects.filter(action_object_type=scriptmodule_ct): name = eventrule.action_parameters.get('script_name') obj, __ = Script.objects.get_or_create( - module_id=eventrule.action_object_id, - name=name, - defaults={'is_executable': False} + module_id=eventrule.action_object_id, name=name, defaults={'is_executable': False} ) EventRule.objects.filter(pk=eventrule.pk).update(action_object_type=script_ct, action_object_id=obj.id) class Migration(migrations.Migration): - dependencies = [ ('extras', '0108_convert_reports_to_scripts'), ] @@ -148,8 +142,16 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(editable=False, max_length=79)), - ('module', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='scripts', to='extras.scriptmodule')), - ('is_executable', models.BooleanField(editable=False, default=True)) + ( + 'module', + models.ForeignKey( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + related_name='scripts', + to='extras.scriptmodule', + ), + ), + ('is_executable', models.BooleanField(editable=False, default=True)), ], options={ 'ordering': ('module', 'name'), @@ -159,12 +161,6 @@ class Migration(migrations.Migration): model_name='script', constraint=models.UniqueConstraint(fields=('name', 'module'), name='extras_script_unique_name_module'), ), - migrations.RunPython( - code=update_scripts, - reverse_code=migrations.RunPython.noop - ), - migrations.RunPython( - code=update_event_rules, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_scripts, reverse_code=migrations.RunPython.noop), + migrations.RunPython(code=update_event_rules, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/migrations/0110_remove_eventrule_action_parameters.py b/netbox/extras/migrations/0110_remove_eventrule_action_parameters.py index b7373bdce..494107643 100644 --- a/netbox/extras/migrations/0110_remove_eventrule_action_parameters.py +++ b/netbox/extras/migrations/0110_remove_eventrule_action_parameters.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('extras', '0109_script_model'), ] diff --git a/netbox/extras/migrations/0111_rename_content_types.py b/netbox/extras/migrations/0111_rename_content_types.py index acd6aef0f..a9f80b146 100644 --- a/netbox/extras/migrations/0111_rename_content_types.py +++ b/netbox/extras/migrations/0111_rename_content_types.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0010_gfk_indexes'), ('extras', '0110_remove_eventrule_action_parameters'), @@ -24,16 +23,19 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='customfield', name='object_type', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.objecttype'), - ), - migrations.RunSQL( - "ALTER TABLE IF EXISTS extras_customfield_content_types_id_seq RENAME TO extras_customfield_object_types_id_seq" + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.objecttype' + ), ), + migrations.RunSQL(( + 'ALTER TABLE IF EXISTS extras_customfield_content_types_id_seq ' + 'RENAME TO extras_customfield_object_types_id_seq' + )), # Pre-v2.10 sequence name (see #15605) - migrations.RunSQL( - "ALTER TABLE IF EXISTS extras_customfield_obj_type_id_seq RENAME TO extras_customfield_object_types_id_seq" - ), - + migrations.RunSQL(( + 'ALTER TABLE IF EXISTS extras_customfield_obj_type_id_seq ' + 'RENAME TO extras_customfield_object_types_id_seq' + )), # Custom links migrations.RenameField( model_name='customlink', @@ -46,9 +48,8 @@ class Migration(migrations.Migration): field=models.ManyToManyField(related_name='custom_links', to='core.objecttype'), ), migrations.RunSQL( - "ALTER TABLE extras_customlink_content_types_id_seq RENAME TO extras_customlink_object_types_id_seq" + 'ALTER TABLE extras_customlink_content_types_id_seq RENAME TO extras_customlink_object_types_id_seq' ), - # Event rules migrations.RenameField( model_name='eventrule', @@ -61,9 +62,8 @@ class Migration(migrations.Migration): field=models.ManyToManyField(related_name='event_rules', to='core.objecttype'), ), migrations.RunSQL( - "ALTER TABLE extras_eventrule_content_types_id_seq RENAME TO extras_eventrule_object_types_id_seq" + 'ALTER TABLE extras_eventrule_content_types_id_seq RENAME TO extras_eventrule_object_types_id_seq' ), - # Export templates migrations.RenameField( model_name='exporttemplate', @@ -76,9 +76,8 @@ class Migration(migrations.Migration): field=models.ManyToManyField(related_name='export_templates', to='core.objecttype'), ), migrations.RunSQL( - "ALTER TABLE extras_exporttemplate_content_types_id_seq RENAME TO extras_exporttemplate_object_types_id_seq" + 'ALTER TABLE extras_exporttemplate_content_types_id_seq RENAME TO extras_exporttemplate_object_types_id_seq' ), - # Saved filters migrations.RenameField( model_name='savedfilter', @@ -91,9 +90,8 @@ class Migration(migrations.Migration): field=models.ManyToManyField(related_name='saved_filters', to='core.objecttype'), ), migrations.RunSQL( - "ALTER TABLE extras_savedfilter_content_types_id_seq RENAME TO extras_savedfilter_object_types_id_seq" + 'ALTER TABLE extras_savedfilter_content_types_id_seq RENAME TO extras_savedfilter_object_types_id_seq' ), - # Image attachments migrations.RemoveIndex( model_name='imageattachment', diff --git a/netbox/extras/migrations/0112_tag_update_object_types.py b/netbox/extras/migrations/0112_tag_update_object_types.py index 87ec117a4..e863ba8c3 100644 --- a/netbox/extras/migrations/0112_tag_update_object_types.py +++ b/netbox/extras/migrations/0112_tag_update_object_types.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0010_gfk_indexes'), ('extras', '0111_rename_content_types'), diff --git a/netbox/extras/migrations/0113_customfield_rename_object_type.py b/netbox/extras/migrations/0113_customfield_rename_object_type.py index 73c4a2a61..9ad9fbbc4 100644 --- a/netbox/extras/migrations/0113_customfield_rename_object_type.py +++ b/netbox/extras/migrations/0113_customfield_rename_object_type.py @@ -2,7 +2,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('extras', '0112_tag_update_object_types'), ] diff --git a/netbox/extras/migrations/0114_customfield_add_comments.py b/netbox/extras/migrations/0114_customfield_add_comments.py index cd85db1ba..ad9e3d46f 100644 --- a/netbox/extras/migrations/0114_customfield_add_comments.py +++ b/netbox/extras/migrations/0114_customfield_add_comments.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0113_customfield_rename_object_type'), ] diff --git a/netbox/extras/migrations/0115_convert_dashboard_widgets.py b/netbox/extras/migrations/0115_convert_dashboard_widgets.py index c85c83ecf..28f6eade9 100644 --- a/netbox/extras/migrations/0115_convert_dashboard_widgets.py +++ b/netbox/extras/migrations/0115_convert_dashboard_widgets.py @@ -16,14 +16,10 @@ def update_dashboard_widgets(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0114_customfield_add_comments'), ] operations = [ - migrations.RunPython( - code=update_dashboard_widgets, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_dashboard_widgets, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/migrations/0116_custom_link_button_color.py b/netbox/extras/migrations/0116_custom_link_button_color.py index 665d73017..ff47eab11 100644 --- a/netbox/extras/migrations/0116_custom_link_button_color.py +++ b/netbox/extras/migrations/0116_custom_link_button_color.py @@ -7,7 +7,6 @@ def update_link_buttons(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0115_convert_dashboard_widgets'), ] @@ -18,8 +17,5 @@ class Migration(migrations.Migration): name='button_class', field=models.CharField(default='default', max_length=30), ), - migrations.RunPython( - code=update_link_buttons, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_link_buttons, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/migrations/0117_move_objectchange.py b/netbox/extras/migrations/0117_move_objectchange.py index a69b5a711..62c7255e7 100644 --- a/netbox/extras/migrations/0117_move_objectchange.py +++ b/netbox/extras/migrations/0117_move_objectchange.py @@ -26,7 +26,6 @@ def update_dashboard_widgets(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0116_custom_link_button_color'), ('core', '0011_move_objectchange'), @@ -44,81 +43,64 @@ class Migration(migrations.Migration): name='ObjectChange', table='core_objectchange', ), - # Rename PK sequence - migrations.RunSQL( - "ALTER TABLE extras_objectchange_id_seq" - " RENAME TO core_objectchange_id_seq" - ), - + migrations.RunSQL('ALTER TABLE extras_objectchange_id_seq' ' RENAME TO core_objectchange_id_seq'), # Rename indexes. Hashes generated by schema_editor._create_index_name() + migrations.RunSQL('ALTER INDEX extras_objectchange_pkey' ' RENAME TO core_objectchange_pkey'), migrations.RunSQL( - "ALTER INDEX extras_objectchange_pkey" - " RENAME TO core_objectchange_pkey" + 'ALTER INDEX extras_obje_changed_927fe5_idx' + ' RENAME TO core_objectchange_changed_object_type_id_cha_79a9ed1e' ), migrations.RunSQL( - "ALTER INDEX extras_obje_changed_927fe5_idx" - " RENAME TO core_objectchange_changed_object_type_id_cha_79a9ed1e" + 'ALTER INDEX extras_obje_related_bfcdef_idx' + ' RENAME TO core_objectchange_related_object_type_id_rel_a71d604a' ), migrations.RunSQL( - "ALTER INDEX extras_obje_related_bfcdef_idx" - " RENAME TO core_objectchange_related_object_type_id_rel_a71d604a" + 'ALTER INDEX extras_objectchange_changed_object_type_id_b755bb60' + ' RENAME TO core_objectchange_changed_object_type_id_2070ade6' ), migrations.RunSQL( - "ALTER INDEX extras_objectchange_changed_object_type_id_b755bb60" - " RENAME TO core_objectchange_changed_object_type_id_2070ade6" + 'ALTER INDEX extras_objectchange_related_object_type_id_fe6e521f' + ' RENAME TO core_objectchange_related_object_type_id_b80958af' ), migrations.RunSQL( - "ALTER INDEX extras_objectchange_related_object_type_id_fe6e521f" - " RENAME TO core_objectchange_related_object_type_id_b80958af" + 'ALTER INDEX extras_objectchange_request_id_4ae21e90' + ' RENAME TO core_objectchange_request_id_d9d160ac' ), migrations.RunSQL( - "ALTER INDEX extras_objectchange_request_id_4ae21e90" - " RENAME TO core_objectchange_request_id_d9d160ac" + 'ALTER INDEX extras_objectchange_time_224380ea' ' RENAME TO core_objectchange_time_800f60a5' ), migrations.RunSQL( - "ALTER INDEX extras_objectchange_time_224380ea" - " RENAME TO core_objectchange_time_800f60a5" + 'ALTER INDEX extras_objectchange_user_id_7fdf8186' ' RENAME TO core_objectchange_user_id_2b2142be' ), - migrations.RunSQL( - "ALTER INDEX extras_objectchange_user_id_7fdf8186" - " RENAME TO core_objectchange_user_id_2b2142be" - ), - # Rename constraints migrations.RunSQL( - "ALTER TABLE core_objectchange RENAME CONSTRAINT " - "extras_objectchange_changed_object_id_check TO " - "core_objectchange_changed_object_id_check" + 'ALTER TABLE core_objectchange RENAME CONSTRAINT ' + 'extras_objectchange_changed_object_id_check TO ' + 'core_objectchange_changed_object_id_check' ), migrations.RunSQL( - "ALTER TABLE core_objectchange RENAME CONSTRAINT " - "extras_objectchange_related_object_id_check TO " - "core_objectchange_related_object_id_check" + 'ALTER TABLE core_objectchange RENAME CONSTRAINT ' + 'extras_objectchange_related_object_id_check TO ' + 'core_objectchange_related_object_id_check' ), migrations.RunSQL( - "ALTER TABLE core_objectchange RENAME CONSTRAINT " - "extras_objectchange_changed_object_type__b755bb60_fk_django_co TO " - "core_objectchange_changed_object_type_id_2070ade6" + 'ALTER TABLE core_objectchange RENAME CONSTRAINT ' + 'extras_objectchange_changed_object_type__b755bb60_fk_django_co TO ' + 'core_objectchange_changed_object_type_id_2070ade6' ), migrations.RunSQL( - "ALTER TABLE core_objectchange RENAME CONSTRAINT " - "extras_objectchange_related_object_type__fe6e521f_fk_django_co TO " - "core_objectchange_related_object_type_id_b80958af" + 'ALTER TABLE core_objectchange RENAME CONSTRAINT ' + 'extras_objectchange_related_object_type__fe6e521f_fk_django_co TO ' + 'core_objectchange_related_object_type_id_b80958af' ), migrations.RunSQL( - "ALTER TABLE core_objectchange RENAME CONSTRAINT " - "extras_objectchange_user_id_7fdf8186_fk_auth_user_id TO " - "core_objectchange_user_id_2b2142be" + 'ALTER TABLE core_objectchange RENAME CONSTRAINT ' + 'extras_objectchange_user_id_7fdf8186_fk_auth_user_id TO ' + 'core_objectchange_user_id_2b2142be' ), ], ), - migrations.RunPython( - code=update_content_types, - reverse_code=migrations.RunPython.noop - ), - migrations.RunPython( - code=update_dashboard_widgets, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_content_types, reverse_code=migrations.RunPython.noop), + migrations.RunPython(code=update_dashboard_widgets, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/migrations/0118_customfield_uniqueness.py b/netbox/extras/migrations/0118_customfield_uniqueness.py index b7693aa24..7571e975a 100644 --- a/netbox/extras/migrations/0118_customfield_uniqueness.py +++ b/netbox/extras/migrations/0118_customfield_uniqueness.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0117_move_objectchange'), ] diff --git a/netbox/extras/migrations/0119_notifications.py b/netbox/extras/migrations/0119_notifications.py index c266f3b6c..2e6aefd20 100644 --- a/netbox/extras/migrations/0119_notifications.py +++ b/netbox/extras/migrations/0119_notifications.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('extras', '0118_customfield_uniqueness'), @@ -22,7 +21,10 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), ('groups', models.ManyToManyField(blank=True, related_name='notification_groups', to='users.group')), - ('users', models.ManyToManyField(blank=True, related_name='notification_groups', to=settings.AUTH_USER_MODEL)), + ( + 'users', + models.ManyToManyField(blank=True, related_name='notification_groups', to=settings.AUTH_USER_MODEL), + ), ], options={ 'verbose_name': 'notification group', @@ -36,8 +38,18 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True)), ('object_id', models.PositiveBigIntegerField()), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscriptions', to=settings.AUTH_USER_MODEL)), + ( + 'object_type', + models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype'), + ), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='subscriptions', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'verbose_name': 'subscription', @@ -53,9 +65,19 @@ class Migration(migrations.Migration): ('read', models.DateTimeField(blank=True, null=True)), ('object_id', models.PositiveBigIntegerField()), ('event_type', models.CharField(max_length=50)), - ('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')), + ( + 'object_type', + models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype'), + ), ('object_repr', models.CharField(editable=False, max_length=200)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='notifications', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'verbose_name': 'notification', @@ -66,7 +88,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='notification', - constraint=models.UniqueConstraint(fields=('object_type', 'object_id', 'user'), name='extras_notification_unique_per_object_and_user'), + constraint=models.UniqueConstraint( + fields=('object_type', 'object_id', 'user'), name='extras_notification_unique_per_object_and_user' + ), ), migrations.AddIndex( model_name='subscription', @@ -74,6 +98,8 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='subscription', - constraint=models.UniqueConstraint(fields=('object_type', 'object_id', 'user'), name='extras_subscription_unique_per_object_and_user'), + constraint=models.UniqueConstraint( + fields=('object_type', 'object_id', 'user'), name='extras_subscription_unique_per_object_and_user' + ), ), ] diff --git a/netbox/extras/migrations/0120_eventrule_event_types.py b/netbox/extras/migrations/0120_eventrule_event_types.py index f62c83e4c..2bcc0a4e6 100644 --- a/netbox/extras/migrations/0120_eventrule_event_types.py +++ b/netbox/extras/migrations/0120_eventrule_event_types.py @@ -26,7 +26,6 @@ def set_event_types(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0119_notifications'), ] @@ -36,16 +35,10 @@ class Migration(migrations.Migration): model_name='eventrule', name='event_types', field=django.contrib.postgres.fields.ArrayField( - base_field=models.CharField(max_length=50), - blank=True, - null=True, - size=None + base_field=models.CharField(max_length=50), blank=True, null=True, size=None ), ), - migrations.RunPython( - code=set_event_types, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_event_types, reverse_code=migrations.RunPython.noop), migrations.AlterField( model_name='eventrule', name='event_types', diff --git a/netbox/extras/migrations/0121_customfield_related_object_filter.py b/netbox/extras/migrations/0121_customfield_related_object_filter.py index d6e41fd7d..10eecd6cc 100644 --- a/netbox/extras/migrations/0121_customfield_related_object_filter.py +++ b/netbox/extras/migrations/0121_customfield_related_object_filter.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0120_eventrule_event_types'), ] diff --git a/netbox/extras/migrations/0122_charfield_null_choices.py b/netbox/extras/migrations/0122_charfield_null_choices.py index 9a1c7ff3f..a32051cb1 100644 --- a/netbox/extras/migrations/0122_charfield_null_choices.py +++ b/netbox/extras/migrations/0122_charfield_null_choices.py @@ -11,7 +11,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('extras', '0121_customfield_related_object_filter'), ] @@ -22,8 +21,5 @@ class Migration(migrations.Migration): name='base_choices', field=models.CharField(blank=True, max_length=50, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/extras/models/models.py b/netbox/extras/models/models.py index d8a274c89..d3e443b14 100644 --- a/netbox/extras/models/models.py +++ b/netbox/extras/models/models.py @@ -704,7 +704,10 @@ class JournalEntry(CustomFieldsMixin, CustomLinksMixin, TagsMixin, ExportTemplat def __str__(self): created = timezone.localtime(self.created) - return f"{created.date().isoformat()} {created.time().isoformat(timespec='minutes')} ({self.get_kind_display()})" + return ( + f"{created.date().isoformat()} {created.time().isoformat(timespec='minutes')} " + f"({self.get_kind_display()})" + ) def get_absolute_url(self): return reverse('extras:journalentry', args=[self.pk]) diff --git a/netbox/extras/tests/test_customfields.py b/netbox/extras/tests/test_customfields.py index 2bc9b5acc..ce26cb889 100644 --- a/netbox/extras/tests/test_customfields.py +++ b/netbox/extras/tests/test_customfields.py @@ -637,15 +637,51 @@ class CustomFieldAPITest(APITestCase): ) custom_fields = ( - CustomField(type=CustomFieldTypeChoices.TYPE_TEXT, name='text_field', default='foo'), - CustomField(type=CustomFieldTypeChoices.TYPE_LONGTEXT, name='longtext_field', default='ABC'), - CustomField(type=CustomFieldTypeChoices.TYPE_INTEGER, name='integer_field', default=123), - CustomField(type=CustomFieldTypeChoices.TYPE_DECIMAL, name='decimal_field', default=123.45), - CustomField(type=CustomFieldTypeChoices.TYPE_BOOLEAN, name='boolean_field', default=False), - CustomField(type=CustomFieldTypeChoices.TYPE_DATE, name='date_field', default='2020-01-01'), - CustomField(type=CustomFieldTypeChoices.TYPE_DATETIME, name='datetime_field', default='2020-01-01T01:23:45'), - CustomField(type=CustomFieldTypeChoices.TYPE_URL, name='url_field', default='http://example.com/1'), - CustomField(type=CustomFieldTypeChoices.TYPE_JSON, name='json_field', default='{"x": "y"}'), + CustomField( + type=CustomFieldTypeChoices.TYPE_TEXT, + name='text_field', + default='foo' + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_LONGTEXT, + name='longtext_field', + default='ABC' + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_INTEGER, + name='integer_field', + default=123 + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_DECIMAL, + name='decimal_field', + default=123.45 + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_BOOLEAN, + name='boolean_field', + default=False) + , + CustomField( + type=CustomFieldTypeChoices.TYPE_DATE, + name='date_field', + default='2020-01-01' + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_DATETIME, + name='datetime_field', + default='2020-01-01T01:23:45' + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_URL, + name='url_field', + default='http://example.com/1' + ), + CustomField( + type=CustomFieldTypeChoices.TYPE_JSON, + name='json_field', + default='{"x": "y"}' + ), CustomField( type=CustomFieldTypeChoices.TYPE_SELECT, name='select_field', @@ -656,7 +692,7 @@ class CustomFieldAPITest(APITestCase): type=CustomFieldTypeChoices.TYPE_MULTISELECT, name='multiselect_field', default=['foo'], - choice_set=choice_set + choice_set=choice_set, ), CustomField( type=CustomFieldTypeChoices.TYPE_OBJECT, @@ -1273,9 +1309,18 @@ class CustomFieldImportTest(TestCase): Import a Site in CSV format, including a value for each CustomField. """ data = ( - ('name', 'slug', 'status', 'cf_text', 'cf_longtext', 'cf_integer', 'cf_decimal', 'cf_boolean', 'cf_date', 'cf_datetime', 'cf_url', 'cf_json', 'cf_select', 'cf_multiselect'), - ('Site 1', 'site-1', 'active', 'ABC', 'Foo', '123', '123.45', 'True', '2020-01-01', '2020-01-01 12:00:00', 'http://example.com/1', '{"foo": 123}', 'a', '"a,b"'), - ('Site 2', 'site-2', 'active', 'DEF', 'Bar', '456', '456.78', 'False', '2020-01-02', '2020-01-02 12:00:00', 'http://example.com/2', '{"bar": 456}', 'b', '"b,c"'), + ( + 'name', 'slug', 'status', 'cf_text', 'cf_longtext', 'cf_integer', 'cf_decimal', 'cf_boolean', 'cf_date', + 'cf_datetime', 'cf_url', 'cf_json', 'cf_select', 'cf_multiselect', + ), + ( + 'Site 1', 'site-1', 'active', 'ABC', 'Foo', '123', '123.45', 'True', '2020-01-01', + '2020-01-01 12:00:00', 'http://example.com/1', '{"foo": 123}', 'a', '"a,b"', + ), + ( + 'Site 2', 'site-2', 'active', 'DEF', 'Bar', '456', '456.78', 'False', '2020-01-02', + '2020-01-02 12:00:00', 'http://example.com/2', '{"bar": 456}', 'b', '"b,c"', + ), ('Site 3', 'site-3', 'active', '', '', '', '', '', '', '', '', '', '', ''), ) csv_data = '\n'.join(','.join(row) for row in data) @@ -1616,7 +1661,10 @@ class CustomFieldModelFilterTest(TestCase): self.assertEqual(self.filterset({'cf_cf6__lte': ['2016-06-27']}, self.queryset).qs.count(), 2) def test_filter_url_strict(self): - self.assertEqual(self.filterset({'cf_cf7': ['http://a.example.com', 'http://b.example.com']}, self.queryset).qs.count(), 2) + self.assertEqual( + self.filterset({'cf_cf7': ['http://a.example.com', 'http://b.example.com']}, self.queryset).qs.count(), + 2 + ) self.assertEqual(self.filterset({'cf_cf7__n': ['http://b.example.com']}, self.queryset).qs.count(), 2) self.assertEqual(self.filterset({'cf_cf7__ic': ['b']}, self.queryset).qs.count(), 1) self.assertEqual(self.filterset({'cf_cf7__nic': ['b']}, self.queryset).qs.count(), 2) @@ -1640,9 +1688,18 @@ class CustomFieldModelFilterTest(TestCase): def test_filter_object(self): manufacturer_ids = Manufacturer.objects.values_list('id', flat=True) - self.assertEqual(self.filterset({'cf_cf11': [manufacturer_ids[0], manufacturer_ids[1]]}, self.queryset).qs.count(), 2) + self.assertEqual( + self.filterset({'cf_cf11': [manufacturer_ids[0], manufacturer_ids[1]]}, self.queryset).qs.count(), + 2 + ) def test_filter_multiobject(self): manufacturer_ids = Manufacturer.objects.values_list('id', flat=True) - self.assertEqual(self.filterset({'cf_cf12': [manufacturer_ids[0], manufacturer_ids[1]]}, self.queryset).qs.count(), 2) - self.assertEqual(self.filterset({'cf_cf12': [manufacturer_ids[3]]}, self.queryset).qs.count(), 3) + self.assertEqual( + self.filterset({'cf_cf12': [manufacturer_ids[0], manufacturer_ids[1]]}, self.queryset).qs.count(), + 2 + ) + self.assertEqual( + self.filterset({'cf_cf12': [manufacturer_ids[3]]}, self.queryset).qs.count(), + 3 + ) diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index 53ffe8f3f..094da3007 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -387,7 +387,12 @@ class IPAddressForm(TenancyForm, NetBoxModelForm): }) elif selected_objects: assigned_object = self.cleaned_data[selected_objects[0]] - if self.instance.pk and self.instance.assigned_object and self.cleaned_data['primary_for_parent'] and assigned_object != self.instance.assigned_object: + if ( + self.instance.pk and + self.instance.assigned_object and + self.cleaned_data['primary_for_parent'] and + assigned_object != self.instance.assigned_object + ): raise ValidationError( _("Cannot reassign IP address while it is designated as the primary IP for the parent object") ) diff --git a/netbox/ipam/graphql/types.py b/netbox/ipam/graphql/types.py index 5a4813e0c..e6ecca984 100644 --- a/netbox/ipam/graphql/types.py +++ b/netbox/ipam/graphql/types.py @@ -295,7 +295,10 @@ class VLANTranslationPolicyType(NetBoxObjectType): filters=VLANTranslationRuleFilter ) class VLANTranslationRuleType(NetBoxObjectType): - policy: Annotated["VLANTranslationPolicyType", strawberry.lazy('ipam.graphql.types')] = strawberry_django.field(select_related=["policy"]) + policy: Annotated[ + "VLANTranslationPolicyType", + strawberry.lazy('ipam.graphql.types') + ] = strawberry_django.field(select_related=["policy"]) @strawberry_django.type( diff --git a/netbox/ipam/migrations/0001_squashed.py b/netbox/ipam/migrations/0001_squashed.py index bef36e698..896d7c4c9 100644 --- a/netbox/ipam/migrations/0001_squashed.py +++ b/netbox/ipam/migrations/0001_squashed.py @@ -9,7 +9,6 @@ import taggit.managers class Migration(migrations.Migration): - initial = True dependencies = [ @@ -50,7 +49,23 @@ class Migration(migrations.Migration): ('status', models.CharField(default='active', max_length=50)), ('role', models.CharField(blank=True, max_length=50)), ('assigned_object_id', models.PositiveIntegerField(blank=True, null=True)), - ('dns_name', models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, asterisks, hyphens, periods, and underscores are allowed in DNS names', regex='^([0-9A-Za-z_-]+|\\*)(\\.[0-9A-Za-z_-]+)*\\.?$')])), + ( + 'dns_name', + models.CharField( + blank=True, + max_length=255, + validators=[ + django.core.validators.RegexValidator( + code='invalid', + message=( + 'Only alphanumeric characters, asterisks, hyphens, periods, and underscores are ' + 'allowed in DNS names' + ), + regex='^([0-9A-Za-z_-]+|\\*)(\\.[0-9A-Za-z_-]+)*\\.?$', + ) + ], + ), + ), ('description', models.CharField(blank=True, max_length=200)), ], options={ @@ -73,7 +88,11 @@ class Migration(migrations.Migration): ], options={ 'verbose_name_plural': 'prefixes', - 'ordering': (django.db.models.expressions.OrderBy(django.db.models.expressions.F('vrf'), nulls_first=True), 'prefix', 'pk'), + 'ordering': ( + django.db.models.expressions.OrderBy(django.db.models.expressions.F('vrf'), nulls_first=True), + 'prefix', + 'pk', + ), }, ), migrations.CreateModel( @@ -135,10 +154,25 @@ class Migration(migrations.Migration): ('rd', models.CharField(blank=True, max_length=21, null=True, unique=True)), ('enforce_unique', models.BooleanField(default=True)), ('description', models.CharField(blank=True, max_length=200)), - ('export_targets', models.ManyToManyField(blank=True, related_name='exporting_vrfs', to='ipam.RouteTarget')), - ('import_targets', models.ManyToManyField(blank=True, related_name='importing_vrfs', to='ipam.RouteTarget')), + ( + 'export_targets', + models.ManyToManyField(blank=True, related_name='exporting_vrfs', to='ipam.RouteTarget'), + ), + ( + 'import_targets', + models.ManyToManyField(blank=True, related_name='importing_vrfs', to='ipam.RouteTarget'), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vrfs', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vrfs', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'VRF', @@ -157,7 +191,21 @@ class Migration(migrations.Migration): ('slug', models.SlugField(max_length=100)), ('scope_id', models.PositiveBigIntegerField(blank=True, null=True)), ('description', models.CharField(blank=True, max_length=200)), - ('scope_type', models.ForeignKey(blank=True, limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster'))), null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + 'scope_type', + models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + ( + 'model__in', + ('region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster'), + ) + ), + null=True, + on_delete=django.db.models.deletion.CASCADE, + to='contenttypes.contenttype', + ), + ), ], options={ 'verbose_name': 'VLAN group', @@ -172,15 +220,59 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=CustomFieldJSONEncoder)), ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('vid', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4094)])), + ( + 'vid', + models.PositiveSmallIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4094), + ] + ), + ), ('name', models.CharField(max_length=64)), ('status', models.CharField(default='active', max_length=50)), ('description', models.CharField(blank=True, max_length=200)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vlans', to='ipam.vlangroup')), - ('role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vlans', to='ipam.role')), - ('site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vlans', to='dcim.site')), + ( + 'group', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vlans', + to='ipam.vlangroup', + ), + ), + ( + 'role', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='vlans', + to='ipam.role', + ), + ), + ( + 'site', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vlans', + to='dcim.site', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vlans', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='vlans', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'VLAN', @@ -197,9 +289,29 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=100)), ('protocol', models.CharField(max_length=50)), - ('ports', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65535)]), size=None)), + ( + 'ports', + django.contrib.postgres.fields.ArrayField( + base_field=models.PositiveIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(65535), + ] + ), + size=None, + ), + ), ('description', models.CharField(blank=True, max_length=200)), - ('device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='services', to='dcim.device')), + ( + 'device', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='services', + to='dcim.device', + ), + ), ('ipaddresses', models.ManyToManyField(blank=True, related_name='services', to='ipam.IPAddress')), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], diff --git a/netbox/ipam/migrations/0002_squashed_0046.py b/netbox/ipam/migrations/0002_squashed_0046.py index 06bcd8741..6c03753d8 100644 --- a/netbox/ipam/migrations/0002_squashed_0046.py +++ b/netbox/ipam/migrations/0002_squashed_0046.py @@ -4,7 +4,6 @@ import taggit.managers class Migration(migrations.Migration): - dependencies = [ ('dcim', '0003_auto_20160628_1721'), ('virtualization', '0001_virtualization'), @@ -66,7 +65,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='service', name='virtual_machine', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='services', to='virtualization.virtualmachine'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='services', + to='virtualization.virtualmachine', + ), ), migrations.AddField( model_name='routetarget', @@ -76,17 +81,35 @@ class Migration(migrations.Migration): migrations.AddField( model_name='routetarget', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='route_targets', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='route_targets', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='prefix', name='role', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prefixes', to='ipam.role'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='prefixes', + to='ipam.role', + ), ), migrations.AddField( model_name='prefix', name='site', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='prefixes', to='dcim.site'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='prefixes', + to='dcim.site', + ), ), migrations.AddField( model_name='prefix', @@ -96,27 +119,64 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prefix', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='prefixes', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='prefixes', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='prefix', name='vlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='prefixes', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='prefixes', + to='ipam.vlan', + ), ), migrations.AddField( model_name='prefix', name='vrf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='prefixes', to='ipam.vrf'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='prefixes', + to='ipam.vrf', + ), ), migrations.AddField( model_name='ipaddress', name='assigned_object_type', - field=models.ForeignKey(blank=True, limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'dcim'), ('model', 'interface')), + models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), + _connector='OR', + ) + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.AddField( model_name='ipaddress', name='nat_inside', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nat_outside', to='ipam.ipaddress'), + field=models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='nat_outside', + to='ipam.ipaddress', + ), ), migrations.AddField( model_name='ipaddress', @@ -126,17 +186,31 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ipaddress', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ip_addresses', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='ip_addresses', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='ipaddress', name='vrf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ip_addresses', to='ipam.vrf'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='ip_addresses', + to='ipam.vrf', + ), ), migrations.AddField( model_name='aggregate', name='rir', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='aggregates', to='ipam.rir'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='aggregates', to='ipam.rir' + ), ), migrations.AddField( model_name='aggregate', @@ -146,7 +220,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='aggregate', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='aggregates', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='aggregates', + to='tenancy.tenant', + ), ), migrations.AlterUniqueTogether( name='vlangroup', diff --git a/netbox/ipam/migrations/0047_squashed_0053.py b/netbox/ipam/migrations/0047_squashed_0053.py index 470261316..a05d0cb81 100644 --- a/netbox/ipam/migrations/0047_squashed_0053.py +++ b/netbox/ipam/migrations/0047_squashed_0053.py @@ -8,7 +8,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('ipam', '0047_prefix_depth_children'), ('ipam', '0048_prefix_populate_depth_children'), @@ -16,7 +15,7 @@ class Migration(migrations.Migration): ('ipam', '0050_iprange'), ('ipam', '0051_extend_tag_support'), ('ipam', '0052_fhrpgroup'), - ('ipam', '0053_asn_model') + ('ipam', '0053_asn_model'), ] dependencies = [ @@ -47,17 +46,47 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('start_address', ipam.fields.IPAddressField()), ('end_address', ipam.fields.IPAddressField()), ('size', models.PositiveIntegerField(editable=False)), ('status', models.CharField(default='active', max_length=50)), ('description', models.CharField(blank=True, max_length=200)), - ('role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ip_ranges', to='ipam.role')), + ( + 'role', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='ip_ranges', + to='ipam.role', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ip_ranges', to='tenancy.tenant')), - ('vrf', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ip_ranges', to='ipam.vrf')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='ip_ranges', + to='tenancy.tenant', + ), + ), + ( + 'vrf', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='ip_ranges', + to='ipam.vrf', + ), + ), ], options={ 'verbose_name': 'IP range', @@ -85,7 +114,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('group_id', models.PositiveSmallIntegerField()), ('protocol', models.CharField(max_length=50)), @@ -102,7 +134,21 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ipaddress', name='assigned_object_type', - field=models.ForeignKey(blank=True, limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'ipam'), ('model', 'fhrpgroup')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype'), + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'dcim'), ('model', 'interface')), + models.Q(('app_label', 'ipam'), ('model', 'fhrpgroup')), + models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), + _connector='OR', + ) + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), ), migrations.CreateModel( name='FHRPGroupAssignment', @@ -111,9 +157,20 @@ class Migration(migrations.Migration): ('last_updated', models.DateTimeField(auto_now=True, null=True)), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('interface_id', models.PositiveIntegerField()), - ('priority', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])), + ( + 'priority', + models.PositiveSmallIntegerField( + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(255), + ] + ), + ), ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ipam.fhrpgroup')), - ('interface_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), + ( + 'interface_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), ], options={ 'verbose_name': 'FHRP group assignment', @@ -126,13 +183,28 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(primary_key=True, serialize=False)), ('asn', ipam.fields.ASNField(unique=True)), ('description', models.CharField(blank=True, max_length=200)), - ('rir', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='asns', to='ipam.rir')), + ( + 'rir', + models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='asns', to='ipam.rir'), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='asns', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='asns', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'ASN', diff --git a/netbox/ipam/migrations/0054_squashed_0067.py b/netbox/ipam/migrations/0054_squashed_0067.py index 40073ca29..929a27fda 100644 --- a/netbox/ipam/migrations/0054_squashed_0067.py +++ b/netbox/ipam/migrations/0054_squashed_0067.py @@ -10,7 +10,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('ipam', '0054_vlangroup_min_max_vids'), ('ipam', '0055_servicetemplate'), @@ -25,7 +24,7 @@ class Migration(migrations.Migration): ('ipam', '0064_clear_search_cache'), ('ipam', '0065_asnrange'), ('ipam', '0066_iprange_mark_utilized'), - ('ipam', '0067_ipaddress_index_host') + ('ipam', '0067_ipaddress_index_host'), ] dependencies = [ @@ -40,12 +39,24 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vlangroup', name='max_vid', - field=models.PositiveSmallIntegerField(default=4094, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4094)]), + field=models.PositiveSmallIntegerField( + default=4094, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4094), + ], + ), ), migrations.AddField( model_name='vlangroup', name='min_vid', - field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4094)]), + field=models.PositiveSmallIntegerField( + default=1, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4094), + ], + ), ), migrations.AlterField( model_name='aggregate', @@ -187,10 +198,24 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('protocol', models.CharField(max_length=50)), - ('ports', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65535)]), size=None)), + ( + 'ports', + django.contrib.postgres.fields.ArrayField( + base_field=models.PositiveIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(65535), + ] + ), + size=None, + ), + ), ('description', models.CharField(blank=True, max_length=200)), ('name', models.CharField(max_length=100, unique=True)), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), @@ -217,7 +242,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ipaddress', name='nat_inside', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nat_outside', to='ipam.ipaddress'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='nat_outside', + to='ipam.ipaddress', + ), ), migrations.CreateModel( name='L2VPN', @@ -225,16 +256,34 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), ('type', models.CharField(max_length=50)), ('identifier', models.BigIntegerField(blank=True, null=True)), ('description', models.CharField(blank=True, max_length=200)), - ('export_targets', models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget')), - ('import_targets', models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget')), + ( + 'export_targets', + models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget'), + ), + ( + 'import_targets', + models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget'), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='l2vpns', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='l2vpns', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'L2VPN', @@ -247,10 +296,33 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('assigned_object_id', models.PositiveBigIntegerField()), - ('assigned_object_type', models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'ipam'), ('model', 'vlan')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('l2vpn', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='ipam.l2vpn')), + ( + 'assigned_object_type', + models.ForeignKey( + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'dcim'), ('model', 'interface')), + models.Q(('app_label', 'ipam'), ('model', 'vlan')), + models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), + _connector='OR', + ) + ), + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'l2vpn', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='ipam.l2vpn' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -260,7 +332,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='l2vpntermination', - constraint=models.UniqueConstraint(fields=('assigned_object_type', 'assigned_object_id'), name='ipam_l2vpntermination_assigned_object'), + constraint=models.UniqueConstraint( + fields=('assigned_object_type', 'assigned_object_id'), name='ipam_l2vpntermination_assigned_object' + ), ), migrations.AddField( model_name='fhrpgroup', @@ -281,7 +355,10 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='fhrpgroupassignment', - constraint=models.UniqueConstraint(fields=('interface_type', 'interface_id', 'group'), name='ipam_fhrpgroupassignment_unique_interface_group'), + constraint=models.UniqueConstraint( + fields=('interface_type', 'interface_id', 'group'), + name='ipam_fhrpgroupassignment_unique_interface_group', + ), ), migrations.AddConstraint( model_name='vlan', @@ -293,11 +370,15 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='vlangroup', - constraint=models.UniqueConstraint(fields=('scope_type', 'scope_id', 'name'), name='ipam_vlangroup_unique_scope_name'), + constraint=models.UniqueConstraint( + fields=('scope_type', 'scope_id', 'name'), name='ipam_vlangroup_unique_scope_name' + ), ), migrations.AddConstraint( model_name='vlangroup', - constraint=models.UniqueConstraint(fields=('scope_type', 'scope_id', 'slug'), name='ipam_vlangroup_unique_scope_slug'), + constraint=models.UniqueConstraint( + fields=('scope_type', 'scope_id', 'slug'), name='ipam_vlangroup_unique_scope_slug' + ), ), migrations.AddField( model_name='aggregate', @@ -365,15 +446,32 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), ('start', ipam.fields.ASNField()), ('end', ipam.fields.ASNField()), - ('rir', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='asn_ranges', to='ipam.rir')), + ( + 'rir', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='asn_ranges', to='ipam.rir' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='asn_ranges', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='asn_ranges', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'ASN range', @@ -388,6 +486,11 @@ class Migration(migrations.Migration): ), migrations.AddIndex( model_name='ipaddress', - index=models.Index(django.db.models.functions.comparison.Cast(ipam.lookups.Host('address'), output_field=ipam.fields.IPAddressField()), name='ipam_ipaddress_host'), + index=models.Index( + django.db.models.functions.comparison.Cast( + ipam.lookups.Host('address'), output_field=ipam.fields.IPAddressField() + ), + name='ipam_ipaddress_host', + ), ), ] diff --git a/netbox/ipam/migrations/0068_move_l2vpn.py b/netbox/ipam/migrations/0068_move_l2vpn.py index b1a059de1..9240240bc 100644 --- a/netbox/ipam/migrations/0068_move_l2vpn.py +++ b/netbox/ipam/migrations/0068_move_l2vpn.py @@ -15,7 +15,6 @@ def update_content_types(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('ipam', '0067_ipaddress_index_host'), ] @@ -57,8 +56,5 @@ class Migration(migrations.Migration): ), ], ), - migrations.RunPython( - code=update_content_types, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_content_types, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/ipam/migrations/0069_gfk_indexes.py b/netbox/ipam/migrations/0069_gfk_indexes.py index 75c016102..d7ce48e35 100644 --- a/netbox/ipam/migrations/0069_gfk_indexes.py +++ b/netbox/ipam/migrations/0069_gfk_indexes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('ipam', '0068_move_l2vpn'), ] @@ -16,7 +15,9 @@ class Migration(migrations.Migration): ), migrations.AddIndex( model_name='ipaddress', - index=models.Index(fields=['assigned_object_type', 'assigned_object_id'], name='ipam_ipaddr_assigne_890ab8_idx'), + index=models.Index( + fields=['assigned_object_type', 'assigned_object_id'], name='ipam_ipaddr_assigne_890ab8_idx' + ), ), migrations.AddIndex( model_name='vlangroup', diff --git a/netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py b/netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py index b01941401..133173234 100644 --- a/netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py +++ b/netbox/ipam/migrations/0070_vlangroup_vlan_id_ranges.py @@ -12,15 +12,12 @@ def set_vid_ranges(apps, schema_editor): """ VLANGroup = apps.get_model('ipam', 'VLANGroup') for group in VLANGroup.objects.all(): - group.vid_ranges = [ - NumericRange(group.min_vid, group.max_vid, bounds='[]') - ] + group.vid_ranges = [NumericRange(group.min_vid, group.max_vid, bounds='[]')] group._total_vlan_ids = group.max_vid - group.min_vid + 1 group.save() class Migration(migrations.Migration): - dependencies = [ ('ipam', '0069_gfk_indexes'), ] @@ -32,7 +29,7 @@ class Migration(migrations.Migration): field=django.contrib.postgres.fields.ArrayField( base_field=django.contrib.postgres.fields.ranges.IntegerRangeField(), default=ipam.models.vlans.default_vid_ranges, - size=None + size=None, ), ), migrations.AddField( @@ -40,10 +37,7 @@ class Migration(migrations.Migration): name='_total_vlan_ids', field=models.PositiveBigIntegerField(default=4094), ), - migrations.RunPython( - code=set_vid_ranges, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_vid_ranges, reverse_code=migrations.RunPython.noop), migrations.RemoveField( model_name='vlangroup', name='max_vid', diff --git a/netbox/ipam/migrations/0071_prefix_scope.py b/netbox/ipam/migrations/0071_prefix_scope.py index d016bdb93..2ab54d023 100644 --- a/netbox/ipam/migrations/0071_prefix_scope.py +++ b/netbox/ipam/migrations/0071_prefix_scope.py @@ -11,13 +11,11 @@ def copy_site_assignments(apps, schema_editor): Site = apps.get_model('dcim', 'Site') Prefix.objects.filter(site__isnull=False).update( - scope_type=ContentType.objects.get_for_model(Site), - scope_id=models.F('site_id') + scope_type=ContentType.objects.get_for_model(Site), scope_id=models.F('site_id') ) class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('ipam', '0070_vlangroup_vlan_id_ranges'), @@ -39,13 +37,9 @@ class Migration(migrations.Migration): null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', - to='contenttypes.contenttype' + to='contenttypes.contenttype', ), ), - # Copy over existing site assignments - migrations.RunPython( - code=copy_site_assignments, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=copy_site_assignments, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/ipam/migrations/0072_prefix_cached_relations.py b/netbox/ipam/migrations/0072_prefix_cached_relations.py index 4b438f7d5..e4a789704 100644 --- a/netbox/ipam/migrations/0072_prefix_cached_relations.py +++ b/netbox/ipam/migrations/0072_prefix_cached_relations.py @@ -19,7 +19,6 @@ def populate_denormalized_fields(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('dcim', '0193_poweroutlet_color'), ('ipam', '0071_prefix_scope'), @@ -29,12 +28,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prefix', name='_location', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.location' + ), ), migrations.AddField( model_name='prefix', name='_region', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.region'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.region' + ), ), migrations.AddField( model_name='prefix', @@ -44,15 +47,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prefix', name='_site_group', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.sitegroup'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dcim.sitegroup' + ), ), - # Populate denormalized FK values - migrations.RunPython( - code=populate_denormalized_fields, - reverse_code=migrations.RunPython.noop - ), - + migrations.RunPython(code=populate_denormalized_fields, reverse_code=migrations.RunPython.noop), # Delete the site ForeignKey migrations.RemoveField( model_name='prefix', diff --git a/netbox/ipam/migrations/0073_charfield_null_choices.py b/netbox/ipam/migrations/0073_charfield_null_choices.py index 9293728f5..cfb764b46 100644 --- a/netbox/ipam/migrations/0073_charfield_null_choices.py +++ b/netbox/ipam/migrations/0073_charfield_null_choices.py @@ -13,7 +13,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('ipam', '0072_prefix_cached_relations'), ] @@ -29,8 +28,5 @@ class Migration(migrations.Migration): name='role', field=models.CharField(blank=True, max_length=50, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/ipam/migrations/0074_vlantranslationpolicy_vlantranslationrule.py b/netbox/ipam/migrations/0074_vlantranslationpolicy_vlantranslationrule.py index ca3943649..5a13f18e6 100644 --- a/netbox/ipam/migrations/0074_vlantranslationpolicy_vlantranslationrule.py +++ b/netbox/ipam/migrations/0074_vlantranslationpolicy_vlantranslationrule.py @@ -8,7 +8,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('extras', '0121_customfield_related_object_filter'), ('ipam', '0073_charfield_null_choices'), @@ -21,7 +20,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), @@ -39,24 +41,57 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), - ('local_vid', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4094)])), - ('remote_vid', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4094)])), - ('policy', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rules', to='ipam.vlantranslationpolicy')), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), + ( + 'local_vid', + models.PositiveSmallIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4094), + ] + ), + ), + ( + 'remote_vid', + models.PositiveSmallIntegerField( + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4094), + ] + ), + ), + ( + 'policy', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='rules', + to='ipam.vlantranslationpolicy', + ), + ), ('description', models.CharField(blank=True, max_length=200)), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ 'verbose_name': 'VLAN translation rule', - 'ordering': ('policy', 'local_vid',), + 'ordering': ( + 'policy', + 'local_vid', + ), }, ), migrations.AddConstraint( model_name='vlantranslationrule', - constraint=models.UniqueConstraint(fields=('policy', 'local_vid'), name='ipam_vlantranslationrule_unique_policy_local_vid'), + constraint=models.UniqueConstraint( + fields=('policy', 'local_vid'), name='ipam_vlantranslationrule_unique_policy_local_vid' + ), ), migrations.AddConstraint( model_name='vlantranslationrule', - constraint=models.UniqueConstraint(fields=('policy', 'remote_vid'), name='ipam_vlantranslationrule_unique_policy_remote_vid'), + constraint=models.UniqueConstraint( + fields=('policy', 'remote_vid'), name='ipam_vlantranslationrule_unique_policy_remote_vid' + ), ), ] diff --git a/netbox/ipam/migrations/0075_vlan_qinq.py b/netbox/ipam/migrations/0075_vlan_qinq.py index 8a3b8a39a..1e8f86c36 100644 --- a/netbox/ipam/migrations/0075_vlan_qinq.py +++ b/netbox/ipam/migrations/0075_vlan_qinq.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('ipam', '0074_vlantranslationpolicy_vlantranslationrule'), ] @@ -17,7 +16,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vlan', name='qinq_svlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='qinq_cvlans', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='qinq_cvlans', + to='ipam.vlan', + ), ), migrations.AddConstraint( model_name='vlan', diff --git a/netbox/ipam/migrations/0076_natural_ordering.py b/netbox/ipam/migrations/0076_natural_ordering.py index 8c7bfaea1..f6c9e5ccb 100644 --- a/netbox/ipam/migrations/0076_natural_ordering.py +++ b/netbox/ipam/migrations/0076_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('ipam', '0075_vlan_qinq'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/ipam/models/ip.py b/netbox/ipam/models/ip.py index dcecbcdea..e1a8d91e3 100644 --- a/netbox/ipam/models/ip.py +++ b/netbox/ipam/models/ip.py @@ -418,7 +418,9 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, CachedScopeMixin, Primary available_ips = prefix - child_ips - netaddr.IPSet(child_ranges) # IPv6 /127's, pool, or IPv4 /31-/32 sets are fully usable - if (self.family == 6 and self.prefix.prefixlen >= 127) or self.is_pool or (self.family == 4 and self.prefix.prefixlen >= 31): + if (self.family == 6 and self.prefix.prefixlen >= 127) or self.is_pool or ( + self.family == 4 and self.prefix.prefixlen >= 31 + ): return available_ips if self.family == 4: @@ -561,10 +563,26 @@ class IPRange(ContactsMixin, PrimaryModel): }) # Check for overlapping ranges - overlapping_ranges = IPRange.objects.exclude(pk=self.pk).filter(vrf=self.vrf).filter( - Q(start_address__host__inet__gte=self.start_address.ip, start_address__host__inet__lte=self.end_address.ip) | # Starts inside - Q(end_address__host__inet__gte=self.start_address.ip, end_address__host__inet__lte=self.end_address.ip) | # Ends inside - Q(start_address__host__inet__lte=self.start_address.ip, end_address__host__inet__gte=self.end_address.ip) # Starts & ends outside + overlapping_ranges = ( + IPRange.objects.exclude(pk=self.pk) + .filter(vrf=self.vrf) + .filter( + # Starts inside + Q( + start_address__host__inet__gte=self.start_address.ip, + start_address__host__inet__lte=self.end_address.ip, + ) | + # Ends inside + Q( + end_address__host__inet__gte=self.start_address.ip, + end_address__host__inet__lte=self.end_address.ip, + ) | + # Starts & ends outside + Q( + start_address__host__inet__lte=self.start_address.ip, + end_address__host__inet__gte=self.end_address.ip, + ) + ) ) if overlapping_ranges.exists(): raise ValidationError( @@ -866,10 +884,12 @@ class IPAddress(ContactsMixin, PrimaryModel): # can't use is_primary_ip as self.assigned_object might be changed is_primary = False - if self.family == 4 and hasattr(original_parent, 'primary_ip4') and original_parent.primary_ip4_id == self.pk: - is_primary = True - if self.family == 6 and hasattr(original_parent, 'primary_ip6') and original_parent.primary_ip6_id == self.pk: - is_primary = True + if self.family == 4 and hasattr(original_parent, 'primary_ip4'): + if original_parent.primary_ip4_id == self.pk: + is_primary = True + if self.family == 6 and hasattr(original_parent, 'primary_ip6'): + if original_parent.primary_ip6_id == self.pk: + is_primary = True if is_primary and (parent != original_parent): raise ValidationError( diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index 399641422..dbbeb3454 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -6,6 +6,7 @@ from django_tables2.utils import Accessor from ipam.models import * from netbox.tables import NetBoxTable, columns from tenancy.tables import TenancyColumnsMixin, TenantColumn +from .template_code import * __all__ = ( 'AggregateTable', @@ -20,61 +21,6 @@ __all__ = ( AVAILABLE_LABEL = mark_safe('Available') -AGGREGATE_COPY_BUTTON = """ -{% copy_content record.pk prefix="aggregate_" %} -""" - -PREFIX_LINK = """ -{% if record.pk %} - {{ record.prefix }} -{% else %} - {{ record.prefix }} -{% endif %} -""" - -PREFIX_COPY_BUTTON = """ -{% copy_content record.pk prefix="prefix_" %} -""" - -PREFIX_LINK_WITH_DEPTH = """ -{% load helpers %} -{% if record.depth %} -
    - {% for i in record.depth|as_range %} - • - {% endfor %} -
    -{% endif %} -""" + PREFIX_LINK - -IPADDRESS_LINK = """ -{% if record.pk %} - {{ record.address }} -{% elif perms.ipam.add_ipaddress %} - {% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available -{% else %} - {% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available -{% endif %} -""" - -IPADDRESS_COPY_BUTTON = """ -{% copy_content record.pk prefix="ipaddress_" %} -""" - -IPADDRESS_ASSIGN_LINK = """ -{{ record }} -""" - -VRF_LINK = """ -{% if value %} - {{ record.vrf }} -{% elif object.vrf %} - {{ object.vrf }} -{% else %} - Global -{% endif %} -""" - # # RIRs diff --git a/netbox/ipam/tables/template_code.py b/netbox/ipam/tables/template_code.py new file mode 100644 index 000000000..fb969345e --- /dev/null +++ b/netbox/ipam/tables/template_code.py @@ -0,0 +1,88 @@ +AGGREGATE_COPY_BUTTON = """ +{% copy_content record.pk prefix="aggregate_" %} +""" + +PREFIX_LINK = """ +{% if record.pk %} + {{ record.prefix }} +{% else %} + {{ record.prefix }} +{% endif %} +""" + +PREFIX_COPY_BUTTON = """ +{% copy_content record.pk prefix="prefix_" %} +""" + +PREFIX_LINK_WITH_DEPTH = """ +{% load helpers %} +{% if record.depth %} +
    + {% for i in record.depth|as_range %} + • + {% endfor %} +
    +{% endif %} +""" + PREFIX_LINK + +IPADDRESS_LINK = """ +{% if record.pk %} + {{ record.address }} +{% elif perms.ipam.add_ipaddress %} + {% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available +{% else %} + {% if record.0 <= 65536 %}{{ record.0 }}{% else %}Many{% endif %} IP{{ record.0|pluralize }} available +{% endif %} +""" + +IPADDRESS_COPY_BUTTON = """ +{% copy_content record.pk prefix="ipaddress_" %} +""" + +IPADDRESS_ASSIGN_LINK = """ +{{ record }} +""" + +VRF_LINK = """ +{% if value %} + {{ record.vrf }} +{% elif object.vrf %} + {{ object.vrf }} +{% else %} + Global +{% endif %} +""" + +VLAN_LINK = """ +{% if record.pk %} + {{ record.vid }} +{% elif perms.ipam.add_vlan %} + {{ record.available }} VLAN{{ record.available|pluralize }} available +{% else %} + {{ record.available }} VLAN{{ record.available|pluralize }} available +{% endif %} +""" + +VLAN_PREFIXES = """ +{% for prefix in value.all %} + {{ prefix }}{% if not forloop.last %}
    {% endif %} +{% endfor %} +""" + +VLANGROUP_BUTTONS = """ +{% with next_vid=record.get_next_available_vid %} + {% if next_vid and perms.ipam.add_vlan %} + + + + {% endif %} +{% endwith %} +""" + +VLAN_MEMBER_TAGGED = """ +{% if record.untagged_vlan_id == object.pk %} + +{% else %} + +{% endif %} +""" diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index d34ff5f45..e3d7c7e63 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -8,6 +8,7 @@ from ipam.models import * from netbox.tables import NetBoxTable, columns from tenancy.tables import TenancyColumnsMixin, TenantColumn from virtualization.models import VMInterface +from .template_code import * __all__ = ( 'InterfaceVLANTable', @@ -22,40 +23,6 @@ __all__ = ( AVAILABLE_LABEL = mark_safe('Available') -VLAN_LINK = """ -{% if record.pk %} - {{ record.vid }} -{% elif perms.ipam.add_vlan %} - {{ record.available }} VLAN{{ record.available|pluralize }} available -{% else %} - {{ record.available }} VLAN{{ record.available|pluralize }} available -{% endif %} -""" - -VLAN_PREFIXES = """ -{% for prefix in value.all %} - {{ prefix }}{% if not forloop.last %}
    {% endif %} -{% endfor %} -""" - -VLANGROUP_BUTTONS = """ -{% with next_vid=record.get_next_available_vid %} - {% if next_vid and perms.ipam.add_vlan %} - - - - {% endif %} -{% endwith %} -""" - -VLAN_MEMBER_TAGGED = """ -{% if record.untagged_vlan_id == object.pk %} - -{% else %} - -{% endif %} -""" - # # VLAN groups diff --git a/netbox/ipam/tests/test_api.py b/netbox/ipam/tests/test_api.py index 4e8456e5a..cbcb2e7c8 100644 --- a/netbox/ipam/tests/test_api.py +++ b/netbox/ipam/tests/test_api.py @@ -732,10 +732,19 @@ class FHRPGroupTest(APIViewTestCases.APIViewTestCase): @classmethod def setUpTestData(cls): - fhrp_groups = ( - FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, group_id=10, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, auth_key='foobar123'), - FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, group_id=20, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, auth_key='foobar123'), + FHRPGroup( + protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, + group_id=10, + auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, + auth_key='foobar123', + ), + FHRPGroup( + protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, + group_id=20, + auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, + auth_key='foobar123', + ), FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_HSRP, group_id=30), ) FHRPGroup.objects.bulk_create(fhrp_groups) diff --git a/netbox/ipam/tests/test_filtersets.py b/netbox/ipam/tests/test_filtersets.py index 28e8cda1e..5455beb9c 100644 --- a/netbox/ipam/tests/test_filtersets.py +++ b/netbox/ipam/tests/test_filtersets.py @@ -496,8 +496,12 @@ class AggregateTestCase(TestCase, ChangeLoggedFilterSetTests): Tenant.objects.bulk_create(tenants) aggregates = ( - Aggregate(prefix='10.1.0.0/16', rir=rirs[0], tenant=tenants[0], date_added='2020-01-01', description='foobar1'), - Aggregate(prefix='10.2.0.0/16', rir=rirs[0], tenant=tenants[1], date_added='2020-01-02', description='foobar2'), + Aggregate( + prefix='10.1.0.0/16', rir=rirs[0], tenant=tenants[0], date_added='2020-01-01', description='foobar1' + ), + Aggregate( + prefix='10.2.0.0/16', rir=rirs[0], tenant=tenants[1], date_added='2020-01-02', description='foobar2' + ), Aggregate(prefix='10.3.0.0/16', rir=rirs[1], tenant=tenants[2], date_added='2020-01-03'), Aggregate(prefix='2001:db8:1::/48', rir=rirs[1], tenant=tenants[0], date_added='2020-01-04'), Aggregate(prefix='2001:db8:2::/48', rir=rirs[2], tenant=tenants[1], date_added='2020-01-05'), @@ -656,14 +660,80 @@ class PrefixTestCase(TestCase, ChangeLoggedFilterSetTests): Tenant.objects.bulk_create(tenants) prefixes = ( - Prefix(prefix='10.0.0.0/24', tenant=None, scope=None, vrf=None, vlan=None, role=None, is_pool=True, mark_utilized=True, description='foobar1'), - Prefix(prefix='10.0.1.0/24', tenant=tenants[0], scope=sites[0], vrf=vrfs[0], vlan=vlans[0], role=roles[0], description='foobar2'), - Prefix(prefix='10.0.2.0/24', tenant=tenants[1], scope=sites[1], vrf=vrfs[1], vlan=vlans[1], role=roles[1], status=PrefixStatusChoices.STATUS_DEPRECATED), - Prefix(prefix='10.0.3.0/24', tenant=tenants[2], scope=sites[2], vrf=vrfs[2], vlan=vlans[2], role=roles[2], status=PrefixStatusChoices.STATUS_RESERVED), - Prefix(prefix='2001:db8::/64', tenant=None, scope=None, vrf=None, vlan=None, role=None, is_pool=True, mark_utilized=True), - Prefix(prefix='2001:db8:0:1::/64', tenant=tenants[0], scope=sites[0], vrf=vrfs[0], vlan=vlans[0], role=roles[0]), - Prefix(prefix='2001:db8:0:2::/64', tenant=tenants[1], scope=sites[1], vrf=vrfs[1], vlan=vlans[1], role=roles[1], status=PrefixStatusChoices.STATUS_DEPRECATED), - Prefix(prefix='2001:db8:0:3::/64', tenant=tenants[2], scope=sites[2], vrf=vrfs[2], vlan=vlans[2], role=roles[2], status=PrefixStatusChoices.STATUS_RESERVED), + Prefix( + prefix='10.0.0.0/24', + tenant=None, + scope=None, + vrf=None, + vlan=None, + role=None, + is_pool=True, + mark_utilized=True, + description='foobar1', + ), + Prefix( + prefix='10.0.1.0/24', + tenant=tenants[0], + scope=sites[0], + vrf=vrfs[0], + vlan=vlans[0], + role=roles[0], + description='foobar2', + ), + Prefix( + prefix='10.0.2.0/24', + tenant=tenants[1], + scope=sites[1], + vrf=vrfs[1], + vlan=vlans[1], + role=roles[1], + status=PrefixStatusChoices.STATUS_DEPRECATED, + ), + Prefix( + prefix='10.0.3.0/24', + tenant=tenants[2], + scope=sites[2], + vrf=vrfs[2], + vlan=vlans[2], + role=roles[2], + status=PrefixStatusChoices.STATUS_RESERVED, + ), + Prefix( + prefix='2001:db8::/64', + tenant=None, + scope=None, + vrf=None, + vlan=None, + role=None, + is_pool=True, + mark_utilized=True, + ), + Prefix( + prefix='2001:db8:0:1::/64', + tenant=tenants[0], + scope=sites[0], + vrf=vrfs[0], + vlan=vlans[0], + role=roles[0] + ), + Prefix( + prefix='2001:db8:0:2::/64', + tenant=tenants[1], + scope=sites[1], + vrf=vrfs[1], + vlan=vlans[1], + role=roles[1], + status=PrefixStatusChoices.STATUS_DEPRECATED, + ), + Prefix( + prefix='2001:db8:0:3::/64', + tenant=tenants[2], + scope=sites[2], + vrf=vrfs[2], + vlan=vlans[2], + role=roles[2], + status=PrefixStatusChoices.STATUS_RESERVED, + ), Prefix(prefix='10.0.0.0/16'), Prefix(prefix='2001:db8::/32'), ) @@ -1365,7 +1435,10 @@ class FHRPGroupTestCase(TestCase, ChangeLoggedFilterSetTests): self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) def test_auth_type(self): - params = {'auth_type': [FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5]} + params = {'auth_type': [ + FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, + FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, + ]} self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) def test_auth_key(self): @@ -1653,9 +1726,15 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): device_type = DeviceType.objects.create(manufacturer=manufacturer, model='Device Type 1') role = DeviceRole.objects.create(name='Device Role 1', slug='device-role-1') devices = ( - Device(name='Device 1', site=sites[0], location=locations[0], rack=racks[0], device_type=device_type, role=role), - Device(name='Device 2', site=sites[1], location=locations[1], rack=racks[1], device_type=device_type, role=role), - Device(name='Device 3', site=sites[2], location=locations[2], rack=racks[2], device_type=device_type, role=role), + Device( + name='Device 1', site=sites[0], location=locations[0], rack=racks[0], device_type=device_type, role=role + ), + Device( + name='Device 2', site=sites[1], location=locations[1], rack=racks[1], device_type=device_type, role=role + ), + Device( + name='Device 3', site=sites[2], location=locations[2], rack=racks[2], device_type=device_type, role=role + ), ) Device.objects.bulk_create(devices) @@ -1773,20 +1852,64 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): VLAN(vid=19, name='Cluster 1', group=groups[18]), VLAN(vid=20, name='Cluster 2', group=groups[19]), VLAN(vid=21, name='Cluster 3', group=groups[20]), - - VLAN(vid=101, name='VLAN 101', site=sites[3], group=groups[21], role=roles[0], tenant=tenants[0], status=VLANStatusChoices.STATUS_ACTIVE), - VLAN(vid=102, name='VLAN 102', site=sites[3], group=groups[21], role=roles[0], tenant=tenants[0], status=VLANStatusChoices.STATUS_ACTIVE), - VLAN(vid=201, name='VLAN 201', site=sites[4], group=groups[22], role=roles[1], tenant=tenants[1], status=VLANStatusChoices.STATUS_DEPRECATED), - VLAN(vid=202, name='VLAN 202', site=sites[4], group=groups[22], role=roles[1], tenant=tenants[1], status=VLANStatusChoices.STATUS_DEPRECATED), - VLAN(vid=301, name='VLAN 301', site=sites[5], group=groups[23], role=roles[2], tenant=tenants[2], status=VLANStatusChoices.STATUS_RESERVED), - VLAN(vid=302, name='VLAN 302', site=sites[5], group=groups[23], role=roles[2], tenant=tenants[2], status=VLANStatusChoices.STATUS_RESERVED), - + VLAN( + vid=101, + name='VLAN 101', + site=sites[3], + group=groups[21], + role=roles[0], + tenant=tenants[0], + status=VLANStatusChoices.STATUS_ACTIVE, + ), + VLAN( + vid=102, + name='VLAN 102', + site=sites[3], + group=groups[21], + role=roles[0], + tenant=tenants[0], + status=VLANStatusChoices.STATUS_ACTIVE, + ), + VLAN( + vid=201, + name='VLAN 201', + site=sites[4], + group=groups[22], + role=roles[1], + tenant=tenants[1], + status=VLANStatusChoices.STATUS_DEPRECATED, + ), + VLAN( + vid=202, + name='VLAN 202', + site=sites[4], + group=groups[22], + role=roles[1], + tenant=tenants[1], + status=VLANStatusChoices.STATUS_DEPRECATED, + ), + VLAN( + vid=301, + name='VLAN 301', + site=sites[5], + group=groups[23], + role=roles[2], + tenant=tenants[2], + status=VLANStatusChoices.STATUS_RESERVED, + ), + VLAN( + vid=302, + name='VLAN 302', + site=sites[5], + group=groups[23], + role=roles[2], + tenant=tenants[2], + status=VLANStatusChoices.STATUS_RESERVED, + ), # Create one globally available VLAN on a VLAN group VLAN(vid=500, name='VLAN Group 1', group=groups[24]), - # Create one globally available VLAN VLAN(vid=1000, name='Global VLAN'), - # Create some Q-in-Q service VLANs VLAN(vid=2001, name='SVLAN 1', site=sites[6], qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), VLAN(vid=2002, name='SVLAN 2', site=sites[6], qinq_role=VLANQinQRoleChoices.ROLE_SERVICE), @@ -1795,11 +1918,31 @@ class VLANTestCase(TestCase, ChangeLoggedFilterSetTests): VLAN.objects.bulk_create(vlans) # Create Q-in-Q customer VLANs - VLAN.objects.bulk_create([ - VLAN(vid=3001, name='CVLAN 1', site=sites[6], qinq_svlan=vlans[29], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), - VLAN(vid=3002, name='CVLAN 2', site=sites[6], qinq_svlan=vlans[30], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), - VLAN(vid=3003, name='CVLAN 3', site=sites[6], qinq_svlan=vlans[31], qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER), - ]) + VLAN.objects.bulk_create( + [ + VLAN( + vid=3001, + name='CVLAN 1', + site=sites[6], + qinq_svlan=vlans[29], + qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER, + ), + VLAN( + vid=3002, + name='CVLAN 2', + site=sites[6], + qinq_svlan=vlans[30], + qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER, + ), + VLAN( + vid=3003, + name='CVLAN 3', + site=sites[6], + qinq_svlan=vlans[31], + qinq_role=VLANQinQRoleChoices.ROLE_CUSTOMER, + ), + ] + ) # Assign VLANs to device interfaces interfaces[0].untagged_vlan = vlans[0] @@ -2125,12 +2268,39 @@ class ServiceTestCase(TestCase, ChangeLoggedFilterSetTests): VirtualMachine.objects.bulk_create(virtual_machines) services = ( - Service(device=devices[0], name='Service 1', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[1001], description='foobar1'), - Service(device=devices[1], name='Service 2', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[1002], description='foobar2'), + Service( + device=devices[0], + name='Service 1', + protocol=ServiceProtocolChoices.PROTOCOL_TCP, + ports=[1001], + description='foobar1', + ), + Service( + device=devices[1], + name='Service 2', + protocol=ServiceProtocolChoices.PROTOCOL_TCP, + ports=[1002], + description='foobar2', + ), Service(device=devices[2], name='Service 3', protocol=ServiceProtocolChoices.PROTOCOL_UDP, ports=[1003]), - Service(virtual_machine=virtual_machines[0], name='Service 4', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[2001]), - Service(virtual_machine=virtual_machines[1], name='Service 5', protocol=ServiceProtocolChoices.PROTOCOL_TCP, ports=[2002]), - Service(virtual_machine=virtual_machines[2], name='Service 6', protocol=ServiceProtocolChoices.PROTOCOL_UDP, ports=[2003]), + Service( + virtual_machine=virtual_machines[0], + name='Service 4', + protocol=ServiceProtocolChoices.PROTOCOL_TCP, + ports=[2001], + ), + Service( + virtual_machine=virtual_machines[1], + name='Service 5', + protocol=ServiceProtocolChoices.PROTOCOL_TCP, + ports=[2002], + ), + Service( + virtual_machine=virtual_machines[2], + name='Service 6', + protocol=ServiceProtocolChoices.PROTOCOL_UDP, + ports=[2003], + ), ) Service.objects.bulk_create(services) services[0].ipaddresses.add(ip_addresses[0]) diff --git a/netbox/ipam/tests/test_models.py b/netbox/ipam/tests/test_models.py index 917b50f33..62eb74123 100644 --- a/netbox/ipam/tests/test_models.py +++ b/netbox/ipam/tests/test_models.py @@ -39,29 +39,50 @@ class TestAggregate(TestCase): class TestIPRange(TestCase): def test_overlapping_range(self): - iprange_192_168 = IPRange.objects.create(start_address=IPNetwork('192.168.0.1/22'), end_address=IPNetwork('192.168.0.49/22')) + iprange_192_168 = IPRange.objects.create( + start_address=IPNetwork('192.168.0.1/22'), end_address=IPNetwork('192.168.0.49/22') + ) iprange_192_168.clean() - iprange_3_1_99 = IPRange.objects.create(start_address=IPNetwork('1.2.3.1/24'), end_address=IPNetwork('1.2.3.99/24')) + iprange_3_1_99 = IPRange.objects.create( + start_address=IPNetwork('1.2.3.1/24'), end_address=IPNetwork('1.2.3.99/24') + ) iprange_3_1_99.clean() - iprange_3_100_199 = IPRange.objects.create(start_address=IPNetwork('1.2.3.100/24'), end_address=IPNetwork('1.2.3.199/24')) + iprange_3_100_199 = IPRange.objects.create( + start_address=IPNetwork('1.2.3.100/24'), end_address=IPNetwork('1.2.3.199/24') + ) iprange_3_100_199.clean() - iprange_3_200_255 = IPRange.objects.create(start_address=IPNetwork('1.2.3.200/24'), end_address=IPNetwork('1.2.3.255/24')) + iprange_3_200_255 = IPRange.objects.create( + start_address=IPNetwork('1.2.3.200/24'), end_address=IPNetwork('1.2.3.255/24') + ) iprange_3_200_255.clean() - iprange_4_1_99 = IPRange.objects.create(start_address=IPNetwork('1.2.4.1/24'), end_address=IPNetwork('1.2.4.99/24')) + iprange_4_1_99 = IPRange.objects.create( + start_address=IPNetwork('1.2.4.1/24'), end_address=IPNetwork('1.2.4.99/24') + ) iprange_4_1_99.clean() - iprange_4_200 = IPRange.objects.create(start_address=IPNetwork('1.2.4.200/24'), end_address=IPNetwork('1.2.4.255/24')) + iprange_4_200 = IPRange.objects.create( + start_address=IPNetwork('1.2.4.200/24'), end_address=IPNetwork('1.2.4.255/24') + ) iprange_4_200.clean() + # Overlapping range entirely within existing with self.assertRaises(ValidationError): - iprange_3_123_124 = IPRange.objects.create(start_address=IPNetwork('1.2.3.123/26'), end_address=IPNetwork('1.2.3.124/26')) + iprange_3_123_124 = IPRange.objects.create( + start_address=IPNetwork('1.2.3.123/26'), end_address=IPNetwork('1.2.3.124/26') + ) iprange_3_123_124.clean() + # Overlapping range starting within existing with self.assertRaises(ValidationError): - iprange_4_98_101 = IPRange.objects.create(start_address=IPNetwork('1.2.4.98/24'), end_address=IPNetwork('1.2.4.101/24')) + iprange_4_98_101 = IPRange.objects.create( + start_address=IPNetwork('1.2.4.98/24'), end_address=IPNetwork('1.2.4.101/24') + ) iprange_4_98_101.clean() + # Overlapping range ending within existing with self.assertRaises(ValidationError): - iprange_4_198_201 = IPRange.objects.create(start_address=IPNetwork('1.2.4.198/24'), end_address=IPNetwork('1.2.4.201/24')) + iprange_4_198_201 = IPRange.objects.create( + start_address=IPNetwork('1.2.4.198/24'), end_address=IPNetwork('1.2.4.201/24') + ) iprange_4_198_201.clean() @@ -105,13 +126,30 @@ class TestPrefix(TestCase): def test_get_child_ranges(self): prefix = Prefix(prefix='192.168.0.16/28') prefix.save() - ranges = IPRange.objects.bulk_create(( - IPRange(start_address=IPNetwork('192.168.0.1/24'), end_address=IPNetwork('192.168.0.10/24'), size=10), # No overlap - IPRange(start_address=IPNetwork('192.168.0.11/24'), end_address=IPNetwork('192.168.0.17/24'), size=7), # Partial overlap - IPRange(start_address=IPNetwork('192.168.0.18/24'), end_address=IPNetwork('192.168.0.23/24'), size=6), # Full overlap - IPRange(start_address=IPNetwork('192.168.0.24/24'), end_address=IPNetwork('192.168.0.30/24'), size=7), # Full overlap - IPRange(start_address=IPNetwork('192.168.0.31/24'), end_address=IPNetwork('192.168.0.40/24'), size=10), # Partial overlap - )) + ranges = IPRange.objects.bulk_create( + ( + # No overlap + IPRange( + start_address=IPNetwork('192.168.0.1/24'), end_address=IPNetwork('192.168.0.10/24'), size=10 + ), + # Partial overlap + IPRange( + start_address=IPNetwork('192.168.0.11/24'), end_address=IPNetwork('192.168.0.17/24'), size=7 + ), + # Full overlap + IPRange( + start_address=IPNetwork('192.168.0.18/24'), end_address=IPNetwork('192.168.0.23/24'), size=6 + ), + # Full overlap + IPRange( + start_address=IPNetwork('192.168.0.24/24'), end_address=IPNetwork('192.168.0.30/24'), size=7 + ), + # Partial overlap + IPRange( + start_address=IPNetwork('192.168.0.31/24'), end_address=IPNetwork('192.168.0.40/24'), size=10 + ), + ) + ) child_ranges = prefix.get_child_ranges() diff --git a/netbox/ipam/tests/test_ordering.py b/netbox/ipam/tests/test_ordering.py index fea6b55e2..2f7a5342d 100644 --- a/netbox/ipam/tests/test_ordering.py +++ b/netbox/ipam/tests/test_ordering.py @@ -92,8 +92,8 @@ class PrefixOrderingTestCase(OrderingTestBase): def test_prefix_complex_ordering(self): """ - This function tests a complex ordering of interwoven prefixes and vrfs. This is the current expected ordering of VRFs - This includes the testing of the Container status. + This function tests a complex ordering of interwoven prefixes and vrfs. This is the current expected ordering + of VRFs. This includes the testing of the Container status. The proper ordering, to get proper containerization should be: None:10.0.0.0/8 @@ -125,7 +125,6 @@ class PrefixOrderingTestCase(OrderingTestBase): class IPAddressOrderingTestCase(OrderingTestBase): - def test_address_vrf_ordering(self): """ This function tests ordering with the inclusion of vrfs @@ -147,24 +146,54 @@ class IPAddressOrderingTestCase(OrderingTestBase): IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf1, address=netaddr.IPNetwork('10.2.2.1/24')), IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf1, address=netaddr.IPNetwork('10.2.3.1/24')), IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf1, address=netaddr.IPNetwork('10.2.4.1/24')), - - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.0.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.1.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.2.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.3.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.4.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.0.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.1.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.2.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.3.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.4.1/24')), - - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.0.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.1.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.2.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.3.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.4.1/24')), - IPAddress(status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.5.1/24')), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.0.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.1.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.2.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.3.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.16.4.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.0.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.1.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.2.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.3.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=vrf2, address=netaddr.IPNetwork('172.17.4.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.0.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.1.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.2.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.3.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.4.1/24') + ), + IPAddress( + status=IPAddressStatusChoices.STATUS_ACTIVE, vrf=None, address=netaddr.IPNetwork('192.168.5.1/24') + ), ) IPAddress.objects.bulk_create(addresses) diff --git a/netbox/ipam/tests/test_views.py b/netbox/ipam/tests/test_views.py index c45777f08..d26a82414 100644 --- a/netbox/ipam/tests/test_views.py +++ b/netbox/ipam/tests/test_views.py @@ -707,11 +707,23 @@ class FHRPGroupTestCase(ViewTestCases.PrimaryObjectViewTestCase): @classmethod def setUpTestData(cls): - fhrp_groups = ( - FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, group_id=10, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, auth_key='foobar123'), - FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, group_id=20, auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, auth_key='foobar123'), - FHRPGroup(protocol=FHRPGroupProtocolChoices.PROTOCOL_HSRP, group_id=30), + FHRPGroup( + protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP2, + group_id=10, + auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_PLAINTEXT, + auth_key='foobar123', + ), + FHRPGroup( + protocol=FHRPGroupProtocolChoices.PROTOCOL_VRRP3, + group_id=20, + auth_type=FHRPGroupAuthTypeChoices.AUTHENTICATION_MD5, + auth_key='foobar123', + ), + FHRPGroup( + protocol=FHRPGroupProtocolChoices.PROTOCOL_HSRP, + group_id=30 + ), ) FHRPGroup.objects.bulk_create(fhrp_groups) diff --git a/netbox/netbox/filtersets.py b/netbox/netbox/filtersets.py index 657f2f71a..b8fbe7ad5 100644 --- a/netbox/netbox/filtersets.py +++ b/netbox/netbox/filtersets.py @@ -264,7 +264,9 @@ class ChangeLoggedModelFilterSet(BaseFilterSet): action = { 'created_by_request': Q(action=ObjectChangeActionChoices.ACTION_CREATE), 'updated_by_request': Q(action=ObjectChangeActionChoices.ACTION_UPDATE), - 'modified_by_request': Q(action__in=[ObjectChangeActionChoices.ACTION_CREATE, ObjectChangeActionChoices.ACTION_UPDATE]), + 'modified_by_request': Q( + action__in=[ObjectChangeActionChoices.ACTION_CREATE, ObjectChangeActionChoices.ACTION_UPDATE] + ), }.get(name) request_id = value pks = ObjectChange.objects.filter( diff --git a/netbox/netbox/tables/columns.py b/netbox/netbox/tables/columns.py index ee1420396..cf6e1f133 100644 --- a/netbox/netbox/tables/columns.py +++ b/netbox/netbox/tables/columns.py @@ -286,7 +286,8 @@ class ActionsColumn(tables.Column): if len(self.actions) == 1 or (self.split_actions and idx == 0): dropdown_class = attrs.css_class button = ( - f'' + f'' f'' ) @@ -303,7 +304,8 @@ class ActionsColumn(tables.Column): html += ( f'' f' {button}' - f' ' + f' ' f' {toggle_text}' f' ' f'' diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py index 7158f056a..456dd67d2 100644 --- a/netbox/netbox/views/generic/bulk_views.py +++ b/netbox/netbox/views/generic/bulk_views.py @@ -995,7 +995,8 @@ class BulkComponentCreateView(GetReturnURLMixin, BaseMultiObjectView): form.add_error(field, '{}: {}'.format(obj, ', '.join(e))) # Enforce object-level permissions - if self.queryset.filter(pk__in=[obj.pk for obj in new_components]).count() != len(new_components): + component_ids = [obj.pk for obj in new_components] + if self.queryset.filter(pk__in=component_ids).count() != len(new_components): raise PermissionsViolation except IntegrityError: diff --git a/netbox/netbox/views/generic/feature_views.py b/netbox/netbox/views/generic/feature_views.py index 49862e83f..1e17d5354 100644 --- a/netbox/netbox/views/generic/feature_views.py +++ b/netbox/netbox/views/generic/feature_views.py @@ -143,7 +143,12 @@ class ObjectJobsView(ConditionalLoginRequiredMixin, View): """ Render a list of all Job assigned to an object. For example: - path('data-sources//jobs/', ObjectJobsView.as_view(), name='datasource_jobs', kwargs={'model': DataSource}), + path( + 'data-sources//jobs/', + ObjectJobsView.as_view(), + name='datasource_jobs', + kwargs={'model': DataSource} + ) Attributes: base_template: The name of the template to extend. If not provided, "{app}/{model}.html" will be used. diff --git a/netbox/tenancy/migrations/0001_squashed_0012.py b/netbox/tenancy/migrations/0001_squashed_0012.py index e8a028a92..8f3f74d9f 100644 --- a/netbox/tenancy/migrations/0001_squashed_0012.py +++ b/netbox/tenancy/migrations/0001_squashed_0012.py @@ -6,7 +6,6 @@ import taggit.managers class Migration(migrations.Migration): - initial = True dependencies = [ @@ -43,7 +42,16 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False)), ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), ('level', models.PositiveIntegerField(editable=False)), - ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='tenancy.tenantgroup')), + ( + 'parent', + mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='tenancy.tenantgroup', + ), + ), ], options={ 'ordering': ['name'], @@ -60,7 +68,16 @@ class Migration(migrations.Migration): ('slug', models.SlugField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tenants', to='tenancy.tenantgroup')), + ( + 'group', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='tenants', + to='tenancy.tenantgroup', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ diff --git a/netbox/tenancy/migrations/0002_squashed_0011.py b/netbox/tenancy/migrations/0002_squashed_0011.py index 8accd1da9..cfdcb58dd 100644 --- a/netbox/tenancy/migrations/0002_squashed_0011.py +++ b/netbox/tenancy/migrations/0002_squashed_0011.py @@ -7,7 +7,6 @@ import utilities.json class Migration(migrations.Migration): - replaces = [ ('tenancy', '0002_tenant_ordering'), ('tenancy', '0003_contacts'), @@ -18,7 +17,7 @@ class Migration(migrations.Migration): ('tenancy', '0008_unique_constraints'), ('tenancy', '0009_standardize_description_comments'), ('tenancy', '0010_tenant_relax_uniqueness'), - ('tenancy', '0011_contactassignment_tags') + ('tenancy', '0011_contactassignment_tags'), ] dependencies = [ @@ -37,7 +36,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), @@ -53,7 +55,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=100)), ('slug', models.SlugField(max_length=100)), @@ -62,7 +67,16 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False)), ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), ('level', models.PositiveIntegerField(editable=False)), - ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='tenancy.contactgroup')), + ( + 'parent', + mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='tenancy.contactgroup', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -75,7 +89,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=100)), ('title', models.CharField(blank=True, max_length=100)), @@ -83,7 +100,16 @@ class Migration(migrations.Migration): ('email', models.EmailField(blank=True, max_length=254)), ('address', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contacts', to='tenancy.contactgroup')), + ( + 'group', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='contacts', + to='tenancy.contactgroup', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ('link', models.URLField(blank=True)), ], @@ -125,9 +151,24 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('object_id', models.PositiveBigIntegerField()), ('priority', models.CharField(blank=True, max_length=50)), - ('contact', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='assignments', to='tenancy.contact')), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')), - ('role', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='assignments', to='tenancy.contactrole')), + ( + 'contact', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='assignments', to='tenancy.contact' + ), + ), + ( + 'content_type', + models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'), + ), + ( + 'role', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name='assignments', + to='tenancy.contactrole', + ), + ), ], options={ 'ordering': ('priority', 'contact'), @@ -140,11 +181,16 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='contactassignment', - constraint=models.UniqueConstraint(fields=('content_type', 'object_id', 'contact', 'role'), name='tenancy_contactassignment_unique_object_contact_role'), + constraint=models.UniqueConstraint( + fields=('content_type', 'object_id', 'contact', 'role'), + name='tenancy_contactassignment_unique_object_contact_role', + ), ), migrations.AddConstraint( model_name='contactgroup', - constraint=models.UniqueConstraint(fields=('parent', 'name'), name='tenancy_contactgroup_unique_parent_name'), + constraint=models.UniqueConstraint( + fields=('parent', 'name'), name='tenancy_contactgroup_unique_parent_name' + ), ), migrations.AddField( model_name='contact', @@ -163,19 +209,31 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='tenant', - constraint=models.UniqueConstraint(fields=('group', 'name'), name='tenancy_tenant_unique_group_name', violation_error_message='Tenant name must be unique per group.'), + constraint=models.UniqueConstraint( + fields=('group', 'name'), + name='tenancy_tenant_unique_group_name', + violation_error_message='Tenant name must be unique per group.', + ), ), migrations.AddConstraint( model_name='tenant', - constraint=models.UniqueConstraint(condition=models.Q(('group__isnull', True)), fields=('name',), name='tenancy_tenant_unique_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('group__isnull', True)), fields=('name',), name='tenancy_tenant_unique_name' + ), ), migrations.AddConstraint( model_name='tenant', - constraint=models.UniqueConstraint(fields=('group', 'slug'), name='tenancy_tenant_unique_group_slug', violation_error_message='Tenant slug must be unique per group.'), + constraint=models.UniqueConstraint( + fields=('group', 'slug'), + name='tenancy_tenant_unique_group_slug', + violation_error_message='Tenant slug must be unique per group.', + ), ), migrations.AddConstraint( model_name='tenant', - constraint=models.UniqueConstraint(condition=models.Q(('group__isnull', True)), fields=('slug',), name='tenancy_tenant_unique_slug'), + constraint=models.UniqueConstraint( + condition=models.Q(('group__isnull', True)), fields=('slug',), name='tenancy_tenant_unique_slug' + ), ), migrations.AddField( model_name='contactassignment', diff --git a/netbox/tenancy/migrations/0012_contactassignment_custom_fields.py b/netbox/tenancy/migrations/0012_contactassignment_custom_fields.py index ee6726822..7f681fd91 100644 --- a/netbox/tenancy/migrations/0012_contactassignment_custom_fields.py +++ b/netbox/tenancy/migrations/0012_contactassignment_custom_fields.py @@ -5,7 +5,6 @@ import utilities.json class Migration(migrations.Migration): - dependencies = [ ('tenancy', '0011_contactassignment_tags'), ] diff --git a/netbox/tenancy/migrations/0013_gfk_indexes.py b/netbox/tenancy/migrations/0013_gfk_indexes.py index dd23cefbb..9d58c8932 100644 --- a/netbox/tenancy/migrations/0013_gfk_indexes.py +++ b/netbox/tenancy/migrations/0013_gfk_indexes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('tenancy', '0012_contactassignment_custom_fields'), ] diff --git a/netbox/tenancy/migrations/0014_contactassignment_ordering.py b/netbox/tenancy/migrations/0014_contactassignment_ordering.py index 66f08aa2a..5e2c39311 100644 --- a/netbox/tenancy/migrations/0014_contactassignment_ordering.py +++ b/netbox/tenancy/migrations/0014_contactassignment_ordering.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('tenancy', '0013_gfk_indexes'), ] diff --git a/netbox/tenancy/migrations/0015_contactassignment_rename_content_type.py b/netbox/tenancy/migrations/0015_contactassignment_rename_content_type.py index 58b14e10f..f2c1ce190 100644 --- a/netbox/tenancy/migrations/0015_contactassignment_rename_content_type.py +++ b/netbox/tenancy/migrations/0015_contactassignment_rename_content_type.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('extras', '0111_rename_content_types'), @@ -25,16 +24,13 @@ class Migration(migrations.Migration): ), migrations.AddIndex( model_name='contactassignment', - index=models.Index( - fields=['object_type', 'object_id'], - name='tenancy_con_object__6f20f7_idx' - ), + index=models.Index(fields=['object_type', 'object_id'], name='tenancy_con_object__6f20f7_idx'), ), migrations.AddConstraint( model_name='contactassignment', constraint=models.UniqueConstraint( fields=('object_type', 'object_id', 'contact', 'role'), - name='tenancy_contactassignment_unique_object_contact_role' + name='tenancy_contactassignment_unique_object_contact_role', ), ), ] diff --git a/netbox/tenancy/migrations/0016_charfield_null_choices.py b/netbox/tenancy/migrations/0016_charfield_null_choices.py index 815a1bdf2..9f5016a13 100644 --- a/netbox/tenancy/migrations/0016_charfield_null_choices.py +++ b/netbox/tenancy/migrations/0016_charfield_null_choices.py @@ -11,7 +11,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('tenancy', '0015_contactassignment_rename_content_type'), ] @@ -22,8 +21,5 @@ class Migration(migrations.Migration): name='priority', field=models.CharField(blank=True, max_length=50, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/tenancy/migrations/0017_natural_ordering.py b/netbox/tenancy/migrations/0017_natural_ordering.py index de1fb49aa..beb98d634 100644 --- a/netbox/tenancy/migrations/0017_natural_ordering.py +++ b/netbox/tenancy/migrations/0017_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('tenancy', '0016_charfield_null_choices'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/tenancy/tables/columns.py b/netbox/tenancy/tables/columns.py index ec73cac4a..005bcf737 100644 --- a/netbox/tenancy/tables/columns.py +++ b/netbox/tenancy/tables/columns.py @@ -2,6 +2,7 @@ from django.utils.translation import gettext_lazy as _ import django_tables2 as tables from netbox.tables import columns +from .template_code import * __all__ = ( 'ContactsColumnMixin', @@ -15,15 +16,7 @@ class TenantColumn(tables.TemplateColumn): """ Include the tenant description. """ - template_code = """ - {% if record.tenant %} - {{ record.tenant }} - {% elif record.vrf.tenant %} - {{ record.vrf.tenant }}* - {% else %} - — - {% endif %} - """ + template_code = TENANT_COLUMN def __init__(self, *args, **kwargs): super().__init__(template_code=self.template_code, *args, **kwargs) @@ -36,15 +29,7 @@ class TenantGroupColumn(tables.TemplateColumn): """ Include the tenant group description. """ - template_code = """ - {% if record.tenant and record.tenant.group %} - {{ record.tenant.group }} - {% elif record.vrf.tenant and record.vrf.tenant.group %} - {{ record.vrf.tenant.group }}* - {% else %} - — - {% endif %} - """ + template_code = TENANT_GROUP_COLUMN def __init__(self, accessor=tables.A('tenant__group'), *args, **kwargs): if 'verbose_name' not in kwargs: diff --git a/netbox/tenancy/tables/template_code.py b/netbox/tenancy/tables/template_code.py new file mode 100644 index 000000000..1d15a8708 --- /dev/null +++ b/netbox/tenancy/tables/template_code.py @@ -0,0 +1,19 @@ +TENANT_COLUMN = """ +{% if record.tenant %} + {{ record.tenant }} +{% elif record.vrf.tenant %} + {{ record.vrf.tenant }}* +{% else %} + — +{% endif %} +""" + +TENANT_GROUP_COLUMN = """ +{% if record.tenant and record.tenant.group %} + {{ record.tenant.group }} +{% elif record.vrf.tenant and record.vrf.tenant.group %} + {{ record.vrf.tenant.group }}* +{% else %} + — +{% endif %} +""" diff --git a/netbox/tenancy/tests/test_api.py b/netbox/tenancy/tests/test_api.py index 5a6fe0453..c32ad3826 100644 --- a/netbox/tenancy/tests/test_api.py +++ b/netbox/tenancy/tests/test_api.py @@ -239,9 +239,24 @@ class ContactAssignmentTest(APIViewTestCases.APIViewTestCase): ContactRole.objects.bulk_create(contact_roles) contact_assignments = ( - ContactAssignment(object=sites[0], contact=contacts[0], role=contact_roles[0], priority=ContactPriorityChoices.PRIORITY_PRIMARY), - ContactAssignment(object=sites[0], contact=contacts[1], role=contact_roles[1], priority=ContactPriorityChoices.PRIORITY_SECONDARY), - ContactAssignment(object=sites[0], contact=contacts[2], role=contact_roles[2], priority=ContactPriorityChoices.PRIORITY_TERTIARY), + ContactAssignment( + object=sites[0], + contact=contacts[0], + role=contact_roles[0], + priority=ContactPriorityChoices.PRIORITY_PRIMARY, + ), + ContactAssignment( + object=sites[0], + contact=contacts[1], + role=contact_roles[1], + priority=ContactPriorityChoices.PRIORITY_SECONDARY, + ), + ContactAssignment( + object=sites[0], + contact=contacts[2], + role=contact_roles[2], + priority=ContactPriorityChoices.PRIORITY_TERTIARY, + ), ) ContactAssignment.objects.bulk_create(contact_assignments) diff --git a/netbox/users/migrations/0001_squashed_0011.py b/netbox/users/migrations/0001_squashed_0011.py index cad84201c..263604d34 100644 --- a/netbox/users/migrations/0001_squashed_0011.py +++ b/netbox/users/migrations/0001_squashed_0011.py @@ -8,7 +8,6 @@ import users.models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -39,15 +38,33 @@ class Migration(migrations.Migration): ('password', models.CharField(max_length=128)), ('last_login', models.DateTimeField(blank=True, null=True)), ('is_superuser', models.BooleanField(default=False)), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()])), + ( + 'username', + models.CharField( + error_messages={'unique': 'A user with that username already exists.'}, + max_length=150, + unique=True, + validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], + ), + ), ('first_name', models.CharField(blank=True, max_length=150)), ('last_name', models.CharField(blank=True, max_length=150)), ('email', models.EmailField(blank=True, max_length=254)), ('is_staff', models.BooleanField(default=False)), ('is_active', models.BooleanField(default=True)), ('date_joined', models.DateTimeField(default=django.utils.timezone.now)), - ('groups', models.ManyToManyField(blank=True, related_name='user_set', related_query_name='user', to='auth.group')), - ('user_permissions', models.ManyToManyField(blank=True, related_name='user_set', related_query_name='user', to='auth.permission')), + ( + 'groups', + models.ManyToManyField( + blank=True, related_name='user_set', related_query_name='user', to='auth.group' + ), + ), + ( + 'user_permissions', + models.ManyToManyField( + blank=True, related_name='user_set', related_query_name='user', to='auth.permission' + ), + ), ], options={ 'verbose_name': 'user', @@ -64,7 +81,12 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)), ('data', models.JSONField(default=dict)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='config', to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, related_name='config', to=settings.AUTH_USER_MODEL + ), + ), ], options={ 'verbose_name': 'User Preferences', @@ -78,10 +100,20 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True)), ('expires', models.DateTimeField(blank=True, null=True)), - ('key', models.CharField(max_length=40, unique=True, validators=[django.core.validators.MinLengthValidator(40)])), + ( + 'key', + models.CharField( + max_length=40, unique=True, validators=[django.core.validators.MinLengthValidator(40)] + ), + ), ('write_enabled', models.BooleanField(default=True)), ('description', models.CharField(blank=True, max_length=200)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tokens', to=settings.AUTH_USER_MODEL)), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='tokens', to=settings.AUTH_USER_MODEL + ), + ), ], ), migrations.CreateModel( @@ -91,11 +123,37 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=100)), ('description', models.CharField(blank=True, max_length=200)), ('enabled', models.BooleanField(default=True)), - ('actions', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=30), size=None)), + ( + 'actions', + django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=30), size=None), + ), ('constraints', models.JSONField(blank=True, null=True)), ('groups', models.ManyToManyField(blank=True, related_name='object_permissions', to='auth.Group')), - ('object_types', models.ManyToManyField(limit_choices_to=models.Q(models.Q(models.Q(('app_label__in', ['account', 'admin', 'auth', 'contenttypes', 'sessions', 'taggit', 'users']), _negated=True), models.Q(('app_label', 'auth'), ('model__in', ['group', 'user'])), models.Q(('app_label', 'users'), ('model__in', ['objectpermission', 'token'])), _connector='OR')), related_name='object_permissions', to='contenttypes.ContentType')), - ('users', models.ManyToManyField(blank=True, related_name='object_permissions', to=settings.AUTH_USER_MODEL)), + ( + 'object_types', + models.ManyToManyField( + limit_choices_to=models.Q( + models.Q( + models.Q( + ( + 'app_label__in', + ['account', 'admin', 'auth', 'contenttypes', 'sessions', 'taggit', 'users'], + ), + _negated=True, + ), + models.Q(('app_label', 'auth'), ('model__in', ['group', 'user'])), + models.Q(('app_label', 'users'), ('model__in', ['objectpermission', 'token'])), + _connector='OR', + ) + ), + related_name='object_permissions', + to='contenttypes.ContentType', + ), + ), + ( + 'users', + models.ManyToManyField(blank=True, related_name='object_permissions', to=settings.AUTH_USER_MODEL), + ), ], options={ 'verbose_name': 'permission', diff --git a/netbox/users/migrations/0002_squashed_0004.py b/netbox/users/migrations/0002_squashed_0004.py index 078721c48..275d7a7a9 100644 --- a/netbox/users/migrations/0002_squashed_0004.py +++ b/netbox/users/migrations/0002_squashed_0004.py @@ -5,11 +5,10 @@ import ipam.fields class Migration(migrations.Migration): - replaces = [ ('users', '0002_standardize_id_fields'), ('users', '0003_token_allowed_ips_last_used'), - ('users', '0004_netboxgroup_netboxuser') + ('users', '0004_netboxgroup_netboxuser'), ] dependencies = [ @@ -36,7 +35,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='token', name='allowed_ips', - field=django.contrib.postgres.fields.ArrayField(base_field=ipam.fields.IPNetworkField(), blank=True, null=True, size=None), + field=django.contrib.postgres.fields.ArrayField( + base_field=ipam.fields.IPNetworkField(), blank=True, null=True, size=None + ), ), migrations.AddField( model_name='token', @@ -45,8 +46,7 @@ class Migration(migrations.Migration): ), migrations.CreateModel( name='NetBoxGroup', - fields=[ - ], + fields=[], options={ 'verbose_name': 'Group', 'proxy': True, diff --git a/netbox/users/migrations/0005_alter_user_table.py b/netbox/users/migrations/0005_alter_user_table.py index 1163da0ae..2e9f699b3 100644 --- a/netbox/users/migrations/0005_alter_user_table.py +++ b/netbox/users/migrations/0005_alter_user_table.py @@ -19,7 +19,6 @@ def update_content_types(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('users', '0002_squashed_0004'), ('extras', '0113_customfield_rename_object_type'), @@ -33,24 +32,17 @@ class Migration(migrations.Migration): name='user', table=None, ), - # Convert the `id` column to a 64-bit integer (BigAutoField is implied by DEFAULT_AUTO_FIELD) - migrations.RunSQL("ALTER TABLE users_user ALTER COLUMN id TYPE bigint"), - + migrations.RunSQL('ALTER TABLE users_user ALTER COLUMN id TYPE bigint'), # Rename auth_user_* sequences - migrations.RunSQL("ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq"), - migrations.RunSQL("ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq"), - migrations.RunSQL("ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq"), - + migrations.RunSQL('ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq'), + migrations.RunSQL('ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq'), + migrations.RunSQL('ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq'), # Rename auth_user_* indexes - migrations.RunSQL("ALTER INDEX auth_user_pkey RENAME TO users_user_pkey"), + migrations.RunSQL('ALTER INDEX auth_user_pkey RENAME TO users_user_pkey'), # Hash is deterministic; generated via schema_editor._create_index_name() - migrations.RunSQL("ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like"), - migrations.RunSQL("ALTER INDEX auth_user_username_key RENAME TO users_user_username_key"), - + migrations.RunSQL('ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like'), + migrations.RunSQL('ALTER INDEX auth_user_username_key RENAME TO users_user_username_key'), # Update ContentTypes - migrations.RunPython( - code=update_content_types, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_content_types, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/users/migrations/0006_custom_group_model.py b/netbox/users/migrations/0006_custom_group_model.py index f958d242a..f70c1d58d 100644 --- a/netbox/users/migrations/0006_custom_group_model.py +++ b/netbox/users/migrations/0006_custom_group_model.py @@ -16,7 +16,6 @@ def update_custom_fields(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('users', '0005_alter_user_table'), ] @@ -29,7 +28,12 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=150, unique=True)), ('description', models.CharField(blank=True, max_length=200)), - ('permissions', models.ManyToManyField(blank=True, related_name='groups', related_query_name='group', to='auth.permission')), + ( + 'permissions', + models.ManyToManyField( + blank=True, related_name='groups', related_query_name='group', to='auth.permission' + ), + ), ], options={ 'ordering': ('name',), @@ -40,17 +44,10 @@ class Migration(migrations.Migration): ('objects', users.models.GroupManager()), ], ), - # Copy existing groups from the old table into the new one - migrations.RunSQL( - "INSERT INTO users_group (SELECT id, name, '' AS description FROM auth_group)" - ), - + migrations.RunSQL("INSERT INTO users_group (SELECT id, name, '' AS description FROM auth_group)"), # Update the sequence for group ID values - migrations.RunSQL( - "SELECT setval('users_group_id_seq', (SELECT MAX(id) FROM users_group))" - ), - + migrations.RunSQL("SELECT setval('users_group_id_seq', (SELECT MAX(id) FROM users_group))"), # Update the "groups" M2M fields on User & ObjectPermission migrations.AlterField( model_name='user', @@ -62,23 +59,12 @@ class Migration(migrations.Migration): name='groups', field=models.ManyToManyField(blank=True, related_name='object_permissions', to='users.group'), ), - # Delete any lingering group assignments for legacy permissions (from before NetBox v2.9) - migrations.RunSQL( - "DELETE from auth_group_permissions" - ), - + migrations.RunSQL('DELETE from auth_group_permissions'), # Delete groups from the old table - migrations.RunSQL( - "DELETE from auth_group" - ), - + migrations.RunSQL('DELETE from auth_group'), # Update custom fields - migrations.RunPython( - code=update_custom_fields, - reverse_code=migrations.RunPython.noop - ), - + migrations.RunPython(code=update_custom_fields, reverse_code=migrations.RunPython.noop), # Delete the proxy model migrations.DeleteModel( name='NetBoxGroup', diff --git a/netbox/users/migrations/0007_objectpermission_update_object_types.py b/netbox/users/migrations/0007_objectpermission_update_object_types.py index d3018a602..598b00b92 100644 --- a/netbox/users/migrations/0007_objectpermission_update_object_types.py +++ b/netbox/users/migrations/0007_objectpermission_update_object_types.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('core', '0010_gfk_indexes'), ('users', '0006_custom_group_model'), @@ -14,6 +13,23 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='objectpermission', name='object_types', - field=models.ManyToManyField(limit_choices_to=models.Q(models.Q(models.Q(('app_label__in', ['account', 'admin', 'auth', 'contenttypes', 'sessions', 'taggit', 'users']), _negated=True), models.Q(('app_label', 'auth'), ('model__in', ['group', 'user'])), models.Q(('app_label', 'users'), ('model__in', ['objectpermission', 'token'])), _connector='OR')), related_name='object_permissions', to='core.objecttype'), + field=models.ManyToManyField( + limit_choices_to=models.Q( + models.Q( + models.Q( + ( + 'app_label__in', + ['account', 'admin', 'auth', 'contenttypes', 'sessions', 'taggit', 'users'], + ), + _negated=True, + ), + models.Q(('app_label', 'auth'), ('model__in', ['group', 'user'])), + models.Q(('app_label', 'users'), ('model__in', ['objectpermission', 'token'])), + _connector='OR', + ) + ), + related_name='object_permissions', + to='core.objecttype', + ), ), ] diff --git a/netbox/users/migrations/0008_flip_objectpermission_assignments.py b/netbox/users/migrations/0008_flip_objectpermission_assignments.py index c61c8b124..11dea5819 100644 --- a/netbox/users/migrations/0008_flip_objectpermission_assignments.py +++ b/netbox/users/migrations/0008_flip_objectpermission_assignments.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('users', '0007_objectpermission_update_object_types'), ] @@ -24,52 +23,47 @@ class Migration(migrations.Migration): database_operations=[ # Rename table migrations.RunSQL( - "ALTER TABLE users_objectpermission_groups" - " RENAME TO users_group_object_permissions" + 'ALTER TABLE users_objectpermission_groups' ' RENAME TO users_group_object_permissions' ), migrations.RunSQL( - "ALTER TABLE users_objectpermission_groups_id_seq" - " RENAME TO users_group_object_permissions_id_seq" + 'ALTER TABLE users_objectpermission_groups_id_seq' + ' RENAME TO users_group_object_permissions_id_seq' ), - # Rename constraints migrations.RunSQL( - "ALTER TABLE users_group_object_permissions RENAME CONSTRAINT " - "users_objectpermissi_group_id_fb7ba6e0_fk_users_gro TO " - "users_group_object_p_group_id_90dd183a_fk_users_gro" + 'ALTER TABLE users_group_object_permissions RENAME CONSTRAINT ' + 'users_objectpermissi_group_id_fb7ba6e0_fk_users_gro TO ' + 'users_group_object_p_group_id_90dd183a_fk_users_gro' ), # Fix for #15698: Drop & recreate constraint which may not exist migrations.RunSQL( - "ALTER TABLE users_group_object_permissions DROP CONSTRAINT IF EXISTS " - "users_objectpermissi_objectpermission_id_2f7cc117_fk_users_obj" + 'ALTER TABLE users_group_object_permissions DROP CONSTRAINT IF EXISTS ' + 'users_objectpermissi_objectpermission_id_2f7cc117_fk_users_obj' ), migrations.RunSQL( - "ALTER TABLE users_group_object_permissions ADD CONSTRAINT " - "users_group_object_p_objectpermission_id_dd489dc4_fk_users_obj " - "FOREIGN KEY (objectpermission_id) REFERENCES users_objectpermission(id) " - "DEFERRABLE INITIALLY DEFERRED" + 'ALTER TABLE users_group_object_permissions ADD CONSTRAINT ' + 'users_group_object_p_objectpermission_id_dd489dc4_fk_users_obj ' + 'FOREIGN KEY (objectpermission_id) REFERENCES users_objectpermission(id) ' + 'DEFERRABLE INITIALLY DEFERRED' ), - # Rename indexes migrations.RunSQL( - "ALTER INDEX users_objectpermission_groups_pkey " - " RENAME TO users_group_object_permissions_pkey" + 'ALTER INDEX users_objectpermission_groups_pkey ' ' RENAME TO users_group_object_permissions_pkey' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_g_objectpermission_id_grou_3b62a39c_uniq " - " RENAME TO users_group_object_permi_group_id_objectpermissio_db1f8cbe_uniq" + 'ALTER INDEX users_objectpermission_g_objectpermission_id_grou_3b62a39c_uniq ' + ' RENAME TO users_group_object_permi_group_id_objectpermissio_db1f8cbe_uniq' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_groups_group_id_fb7ba6e0" - " RENAME TO users_group_object_permissions_group_id_90dd183a" + 'ALTER INDEX users_objectpermission_groups_group_id_fb7ba6e0' + ' RENAME TO users_group_object_permissions_group_id_90dd183a' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_groups_objectpermission_id_2f7cc117" - " RENAME TO users_group_object_permissions_objectpermission_id_dd489dc4" + 'ALTER INDEX users_objectpermission_groups_objectpermission_id_2f7cc117' + ' RENAME TO users_group_object_permissions_objectpermission_id_dd489dc4' ), - ] + ], ), - # Flip M2M assignments for ObjectPermission to Users migrations.SeparateDatabaseAndState( state_operations=[ @@ -86,49 +80,44 @@ class Migration(migrations.Migration): database_operations=[ # Rename table migrations.RunSQL( - "ALTER TABLE users_objectpermission_users" - " RENAME TO users_user_object_permissions" + 'ALTER TABLE users_objectpermission_users' ' RENAME TO users_user_object_permissions' ), migrations.RunSQL( - "ALTER TABLE users_objectpermission_users_id_seq" - " RENAME TO users_user_object_permissions_id_seq" + 'ALTER TABLE users_objectpermission_users_id_seq' ' RENAME TO users_user_object_permissions_id_seq' ), - # Rename constraints migrations.RunSQL( - "ALTER TABLE users_user_object_permissions RENAME CONSTRAINT " - "users_objectpermission_users_user_id_16c0905d_fk_auth_user_id TO " - "users_user_object_permissions_user_id_9d647aac_fk_users_user_id" + 'ALTER TABLE users_user_object_permissions RENAME CONSTRAINT ' + 'users_objectpermission_users_user_id_16c0905d_fk_auth_user_id TO ' + 'users_user_object_permissions_user_id_9d647aac_fk_users_user_id' ), # Fix for #15698: Drop & recreate constraint which may not exist migrations.RunSQL( - "ALTER TABLE users_user_object_permissions DROP CONSTRAINT IF EXISTS " - "users_objectpermissi_objectpermission_id_78a9c2e6_fk_users_obj" + 'ALTER TABLE users_user_object_permissions DROP CONSTRAINT IF EXISTS ' + 'users_objectpermissi_objectpermission_id_78a9c2e6_fk_users_obj' ), migrations.RunSQL( - "ALTER TABLE users_user_object_permissions ADD CONSTRAINT " - "users_user_object_pe_objectpermission_id_29b431b4_fk_users_obj " - "FOREIGN KEY (objectpermission_id) REFERENCES users_objectpermission(id) " - "DEFERRABLE INITIALLY DEFERRED" + 'ALTER TABLE users_user_object_permissions ADD CONSTRAINT ' + 'users_user_object_pe_objectpermission_id_29b431b4_fk_users_obj ' + 'FOREIGN KEY (objectpermission_id) REFERENCES users_objectpermission(id) ' + 'DEFERRABLE INITIALLY DEFERRED' ), - # Rename indexes migrations.RunSQL( - "ALTER INDEX users_objectpermission_users_pkey " - " RENAME TO users_user_object_permissions_pkey" + 'ALTER INDEX users_objectpermission_users_pkey ' ' RENAME TO users_user_object_permissions_pkey' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_u_objectpermission_id_user_3a7db108_uniq " - " RENAME TO users_user_object_permis_user_id_objectpermission_0a98550e_uniq" + 'ALTER INDEX users_objectpermission_u_objectpermission_id_user_3a7db108_uniq ' + ' RENAME TO users_user_object_permis_user_id_objectpermission_0a98550e_uniq' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_users_user_id_16c0905d" - " RENAME TO users_user_object_permissions_user_id_9d647aac" + 'ALTER INDEX users_objectpermission_users_user_id_16c0905d' + ' RENAME TO users_user_object_permissions_user_id_9d647aac' ), migrations.RunSQL( - "ALTER INDEX users_objectpermission_users_objectpermission_id_78a9c2e6" - " RENAME TO users_user_object_permissions_objectpermission_id_29b431b4" + 'ALTER INDEX users_objectpermission_users_objectpermission_id_78a9c2e6' + ' RENAME TO users_user_object_permissions_objectpermission_id_29b431b4' ), - ] + ], ), ] diff --git a/netbox/users/migrations/0009_update_group_perms.py b/netbox/users/migrations/0009_update_group_perms.py index f3b197492..7698fd1e7 100644 --- a/netbox/users/migrations/0009_update_group_perms.py +++ b/netbox/users/migrations/0009_update_group_perms.py @@ -18,17 +18,13 @@ def update_content_types(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('users', '0008_flip_objectpermission_assignments'), ] operations = [ # Update ContentTypes - migrations.RunPython( - code=update_content_types, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=update_content_types, reverse_code=migrations.RunPython.noop), migrations.AlterField( model_name='objectpermission', name='object_types', diff --git a/netbox/users/tests/test_filtersets.py b/netbox/users/tests/test_filtersets.py index fdf25d970..8b683b346 100644 --- a/netbox/users/tests/test_filtersets.py +++ b/netbox/users/tests/test_filtersets.py @@ -286,9 +286,15 @@ class TokenTestCase(TestCase, BaseFilterSetTests): future_date = make_aware(datetime.datetime(3000, 1, 1)) past_date = make_aware(datetime.datetime(2000, 1, 1)) tokens = ( - Token(user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1'), - Token(user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2'), - Token(user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False), + Token( + user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1' + ), + Token( + user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2' + ), + Token( + user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False + ), ) Token.objects.bulk_create(tokens) diff --git a/netbox/users/tests/test_views.py b/netbox/users/tests/test_views.py index 8386364dd..8226a8be9 100644 --- a/netbox/users/tests/test_views.py +++ b/netbox/users/tests/test_views.py @@ -23,11 +23,16 @@ class UserTestCase( @classmethod def setUpTestData(cls): - users = ( - User(username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx'), - User(username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx'), - User(username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx'), + User( + username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx' + ), + User( + username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx' + ), + User( + username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx' + ), ) User.objects.bulk_create(users) diff --git a/netbox/utilities/socks.py b/netbox/utilities/socks.py index bb0b6b250..6b62e8fc7 100644 --- a/netbox/utilities/socks.py +++ b/netbox/utilities/socks.py @@ -26,7 +26,10 @@ class ProxyHTTPConnection(HTTPConnection): try: from python_socks.sync import Proxy except ModuleNotFoundError as e: - logger.info("Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been installed.") + logger.info( + "Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been " + "installed." + ) raise e proxy = Proxy.from_url(self._proxy_url, rdns=self.use_rdns) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 0471b1cfd..12e38a27f 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -443,7 +443,10 @@ class APIViewTestCases: # Compile list of fields to include fields_string = '' - file_fields = (strawberry_django.fields.types.DjangoFileType, strawberry_django.fields.types.DjangoImageType) + file_fields = ( + strawberry_django.fields.types.DjangoFileType, + strawberry_django.fields.types.DjangoImageType, + ) for field in type_class.__strawberry_definition__.fields: if ( field.type in file_fields or ( diff --git a/netbox/utilities/tests/test_filters.py b/netbox/utilities/tests/test_filters.py index 031f31a12..6956396d2 100644 --- a/netbox/utilities/tests/test_filters.py +++ b/netbox/utilities/tests/test_filters.py @@ -427,9 +427,46 @@ class DynamicFilterLookupExpressionTest(TestCase): Rack.objects.bulk_create(racks) devices = ( - Device(name='Device 1', device_type=device_types[0], role=roles[0], platform=platforms[0], serial='ABC', asset_tag='1001', site=sites[0], rack=racks[0], position=1, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_ACTIVE, local_context_data={"foo": 123}), - Device(name='Device 2', device_type=device_types[1], role=roles[1], platform=platforms[1], serial='DEF', asset_tag='1002', site=sites[1], rack=racks[1], position=2, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_STAGED), - Device(name='Device 3', device_type=device_types[2], role=roles[2], platform=platforms[2], serial='GHI', asset_tag='1003', site=sites[2], rack=racks[2], position=3, face=DeviceFaceChoices.FACE_REAR, status=DeviceStatusChoices.STATUS_FAILED), + Device( + name='Device 1', + device_type=device_types[0], + role=roles[0], + platform=platforms[0], + serial='ABC', + asset_tag='1001', + site=sites[0], + rack=racks[0], + position=1, + face=DeviceFaceChoices.FACE_FRONT, + status=DeviceStatusChoices.STATUS_ACTIVE, + local_context_data={'foo': 123}, + ), + Device( + name='Device 2', + device_type=device_types[1], + role=roles[1], + platform=platforms[1], + serial='DEF', + asset_tag='1002', + site=sites[1], + rack=racks[1], + position=2, + face=DeviceFaceChoices.FACE_FRONT, + status=DeviceStatusChoices.STATUS_STAGED, + ), + Device( + name='Device 3', + device_type=device_types[2], + role=roles[2], + platform=platforms[2], + serial='GHI', + asset_tag='1003', + site=sites[2], + rack=racks[2], + position=3, + face=DeviceFaceChoices.FACE_REAR, + status=DeviceStatusChoices.STATUS_FAILED, + ), ) Device.objects.bulk_create(devices) diff --git a/netbox/virtualization/api/serializers_/clusters.py b/netbox/virtualization/api/serializers_/clusters.py index 450924fef..ff64db1cf 100644 --- a/netbox/virtualization/api/serializers_/clusters.py +++ b/netbox/virtualization/api/serializers_/clusters.py @@ -75,9 +75,9 @@ class ClusterSerializer(NetBoxModelSerializer): class Meta: model = Cluster fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'scope_id', 'scope', - 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', - 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk' + 'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', + 'scope_id', 'scope', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'device_count', 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk' ] brief_fields = ('id', 'url', 'display', 'name', 'description', 'virtualmachine_count') diff --git a/netbox/virtualization/api/serializers_/virtualmachines.py b/netbox/virtualization/api/serializers_/virtualmachines.py index dfc205b7c..05fa2e427 100644 --- a/netbox/virtualization/api/serializers_/virtualmachines.py +++ b/netbox/virtualization/api/serializers_/virtualmachines.py @@ -49,8 +49,8 @@ class VirtualMachineSerializer(NetBoxModelSerializer): class Meta: model = VirtualMachine fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant', - 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', + 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', + 'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'created', 'last_updated', 'interface_count', 'virtual_disk_count', ] @@ -62,8 +62,8 @@ class VirtualMachineWithConfigContextSerializer(VirtualMachineSerializer): class Meta(VirtualMachineSerializer.Meta): fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant', - 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', + 'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', + 'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description', 'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'config_context', 'created', 'last_updated', 'interface_count', 'virtual_disk_count', ] diff --git a/netbox/virtualization/forms/bulk_import.py b/netbox/virtualization/forms/bulk_import.py index 027f3b309..6b5b62d11 100644 --- a/netbox/virtualization/forms/bulk_import.py +++ b/netbox/virtualization/forms/bulk_import.py @@ -73,7 +73,9 @@ class ClusterImportForm(ScopedImportForm, NetBoxModelImportForm): class Meta: model = Cluster - fields = ('name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags') + fields = ( + 'name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags', + ) labels = { 'scope_id': _('Scope ID'), } diff --git a/netbox/virtualization/migrations/0001_squashed_0022.py b/netbox/virtualization/migrations/0001_squashed_0022.py index 2a7894737..c7aa35ec7 100644 --- a/netbox/virtualization/migrations/0001_squashed_0022.py +++ b/netbox/virtualization/migrations/0001_squashed_0022.py @@ -10,7 +10,6 @@ import utilities.query_functions class Migration(migrations.Migration): - initial = True dependencies = [ @@ -100,17 +99,79 @@ class Migration(migrations.Migration): ('local_context_data', models.JSONField(blank=True, null=True)), ('name', models.CharField(max_length=64)), ('status', models.CharField(default='active', max_length=50)), - ('vcpus', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, validators=[django.core.validators.MinValueValidator(0.01)])), + ( + 'vcpus', + models.DecimalField( + blank=True, + decimal_places=2, + max_digits=6, + null=True, + validators=[django.core.validators.MinValueValidator(0.01)], + ), + ), ('memory', models.PositiveIntegerField(blank=True, null=True)), ('disk', models.PositiveIntegerField(blank=True, null=True)), ('comments', models.TextField(blank=True)), - ('cluster', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='virtualization.cluster')), - ('platform', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='virtual_machines', to='dcim.platform')), - ('primary_ip4', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress')), - ('primary_ip6', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='ipam.ipaddress')), - ('role', models.ForeignKey(blank=True, limit_choices_to={'vm_role': True}, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='dcim.devicerole')), + ( + 'cluster', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='virtualization.cluster', + ), + ), + ( + 'platform', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='virtual_machines', + to='dcim.platform', + ), + ), + ( + 'primary_ip4', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), + ), + ( + 'primary_ip6', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to='ipam.ipaddress', + ), + ), + ( + 'role', + models.ForeignKey( + blank=True, + limit_choices_to={'vm_role': True}, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='dcim.devicerole', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='tenancy.tenant', + ), + ), ], options={ 'ordering': ('name', 'pk'), @@ -120,12 +181,24 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cluster', name='group', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='clusters', to='virtualization.clustergroup'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='clusters', + to='virtualization.clustergroup', + ), ), migrations.AddField( model_name='cluster', name='site', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='clusters', to='dcim.site'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='clusters', + to='dcim.site', + ), ), migrations.AddField( model_name='cluster', @@ -135,12 +208,20 @@ class Migration(migrations.Migration): migrations.AddField( model_name='cluster', name='tenant', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='clusters', to='tenancy.tenant'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='clusters', + to='tenancy.tenant', + ), ), migrations.AddField( model_name='cluster', name='type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='clusters', to='virtualization.clustertype'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='clusters', to='virtualization.clustertype' + ), ), migrations.CreateModel( name='VMInterface', @@ -151,16 +232,59 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(primary_key=True, serialize=False)), ('enabled', models.BooleanField(default=True)), ('mac_address', dcim.fields.MACAddressField(blank=True, null=True)), - ('mtu', models.PositiveIntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65536)])), + ( + 'mtu', + models.PositiveIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(65536), + ], + ), + ), ('mode', models.CharField(blank=True, max_length=50)), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface + ), + ), ('description', models.CharField(blank=True, max_length=200)), - ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='child_interfaces', to='virtualization.vminterface')), - ('tagged_vlans', models.ManyToManyField(blank=True, related_name='vminterfaces_as_tagged', to='ipam.VLAN')), + ( + 'parent', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='child_interfaces', + to='virtualization.vminterface', + ), + ), + ( + 'tagged_vlans', + models.ManyToManyField(blank=True, related_name='vminterfaces_as_tagged', to='ipam.VLAN'), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('untagged_vlan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vminterfaces_as_untagged', to='ipam.vlan')), - ('virtual_machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interfaces', to='virtualization.virtualmachine')), + ( + 'untagged_vlan', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='vminterfaces_as_untagged', + to='ipam.vlan', + ), + ), + ( + 'virtual_machine', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='interfaces', + to='virtualization.virtualmachine', + ), + ), ], options={ 'verbose_name': 'interface', diff --git a/netbox/virtualization/migrations/0023_squashed_0036.py b/netbox/virtualization/migrations/0023_squashed_0036.py index bbfb62b39..0665aaab6 100644 --- a/netbox/virtualization/migrations/0023_squashed_0036.py +++ b/netbox/virtualization/migrations/0023_squashed_0036.py @@ -7,7 +7,6 @@ import utilities.ordering class Migration(migrations.Migration): - replaces = [ ('virtualization', '0023_virtualmachine_natural_ordering'), ('virtualization', '0024_cluster_relax_uniqueness'), @@ -22,7 +21,7 @@ class Migration(migrations.Migration): ('virtualization', '0033_unique_constraints'), ('virtualization', '0034_standardize_description_comments'), ('virtualization', '0035_virtualmachine_interface_count'), - ('virtualization', '0036_virtualmachine_config_template') + ('virtualization', '0036_virtualmachine_config_template'), ] dependencies = [ @@ -40,7 +39,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='virtualmachine', name='_name', - field=utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize), + field=utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize + ), ), migrations.AlterField( model_name='cluster', @@ -64,7 +65,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vminterface', name='bridge', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bridge_interfaces', to='virtualization.vminterface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='bridge_interfaces', + to='virtualization.vminterface', + ), ), migrations.AlterField( model_name='cluster', @@ -94,7 +101,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vminterface', name='vrf', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vminterfaces', to='ipam.vrf'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='vminterfaces', + to='ipam.vrf', + ), ), migrations.AlterField( model_name='cluster', @@ -129,17 +142,35 @@ class Migration(migrations.Migration): migrations.AddField( model_name='virtualmachine', name='site', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='dcim.site'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='dcim.site', + ), ), migrations.AddField( model_name='virtualmachine', name='device', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='dcim.device'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='dcim.device', + ), ), migrations.AlterField( model_name='virtualmachine', name='cluster', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='virtual_machines', to='virtualization.cluster'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='virtual_machines', + to='virtualization.cluster', + ), ), migrations.AlterUniqueTogether( name='cluster', @@ -155,7 +186,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='cluster', - constraint=models.UniqueConstraint(fields=('group', 'name'), name='virtualization_cluster_unique_group_name'), + constraint=models.UniqueConstraint( + fields=('group', 'name'), name='virtualization_cluster_unique_group_name' + ), ), migrations.AddConstraint( model_name='cluster', @@ -163,15 +196,28 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='virtualmachine', - constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), models.F('cluster'), models.F('tenant'), name='virtualization_virtualmachine_unique_name_cluster_tenant'), + constraint=models.UniqueConstraint( + django.db.models.functions.text.Lower('name'), + models.F('cluster'), + models.F('tenant'), + name='virtualization_virtualmachine_unique_name_cluster_tenant', + ), ), migrations.AddConstraint( model_name='virtualmachine', - constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), models.F('cluster'), condition=models.Q(('tenant__isnull', True)), name='virtualization_virtualmachine_unique_name_cluster', violation_error_message='Virtual machine name must be unique per cluster.'), + constraint=models.UniqueConstraint( + django.db.models.functions.text.Lower('name'), + models.F('cluster'), + condition=models.Q(('tenant__isnull', True)), + name='virtualization_virtualmachine_unique_name_cluster', + violation_error_message='Virtual machine name must be unique per cluster.', + ), ), migrations.AddConstraint( model_name='vminterface', - constraint=models.UniqueConstraint(fields=('virtual_machine', 'name'), name='virtualization_vminterface_unique_virtual_machine_name'), + constraint=models.UniqueConstraint( + fields=('virtual_machine', 'name'), name='virtualization_vminterface_unique_virtual_machine_name' + ), ), migrations.AddField( model_name='cluster', @@ -186,11 +232,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='virtualmachine', name='interface_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='virtual_machine', to_model='virtualization.VMInterface'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='virtual_machine', to_model='virtualization.VMInterface' + ), ), migrations.AddField( model_name='virtualmachine', name='config_template', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='%(class)ss', to='extras.configtemplate'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='%(class)ss', + to='extras.configtemplate', + ), ), ] diff --git a/netbox/virtualization/migrations/0037_protect_child_interfaces.py b/netbox/virtualization/migrations/0037_protect_child_interfaces.py index ab6cf0cb3..a9d2075c1 100644 --- a/netbox/virtualization/migrations/0037_protect_child_interfaces.py +++ b/netbox/virtualization/migrations/0037_protect_child_interfaces.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0036_virtualmachine_config_template'), ] @@ -14,6 +13,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='vminterface', name='parent', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.RESTRICT, related_name='child_interfaces', to='virtualization.vminterface'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.RESTRICT, + related_name='child_interfaces', + to='virtualization.vminterface', + ), ), ] diff --git a/netbox/virtualization/migrations/0038_virtualdisk.py b/netbox/virtualization/migrations/0038_virtualdisk.py index 59d45c975..2f7824121 100644 --- a/netbox/virtualization/migrations/0038_virtualdisk.py +++ b/netbox/virtualization/migrations/0038_virtualdisk.py @@ -9,7 +9,6 @@ import utilities.tracking class Migration(migrations.Migration): - dependencies = [ ('extras', '0099_cachedvalue_ordering'), ('virtualization', '0037_protect_child_interfaces'), @@ -19,7 +18,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='virtualmachine', name='virtual_disk_count', - field=utilities.fields.CounterCacheField(default=0, editable=False, to_field='virtual_machine', to_model='virtualization.VirtualDisk'), + field=utilities.fields.CounterCacheField( + default=0, editable=False, to_field='virtual_machine', to_model='virtualization.VirtualDisk' + ), ), migrations.CreateModel( name='VirtualDisk', @@ -27,13 +28,28 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('name', models.CharField(max_length=64)), - ('_name', utilities.fields.NaturalOrderingField('name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface)), + ( + '_name', + utilities.fields.NaturalOrderingField( + 'name', blank=True, max_length=100, naturalize_function=utilities.ordering.naturalize_interface + ), + ), ('description', models.CharField(blank=True, max_length=200)), ('size', models.PositiveIntegerField()), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('virtual_machine', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(class)ss', to='virtualization.virtualmachine')), + ( + 'virtual_machine', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='%(class)ss', + to='virtualization.virtualmachine', + ), + ), ], options={ 'verbose_name': 'virtual disk', @@ -45,6 +61,8 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='virtualdisk', - constraint=models.UniqueConstraint(fields=('virtual_machine', 'name'), name='virtualization_virtualdisk_unique_virtual_machine_name'), + constraint=models.UniqueConstraint( + fields=('virtual_machine', 'name'), name='virtualization_virtualdisk_unique_virtual_machine_name' + ), ), ] diff --git a/netbox/virtualization/migrations/0039_virtualmachine_serial_number.py b/netbox/virtualization/migrations/0039_virtualmachine_serial_number.py index 15b58fa22..758c21edc 100644 --- a/netbox/virtualization/migrations/0039_virtualmachine_serial_number.py +++ b/netbox/virtualization/migrations/0039_virtualmachine_serial_number.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0038_virtualdisk'), ] diff --git a/netbox/virtualization/migrations/0040_convert_disk_size.py b/netbox/virtualization/migrations/0040_convert_disk_size.py index 6471a0908..4b0aec7bd 100644 --- a/netbox/virtualization/migrations/0040_convert_disk_size.py +++ b/netbox/virtualization/migrations/0040_convert_disk_size.py @@ -18,14 +18,10 @@ def convert_disk_size(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0039_virtualmachine_serial_number'), ] operations = [ - migrations.RunPython( - code=convert_disk_size, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=convert_disk_size, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/virtualization/migrations/0041_charfield_null_choices.py b/netbox/virtualization/migrations/0041_charfield_null_choices.py index 88b7f9b2c..22eb9955a 100644 --- a/netbox/virtualization/migrations/0041_charfield_null_choices.py +++ b/netbox/virtualization/migrations/0041_charfield_null_choices.py @@ -11,7 +11,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0040_convert_disk_size'), ] @@ -22,8 +21,5 @@ class Migration(migrations.Migration): name='mode', field=models.CharField(blank=True, max_length=50, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py index 3a6d5e481..ad93a751f 100644 --- a/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py +++ b/netbox/virtualization/migrations/0042_vminterface_vlan_translation_policy.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('ipam', '0074_vlantranslationpolicy_vlantranslationrule'), ('virtualization', '0041_charfield_null_choices'), @@ -13,6 +12,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vminterface', name='vlan_translation_policy', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlantranslationpolicy'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlantranslationpolicy' + ), ), ] diff --git a/netbox/virtualization/migrations/0043_qinq_svlan.py b/netbox/virtualization/migrations/0043_qinq_svlan.py index 422289fb7..b407facce 100644 --- a/netbox/virtualization/migrations/0043_qinq_svlan.py +++ b/netbox/virtualization/migrations/0043_qinq_svlan.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('ipam', '0075_vlan_qinq'), ('virtualization', '0042_vminterface_vlan_translation_policy'), @@ -13,7 +12,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vminterface', name='qinq_svlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_svlan', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='%(class)ss_svlan', + to='ipam.vlan', + ), ), migrations.AlterField( model_name='vminterface', @@ -23,6 +28,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='vminterface', name='untagged_vlan', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)ss_as_untagged', to='ipam.vlan'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='%(class)ss_as_untagged', + to='ipam.vlan', + ), ), ] diff --git a/netbox/virtualization/migrations/0044_cluster_scope.py b/netbox/virtualization/migrations/0044_cluster_scope.py index b7af25f8b..521db1877 100644 --- a/netbox/virtualization/migrations/0044_cluster_scope.py +++ b/netbox/virtualization/migrations/0044_cluster_scope.py @@ -11,13 +11,11 @@ def copy_site_assignments(apps, schema_editor): Site = apps.get_model('dcim', 'Site') Cluster.objects.filter(site__isnull=False).update( - scope_type=ContentType.objects.get_for_model(Site), - scope_id=models.F('site_id') + scope_type=ContentType.objects.get_for_model(Site), scope_id=models.F('site_id') ) class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('virtualization', '0043_qinq_svlan'), @@ -41,11 +39,6 @@ class Migration(migrations.Migration): to='contenttypes.contenttype', ), ), - # Copy over existing site assignments - migrations.RunPython( - code=copy_site_assignments, - reverse_code=migrations.RunPython.noop - ), - + migrations.RunPython(code=copy_site_assignments, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/virtualization/migrations/0045_clusters_cached_relations.py b/netbox/virtualization/migrations/0045_clusters_cached_relations.py index ff851aa7c..6d0c8ff33 100644 --- a/netbox/virtualization/migrations/0045_clusters_cached_relations.py +++ b/netbox/virtualization/migrations/0045_clusters_cached_relations.py @@ -19,7 +19,6 @@ def populate_denormalized_fields(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0044_cluster_scope'), ] @@ -69,13 +68,8 @@ class Migration(migrations.Migration): to='dcim.sitegroup', ), ), - # Populate denormalized FK values - migrations.RunPython( - code=populate_denormalized_fields, - reverse_code=migrations.RunPython.noop - ), - + migrations.RunPython(code=populate_denormalized_fields, reverse_code=migrations.RunPython.noop), migrations.RemoveConstraint( model_name='cluster', name='virtualization_cluster_unique_site_name', diff --git a/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py b/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py index 7b1168da0..75c806382 100644 --- a/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py +++ b/netbox/virtualization/migrations/0046_alter_cluster__location_alter_cluster__region_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0196_qinq_svlan'), ('virtualization', '0045_clusters_cached_relations'), diff --git a/netbox/virtualization/migrations/0047_natural_ordering.py b/netbox/virtualization/migrations/0047_natural_ordering.py index 4454cfe2d..4ce5b8370 100644 --- a/netbox/virtualization/migrations/0047_natural_ordering.py +++ b/netbox/virtualization/migrations/0047_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('virtualization', '0046_alter_cluster__location_alter_cluster__region_and_more'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/virtualization/migrations/0048_populate_mac_addresses.py b/netbox/virtualization/migrations/0048_populate_mac_addresses.py index 328d6438a..a4be1e2be 100644 --- a/netbox/virtualization/migrations/0048_populate_mac_addresses.py +++ b/netbox/virtualization/migrations/0048_populate_mac_addresses.py @@ -10,9 +10,7 @@ def populate_mac_addresses(apps, schema_editor): mac_addresses = [ MACAddress( - mac_address=vminterface.mac_address, - assigned_object_type=vminterface_ct, - assigned_object_id=vminterface.pk + mac_address=vminterface.mac_address, assigned_object_type=vminterface_ct, assigned_object_id=vminterface.pk ) for vminterface in VMInterface.objects.filter(mac_address__isnull=False) ] @@ -24,7 +22,6 @@ def populate_mac_addresses(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('dcim', '0199_macaddress'), ('virtualization', '0047_natural_ordering'), @@ -39,13 +36,10 @@ class Migration(migrations.Migration): null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', - to='dcim.macaddress' + to='dcim.macaddress', ), ), - migrations.RunPython( - code=populate_mac_addresses, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=populate_mac_addresses, reverse_code=migrations.RunPython.noop), migrations.RemoveField( model_name='vminterface', name='mac_address', diff --git a/netbox/virtualization/tables/clusters.py b/netbox/virtualization/tables/clusters.py index 91807e35b..d07bb4519 100644 --- a/netbox/virtualization/tables/clusters.py +++ b/netbox/virtualization/tables/clusters.py @@ -100,7 +100,7 @@ class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): class Meta(NetBoxTable.Meta): model = Cluster fields = ( - 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', 'description', - 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', + 'description', 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'type', 'group', 'status', 'tenant', 'site', 'device_count', 'vm_count') diff --git a/netbox/virtualization/tables/template_code.py b/netbox/virtualization/tables/template_code.py new file mode 100644 index 000000000..a6b7251f2 --- /dev/null +++ b/netbox/virtualization/tables/template_code.py @@ -0,0 +1,32 @@ +VMINTERFACE_BUTTONS = """ +{% if perms.virtualization.change_vminterface %} + + + + +{% endif %} +{% if perms.vpn.add_tunnel and not record.tunnel_termination %} + + + +{% elif perms.vpn.delete_tunneltermination and record.tunnel_termination %} + + + +{% endif %} +""" diff --git a/netbox/virtualization/tables/virtualmachines.py b/netbox/virtualization/tables/virtualmachines.py index fe7a66ac1..116051037 100644 --- a/netbox/virtualization/tables/virtualmachines.py +++ b/netbox/virtualization/tables/virtualmachines.py @@ -6,6 +6,7 @@ from netbox.tables import NetBoxTable, columns from tenancy.tables import ContactsColumnMixin, TenancyColumnsMixin from utilities.templatetags.helpers import humanize_megabytes from virtualization.models import VirtualDisk, VirtualMachine, VMInterface +from .template_code import * __all__ = ( 'VirtualDiskTable', @@ -15,39 +16,6 @@ __all__ = ( 'VMInterfaceTable', ) -VMINTERFACE_BUTTONS = """ -{% if perms.virtualization.change_vminterface %} - - - - -{% endif %} -{% if perms.vpn.add_tunnel and not record.tunnel_termination %} - - - -{% elif perms.vpn.delete_tunneltermination and record.tunnel_termination %} - - - -{% endif %} -""" - # # Virtual machines diff --git a/netbox/virtualization/tests/test_api.py b/netbox/virtualization/tests/test_api.py index 149b64684..c57b57f2e 100644 --- a/netbox/virtualization/tests/test_api.py +++ b/netbox/virtualization/tests/test_api.py @@ -109,9 +109,24 @@ class ClusterTest(APIViewTestCases.APIViewTestCase): ClusterGroup.objects.bulk_create(cluster_groups) clusters = ( - Cluster(name='Cluster 1', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), - Cluster(name='Cluster 2', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), - Cluster(name='Cluster 3', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED), + Cluster( + name='Cluster 1', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), + Cluster( + name='Cluster 2', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), + Cluster( + name='Cluster 3', + type=cluster_types[0], + group=cluster_groups[0], + status=ClusterStatusChoices.STATUS_PLANNED, + ), ) for cluster in clusters: cluster.save() @@ -169,9 +184,25 @@ class VirtualMachineTest(APIViewTestCases.APIViewTestCase): device2 = create_test_device('device2', site=sites[1], cluster=clusters[1]) virtual_machines = ( - VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=device1, local_context_data={'A': 1}), - VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], local_context_data={'B': 2}), - VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], local_context_data={'C': 3}), + VirtualMachine( + name='Virtual Machine 1', + site=sites[0], + cluster=clusters[0], + device=device1, + local_context_data={'A': 1}, + ), + VirtualMachine( + name='Virtual Machine 2', + site=sites[0], + cluster=clusters[0], + local_context_data={'B': 2 + }), + VirtualMachine( + name='Virtual Machine 3', + site=sites[0], + cluster=clusters[0], + local_context_data={'C': 3} + ), ) VirtualMachine.objects.bulk_create(virtual_machines) diff --git a/netbox/virtualization/tests/test_views.py b/netbox/virtualization/tests/test_views.py index dfd7e041c..3c8d7eadc 100644 --- a/netbox/virtualization/tests/test_views.py +++ b/netbox/virtualization/tests/test_views.py @@ -117,9 +117,27 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase): ClusterType.objects.bulk_create(clustertypes) clusters = ( - Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), - Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), - Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]), + Cluster( + name='Cluster 1', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), + Cluster( + name='Cluster 2', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), + Cluster( + name='Cluster 3', + group=clustergroups[0], + type=clustertypes[0], + status=ClusterStatusChoices.STATUS_ACTIVE, + scope=sites[0], + ), ) for cluster in clusters: cluster.save() @@ -214,9 +232,30 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase): ) virtual_machines = ( - VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), - VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), - VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]), + VirtualMachine( + name='Virtual Machine 1', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), + VirtualMachine( + name='Virtual Machine 2', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), + VirtualMachine( + name='Virtual Machine 3', + site=sites[0], + cluster=clusters[0], + device=devices[0], + role=roles[0], + platform=platforms[0], + ), ) VirtualMachine.objects.bulk_create(virtual_machines) diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 605de0911..ccba12239 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -177,7 +177,11 @@ class ClusterView(generic.ObjectView): queryset = Cluster.objects.all() def get_extra_context(self, request, instance): - return instance.virtual_machines.aggregate(vcpus_sum=Sum('vcpus'), memory_sum=Sum('memory'), disk_sum=Sum('disk')) + return instance.virtual_machines.aggregate( + vcpus_sum=Sum('vcpus'), + memory_sum=Sum('memory'), + disk_sum=Sum('disk') + ) @register_model_view(Cluster, 'virtualmachines', path='virtual-machines') diff --git a/netbox/vpn/api/serializers_/crypto.py b/netbox/vpn/api/serializers_/crypto.py index c11b8de2b..fbd04c230 100644 --- a/netbox/vpn/api/serializers_/crypto.py +++ b/netbox/vpn/api/serializers_/crypto.py @@ -74,7 +74,8 @@ class IPSecProposalSerializer(NetBoxModelSerializer): model = IPSecProposal fields = ( 'id', 'url', 'display_url', 'display', 'name', 'description', 'encryption_algorithm', - 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', + 'created', 'last_updated', ) brief_fields = ('id', 'url', 'display', 'name', 'description') diff --git a/netbox/vpn/migrations/0001_initial.py b/netbox/vpn/migrations/0001_initial.py index 681474837..b44ae3e52 100644 --- a/netbox/vpn/migrations/0001_initial.py +++ b/netbox/vpn/migrations/0001_initial.py @@ -5,7 +5,6 @@ import utilities.json class Migration(migrations.Migration): - initial = True dependencies = [ @@ -23,7 +22,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), @@ -46,7 +48,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), @@ -70,7 +75,6 @@ class Migration(migrations.Migration): name='tags', field=taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag'), ), - # IPSec migrations.CreateModel( name='IPSecProposal', @@ -78,7 +82,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), @@ -100,7 +107,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), @@ -128,13 +138,26 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), ('mode', models.CharField()), - ('ike_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ikepolicy')), - ('ipsec_policy', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ipsecpolicy')), + ( + 'ike_policy', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ikepolicy' + ), + ), + ( + 'ipsec_policy', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='ipsec_profiles', to='vpn.ipsecpolicy' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -143,7 +166,6 @@ class Migration(migrations.Migration): 'ordering': ('name',), }, ), - # Tunnels migrations.CreateModel( name='TunnelGroup', @@ -151,7 +173,10 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), ('description', models.CharField(blank=True, max_length=200)), @@ -173,17 +198,47 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), ('status', models.CharField(default='active', max_length=50)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnels', to='vpn.tunnelgroup')), + ( + 'group', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='tunnels', + to='vpn.tunnelgroup', + ), + ), ('encapsulation', models.CharField(max_length=50)), ('tunnel_id', models.PositiveBigIntegerField(blank=True, null=True)), - ('ipsec_profile', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnels', to='vpn.ipsecprofile')), + ( + 'ipsec_profile', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='tunnels', + to='vpn.ipsecprofile', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnels', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='tunnels', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'tunnel', @@ -197,7 +252,9 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='tunnel', - constraint=models.UniqueConstraint(condition=models.Q(('group__isnull', True)), fields=('name',), name='vpn_tunnel_name'), + constraint=models.UniqueConstraint( + condition=models.Q(('group__isnull', True)), fields=('name',), name='vpn_tunnel_name' + ), ), migrations.CreateModel( name='TunnelTermination', @@ -205,13 +262,35 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('role', models.CharField(default='peer', max_length=50)), ('termination_id', models.PositiveBigIntegerField(blank=True, null=True)), - ('termination_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('outside_ip', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnel_termination', to='ipam.ipaddress')), + ( + 'termination_type', + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype' + ), + ), + ( + 'outside_ip', + models.OneToOneField( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='tunnel_termination', + to='ipam.ipaddress', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tunnel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.tunnel')), + ( + 'tunnel', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.tunnel' + ), + ), ], options={ 'verbose_name': 'tunnel termination', @@ -225,6 +304,10 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='tunneltermination', - constraint=models.UniqueConstraint(fields=('termination_type', 'termination_id'), name='vpn_tunneltermination_termination', violation_error_message='An object may be terminated to only one tunnel at a time.'), + constraint=models.UniqueConstraint( + fields=('termination_type', 'termination_id'), + name='vpn_tunneltermination_termination', + violation_error_message='An object may be terminated to only one tunnel at a time.', + ), ), ] diff --git a/netbox/vpn/migrations/0002_move_l2vpn.py b/netbox/vpn/migrations/0002_move_l2vpn.py index b83ea4655..5f1480dce 100644 --- a/netbox/vpn/migrations/0002_move_l2vpn.py +++ b/netbox/vpn/migrations/0002_move_l2vpn.py @@ -5,7 +5,6 @@ import utilities.json class Migration(migrations.Migration): - dependencies = [ ('extras', '0099_cachedvalue_ordering'), ('contenttypes', '0002_remove_content_type_name'), @@ -23,17 +22,35 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('description', models.CharField(blank=True, max_length=200)), ('comments', models.TextField(blank=True)), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), ('type', models.CharField(max_length=50)), ('identifier', models.BigIntegerField(blank=True, null=True)), - ('export_targets', models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget')), - ('import_targets', models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget')), + ( + 'export_targets', + models.ManyToManyField(blank=True, related_name='exporting_l2vpns', to='ipam.routetarget'), + ), + ( + 'import_targets', + models.ManyToManyField(blank=True, related_name='importing_l2vpns', to='ipam.routetarget'), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='l2vpns', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='l2vpns', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'L2VPN', @@ -47,10 +64,33 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('assigned_object_id', models.PositiveBigIntegerField()), - ('assigned_object_type', models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'dcim'), ('model', 'interface')), models.Q(('app_label', 'ipam'), ('model', 'vlan')), models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), _connector='OR')), on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.contenttype')), - ('l2vpn', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.l2vpn')), + ( + 'assigned_object_type', + models.ForeignKey( + limit_choices_to=models.Q( + models.Q( + models.Q(('app_label', 'dcim'), ('model', 'interface')), + models.Q(('app_label', 'ipam'), ('model', 'vlan')), + models.Q(('app_label', 'virtualization'), ('model', 'vminterface')), + _connector='OR', + ) + ), + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='contenttypes.contenttype', + ), + ), + ( + 'l2vpn', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name='terminations', to='vpn.l2vpn' + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ @@ -66,12 +106,13 @@ class Migration(migrations.Migration): migrations.AddConstraint( model_name='l2vpntermination', constraint=models.UniqueConstraint( - fields=('assigned_object_type', 'assigned_object_id'), - name='vpn_l2vpntermination_assigned_object' + fields=('assigned_object_type', 'assigned_object_id'), name='vpn_l2vpntermination_assigned_object' ), ), migrations.AddIndex( model_name='l2vpntermination', - index=models.Index(fields=['assigned_object_type', 'assigned_object_id'], name='vpn_l2vpnte_assigne_9c55f8_idx'), + index=models.Index( + fields=['assigned_object_type', 'assigned_object_id'], name='vpn_l2vpnte_assigne_9c55f8_idx' + ), ), ] diff --git a/netbox/vpn/migrations/0003_ipaddress_multiple_tunnel_terminations.py b/netbox/vpn/migrations/0003_ipaddress_multiple_tunnel_terminations.py index 2747669ae..ce042b4db 100644 --- a/netbox/vpn/migrations/0003_ipaddress_multiple_tunnel_terminations.py +++ b/netbox/vpn/migrations/0003_ipaddress_multiple_tunnel_terminations.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ('ipam', '0069_gfk_indexes'), ('vpn', '0002_move_l2vpn'), @@ -15,6 +14,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='tunneltermination', name='outside_ip', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tunnel_terminations', to='ipam.ipaddress'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='tunnel_terminations', + to='ipam.ipaddress', + ), ), ] diff --git a/netbox/vpn/migrations/0004_alter_ikepolicy_mode.py b/netbox/vpn/migrations/0004_alter_ikepolicy_mode.py index 40dd4f99e..44bf4d35b 100644 --- a/netbox/vpn/migrations/0004_alter_ikepolicy_mode.py +++ b/netbox/vpn/migrations/0004_alter_ikepolicy_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('vpn', '0003_ipaddress_multiple_tunnel_terminations'), ] diff --git a/netbox/vpn/migrations/0005_rename_indexes.py b/netbox/vpn/migrations/0005_rename_indexes.py index 805b380cc..f24106c1f 100644 --- a/netbox/vpn/migrations/0005_rename_indexes.py +++ b/netbox/vpn/migrations/0005_rename_indexes.py @@ -2,43 +2,56 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('vpn', '0004_alter_ikepolicy_mode'), ] operations = [ - # Rename vpn_l2vpn constraints - migrations.RunSQL("ALTER TABLE vpn_l2vpn RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id"), - + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpn ' + 'RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id ' + 'TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id' + )), # Rename ipam_l2vpn_* sequences - migrations.RunSQL("ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq"), - migrations.RunSQL("ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq"), - migrations.RunSQL("ALTER TABLE ipam_l2vpn_import_targets_id_seq RENAME TO vpn_l2vpn_import_targets_id_seq"), - + migrations.RunSQL('ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq'), + migrations.RunSQL('ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq'), + migrations.RunSQL('ALTER TABLE ipam_l2vpn_import_targets_id_seq RENAME TO vpn_l2vpn_import_targets_id_seq'), # Rename ipam_l2vpn_* indexes - migrations.RunSQL("ALTER INDEX ipam_l2vpn_pkey RENAME TO vpn_l2vpn_pkey"), - migrations.RunSQL("ALTER INDEX ipam_l2vpn_name_5e1c080f_like RENAME TO vpn_l2vpn_name_8824eda5_like"), - migrations.RunSQL("ALTER INDEX ipam_l2vpn_name_key RENAME TO vpn_l2vpn_name_key"), - migrations.RunSQL("ALTER INDEX ipam_l2vpn_slug_24008406_like RENAME TO vpn_l2vpn_slug_76b5a174_like"), - migrations.RunSQL("ALTER INDEX ipam_l2vpn_tenant_id_bb2564a6 RENAME TO vpn_l2vpn_tenant_id_57ec8f92"), + migrations.RunSQL('ALTER INDEX ipam_l2vpn_pkey RENAME TO vpn_l2vpn_pkey'), + migrations.RunSQL('ALTER INDEX ipam_l2vpn_name_5e1c080f_like RENAME TO vpn_l2vpn_name_8824eda5_like'), + migrations.RunSQL('ALTER INDEX ipam_l2vpn_name_key RENAME TO vpn_l2vpn_name_key'), + migrations.RunSQL('ALTER INDEX ipam_l2vpn_slug_24008406_like RENAME TO vpn_l2vpn_slug_76b5a174_like'), + migrations.RunSQL('ALTER INDEX ipam_l2vpn_tenant_id_bb2564a6 RENAME TO vpn_l2vpn_tenant_id_57ec8f92'), # The unique index for L2VPN.slug may have one of two names, depending on how it was created, # so we check for both. - migrations.RunSQL("ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq"), - migrations.RunSQL("ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key"), - + migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq'), + migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key'), # Rename vpn_l2vpntermination constraints - migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check TO vpn_l2vpntermination_assigned_object_id_check"), - migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co"), - migrations.RunSQL("ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id"), - + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check ' + 'TO vpn_l2vpntermination_assigned_object_id_check' + )), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co ' + 'TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co' + )), + migrations.RunSQL(( + 'ALTER TABLE vpn_l2vpntermination ' + 'RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id ' + 'TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id' + )), # Rename ipam_l2vpn_termination_* sequences - migrations.RunSQL("ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq"), - + migrations.RunSQL('ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq'), # Rename ipam_l2vpn_* indexes - migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey"), - migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865"), - migrations.RunSQL("ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe"), - + migrations.RunSQL('ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey'), + migrations.RunSQL(( + 'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 ' + 'RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865' + )), + migrations.RunSQL( + 'ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe' + ), ] diff --git a/netbox/vpn/migrations/0006_charfield_null_choices.py b/netbox/vpn/migrations/0006_charfield_null_choices.py index 1943c466f..784b66d72 100644 --- a/netbox/vpn/migrations/0006_charfield_null_choices.py +++ b/netbox/vpn/migrations/0006_charfield_null_choices.py @@ -16,7 +16,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('vpn', '0005_rename_indexes'), ] @@ -42,8 +41,5 @@ class Migration(migrations.Migration): name='encryption_algorithm', field=models.CharField(blank=True, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/vpn/migrations/0007_natural_ordering.py b/netbox/vpn/migrations/0007_natural_ordering.py index 01dd4620f..3eb8ab5a9 100644 --- a/netbox/vpn/migrations/0007_natural_ordering.py +++ b/netbox/vpn/migrations/0007_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('vpn', '0006_charfield_null_choices'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/wireless/api/serializers_/wirelesslans.py b/netbox/wireless/api/serializers_/wirelesslans.py index 637089277..68f79daf6 100644 --- a/netbox/wireless/api/serializers_/wirelesslans.py +++ b/netbox/wireless/api/serializers_/wirelesslans.py @@ -52,9 +52,9 @@ class WirelessLANSerializer(NetBoxModelSerializer): class Meta: model = WirelessLAN fields = [ - 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', 'scope_id', 'scope', - 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', - 'created', 'last_updated', + 'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', + 'scope_id', 'scope', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', + 'custom_fields', 'created', 'last_updated', ] brief_fields = ('id', 'url', 'display', 'ssid', 'description') diff --git a/netbox/wireless/forms/bulk_import.py b/netbox/wireless/forms/bulk_import.py index f23ccf203..1fece7e46 100644 --- a/netbox/wireless/forms/bulk_import.py +++ b/netbox/wireless/forms/bulk_import.py @@ -76,8 +76,8 @@ class WirelessLANImportForm(ScopedImportForm, NetBoxModelImportForm): class Meta: model = WirelessLAN fields = ( - 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', 'scope_id', - 'description', 'comments', 'tags', + 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', + 'scope_id', 'description', 'comments', 'tags', ) labels = { 'scope_id': _('Scope ID'), diff --git a/netbox/wireless/migrations/0001_squashed_0008.py b/netbox/wireless/migrations/0001_squashed_0008.py index 2326f5cf7..8886580e1 100644 --- a/netbox/wireless/migrations/0001_squashed_0008.py +++ b/netbox/wireless/migrations/0001_squashed_0008.py @@ -8,7 +8,6 @@ import wireless.models class Migration(migrations.Migration): - replaces = [ ('wireless', '0001_wireless'), ('wireless', '0002_standardize_id_fields'), @@ -17,7 +16,7 @@ class Migration(migrations.Migration): ('wireless', '0005_wirelesslink_interface_types'), ('wireless', '0006_unique_constraints'), ('wireless', '0007_standardize_description_comments'), - ('wireless', '0008_wirelesslan_status') + ('wireless', '0008_wirelesslan_status'), ] dependencies = [ @@ -33,7 +32,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('name', models.CharField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)), @@ -43,7 +45,16 @@ class Migration(migrations.Migration): ('rght', models.PositiveIntegerField(editable=False)), ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)), ('level', models.PositiveIntegerField(editable=False)), - ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='wireless.wirelesslangroup')), + ( + 'parent', + mptt.fields.TreeForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='wireless.wirelesslangroup', + ), + ), ], options={ 'ordering': ('name', 'pk'), @@ -56,17 +67,43 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('ssid', models.CharField(max_length=32)), - ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='wireless_lans', to='wireless.wirelesslangroup')), + ( + 'group', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='wireless_lans', + to='wireless.wirelesslangroup', + ), + ), ('description', models.CharField(blank=True, max_length=200)), ('auth_cipher', models.CharField(blank=True, max_length=50)), ('auth_psk', models.CharField(blank=True, max_length=64)), ('auth_type', models.CharField(blank=True, max_length=50)), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('vlan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlan')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='wireless_lans', to='tenancy.tenant')), + ( + 'vlan', + models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ipam.vlan' + ), + ), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='wireless_lans', + to='tenancy.tenant', + ), + ), ], options={ 'verbose_name': 'Wireless LAN', @@ -78,7 +115,10 @@ class Migration(migrations.Migration): fields=[ ('created', models.DateTimeField(auto_now_add=True, null=True)), ('last_updated', models.DateTimeField(auto_now=True, null=True)), - ('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)), + ( + 'custom_field_data', + models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), + ), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)), ('ssid', models.CharField(blank=True, max_length=32)), ('status', models.CharField(default='connected', max_length=50)), @@ -86,12 +126,55 @@ class Migration(migrations.Migration): ('auth_cipher', models.CharField(blank=True, max_length=50)), ('auth_psk', models.CharField(blank=True, max_length=64)), ('auth_type', models.CharField(blank=True, max_length=50)), - ('_interface_a_device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device')), - ('_interface_b_device', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device')), - ('interface_a', models.ForeignKey(limit_choices_to=wireless.models.get_wireless_interface_types, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='dcim.interface')), - ('interface_b', models.ForeignKey(limit_choices_to=wireless.models.get_wireless_interface_types, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='dcim.interface')), + ( + '_interface_a_device', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='dcim.device', + ), + ), + ( + '_interface_b_device', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='dcim.device', + ), + ), + ( + 'interface_a', + models.ForeignKey( + limit_choices_to=wireless.models.get_wireless_interface_types, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='dcim.interface', + ), + ), + ( + 'interface_b', + models.ForeignKey( + limit_choices_to=wireless.models.get_wireless_interface_types, + on_delete=django.db.models.deletion.PROTECT, + related_name='+', + to='dcim.interface', + ), + ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), - ('tenant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='wireless_links', to='tenancy.tenant')), + ( + 'tenant', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name='wireless_links', + to='tenancy.tenant', + ), + ), ], options={ 'ordering': ['pk'], @@ -100,11 +183,15 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name='wirelesslangroup', - constraint=models.UniqueConstraint(fields=('parent', 'name'), name='wireless_wirelesslangroup_unique_parent_name'), + constraint=models.UniqueConstraint( + fields=('parent', 'name'), name='wireless_wirelesslangroup_unique_parent_name' + ), ), migrations.AddConstraint( model_name='wirelesslink', - constraint=models.UniqueConstraint(fields=('interface_a', 'interface_b'), name='wireless_wirelesslink_unique_interfaces'), + constraint=models.UniqueConstraint( + fields=('interface_a', 'interface_b'), name='wireless_wirelesslink_unique_interfaces' + ), ), migrations.AddField( model_name='wirelesslan', diff --git a/netbox/wireless/migrations/0009_wirelesslink_distance.py b/netbox/wireless/migrations/0009_wirelesslink_distance.py index 6a778ef00..6ddf4ab44 100644 --- a/netbox/wireless/migrations/0009_wirelesslink_distance.py +++ b/netbox/wireless/migrations/0009_wirelesslink_distance.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('wireless', '0001_squashed_0008'), ] diff --git a/netbox/wireless/migrations/0010_charfield_null_choices.py b/netbox/wireless/migrations/0010_charfield_null_choices.py index 9bfdc54ed..f0394618a 100644 --- a/netbox/wireless/migrations/0010_charfield_null_choices.py +++ b/netbox/wireless/migrations/0010_charfield_null_choices.py @@ -16,7 +16,6 @@ def set_null_values(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ('wireless', '0009_wirelesslink_distance'), ] @@ -47,8 +46,5 @@ class Migration(migrations.Migration): name='distance_unit', field=models.CharField(blank=True, max_length=50, null=True), ), - migrations.RunPython( - code=set_null_values, - reverse_code=migrations.RunPython.noop - ), + migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py b/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py index ea4470641..334d41bdd 100644 --- a/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py +++ b/netbox/wireless/migrations/0011_wirelesslan__location_wirelesslan__region_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('dcim', '0196_qinq_svlan'), diff --git a/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py b/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py index 7edaff92b..21f118bd0 100644 --- a/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py +++ b/netbox/wireless/migrations/0012_alter_wirelesslan__location_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('dcim', '0196_qinq_svlan'), ('wireless', '0011_wirelesslan__location_wirelesslan__region_and_more'), diff --git a/netbox/wireless/migrations/0013_natural_ordering.py b/netbox/wireless/migrations/0013_natural_ordering.py index e33c87c60..7caede643 100644 --- a/netbox/wireless/migrations/0013_natural_ordering.py +++ b/netbox/wireless/migrations/0013_natural_ordering.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('wireless', '0012_alter_wirelesslan__location_and_more'), ('dcim', '0197_natural_sort_collation'), diff --git a/netbox/wireless/tables/wirelesslan.py b/netbox/wireless/tables/wirelesslan.py index 40f52f8a5..fe9c0f5fa 100644 --- a/netbox/wireless/tables/wirelesslan.py +++ b/netbox/wireless/tables/wirelesslan.py @@ -72,7 +72,8 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable): model = WirelessLAN fields = ( 'pk', 'ssid', 'group', 'status', 'tenant', 'tenant_group', 'vlan', 'interface_count', 'auth_type', - 'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', 'last_updated', + 'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', + 'last_updated', ) default_columns = ('pk', 'ssid', 'group', 'status', 'description', 'vlan', 'auth_type', 'interface_count') diff --git a/netbox/wireless/tests/test_filtersets.py b/netbox/wireless/tests/test_filtersets.py index 76ef4e220..27aab83d8 100644 --- a/netbox/wireless/tests/test_filtersets.py +++ b/netbox/wireless/tests/test_filtersets.py @@ -27,8 +27,18 @@ class WirelessLANGroupTestCase(TestCase, ChangeLoggedFilterSetTests): group.save() groups = ( - WirelessLANGroup(name='Wireless LAN Group 1A', slug='wireless-lan-group-1a', parent=parent_groups[0], description='foobar1'), - WirelessLANGroup(name='Wireless LAN Group 1B', slug='wireless-lan-group-1b', parent=parent_groups[0], description='foobar2'), + WirelessLANGroup( + name='Wireless LAN Group 1A', + slug='wireless-lan-group-1a', + parent=parent_groups[0], + description='foobar1', + ), + WirelessLANGroup( + name='Wireless LAN Group 1B', + slug='wireless-lan-group-1b', + parent=parent_groups[0], + description='foobar2', + ), WirelessLANGroup(name='Wireless LAN Group 2A', slug='wireless-lan-group-2a', parent=parent_groups[1]), WirelessLANGroup(name='Wireless LAN Group 2B', slug='wireless-lan-group-2b', parent=parent_groups[1]), WirelessLANGroup(name='Wireless LAN Group 3A', slug='wireless-lan-group-3a', parent=parent_groups[2]), diff --git a/netbox/wireless/tests/test_views.py b/netbox/wireless/tests/test_views.py index 713ba81d7..51af37364 100644 --- a/netbox/wireless/tests/test_views.py +++ b/netbox/wireless/tests/test_views.py @@ -113,9 +113,20 @@ class WirelessLANTestCase(ViewTestCases.PrimaryObjectViewTestCase): cls.csv_data = ( "group,ssid,status,tenant,scope_type,scope_id", - f"Wireless LAN Group 2,WLAN4,{WirelessLANStatusChoices.STATUS_ACTIVE},{tenants[0].name},,", - f"Wireless LAN Group 2,WLAN5,{WirelessLANStatusChoices.STATUS_DISABLED},{tenants[1].name},dcim.site,{sites[0].pk}", - f"Wireless LAN Group 2,WLAN6,{WirelessLANStatusChoices.STATUS_RESERVED},{tenants[2].name},dcim.site,{sites[1].pk}", + "Wireless LAN Group 2,WLAN4,{status},{tenant},,".format( + status=WirelessLANStatusChoices.STATUS_ACTIVE, + tenant=tenants[0].name + ), + "Wireless LAN Group 2,WLAN5,{status},{tenant},dcim.site,{site}".format( + status=WirelessLANStatusChoices.STATUS_DISABLED, + tenant=tenants[1].name, + site=sites[0].pk + ), + "Wireless LAN Group 2,WLAN6,{status},{tenant},dcim.site,{site}".format( + status=WirelessLANStatusChoices.STATUS_RESERVED, + tenant=tenants[2].name, + site=sites[1].pk + ), ) cls.csv_update_data = ( @@ -157,11 +168,17 @@ class WirelessLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase): ] Interface.objects.bulk_create(interfaces) - wirelesslink1 = WirelessLink(interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0]) + wirelesslink1 = WirelessLink( + interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0] + ) wirelesslink1.save() - wirelesslink2 = WirelessLink(interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0]) + wirelesslink2 = WirelessLink( + interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0] + ) wirelesslink2.save() - wirelesslink3 = WirelessLink(interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0]) + wirelesslink3 = WirelessLink( + interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0] + ) wirelesslink3.save() tags = create_tags('Alpha', 'Bravo', 'Charlie') diff --git a/ruff.toml b/ruff.toml index 94a0e1c61..12dac331e 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,4 +1,15 @@ +exclude = [ + "netbox/project-static/**" +] +line-length = 120 + [lint] -extend-select = ["E1", "E2", "E3", "W"] -ignore = ["E501", "F403", "F405"] +extend-select = ["E1", "E2", "E3", "E501", "W"] +ignore = ["F403", "F405"] preview = true + +[lint.per-file-ignores] +"template_code.py" = ["E501"] + +[format] +quote-style = "single" From ff7a59db2ec6cf322bb1887375ffb03e7a7f3c8e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 21 Nov 2024 16:01:31 -0500 Subject: [PATCH 36/65] Closes #17752: Rename URL paths for bulk import to *_bulk_import --- netbox/circuits/tests/test_views.py | 8 +-- netbox/circuits/urls.py | 4 +- netbox/circuits/views.py | 16 ++--- netbox/core/views.py | 2 +- netbox/dcim/tests/test_views.py | 10 +-- netbox/dcim/views.py | 64 +++++++++---------- netbox/extras/tests/test_custom_validation.py | 4 +- netbox/extras/tests/test_customfields.py | 2 +- netbox/extras/views.py | 24 +++---- netbox/ipam/tests/test_views.py | 4 +- netbox/ipam/views.py | 34 +++++----- netbox/netbox/constants.py | 2 +- netbox/netbox/navigation/__init__.py | 8 +-- netbox/netbox/navigation/menu.py | 8 +-- netbox/netbox/tests/test_import.py | 14 ++-- netbox/templates/generic/object_list.html | 2 +- netbox/tenancy/views.py | 14 ++-- netbox/users/views.py | 6 +- netbox/utilities/templatetags/buttons.py | 2 +- netbox/utilities/testing/views.py | 14 ++-- netbox/virtualization/views.py | 14 ++-- netbox/vpn/views.py | 20 +++--- netbox/wireless/views.py | 6 +- 23 files changed, 141 insertions(+), 141 deletions(-) diff --git a/netbox/circuits/tests/test_views.py b/netbox/circuits/tests/test_views.py index 3a9bd4dff..036bebe23 100644 --- a/netbox/circuits/tests/test_views.py +++ b/netbox/circuits/tests/test_views.py @@ -239,10 +239,10 @@ class CircuitTestCase(ViewTestCases.PrimaryObjectViewTestCase): obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Try GET with model-level permission - self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(self._get_queryset().count(), initial_count + 1) @@ -655,10 +655,10 @@ class VirtualCircuitTestCase(ViewTestCases.PrimaryObjectViewTestCase): obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Try GET with model-level permission - self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(self._get_queryset().count(), initial_count + 1) diff --git a/netbox/circuits/urls.py b/netbox/circuits/urls.py index 56ba5eb8a..49eaa3910 100644 --- a/netbox/circuits/urls.py +++ b/netbox/circuits/urls.py @@ -37,7 +37,7 @@ urlpatterns = [ # Virtual circuits path('virtual-circuits/', views.VirtualCircuitListView.as_view(), name='virtualcircuit_list'), path('virtual-circuits/add/', views.VirtualCircuitEditView.as_view(), name='virtualcircuit_add'), - path('virtual-circuits/import/', views.VirtualCircuitBulkImportView.as_view(), name='virtualcircuit_import'), + path('virtual-circuits/import/', views.VirtualCircuitBulkImportView.as_view(), name='virtualcircuit_bulk_import'), path('virtual-circuits/edit/', views.VirtualCircuitBulkEditView.as_view(), name='virtualcircuit_bulk_edit'), path('virtual-circuits/delete/', views.VirtualCircuitBulkDeleteView.as_view(), name='virtualcircuit_bulk_delete'), path('virtual-circuits//', include(get_model_urls('circuits', 'virtualcircuit'))), @@ -56,7 +56,7 @@ urlpatterns = [ path( 'virtual-circuit-terminations/import/', views.VirtualCircuitTerminationBulkImportView.as_view(), - name='virtualcircuittermination_import', + name='virtualcircuittermination_bulk_import', ), path( 'virtual-circuit-terminations/edit/', diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 7410d0a8f..09f79789e 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -49,7 +49,7 @@ class ProviderDeleteView(generic.ObjectDeleteView): queryset = Provider.objects.all() -@register_model_view(Provider, 'import', detail=False) +@register_model_view(Provider, 'bulk_import', detail=False) class ProviderBulkImportView(generic.BulkImportView): queryset = Provider.objects.all() model_form = forms.ProviderImportForm @@ -115,7 +115,7 @@ class ProviderAccountDeleteView(generic.ObjectDeleteView): queryset = ProviderAccount.objects.all() -@register_model_view(ProviderAccount, 'import', detail=False) +@register_model_view(ProviderAccount, 'bulk_import', detail=False) class ProviderAccountBulkImportView(generic.BulkImportView): queryset = ProviderAccount.objects.all() model_form = forms.ProviderAccountImportForm @@ -189,7 +189,7 @@ class ProviderNetworkDeleteView(generic.ObjectDeleteView): queryset = ProviderNetwork.objects.all() -@register_model_view(ProviderNetwork, 'import', detail=False) +@register_model_view(ProviderNetwork, 'bulk_import', detail=False) class ProviderNetworkBulkImportView(generic.BulkImportView): queryset = ProviderNetwork.objects.all() model_form = forms.ProviderNetworkImportForm @@ -246,7 +246,7 @@ class CircuitTypeDeleteView(generic.ObjectDeleteView): queryset = CircuitType.objects.all() -@register_model_view(CircuitType, 'import', detail=False) +@register_model_view(CircuitType, 'bulk_import', detail=False) class CircuitTypeBulkImportView(generic.BulkImportView): queryset = CircuitType.objects.all() model_form = forms.CircuitTypeImportForm @@ -302,7 +302,7 @@ class CircuitDeleteView(generic.ObjectDeleteView): queryset = Circuit.objects.all() -@register_model_view(Circuit, 'import', detail=False) +@register_model_view(Circuit, 'bulk_import', detail=False) class CircuitBulkImportView(generic.BulkImportView): queryset = Circuit.objects.all() model_form = forms.CircuitImportForm @@ -447,7 +447,7 @@ class CircuitTerminationDeleteView(generic.ObjectDeleteView): queryset = CircuitTermination.objects.all() -@register_model_view(CircuitTermination, 'import', detail=False) +@register_model_view(CircuitTermination, 'bulk_import', detail=False) class CircuitTerminationBulkImportView(generic.BulkImportView): queryset = CircuitTermination.objects.all() model_form = forms.CircuitTerminationImportForm @@ -508,7 +508,7 @@ class CircuitGroupDeleteView(generic.ObjectDeleteView): queryset = CircuitGroup.objects.all() -@register_model_view(CircuitGroup, 'import', detail=False) +@register_model_view(CircuitGroup, 'bulk_import', detail=False) class CircuitGroupBulkImportView(generic.BulkImportView): queryset = CircuitGroup.objects.all() model_form = forms.CircuitGroupImportForm @@ -558,7 +558,7 @@ class CircuitGroupAssignmentDeleteView(generic.ObjectDeleteView): queryset = CircuitGroupAssignment.objects.all() -@register_model_view(CircuitGroupAssignment, 'import', detail=False) +@register_model_view(CircuitGroupAssignment, 'bulk_import', detail=False) class CircuitGroupAssignmentBulkImportView(generic.BulkImportView): queryset = CircuitGroupAssignment.objects.all() model_form = forms.CircuitGroupAssignmentImportForm diff --git a/netbox/core/views.py b/netbox/core/views.py index b49676d49..a9ec5d70a 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -105,7 +105,7 @@ class DataSourceDeleteView(generic.ObjectDeleteView): queryset = DataSource.objects.all() -@register_model_view(DataSource, 'import', detail=False) +@register_model_view(DataSource, 'bulk_import', detail=False) class DataSourceBulkImportView(generic.BulkImportView): queryset = DataSource.objects.all() model_form = forms.DataSourceImportForm diff --git a/netbox/dcim/tests/test_views.py b/netbox/dcim/tests/test_views.py index c2c5b6a01..bb942c685 100644 --- a/netbox/dcim/tests/test_views.py +++ b/netbox/dcim/tests/test_views.py @@ -900,7 +900,7 @@ inventory-items: 'data': IMPORT_DATA, 'format': 'yaml' } - response = self.client.post(reverse('dcim:devicetype_import'), data=form_data, follow=True) + response = self.client.post(reverse('dcim:devicetype_bulk_import'), data=form_data, follow=True) self.assertHttpStatus(response, 200) device_type = DeviceType.objects.get(model='TEST-1000') @@ -1228,7 +1228,7 @@ front-ports: 'data': IMPORT_DATA, 'format': 'yaml' } - response = self.client.post(reverse('dcim:moduletype_import'), data=form_data, follow=True) + response = self.client.post(reverse('dcim:moduletype_bulk_import'), data=form_data, follow=True) self.assertHttpStatus(response, 200) module_type = ModuleType.objects.get(model='TEST-1000') @@ -2170,7 +2170,7 @@ class ModuleTestCase( f"{device.name},{module_bay.name},{module_type.model},active,false" ] request = { - 'path': self._get_url('import'), + 'path': self._get_url('bulk_import'), 'data': { 'data': '\n'.join(csv_data), 'format': ImportFormatChoices.CSV, @@ -2187,7 +2187,7 @@ class ModuleTestCase( module_bay = ModuleBay.objects.get(device=device, name='Module Bay 5') csv_data[1] = f"{device.name},{module_bay.name},{module_type.model},active,true" request = { - 'path': self._get_url('import'), + 'path': self._get_url('bulk_import'), 'data': { 'data': '\n'.join(csv_data), 'format': ImportFormatChoices.CSV, @@ -2264,7 +2264,7 @@ class ModuleTestCase( f"{device.name},{module_bay.name},{module_type.model},active,false,true" ] request = { - 'path': self._get_url('import'), + 'path': self._get_url('bulk_import'), 'data': { 'data': '\n'.join(csv_data), 'format': ImportFormatChoices.CSV, diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 731034dc1..8b0628de5 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -266,7 +266,7 @@ class RegionDeleteView(generic.ObjectDeleteView): queryset = Region.objects.all() -@register_model_view(Region, 'import', detail=False) +@register_model_view(Region, 'bulk_import', detail=False) class RegionBulkImportView(generic.BulkImportView): queryset = Region.objects.all() model_form = forms.RegionImportForm @@ -359,7 +359,7 @@ class SiteGroupDeleteView(generic.ObjectDeleteView): queryset = SiteGroup.objects.all() -@register_model_view(SiteGroup, 'import', detail=False) +@register_model_view(SiteGroup, 'bulk_import', detail=False) class SiteGroupBulkImportView(generic.BulkImportView): queryset = SiteGroup.objects.all() model_form = forms.SiteGroupImportForm @@ -448,7 +448,7 @@ class SiteDeleteView(generic.ObjectDeleteView): queryset = Site.objects.all() -@register_model_view(Site, 'import', detail=False) +@register_model_view(Site, 'bulk_import', detail=False) class SiteBulkImportView(generic.BulkImportView): queryset = Site.objects.all() model_form = forms.SiteImportForm @@ -533,7 +533,7 @@ class LocationDeleteView(generic.ObjectDeleteView): queryset = Location.objects.all() -@register_model_view(Location, 'import', detail=False) +@register_model_view(Location, 'bulk_import', detail=False) class LocationBulkImportView(generic.BulkImportView): queryset = Location.objects.all() model_form = forms.LocationImportForm @@ -607,7 +607,7 @@ class RackRoleDeleteView(generic.ObjectDeleteView): queryset = RackRole.objects.all() -@register_model_view(RackRole, 'import', detail=False) +@register_model_view(RackRole, 'bulk_import', detail=False) class RackRoleBulkImportView(generic.BulkImportView): queryset = RackRole.objects.all() model_form = forms.RackRoleImportForm @@ -668,7 +668,7 @@ class RackTypeDeleteView(generic.ObjectDeleteView): queryset = RackType.objects.all() -@register_model_view(RackType, 'import', detail=False) +@register_model_view(RackType, 'bulk_import', detail=False) class RackTypeBulkImportView(generic.BulkImportView): queryset = RackType.objects.all() model_form = forms.RackTypeImportForm @@ -836,7 +836,7 @@ class RackDeleteView(generic.ObjectDeleteView): queryset = Rack.objects.all() -@register_model_view(Rack, 'import', detail=False) +@register_model_view(Rack, 'bulk_import', detail=False) class RackBulkImportView(generic.BulkImportView): queryset = Rack.objects.all() model_form = forms.RackImportForm @@ -898,7 +898,7 @@ class RackReservationDeleteView(generic.ObjectDeleteView): queryset = RackReservation.objects.all() -@register_model_view(RackReservation, 'import', detail=False) +@register_model_view(RackReservation, 'bulk_import', detail=False) class RackReservationImportView(generic.BulkImportView): queryset = RackReservation.objects.all() model_form = forms.RackReservationImportForm @@ -968,7 +968,7 @@ class ManufacturerDeleteView(generic.ObjectDeleteView): queryset = Manufacturer.objects.all() -@register_model_view(Manufacturer, 'import', detail=False) +@register_model_view(Manufacturer, 'bulk_import', detail=False) class ManufacturerBulkImportView(generic.BulkImportView): queryset = Manufacturer.objects.all() model_form = forms.ManufacturerImportForm @@ -1194,7 +1194,7 @@ class DeviceTypeInventoryItemsView(DeviceTypeComponentsView): ) -@register_model_view(DeviceType, 'import', detail=False) +@register_model_view(DeviceType, 'bulk_import', detail=False) class DeviceTypeImportView(generic.BulkImportView): additional_permissions = [ 'dcim.add_devicetype', @@ -1408,7 +1408,7 @@ class ModuleTypeModuleBaysView(ModuleTypeComponentsView): ) -@register_model_view(ModuleType, 'import', detail=False) +@register_model_view(ModuleType, 'bulk_import', detail=False) class ModuleTypeImportView(generic.BulkImportView): additional_permissions = [ 'dcim.add_moduletype', @@ -1904,7 +1904,7 @@ class DeviceRoleDeleteView(generic.ObjectDeleteView): queryset = DeviceRole.objects.all() -@register_model_view(DeviceRole, 'import', detail=False) +@register_model_view(DeviceRole, 'bulk_import', detail=False) class DeviceRoleBulkImportView(generic.BulkImportView): queryset = DeviceRole.objects.all() model_form = forms.DeviceRoleImportForm @@ -1968,7 +1968,7 @@ class PlatformDeleteView(generic.ObjectDeleteView): queryset = Platform.objects.all() -@register_model_view(Platform, 'import', detail=False) +@register_model_view(Platform, 'bulk_import', detail=False) class PlatformBulkImportView(generic.BulkImportView): queryset = Platform.objects.all() model_form = forms.PlatformImportForm @@ -2289,7 +2289,7 @@ class DeviceVirtualMachinesView(generic.ObjectChildrenView): return self.child_model.objects.restrict(request.user, 'view').filter(cluster=parent.cluster, device=parent) -@register_model_view(Device, 'import', detail=False) +@register_model_view(Device, 'bulk_import', detail=False) class DeviceBulkImportView(generic.BulkImportView): queryset = Device.objects.all() model_form = forms.DeviceImportForm @@ -2367,7 +2367,7 @@ class ModuleDeleteView(generic.ObjectDeleteView): queryset = Module.objects.all() -@register_model_view(Module, 'import', detail=False) +@register_model_view(Module, 'bulk_import', detail=False) class ModuleBulkImportView(generic.BulkImportView): queryset = Module.objects.all() model_form = forms.ModuleImportForm @@ -2428,7 +2428,7 @@ class ConsolePortDeleteView(generic.ObjectDeleteView): queryset = ConsolePort.objects.all() -@register_model_view(ConsolePort, 'import', detail=False) +@register_model_view(ConsolePort, 'bulk_import', detail=False) class ConsolePortBulkImportView(generic.BulkImportView): queryset = ConsolePort.objects.all() model_form = forms.ConsolePortImportForm @@ -2503,7 +2503,7 @@ class ConsoleServerPortDeleteView(generic.ObjectDeleteView): queryset = ConsoleServerPort.objects.all() -@register_model_view(ConsoleServerPort, 'import', detail=False) +@register_model_view(ConsoleServerPort, 'bulk_import', detail=False) class ConsoleServerPortBulkImportView(generic.BulkImportView): queryset = ConsoleServerPort.objects.all() model_form = forms.ConsoleServerPortImportForm @@ -2578,7 +2578,7 @@ class PowerPortDeleteView(generic.ObjectDeleteView): queryset = PowerPort.objects.all() -@register_model_view(PowerPort, 'import', detail=False) +@register_model_view(PowerPort, 'bulk_import', detail=False) class PowerPortBulkImportView(generic.BulkImportView): queryset = PowerPort.objects.all() model_form = forms.PowerPortImportForm @@ -2653,7 +2653,7 @@ class PowerOutletDeleteView(generic.ObjectDeleteView): queryset = PowerOutlet.objects.all() -@register_model_view(PowerOutlet, 'import', detail=False) +@register_model_view(PowerOutlet, 'bulk_import', detail=False) class PowerOutletBulkImportView(generic.BulkImportView): queryset = PowerOutlet.objects.all() model_form = forms.PowerOutletImportForm @@ -2785,7 +2785,7 @@ class InterfaceDeleteView(generic.ObjectDeleteView): queryset = Interface.objects.all() -@register_model_view(Interface, 'import', detail=False) +@register_model_view(Interface, 'bulk_import', detail=False) class InterfaceBulkImportView(generic.BulkImportView): queryset = Interface.objects.all() model_form = forms.InterfaceImportForm @@ -2871,7 +2871,7 @@ class FrontPortDeleteView(generic.ObjectDeleteView): queryset = FrontPort.objects.all() -@register_model_view(FrontPort, 'import', detail=False) +@register_model_view(FrontPort, 'bulk_import', detail=False) class FrontPortBulkImportView(generic.BulkImportView): queryset = FrontPort.objects.all() model_form = forms.FrontPortImportForm @@ -2946,7 +2946,7 @@ class RearPortDeleteView(generic.ObjectDeleteView): queryset = RearPort.objects.all() -@register_model_view(RearPort, 'import', detail=False) +@register_model_view(RearPort, 'bulk_import', detail=False) class RearPortBulkImportView(generic.BulkImportView): queryset = RearPort.objects.all() model_form = forms.RearPortImportForm @@ -3021,7 +3021,7 @@ class ModuleBayDeleteView(generic.ObjectDeleteView): queryset = ModuleBay.objects.all() -@register_model_view(ModuleBay, 'import', detail=False) +@register_model_view(ModuleBay, 'bulk_import', detail=False) class ModuleBayBulkImportView(generic.BulkImportView): queryset = ModuleBay.objects.all() model_form = forms.ModuleBayImportForm @@ -3168,7 +3168,7 @@ class DeviceBayDepopulateView(generic.ObjectEditView): }) -@register_model_view(DeviceBay, 'import', detail=False) +@register_model_view(DeviceBay, 'bulk_import', detail=False) class DeviceBayBulkImportView(generic.BulkImportView): queryset = DeviceBay.objects.all() model_form = forms.DeviceBayImportForm @@ -3234,7 +3234,7 @@ class InventoryItemDeleteView(generic.ObjectDeleteView): queryset = InventoryItem.objects.all() -@register_model_view(InventoryItem, 'import', detail=False) +@register_model_view(InventoryItem, 'bulk_import', detail=False) class InventoryItemBulkImportView(generic.BulkImportView): queryset = InventoryItem.objects.all() model_form = forms.InventoryItemImportForm @@ -3315,7 +3315,7 @@ class InventoryItemRoleDeleteView(generic.ObjectDeleteView): queryset = InventoryItemRole.objects.all() -@register_model_view(InventoryItemRole, 'import', detail=False) +@register_model_view(InventoryItemRole, 'bulk_import', detail=False) class InventoryItemRoleBulkImportView(generic.BulkImportView): queryset = InventoryItemRole.objects.all() model_form = forms.InventoryItemRoleImportForm @@ -3511,7 +3511,7 @@ class CableDeleteView(generic.ObjectDeleteView): queryset = Cable.objects.all() -@register_model_view(Cable, 'import', detail=False) +@register_model_view(Cable, 'bulk_import', detail=False) class CableBulkImportView(generic.BulkImportView): queryset = Cable.objects.all() model_form = forms.CableImportForm @@ -3812,7 +3812,7 @@ class VirtualChassisRemoveMemberView(ObjectPermissionRequiredMixin, GetReturnURL }) -@register_model_view(VirtualChassis, 'import', detail=False) +@register_model_view(VirtualChassis, 'bulk_import', detail=False) class VirtualChassisBulkImportView(generic.BulkImportView): queryset = VirtualChassis.objects.all() model_form = forms.VirtualChassisImportForm @@ -3869,7 +3869,7 @@ class PowerPanelDeleteView(generic.ObjectDeleteView): queryset = PowerPanel.objects.all() -@register_model_view(PowerPanel, 'import', detail=False) +@register_model_view(PowerPanel, 'bulk_import', detail=False) class PowerPanelBulkImportView(generic.BulkImportView): queryset = PowerPanel.objects.all() model_form = forms.PowerPanelImportForm @@ -3926,7 +3926,7 @@ class PowerFeedDeleteView(generic.ObjectDeleteView): queryset = PowerFeed.objects.all() -@register_model_view(PowerFeed, 'import', detail=False) +@register_model_view(PowerFeed, 'bulk_import', detail=False) class PowerFeedBulkImportView(generic.BulkImportView): queryset = PowerFeed.objects.all() model_form = forms.PowerFeedImportForm @@ -3998,7 +3998,7 @@ class VirtualDeviceContextDeleteView(generic.ObjectDeleteView): queryset = VirtualDeviceContext.objects.all() -@register_model_view(VirtualDeviceContext, 'import', detail=False) +@register_model_view(VirtualDeviceContext, 'bulk_import', detail=False) class VirtualDeviceContextBulkImportView(generic.BulkImportView): queryset = VirtualDeviceContext.objects.all() model_form = forms.VirtualDeviceContextImportForm @@ -4048,7 +4048,7 @@ class MACAddressDeleteView(generic.ObjectDeleteView): queryset = MACAddress.objects.all() -@register_model_view(MACAddress, 'import', detail=False) +@register_model_view(MACAddress, 'bulk_import', detail=False) class MACAddressBulkImportView(generic.BulkImportView): queryset = MACAddress.objects.all() model_form = forms.MACAddressImportForm diff --git a/netbox/extras/tests/test_custom_validation.py b/netbox/extras/tests/test_custom_validation.py index 652bc241b..6eb90e5b0 100644 --- a/netbox/extras/tests/test_custom_validation.py +++ b/netbox/extras/tests/test_custom_validation.py @@ -191,7 +191,7 @@ class BulkImportCustomValidationTest(ModelViewTestCase): # Attempt to import providers without tags request = { - 'path': self._get_url('import'), + 'path': self._get_url('bulk_import'), 'data': post_data(data), } response = self.client.post(**request) @@ -207,7 +207,7 @@ class BulkImportCustomValidationTest(ModelViewTestCase): ) data['data'] = '\n'.join(csv_data) request = { - 'path': self._get_url('import'), + 'path': self._get_url('bulk_import'), 'data': post_data(data), } response = self.client.post(**request) diff --git a/netbox/extras/tests/test_customfields.py b/netbox/extras/tests/test_customfields.py index ce26cb889..d36477da8 100644 --- a/netbox/extras/tests/test_customfields.py +++ b/netbox/extras/tests/test_customfields.py @@ -1325,7 +1325,7 @@ class CustomFieldImportTest(TestCase): ) csv_data = '\n'.join(','.join(row) for row in data) - response = self.client.post(reverse('dcim:site_import'), { + response = self.client.post(reverse('dcim:site_bulk_import'), { 'data': csv_data, 'format': ImportFormatChoices.CSV, 'csv_delimiter': CSVDelimiterChoices.AUTO, diff --git a/netbox/extras/views.py b/netbox/extras/views.py index 04f29a020..2c390a78c 100644 --- a/netbox/extras/views.py +++ b/netbox/extras/views.py @@ -82,7 +82,7 @@ class CustomFieldDeleteView(generic.ObjectDeleteView): queryset = CustomField.objects.select_related('choice_set') -@register_model_view(CustomField, 'import', detail=False) +@register_model_view(CustomField, 'bulk_import', detail=False) class CustomFieldBulkImportView(generic.BulkImportView): queryset = CustomField.objects.select_related('choice_set') model_form = forms.CustomFieldImportForm @@ -151,7 +151,7 @@ class CustomFieldChoiceSetDeleteView(generic.ObjectDeleteView): queryset = CustomFieldChoiceSet.objects.all() -@register_model_view(CustomFieldChoiceSet, 'import', detail=False) +@register_model_view(CustomFieldChoiceSet, 'bulk_import', detail=False) class CustomFieldChoiceSetBulkImportView(generic.BulkImportView): queryset = CustomFieldChoiceSet.objects.all() model_form = forms.CustomFieldChoiceSetImportForm @@ -201,7 +201,7 @@ class CustomLinkDeleteView(generic.ObjectDeleteView): queryset = CustomLink.objects.all() -@register_model_view(CustomLink, 'import', detail=False) +@register_model_view(CustomLink, 'bulk_import', detail=False) class CustomLinkBulkImportView(generic.BulkImportView): queryset = CustomLink.objects.all() model_form = forms.CustomLinkImportForm @@ -256,7 +256,7 @@ class ExportTemplateDeleteView(generic.ObjectDeleteView): queryset = ExportTemplate.objects.all() -@register_model_view(ExportTemplate, 'import', detail=False) +@register_model_view(ExportTemplate, 'bulk_import', detail=False) class ExportTemplateBulkImportView(generic.BulkImportView): queryset = ExportTemplate.objects.all() model_form = forms.ExportTemplateImportForm @@ -333,7 +333,7 @@ class SavedFilterDeleteView(SavedFilterMixin, generic.ObjectDeleteView): queryset = SavedFilter.objects.all() -@register_model_view(SavedFilter, 'import', detail=False) +@register_model_view(SavedFilter, 'bulk_import', detail=False) class SavedFilterBulkImportView(SavedFilterMixin, generic.BulkImportView): queryset = SavedFilter.objects.all() model_form = forms.SavedFilterImportForm @@ -414,7 +414,7 @@ class NotificationGroupDeleteView(generic.ObjectDeleteView): queryset = NotificationGroup.objects.all() -@register_model_view(NotificationGroup, 'import', detail=False) +@register_model_view(NotificationGroup, 'bulk_import', detail=False) class NotificationGroupBulkImportView(generic.BulkImportView): queryset = NotificationGroup.objects.all() model_form = forms.NotificationGroupImportForm @@ -560,7 +560,7 @@ class WebhookDeleteView(generic.ObjectDeleteView): queryset = Webhook.objects.all() -@register_model_view(Webhook, 'import', detail=False) +@register_model_view(Webhook, 'bulk_import', detail=False) class WebhookBulkImportView(generic.BulkImportView): queryset = Webhook.objects.all() model_form = forms.WebhookImportForm @@ -610,7 +610,7 @@ class EventRuleDeleteView(generic.ObjectDeleteView): queryset = EventRule.objects.all() -@register_model_view(EventRule, 'import', detail=False) +@register_model_view(EventRule, 'bulk_import', detail=False) class EventRuleBulkImportView(generic.BulkImportView): queryset = EventRule.objects.all() model_form = forms.EventRuleImportForm @@ -683,7 +683,7 @@ class TagDeleteView(generic.ObjectDeleteView): queryset = Tag.objects.all() -@register_model_view(Tag, 'import', detail=False) +@register_model_view(Tag, 'bulk_import', detail=False) class TagBulkImportView(generic.BulkImportView): queryset = Tag.objects.all() model_form = forms.TagImportForm @@ -859,7 +859,7 @@ class ConfigTemplateDeleteView(generic.ObjectDeleteView): queryset = ConfigTemplate.objects.all() -@register_model_view(ConfigTemplate, 'import', detail=False) +@register_model_view(ConfigTemplate, 'bulk_import', detail=False) class ConfigTemplateBulkImportView(generic.BulkImportView): queryset = ConfigTemplate.objects.all() model_form = forms.ConfigTemplateImportForm @@ -942,8 +942,8 @@ class JournalEntryListView(generic.ObjectListView): filterset_form = forms.JournalEntryFilterForm table = tables.JournalEntryTable actions = { - 'import': {'add'}, 'export': {'view'}, + 'bulk_import': {'add'}, 'bulk_edit': {'change'}, 'bulk_delete': {'delete'}, } @@ -983,7 +983,7 @@ class JournalEntryDeleteView(generic.ObjectDeleteView): return reverse(viewname, kwargs={'pk': obj.pk}) -@register_model_view(JournalEntry, 'import', detail=False) +@register_model_view(JournalEntry, 'bulk_import', detail=False) class JournalEntryBulkImportView(generic.BulkImportView): queryset = JournalEntry.objects.all() model_form = forms.JournalEntryImportForm diff --git a/netbox/ipam/tests/test_views.py b/netbox/ipam/tests/test_views.py index d26a82414..e9903d766 100644 --- a/netbox/ipam/tests/test_views.py +++ b/netbox/ipam/tests/test_views.py @@ -521,7 +521,7 @@ scope_id: {site.pk} 'data': IMPORT_DATA, 'format': 'yaml' } - response = self.client.post(reverse('ipam:prefix_import'), data=form_data, follow=True) + response = self.client.post(reverse('ipam:prefix_bulk_import'), data=form_data, follow=True) self.assertHttpStatus(response, 200) prefix = Prefix.objects.get(prefix='10.1.1.0/24') @@ -553,7 +553,7 @@ vlan: 102 'data': IMPORT_DATA, 'format': 'yaml' } - response = self.client.post(reverse('ipam:prefix_import'), data=form_data, follow=True) + response = self.client.post(reverse('ipam:prefix_bulk_import'), data=form_data, follow=True) self.assertHttpStatus(response, 200) prefix = Prefix.objects.get(prefix='10.1.2.0/24') diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 327c05f3d..f83934906 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -70,7 +70,7 @@ class VRFDeleteView(generic.ObjectDeleteView): queryset = VRF.objects.all() -@register_model_view(VRF, 'import', detail=False) +@register_model_view(VRF, 'bulk_import', detail=False) class VRFBulkImportView(generic.BulkImportView): queryset = VRF.objects.all() model_form = forms.VRFImportForm @@ -120,7 +120,7 @@ class RouteTargetDeleteView(generic.ObjectDeleteView): queryset = RouteTarget.objects.all() -@register_model_view(RouteTarget, 'import', detail=False) +@register_model_view(RouteTarget, 'bulk_import', detail=False) class RouteTargetBulkImportView(generic.BulkImportView): queryset = RouteTarget.objects.all() model_form = forms.RouteTargetImportForm @@ -177,7 +177,7 @@ class RIRDeleteView(generic.ObjectDeleteView): queryset = RIR.objects.all() -@register_model_view(RIR, 'import', detail=False) +@register_model_view(RIR, 'bulk_import', detail=False) class RIRBulkImportView(generic.BulkImportView): queryset = RIR.objects.all() model_form = forms.RIRImportForm @@ -252,7 +252,7 @@ class ASNRangeDeleteView(generic.ObjectDeleteView): queryset = ASNRange.objects.all() -@register_model_view(ASNRange, 'import', detail=False) +@register_model_view(ASNRange, 'bulk_import', detail=False) class ASNRangeBulkImportView(generic.BulkImportView): queryset = ASNRange.objects.all() model_form = forms.ASNRangeImportForm @@ -317,7 +317,7 @@ class ASNDeleteView(generic.ObjectDeleteView): queryset = ASN.objects.all() -@register_model_view(ASN, 'import', detail=False) +@register_model_view(ASN, 'bulk_import', detail=False) class ASNBulkImportView(generic.BulkImportView): queryset = ASN.objects.all() model_form = forms.ASNImportForm @@ -409,7 +409,7 @@ class AggregateDeleteView(generic.ObjectDeleteView): queryset = Aggregate.objects.all() -@register_model_view(Aggregate, 'import', detail=False) +@register_model_view(Aggregate, 'bulk_import', detail=False) class AggregateBulkImportView(generic.BulkImportView): queryset = Aggregate.objects.all() model_form = forms.AggregateImportForm @@ -477,7 +477,7 @@ class RoleDeleteView(generic.ObjectDeleteView): queryset = Role.objects.all() -@register_model_view(Role, 'import', detail=False) +@register_model_view(Role, 'bulk_import', detail=False) class RoleBulkImportView(generic.BulkImportView): queryset = Role.objects.all() model_form = forms.RoleImportForm @@ -663,7 +663,7 @@ class PrefixDeleteView(generic.ObjectDeleteView): queryset = Prefix.objects.all() -@register_model_view(Prefix, 'import', detail=False) +@register_model_view(Prefix, 'bulk_import', detail=False) class PrefixBulkImportView(generic.BulkImportView): queryset = Prefix.objects.all() model_form = forms.PrefixImportForm @@ -757,7 +757,7 @@ class IPRangeDeleteView(generic.ObjectDeleteView): queryset = IPRange.objects.all() -@register_model_view(IPRange, 'import', detail=False) +@register_model_view(IPRange, 'bulk_import', detail=False) class IPRangeBulkImportView(generic.BulkImportView): queryset = IPRange.objects.all() model_form = forms.IPRangeImportForm @@ -919,7 +919,7 @@ class IPAddressBulkCreateView(generic.BulkCreateView): template_name = 'ipam/ipaddress_bulk_add.html' -@register_model_view(IPAddress, 'import', detail=False) +@register_model_view(IPAddress, 'bulk_import', detail=False) class IPAddressBulkImportView(generic.BulkImportView): queryset = IPAddress.objects.all() model_form = forms.IPAddressImportForm @@ -997,7 +997,7 @@ class VLANGroupDeleteView(generic.ObjectDeleteView): queryset = VLANGroup.objects.all() -@register_model_view(VLANGroup, 'import', detail=False) +@register_model_view(VLANGroup, 'bulk_import', detail=False) class VLANGroupBulkImportView(generic.BulkImportView): queryset = VLANGroup.objects.all() model_form = forms.VLANGroupImportForm @@ -1082,7 +1082,7 @@ class VLANTranslationPolicyDeleteView(generic.ObjectDeleteView): queryset = VLANTranslationPolicy.objects.all() -@register_model_view(VLANTranslationPolicy, 'import', detail=False) +@register_model_view(VLANTranslationPolicy, 'bulk_import', detail=False) class VLANTranslationPolicyBulkImportView(generic.BulkImportView): queryset = VLANTranslationPolicy.objects.all() model_form = forms.VLANTranslationPolicyImportForm @@ -1137,7 +1137,7 @@ class VLANTranslationRuleDeleteView(generic.ObjectDeleteView): queryset = VLANTranslationRule.objects.all() -@register_model_view(VLANTranslationRule, 'import', detail=False) +@register_model_view(VLANTranslationRule, 'bulk_import', detail=False) class VLANTranslationRuleBulkImportView(generic.BulkImportView): queryset = VLANTranslationRule.objects.all() model_form = forms.VLANTranslationRuleImportForm @@ -1218,7 +1218,7 @@ class FHRPGroupDeleteView(generic.ObjectDeleteView): queryset = FHRPGroup.objects.all() -@register_model_view(FHRPGroup, 'import', detail=False) +@register_model_view(FHRPGroup, 'bulk_import', detail=False) class FHRPGroupBulkImportView(generic.BulkImportView): queryset = FHRPGroup.objects.all() model_form = forms.FHRPGroupImportForm @@ -1344,7 +1344,7 @@ class VLANDeleteView(generic.ObjectDeleteView): queryset = VLAN.objects.all() -@register_model_view(VLAN, 'import', detail=False) +@register_model_view(VLAN, 'bulk_import', detail=False) class VLANBulkImportView(generic.BulkImportView): queryset = VLAN.objects.all() model_form = forms.VLANImportForm @@ -1394,7 +1394,7 @@ class ServiceTemplateDeleteView(generic.ObjectDeleteView): queryset = ServiceTemplate.objects.all() -@register_model_view(ServiceTemplate, 'import', detail=False) +@register_model_view(ServiceTemplate, 'bulk_import', detail=False) class ServiceTemplateBulkImportView(generic.BulkImportView): queryset = ServiceTemplate.objects.all() model_form = forms.ServiceTemplateImportForm @@ -1449,7 +1449,7 @@ class ServiceDeleteView(generic.ObjectDeleteView): queryset = Service.objects.all() -@register_model_view(Service, 'import', detail=False) +@register_model_view(Service, 'bulk_import', detail=False) class ServiceBulkImportView(generic.BulkImportView): queryset = Service.objects.all() model_form = forms.ServiceImportForm diff --git a/netbox/netbox/constants.py b/netbox/netbox/constants.py index b8c679ec0..8d20fed45 100644 --- a/netbox/netbox/constants.py +++ b/netbox/netbox/constants.py @@ -31,8 +31,8 @@ ADVISORY_LOCK_KEYS = { # Default view action permission mapping DEFAULT_ACTION_PERMISSIONS = { 'add': {'add'}, - 'import': {'add'}, 'export': {'view'}, + 'bulk_import': {'add'}, 'bulk_edit': {'change'}, 'bulk_delete': {'delete'}, } diff --git a/netbox/netbox/navigation/__init__.py b/netbox/netbox/navigation/__init__.py index b4f7dbd9f..75ca8f440 100644 --- a/netbox/netbox/navigation/__init__.py +++ b/netbox/netbox/navigation/__init__.py @@ -60,7 +60,7 @@ class Menu: # Utility functions # -def get_model_item(app_label, model_name, label, actions=('add', 'import')): +def get_model_item(app_label, model_name, label, actions=('add', 'bulk_import')): return MenuItem( link=f'{app_label}:{model_name}_list', link_text=label, @@ -69,7 +69,7 @@ def get_model_item(app_label, model_name, label, actions=('add', 'import')): ) -def get_model_buttons(app_label, model_name, actions=('add', 'import')): +def get_model_buttons(app_label, model_name, actions=('add', 'bulk_import')): buttons = [] if 'add' in actions: @@ -81,10 +81,10 @@ def get_model_buttons(app_label, model_name, actions=('add', 'import')): permissions=[f'{app_label}.add_{model_name}'] ) ) - if 'import' in actions: + if 'bulk_import' in actions: buttons.append( MenuItemButton( - link=f'{app_label}:{model_name}_import', + link=f'{app_label}:{model_name}_bulk_import', title='Import', icon_class='mdi mdi-upload', permissions=[f'{app_label}.add_{model_name}'] diff --git a/netbox/netbox/navigation/menu.py b/netbox/netbox/navigation/menu.py index ba20e5f98..cf0649ac0 100644 --- a/netbox/netbox/navigation/menu.py +++ b/netbox/netbox/navigation/menu.py @@ -33,7 +33,7 @@ ORGANIZATION_MENU = Menu( get_model_item('tenancy', 'contact', _('Contacts')), get_model_item('tenancy', 'contactgroup', _('Contact Groups')), get_model_item('tenancy', 'contactrole', _('Contact Roles')), - get_model_item('tenancy', 'contactassignment', _('Contact Assignments'), actions=['import']), + get_model_item('tenancy', 'contactassignment', _('Contact Assignments'), actions=['bulk_import']), ), ), ), @@ -386,7 +386,7 @@ OPERATIONS_MENU = Menu( label=_('Logging'), items=( get_model_item('extras', 'notificationgroup', _('Notification Groups')), - get_model_item('extras', 'journalentry', _('Journal Entries'), actions=['import']), + get_model_item('extras', 'journalentry', _('Journal Entries'), actions=['bulk_import']), get_model_item('core', 'objectchange', _('Change Log'), actions=[]), ), ), @@ -413,7 +413,7 @@ ADMIN_MENU = Menu( permissions=['users.add_user'] ), MenuItemButton( - link='users:user_import', + link='users:user_bulk_import', title='Import', icon_class='mdi mdi-upload', permissions=['users.add_user'] @@ -433,7 +433,7 @@ ADMIN_MENU = Menu( permissions=['users.add_group'] ), MenuItemButton( - link='users:group_import', + link='users:group_bulk_import', title='Import', icon_class='mdi mdi-upload', permissions=['users.add_group'] diff --git a/netbox/netbox/tests/test_import.py b/netbox/netbox/tests/test_import.py index 16711ef72..690a6dc14 100644 --- a/netbox/netbox/tests/test_import.py +++ b/netbox/netbox/tests/test_import.py @@ -37,7 +37,7 @@ class CSVImportTestCase(ModelViewTestCase): } # Form validation should fail with invalid header present - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 200) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 200) self.assertEqual(Region.objects.count(), 0) # Correct the CSV header name @@ -45,7 +45,7 @@ class CSVImportTestCase(ModelViewTestCase): data['data'] = self._get_csv_data(csv_data) # Validation should succeed - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(Region.objects.count(), 3) @override_settings(EXEMPT_VIEW_PERMISSIONS=['*']) @@ -71,10 +71,10 @@ class CSVImportTestCase(ModelViewTestCase): obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Try GET with model-level permission - self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) regions = Region.objects.all() self.assertEqual(regions.count(), 4) self.assertEqual( @@ -111,10 +111,10 @@ class CSVImportTestCase(ModelViewTestCase): obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Try GET with model-level permission - self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 200) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 200) self.assertEqual(Region.objects.count(), 0) @override_settings(EXEMPT_VIEW_PERMISSIONS=['*']) @@ -138,6 +138,6 @@ class CSVImportTestCase(ModelViewTestCase): ) cf.object_types.set([ObjectType.objects.get_for_model(self.model)]) - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) region = Region.objects.get(slug='region-1') self.assertEqual(region.cf['tcf'], 'def-cf-text') diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index fdd3cd3d8..e6d5505a4 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -34,7 +34,7 @@ Context: {% if 'add' in actions %} {% add_button model %} {% endif %} - {% if 'import' in actions %} + {% if 'bulk_import' in actions %} {% import_button model %} {% endif %} {% if 'export' in actions %} diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index 6f16842f6..0988d2e65 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -80,7 +80,7 @@ class TenantGroupDeleteView(generic.ObjectDeleteView): queryset = TenantGroup.objects.all() -@register_model_view(TenantGroup, 'import', detail=False) +@register_model_view(TenantGroup, 'bulk_import', detail=False) class TenantGroupBulkImportView(generic.BulkImportView): queryset = TenantGroup.objects.all() model_form = forms.TenantGroupImportForm @@ -147,7 +147,7 @@ class TenantDeleteView(generic.ObjectDeleteView): queryset = Tenant.objects.all() -@register_model_view(Tenant, 'import', detail=False) +@register_model_view(Tenant, 'bulk_import', detail=False) class TenantBulkImportView(generic.BulkImportView): queryset = Tenant.objects.all() model_form = forms.TenantImportForm @@ -215,7 +215,7 @@ class ContactGroupDeleteView(generic.ObjectDeleteView): queryset = ContactGroup.objects.all() -@register_model_view(ContactGroup, 'import', detail=False) +@register_model_view(ContactGroup, 'bulk_import', detail=False) class ContactGroupBulkImportView(generic.BulkImportView): queryset = ContactGroup.objects.all() model_form = forms.ContactGroupImportForm @@ -282,7 +282,7 @@ class ContactRoleDeleteView(generic.ObjectDeleteView): queryset = ContactRole.objects.all() -@register_model_view(ContactRole, 'import', detail=False) +@register_model_view(ContactRole, 'bulk_import', detail=False) class ContactRoleBulkImportView(generic.BulkImportView): queryset = ContactRole.objects.all() model_form = forms.ContactRoleImportForm @@ -334,7 +334,7 @@ class ContactDeleteView(generic.ObjectDeleteView): queryset = Contact.objects.all() -@register_model_view(Contact, 'import', detail=False) +@register_model_view(Contact, 'bulk_import', detail=False) class ContactBulkImportView(generic.BulkImportView): queryset = Contact.objects.all() model_form = forms.ContactImportForm @@ -370,8 +370,8 @@ class ContactAssignmentListView(generic.ObjectListView): filterset_form = forms.ContactAssignmentFilterForm table = tables.ContactAssignmentTable actions = { - 'import': {'add'}, 'export': {'view'}, + 'bulk_import': {'add'}, 'bulk_edit': {'change'}, 'bulk_delete': {'delete'}, } @@ -397,7 +397,7 @@ class ContactAssignmentEditView(generic.ObjectEditView): } -@register_model_view(ContactAssignment, 'import', detail=False) +@register_model_view(ContactAssignment, 'bulk_import', detail=False) class ContactAssignmentBulkImportView(generic.BulkImportView): queryset = ContactAssignment.objects.all() model_form = forms.ContactAssignmentImportForm diff --git a/netbox/users/views.py b/netbox/users/views.py index 904a44674..ca928e582 100644 --- a/netbox/users/views.py +++ b/netbox/users/views.py @@ -38,7 +38,7 @@ class TokenDeleteView(generic.ObjectDeleteView): queryset = Token.objects.all() -@register_model_view(Token, 'import', detail=False) +@register_model_view(Token, 'bulk_import', detail=False) class TokenBulkImportView(generic.BulkImportView): queryset = Token.objects.all() model_form = forms.TokenImportForm @@ -95,7 +95,7 @@ class UserDeleteView(generic.ObjectDeleteView): queryset = User.objects.all() -@register_model_view(User, 'import', detail=False) +@register_model_view(User, 'bulk_import', detail=False) class UserBulkImportView(generic.BulkImportView): queryset = User.objects.all() model_form = forms.UserImportForm @@ -146,7 +146,7 @@ class GroupDeleteView(generic.ObjectDeleteView): queryset = Group.objects.all() -@register_model_view(Group, 'import', detail=False) +@register_model_view(Group, 'bulk_import', detail=False) class GroupBulkImportView(generic.BulkImportView): queryset = Group.objects.all() model_form = forms.GroupImportForm diff --git a/netbox/utilities/templatetags/buttons.py b/netbox/utilities/templatetags/buttons.py index 675fa98eb..d38c8863f 100644 --- a/netbox/utilities/templatetags/buttons.py +++ b/netbox/utilities/templatetags/buttons.py @@ -158,7 +158,7 @@ def add_button(model, action='add'): @register.inclusion_tag('buttons/import.html') -def import_button(model, action='import'): +def import_button(model, action='bulk_import'): try: url = reverse(get_viewname(model, action)) except NoReverseMatch: diff --git a/netbox/utilities/testing/views.py b/netbox/utilities/testing/views.py index 18c767bd0..c451649ff 100644 --- a/netbox/utilities/testing/views.py +++ b/netbox/utilities/testing/views.py @@ -594,10 +594,10 @@ class ViewTestCases: # Test GET without permission with disable_warnings('django.request'): - self.assertHttpStatus(self.client.get(self._get_url('import')), 403) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 403) # Try POST without permission - response = self.client.post(self._get_url('import'), data) + response = self.client.post(self._get_url('bulk_import'), data) with disable_warnings('django.request'): self.assertHttpStatus(response, 403) @@ -620,10 +620,10 @@ class ViewTestCases: obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Try GET with model-level permission - self.assertHttpStatus(self.client.get(self._get_url('import')), 200) + self.assertHttpStatus(self.client.get(self._get_url('bulk_import')), 200) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(self._get_queryset().count(), initial_count + len(self.csv_data) - 1) @override_settings(EXEMPT_VIEW_PERMISSIONS=['*']) @@ -649,7 +649,7 @@ class ViewTestCases: obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Test POST with permission - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(initial_count, self._get_queryset().count()) reader = csv.DictReader(array, delimiter=',') @@ -684,7 +684,7 @@ class ViewTestCases: obj_perm.object_types.add(ObjectType.objects.get_for_model(self.model)) # Attempt to import non-permitted objects - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 200) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 200) self.assertEqual(self._get_queryset().count(), initial_count) # Update permission constraints @@ -692,7 +692,7 @@ class ViewTestCases: obj_perm.save() # Import permitted objects - self.assertHttpStatus(self.client.post(self._get_url('import'), data), 302) + self.assertHttpStatus(self.client.post(self._get_url('bulk_import'), data), 302) self.assertEqual(self._get_queryset().count(), initial_count + len(self.csv_data) - 1) class BulkEditObjectsViewTestCase(ModelViewTestCase): diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index ccba12239..46613b742 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -63,7 +63,7 @@ class ClusterTypeDeleteView(generic.ObjectDeleteView): queryset = ClusterType.objects.all() -@register_model_view(ClusterType, 'import', detail=False) +@register_model_view(ClusterType, 'bulk_import', detail=False) class ClusterTypeBulkImportView(generic.BulkImportView): queryset = ClusterType.objects.all() model_form = forms.ClusterTypeImportForm @@ -124,7 +124,7 @@ class ClusterGroupDeleteView(generic.ObjectDeleteView): queryset = ClusterGroup.objects.all() -@register_model_view(ClusterGroup, 'import', detail=False) +@register_model_view(ClusterGroup, 'bulk_import', detail=False) class ClusterGroupBulkImportView(generic.BulkImportView): queryset = ClusterGroup.objects.annotate( cluster_count=count_related(Cluster, 'group') @@ -212,8 +212,8 @@ class ClusterDevicesView(generic.ObjectChildrenView): template_name = 'virtualization/cluster/devices.html' actions = { 'add': {'add'}, - 'import': {'add'}, 'export': {'view'}, + 'bulk_import': {'add'}, 'bulk_edit': {'change'}, 'bulk_remove_devices': {'change'}, } @@ -240,7 +240,7 @@ class ClusterDeleteView(generic.ObjectDeleteView): queryset = Cluster.objects.all() -@register_model_view(Cluster, 'import', detail=False) +@register_model_view(Cluster, 'bulk_import', detail=False) class ClusterBulkImportView(generic.BulkImportView): queryset = Cluster.objects.all() model_form = forms.ClusterImportForm @@ -489,7 +489,7 @@ class VirtualMachineDeleteView(generic.ObjectDeleteView): queryset = VirtualMachine.objects.all() -@register_model_view(VirtualMachine, 'import', detail=False) +@register_model_view(VirtualMachine, 'bulk_import', detail=False) class VirtualMachineBulkImportView(generic.BulkImportView): queryset = VirtualMachine.objects.all() model_form = forms.VirtualMachineImportForm @@ -588,7 +588,7 @@ class VMInterfaceDeleteView(generic.ObjectDeleteView): queryset = VMInterface.objects.all() -@register_model_view(VMInterface, 'import', detail=False) +@register_model_view(VMInterface, 'bulk_import', detail=False) class VMInterfaceBulkImportView(generic.BulkImportView): queryset = VMInterface.objects.all() model_form = forms.VMInterfaceImportForm @@ -651,7 +651,7 @@ class VirtualDiskDeleteView(generic.ObjectDeleteView): queryset = VirtualDisk.objects.all() -@register_model_view(VirtualDisk, 'import', detail=False) +@register_model_view(VirtualDisk, 'bulk_import', detail=False) class VirtualDiskBulkImportView(generic.BulkImportView): queryset = VirtualDisk.objects.all() model_form = forms.VirtualDiskImportForm diff --git a/netbox/vpn/views.py b/netbox/vpn/views.py index f1546bfbe..3372e9412 100644 --- a/netbox/vpn/views.py +++ b/netbox/vpn/views.py @@ -43,7 +43,7 @@ class TunnelGroupDeleteView(generic.ObjectDeleteView): queryset = TunnelGroup.objects.all() -@register_model_view(TunnelGroup, 'import', detail=False) +@register_model_view(TunnelGroup, 'bulk_import', detail=False) class TunnelGroupBulkImportView(generic.BulkImportView): queryset = TunnelGroup.objects.all() model_form = forms.TunnelGroupImportForm @@ -107,7 +107,7 @@ class TunnelDeleteView(generic.ObjectDeleteView): queryset = Tunnel.objects.all() -@register_model_view(Tunnel, 'import', detail=False) +@register_model_view(Tunnel, 'bulk_import', detail=False) class TunnelBulkImportView(generic.BulkImportView): queryset = Tunnel.objects.all() model_form = forms.TunnelImportForm @@ -161,7 +161,7 @@ class TunnelTerminationDeleteView(generic.ObjectDeleteView): queryset = TunnelTermination.objects.all() -@register_model_view(TunnelTermination, 'import', detail=False) +@register_model_view(TunnelTermination, 'bulk_import', detail=False) class TunnelTerminationBulkImportView(generic.BulkImportView): queryset = TunnelTermination.objects.all() model_form = forms.TunnelTerminationImportForm @@ -211,7 +211,7 @@ class IKEProposalDeleteView(generic.ObjectDeleteView): queryset = IKEProposal.objects.all() -@register_model_view(IKEProposal, 'import', detail=False) +@register_model_view(IKEProposal, 'bulk_import', detail=False) class IKEProposalBulkImportView(generic.BulkImportView): queryset = IKEProposal.objects.all() model_form = forms.IKEProposalImportForm @@ -261,7 +261,7 @@ class IKEPolicyDeleteView(generic.ObjectDeleteView): queryset = IKEPolicy.objects.all() -@register_model_view(IKEPolicy, 'import', detail=False) +@register_model_view(IKEPolicy, 'bulk_import', detail=False) class IKEPolicyBulkImportView(generic.BulkImportView): queryset = IKEPolicy.objects.all() model_form = forms.IKEPolicyImportForm @@ -311,7 +311,7 @@ class IPSecProposalDeleteView(generic.ObjectDeleteView): queryset = IPSecProposal.objects.all() -@register_model_view(IPSecProposal, 'import', detail=False) +@register_model_view(IPSecProposal, 'bulk_import', detail=False) class IPSecProposalBulkImportView(generic.BulkImportView): queryset = IPSecProposal.objects.all() model_form = forms.IPSecProposalImportForm @@ -361,7 +361,7 @@ class IPSecPolicyDeleteView(generic.ObjectDeleteView): queryset = IPSecPolicy.objects.all() -@register_model_view(IPSecPolicy, 'import', detail=False) +@register_model_view(IPSecPolicy, 'bulk_import', detail=False) class IPSecPolicyBulkImportView(generic.BulkImportView): queryset = IPSecPolicy.objects.all() model_form = forms.IPSecPolicyImportForm @@ -411,7 +411,7 @@ class IPSecProfileDeleteView(generic.ObjectDeleteView): queryset = IPSecProfile.objects.all() -@register_model_view(IPSecProfile, 'import', detail=False) +@register_model_view(IPSecProfile, 'bulk_import', detail=False) class IPSecProfileBulkImportView(generic.BulkImportView): queryset = IPSecProfile.objects.all() model_form = forms.IPSecProfileImportForm @@ -476,7 +476,7 @@ class L2VPNDeleteView(generic.ObjectDeleteView): queryset = L2VPN.objects.all() -@register_model_view(L2VPN, 'import', detail=False) +@register_model_view(L2VPN, 'bulk_import', detail=False) class L2VPNBulkImportView(generic.BulkImportView): queryset = L2VPN.objects.all() model_form = forms.L2VPNImportForm @@ -531,7 +531,7 @@ class L2VPNTerminationDeleteView(generic.ObjectDeleteView): queryset = L2VPNTermination.objects.all() -@register_model_view(L2VPNTermination, 'import', detail=False) +@register_model_view(L2VPNTermination, 'bulk_import', detail=False) class L2VPNTerminationBulkImportView(generic.BulkImportView): queryset = L2VPNTermination.objects.all() model_form = forms.L2VPNTerminationImportForm diff --git a/netbox/wireless/views.py b/netbox/wireless/views.py index 6c5ae6f94..c03564b27 100644 --- a/netbox/wireless/views.py +++ b/netbox/wireless/views.py @@ -48,7 +48,7 @@ class WirelessLANGroupDeleteView(generic.ObjectDeleteView): queryset = WirelessLANGroup.objects.all() -@register_model_view(WirelessLANGroup, 'import', detail=False) +@register_model_view(WirelessLANGroup, 'bulk_import', detail=False) class WirelessLANGroupBulkImportView(generic.BulkImportView): queryset = WirelessLANGroup.objects.all() model_form = forms.WirelessLANGroupImportForm @@ -123,7 +123,7 @@ class WirelessLANDeleteView(generic.ObjectDeleteView): queryset = WirelessLAN.objects.all() -@register_model_view(WirelessLAN, 'import', detail=False) +@register_model_view(WirelessLAN, 'bulk_import', detail=False) class WirelessLANBulkImportView(generic.BulkImportView): queryset = WirelessLAN.objects.all() model_form = forms.WirelessLANImportForm @@ -173,7 +173,7 @@ class WirelessLinkDeleteView(generic.ObjectDeleteView): queryset = WirelessLink.objects.all() -@register_model_view(WirelessLink, 'import', detail=False) +@register_model_view(WirelessLink, 'bulk_import', detail=False) class WirelessLinkBulkImportView(generic.BulkImportView): queryset = WirelessLink.objects.all() model_form = forms.WirelessLinkImportForm From 14d769a501d8a1a103e795ca667aba595b2030e2 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 22 Nov 2024 13:39:52 -0500 Subject: [PATCH 37/65] Draft v4.2 release notes --- docs/release-notes/version-4.2.md | 118 ++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/release-notes/version-4.2.md diff --git a/docs/release-notes/version-4.2.md b/docs/release-notes/version-4.2.md new file mode 100644 index 000000000..c32bddaeb --- /dev/null +++ b/docs/release-notes/version-4.2.md @@ -0,0 +1,118 @@ +# NetBox v4.2 + +## v4.2.0 (FUTURE) + +### Breaking Changes + +* Support for the Django admin UI has been completely removed. (The Django admin UI was disabled by default in NetBox v4.0.) +* NetBox has adopted collation-based natural ordering for many models. This may alter the order in which some objects are listed by default. +* The `site` and `provider_network` foreign key fields on `circuits.CircuitTermination` have been replaced by the `termination` generic foreign key. +* The `site` foreign key field on `ipam.Prefix` has been replaced by the `scope` generic foreign key. +* The `site` foreign key field on `virtualization.Cluster` has been replaced by the `scope` generic foreign key. +* Obsolete nested REST API serializers have been removed. These were deprecated in NetBox v4.1 under [#17143](https://github.com/netbox-community/netbox/issues/17143). + +### New Features + +#### Assign Multiple MAC Addresses per Interface ([#4867](https://github.com/netbox-community/netbox/issues/4867)) + +MAC addresses are now managed as independent objects, rather than attributes on device and VM interfaces. NetBox now supports the assignment of multiple MAC addresses per interface, and allows a primary MAC address to be designated for each. + +#### Quick Add UI Widget ([#5858](https://github.com/netbox-community/netbox/issues/5858)) + +A new UI widget has been introduced to enable conveniently creating new related objects while creating or editing an object. For instance, it is now possible to create and assign a new device role when creating or editing a device from within the device form. + +#### VLAN Translation ([#7336](https://github.com/netbox-community/netbox/issues/7336)) + +User can now define policies which track the translation of VLAN IDs on IEEE 802.1Q-encapsulated interfaces. Translation policies can be reused across multiple interfaces. + +#### Virtual Circuits ([#13086](https://github.com/netbox-community/netbox/issues/13086)) + +New models have been introduced to support the documentation of virtual circuits as an extension to the physical circuit modeling already supported. This enables users to accurately reflect point-to-point or multipoint virtual circuits atop infrastructure comprising physical circuits and cables. + +#### Q-in-Q Encapsulation ([#13428](https://github.com/netbox-community/netbox/issues/13428)) + +NetBox now supports the designation of customer VLANs (CVLANs) and service VLANs (SVLANs) to support IEEE 802.1ad/Q-in-Q encapsulation. Each interface can now have it mode designated "Q-in-Q" and be assigned an SVLAN. + +### Enhancements + +* [#6414](https://github.com/netbox-community/netbox/issues/6414) - Prefixes can now be scoped by region, site group, site, or location +* [#7699](https://github.com/netbox-community/netbox/issues/7699) - Virtualization clusters can now be scoped by region, site group, site, or location +* [#9604](https://github.com/netbox-community/netbox/issues/9604) - The scope of a circuit termination now include a region, site group, site, location, or provider network +* [#10711](https://github.com/netbox-community/netbox/issues/10711) - Wireless LANs can now be scoped by region, site group, site, or location +* [#11279](https://github.com/netbox-community/netbox/issues/11279) - Improved the use of natural ordering for various models throughout the application +* [#12596](https://github.com/netbox-community/netbox/issues/12596) - Extended the virtualization clusters REST API endpoint to report on allocated VM resources +* [#16547](https://github.com/netbox-community/netbox/issues/16547) - Add a geographic distance field for circuits +* [#16783](https://github.com/netbox-community/netbox/issues/16783) - Add an operational status field for inventory items +* [#17195](https://github.com/netbox-community/netbox/issues/17195) - Add a color field for power outlets + +### Plugins + +* [#15093](https://github.com/netbox-community/netbox/issues/15093) - Introduced the `events_pipeline` configuration parameter, which allows plugins to hook into NetBox event processing +* [#16546](https://github.com/netbox-community/netbox/issues/16546) - NetBoxModel now provides a default `get_absolute_url()` method +* [#16971](https://github.com/netbox-community/netbox/issues/16971) - Plugins can now easily register system jobs to perform background tasks +* [#17029](https://github.com/netbox-community/netbox/issues/17029) - Registering a `PluginTemplateExtension` subclass for a single model has been deprecated (replace `model` with `models`) +* [#18023](https://github.com/netbox-community/netbox/issues/18023) - Extend `register_model_view()` to handle list views + +### Other Changes + +* [#16136](https://github.com/netbox-community/netbox/issues/16136) - Removed support for the Django admin UI +* [#17165](https://github.com/netbox-community/netbox/issues/17165) - All obsolete nested REST API serializers have been removed +* [#17472](https://github.com/netbox-community/netbox/issues/17472) - The legacy staged changes API has been deprecated, and will be removed in Netbox v4.3 +* [#17476](https://github.com/netbox-community/netbox/issues/17476) - Upgrade to Django 5.1 +* [#17752](https://github.com/netbox-community/netbox/issues/17752) - Bulk object import URL paths have been renamed from `*_import` to `*_bulk_import` +* [#17761](https://github.com/netbox-community/netbox/issues/17761) - Optional choice fields now store empty values as null (rather than empty strings) in the database + +### REST API Changes + +* Added the following endpoints: + * `/api/circuits/virtual-circuits/` + * `/api/circuits/virtual-circuit-terminations/` + * `/api/dcim/mac-addresses/` + * `/api/ipam/vlan-translation-policies/` + * `/api/ipam/vlan-translation-rules/` +* circuits.Circuit + * Added the optional `distance` and `distance_unit` fields +* circuits.CircuitTermination + * Removed the `site` & `provider_network` fields + * Added the `termination_type` & `termination_id` fields to facilitate termination assignment + * Added the read-only `termination` field +* dcim.Interface + * The `mac_address` field is now read-only + * Added the `primary_mac_address` relation to dcim.MACAddress + * Added the read-only `mac_addresses` list + * Added the `qinq_svlan` relation to ipam.VLAN + * Added the `vlan_translation_policy` relation to ipam.VLANTranslationPolicy + * Added `mode` choice "Q-in-Q" +* dcim.InventoryItem + * Added the optional `status` choice field +* dcim.Location + * Added the read-only `prefix_count` field +* dcim.PowerOutlet + * Added the optional `color` field +* dcim.Region + * Added the read-only `prefix_count` field +* dcim.SiteGroup + * Added the read-only `prefix_count` field +* ipam.Prefix + * Removed the `site` field + * Added the `scope_type` & `scope_id` fields to facilitate scope assignment + * Added the read-only `scope` field +* ipam.VLAN + * Added the optional `qinq_role` selection field + * Added the `qinq_svlan` recursive relation +* virtualization.Cluster + * Removed the `site` field + * Added the `scope_type` & `scope_id` fields to facilitate scope assignment + * Added the read-only `scope` field +* virtualization.Cluster + * Added the read-only fields `allocated_vcpus`, `allocated_memory`, and `allocated_disk` +* virtualization.VMInterface + * The `mac_address` field is now read-only + * Added the `primary_mac_address` relation to dcim.MACAddress + * Added the read-only `mac_addresses` list + * Added the `qinq_svlan` relation to ipam.VLAN + * Added the `vlan_translation_policy` relation to ipam.VLANTranslationPolicy + * Added `mode` choice "Q-in-Q" +* wireless.WirelessLAN + * Added the `scope_type` & `scope_id` fields to support scope assignment + * Added the read-only `scope` field From 0946a536f3d39fcbc137ab6fca1383ba2adcffe6 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 09:56:02 -0500 Subject: [PATCH 38/65] #4867: Misc cleanup --- netbox/dcim/forms/common.py | 3 ++- netbox/dcim/forms/model_forms.py | 6 ++++++ netbox/netbox/navigation/menu.py | 12 ++++++------ netbox/templates/dcim/interface.html | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/netbox/dcim/forms/common.py b/netbox/dcim/forms/common.py index 04c53b384..65d0d0f23 100644 --- a/netbox/dcim/forms/common.py +++ b/netbox/dcim/forms/common.py @@ -23,7 +23,8 @@ class InterfaceCommonForm(forms.Form): primary_mac_address = DynamicModelChoiceField( queryset=MACAddress.objects.all(), label=_('Primary MAC address'), - required=False + required=False, + quick_add=True ) def __init__(self, *args, **kwargs): diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 37cce9060..3e6d87ff0 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -1758,11 +1758,17 @@ class MACAddressForm(NetBoxModelForm): label=_('Interface'), queryset=Interface.objects.all(), required=False, + context={ + 'parent': 'device', + }, ) vminterface = DynamicModelChoiceField( label=_('VM Interface'), queryset=VMInterface.objects.all(), required=False, + context={ + 'parent': 'virtual_machine', + }, ) fieldsets = ( diff --git a/netbox/netbox/navigation/menu.py b/netbox/netbox/navigation/menu.py index cf0649ac0..fbbd3d0b1 100644 --- a/netbox/netbox/navigation/menu.py +++ b/netbox/netbox/navigation/menu.py @@ -88,12 +88,6 @@ DEVICES_MENU = Menu( get_model_item('dcim', 'manufacturer', _('Manufacturers')), ), ), - MenuGroup( - label=_('Addressing'), - items=( - get_model_item('dcim', 'macaddress', _('MAC Addresses')), - ), - ), MenuGroup( label=_('Device Components'), items=( @@ -110,6 +104,12 @@ DEVICES_MENU = Menu( get_model_item('dcim', 'inventoryitemrole', _('Inventory Item Roles')), ), ), + MenuGroup( + label=_('Addressing'), + items=( + get_model_item('dcim', 'macaddress', _('MAC Addresses')), + ), + ), ), ) diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index b0d307bee..1658dd37e 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -124,8 +124,8 @@ {% trans "MAC Address" %} - {% if object.mac_address %} - {{ object.mac_address }} + {% if object.primary_mac_address %} + {{ object.primary_mac_address|linkify }} {% trans "Primary" %} {% else %} {{ ''|placeholder }} From 5afa6d796418a4f7412ee03c07d2a491545f146a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 09:26:01 -0500 Subject: [PATCH 39/65] Closed #18093: Remove redirects for pre-v4.1 virtual disk views --- netbox/virtualization/urls.py | 6 +----- netbox/virtualization/views.py | 10 ---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/netbox/virtualization/urls.py b/netbox/virtualization/urls.py index 2aeeead77..679f6f229 100644 --- a/netbox/virtualization/urls.py +++ b/netbox/virtualization/urls.py @@ -1,4 +1,4 @@ -from django.urls import include, path, re_path +from django.urls import include, path from utilities.urls import get_model_urls from . import views @@ -33,8 +33,4 @@ urlpatterns = [ views.VirtualMachineBulkAddVirtualDiskView.as_view(), name='virtualmachine_bulk_add_virtualdisk' ), - - # TODO: Remove in v4.2 - # Redirect old (pre-v4.1) URLs for VirtualDisk views - re_path('disks/(?P[a-z0-9/-]*)', views.VirtualDiskRedirectView.as_view()), ] diff --git a/netbox/virtualization/views.py b/netbox/virtualization/views.py index 46613b742..ef42f94ef 100644 --- a/netbox/virtualization/views.py +++ b/netbox/virtualization/views.py @@ -7,7 +7,6 @@ from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from django.views.generic.base import RedirectView from jinja2.exceptions import TemplateError from dcim.filtersets import DeviceFilterSet @@ -678,15 +677,6 @@ class VirtualDiskBulkDeleteView(generic.BulkDeleteView): table = tables.VirtualDiskTable -# TODO: Remove in v4.2 -class VirtualDiskRedirectView(RedirectView): - """ - Redirect old (pre-v4.1) URLs for VirtualDisk views. - """ - def get_redirect_url(self, path): - return f"{reverse('virtualization:virtualdisk_list')}{path}" - - # # Bulk Device component creation # From 6d65d92c3871a3bfa31b5b2110fff7502edcfd16 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 13:26:17 -0500 Subject: [PATCH 40/65] #7336: Misc cleanup --- netbox/ipam/api/serializers_/vlans.py | 6 +++--- netbox/ipam/forms/bulk_import.py | 6 ++++++ netbox/ipam/models/vlans.py | 2 ++ netbox/ipam/tables/vlans.py | 9 +++++++-- netbox/ipam/tests/test_views.py | 14 +++++++------- netbox/ipam/views.py | 4 +++- netbox/templates/ipam/vlantranslationpolicy.html | 10 ++++++++++ 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/netbox/ipam/api/serializers_/vlans.py b/netbox/ipam/api/serializers_/vlans.py index 05fdd5813..9b5501dc5 100644 --- a/netbox/ipam/api/serializers_/vlans.py +++ b/netbox/ipam/api/serializers_/vlans.py @@ -121,7 +121,7 @@ class VLANTranslationRuleSerializer(NetBoxModelSerializer): class Meta: model = VLANTranslationRule - fields = ['id', 'policy', 'local_vid', 'remote_vid'] + fields = ['id', 'url', 'display', 'policy', 'local_vid', 'remote_vid', 'description'] class VLANTranslationPolicySerializer(NetBoxModelSerializer): @@ -129,5 +129,5 @@ class VLANTranslationPolicySerializer(NetBoxModelSerializer): class Meta: model = VLANTranslationPolicy - fields = ['id', 'url', 'name', 'description', 'display', 'rules'] - brief_fields = ('id', 'url', 'name', 'description', 'display') + fields = ['id', 'url', 'display', 'name', 'description', 'display', 'rules'] + brief_fields = ('id', 'url', 'display', 'name', 'description') diff --git a/netbox/ipam/forms/bulk_import.py b/netbox/ipam/forms/bulk_import.py index 7e1382be9..e8d48de7c 100644 --- a/netbox/ipam/forms/bulk_import.py +++ b/netbox/ipam/forms/bulk_import.py @@ -487,6 +487,12 @@ class VLANTranslationPolicyImportForm(NetBoxModelImportForm): class VLANTranslationRuleImportForm(NetBoxModelImportForm): + policy = CSVModelChoiceField( + label=_('Policy'), + queryset=VLANTranslationPolicy.objects.all(), + to_field_name='name', + help_text=_('VLAN translation policy') + ) class Meta: model = VLANTranslationRule diff --git a/netbox/ipam/models/vlans.py b/netbox/ipam/models/vlans.py index dfa814619..4c7f191c9 100644 --- a/netbox/ipam/models/vlans.py +++ b/netbox/ipam/models/vlans.py @@ -379,6 +379,8 @@ class VLANTranslationRule(NetBoxModel): 'ipam.VLANTranslationPolicy', ) + clone_fields = ['policy'] + class Meta: verbose_name = _('VLAN translation rule') ordering = ('policy', 'local_vid',) diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index e3d7c7e63..aa1900e41 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -231,6 +231,11 @@ class VLANTranslationPolicyTable(NetBoxTable): verbose_name=_('Name'), linkify=True ) + rule_count = columns.LinkedCountColumn( + viewname='ipam:vlantranslationrule_list', + url_params={'policy_id': 'pk'}, + verbose_name=_('Rules') + ) description = tables.Column( verbose_name=_('Description'), ) @@ -241,9 +246,9 @@ class VLANTranslationPolicyTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = VLANTranslationPolicy fields = ( - 'pk', 'id', 'name', 'description', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'rule_count', 'description', 'tags', 'created', 'last_updated', ) - default_columns = ('pk', 'name', 'description') + default_columns = ('pk', 'name', 'rule_count', 'description') class VLANTranslationRuleTable(NetBoxTable): diff --git a/netbox/ipam/tests/test_views.py b/netbox/ipam/tests/test_views.py index e9903d766..d7d367bb7 100644 --- a/netbox/ipam/tests/test_views.py +++ b/netbox/ipam/tests/test_views.py @@ -973,16 +973,16 @@ class VLANTranslationRuleTestCase(ViewTestCases.PrimaryObjectViewTestCase): cls.csv_data = ( "policy,local_vid,remote_vid", - f"{vlan_translation_policies[0].pk},103,203", - f"{vlan_translation_policies[0].pk},104,204", - f"{vlan_translation_policies[1].pk},105,205", + f"{vlan_translation_policies[0].name},103,203", + f"{vlan_translation_policies[0].name},104,204", + f"{vlan_translation_policies[1].name},105,205", ) cls.csv_update_data = ( - "id,policy,local_vid,remote_vid", - f"{vlan_translation_rules[0].pk},{vlan_translation_policies[1].pk},105,205", - f"{vlan_translation_rules[1].pk},{vlan_translation_policies[1].pk},106,206", - f"{vlan_translation_rules[2].pk},{vlan_translation_policies[0].pk},107,207", + "id,local_vid,remote_vid", + f"{vlan_translation_rules[0].pk},105,205", + f"{vlan_translation_rules[1].pk},106,206", + f"{vlan_translation_rules[2].pk},107,207", ) cls.bulk_edit_data = { diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index f83934906..f145716e9 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -1050,7 +1050,9 @@ class VLANGroupVLANsView(generic.ObjectChildrenView): @register_model_view(VLANTranslationPolicy, 'list', path='', detail=False) class VLANTranslationPolicyListView(generic.ObjectListView): - queryset = VLANTranslationPolicy.objects.all() + queryset = VLANTranslationPolicy.objects.annotate( + rule_count=count_related(VLANTranslationRule, 'policy'), + ) filterset = filtersets.VLANTranslationPolicyFilterSet filterset_form = forms.VLANTranslationPolicyFilterForm table = tables.VLANTranslationPolicyTable diff --git a/netbox/templates/ipam/vlantranslationpolicy.html b/netbox/templates/ipam/vlantranslationpolicy.html index 5217db913..58a1201d4 100644 --- a/netbox/templates/ipam/vlantranslationpolicy.html +++ b/netbox/templates/ipam/vlantranslationpolicy.html @@ -18,6 +18,16 @@ {% trans "Description" %} {{ object.description|placeholder }} + + {% trans "Rules" %} + + {% if object.rules.count %} + {{ object.rules.count }} + {% else %} + 0 + {% endif %} + +
    {% plugin_left_page object %} From 02cbdc10f20fa6699b291c2367b61af0250172b4 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 13:28:17 -0500 Subject: [PATCH 41/65] #9604: Remove provider_network from CircuitTerminationSerializer & CircuitCircuitTerminationSerializer --- netbox/circuits/api/serializers_/circuits.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index 70644a7b7..9b25c3af2 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -54,13 +54,12 @@ class CircuitCircuitTerminationSerializer(WritableNestedSerializer): ) termination_id = serializers.IntegerField(allow_null=True, required=False, default=None) termination = serializers.SerializerMethodField(read_only=True) - provider_network = ProviderNetworkSerializer(nested=True, allow_null=True) class Meta: model = CircuitTermination fields = [ - 'id', 'url', 'display_url', 'display', 'termination_type', 'termination_id', 'termination', - 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'description', + 'id', 'url', 'display_url', 'display', 'termination_type', 'termination_id', 'termination', 'port_speed', + 'upstream_speed', 'xconnect_id', 'description', ] @extend_schema_field(serializers.JSONField(allow_null=True)) @@ -133,15 +132,14 @@ class CircuitTerminationSerializer(NetBoxModelSerializer, CabledObjectSerializer ) termination_id = serializers.IntegerField(allow_null=True, required=False, default=None) termination = serializers.SerializerMethodField(read_only=True) - provider_network = ProviderNetworkSerializer(nested=True, required=False, allow_null=True) class Meta: model = CircuitTermination fields = [ 'id', 'url', 'display_url', 'display', 'circuit', 'term_side', 'termination_type', 'termination_id', - 'termination', 'provider_network', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', - 'mark_connected', 'cable', 'cable_end', 'link_peers', 'link_peers_type', 'tags', 'custom_fields', 'created', - 'last_updated', '_occupied', + 'termination', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info', 'description', 'mark_connected', + 'cable', 'cable_end', 'link_peers', 'link_peers_type', 'tags', 'custom_fields', 'created', 'last_updated', + '_occupied', ] brief_fields = ('id', 'url', 'display', 'circuit', 'term_side', 'description', 'cable', '_occupied') From dd29c0ede56873522fa8989ef926d4f2093fe25b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 13:35:15 -0500 Subject: [PATCH 42/65] #16136: Remove obsolete accommodation for Django admin UI --- netbox/templates/django/forms/widgets/checkbox.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/netbox/templates/django/forms/widgets/checkbox.html b/netbox/templates/django/forms/widgets/checkbox.html index f769fce96..8a1e1d23a 100644 --- a/netbox/templates/django/forms/widgets/checkbox.html +++ b/netbox/templates/django/forms/widgets/checkbox.html @@ -1,7 +1,6 @@ {% comment %} Include a hidden field of the same name to ensure that unchecked checkboxes - are always included in the submitted form data. Omit fields names - _selected_action to avoid breaking the admin UI. + are always included in the submitted form data. {% endcomment %} -{% if widget.name != '_selected_action' %}{% endif %} + From b45b8f3a4d217494050533c1251dac601230fbe0 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 14:02:45 -0500 Subject: [PATCH 43/65] #7336: Correct API test --- netbox/ipam/tests/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/ipam/tests/test_api.py b/netbox/ipam/tests/test_api.py index cbcb2e7c8..e9dcacc16 100644 --- a/netbox/ipam/tests/test_api.py +++ b/netbox/ipam/tests/test_api.py @@ -1080,7 +1080,7 @@ class VLANTranslationPolicyTest(APIViewTestCases.APIViewTestCase): class VLANTranslationRuleTest(APIViewTestCases.APIViewTestCase): model = VLANTranslationRule - brief_fields = ['id', 'local_vid', 'policy', 'remote_vid',] + brief_fields = ['description', 'display', 'id', 'local_vid', 'policy', 'remote_vid', 'url'] @classmethod def setUpTestData(cls): From 17189456c9e2d54e4ab67c1b38932c96d31b3968 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 14:51:59 -0500 Subject: [PATCH 44/65] #13086: Include button to terminate virtual circuit on interfaces table --- netbox/dcim/tables/template_code.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index e6f2c8817..449d55e14 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -390,6 +390,15 @@ INTERFACE_BUTTONS = """ {% endif %} + {% if perms.circuits.add_virtualcircuittermination and not record.virtual_circuit_termination %} + + + + {% elif perms.circuits.delete_virtualcircuittermination and record.virtual_circuit_termination %} + + + + {% endif %} {% elif record.is_wired and perms.dcim.add_cable %} From f17545788f8cb690c5e2b5bd9aebea020b2f0239 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 15:26:20 -0500 Subject: [PATCH 45/65] #16547: Reorder API serializer fields for Circuit --- netbox/circuits/api/serializers_/circuits.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index 9b25c3af2..0365dca33 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -104,18 +104,19 @@ class CircuitSerializer(NetBoxModelSerializer): provider_account = ProviderAccountSerializer(nested=True, required=False, allow_null=True, default=None) status = ChoiceField(choices=CircuitStatusChoices, required=False) type = CircuitTypeSerializer(nested=True) + distance_unit = ChoiceField(choices=DistanceUnitChoices, allow_blank=True, required=False, allow_null=True) tenant = TenantSerializer(nested=True, required=False, allow_null=True) termination_a = CircuitCircuitTerminationSerializer(read_only=True, allow_null=True) termination_z = CircuitCircuitTerminationSerializer(read_only=True, allow_null=True) assignments = CircuitGroupAssignmentSerializer_(nested=True, many=True, required=False) - distance_unit = ChoiceField(choices=DistanceUnitChoices, allow_blank=True, required=False, allow_null=True) class Meta: model = Circuit fields = [ 'id', 'url', 'display_url', 'display', 'cid', 'provider', 'provider_account', 'type', 'status', 'tenant', - 'install_date', 'termination_date', 'commit_rate', 'description', 'termination_a', 'termination_z', - 'distance', 'distance_unit', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'assignments', + 'install_date', 'termination_date', 'commit_rate', 'description', 'distance', 'distance_unit', + 'termination_a', 'termination_z', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'assignments', ] brief_fields = ('id', 'url', 'display', 'provider', 'cid', 'description') From b841875f6375990a4bf066abb888a6eb8ffeef05 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 15:30:15 -0500 Subject: [PATCH 46/65] #16783: Misc cleanup --- netbox/dcim/forms/filtersets.py | 2 +- netbox/templates/dcim/inventoryitem.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/forms/filtersets.py b/netbox/dcim/forms/filtersets.py index 4a373a996..37b8afd17 100644 --- a/netbox/dcim/forms/filtersets.py +++ b/netbox/dcim/forms/filtersets.py @@ -1524,7 +1524,7 @@ class InventoryItemFilterForm(DeviceComponentFilterForm): fieldsets = ( FieldSet('q', 'filter_id', 'tag'), FieldSet( - 'name', 'label', 'role_id', 'manufacturer_id', 'serial', 'asset_tag', 'discovered', + 'name', 'label', 'status', 'role_id', 'manufacturer_id', 'serial', 'asset_tag', 'discovered', name=_('Attributes') ), FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_('Location')), diff --git a/netbox/templates/dcim/inventoryitem.html b/netbox/templates/dcim/inventoryitem.html index f17bf2ade..fd8ea42eb 100644 --- a/netbox/templates/dcim/inventoryitem.html +++ b/netbox/templates/dcim/inventoryitem.html @@ -32,6 +32,10 @@ {% trans "Label" %} {{ object.label|placeholder }} + + {% trans "Status" %} + {% badge object.get_status_display bg_color=object.get_status_color %} + {% trans "Role" %} {{ object.role|linkify|placeholder }} @@ -56,10 +60,6 @@ {% trans "Asset Tag" %} {{ object.asset_tag|placeholder }} - - {% trans "Status" %} - {% badge object.get_status_display bg_color=object.get_status_color %} - {% trans "Description" %} {{ object.description|placeholder }} From d093b21bc0047f42d4e3b287f98f6403ac695480 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Nov 2024 16:50:53 -0500 Subject: [PATCH 47/65] #17761: Set null=True on Site.time_zone --- netbox/dcim/migrations/0194_charfield_null_choices.py | 8 ++++++++ netbox/dcim/models/sites.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/migrations/0194_charfield_null_choices.py b/netbox/dcim/migrations/0194_charfield_null_choices.py index 83c056386..e13b0e10d 100644 --- a/netbox/dcim/migrations/0194_charfield_null_choices.py +++ b/netbox/dcim/migrations/0194_charfield_null_choices.py @@ -1,3 +1,4 @@ +import timezone_field.fields from django.db import migrations, models @@ -24,6 +25,7 @@ def set_null_values(apps, schema_editor): Rack = apps.get_model('dcim', 'Rack') RackType = apps.get_model('dcim', 'RackType') RearPort = apps.get_model('dcim', 'RearPort') + Site = apps.get_model('dcim', 'Site') Cable.objects.filter(length_unit='').update(length_unit=None) Cable.objects.filter(type='').update(type=None) @@ -66,6 +68,7 @@ def set_null_values(apps, schema_editor): RackType.objects.filter(outer_unit='').update(outer_unit=None) RackType.objects.filter(weight_unit='').update(weight_unit=None) RearPort.objects.filter(cable_end='').update(cable_end=None) + Site.objects.filter(time_zone='').update(time_zone=None) class Migration(migrations.Migration): @@ -279,5 +282,10 @@ class Migration(migrations.Migration): name='cable_end', field=models.CharField(blank=True, max_length=1, null=True), ), + migrations.AlterField( + model_name='site', + name='time_zone', + field=timezone_field.fields.TimeZoneField(blank=True, null=True), + ), migrations.RunPython(code=set_null_values, reverse_code=migrations.RunPython.noop), ] diff --git a/netbox/dcim/models/sites.py b/netbox/dcim/models/sites.py index 0985a8d7a..7880a067f 100644 --- a/netbox/dcim/models/sites.py +++ b/netbox/dcim/models/sites.py @@ -189,7 +189,8 @@ class Site(ContactsMixin, ImageAttachmentsMixin, PrimaryModel): blank=True ) time_zone = TimeZoneField( - blank=True + blank=True, + null=True ) physical_address = models.CharField( verbose_name=_('physical address'), From 9b4b56febc3e1078fb1e18d05a4439d271b89fde Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2024 09:56:33 -0500 Subject: [PATCH 48/65] #13428: Misc cleanup --- netbox/dcim/forms/bulk_edit.py | 15 +++++++++++++-- netbox/dcim/forms/model_forms.py | 2 +- netbox/ipam/choices.py | 4 ++-- netbox/ipam/forms/bulk_import.py | 2 +- netbox/templates/dcim/interface.html | 6 ++++++ netbox/templates/ipam/vlan.html | 6 +++--- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 654459fce..dccca1bdf 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -7,6 +7,7 @@ from dcim.choices import * from dcim.constants import * from dcim.models import * from extras.models import ConfigTemplate +from ipam.choices import VLANQinQRoleChoices from ipam.models import ASN, VLAN, VLANGroup, VRF from netbox.choices import * from netbox.forms import NetBoxModelBulkEditForm @@ -1522,6 +1523,16 @@ class InterfaceBulkEditForm( 'available_on_device': '$device', } ) + qinq_svlan = DynamicModelChoiceField( + queryset=VLAN.objects.all(), + required=False, + label=_('Q-in-Q Service VLAN'), + query_params={ + 'group_id': '$vlan_group', + 'available_on_device': '$device', + 'qinq_role': VLANQinQRoleChoices.ROLE_SERVICE, + } + ) vrf = DynamicModelChoiceField( queryset=VRF.objects.all(), required=False, @@ -1548,7 +1559,7 @@ class InterfaceBulkEditForm( FieldSet('vdcs', 'mtu', 'tx_power', 'enabled', 'mgmt_only', 'mark_connected', name=_('Operation')), FieldSet('poe_mode', 'poe_type', name=_('PoE')), FieldSet('parent', 'bridge', 'lag', name=_('Related Interfaces')), - FieldSet('mode', 'vlan_group', 'untagged_vlan', name=_('802.1Q Switching')), + FieldSet('mode', 'vlan_group', 'untagged_vlan', 'qinq_svlan', name=_('802.1Q Switching')), FieldSet( TabbedGroups( FieldSet('tagged_vlans', name=_('Assignment')), @@ -1563,7 +1574,7 @@ class InterfaceBulkEditForm( nullable_fields = ( 'module', 'label', 'parent', 'bridge', 'lag', 'speed', 'duplex', 'wwn', 'vdcs', 'mtu', 'description', 'poe_mode', 'poe_type', 'mode', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', - 'untagged_vlan', 'tagged_vlans', 'vrf', 'wireless_lans' + 'untagged_vlan', 'tagged_vlans', 'qinq_svlan', 'vrf', 'wireless_lans' ) def __init__(self, *args, **kwargs): diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 3e6d87ff0..d6fdb21e2 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -1395,7 +1395,7 @@ class InterfaceForm(InterfaceCommonForm, ModularDeviceComponentForm): 'available_on_device': '$device', } ) - qinq_svlan = DynamicModelMultipleChoiceField( + qinq_svlan = DynamicModelChoiceField( queryset=VLAN.objects.all(), required=False, label=_('Q-in-Q Service VLAN'), diff --git a/netbox/ipam/choices.py b/netbox/ipam/choices.py index 4d9c0bdd4..51b65a6da 100644 --- a/netbox/ipam/choices.py +++ b/netbox/ipam/choices.py @@ -159,8 +159,8 @@ class VLANStatusChoices(ChoiceSet): class VLANQinQRoleChoices(ChoiceSet): - ROLE_SERVICE = 's-vlan' - ROLE_CUSTOMER = 'c-vlan' + ROLE_SERVICE = 'svlan' + ROLE_CUSTOMER = 'cvlan' CHOICES = [ (ROLE_SERVICE, _('Service'), 'blue'), diff --git a/netbox/ipam/forms/bulk_import.py b/netbox/ipam/forms/bulk_import.py index e8d48de7c..0b37665d5 100644 --- a/netbox/ipam/forms/bulk_import.py +++ b/netbox/ipam/forms/bulk_import.py @@ -459,7 +459,7 @@ class VLANImportForm(NetBoxModelImportForm): ) qinq_role = CSVChoiceField( label=_('Q-in-Q role'), - choices=VLANStatusChoices, + choices=VLANQinQRoleChoices, required=False, help_text=_('Operational status') ) diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 1658dd37e..510780dd9 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -81,6 +81,12 @@ {% trans "802.1Q Mode" %} {{ object.get_mode_display|placeholder }} + {% if object.mode == 'q-in-q' %} + + {% trans "Q-in-Q SVLAN" %} + {{ object.qinq_svlan|linkify|placeholder }} + + {% endif %} {% trans "Transmit power (dBm)" %} {{ object.tx_power|placeholder }} diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html index a10a1439a..fa480f2f6 100644 --- a/netbox/templates/ipam/vlan.html +++ b/netbox/templates/ipam/vlan.html @@ -72,7 +72,7 @@ {% endif %} - {% if object.qinq_role == 'c-vlan' %} + {% if object.qinq_role == 'cvlan' %} {% trans "Q-in-Q SVLAN" %} {{ object.qinq_svlan|linkify|placeholder }} @@ -108,13 +108,13 @@ {% htmx_table 'ipam:prefix_list' vlan_id=object.pk %} - {% if object.qinq_role == 's-vlan' %} + {% if object.qinq_role == 'svlan' %}

    {% trans "Customer VLANs" %} {% if perms.ipam.add_vlan %} From a24576f12607a73f24d2c75d9a2c97194a3066d6 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Tue, 26 Nov 2024 07:01:06 -0800 Subject: [PATCH 49/65] 7848 Add RQ API (#17938) * 7848 Add Background Tasks (RQ) to API * 7848 Tasks * 7848 cleanup * 7848 add worker support * 7848 switch to APIView * 7848 Task detail view * 7848 Task enqueue, requeue, stop * 7848 Task enqueue, requeue, stop * 7848 Task enqueue, requeue, stop * 7848 tests * 7848 tests * 7848 OpenAPI doc generation * 7848 OpenAPI doc generation * 7848 review changes * 7848 viewset * 7848 viewset * 7848 fix tests * 7848 more viewsets * 7848 fix docstring * 7848 review comments * 7848 review comments - get all tasks * 7848 queue detail view * 7848 cleanup * 7848 cleanup * 7848 cleanup * 7848 cleanup * Rename viewsets for consistency w/serializers * Misc cleanup * 7848 review changes * 7848 review changes * 7848 add test * 7848 queue detail view * 7848 fix tests * 7848 fix the spectacular test failure * 7848 fix the spectacular test failure * Misc cleanup --------- Co-authored-by: Jeremy Stretch --- netbox/core/api/schema.py | 3 + netbox/core/api/serializers.py | 1 + netbox/core/api/serializers_/tasks.py | 87 +++++++++++++ netbox/core/api/urls.py | 5 +- netbox/core/api/views.py | 161 ++++++++++++++++++++++++ netbox/core/tests/test_api.py | 170 +++++++++++++++++++++++++- netbox/core/utils.py | 155 +++++++++++++++++++++++ netbox/core/views.py | 104 ++-------------- netbox/netbox/api/pagination.py | 25 ++++ 9 files changed, 612 insertions(+), 99 deletions(-) create mode 100644 netbox/core/api/serializers_/tasks.py create mode 100644 netbox/core/utils.py diff --git a/netbox/core/api/schema.py b/netbox/core/api/schema.py index fad907ac1..663ee2899 100644 --- a/netbox/core/api/schema.py +++ b/netbox/core/api/schema.py @@ -158,6 +158,9 @@ class NetBoxAutoSchema(AutoSchema): fields = {} if hasattr(serializer, 'child') else serializer.fields remove_fields = [] + # If you get a failure here for "AttributeError: 'cached_property' object has no attribute 'items'" + # it is probably because you are using a viewsets.ViewSet for the API View and are defining a + # serializer_class. You will also need to define a get_serializer() method like for GenericAPIView. for child_name, child in fields.items(): # read_only fields don't need to be in writable (write only) serializers if 'read_only' in dir(child) and child.read_only: diff --git a/netbox/core/api/serializers.py b/netbox/core/api/serializers.py index 2dde6be9f..9a6d4d726 100644 --- a/netbox/core/api/serializers.py +++ b/netbox/core/api/serializers.py @@ -1,3 +1,4 @@ from .serializers_.change_logging import * from .serializers_.data import * from .serializers_.jobs import * +from .serializers_.tasks import * diff --git a/netbox/core/api/serializers_/tasks.py b/netbox/core/api/serializers_/tasks.py new file mode 100644 index 000000000..53f2b5126 --- /dev/null +++ b/netbox/core/api/serializers_/tasks.py @@ -0,0 +1,87 @@ +from rest_framework import serializers +from rest_framework.reverse import reverse + +__all__ = ( + 'BackgroundTaskSerializer', + 'BackgroundQueueSerializer', + 'BackgroundWorkerSerializer', +) + + +class BackgroundTaskSerializer(serializers.Serializer): + id = serializers.CharField() + url = serializers.HyperlinkedIdentityField( + view_name='core-api:rqtask-detail', + lookup_field='id', + lookup_url_kwarg='pk' + ) + description = serializers.CharField() + origin = serializers.CharField() + func_name = serializers.CharField() + args = serializers.ListField(child=serializers.CharField()) + kwargs = serializers.DictField() + result = serializers.CharField() + timeout = serializers.IntegerField() + result_ttl = serializers.IntegerField() + created_at = serializers.DateTimeField() + enqueued_at = serializers.DateTimeField() + started_at = serializers.DateTimeField() + ended_at = serializers.DateTimeField() + worker_name = serializers.CharField() + position = serializers.SerializerMethodField() + status = serializers.SerializerMethodField() + meta = serializers.DictField() + last_heartbeat = serializers.CharField() + + is_finished = serializers.BooleanField() + is_queued = serializers.BooleanField() + is_failed = serializers.BooleanField() + is_started = serializers.BooleanField() + is_deferred = serializers.BooleanField() + is_canceled = serializers.BooleanField() + is_scheduled = serializers.BooleanField() + is_stopped = serializers.BooleanField() + + def get_position(self, obj) -> int: + return obj.get_position() + + def get_status(self, obj) -> str: + return obj.get_status() + + +class BackgroundQueueSerializer(serializers.Serializer): + name = serializers.CharField() + url = serializers.SerializerMethodField() + jobs = serializers.IntegerField() + oldest_job_timestamp = serializers.CharField() + index = serializers.IntegerField() + scheduler_pid = serializers.CharField() + workers = serializers.IntegerField() + finished_jobs = serializers.IntegerField() + started_jobs = serializers.IntegerField() + deferred_jobs = serializers.IntegerField() + failed_jobs = serializers.IntegerField() + scheduled_jobs = serializers.IntegerField() + + def get_url(self, obj): + return reverse('core-api:rqqueue-detail', args=[obj['name']], request=self.context.get("request")) + + +class BackgroundWorkerSerializer(serializers.Serializer): + name = serializers.CharField() + url = serializers.HyperlinkedIdentityField( + view_name='core-api:rqworker-detail', + lookup_field='name' + ) + state = serializers.SerializerMethodField() + birth_date = serializers.DateTimeField() + queue_names = serializers.ListField( + child=serializers.CharField() + ) + pid = serializers.CharField() + successful_job_count = serializers.IntegerField() + failed_job_count = serializers.IntegerField() + total_working_time = serializers.IntegerField() + + def get_state(self, obj): + return obj.get_state() diff --git a/netbox/core/api/urls.py b/netbox/core/api/urls.py index 95ee1896e..3c22f1cf4 100644 --- a/netbox/core/api/urls.py +++ b/netbox/core/api/urls.py @@ -1,6 +1,7 @@ from netbox.api.routers import NetBoxRouter from . import views +app_name = 'core-api' router = NetBoxRouter() router.APIRootView = views.CoreRootView @@ -9,6 +10,8 @@ router.register('data-sources', views.DataSourceViewSet) router.register('data-files', views.DataFileViewSet) router.register('jobs', views.JobViewSet) router.register('object-changes', views.ObjectChangeViewSet) +router.register('background-queues', views.BackgroundQueueViewSet, basename='rqqueue') +router.register('background-workers', views.BackgroundWorkerViewSet, basename='rqworker') +router.register('background-tasks', views.BackgroundTaskViewSet, basename='rqtask') -app_name = 'core-api' urlpatterns = router.urls diff --git a/netbox/core/api/views.py b/netbox/core/api/views.py index b3a024c02..4e5b148fc 100644 --- a/netbox/core/api/views.py +++ b/netbox/core/api/views.py @@ -1,5 +1,8 @@ +from django.http import Http404, HttpResponse from django.shortcuts import get_object_or_404 from django.utils.translation import gettext_lazy as _ +from drf_spectacular.types import OpenApiTypes +from drf_spectacular.utils import extend_schema from rest_framework.decorators import action from rest_framework.exceptions import PermissionDenied from rest_framework.response import Response @@ -10,8 +13,17 @@ from core import filtersets from core.choices import DataSourceStatusChoices from core.jobs import SyncDataSourceJob from core.models import * +from core.utils import delete_rq_job, enqueue_rq_job, get_rq_jobs, requeue_rq_job, stop_rq_job +from django_rq.queues import get_redis_connection +from django_rq.utils import get_statistics +from django_rq.settings import QUEUES_LIST from netbox.api.metadata import ContentTypeMetadata +from netbox.api.pagination import LimitOffsetListPagination from netbox.api.viewsets import NetBoxModelViewSet, NetBoxReadOnlyModelViewSet +from rest_framework import viewsets +from rest_framework.permissions import IsAdminUser +from rq.job import Job as RQ_Job +from rq.worker import Worker from . import serializers @@ -71,3 +83,152 @@ class ObjectChangeViewSet(ReadOnlyModelViewSet): queryset = ObjectChange.objects.valid_models() serializer_class = serializers.ObjectChangeSerializer filterset_class = filtersets.ObjectChangeFilterSet + + +class BaseRQViewSet(viewsets.ViewSet): + """ + Base class for RQ view sets. Provides a list() method. Subclasses must implement get_data(). + """ + permission_classes = [IsAdminUser] + serializer_class = None + + def get_data(self): + raise NotImplementedError() + + @extend_schema(responses={200: OpenApiTypes.OBJECT}) + def list(self, request): + data = self.get_data() + paginator = LimitOffsetListPagination() + data = paginator.paginate_list(data, request) + + serializer = self.serializer_class(data, many=True, context={'request': request}) + return paginator.get_paginated_response(serializer.data) + + def get_serializer(self, *args, **kwargs): + """ + Return the serializer instance that should be used for validating and + deserializing input, and for serializing output. + """ + serializer_class = self.get_serializer_class() + kwargs['context'] = self.get_serializer_context() + return serializer_class(*args, **kwargs) + + +class BackgroundQueueViewSet(BaseRQViewSet): + """ + Retrieve a list of RQ Queues. + Note: Queue names are not URL safe so not returning a detail view. + """ + serializer_class = serializers.BackgroundQueueSerializer + lookup_field = 'name' + lookup_value_regex = r'[\w.@+-]+' + + def get_view_name(self): + return "Background Queues" + + def get_data(self): + return get_statistics(run_maintenance_tasks=True)["queues"] + + @extend_schema(responses={200: OpenApiTypes.OBJECT}) + def retrieve(self, request, name): + data = self.get_data() + if not data: + raise Http404 + + for queue in data: + if queue['name'] == name: + serializer = self.serializer_class(queue, context={'request': request}) + return Response(serializer.data) + + raise Http404 + + +class BackgroundWorkerViewSet(BaseRQViewSet): + """ + Retrieve a list of RQ Workers. + """ + serializer_class = serializers.BackgroundWorkerSerializer + lookup_field = 'name' + + def get_view_name(self): + return "Background Workers" + + def get_data(self): + config = QUEUES_LIST[0] + return Worker.all(get_redis_connection(config['connection_config'])) + + def retrieve(self, request, name): + # all the RQ queues should use the same connection + config = QUEUES_LIST[0] + workers = Worker.all(get_redis_connection(config['connection_config'])) + worker = next((item for item in workers if item.name == name), None) + if not worker: + raise Http404 + + serializer = serializers.BackgroundWorkerSerializer(worker, context={'request': request}) + return Response(serializer.data) + + +class BackgroundTaskViewSet(BaseRQViewSet): + """ + Retrieve a list of RQ Tasks. + """ + serializer_class = serializers.BackgroundTaskSerializer + + def get_view_name(self): + return "Background Tasks" + + def get_data(self): + return get_rq_jobs() + + def get_task_from_id(self, task_id): + config = QUEUES_LIST[0] + task = RQ_Job.fetch(task_id, connection=get_redis_connection(config['connection_config'])) + if not task: + raise Http404 + + return task + + @extend_schema(responses={200: OpenApiTypes.OBJECT}) + def retrieve(self, request, pk): + """ + Retrieve the details of the specified RQ Task. + """ + task = self.get_task_from_id(pk) + serializer = self.serializer_class(task, context={'request': request}) + return Response(serializer.data) + + @action(methods=["POST"], detail=True) + def delete(self, request, pk): + """ + Delete the specified RQ Task. + """ + delete_rq_job(pk) + return HttpResponse(status=200) + + @action(methods=["POST"], detail=True) + def requeue(self, request, pk): + """ + Requeues the specified RQ Task. + """ + requeue_rq_job(pk) + return HttpResponse(status=200) + + @action(methods=["POST"], detail=True) + def enqueue(self, request, pk): + """ + Enqueues the specified RQ Task. + """ + enqueue_rq_job(pk) + return HttpResponse(status=200) + + @action(methods=["POST"], detail=True) + def stop(self, request, pk): + """ + Stops the specified RQ Task. + """ + stopped_jobs = stop_rq_job(pk) + if len(stopped_jobs) == 1: + return HttpResponse(status=200) + else: + return HttpResponse(status=204) diff --git a/netbox/core/tests/test_api.py b/netbox/core/tests/test_api.py index eeb3bd9c4..d8fb8fd83 100644 --- a/netbox/core/tests/test_api.py +++ b/netbox/core/tests/test_api.py @@ -1,7 +1,14 @@ +import uuid + +from django_rq import get_queue +from django_rq.workers import get_worker from django.urls import reverse from django.utils import timezone +from rq.job import Job as RQ_Job, JobStatus +from rq.registry import FailedJobRegistry, StartedJobRegistry -from utilities.testing import APITestCase, APIViewTestCases +from users.models import Token, User +from utilities.testing import APITestCase, APIViewTestCases, TestCase from ..models import * @@ -91,3 +98,164 @@ class DataFileTest( ), ) DataFile.objects.bulk_create(data_files) + + +class BackgroundTaskTestCase(TestCase): + user_permissions = () + + @staticmethod + def dummy_job_default(): + return "Job finished" + + @staticmethod + def dummy_job_failing(): + raise Exception("Job failed") + + def setUp(self): + """ + Create a user and token for API calls. + """ + # Create the test user and assign permissions + self.user = User.objects.create_user(username='testuser') + self.user.is_staff = True + self.user.is_active = True + self.user.save() + self.token = Token.objects.create(user=self.user) + self.header = {'HTTP_AUTHORIZATION': f'Token {self.token.key}'} + + # Clear all queues prior to running each test + get_queue('default').connection.flushall() + get_queue('high').connection.flushall() + get_queue('low').connection.flushall() + + def test_background_queue_list(self): + url = reverse('core-api:rqqueue-list') + + # Attempt to load view without permission + self.user.is_staff = False + self.user.save() + response = self.client.get(url, **self.header) + self.assertEqual(response.status_code, 403) + + # Load view with permission + self.user.is_staff = True + self.user.save() + response = self.client.get(url, **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn('default', str(response.content)) + self.assertIn('high', str(response.content)) + self.assertIn('low', str(response.content)) + + def test_background_queue(self): + response = self.client.get(reverse('core-api:rqqueue-detail', args=['default']), **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn('default', str(response.content)) + self.assertIn('oldest_job_timestamp', str(response.content)) + self.assertIn('scheduled_jobs', str(response.content)) + + def test_background_task_list(self): + queue = get_queue('default') + queue.enqueue(self.dummy_job_default) + + response = self.client.get(reverse('core-api:rqtask-list'), **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn('origin', str(response.content)) + self.assertIn('core.tests.test_api.BackgroundTaskTestCase.dummy_job_default()', str(response.content)) + + def test_background_task(self): + queue = get_queue('default') + job = queue.enqueue(self.dummy_job_default) + + response = self.client.get(reverse('core-api:rqtask-detail', args=[job.id]), **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn(str(job.id), str(response.content)) + self.assertIn('origin', str(response.content)) + self.assertIn('meta', str(response.content)) + self.assertIn('kwargs', str(response.content)) + + def test_background_task_delete(self): + queue = get_queue('default') + job = queue.enqueue(self.dummy_job_default) + + response = self.client.post(reverse('core-api:rqtask-delete', args=[job.id]), **self.header) + self.assertEqual(response.status_code, 200) + self.assertFalse(RQ_Job.exists(job.id, connection=queue.connection)) + queue = get_queue('default') + self.assertNotIn(job.id, queue.job_ids) + + def test_background_task_requeue(self): + queue = get_queue('default') + + # Enqueue & run a job that will fail + job = queue.enqueue(self.dummy_job_failing) + worker = get_worker('default') + worker.work(burst=True) + self.assertTrue(job.is_failed) + + # Re-enqueue the failed job and check that its status has been reset + response = self.client.post(reverse('core-api:rqtask-requeue', args=[job.id]), **self.header) + self.assertEqual(response.status_code, 200) + job = RQ_Job.fetch(job.id, queue.connection) + self.assertFalse(job.is_failed) + + def test_background_task_enqueue(self): + queue = get_queue('default') + + # Enqueue some jobs that each depends on its predecessor + job = previous_job = None + for _ in range(0, 3): + job = queue.enqueue(self.dummy_job_default, depends_on=previous_job) + previous_job = job + + # Check that the last job to be enqueued has a status of deferred + self.assertIsNotNone(job) + self.assertEqual(job.get_status(), JobStatus.DEFERRED) + self.assertIsNone(job.enqueued_at) + + # Force-enqueue the deferred job + response = self.client.post(reverse('core-api:rqtask-enqueue', args=[job.id]), **self.header) + self.assertEqual(response.status_code, 200) + + # Check that job's status is updated correctly + job = queue.fetch_job(job.id) + self.assertEqual(job.get_status(), JobStatus.QUEUED) + self.assertIsNotNone(job.enqueued_at) + + def test_background_task_stop(self): + queue = get_queue('default') + + worker = get_worker('default') + job = queue.enqueue(self.dummy_job_default) + worker.prepare_job_execution(job) + + self.assertEqual(job.get_status(), JobStatus.STARTED) + response = self.client.post(reverse('core-api:rqtask-stop', args=[job.id]), **self.header) + self.assertEqual(response.status_code, 200) + worker.monitor_work_horse(job, queue) # Sets the job as Failed and removes from Started + started_job_registry = StartedJobRegistry(queue.name, connection=queue.connection) + self.assertEqual(len(started_job_registry), 0) + + canceled_job_registry = FailedJobRegistry(queue.name, connection=queue.connection) + self.assertEqual(len(canceled_job_registry), 1) + self.assertIn(job.id, canceled_job_registry) + + def test_worker_list(self): + worker1 = get_worker('default', name=uuid.uuid4().hex) + worker1.register_birth() + + worker2 = get_worker('high') + worker2.register_birth() + + response = self.client.get(reverse('core-api:rqworker-list'), **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn(str(worker1.name), str(response.content)) + + def test_worker(self): + worker1 = get_worker('default', name=uuid.uuid4().hex) + worker1.register_birth() + + response = self.client.get(reverse('core-api:rqworker-detail', args=[worker1.name]), **self.header) + self.assertEqual(response.status_code, 200) + self.assertIn(str(worker1.name), str(response.content)) + self.assertIn('birth_date', str(response.content)) + self.assertIn('total_working_time', str(response.content)) diff --git a/netbox/core/utils.py b/netbox/core/utils.py new file mode 100644 index 000000000..26adfdfa2 --- /dev/null +++ b/netbox/core/utils.py @@ -0,0 +1,155 @@ +from django.http import Http404 +from django.utils.translation import gettext_lazy as _ +from django_rq.queues import get_queue, get_queue_by_index, get_redis_connection +from django_rq.settings import QUEUES_MAP, QUEUES_LIST +from django_rq.utils import get_jobs, stop_jobs +from rq import requeue_job +from rq.exceptions import NoSuchJobError +from rq.job import Job as RQ_Job, JobStatus as RQJobStatus +from rq.registry import ( + DeferredJobRegistry, + FailedJobRegistry, + FinishedJobRegistry, + ScheduledJobRegistry, + StartedJobRegistry, +) + +__all__ = ( + 'delete_rq_job', + 'enqueue_rq_job', + 'get_rq_jobs', + 'get_rq_jobs_from_status', + 'requeue_rq_job', + 'stop_rq_job', +) + + +def get_rq_jobs(): + """ + Return a list of all RQ jobs. + """ + jobs = set() + + for queue in QUEUES_LIST: + queue = get_queue(queue['name']) + jobs.update(queue.get_jobs()) + + return list(jobs) + + +def get_rq_jobs_from_status(queue, status): + """ + Return the RQ jobs with the given status. + """ + jobs = [] + + try: + registry_cls = { + RQJobStatus.STARTED: StartedJobRegistry, + RQJobStatus.DEFERRED: DeferredJobRegistry, + RQJobStatus.FINISHED: FinishedJobRegistry, + RQJobStatus.FAILED: FailedJobRegistry, + RQJobStatus.SCHEDULED: ScheduledJobRegistry, + }[status] + except KeyError: + raise Http404 + registry = registry_cls(queue.name, queue.connection) + + job_ids = registry.get_job_ids() + if status != RQJobStatus.DEFERRED: + jobs = get_jobs(queue, job_ids, registry) + else: + # Deferred jobs require special handling + for job_id in job_ids: + try: + jobs.append(RQ_Job.fetch(job_id, connection=queue.connection, serializer=queue.serializer)) + except NoSuchJobError: + pass + + if jobs and status == RQJobStatus.SCHEDULED: + for job in jobs: + job.scheduled_at = registry.get_scheduled_time(job) + + return jobs + + +def delete_rq_job(job_id): + """ + Delete the specified RQ job. + """ + config = QUEUES_LIST[0] + try: + job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) + except NoSuchJobError: + raise Http404(_("Job {job_id} not found").format(job_id=job_id)) + + queue_index = QUEUES_MAP[job.origin] + queue = get_queue_by_index(queue_index) + + # Remove job id from queue and delete the actual job + queue.connection.lrem(queue.key, 0, job.id) + job.delete() + + +def requeue_rq_job(job_id): + """ + Requeue the specified RQ job. + """ + config = QUEUES_LIST[0] + try: + job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) + except NoSuchJobError: + raise Http404(_("Job {id} not found.").format(id=job_id)) + + queue_index = QUEUES_MAP[job.origin] + queue = get_queue_by_index(queue_index) + + requeue_job(job_id, connection=queue.connection, serializer=queue.serializer) + + +def enqueue_rq_job(job_id): + """ + Enqueue the specified RQ job. + """ + config = QUEUES_LIST[0] + try: + job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) + except NoSuchJobError: + raise Http404(_("Job {id} not found.").format(id=job_id)) + + queue_index = QUEUES_MAP[job.origin] + queue = get_queue_by_index(queue_index) + + try: + # _enqueue_job is new in RQ 1.14, this is used to enqueue + # job regardless of its dependencies + queue._enqueue_job(job) + except AttributeError: + queue.enqueue_job(job) + + # Remove job from correct registry if needed + if job.get_status() == RQJobStatus.DEFERRED: + registry = DeferredJobRegistry(queue.name, queue.connection) + registry.remove(job) + elif job.get_status() == RQJobStatus.FINISHED: + registry = FinishedJobRegistry(queue.name, queue.connection) + registry.remove(job) + elif job.get_status() == RQJobStatus.SCHEDULED: + registry = ScheduledJobRegistry(queue.name, queue.connection) + registry.remove(job) + + +def stop_rq_job(job_id): + """ + Stop the specified RQ job. + """ + config = QUEUES_LIST[0] + try: + job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) + except NoSuchJobError: + raise Http404(_("Job {job_id} not found").format(job_id=job_id)) + + queue_index = QUEUES_MAP[job.origin] + queue = get_queue_by_index(queue_index) + + return stop_jobs(queue, job_id)[0] diff --git a/netbox/core/views.py b/netbox/core/views.py index a9ec5d70a..713807a82 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -14,16 +14,13 @@ from django.utils.translation import gettext_lazy as _ from django.views.generic import View from django_rq.queues import get_connection, get_queue_by_index, get_redis_connection from django_rq.settings import QUEUES_MAP, QUEUES_LIST -from django_rq.utils import get_jobs, get_statistics, stop_jobs -from rq import requeue_job +from django_rq.utils import get_statistics from rq.exceptions import NoSuchJobError from rq.job import Job as RQ_Job, JobStatus as RQJobStatus -from rq.registry import ( - DeferredJobRegistry, FailedJobRegistry, FinishedJobRegistry, ScheduledJobRegistry, StartedJobRegistry, -) from rq.worker import Worker from rq.worker_registration import clean_worker_registry +from core.utils import delete_rq_job, enqueue_rq_job, get_rq_jobs_from_status, requeue_rq_job, stop_rq_job from netbox.config import get_config, PARAMS from netbox.views import generic from netbox.views.generic.base import BaseObjectView @@ -363,41 +360,12 @@ class BackgroundTaskListView(TableMixin, BaseRQView): table = tables.BackgroundTaskTable def get_table_data(self, request, queue, status): - jobs = [] # Call get_jobs() to returned queued tasks if status == RQJobStatus.QUEUED: return queue.get_jobs() - # For other statuses, determine the registry to list (or raise a 404 for invalid statuses) - try: - registry_cls = { - RQJobStatus.STARTED: StartedJobRegistry, - RQJobStatus.DEFERRED: DeferredJobRegistry, - RQJobStatus.FINISHED: FinishedJobRegistry, - RQJobStatus.FAILED: FailedJobRegistry, - RQJobStatus.SCHEDULED: ScheduledJobRegistry, - }[status] - except KeyError: - raise Http404 - registry = registry_cls(queue.name, queue.connection) - - job_ids = registry.get_job_ids() - if status != RQJobStatus.DEFERRED: - jobs = get_jobs(queue, job_ids, registry) - else: - # Deferred jobs require special handling - for job_id in job_ids: - try: - jobs.append(RQ_Job.fetch(job_id, connection=queue.connection, serializer=queue.serializer)) - except NoSuchJobError: - pass - - if jobs and status == RQJobStatus.SCHEDULED: - for job in jobs: - job.scheduled_at = registry.get_scheduled_time(job) - - return jobs + return get_rq_jobs_from_status(queue, status) def get(self, request, queue_index, status): queue = get_queue_by_index(queue_index) @@ -463,19 +431,7 @@ class BackgroundTaskDeleteView(BaseRQView): form = ConfirmationForm(request.POST) if form.is_valid(): - # all the RQ queues should use the same connection - config = QUEUES_LIST[0] - try: - job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) - except NoSuchJobError: - raise Http404(_("Job {job_id} not found").format(job_id=job_id)) - - queue_index = QUEUES_MAP[job.origin] - queue = get_queue_by_index(queue_index) - - # Remove job id from queue and delete the actual job - queue.connection.lrem(queue.key, 0, job.id) - job.delete() + delete_rq_job(job_id) messages.success(request, _('Job {id} has been deleted.').format(id=job_id)) else: messages.error(request, _('Error deleting job {id}: {error}').format(id=job_id, error=form.errors[0])) @@ -486,17 +442,7 @@ class BackgroundTaskDeleteView(BaseRQView): class BackgroundTaskRequeueView(BaseRQView): def get(self, request, job_id): - # all the RQ queues should use the same connection - config = QUEUES_LIST[0] - try: - job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) - except NoSuchJobError: - raise Http404(_("Job {id} not found.").format(id=job_id)) - - queue_index = QUEUES_MAP[job.origin] - queue = get_queue_by_index(queue_index) - - requeue_job(job_id, connection=queue.connection, serializer=queue.serializer) + requeue_rq_job(job_id) messages.success(request, _('Job {id} has been re-enqueued.').format(id=job_id)) return redirect(reverse('core:background_task', args=[job_id])) @@ -505,33 +451,7 @@ class BackgroundTaskEnqueueView(BaseRQView): def get(self, request, job_id): # all the RQ queues should use the same connection - config = QUEUES_LIST[0] - try: - job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) - except NoSuchJobError: - raise Http404(_("Job {id} not found.").format(id=job_id)) - - queue_index = QUEUES_MAP[job.origin] - queue = get_queue_by_index(queue_index) - - try: - # _enqueue_job is new in RQ 1.14, this is used to enqueue - # job regardless of its dependencies - queue._enqueue_job(job) - except AttributeError: - queue.enqueue_job(job) - - # Remove job from correct registry if needed - if job.get_status() == RQJobStatus.DEFERRED: - registry = DeferredJobRegistry(queue.name, queue.connection) - registry.remove(job) - elif job.get_status() == RQJobStatus.FINISHED: - registry = FinishedJobRegistry(queue.name, queue.connection) - registry.remove(job) - elif job.get_status() == RQJobStatus.SCHEDULED: - registry = ScheduledJobRegistry(queue.name, queue.connection) - registry.remove(job) - + enqueue_rq_job(job_id) messages.success(request, _('Job {id} has been enqueued.').format(id=job_id)) return redirect(reverse('core:background_task', args=[job_id])) @@ -539,17 +459,7 @@ class BackgroundTaskEnqueueView(BaseRQView): class BackgroundTaskStopView(BaseRQView): def get(self, request, job_id): - # all the RQ queues should use the same connection - config = QUEUES_LIST[0] - try: - job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),) - except NoSuchJobError: - raise Http404(_("Job {job_id} not found").format(job_id=job_id)) - - queue_index = QUEUES_MAP[job.origin] - queue = get_queue_by_index(queue_index) - - stopped_jobs = stop_jobs(queue, job_id)[0] + stopped_jobs = stop_rq_job(job_id) if len(stopped_jobs) == 1: messages.success(request, _('Job {id} has been stopped.').format(id=job_id)) else: diff --git a/netbox/netbox/api/pagination.py b/netbox/netbox/api/pagination.py index 5ecade264..f47434ebd 100644 --- a/netbox/netbox/api/pagination.py +++ b/netbox/netbox/api/pagination.py @@ -83,3 +83,28 @@ class StripCountAnnotationsPaginator(OptionalLimitOffsetPagination): cloned_queryset.query.annotations.clear() return cloned_queryset.count() + + +class LimitOffsetListPagination(LimitOffsetPagination): + """ + DRF LimitOffset Paginator but for list instead of queryset + """ + count = 0 + offset = 0 + + def paginate_list(self, data, request, view=None): + self.request = request + self.limit = self.get_limit(request) + self.count = len(data) + self.offset = self.get_offset(request) + + if self.limit is None: + self.limit = self.count + + if self.count == 0 or self.offset > self.count: + return [] + + if self.count > self.limit and self.template is not None: + self.display_page_controls = True + + return data[self.offset:self.offset + self.limit] From 64e56cd7c84b80fb78a293ba9cc6a5100c99b589 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2024 10:35:30 -0500 Subject: [PATCH 50/65] #16971: Improve example in documentation --- docs/plugins/development/background-jobs.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/plugins/development/background-jobs.md b/docs/plugins/development/background-jobs.md index d51981b9e..3d789b6b9 100644 --- a/docs/plugins/development/background-jobs.md +++ b/docs/plugins/development/background-jobs.md @@ -87,14 +87,17 @@ class MyHousekeepingJob(JobRunner): def run(self, *args, **kwargs): MyModel.objects.filter(foo='bar').delete() - -system_jobs = ( - MyHousekeepingJob, -) ``` !!! note - Ensure that any system jobs are imported on initialization. Otherwise, they won't be registered. This can be achieved by extending the PluginConfig's `ready()` method. + Ensure that any system jobs are imported on initialization. Otherwise, they won't be registered. This can be achieved by extending the PluginConfig's `ready()` method. For example: + + ```python + def ready(self): + super().ready() + + from .jobs import MyHousekeepingJob + ``` ## Task queues From 3ee951b0d08cfa0fca34a0d0fea36a39180a951f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2024 10:45:30 -0500 Subject: [PATCH 51/65] Fix missing/incorrect documentation links --- docs/models/virtualization/vminterface.md | 4 +- docs/plugins/development/index.md | 46 +++++++++++------------ mkdocs.yml | 4 ++ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/docs/models/virtualization/vminterface.md b/docs/models/virtualization/vminterface.md index 6617b5e59..880cf927b 100644 --- a/docs/models/virtualization/vminterface.md +++ b/docs/models/virtualization/vminterface.md @@ -29,10 +29,10 @@ If not selected, this interface will be treated as disabled/inoperative. ### Primary MAC Address -The [MAC address](./macaddress.md) assigned to this interface which is designated as its primary. +The [MAC address](../dcim/macaddress.md) assigned to this interface which is designated as its primary. !!! note "Changed in NetBox v4.2" - The MAC address of an interface (formerly a concrete database field) is available as a property, `mac_address`, which reflects the value of the primary linked [MAC address](./macaddress.md) object. + The MAC address of an interface (formerly a concrete database field) is available as a property, `mac_address`, which reflects the value of the primary linked [MAC address](../dcim/macaddress.md) object. ### MTU diff --git a/docs/plugins/development/index.md b/docs/plugins/development/index.md index 8a83ab71b..246816349 100644 --- a/docs/plugins/development/index.md +++ b/docs/plugins/development/index.md @@ -98,29 +98,29 @@ NetBox looks for the `config` variable within a plugin's `__init__.py` to load i ### PluginConfig Attributes -| Name | Description | -|-----------------------|--------------------------------------------------------------------------------------------------------------------------| -| `name` | Raw plugin name; same as the plugin's source directory | -| `verbose_name` | Human-friendly name for the plugin | -| `version` | Current release ([semantic versioning](https://semver.org/) is encouraged) | -| `description` | Brief description of the plugin's purpose | -| `author` | Name of plugin's author | -| `author_email` | Author's public email address | -| `base_url` | Base path to use for plugin URLs (optional). If not specified, the project's `name` will be used. | -| `required_settings` | A list of any configuration parameters that **must** be defined by the user | -| `default_settings` | A dictionary of configuration parameters and their default values | -| `django_apps` | A list of additional Django apps to load alongside the plugin | -| `min_version` | Minimum version of NetBox with which the plugin is compatible | -| `max_version` | Maximum version of NetBox with which the plugin is compatible | -| `middleware` | A list of middleware classes to append after NetBox's build-in middleware | -| `queues` | A list of custom background task queues to create | -| `events_pipeline` | A list of handlers to add to [`EVENTS_PIPELINE`](./miscellaneous.md#events_pipeline), identified by dotted paths | -| `search_extensions` | The dotted path to the list of search index classes (default: `search.indexes`) | -| `data_backends` | The dotted path to the list of data source backend classes (default: `data_backends.backends`) | -| `template_extensions` | The dotted path to the list of template extension classes (default: `template_content.template_extensions`) | -| `menu_items` | The dotted path to the list of menu items provided by the plugin (default: `navigation.menu_items`) | -| `graphql_schema` | The dotted path to the plugin's GraphQL schema class, if any (default: `graphql.schema`) | -| `user_preferences` | The dotted path to the dictionary mapping of user preferences defined by the plugin (default: `preferences.preferences`) | +| Name | Description | +|-----------------------|------------------------------------------------------------------------------------------------------------------------------------| +| `name` | Raw plugin name; same as the plugin's source directory | +| `verbose_name` | Human-friendly name for the plugin | +| `version` | Current release ([semantic versioning](https://semver.org/) is encouraged) | +| `description` | Brief description of the plugin's purpose | +| `author` | Name of plugin's author | +| `author_email` | Author's public email address | +| `base_url` | Base path to use for plugin URLs (optional). If not specified, the project's `name` will be used. | +| `required_settings` | A list of any configuration parameters that **must** be defined by the user | +| `default_settings` | A dictionary of configuration parameters and their default values | +| `django_apps` | A list of additional Django apps to load alongside the plugin | +| `min_version` | Minimum version of NetBox with which the plugin is compatible | +| `max_version` | Maximum version of NetBox with which the plugin is compatible | +| `middleware` | A list of middleware classes to append after NetBox's build-in middleware | +| `queues` | A list of custom background task queues to create | +| `events_pipeline` | A list of handlers to add to [`EVENTS_PIPELINE`](../../configuration/miscellaneous.md#events_pipeline), identified by dotted paths | +| `search_extensions` | The dotted path to the list of search index classes (default: `search.indexes`) | +| `data_backends` | The dotted path to the list of data source backend classes (default: `data_backends.backends`) | +| `template_extensions` | The dotted path to the list of template extension classes (default: `template_content.template_extensions`) | +| `menu_items` | The dotted path to the list of menu items provided by the plugin (default: `navigation.menu_items`) | +| `graphql_schema` | The dotted path to the plugin's GraphQL schema class, if any (default: `graphql.schema`) | +| `user_preferences` | The dotted path to the dictionary mapping of user preferences defined by the plugin (default: `preferences.preferences`) | All required settings must be configured by the user. If a configuration parameter is listed in both `required_settings` and `default_settings`, the default setting will be ignored. diff --git a/mkdocs.yml b/mkdocs.yml index a66baa286..f870b69d6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -199,6 +199,7 @@ nav: - InventoryItemRole: 'models/dcim/inventoryitemrole.md' - InventoryItemTemplate: 'models/dcim/inventoryitemtemplate.md' - Location: 'models/dcim/location.md' + - MACAddress: 'models/dcim/macaddress.md' - Manufacturer: 'models/dcim/manufacturer.md' - Module: 'models/dcim/module.md' - ModuleBay: 'models/dcim/modulebay.md' @@ -257,6 +258,8 @@ nav: - ServiceTemplate: 'models/ipam/servicetemplate.md' - VLAN: 'models/ipam/vlan.md' - VLANGroup: 'models/ipam/vlangroup.md' + - VLANTranslationPolicy: 'models/ipam/vlantranslationpolicy.md' + - VLANTranslationRule: 'models/ipam/vlantranslationrule.md' - VRF: 'models/ipam/vrf.md' - Tenancy: - Contact: 'models/tenancy/contact.md' @@ -308,6 +311,7 @@ nav: - git Cheat Sheet: 'development/git-cheat-sheet.md' - Release Notes: - Summary: 'release-notes/index.md' + - Version 4.2: 'release-notes/version-4.2.md' - Version 4.1: 'release-notes/version-4.1.md' - Version 4.0: 'release-notes/version-4.0.md' - Version 3.7: 'release-notes/version-3.7.md' From d511ba487db89bf0a96bf0ab61cc43ad7298eaca Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2024 12:20:59 -0500 Subject: [PATCH 52/65] #13086: Add virtual circuit to InterfaceTable --- netbox/dcim/tables/devices.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 59d0845d5..963150a7a 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -647,6 +647,10 @@ class InterfaceTable(BaseInterfaceTable, ModularDeviceComponentTable, PathEndpoi verbose_name=_('VRF'), linkify=True ) + virtual_circuit_termination = tables.Column( + verbose_name=_('Virtual Circuit'), + linkify=True + ) tags = columns.TagColumn( url_name='dcim:interface_list' ) From 678d89d406d1cc21af4dc70bc8c861f397b7f385 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2024 12:38:29 -0500 Subject: [PATCH 53/65] Update documentation for v4.2 --- docs/configuration/miscellaneous.md | 1 + docs/configuration/system.md | 2 -- docs/features/notifications.md | 2 -- docs/models/circuits/circuitgroup.md | 2 -- docs/models/circuits/circuittermination.md | 2 ++ docs/models/circuits/virtualcircuit.md | 2 ++ docs/models/circuits/virtualcircuittermination.md | 2 ++ docs/models/dcim/interface.md | 5 +++++ docs/models/dcim/inventoryitem.md | 10 ++++++---- docs/models/dcim/macaddress.md | 2 ++ docs/models/dcim/modulebay.md | 2 -- docs/models/dcim/moduletype.md | 2 -- docs/models/dcim/poweroutlet.md | 2 ++ docs/models/dcim/racktype.md | 2 -- docs/models/extras/customfield.md | 2 -- docs/models/ipam/prefix.md | 6 ++++-- docs/models/ipam/vlan.md | 4 ++++ docs/models/ipam/vlangroup.md | 2 -- docs/models/ipam/vlantranslationpolicy.md | 2 ++ docs/models/ipam/vlantranslationrule.md | 2 ++ docs/models/virtualization/cluster.md | 2 ++ docs/models/virtualization/virtualmachine.md | 2 -- docs/models/virtualization/vminterface.md | 5 +++++ docs/models/wireless/wirelesslan.md | 2 ++ docs/models/wireless/wirelesslink.md | 2 -- docs/plugins/development/background-jobs.md | 4 ++-- docs/plugins/development/event-types.md | 2 -- docs/plugins/development/views.md | 2 -- docs/release-notes/index.md | 8 ++++++++ 29 files changed, 53 insertions(+), 32 deletions(-) diff --git a/docs/configuration/miscellaneous.md b/docs/configuration/miscellaneous.md index b983acd80..c14c0ac77 100644 --- a/docs/configuration/miscellaneous.md +++ b/docs/configuration/miscellaneous.md @@ -108,6 +108,7 @@ By default, NetBox will prevent the creation of duplicate prefixes and IP addres ## EVENTS_PIPELINE +!!! info "This parameter was introduced in NetBox v4.2." Default: `['extras.events.process_event_queue',]` diff --git a/docs/configuration/system.md b/docs/configuration/system.md index 25c724bc9..af3a6f5e6 100644 --- a/docs/configuration/system.md +++ b/docs/configuration/system.md @@ -89,8 +89,6 @@ addresses (and [`DEBUG`](./development.md#debug) is true). ## ISOLATED_DEPLOYMENT -!!! info "This feature was introduced in NetBox v4.1." - Default: False Set this configuration parameter to True for NetBox deployments which do not have Internet access. This will disable miscellaneous functionality which depends on access to the Internet. diff --git a/docs/features/notifications.md b/docs/features/notifications.md index a28a17947..0567a6db6 100644 --- a/docs/features/notifications.md +++ b/docs/features/notifications.md @@ -1,7 +1,5 @@ # Notifications -!!! info "This feature was introduced in NetBox v4.1." - NetBox includes a system for generating user notifications, which can be marked as read or deleted by individual users. There are two built-in mechanisms for generating a notification: * A user can subscribe to an object. When that object is modified, a notification is created to inform the user of the change. diff --git a/docs/models/circuits/circuitgroup.md b/docs/models/circuits/circuitgroup.md index faa9dbc14..6d1503509 100644 --- a/docs/models/circuits/circuitgroup.md +++ b/docs/models/circuits/circuitgroup.md @@ -1,7 +1,5 @@ # Circuit Groups -!!! info "This feature was introduced in NetBox v4.1." - [Circuits](./circuit.md) can be arranged into administrative groups for organization. The assignment of a circuit to a group is optional. ## Fields diff --git a/docs/models/circuits/circuittermination.md b/docs/models/circuits/circuittermination.md index 791863483..4b1a16ded 100644 --- a/docs/models/circuits/circuittermination.md +++ b/docs/models/circuits/circuittermination.md @@ -23,6 +23,8 @@ If selected, the circuit termination will be considered "connected" even if no c ### Termination +!!! info "This field replaced the `site` and `provider_network` fields in NetBox v4.2." + The [region](../dcim/region.md), [site group](../dcim/sitegroup.md), [site](../dcim/site.md), [location](../dcim/location.md) or [provider network](./providernetwork.md) with which this circuit termination is associated. Once created, a cable can be connected between the circuit termination and a device interface (or similar component). ### Port Speed diff --git a/docs/models/circuits/virtualcircuit.md b/docs/models/circuits/virtualcircuit.md index a379b6330..c81c654c8 100644 --- a/docs/models/circuits/virtualcircuit.md +++ b/docs/models/circuits/virtualcircuit.md @@ -1,5 +1,7 @@ # Virtual Circuits +!!! info "This feature was introduced in NetBox v4.2." + A virtual circuit can connect two or more interfaces atop a set of decoupled physical connections. For example, it's very common to form a virtual connection between two virtual interfaces, each of which is bound to a physical interface on its respective device and physically connected to a [provider network](./providernetwork.md) via an independent [physical circuit](./circuit.md). ## Fields diff --git a/docs/models/circuits/virtualcircuittermination.md b/docs/models/circuits/virtualcircuittermination.md index 82ea43eef..a7833e13c 100644 --- a/docs/models/circuits/virtualcircuittermination.md +++ b/docs/models/circuits/virtualcircuittermination.md @@ -1,5 +1,7 @@ # Virtual Circuit Terminations +!!! info "This feature was introduced in NetBox v4.2." + This model represents the connection of a virtual [interface](../dcim/interface.md) to a [virtual circuit](./virtualcircuit.md). ## Fields diff --git a/docs/models/dcim/interface.md b/docs/models/dcim/interface.md index f2af1a2ad..b7115050f 100644 --- a/docs/models/dcim/interface.md +++ b/docs/models/dcim/interface.md @@ -112,6 +112,7 @@ For switched Ethernet interfaces, this identifies the 802.1Q encapsulation strat * **Access:** All traffic is assigned to a single VLAN, with no tagging. * **Tagged:** One untagged "native" VLAN is allowed, as well as any number of tagged VLANs. * **Tagged (all):** Implies that all VLANs are carried by the interface. One untagged VLAN may be designated. +* **Q-in-Q:** Q-in-Q (IEEE 802.1ad) encapsulation is performed using the assigned SVLAN. This field must be left blank for routed interfaces which do employ 802.1Q encapsulation. @@ -125,6 +126,8 @@ The tagged VLANs which are configured to be carried by this interface. Valid onl ### Q-in-Q SVLAN +!!! info "This field was introduced in NetBox v4.2." + The assigned service VLAN (for Q-in-Q/802.1ad interfaces). ### Wireless Role @@ -152,4 +155,6 @@ The [wireless LANs](../wireless/wirelesslan.md) for which this interface carries ### VLAN Translation Policy +!!! info "This field was introduced in NetBox v4.2." + The [VLAN translation policy](../ipam/vlantranslationpolicy.md) that applies to this interface (optional). diff --git a/docs/models/dcim/inventoryitem.md b/docs/models/dcim/inventoryitem.md index a6dfa32db..2d648341b 100644 --- a/docs/models/dcim/inventoryitem.md +++ b/docs/models/dcim/inventoryitem.md @@ -25,6 +25,12 @@ The inventory item's name. If the inventory item is assigned to a parent item, i An alternative physical label identifying the inventory item. +### Status + +!!! info "This field was introduced in NetBox v4.2." + +The inventory item's operational status. + ### Role The functional [role](./inventoryitemrole.md) assigned to this inventory item. @@ -44,7 +50,3 @@ The serial number assigned by the manufacturer. ### Asset Tag A unique, locally-administered label used to identify hardware resources. - -### Status - -The inventory item's operational status. diff --git a/docs/models/dcim/macaddress.md b/docs/models/dcim/macaddress.md index fe3d1f0e3..5b1dd93be 100644 --- a/docs/models/dcim/macaddress.md +++ b/docs/models/dcim/macaddress.md @@ -1,5 +1,7 @@ # MAC Addresses +!!! info "This feature was introduced in NetBox v4.2." + A MAC address object in NetBox comprises a single Ethernet link layer address, and represents a MAC address as reported by or assigned to a network interface. MAC addresses can be assigned to [device](../dcim/device.md) and [virtual machine](../virtualization/virtualmachine.md) interfaces. A MAC address can be specified as the primary MAC address for a given device or VM interface. Most interfaces have only a single MAC address, hard-coded at the factory. However, on some devices (particularly virtual interfaces) it is possible to assign additional MAC addresses or change existing ones. For this reason NetBox allows multiple MACAddress objects to be assigned to a single interface. diff --git a/docs/models/dcim/modulebay.md b/docs/models/dcim/modulebay.md index 1bff799c2..494012a7b 100644 --- a/docs/models/dcim/modulebay.md +++ b/docs/models/dcim/modulebay.md @@ -16,8 +16,6 @@ The device to which this module bay belongs. ### Module -!!! info "This feature was introduced in NetBox v4.1." - The module to which this bay belongs (optional). ### Name diff --git a/docs/models/dcim/moduletype.md b/docs/models/dcim/moduletype.md index 225873d61..7077e16c2 100644 --- a/docs/models/dcim/moduletype.md +++ b/docs/models/dcim/moduletype.md @@ -42,6 +42,4 @@ The numeric weight of the module, including a unit designation (e.g. 3 kilograms ### Airflow -!!! info "The `airflow` field was introduced in NetBox v4.1." - The direction in which air circulates through the device chassis for cooling. diff --git a/docs/models/dcim/poweroutlet.md b/docs/models/dcim/poweroutlet.md index fe9390056..a99f60b23 100644 --- a/docs/models/dcim/poweroutlet.md +++ b/docs/models/dcim/poweroutlet.md @@ -31,6 +31,8 @@ The type of power outlet. ### Color +!!! info "This field was introduced in NetBox v4.2." + The power outlet's color (optional). ### Power Port diff --git a/docs/models/dcim/racktype.md b/docs/models/dcim/racktype.md index eeb90bd29..b5f2d99e7 100644 --- a/docs/models/dcim/racktype.md +++ b/docs/models/dcim/racktype.md @@ -1,7 +1,5 @@ # Rack Types -!!! info "This feature was introduced in NetBox v4.1." - A rack type defines the physical characteristics of a particular model of [rack](./rack.md). ## Fields diff --git a/docs/models/extras/customfield.md b/docs/models/extras/customfield.md index 9aab66a36..a5d083492 100644 --- a/docs/models/extras/customfield.md +++ b/docs/models/extras/customfield.md @@ -44,8 +44,6 @@ For object and multiple-object fields only. Designates the type of NetBox object ### Related Object Filter -!!! info "This field was introduced in NetBox v4.1." - For object and multi-object custom fields, a filter may be defined to limit the available objects when populating a field value. This filter maps object attributes to values. For example, `{"status": "active"}` will include only objects with a status of "active." !!! warning diff --git a/docs/models/ipam/prefix.md b/docs/models/ipam/prefix.md index 2fb01daf0..939ca3ea5 100644 --- a/docs/models/ipam/prefix.md +++ b/docs/models/ipam/prefix.md @@ -34,9 +34,11 @@ Designates whether the prefix should be treated as a pool. If selected, the firs If selected, this prefix will report 100% utilization regardless of how many child objects have been defined within it. -### Site +### Scope -The [site](../dcim/site.md) to which this prefix is assigned (optional). +!!! info "This field replaced the `site` field in NetBox v4.2." + +The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) to which the prefix is assigned (optional). ### VLAN diff --git a/docs/models/ipam/vlan.md b/docs/models/ipam/vlan.md index dc547ddbc..3c90d8cc9 100644 --- a/docs/models/ipam/vlan.md +++ b/docs/models/ipam/vlan.md @@ -29,8 +29,12 @@ The [VLAN group](./vlangroup.md) or [site](../dcim/site.md) to which the VLAN is ### Q-in-Q Role +!!! info "This field was introduced in NetBox v4.2." + For VLANs which comprise a Q-in-Q/IEEE 802.1ad topology, this field indicates whether the VLAN is treated as a service or customer VLAN. ### Q-in-Q Service VLAN +!!! info "This field was introduced in NetBox v4.2." + The designated parent service VLAN for a Q-in-Q customer VLAN. This may be set only for Q-in-Q custom VLANs. diff --git a/docs/models/ipam/vlangroup.md b/docs/models/ipam/vlangroup.md index 20989452f..67050ab4c 100644 --- a/docs/models/ipam/vlangroup.md +++ b/docs/models/ipam/vlangroup.md @@ -16,8 +16,6 @@ A unique URL-friendly identifier. (This value can be used for filtering.) ### VLAN ID Ranges -!!! info "This field replaced the legacy `min_vid` and `max_vid` fields in NetBox v4.1." - The set of VLAN IDs which are encompassed by the group. By default, this will be the entire range of valid IEEE 802.1Q VLAN IDs (1 to 4094, inclusive). VLANs created within a group must have a VID that falls within one of these ranges. Ranges may not overlap. ### Scope diff --git a/docs/models/ipam/vlantranslationpolicy.md b/docs/models/ipam/vlantranslationpolicy.md index 59541931e..9e3e8de98 100644 --- a/docs/models/ipam/vlantranslationpolicy.md +++ b/docs/models/ipam/vlantranslationpolicy.md @@ -1,5 +1,7 @@ # VLAN Translation Policies +!!! info "This feature was introduced in NetBox v4.2." + VLAN translation is a feature that consists of VLAN translation policies and [VLAN translation rules](./vlantranslationrule.md). Many rules can belong to a policy, and each rule defines a mapping of a local to remote VLAN ID (VID). A policy can then be assigned to an [Interface](../dcim/interface.md) or [VMInterface](../virtualization/vminterface.md), and all VLAN translation rules associated with that policy will be visible in the interface details. There are uniqueness constraints on `(policy, local_vid)` and on `(policy, remote_vid)` in the `VLANTranslationRule` model. Thus, you cannot have multiple rules linked to the same policy that have the same local VID or the same remote VID. A set of policies and rules might look like this: diff --git a/docs/models/ipam/vlantranslationrule.md b/docs/models/ipam/vlantranslationrule.md index bffc030ed..eb356d0d0 100644 --- a/docs/models/ipam/vlantranslationrule.md +++ b/docs/models/ipam/vlantranslationrule.md @@ -1,5 +1,7 @@ # VLAN Translation Rules +!!! info "This feature was introduced in NetBox v4.2." + A VLAN translation rule represents a one-to-one mapping of a local VLAN ID (VID) to a remote VID. Many rules can belong to a single policy. See [VLAN translation policies](./vlantranslationpolicy.md) for an overview of the VLAN Translation feature. diff --git a/docs/models/virtualization/cluster.md b/docs/models/virtualization/cluster.md index 9acdb2bc4..b9e6b608f 100644 --- a/docs/models/virtualization/cluster.md +++ b/docs/models/virtualization/cluster.md @@ -25,4 +25,6 @@ The cluster's operational status. ### Scope +!!! info "This field replaced the `site` field in NetBox v4.2." + The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) with which this cluster is associated. diff --git a/docs/models/virtualization/virtualmachine.md b/docs/models/virtualization/virtualmachine.md index 7ea31111c..a90b2752d 100644 --- a/docs/models/virtualization/virtualmachine.md +++ b/docs/models/virtualization/virtualmachine.md @@ -57,6 +57,4 @@ The amount of disk storage provisioned, in megabytes. ### Serial Number -!!! info "This field was introduced in NetBox v4.1." - Optional serial number assigned to this virtual machine. Unlike devices, uniqueness is not enforced for virtual machine serial numbers. diff --git a/docs/models/virtualization/vminterface.md b/docs/models/virtualization/vminterface.md index 880cf927b..ba0c68b15 100644 --- a/docs/models/virtualization/vminterface.md +++ b/docs/models/virtualization/vminterface.md @@ -45,6 +45,7 @@ For switched Ethernet interfaces, this identifies the 802.1Q encapsulation strat * **Access:** All traffic is assigned to a single VLAN, with no tagging. * **Tagged:** One untagged "native" VLAN is allowed, as well as any number of tagged VLANs. * **Tagged (all):** Implies that all VLANs are carried by the interface. One untagged VLAN may be designated. +* **Q-in-Q:** Q-in-Q (IEEE 802.1ad) encapsulation is performed using the assigned SVLAN. This field must be left blank for routed interfaces which do employ 802.1Q encapsulation. @@ -58,6 +59,8 @@ The tagged VLANs which are configured to be carried by this interface. Valid onl ### Q-in-Q SVLAN +!!! info "This field was introduced in NetBox v4.2." + The assigned service VLAN (for Q-in-Q/802.1ad interfaces). ### VRF @@ -66,4 +69,6 @@ The [virtual routing and forwarding](../ipam/vrf.md) instance to which this inte ### VLAN Translation Policy +!!! info "This field was introduced in NetBox v4.2." + The [VLAN translation policy](../ipam/vlantranslationpolicy.md) that applies to this interface (optional). diff --git a/docs/models/wireless/wirelesslan.md b/docs/models/wireless/wirelesslan.md index a448c42a2..2ce673086 100644 --- a/docs/models/wireless/wirelesslan.md +++ b/docs/models/wireless/wirelesslan.md @@ -46,4 +46,6 @@ The security key configured on each client to grant access to the secured wirele ### Scope +!!! info "This field was introduced in NetBox v4.2." + The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) with which this wireless LAN is associated. diff --git a/docs/models/wireless/wirelesslink.md b/docs/models/wireless/wirelesslink.md index 7553902b0..a9fd6b4fc 100644 --- a/docs/models/wireless/wirelesslink.md +++ b/docs/models/wireless/wirelesslink.md @@ -22,8 +22,6 @@ The service set identifier (SSID) for the wireless link (optional). ### Distance -!!! info "This field was introduced in NetBox v4.1." - The distance between the link's two endpoints, including a unit designation (e.g. 100 meters or 25 feet). ### Authentication Type diff --git a/docs/plugins/development/background-jobs.md b/docs/plugins/development/background-jobs.md index 3d789b6b9..9be52c3ca 100644 --- a/docs/plugins/development/background-jobs.md +++ b/docs/plugins/development/background-jobs.md @@ -1,7 +1,5 @@ # Background Jobs -!!! info "This feature was introduced in NetBox v4.1." - NetBox plugins can defer certain operations by enqueuing [background jobs](../../features/background-jobs.md), which are executed asynchronously by background workers. This is helpful for decoupling long-running processes from the user-facing request-response cycle. For example, your plugin might need to fetch data from a remote system. Depending on the amount of data and the responsiveness of the remote server, this could take a few minutes. Deferring this task to a queued job ensures that it can be completed in the background, without interrupting the user. The data it fetches can be made available once the job has completed. @@ -69,6 +67,8 @@ class MyModel(NetBoxModel): ### System Jobs +!!! info "This feature was introduced in NetBox v4.2." + Some plugins may implement background jobs that are decoupled from the request/response cycle. Typical use cases would be housekeeping tasks or synchronization jobs. These can be registered as _system jobs_ using the `system_job()` decorator. The job interval must be passed as an integer (in minutes) when registering a system job. System jobs are scheduled automatically when the RQ worker (`manage.py rqworker`) is run. #### Example diff --git a/docs/plugins/development/event-types.md b/docs/plugins/development/event-types.md index 4bcdeea31..65e2bbc5c 100644 --- a/docs/plugins/development/event-types.md +++ b/docs/plugins/development/event-types.md @@ -1,7 +1,5 @@ # Event Types -!!! info "This feature was introduced in NetBox v4.1." - Plugins can register their own custom event types for use with NetBox [event rules](../../models/extras/eventrule.md). This is accomplished by calling the `register()` method on an instance of the `EventType` class. This can be done anywhere within the plugin. An example is provided below. ```python diff --git a/docs/plugins/development/views.md b/docs/plugins/development/views.md index 3b6213917..e3740de59 100644 --- a/docs/plugins/development/views.md +++ b/docs/plugins/development/views.md @@ -206,8 +206,6 @@ Plugins can inject custom content into certain areas of core NetBox views. This | `right_page()` | Object view | Inject content on the right side of the page | | `full_width_page()` | Object view | Inject content across the entire bottom of the page | -!!! info "The `navbar()` and `alerts()` methods were introduced in NetBox v4.1." - Additionally, a `render()` method is available for convenience. This method accepts the name of a template to render, and any additional context data you want to pass. Its use is optional, however. To control where the custom content is injected, plugin authors can specify an iterable of models by overriding the `models` attribute on the subclass. Extensions which do not specify a set of models will be invoked on every view, where supported. diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md index 82da8cc4e..d996224c1 100644 --- a/docs/release-notes/index.md +++ b/docs/release-notes/index.md @@ -10,6 +10,14 @@ Minor releases are published in April, August, and December of each calendar yea This page contains a history of all major and minor releases since NetBox v2.0. For more detail on a specific patch release, please see the release notes page for that specific minor release. +#### [Version 4.2](./version-4.2.md) (January 2025) + +* Assign Multiple MAC Addresses per Interface ([#4867](https://github.com/netbox-community/netbox/issues/4867)) +* Quick Add UI Widget ([#5858](https://github.com/netbox-community/netbox/issues/5858)) +* VLAN Translation ([#7336](https://github.com/netbox-community/netbox/issues/7336)) +* Virtual Circuits ([#13086](https://github.com/netbox-community/netbox/issues/13086)) +* Q-in-Q Encapsulation ([#13428](https://github.com/netbox-community/netbox/issues/13428)) + #### [Version 4.1](./version-4.1.md) (September 2024) * Circuit Groups ([#7025](https://github.com/netbox-community/netbox/issues/7025)) From 27d970df418680f7fc3d0fcb2c6b2ba291db2757 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 2 Dec 2024 09:32:38 -0500 Subject: [PATCH 54/65] Update UI dependencies --- .../dist/graphiql/graphiql.min.js | 5568 +++++++---------- netbox/project-static/dist/netbox.js | Bin 390918 -> 390368 bytes netbox/project-static/dist/netbox.js.map | Bin 527957 -> 524890 bytes .../netbox-graphiql/package.json | 6 +- netbox/project-static/package.json | 6 +- .../src/select/classes/dynamicTomSelect.ts | 39 +- netbox/project-static/tsconfig.json | 4 +- netbox/project-static/yarn.lock | 82 +- 8 files changed, 2406 insertions(+), 3299 deletions(-) diff --git a/netbox/project-static/dist/graphiql/graphiql.min.js b/netbox/project-static/dist/graphiql/graphiql.min.js index 862ce3a80..03d4ac1e1 100644 --- a/netbox/project-static/dist/graphiql/graphiql.min.js +++ b/netbox/project-static/dist/graphiql/graphiql.min.js @@ -22986,17 +22986,79 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GraphQLError = void 0; +exports.formatError = formatError; +exports.printError = printError; var _isObjectLike = __webpack_require__(/*! ../jsutils/isObjectLike.mjs */ "../../../node_modules/graphql/jsutils/isObjectLike.mjs"); var _location = __webpack_require__(/*! ../language/location.mjs */ "../../../node_modules/graphql/language/location.mjs"); var _printLocation = __webpack_require__(/*! ../language/printLocation.mjs */ "../../../node_modules/graphql/language/printLocation.mjs"); +function toNormalizedOptions(args) { + const firstArg = args[0]; + if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) { + return { + nodes: firstArg, + source: args[1], + positions: args[2], + path: args[3], + originalError: args[4], + extensions: args[5] + }; + } + return firstArg; +} /** * A GraphQLError describes an Error found during the parse, validate, or * execute phases of performing a GraphQL operation. In addition to a message * and stack trace, it also includes information about the locations in a * GraphQL document and/or execution result that correspond to the Error. */ + class GraphQLError extends Error { - constructor(message, options = {}) { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor(message, ...rawArgs) { var _this$nodes, _nodeLocations$, _ref; const { nodes, @@ -23005,22 +23067,22 @@ class GraphQLError extends Error { path, originalError, extensions - } = options; + } = toNormalizedOptions(rawArgs); super(message); this.name = 'GraphQLError'; this.path = path !== null && path !== void 0 ? path : undefined; - this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; - // Compute list of blame nodes. + this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes. + this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined); - const nodeLocations = undefinedIfEmpty((_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map(node => node.loc).filter(loc => loc != null)); - // Compute locations in the source for the given nodes/positions. + const nodeLocations = undefinedIfEmpty((_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map(node => node.loc).filter(loc => loc != null)); // Compute locations in the source for the given nodes/positions. + this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source; this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map(loc => loc.start); this.locations = positions && source ? positions.map(pos => (0, _location.getLocation)(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map(loc => (0, _location.getLocation)(loc.source, loc.start)); const originalExtensions = (0, _isObjectLike.isObjectLike)(originalError === null || originalError === void 0 ? void 0 : originalError.extensions) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : undefined; - this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : Object.create(null); - // Only properties prescribed by the spec should be enumerable. + this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : Object.create(null); // Only properties prescribed by the spec should be enumerable. // Keep the rest as non-enumerable. + Object.defineProperties(this, { message: { writable: true, @@ -23041,17 +23103,18 @@ class GraphQLError extends Error { originalError: { enumerable: false } - }); - // Include (non-enumerable) stack trace. + }); // Include (non-enumerable) stack trace. + /* c8 ignore start */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 - if ((originalError === null || originalError === void 0 ? void 0 : originalError.stack) != null) { + + if (originalError !== null && originalError !== void 0 && originalError.stack) { Object.defineProperty(this, 'stack', { value: originalError.stack, writable: true, configurable: true }); - } else if (Error.captureStackTrace != null) { + } else if (Error.captureStackTrace) { Error.captureStackTrace(this, GraphQLError); } else { Object.defineProperty(this, 'stack', { @@ -23100,6 +23163,29 @@ exports.GraphQLError = GraphQLError; function undefinedIfEmpty(array) { return array === undefined || array.length === 0 ? undefined : array; } +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +function printError(error) { + return error.toString(); +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ + +function formatError(error) { + return error.toJSON(); +} /***/ }), @@ -23120,12 +23206,24 @@ Object.defineProperty(exports, "GraphQLError", ({ return _GraphQLError.GraphQLError; } })); +Object.defineProperty(exports, "formatError", ({ + enumerable: true, + get: function () { + return _GraphQLError.formatError; + } +})); Object.defineProperty(exports, "locatedError", ({ enumerable: true, get: function () { return _locatedError.locatedError; } })); +Object.defineProperty(exports, "printError", ({ + enumerable: true, + get: function () { + return _GraphQLError.printError; + } +})); Object.defineProperty(exports, "syntaxError", ({ enumerable: true, get: function () { @@ -23157,15 +23255,16 @@ var _GraphQLError = __webpack_require__(/*! ./GraphQLError.mjs */ "../../../node * GraphQL operation, produce a new GraphQLError aware of the location in the * document responsible for the original Error. */ + function locatedError(rawOriginalError, nodes, path) { - var _originalError$nodes; - const originalError = (0, _toError.toError)(rawOriginalError); - // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + var _nodes; + const originalError = (0, _toError.toError)(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + if (isLocatedGraphQLError(originalError)) { return originalError; } return new _GraphQLError.GraphQLError(originalError.message, { - nodes: (_originalError$nodes = originalError.nodes) !== null && _originalError$nodes !== void 0 ? _originalError$nodes : nodes, + nodes: (_nodes = originalError.nodes) !== null && _nodes !== void 0 ? _nodes : nodes, source: originalError.source, positions: originalError.positions, path, @@ -23195,6 +23294,7 @@ var _GraphQLError = __webpack_require__(/*! ./GraphQLError.mjs */ "../../../node * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. */ + function syntaxError(source, position, description) { return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, { source, @@ -23204,613 +23304,6 @@ function syntaxError(source, position, description) { /***/ }), -/***/ "../../../node_modules/graphql/execution/IncrementalGraph.mjs": -/*!********************************************************************!*\ - !*** ../../../node_modules/graphql/execution/IncrementalGraph.mjs ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.IncrementalGraph = void 0; -var _BoxedPromiseOrValue = __webpack_require__(/*! ../jsutils/BoxedPromiseOrValue.mjs */ "../../../node_modules/graphql/jsutils/BoxedPromiseOrValue.mjs"); -var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); -var _isPromise = __webpack_require__(/*! ../jsutils/isPromise.mjs */ "../../../node_modules/graphql/jsutils/isPromise.mjs"); -var _promiseWithResolvers = __webpack_require__(/*! ../jsutils/promiseWithResolvers.mjs */ "../../../node_modules/graphql/jsutils/promiseWithResolvers.mjs"); -var _types = __webpack_require__(/*! ./types.mjs */ "../../../node_modules/graphql/execution/types.mjs"); -/** - * @internal - */ -class IncrementalGraph { - constructor() { - this._rootNodes = new Set(); - this._completedQueue = []; - this._nextQueue = []; - } - getNewRootNodes(incrementalDataRecords) { - const initialResultChildren = new Set(); - this._addIncrementalDataRecords(incrementalDataRecords, undefined, initialResultChildren); - return this._promoteNonEmptyToRoot(initialResultChildren); - } - addCompletedSuccessfulExecutionGroup(successfulExecutionGroup) { - for (const deferredFragmentRecord of successfulExecutionGroup.pendingExecutionGroup.deferredFragmentRecords) { - deferredFragmentRecord.pendingExecutionGroups.delete(successfulExecutionGroup.pendingExecutionGroup); - deferredFragmentRecord.successfulExecutionGroups.add(successfulExecutionGroup); - } - const incrementalDataRecords = successfulExecutionGroup.incrementalDataRecords; - if (incrementalDataRecords !== undefined) { - this._addIncrementalDataRecords(incrementalDataRecords, successfulExecutionGroup.pendingExecutionGroup.deferredFragmentRecords); - } - } - *currentCompletedBatch() { - let completed; - while ((completed = this._completedQueue.shift()) !== undefined) { - yield completed; - } - if (this._rootNodes.size === 0) { - for (const resolve of this._nextQueue) { - resolve(undefined); - } - } - } - nextCompletedBatch() { - const { - promise, - resolve - } = (0, _promiseWithResolvers.promiseWithResolvers)(); - this._nextQueue.push(resolve); - return promise; - } - abort() { - for (const resolve of this._nextQueue) { - resolve(undefined); - } - } - hasNext() { - return this._rootNodes.size > 0; - } - completeDeferredFragment(deferredFragmentRecord) { - if (!this._rootNodes.has(deferredFragmentRecord) || deferredFragmentRecord.pendingExecutionGroups.size > 0) { - return; - } - const successfulExecutionGroups = Array.from(deferredFragmentRecord.successfulExecutionGroups); - this._removeRootNode(deferredFragmentRecord); - for (const successfulExecutionGroup of successfulExecutionGroups) { - for (const otherDeferredFragmentRecord of successfulExecutionGroup.pendingExecutionGroup.deferredFragmentRecords) { - otherDeferredFragmentRecord.successfulExecutionGroups.delete(successfulExecutionGroup); - } - } - const newRootNodes = this._promoteNonEmptyToRoot(deferredFragmentRecord.children); - return { - newRootNodes, - successfulExecutionGroups - }; - } - removeDeferredFragment(deferredFragmentRecord) { - if (!this._rootNodes.has(deferredFragmentRecord)) { - return false; - } - this._removeRootNode(deferredFragmentRecord); - return true; - } - removeStream(streamRecord) { - this._removeRootNode(streamRecord); - } - _removeRootNode(deliveryGroup) { - this._rootNodes.delete(deliveryGroup); - } - _addIncrementalDataRecords(incrementalDataRecords, parents, initialResultChildren) { - for (const incrementalDataRecord of incrementalDataRecords) { - if ((0, _types.isPendingExecutionGroup)(incrementalDataRecord)) { - for (const deferredFragmentRecord of incrementalDataRecord.deferredFragmentRecords) { - this._addDeferredFragment(deferredFragmentRecord, initialResultChildren); - deferredFragmentRecord.pendingExecutionGroups.add(incrementalDataRecord); - } - if (this._completesRootNode(incrementalDataRecord)) { - this._onExecutionGroup(incrementalDataRecord); - } - } else if (parents === undefined) { - initialResultChildren !== undefined || (0, _invariant.invariant)(false); - initialResultChildren.add(incrementalDataRecord); - } else { - for (const parent of parents) { - this._addDeferredFragment(parent, initialResultChildren); - parent.children.add(incrementalDataRecord); - } - } - } - } - _promoteNonEmptyToRoot(maybeEmptyNewRootNodes) { - const newRootNodes = []; - for (const node of maybeEmptyNewRootNodes) { - if ((0, _types.isDeferredFragmentRecord)(node)) { - if (node.pendingExecutionGroups.size > 0) { - for (const pendingExecutionGroup of node.pendingExecutionGroups) { - if (!this._completesRootNode(pendingExecutionGroup)) { - this._onExecutionGroup(pendingExecutionGroup); - } - } - this._rootNodes.add(node); - newRootNodes.push(node); - continue; - } - for (const child of node.children) { - maybeEmptyNewRootNodes.add(child); - } - } else { - this._rootNodes.add(node); - newRootNodes.push(node); - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this._onStreamItems(node); - } - } - return newRootNodes; - } - _completesRootNode(pendingExecutionGroup) { - return pendingExecutionGroup.deferredFragmentRecords.some(deferredFragmentRecord => this._rootNodes.has(deferredFragmentRecord)); - } - _addDeferredFragment(deferredFragmentRecord, initialResultChildren) { - if (this._rootNodes.has(deferredFragmentRecord)) { - return; - } - const parent = deferredFragmentRecord.parent; - if (parent === undefined) { - initialResultChildren !== undefined || (0, _invariant.invariant)(false); - initialResultChildren.add(deferredFragmentRecord); - return; - } - parent.children.add(deferredFragmentRecord); - this._addDeferredFragment(parent, initialResultChildren); - } - _onExecutionGroup(pendingExecutionGroup) { - let completedExecutionGroup = pendingExecutionGroup.result; - if (!(completedExecutionGroup instanceof _BoxedPromiseOrValue.BoxedPromiseOrValue)) { - completedExecutionGroup = completedExecutionGroup(); - } - const value = completedExecutionGroup.value; - if ((0, _isPromise.isPromise)(value)) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - value.then(resolved => this._enqueue(resolved)); - } else { - this._enqueue(value); - } - } - async _onStreamItems(streamRecord) { - let items = []; - let errors = []; - let incrementalDataRecords = []; - const streamItemQueue = streamRecord.streamItemQueue; - let streamItemRecord; - while ((streamItemRecord = streamItemQueue.shift()) !== undefined) { - let result = streamItemRecord instanceof _BoxedPromiseOrValue.BoxedPromiseOrValue ? streamItemRecord.value : streamItemRecord().value; - if ((0, _isPromise.isPromise)(result)) { - if (items.length > 0) { - this._enqueue({ - streamRecord, - result: - // TODO add additional test case or rework for coverage - errors.length > 0 /* c8 ignore start */ ? { - items, - errors - } /* c8 ignore stop */ : { - items - }, - incrementalDataRecords - }); - items = []; - errors = []; - incrementalDataRecords = []; - } - // eslint-disable-next-line no-await-in-loop - result = await result; - // wait an additional tick to coalesce resolving additional promises - // within the queue - // eslint-disable-next-line no-await-in-loop - await Promise.resolve(); - } - if (result.item === undefined) { - if (items.length > 0) { - this._enqueue({ - streamRecord, - result: errors.length > 0 ? { - items, - errors - } : { - items - }, - incrementalDataRecords - }); - } - this._enqueue(result.errors === undefined ? { - streamRecord - } : { - streamRecord, - errors: result.errors - }); - return; - } - items.push(result.item); - if (result.errors !== undefined) { - errors.push(...result.errors); - } - if (result.incrementalDataRecords !== undefined) { - incrementalDataRecords.push(...result.incrementalDataRecords); - } - } - } - *_yieldCurrentCompletedIncrementalData(first) { - yield first; - yield* this.currentCompletedBatch(); - } - _enqueue(completed) { - const next = this._nextQueue.shift(); - if (next !== undefined) { - next(this._yieldCurrentCompletedIncrementalData(completed)); - return; - } - this._completedQueue.push(completed); - } -} -exports.IncrementalGraph = IncrementalGraph; - -/***/ }), - -/***/ "../../../node_modules/graphql/execution/IncrementalPublisher.mjs": -/*!************************************************************************!*\ - !*** ../../../node_modules/graphql/execution/IncrementalPublisher.mjs ***! - \************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.buildIncrementalResponse = buildIncrementalResponse; -var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); -var _Path = __webpack_require__(/*! ../jsutils/Path.mjs */ "../../../node_modules/graphql/jsutils/Path.mjs"); -var _IncrementalGraph = __webpack_require__(/*! ./IncrementalGraph.mjs */ "../../../node_modules/graphql/execution/IncrementalGraph.mjs"); -var _types = __webpack_require__(/*! ./types.mjs */ "../../../node_modules/graphql/execution/types.mjs"); -function buildIncrementalResponse(context, result, errors, incrementalDataRecords) { - const incrementalPublisher = new IncrementalPublisher(context); - return incrementalPublisher.buildResponse(result, errors, incrementalDataRecords); -} -/** - * This class is used to publish incremental results to the client, enabling semi-concurrent - * execution while preserving result order. - * - * @internal - */ -class IncrementalPublisher { - constructor(context) { - this._context = context; - this._nextId = 0; - this._incrementalGraph = new _IncrementalGraph.IncrementalGraph(); - } - buildResponse(data, errors, incrementalDataRecords) { - const newRootNodes = this._incrementalGraph.getNewRootNodes(incrementalDataRecords); - const pending = this._toPendingResults(newRootNodes); - const initialResult = errors === undefined ? { - data, - pending, - hasNext: true - } : { - errors, - data, - pending, - hasNext: true - }; - return { - initialResult, - subsequentResults: this._subscribe() - }; - } - _toPendingResults(newRootNodes) { - const pendingResults = []; - for (const node of newRootNodes) { - const id = String(this._getNextId()); - node.id = id; - const pendingResult = { - id, - path: (0, _Path.pathToArray)(node.path) - }; - if (node.label !== undefined) { - pendingResult.label = node.label; - } - pendingResults.push(pendingResult); - } - return pendingResults; - } - _getNextId() { - return String(this._nextId++); - } - _subscribe() { - let isDone = false; - const _next = async () => { - if (isDone) { - await this._returnAsyncIteratorsIgnoringErrors(); - return { - value: undefined, - done: true - }; - } - const context = { - pending: [], - incremental: [], - completed: [] - }; - let batch = this._incrementalGraph.currentCompletedBatch(); - do { - for (const completedResult of batch) { - this._handleCompletedIncrementalData(completedResult, context); - } - const { - incremental, - completed - } = context; - if (incremental.length > 0 || completed.length > 0) { - const hasNext = this._incrementalGraph.hasNext(); - if (!hasNext) { - isDone = true; - } - const subsequentIncrementalExecutionResult = { - hasNext - }; - const pending = context.pending; - if (pending.length > 0) { - subsequentIncrementalExecutionResult.pending = pending; - } - if (incremental.length > 0) { - subsequentIncrementalExecutionResult.incremental = incremental; - } - if (completed.length > 0) { - subsequentIncrementalExecutionResult.completed = completed; - } - return { - value: subsequentIncrementalExecutionResult, - done: false - }; - } - // eslint-disable-next-line no-await-in-loop - batch = await this._incrementalGraph.nextCompletedBatch(); - } while (batch !== undefined); - await this._returnAsyncIteratorsIgnoringErrors(); - return { - value: undefined, - done: true - }; - }; - const _return = async () => { - isDone = true; - this._incrementalGraph.abort(); - await this._returnAsyncIterators(); - return { - value: undefined, - done: true - }; - }; - const _throw = async error => { - isDone = true; - this._incrementalGraph.abort(); - await this._returnAsyncIterators(); - return Promise.reject(error); - }; - return { - [Symbol.asyncIterator]() { - return this; - }, - next: _next, - return: _return, - throw: _throw - }; - } - _handleCompletedIncrementalData(completedIncrementalData, context) { - if ((0, _types.isCompletedExecutionGroup)(completedIncrementalData)) { - this._handleCompletedExecutionGroup(completedIncrementalData, context); - } else { - this._handleCompletedStreamItems(completedIncrementalData, context); - } - } - _handleCompletedExecutionGroup(completedExecutionGroup, context) { - if ((0, _types.isFailedExecutionGroup)(completedExecutionGroup)) { - for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup.deferredFragmentRecords) { - const id = deferredFragmentRecord.id; - if (!this._incrementalGraph.removeDeferredFragment(deferredFragmentRecord)) { - // This can occur if multiple deferred grouped field sets error for a fragment. - continue; - } - id !== undefined || (0, _invariant.invariant)(false); - context.completed.push({ - id, - errors: completedExecutionGroup.errors - }); - } - return; - } - this._incrementalGraph.addCompletedSuccessfulExecutionGroup(completedExecutionGroup); - for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup.deferredFragmentRecords) { - const completion = this._incrementalGraph.completeDeferredFragment(deferredFragmentRecord); - if (completion === undefined) { - continue; - } - const id = deferredFragmentRecord.id; - id !== undefined || (0, _invariant.invariant)(false); - const incremental = context.incremental; - const { - newRootNodes, - successfulExecutionGroups - } = completion; - context.pending.push(...this._toPendingResults(newRootNodes)); - for (const successfulExecutionGroup of successfulExecutionGroups) { - const { - bestId, - subPath - } = this._getBestIdAndSubPath(id, deferredFragmentRecord, successfulExecutionGroup); - const incrementalEntry = { - ...successfulExecutionGroup.result, - id: bestId - }; - if (subPath !== undefined) { - incrementalEntry.subPath = subPath; - } - incremental.push(incrementalEntry); - } - context.completed.push({ - id - }); - } - } - _handleCompletedStreamItems(streamItemsResult, context) { - const streamRecord = streamItemsResult.streamRecord; - const id = streamRecord.id; - id !== undefined || (0, _invariant.invariant)(false); - if (streamItemsResult.errors !== undefined) { - context.completed.push({ - id, - errors: streamItemsResult.errors - }); - this._incrementalGraph.removeStream(streamRecord); - if ((0, _types.isCancellableStreamRecord)(streamRecord)) { - this._context.cancellableStreams !== undefined || (0, _invariant.invariant)(false); - this._context.cancellableStreams.delete(streamRecord); - streamRecord.earlyReturn().catch(() => { - /* c8 ignore next 1 */ - // ignore error - }); - } - } else if (streamItemsResult.result === undefined) { - context.completed.push({ - id - }); - this._incrementalGraph.removeStream(streamRecord); - if ((0, _types.isCancellableStreamRecord)(streamRecord)) { - this._context.cancellableStreams !== undefined || (0, _invariant.invariant)(false); - this._context.cancellableStreams.delete(streamRecord); - } - } else { - const incrementalEntry = { - id, - ...streamItemsResult.result - }; - context.incremental.push(incrementalEntry); - const incrementalDataRecords = streamItemsResult.incrementalDataRecords; - if (incrementalDataRecords !== undefined) { - const newRootNodes = this._incrementalGraph.getNewRootNodes(incrementalDataRecords); - context.pending.push(...this._toPendingResults(newRootNodes)); - } - } - } - _getBestIdAndSubPath(initialId, initialDeferredFragmentRecord, completedExecutionGroup) { - let maxLength = (0, _Path.pathToArray)(initialDeferredFragmentRecord.path).length; - let bestId = initialId; - for (const deferredFragmentRecord of completedExecutionGroup.pendingExecutionGroup.deferredFragmentRecords) { - if (deferredFragmentRecord === initialDeferredFragmentRecord) { - continue; - } - const id = deferredFragmentRecord.id; - // TODO: add test case for when an fragment has not been released, but might be processed for the shortest path. - /* c8 ignore next 3 */ - if (id === undefined) { - continue; - } - const fragmentPath = (0, _Path.pathToArray)(deferredFragmentRecord.path); - const length = fragmentPath.length; - if (length > maxLength) { - maxLength = length; - bestId = id; - } - } - const subPath = completedExecutionGroup.path.slice(maxLength); - return { - bestId, - subPath: subPath.length > 0 ? subPath : undefined - }; - } - async _returnAsyncIterators() { - const cancellableStreams = this._context.cancellableStreams; - if (cancellableStreams === undefined) { - return; - } - const promises = []; - for (const streamRecord of cancellableStreams) { - if (streamRecord.earlyReturn !== undefined) { - promises.push(streamRecord.earlyReturn()); - } - } - await Promise.all(promises); - } - async _returnAsyncIteratorsIgnoringErrors() { - await this._returnAsyncIterators().catch(() => { - // Ignore errors - }); - } -} - -/***/ }), - -/***/ "../../../node_modules/graphql/execution/buildExecutionPlan.mjs": -/*!**********************************************************************!*\ - !*** ../../../node_modules/graphql/execution/buildExecutionPlan.mjs ***! - \**********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.buildExecutionPlan = buildExecutionPlan; -var _getBySet = __webpack_require__(/*! ../jsutils/getBySet.mjs */ "../../../node_modules/graphql/jsutils/getBySet.mjs"); -var _isSameSet = __webpack_require__(/*! ../jsutils/isSameSet.mjs */ "../../../node_modules/graphql/jsutils/isSameSet.mjs"); -function buildExecutionPlan(originalGroupedFieldSet, parentDeferUsages = new Set()) { - const groupedFieldSet = new Map(); - const newGroupedFieldSets = new Map(); - for (const [responseKey, fieldGroup] of originalGroupedFieldSet) { - const filteredDeferUsageSet = getFilteredDeferUsageSet(fieldGroup); - if ((0, _isSameSet.isSameSet)(filteredDeferUsageSet, parentDeferUsages)) { - groupedFieldSet.set(responseKey, fieldGroup); - continue; - } - let newGroupedFieldSet = (0, _getBySet.getBySet)(newGroupedFieldSets, filteredDeferUsageSet); - if (newGroupedFieldSet === undefined) { - newGroupedFieldSet = new Map(); - newGroupedFieldSets.set(filteredDeferUsageSet, newGroupedFieldSet); - } - newGroupedFieldSet.set(responseKey, fieldGroup); - } - return { - groupedFieldSet, - newGroupedFieldSets - }; -} -function getFilteredDeferUsageSet(fieldGroup) { - const filteredDeferUsageSet = new Set(); - for (const fieldDetails of fieldGroup) { - const deferUsage = fieldDetails.deferUsage; - if (deferUsage === undefined) { - filteredDeferUsageSet.clear(); - return filteredDeferUsageSet; - } - filteredDeferUsageSet.add(deferUsage); - } - for (const deferUsage of filteredDeferUsageSet) { - let parentDeferUsage = deferUsage.parentDeferUsage; - while (parentDeferUsage !== undefined) { - if (filteredDeferUsageSet.has(parentDeferUsage)) { - filteredDeferUsageSet.delete(deferUsage); - break; - } - parentDeferUsage = parentDeferUsage.parentDeferUsage; - } - } - return filteredDeferUsageSet; -} - -/***/ }), - /***/ "../../../node_modules/graphql/execution/collectFields.mjs": /*!*****************************************************************!*\ !*** ../../../node_modules/graphql/execution/collectFields.mjs ***! @@ -23824,9 +23317,6 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.collectFields = collectFields; exports.collectSubfields = collectSubfields; -var _AccumulatorMap = __webpack_require__(/*! ../jsutils/AccumulatorMap.mjs */ "../../../node_modules/graphql/jsutils/AccumulatorMap.mjs"); -var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); -var _ast = __webpack_require__(/*! ../language/ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); var _directives = __webpack_require__(/*! ../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); @@ -23841,22 +23331,11 @@ var _values = __webpack_require__(/*! ./values.mjs */ "../../../node_modules/gra * * @internal */ -function collectFields(schema, fragments, variableValues, runtimeType, operation) { - const groupedFieldSet = new _AccumulatorMap.AccumulatorMap(); - const newDeferUsages = []; - const context = { - schema, - fragments, - variableValues, - runtimeType, - operation, - visitedFragmentNames: new Set() - }; - collectFieldsImpl(context, operation.selectionSet, groupedFieldSet, newDeferUsages); - return { - groupedFieldSet, - newDeferUsages - }; + +function collectFields(schema, fragments, variableValues, runtimeType, selectionSet) { + const fields = new Map(); + collectFieldsImpl(schema, fragments, variableValues, runtimeType, selectionSet, fields, new Set()); + return fields; } /** * Given an array of field nodes, collects all of the subfields of the passed @@ -23868,38 +23347,18 @@ function collectFields(schema, fragments, variableValues, runtimeType, operation * * @internal */ -// eslint-disable-next-line max-params -function collectSubfields(schema, fragments, variableValues, operation, returnType, fieldGroup) { - const context = { - schema, - fragments, - variableValues, - runtimeType: returnType, - operation, - visitedFragmentNames: new Set() - }; - const subGroupedFieldSet = new _AccumulatorMap.AccumulatorMap(); - const newDeferUsages = []; - for (const fieldDetail of fieldGroup) { - const node = fieldDetail.node; + +function collectSubfields(schema, fragments, variableValues, returnType, fieldNodes) { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + for (const node of fieldNodes) { if (node.selectionSet) { - collectFieldsImpl(context, node.selectionSet, subGroupedFieldSet, newDeferUsages, fieldDetail.deferUsage); + collectFieldsImpl(schema, fragments, variableValues, returnType, node.selectionSet, subFieldNodes, visitedFragmentNames); } } - return { - groupedFieldSet: subGroupedFieldSet, - newDeferUsages - }; + return subFieldNodes; } -function collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages, deferUsage) { - const { - schema, - fragments, - variableValues, - runtimeType, - operation, - visitedFragmentNames - } = context; +function collectFieldsImpl(schema, fragments, variableValues, runtimeType, selectionSet, fields, visitedFragmentNames) { for (const selection of selectionSet.selections) { switch (selection.kind) { case _kinds.Kind.FIELD: @@ -23907,10 +23366,13 @@ function collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsage if (!shouldIncludeNode(variableValues, selection)) { continue; } - groupedFieldSet.add(getFieldEntryKey(selection), { - node: selection, - deferUsage - }); + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } break; } case _kinds.Kind.INLINE_FRAGMENT: @@ -23918,61 +23380,31 @@ function collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsage if (!shouldIncludeNode(variableValues, selection) || !doesFragmentConditionMatch(schema, selection, runtimeType)) { continue; } - const newDeferUsage = getDeferUsage(operation, variableValues, selection, deferUsage); - if (!newDeferUsage) { - collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, deferUsage); - } else { - newDeferUsages.push(newDeferUsage); - collectFieldsImpl(context, selection.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage); - } + collectFieldsImpl(schema, fragments, variableValues, runtimeType, selection.selectionSet, fields, visitedFragmentNames); break; } case _kinds.Kind.FRAGMENT_SPREAD: { const fragName = selection.name.value; - const newDeferUsage = getDeferUsage(operation, variableValues, selection, deferUsage); - if (!newDeferUsage && (visitedFragmentNames.has(fragName) || !shouldIncludeNode(variableValues, selection))) { + if (visitedFragmentNames.has(fragName) || !shouldIncludeNode(variableValues, selection)) { continue; } + visitedFragmentNames.add(fragName); const fragment = fragments[fragName]; - if (fragment == null || !doesFragmentConditionMatch(schema, fragment, runtimeType)) { + if (!fragment || !doesFragmentConditionMatch(schema, fragment, runtimeType)) { continue; } - if (!newDeferUsage) { - visitedFragmentNames.add(fragName); - collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, deferUsage); - } else { - newDeferUsages.push(newDeferUsage); - collectFieldsImpl(context, fragment.selectionSet, groupedFieldSet, newDeferUsages, newDeferUsage); - } + collectFieldsImpl(schema, fragments, variableValues, runtimeType, fragment.selectionSet, fields, visitedFragmentNames); break; } } } } -/** - * Returns an object containing the `@defer` arguments if a field should be - * deferred based on the experimental flag, defer directive present and - * not disabled by the "if" argument. - */ -function getDeferUsage(operation, variableValues, node, parentDeferUsage) { - const defer = (0, _values.getDirectiveValues)(_directives.GraphQLDeferDirective, node, variableValues); - if (!defer) { - return; - } - if (defer.if === false) { - return; - } - operation.operation !== _ast.OperationTypeNode.SUBSCRIPTION || (0, _invariant.invariant)(false, '`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.'); - return { - label: typeof defer.label === 'string' ? defer.label : undefined, - parentDeferUsage - }; -} /** * Determines if a field should be included based on the `@include` and `@skip` * directives, where `@skip` has higher precedence than `@include`. */ + function shouldIncludeNode(variableValues, node) { const skip = (0, _values.getDirectiveValues)(_directives.GraphQLSkipDirective, node, variableValues); if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { @@ -23987,6 +23419,7 @@ function shouldIncludeNode(variableValues, node) { /** * Determines if a fragment is applicable to the given type. */ + function doesFragmentConditionMatch(schema, fragment, type) { const typeConditionNode = fragment.typeCondition; if (!typeConditionNode) { @@ -24004,6 +23437,7 @@ function doesFragmentConditionMatch(schema, fragment, type) { /** * Implements the logic to compute the key of a given field's entry */ + function getFieldEntryKey(node) { return node.alias ? node.alias.value : node.name.value; } @@ -24021,18 +23455,16 @@ function getFieldEntryKey(node) { Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assertValidExecutionArguments = assertValidExecutionArguments; exports.buildExecutionContext = buildExecutionContext; exports.buildResolveInfo = buildResolveInfo; -exports.createSourceEventStream = createSourceEventStream; exports.defaultTypeResolver = exports.defaultFieldResolver = void 0; exports.execute = execute; exports.executeSync = executeSync; -exports.experimentalExecuteIncrementally = experimentalExecuteIncrementally; -exports.subscribe = subscribe; -var _BoxedPromiseOrValue = __webpack_require__(/*! ../jsutils/BoxedPromiseOrValue.mjs */ "../../../node_modules/graphql/jsutils/BoxedPromiseOrValue.mjs"); +exports.getFieldDef = getFieldDef; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); -var _isAsyncIterable = __webpack_require__(/*! ../jsutils/isAsyncIterable.mjs */ "../../../node_modules/graphql/jsutils/isAsyncIterable.mjs"); var _isIterableObject = __webpack_require__(/*! ../jsutils/isIterableObject.mjs */ "../../../node_modules/graphql/jsutils/isIterableObject.mjs"); var _isObjectLike = __webpack_require__(/*! ../jsutils/isObjectLike.mjs */ "../../../node_modules/graphql/jsutils/isObjectLike.mjs"); var _isPromise = __webpack_require__(/*! ../jsutils/isPromise.mjs */ "../../../node_modules/graphql/jsutils/isPromise.mjs"); @@ -24045,25 +23477,44 @@ var _locatedError = __webpack_require__(/*! ../error/locatedError.mjs */ "../../ var _ast = __webpack_require__(/*! ../language/ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); -var _directives = __webpack_require__(/*! ../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); +var _introspection = __webpack_require__(/*! ../type/introspection.mjs */ "../../../node_modules/graphql/type/introspection.mjs"); var _validate = __webpack_require__(/*! ../type/validate.mjs */ "../../../node_modules/graphql/type/validate.mjs"); -var _buildExecutionPlan = __webpack_require__(/*! ./buildExecutionPlan.mjs */ "../../../node_modules/graphql/execution/buildExecutionPlan.mjs"); var _collectFields = __webpack_require__(/*! ./collectFields.mjs */ "../../../node_modules/graphql/execution/collectFields.mjs"); -var _IncrementalPublisher = __webpack_require__(/*! ./IncrementalPublisher.mjs */ "../../../node_modules/graphql/execution/IncrementalPublisher.mjs"); -var _mapAsyncIterable = __webpack_require__(/*! ./mapAsyncIterable.mjs */ "../../../node_modules/graphql/execution/mapAsyncIterable.mjs"); -var _types = __webpack_require__(/*! ./types.mjs */ "../../../node_modules/graphql/execution/types.mjs"); var _values = __webpack_require__(/*! ./values.mjs */ "../../../node_modules/graphql/execution/values.mjs"); -/* eslint-disable max-params */ -// This file contains a lot of such errors but we plan to refactor it anyway -// so just disable it for entire file. /** * A memoized collection of relevant subfields with regard to the return * type. Memoizing ensures the subfields are not repeatedly calculated, which * saves overhead when resolving lists of values. */ -const collectSubfields = (0, _memoize.memoize3)((exeContext, returnType, fieldGroup) => (0, _collectFields.collectSubfields)(exeContext.schema, exeContext.fragments, exeContext.variableValues, exeContext.operation, returnType, fieldGroup)); -const UNEXPECTED_EXPERIMENTAL_DIRECTIVES = 'The provided schema unexpectedly contains experimental directives (@defer or @stream). These directives may only be utilized if experimental execution features are explicitly enabled.'; -const UNEXPECTED_MULTIPLE_PAYLOADS = 'Executing this GraphQL operation would unexpectedly produce multiple payloads (due to @defer or @stream directive)'; + +const collectSubfields = (0, _memoize.memoize3)((exeContext, returnType, fieldNodes) => (0, _collectFields.collectSubfields)(exeContext.schema, exeContext.fragments, exeContext.variableValues, returnType, fieldNodes)); +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ + /** * Implements the "Executing requests" section of the GraphQL specification. * @@ -24073,177 +23524,105 @@ const UNEXPECTED_MULTIPLE_PAYLOADS = 'Executing this GraphQL operation would une * * If the arguments to this function do not result in a legal execution context, * a GraphQLError will be thrown immediately explaining the invalid input. - * - * This function does not support incremental delivery (`@defer` and `@stream`). - * If an operation which would defer or stream data is executed with this - * function, it will throw or return a rejected promise. - * Use `experimentalExecuteIncrementally` if you want to support incremental - * delivery. */ function execute(args) { - if (args.schema.getDirective('defer') || args.schema.getDirective('stream')) { - throw new Error(UNEXPECTED_EXPERIMENTAL_DIRECTIVES); - } - const result = experimentalExecuteIncrementally(args); - if (!(0, _isPromise.isPromise)(result)) { - if ('initialResult' in result) { - // This can happen if the operation contains @defer or @stream directives - // and is not validated prior to execution - throw new Error(UNEXPECTED_MULTIPLE_PAYLOADS); - } - return result; - } - return result.then(incrementalResult => { - if ('initialResult' in incrementalResult) { - // This can happen if the operation contains @defer or @stream directives - // and is not validated prior to execution - throw new Error(UNEXPECTED_MULTIPLE_PAYLOADS); - } - return incrementalResult; - }); -} -/** - * Implements the "Executing requests" section of the GraphQL specification, - * including `@defer` and `@stream` as proposed in - * https://github.com/graphql/graphql-spec/pull/742 - * - * This function returns a Promise of an ExperimentalIncrementalExecutionResults - * object. This object either consists of a single ExecutionResult, or an - * object containing an `initialResult` and a stream of `subsequentResults`. - * - * If the arguments to this function do not result in a legal execution context, - * a GraphQLError will be thrown immediately explaining the invalid input. - */ -function experimentalExecuteIncrementally(args) { - // If a valid execution context cannot be created due to incorrect arguments, + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || (0, _devAssert.devAssert)(false, 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.'); + const { + schema, + document, + variableValues, + rootValue + } = args; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, // a "Response" with only errors is returned. - const exeContext = buildExecutionContext(args); - // Return early errors if execution context failed. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + if (!('schema' in exeContext)) { return { errors: exeContext }; - } - return executeOperation(exeContext); -} -/** - * Implements the "Executing operations" section of the spec. - * - * Returns a Promise that will eventually resolve to the data described by - * The "Response" section of the GraphQL specification. - * - * If errors are encountered while executing a GraphQL field, only that - * field and its descendants will be omitted, and sibling fields will still - * be executed. An execution which encounters errors will still result in a - * resolved Promise. - * - * Errors from sub-fields of a NonNull type may propagate to the top level, - * at which point we still log the error and null the parent field, which - * in this case is the entire response. - */ -function executeOperation(exeContext) { + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + try { const { - operation, - schema, - fragments, - variableValues, - rootValue + operation } = exeContext; - const rootType = schema.getRootType(operation.operation); - if (rootType == null) { - throw new _GraphQLError.GraphQLError(`Schema is not configured to execute ${operation.operation} operation.`, { - nodes: operation + const result = executeOperation(exeContext, operation, rootValue); + if ((0, _isPromise.isPromise)(result)) { + return result.then(data => buildResponse(data, exeContext.errors), error => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); }); } - const collectedFields = (0, _collectFields.collectFields)(schema, fragments, variableValues, rootType, operation); - let groupedFieldSet = collectedFields.groupedFieldSet; - const newDeferUsages = collectedFields.newDeferUsages; - let graphqlWrappedResult; - if (newDeferUsages.length === 0) { - graphqlWrappedResult = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, groupedFieldSet, undefined); - } else { - const executionPlan = (0, _buildExecutionPlan.buildExecutionPlan)(groupedFieldSet); - groupedFieldSet = executionPlan.groupedFieldSet; - const newGroupedFieldSets = executionPlan.newGroupedFieldSets; - const newDeferMap = addNewDeferredFragments(newDeferUsages, new Map()); - graphqlWrappedResult = executeRootGroupedFieldSet(exeContext, operation.operation, rootType, rootValue, groupedFieldSet, newDeferMap); - if (newGroupedFieldSets.size > 0) { - const newPendingExecutionGroups = collectExecutionGroups(exeContext, rootType, rootValue, undefined, undefined, newGroupedFieldSets, newDeferMap); - graphqlWrappedResult = withNewExecutionGroups(graphqlWrappedResult, newPendingExecutionGroups); - } - } - if ((0, _isPromise.isPromise)(graphqlWrappedResult)) { - return graphqlWrappedResult.then(resolved => buildDataResponse(exeContext, resolved[0], resolved[1]), error => ({ - data: null, - errors: withError(exeContext.errors, error) - })); - } - return buildDataResponse(exeContext, graphqlWrappedResult[0], graphqlWrappedResult[1]); + return buildResponse(result, exeContext.errors); } catch (error) { - return { - data: null, - errors: withError(exeContext.errors, error) - }; + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); } } -function withNewExecutionGroups(result, newPendingExecutionGroups) { - if ((0, _isPromise.isPromise)(result)) { - return result.then(resolved => { - addIncrementalDataRecords(resolved, newPendingExecutionGroups); - return resolved; - }); - } - addIncrementalDataRecords(result, newPendingExecutionGroups); - return result; -} -function addIncrementalDataRecords(graphqlWrappedResult, incrementalDataRecords) { - if (incrementalDataRecords === undefined) { - return; - } - if (graphqlWrappedResult[1] === undefined) { - graphqlWrappedResult[1] = [...incrementalDataRecords]; - } else { - graphqlWrappedResult[1].push(...incrementalDataRecords); - } -} -function withError(errors, error) { - return errors === undefined ? [error] : [...errors, error]; -} -function buildDataResponse(exeContext, data, incrementalDataRecords) { - const errors = exeContext.errors; - if (incrementalDataRecords === undefined) { - return errors !== undefined ? { - errors, - data - } : { - data - }; - } - return (0, _IncrementalPublisher.buildIncrementalResponse)(exeContext, data, errors, incrementalDataRecords); -} /** * Also implements the "Executing requests" section of the GraphQL specification. * However, it guarantees to complete synchronously (or throw an error) assuming * that all field resolvers are also synchronous. */ + function executeSync(args) { - const result = experimentalExecuteIncrementally(args); - // Assert that the execution was synchronous. - if ((0, _isPromise.isPromise)(result) || 'initialResult' in result) { + const result = execute(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.isPromise)(result)) { throw new Error('GraphQL execution failed to complete synchronously.'); } return result; } +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ + +function buildResponse(data, errors) { + return errors.length === 0 ? { + data + } : { + errors, + data + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + +function assertValidExecutionArguments(schema, document, rawVariableValues) { + document || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || (0, _isObjectLike.isObjectLike)(rawVariableValues) || (0, _devAssert.devAssert)(false, 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.'); +} /** * Constructs a ExecutionContext object from the arguments passed to * execute, which we will pass throughout the other execution methods. * * Throws a GraphQLError if a valid execution context cannot be created. * - * TODO: consider no longer exporting this function * @internal */ + function buildExecutionContext(args) { var _definition$name, _operation$variableDe; const { @@ -24255,11 +23634,8 @@ function buildExecutionContext(args) { operationName, fieldResolver, typeResolver, - subscribeFieldResolver, - enableEarlyExecution + subscribeFieldResolver } = args; - // If the schema used for execution is invalid, throw an error. - (0, _validate.assertValidSchema)(schema); let operation; const fragments = Object.create(null); for (const definition of document.definitions) { @@ -24277,8 +23653,7 @@ function buildExecutionContext(args) { case _kinds.Kind.FRAGMENT_DEFINITION: fragments[definition.name.value] = definition; break; - default: - // ignore non-executable definitions + default: // ignore non-executable definitions } } if (!operation) { @@ -24286,9 +23661,10 @@ function buildExecutionContext(args) { return [new _GraphQLError.GraphQLError(`Unknown operation named "${operationName}".`)]; } return [new _GraphQLError.GraphQLError('Must provide an operation.')]; - } - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; const coercedVariableValues = (0, _values.getVariableValues)(schema, variableDefinitions, rawVariableValues !== null && rawVariableValues !== void 0 ? rawVariableValues : {}, { maxErrors: 50 @@ -24306,100 +23682,91 @@ function buildExecutionContext(args) { fieldResolver: fieldResolver !== null && fieldResolver !== void 0 ? fieldResolver : defaultFieldResolver, typeResolver: typeResolver !== null && typeResolver !== void 0 ? typeResolver : defaultTypeResolver, subscribeFieldResolver: subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 ? subscribeFieldResolver : defaultFieldResolver, - enableEarlyExecution: enableEarlyExecution === true, - errors: undefined, - cancellableStreams: undefined + errors: [] }; } -function buildPerEventExecutionContext(exeContext, payload) { - return { - ...exeContext, - rootValue: payload, - errors: undefined - }; -} -function executeRootGroupedFieldSet(exeContext, operation, rootType, rootValue, groupedFieldSet, deferMap) { - switch (operation) { +/** + * Implements the "Executing operations" section of the spec. + */ + +function executeOperation(exeContext, operation, rootValue) { + const rootType = exeContext.schema.getRootType(operation.operation); + if (rootType == null) { + throw new _GraphQLError.GraphQLError(`Schema is not configured to execute ${operation.operation} operation.`, { + nodes: operation + }); + } + const rootFields = (0, _collectFields.collectFields)(exeContext.schema, exeContext.fragments, exeContext.variableValues, rootType, operation.selectionSet); + const path = undefined; + switch (operation.operation) { case _ast.OperationTypeNode.QUERY: - return executeFields(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined, deferMap); + return executeFields(exeContext, rootType, rootValue, path, rootFields); case _ast.OperationTypeNode.MUTATION: - return executeFieldsSerially(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined, deferMap); + return executeFieldsSerially(exeContext, rootType, rootValue, path, rootFields); case _ast.OperationTypeNode.SUBSCRIPTION: // TODO: deprecate `subscribe` and move all logic here // Temporary solution until we finish merging execute and subscribe together - return executeFields(exeContext, rootType, rootValue, undefined, groupedFieldSet, undefined, deferMap); + return executeFields(exeContext, rootType, rootValue, path, rootFields); } } /** * Implements the "Executing selection sets" section of the spec * for fields that must be executed serially. */ -function executeFieldsSerially(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) { - return (0, _promiseReduce.promiseReduce)(groupedFieldSet, (graphqlWrappedResult, [responseName, fieldGroup]) => { + +function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) { + return (0, _promiseReduce.promiseReduce)(fields.entries(), (results, [responseName, fieldNodes]) => { const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); - const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext, deferMap); + const result = executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); if (result === undefined) { - return graphqlWrappedResult; + return results; } if ((0, _isPromise.isPromise)(result)) { - return result.then(resolved => { - graphqlWrappedResult[0][responseName] = resolved[0]; - addIncrementalDataRecords(graphqlWrappedResult, resolved[1]); - return graphqlWrappedResult; + return result.then(resolvedResult => { + results[responseName] = resolvedResult; + return results; }); } - graphqlWrappedResult[0][responseName] = result[0]; - addIncrementalDataRecords(graphqlWrappedResult, result[1]); - return graphqlWrappedResult; - }, [Object.create(null), undefined]); + results[responseName] = result; + return results; + }, Object.create(null)); } /** * Implements the "Executing selection sets" section of the spec * for fields that may be executed in parallel. */ -function executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) { + +function executeFields(exeContext, parentType, sourceValue, path, fields) { const results = Object.create(null); - const graphqlWrappedResult = [results, undefined]; let containsPromise = false; try { - for (const [responseName, fieldGroup] of groupedFieldSet) { + for (const [responseName, fieldNodes] of fields.entries()) { const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); - const result = executeField(exeContext, parentType, sourceValue, fieldGroup, fieldPath, incrementalContext, deferMap); + const result = executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath); if (result !== undefined) { + results[responseName] = result; if ((0, _isPromise.isPromise)(result)) { - results[responseName] = result.then(resolved => { - addIncrementalDataRecords(graphqlWrappedResult, resolved[1]); - return resolved[0]; - }); containsPromise = true; - } else { - results[responseName] = result[0]; - addIncrementalDataRecords(graphqlWrappedResult, result[1]); } } } } catch (error) { if (containsPromise) { // Ensure that any promises returned by other fields are handled, as they may also reject. - return (0, _promiseForObject.promiseForObject)(results, () => { - /* noop */ - }).finally(() => { + return (0, _promiseForObject.promiseForObject)(results).finally(() => { throw error; }); } throw error; - } - // If there are no promises, we can just return the object and any incrementalDataRecords + } // If there are no promises, we can just return the object + if (!containsPromise) { - return graphqlWrappedResult; - } - // Otherwise, results is a map from field name to the result of resolving that + return results; + } // Otherwise, results is a map from field name to the result of resolving that // field, which is possibly a promise. Return a promise that will return this // same map, but with any promises replaced with the values they resolved to. - return (0, _promiseForObject.promiseForObject)(results, resolved => [resolved, graphqlWrappedResult[1]]); -} -function toNodes(fieldGroup) { - return fieldGroup.map(fieldDetails => fieldDetails.node); + + return (0, _promiseForObject.promiseForObject)(results); } /** * Implements the "Executing fields" section of the spec @@ -24407,49 +23774,51 @@ function toNodes(fieldGroup) { * calling its resolve function, then calls completeValue to complete promises, * serialize scalars, or execute the sub-selection-set for objects. */ -function executeField(exeContext, parentType, source, fieldGroup, path, incrementalContext, deferMap) { + +function executeField(exeContext, parentType, source, fieldNodes, path) { var _fieldDef$resolve; - const fieldName = fieldGroup[0].node.name.value; - const fieldDef = exeContext.schema.getField(parentType, fieldName); + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); if (!fieldDef) { return; } const returnType = fieldDef.type; const resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver; - const info = buildResolveInfo(exeContext, fieldDef, toNodes(fieldGroup), parentType, path); - // Get the resolve function, regardless of if its result is normal or abrupt (error). + const info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error). + try { // Build a JS object of arguments from the field.arguments AST, using the // variables scope to fulfill any variable references. // TODO: find a way to memoize, in case this field is within a List type. - const args = (0, _values.getArgumentValues)(fieldDef, fieldGroup[0].node, exeContext.variableValues); - // The resolve function's optional third argument is a context value that + const args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues); // The resolve function's optional third argument is a context value that // is provided to every resolve function within an execution. It is commonly // used to represent an authenticated user, or request-specific caches. + const contextValue = exeContext.contextValue; const result = resolveFn(source, args, contextValue, info); + let completed; if ((0, _isPromise.isPromise)(result)) { - return completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap); + completed = result.then(resolved => completeValue(exeContext, returnType, fieldNodes, info, path, resolved)); + } else { + completed = completeValue(exeContext, returnType, fieldNodes, info, path, result); } - const completed = completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap); if ((0, _isPromise.isPromise)(completed)) { // Note: we don't rely on a `catch` method, but we do expect "thenable" // to take a second callback for the error case. return completed.then(undefined, rawError => { - handleFieldError(rawError, exeContext, returnType, fieldGroup, path, incrementalContext); - return [null, undefined]; + const error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); + return handleFieldError(error, returnType, exeContext); }); } return completed; } catch (rawError) { - handleFieldError(rawError, exeContext, returnType, fieldGroup, path, incrementalContext); - return [null, undefined]; + const error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path)); + return handleFieldError(error, returnType, exeContext); } } /** - * TODO: consider no longer exporting this function * @internal */ + function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { // The resolve function's optional fourth argument is a collection of // information about the current execution state. @@ -24466,22 +23835,16 @@ function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { variableValues: exeContext.variableValues }; } -function handleFieldError(rawError, exeContext, returnType, fieldGroup, path, incrementalContext) { - const error = (0, _locatedError.locatedError)(rawError, toNodes(fieldGroup), (0, _Path.pathToArray)(path)); +function handleFieldError(error, returnType, exeContext) { // If the field type is non-nullable, then it is resolved without any // protection from errors, however it still properly locates the error. if ((0, _definition.isNonNullType)(returnType)) { throw error; - } - // Otherwise, error protection is applied, logging the error and resolving + } // Otherwise, error protection is applied, logging the error and resolving // a null value for this field if one is encountered. - const context = incrementalContext !== null && incrementalContext !== void 0 ? incrementalContext : exeContext; - let errors = context.errors; - if (errors === undefined) { - errors = []; - context.errors = errors; - } - errors.push(error); + + exeContext.errors.push(error); + return null; } /** * Implements the instructions for completeValue as defined in the @@ -24504,271 +23867,94 @@ function handleFieldError(rawError, exeContext, returnType, fieldGroup, path, in * Otherwise, the field type expects a sub-selection set, and will complete the * value by executing all sub-selections. */ -function completeValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) { + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { // If result is an Error, throw a located error. if (result instanceof Error) { throw result; - } - // If field type is NonNull, complete for inner type, and throw field error + } // If field type is NonNull, complete for inner type, and throw field error // if result is null. + if ((0, _definition.isNonNullType)(returnType)) { - const completed = completeValue(exeContext, returnType.ofType, fieldGroup, info, path, result, incrementalContext, deferMap); - if (completed[0] === null) { + const completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path, result); + if (completed === null) { throw new Error(`Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`); } return completed; - } - // If result value is null or undefined then return null. + } // If result value is null or undefined then return null. + if (result == null) { - return [null, undefined]; - } - // If field type is List, complete each item in the list with the inner type + return null; + } // If field type is List, complete each item in the list with the inner type + if ((0, _definition.isListType)(returnType)) { - return completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap); - } - // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + return completeListValue(exeContext, returnType, fieldNodes, info, path, result); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, // returning null if serialization is not possible. + if ((0, _definition.isLeafType)(returnType)) { - return [completeLeafValue(returnType, result), undefined]; - } - // If field type is an abstract type, Interface or Union, determine the + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the // runtime Object type and complete for that type. + if ((0, _definition.isAbstractType)(returnType)) { - return completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap); - } - // If field type is Object, execute and complete all sub-selections. + return completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result); + } // If field type is Object, execute and complete all sub-selections. + if ((0, _definition.isObjectType)(returnType)) { - return completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap); + return completeObjectValue(exeContext, returnType, fieldNodes, info, path, result); } /* c8 ignore next 6 */ // Not reachable, all possible output types have been considered. + false || (0, _invariant.invariant)(false, 'Cannot complete value of unexpected output type: ' + (0, _inspect.inspect)(returnType)); } -async function completePromisedValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) { - try { - const resolved = await result; - let completed = completeValue(exeContext, returnType, fieldGroup, info, path, resolved, incrementalContext, deferMap); - if ((0, _isPromise.isPromise)(completed)) { - completed = await completed; - } - return completed; - } catch (rawError) { - handleFieldError(rawError, exeContext, returnType, fieldGroup, path, incrementalContext); - return [null, undefined]; - } -} -/** - * Returns an object containing info for streaming if a field should be - * streamed based on the experimental flag, stream directive present and - * not disabled by the "if" argument. - */ -function getStreamUsage(exeContext, fieldGroup, path) { - // do not stream inner lists of multi-dimensional lists - if (typeof path.key === 'number') { - return; - } - // TODO: add test for this case (a streamed list nested under a list). - /* c8 ignore next 7 */ - if (fieldGroup._streamUsage !== undefined) { - return fieldGroup._streamUsage; - } - // validation only allows equivalent streams on multiple fields, so it is - // safe to only check the first fieldNode for the stream directive - const stream = (0, _values.getDirectiveValues)(_directives.GraphQLStreamDirective, fieldGroup[0].node, exeContext.variableValues); - if (!stream) { - return; - } - if (stream.if === false) { - return; - } - typeof stream.initialCount === 'number' || (0, _invariant.invariant)(false, 'initialCount must be a number'); - stream.initialCount >= 0 || (0, _invariant.invariant)(false, 'initialCount must be a positive integer'); - exeContext.operation.operation !== _ast.OperationTypeNode.SUBSCRIPTION || (0, _invariant.invariant)(false, '`@stream` directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`.'); - const streamedFieldGroup = fieldGroup.map(fieldDetails => ({ - node: fieldDetails.node, - deferUsage: undefined - })); - const streamUsage = { - initialCount: stream.initialCount, - label: typeof stream.label === 'string' ? stream.label : undefined, - fieldGroup: streamedFieldGroup - }; - fieldGroup._streamUsage = streamUsage; - return streamUsage; -} -/** - * Complete a async iterator value by completing the result and calling - * recursively until all the results are completed. - */ -async function completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext, deferMap) { - let containsPromise = false; - const completedResults = []; - const graphqlWrappedResult = [completedResults, undefined]; - let index = 0; - const streamUsage = getStreamUsage(exeContext, fieldGroup, path); - const earlyReturn = asyncIterator.return === undefined ? undefined : asyncIterator.return.bind(asyncIterator); - try { - // eslint-disable-next-line no-constant-condition - while (true) { - if (streamUsage && index >= streamUsage.initialCount) { - const streamItemQueue = buildAsyncStreamItemQueue(index, path, asyncIterator, exeContext, streamUsage.fieldGroup, info, itemType); - let streamRecord; - if (earlyReturn === undefined) { - streamRecord = { - label: streamUsage.label, - path, - streamItemQueue - }; - } else { - streamRecord = { - label: streamUsage.label, - path, - earlyReturn, - streamItemQueue - }; - if (exeContext.cancellableStreams === undefined) { - exeContext.cancellableStreams = new Set(); - } - exeContext.cancellableStreams.add(streamRecord); - } - addIncrementalDataRecords(graphqlWrappedResult, [streamRecord]); - break; - } - const itemPath = (0, _Path.addPath)(path, index, undefined); - let iteration; - try { - // eslint-disable-next-line no-await-in-loop - iteration = await asyncIterator.next(); - } catch (rawError) { - throw (0, _locatedError.locatedError)(rawError, toNodes(fieldGroup), (0, _Path.pathToArray)(path)); - } - // TODO: add test case for stream returning done before initialCount - /* c8 ignore next 3 */ - if (iteration.done) { - break; - } - const item = iteration.value; - // TODO: add tests for stream backed by asyncIterator that returns a promise - /* c8 ignore start */ - if ((0, _isPromise.isPromise)(item)) { - completedResults.push(completePromisedListItemValue(item, graphqlWrappedResult, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap)); - containsPromise = true; - } else if ( /* c8 ignore stop */ - completeListItemValue(item, completedResults, graphqlWrappedResult, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap) - // TODO: add tests for stream backed by asyncIterator that completes to a promise - /* c8 ignore start */) { - containsPromise = true; - } - /* c8 ignore stop */ - index++; - } - } catch (error) { - if (earlyReturn !== undefined) { - earlyReturn().catch(() => { - /* c8 ignore next 1 */ - // ignore error - }); - } - throw error; - } - return containsPromise ? /* c8 ignore start */Promise.all(completedResults).then(resolved => [resolved, graphqlWrappedResult[1]]) : /* c8 ignore stop */graphqlWrappedResult; -} /** * Complete a list value by completing each item in the list with the * inner type */ -function completeListValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) { - const itemType = returnType.ofType; - if ((0, _isAsyncIterable.isAsyncIterable)(result)) { - const asyncIterator = result[Symbol.asyncIterator](); - return completeAsyncIteratorValue(exeContext, itemType, fieldGroup, info, path, asyncIterator, incrementalContext, deferMap); - } + +function completeListValue(exeContext, returnType, fieldNodes, info, path, result) { if (!(0, _isIterableObject.isIterableObject)(result)) { throw new _GraphQLError.GraphQLError(`Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`); - } - return completeIterableValue(exeContext, itemType, fieldGroup, info, path, result, incrementalContext, deferMap); -} -function completeIterableValue(exeContext, itemType, fieldGroup, info, path, items, incrementalContext, deferMap) { - // This is specified as a simple map, however we're optimizing the path + } // This is specified as a simple map, however we're optimizing the path // where the list contains no Promises by avoiding creating another Promise. + + const itemType = returnType.ofType; let containsPromise = false; - const completedResults = []; - const graphqlWrappedResult = [completedResults, undefined]; - let index = 0; - const streamUsage = getStreamUsage(exeContext, fieldGroup, path); - const iterator = items[Symbol.iterator](); - let iteration = iterator.next(); - while (!iteration.done) { - const item = iteration.value; - if (streamUsage && index >= streamUsage.initialCount) { - const syncStreamRecord = { - label: streamUsage.label, - path, - streamItemQueue: buildSyncStreamItemQueue(item, index, path, iterator, exeContext, streamUsage.fieldGroup, info, itemType) - }; - addIncrementalDataRecords(graphqlWrappedResult, [syncStreamRecord]); - break; - } + const completedResults = Array.from(result, (item, index) => { // No need to modify the info object containing the path, // since from here on it is not ever accessed by resolver functions. const itemPath = (0, _Path.addPath)(path, index, undefined); - if ((0, _isPromise.isPromise)(item)) { - completedResults.push(completePromisedListItemValue(item, graphqlWrappedResult, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap)); - containsPromise = true; - } else if (completeListItemValue(item, completedResults, graphqlWrappedResult, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap)) { - containsPromise = true; + try { + let completedItem; + if ((0, _isPromise.isPromise)(item)) { + completedItem = item.then(resolved => completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved)); + } else { + completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item); + } + if ((0, _isPromise.isPromise)(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, rawError => { + const error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); + return handleFieldError(error, itemType, exeContext); + }); + } + return completedItem; + } catch (rawError) { + const error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath)); + return handleFieldError(error, itemType, exeContext); } - index++; - iteration = iterator.next(); - } - return containsPromise ? Promise.all(completedResults).then(resolved => [resolved, graphqlWrappedResult[1]]) : graphqlWrappedResult; -} -/** - * Complete a list item value by adding it to the completed results. - * - * Returns true if the value is a Promise. - */ -function completeListItemValue(item, completedResults, parent, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap) { - try { - const completedItem = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, deferMap); - if ((0, _isPromise.isPromise)(completedItem)) { - // Note: we don't rely on a `catch` method, but we do expect "thenable" - // to take a second callback for the error case. - completedResults.push(completedItem.then(resolved => { - addIncrementalDataRecords(parent, resolved[1]); - return resolved[0]; - }, rawError => { - handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath, incrementalContext); - return null; - })); - return true; - } - completedResults.push(completedItem[0]); - addIncrementalDataRecords(parent, completedItem[1]); - } catch (rawError) { - handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath, incrementalContext); - completedResults.push(null); - } - return false; -} -async function completePromisedListItemValue(item, parent, exeContext, itemType, fieldGroup, info, itemPath, incrementalContext, deferMap) { - try { - const resolved = await item; - let completed = completeValue(exeContext, itemType, fieldGroup, info, itemPath, resolved, incrementalContext, deferMap); - if ((0, _isPromise.isPromise)(completed)) { - completed = await completed; - } - addIncrementalDataRecords(parent, completed[1]); - return completed[0]; - } catch (rawError) { - handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath, incrementalContext); - return null; - } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; } /** * Complete a Scalar or Enum by serializing to a valid value, returning * null if serialization is not possible. */ + function completeLeafValue(returnType, result) { const serializedResult = returnType.serialize(result); if (serializedResult == null) { @@ -24780,24 +23966,23 @@ function completeLeafValue(returnType, result) { * Complete a value of an abstract type by determining the runtime object type * of that value, then complete the value for that type. */ -function completeAbstractValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) { + +function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, result) { var _returnType$resolveTy; const resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver; const contextValue = exeContext.contextValue; const runtimeType = resolveTypeFn(result, contextValue, info, returnType); if ((0, _isPromise.isPromise)(runtimeType)) { - return runtimeType.then(resolvedRuntimeType => completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext, deferMap)); + return runtimeType.then(resolvedRuntimeType => completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result)); } - return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldGroup, info, result), fieldGroup, info, path, result, incrementalContext, deferMap); + return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path, result); } -function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGroup, info, result) { +function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldNodes, info, result) { if (runtimeTypeName == null) { - throw new _GraphQLError.GraphQLError(`Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, { - nodes: toNodes(fieldGroup) - }); - } - // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + throw new _GraphQLError.GraphQLError(`Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, fieldNodes); + } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` // TODO: remove in 17.0.0 release + if ((0, _definition.isObjectType)(runtimeTypeName)) { throw new _GraphQLError.GraphQLError('Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.'); } @@ -24807,17 +23992,17 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGr const runtimeType = exeContext.schema.getType(runtimeTypeName); if (runtimeType == null) { throw new _GraphQLError.GraphQLError(`Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, { - nodes: toNodes(fieldGroup) + nodes: fieldNodes }); } if (!(0, _definition.isObjectType)(runtimeType)) { throw new _GraphQLError.GraphQLError(`Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, { - nodes: toNodes(fieldGroup) + nodes: fieldNodes }); } if (!exeContext.schema.isSubType(returnType, runtimeType)) { throw new _GraphQLError.GraphQLError(`Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, { - nodes: toNodes(fieldGroup) + nodes: fieldNodes }); } return runtimeType; @@ -24825,92 +24010,34 @@ function ensureValidRuntimeType(runtimeTypeName, exeContext, returnType, fieldGr /** * Complete an Object value by executing all sub-selections. */ -function completeObjectValue(exeContext, returnType, fieldGroup, info, path, result, incrementalContext, deferMap) { - // If there is an isTypeOf predicate function, call it with the + +function completeObjectValue(exeContext, returnType, fieldNodes, info, path, result) { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the // current result. If isTypeOf returns false, then raise an error rather // than continuing execution. + if (returnType.isTypeOf) { const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); if ((0, _isPromise.isPromise)(isTypeOf)) { return isTypeOf.then(resolvedIsTypeOf => { if (!resolvedIsTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldGroup); + throw invalidReturnTypeError(returnType, result, fieldNodes); } - return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap); + return executeFields(exeContext, returnType, result, path, subFieldNodes); }); } if (!isTypeOf) { - throw invalidReturnTypeError(returnType, result, fieldGroup); + throw invalidReturnTypeError(returnType, result, fieldNodes); } } - return collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap); + return executeFields(exeContext, returnType, result, path, subFieldNodes); } -function invalidReturnTypeError(returnType, result, fieldGroup) { +function invalidReturnTypeError(returnType, result, fieldNodes) { return new _GraphQLError.GraphQLError(`Expected value of type "${returnType.name}" but got: ${(0, _inspect.inspect)(result)}.`, { - nodes: toNodes(fieldGroup) + nodes: fieldNodes }); } -/** - * Instantiates new DeferredFragmentRecords for the given path within an - * incremental data record, returning an updated map of DeferUsage - * objects to DeferredFragmentRecords. - * - * Note: As defer directives may be used with operations returning lists, - * a DeferUsage object may correspond to many DeferredFragmentRecords. - * - * DeferredFragmentRecord creation includes the following steps: - * 1. The new DeferredFragmentRecord is instantiated at the given path. - * 2. The parent result record is calculated from the given incremental data - * record. - * 3. The IncrementalPublisher is notified that a new DeferredFragmentRecord - * with the calculated parent has been added; the record will be released only - * after the parent has completed. - * - */ -function addNewDeferredFragments(newDeferUsages, newDeferMap, path) { - // For each new deferUsage object: - for (const newDeferUsage of newDeferUsages) { - const parentDeferUsage = newDeferUsage.parentDeferUsage; - const parent = parentDeferUsage === undefined ? undefined : deferredFragmentRecordFromDeferUsage(parentDeferUsage, newDeferMap); - // Instantiate the new record. - const deferredFragmentRecord = new _types.DeferredFragmentRecord(path, newDeferUsage.label, parent); - // Update the map. - newDeferMap.set(newDeferUsage, deferredFragmentRecord); - } - return newDeferMap; -} -function deferredFragmentRecordFromDeferUsage(deferUsage, deferMap) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return deferMap.get(deferUsage); -} -function collectAndExecuteSubfields(exeContext, returnType, fieldGroup, path, result, incrementalContext, deferMap) { - // Collect sub-fields to execute to complete this value. - const collectedSubfields = collectSubfields(exeContext, returnType, fieldGroup); - let groupedFieldSet = collectedSubfields.groupedFieldSet; - const newDeferUsages = collectedSubfields.newDeferUsages; - if (deferMap === undefined && newDeferUsages.length === 0) { - return executeFields(exeContext, returnType, result, path, groupedFieldSet, incrementalContext, undefined); - } - const subExecutionPlan = buildSubExecutionPlan(groupedFieldSet, incrementalContext === null || incrementalContext === void 0 ? void 0 : incrementalContext.deferUsageSet); - groupedFieldSet = subExecutionPlan.groupedFieldSet; - const newGroupedFieldSets = subExecutionPlan.newGroupedFieldSets; - const newDeferMap = addNewDeferredFragments(newDeferUsages, new Map(deferMap), path); - const subFields = executeFields(exeContext, returnType, result, path, groupedFieldSet, incrementalContext, newDeferMap); - if (newGroupedFieldSets.size > 0) { - const newPendingExecutionGroups = collectExecutionGroups(exeContext, returnType, result, path, incrementalContext === null || incrementalContext === void 0 ? void 0 : incrementalContext.deferUsageSet, newGroupedFieldSets, newDeferMap); - return withNewExecutionGroups(subFields, newPendingExecutionGroups); - } - return subFields; -} -function buildSubExecutionPlan(originalGroupedFieldSet, deferUsageSet) { - let executionPlan = originalGroupedFieldSet._executionPlan; - if (executionPlan !== undefined) { - return executionPlan; - } - executionPlan = (0, _buildExecutionPlan.buildExecutionPlan)(originalGroupedFieldSet, deferUsageSet); - originalGroupedFieldSet._executionPlan = executionPlan; - return executionPlan; -} /** * If a resolveType function is not given, then a default resolve behavior is * used which attempts two strategies: @@ -24921,12 +24048,13 @@ function buildSubExecutionPlan(originalGroupedFieldSet, deferUsageSet) { * Otherwise, test each possible type for the abstract type by calling * isTypeOf for the object being coerced, returning the first type that matches. */ + const defaultTypeResolver = function (value, contextValue, info, abstractType) { // First, look for `__typename`. if ((0, _isObjectLike.isObjectLike)(value) && typeof value.__typename === 'string') { return value.__typename; - } - // Otherwise, test each possible type. + } // Otherwise, test each possible type. + const possibleTypes = info.schema.getPossibleTypes(abstractType); const promisedIsTypeOfResults = []; for (let i = 0; i < possibleTypes.length; i++) { @@ -24968,340 +24096,27 @@ const defaultFieldResolver = function (source, args, contextValue, info) { } }; /** - * Implements the "Subscribe" algorithm described in the GraphQL specification. + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. * - * Returns a Promise which resolves to either an AsyncIterator (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with descriptive - * errors and no data will be returned. - * - * If the source stream could not be created due to faulty subscription resolver - * logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to an AsyncIterator, which - * yields a stream of ExecutionResults representing the response stream. - * - * This function does not support incremental delivery (`@defer` and `@stream`). - * If an operation which would defer or stream data is executed with this - * function, a field error will be raised at the location of the `@defer` or - * `@stream` directive. - * - * Accepts an object with named arguments. + * @internal */ exports.defaultFieldResolver = defaultFieldResolver; -function subscribe(args) { - // If a valid execution context cannot be created due to incorrect arguments, - // a "Response" with only errors is returned. - const exeContext = buildExecutionContext(args); - // Return early errors if execution context failed. - if (!('schema' in exeContext)) { - return { - errors: exeContext - }; +function getFieldDef(schema, parentType, fieldNode) { + const fieldName = fieldNode.name.value; + if (fieldName === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.SchemaMetaFieldDef; + } else if (fieldName === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.TypeMetaFieldDef; + } else if (fieldName === _introspection.TypeNameMetaFieldDef.name) { + return _introspection.TypeNameMetaFieldDef; } - const resultOrStream = createSourceEventStreamImpl(exeContext); - if ((0, _isPromise.isPromise)(resultOrStream)) { - return resultOrStream.then(resolvedResultOrStream => mapSourceToResponse(exeContext, resolvedResultOrStream)); - } - return mapSourceToResponse(exeContext, resultOrStream); -} -function mapSourceToResponse(exeContext, resultOrStream) { - if (!(0, _isAsyncIterable.isAsyncIterable)(resultOrStream)) { - return resultOrStream; - } - // For each payload yielded from a subscription, map it over the normal - // GraphQL `execute` function, with `payload` as the rootValue. - // This implements the "MapSourceToResponseEvent" algorithm described in - // the GraphQL specification. The `execute` function provides the - // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the - // "ExecuteQuery" algorithm, for which `execute` is also used. - return (0, _mapAsyncIterable.mapAsyncIterable)(resultOrStream, payload => executeOperation(buildPerEventExecutionContext(exeContext, payload))); -} -/** - * Implements the "CreateSourceEventStream" algorithm described in the - * GraphQL specification, resolving the subscription source event stream. - * - * Returns a Promise which resolves to either an AsyncIterable (if successful) - * or an ExecutionResult (error). The promise will be rejected if the schema or - * other arguments to this function are invalid, or if the resolved event stream - * is not an async iterable. - * - * If the client-provided arguments to this function do not result in a - * compliant subscription, a GraphQL Response (ExecutionResult) with - * descriptive errors and no data will be returned. - * - * If the the source stream could not be created due to faulty subscription - * resolver logic or underlying systems, the promise will resolve to a single - * ExecutionResult containing `errors` and no `data`. - * - * If the operation succeeded, the promise resolves to the AsyncIterable for the - * event stream returned by the resolver. - * - * A Source Event Stream represents a sequence of events, each of which triggers - * a GraphQL execution for that event. - * - * This may be useful when hosting the stateful subscription service in a - * different process or machine than the stateless GraphQL execution engine, - * or otherwise separating these two steps. For more on this, see the - * "Supporting Subscriptions at Scale" information in the GraphQL specification. - */ -function createSourceEventStream(args) { - // If a valid execution context cannot be created due to incorrect arguments, - // a "Response" with only errors is returned. - const exeContext = buildExecutionContext(args); - // Return early errors if execution context failed. - if (!('schema' in exeContext)) { - return { - errors: exeContext - }; - } - return createSourceEventStreamImpl(exeContext); -} -function createSourceEventStreamImpl(exeContext) { - try { - const eventStream = executeSubscription(exeContext); - if ((0, _isPromise.isPromise)(eventStream)) { - return eventStream.then(undefined, error => ({ - errors: [error] - })); - } - return eventStream; - } catch (error) { - return { - errors: [error] - }; - } -} -function executeSubscription(exeContext) { - const { - schema, - fragments, - operation, - variableValues, - rootValue - } = exeContext; - const rootType = schema.getSubscriptionType(); - if (rootType == null) { - throw new _GraphQLError.GraphQLError('Schema is not configured to execute subscription operation.', { - nodes: operation - }); - } - const { - groupedFieldSet - } = (0, _collectFields.collectFields)(schema, fragments, variableValues, rootType, operation); - const firstRootField = groupedFieldSet.entries().next().value; - const [responseName, fieldGroup] = firstRootField; - const fieldName = fieldGroup[0].node.name.value; - const fieldDef = schema.getField(rootType, fieldName); - const fieldNodes = fieldGroup.map(fieldDetails => fieldDetails.node); - if (!fieldDef) { - throw new _GraphQLError.GraphQLError(`The subscription field "${fieldName}" is not defined.`, { - nodes: fieldNodes - }); - } - const path = (0, _Path.addPath)(undefined, responseName, rootType.name); - const info = buildResolveInfo(exeContext, fieldDef, fieldNodes, rootType, path); - try { - var _fieldDef$subscribe; - // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. - // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. - // Build a JS object of arguments from the field.arguments AST, using the - // variables scope to fulfill any variable references. - const args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues); - // The resolve function's optional third argument is a context value that - // is provided to every resolve function within an execution. It is commonly - // used to represent an authenticated user, or request-specific caches. - const contextValue = exeContext.contextValue; - // Call the `subscribe()` resolver or the default resolver to produce an - // AsyncIterable yielding raw payloads. - const resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.subscribeFieldResolver; - const result = resolveFn(rootValue, args, contextValue, info); - if ((0, _isPromise.isPromise)(result)) { - return result.then(assertEventStream).then(undefined, error => { - throw (0, _locatedError.locatedError)(error, fieldNodes, (0, _Path.pathToArray)(path)); - }); - } - return assertEventStream(result); - } catch (error) { - throw (0, _locatedError.locatedError)(error, fieldNodes, (0, _Path.pathToArray)(path)); - } -} -function assertEventStream(result) { - if (result instanceof Error) { - throw result; - } - // Assert field returned an event stream, otherwise yield an error. - if (!(0, _isAsyncIterable.isAsyncIterable)(result)) { - throw new _GraphQLError.GraphQLError('Subscription field must return Async Iterable. ' + `Received: ${(0, _inspect.inspect)(result)}.`); - } - return result; -} -function collectExecutionGroups(exeContext, parentType, sourceValue, path, parentDeferUsages, newGroupedFieldSets, deferMap) { - const newPendingExecutionGroups = []; - for (const [deferUsageSet, groupedFieldSet] of newGroupedFieldSets) { - const deferredFragmentRecords = getDeferredFragmentRecords(deferUsageSet, deferMap); - const pendingExecutionGroup = { - deferredFragmentRecords, - result: undefined - }; - const executor = () => executeExecutionGroup(pendingExecutionGroup, exeContext, parentType, sourceValue, path, groupedFieldSet, { - errors: undefined, - deferUsageSet - }, deferMap); - if (exeContext.enableEarlyExecution) { - pendingExecutionGroup.result = new _BoxedPromiseOrValue.BoxedPromiseOrValue(shouldDefer(parentDeferUsages, deferUsageSet) ? Promise.resolve().then(executor) : executor()); - } else { - pendingExecutionGroup.result = () => new _BoxedPromiseOrValue.BoxedPromiseOrValue(executor()); - } - newPendingExecutionGroups.push(pendingExecutionGroup); - } - return newPendingExecutionGroups; -} -function shouldDefer(parentDeferUsages, deferUsages) { - // If we have a new child defer usage, defer. - // Otherwise, this defer usage was already deferred when it was initially - // encountered, and is now in the midst of executing early, so the new - // deferred grouped fields set can be executed immediately. - return parentDeferUsages === undefined || !Array.from(deferUsages).every(deferUsage => parentDeferUsages.has(deferUsage)); -} -function executeExecutionGroup(pendingExecutionGroup, exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap) { - let result; - try { - result = executeFields(exeContext, parentType, sourceValue, path, groupedFieldSet, incrementalContext, deferMap); - } catch (error) { - return { - pendingExecutionGroup, - path: (0, _Path.pathToArray)(path), - errors: withError(incrementalContext.errors, error) - }; - } - if ((0, _isPromise.isPromise)(result)) { - return result.then(resolved => buildCompletedExecutionGroup(incrementalContext.errors, pendingExecutionGroup, path, resolved), error => ({ - pendingExecutionGroup, - path: (0, _Path.pathToArray)(path), - errors: withError(incrementalContext.errors, error) - })); - } - return buildCompletedExecutionGroup(incrementalContext.errors, pendingExecutionGroup, path, result); -} -function buildCompletedExecutionGroup(errors, pendingExecutionGroup, path, result) { - return { - pendingExecutionGroup, - path: (0, _Path.pathToArray)(path), - result: errors === undefined ? { - data: result[0] - } : { - data: result[0], - errors - }, - incrementalDataRecords: result[1] - }; -} -function getDeferredFragmentRecords(deferUsages, deferMap) { - return Array.from(deferUsages).map(deferUsage => deferredFragmentRecordFromDeferUsage(deferUsage, deferMap)); -} -function buildSyncStreamItemQueue(initialItem, initialIndex, streamPath, iterator, exeContext, fieldGroup, info, itemType) { - const streamItemQueue = []; - const enableEarlyExecution = exeContext.enableEarlyExecution; - const firstExecutor = () => { - const initialPath = (0, _Path.addPath)(streamPath, initialIndex, undefined); - const firstStreamItem = new _BoxedPromiseOrValue.BoxedPromiseOrValue(completeStreamItem(initialPath, initialItem, exeContext, { - errors: undefined - }, fieldGroup, info, itemType)); - let iteration = iterator.next(); - let currentIndex = initialIndex + 1; - let currentStreamItem = firstStreamItem; - while (!iteration.done) { - // TODO: add test case for early sync termination - /* c8 ignore next 6 */ - if (currentStreamItem instanceof _BoxedPromiseOrValue.BoxedPromiseOrValue) { - const result = currentStreamItem.value; - if (!(0, _isPromise.isPromise)(result) && result.errors !== undefined) { - break; - } - } - const itemPath = (0, _Path.addPath)(streamPath, currentIndex, undefined); - const value = iteration.value; - const currentExecutor = () => completeStreamItem(itemPath, value, exeContext, { - errors: undefined - }, fieldGroup, info, itemType); - currentStreamItem = enableEarlyExecution ? new _BoxedPromiseOrValue.BoxedPromiseOrValue(currentExecutor()) : () => new _BoxedPromiseOrValue.BoxedPromiseOrValue(currentExecutor()); - streamItemQueue.push(currentStreamItem); - iteration = iterator.next(); - currentIndex = initialIndex + 1; - } - streamItemQueue.push(new _BoxedPromiseOrValue.BoxedPromiseOrValue({})); - return firstStreamItem.value; - }; - streamItemQueue.push(enableEarlyExecution ? new _BoxedPromiseOrValue.BoxedPromiseOrValue(Promise.resolve().then(firstExecutor)) : () => new _BoxedPromiseOrValue.BoxedPromiseOrValue(firstExecutor())); - return streamItemQueue; -} -function buildAsyncStreamItemQueue(initialIndex, streamPath, asyncIterator, exeContext, fieldGroup, info, itemType) { - const streamItemQueue = []; - const executor = () => getNextAsyncStreamItemResult(streamItemQueue, streamPath, initialIndex, asyncIterator, exeContext, fieldGroup, info, itemType); - streamItemQueue.push(exeContext.enableEarlyExecution ? new _BoxedPromiseOrValue.BoxedPromiseOrValue(executor()) : () => new _BoxedPromiseOrValue.BoxedPromiseOrValue(executor())); - return streamItemQueue; -} -async function getNextAsyncStreamItemResult(streamItemQueue, streamPath, index, asyncIterator, exeContext, fieldGroup, info, itemType) { - let iteration; - try { - iteration = await asyncIterator.next(); - } catch (error) { - return { - errors: [(0, _locatedError.locatedError)(error, toNodes(fieldGroup), (0, _Path.pathToArray)(streamPath))] - }; - } - if (iteration.done) { - return {}; - } - const itemPath = (0, _Path.addPath)(streamPath, index, undefined); - const result = completeStreamItem(itemPath, iteration.value, exeContext, { - errors: undefined - }, fieldGroup, info, itemType); - const executor = () => getNextAsyncStreamItemResult(streamItemQueue, streamPath, index + 1, asyncIterator, exeContext, fieldGroup, info, itemType); - streamItemQueue.push(exeContext.enableEarlyExecution ? new _BoxedPromiseOrValue.BoxedPromiseOrValue(executor()) : () => new _BoxedPromiseOrValue.BoxedPromiseOrValue(executor())); - return result; -} -function completeStreamItem(itemPath, item, exeContext, incrementalContext, fieldGroup, info, itemType) { - if ((0, _isPromise.isPromise)(item)) { - return completePromisedValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, new Map()).then(resolvedItem => buildStreamItemResult(incrementalContext.errors, resolvedItem), error => ({ - errors: withError(incrementalContext.errors, error) - })); - } - let result; - try { - try { - result = completeValue(exeContext, itemType, fieldGroup, info, itemPath, item, incrementalContext, new Map()); - } catch (rawError) { - handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath, incrementalContext); - result = [null, undefined]; - } - } catch (error) { - return { - errors: withError(incrementalContext.errors, error) - }; - } - if ((0, _isPromise.isPromise)(result)) { - return result.then(undefined, rawError => { - handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath, incrementalContext); - return [null, undefined]; - }).then(resolvedItem => buildStreamItemResult(incrementalContext.errors, resolvedItem), error => ({ - errors: withError(incrementalContext.errors, error) - })); - } - return buildStreamItemResult(incrementalContext.errors, result); -} -function buildStreamItemResult(errors, result) { - return { - item: result[0], - errors, - incrementalDataRecords: result[1] - }; + return parentType.getFields()[fieldName]; } /***/ }), @@ -25320,7 +24135,7 @@ Object.defineProperty(exports, "__esModule", ({ Object.defineProperty(exports, "createSourceEventStream", ({ enumerable: true, get: function () { - return _execute.createSourceEventStream; + return _subscribe.createSourceEventStream; } })); Object.defineProperty(exports, "defaultFieldResolver", ({ @@ -25347,12 +24162,6 @@ Object.defineProperty(exports, "executeSync", ({ return _execute.executeSync; } })); -Object.defineProperty(exports, "experimentalExecuteIncrementally", ({ - enumerable: true, - get: function () { - return _execute.experimentalExecuteIncrementally; - } -})); Object.defineProperty(exports, "getArgumentValues", ({ enumerable: true, get: function () { @@ -25380,18 +24189,19 @@ Object.defineProperty(exports, "responsePathAsArray", ({ Object.defineProperty(exports, "subscribe", ({ enumerable: true, get: function () { - return _execute.subscribe; + return _subscribe.subscribe; } })); var _Path = __webpack_require__(/*! ../jsutils/Path.mjs */ "../../../node_modules/graphql/jsutils/Path.mjs"); var _execute = __webpack_require__(/*! ./execute.mjs */ "../../../node_modules/graphql/execution/execute.mjs"); +var _subscribe = __webpack_require__(/*! ./subscribe.mjs */ "../../../node_modules/graphql/execution/subscribe.mjs"); var _values = __webpack_require__(/*! ./values.mjs */ "../../../node_modules/graphql/execution/values.mjs"); /***/ }), -/***/ "../../../node_modules/graphql/execution/mapAsyncIterable.mjs": +/***/ "../../../node_modules/graphql/execution/mapAsyncIterator.mjs": /*!********************************************************************!*\ - !*** ../../../node_modules/graphql/execution/mapAsyncIterable.mjs ***! + !*** ../../../node_modules/graphql/execution/mapAsyncIterator.mjs ***! \********************************************************************/ /***/ (function(__unused_webpack_module, exports) { @@ -25400,12 +24210,12 @@ var _values = __webpack_require__(/*! ./values.mjs */ "../../../node_modules/gra Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.mapAsyncIterable = mapAsyncIterable; +exports.mapAsyncIterator = mapAsyncIterator; /** * Given an AsyncIterable and a callback function, return an AsyncIterator * which produces values mapped via calling the callback function. */ -function mapAsyncIterable(iterable, callback) { +function mapAsyncIterator(iterable, callback) { const iterator = iterable[Symbol.asyncIterator](); async function mapResult(result) { if (result.done) { @@ -25455,49 +24265,201 @@ function mapAsyncIterable(iterable, callback) { /***/ }), -/***/ "../../../node_modules/graphql/execution/types.mjs": -/*!*********************************************************!*\ - !*** ../../../node_modules/graphql/execution/types.mjs ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, exports) { +/***/ "../../../node_modules/graphql/execution/subscribe.mjs": +/*!*************************************************************!*\ + !*** ../../../node_modules/graphql/execution/subscribe.mjs ***! + \*************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DeferredFragmentRecord = void 0; -exports.isCancellableStreamRecord = isCancellableStreamRecord; -exports.isCompletedExecutionGroup = isCompletedExecutionGroup; -exports.isDeferredFragmentRecord = isDeferredFragmentRecord; -exports.isFailedExecutionGroup = isFailedExecutionGroup; -exports.isPendingExecutionGroup = isPendingExecutionGroup; -function isPendingExecutionGroup(incrementalDataRecord) { - return 'deferredFragmentRecords' in incrementalDataRecord; +exports.createSourceEventStream = createSourceEventStream; +exports.subscribe = subscribe; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); +var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); +var _isAsyncIterable = __webpack_require__(/*! ../jsutils/isAsyncIterable.mjs */ "../../../node_modules/graphql/jsutils/isAsyncIterable.mjs"); +var _Path = __webpack_require__(/*! ../jsutils/Path.mjs */ "../../../node_modules/graphql/jsutils/Path.mjs"); +var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); +var _locatedError = __webpack_require__(/*! ../error/locatedError.mjs */ "../../../node_modules/graphql/error/locatedError.mjs"); +var _collectFields = __webpack_require__(/*! ./collectFields.mjs */ "../../../node_modules/graphql/execution/collectFields.mjs"); +var _execute = __webpack_require__(/*! ./execute.mjs */ "../../../node_modules/graphql/execution/execute.mjs"); +var _mapAsyncIterator = __webpack_require__(/*! ./mapAsyncIterator.mjs */ "../../../node_modules/graphql/execution/mapAsyncIterator.mjs"); +var _values = __webpack_require__(/*! ./values.mjs */ "../../../node_modules/graphql/execution/values.mjs"); +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ + +async function subscribe(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || (0, _devAssert.devAssert)(false, 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.'); + const resultOrStream = await createSourceEventStream(args); + if (!(0, _isAsyncIterable.isAsyncIterable)(resultOrStream)) { + return resultOrStream; + } // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + const mapSourceToResponse = payload => (0, _execute.execute)({ + ...args, + rootValue: payload + }); // Map every source value to a ExecutionResult value as described above. + + return (0, _mapAsyncIterator.mapAsyncIterator)(resultOrStream, mapSourceToResponse); } -function isCompletedExecutionGroup(subsequentResult) { - return 'pendingExecutionGroup' in subsequentResult; +function toNormalizedArgs(args) { + const firstArg = args[0]; + if (firstArg && 'document' in firstArg) { + return firstArg; + } + return { + schema: firstArg, + // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 + document: args[1], + rootValue: args[2], + contextValue: args[3], + variableValues: args[4], + operationName: args[5], + subscribeFieldResolver: args[6] + }; } -function isFailedExecutionGroup(completedExecutionGroup) { - return completedExecutionGroup.errors !== undefined; -} -/** @internal */ -class DeferredFragmentRecord { - constructor(path, label, parent) { - this.path = path; - this.label = label; - this.parent = parent; - this.pendingExecutionGroups = new Set(); - this.successfulExecutionGroups = new Set(); - this.children = new Set(); +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + +async function createSourceEventStream(...rawArgs) { + const args = toNormalizedArgs(rawArgs); + const { + schema, + document, + variableValues + } = args; // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + + (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = (0, _execute.buildExecutionContext)(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext + }; + } + try { + const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. + + if (!(0, _isAsyncIterable.isAsyncIterable)(eventStream)) { + throw new Error('Subscription field must return Async Iterable. ' + `Received: ${(0, _inspect.inspect)(eventStream)}.`); + } + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof _GraphQLError.GraphQLError) { + return { + errors: [error] + }; + } + throw error; } } -exports.DeferredFragmentRecord = DeferredFragmentRecord; -function isDeferredFragmentRecord(deliveryGroup) { - return deliveryGroup instanceof DeferredFragmentRecord; -} -function isCancellableStreamRecord(deliveryGroup) { - return 'earlyReturn' in deliveryGroup; +async function executeSubscription(exeContext) { + const { + schema, + fragments, + operation, + variableValues, + rootValue + } = exeContext; + const rootType = schema.getSubscriptionType(); + if (rootType == null) { + throw new _GraphQLError.GraphQLError('Schema is not configured to execute subscription operation.', { + nodes: operation + }); + } + const rootFields = (0, _collectFields.collectFields)(schema, fragments, variableValues, rootType, operation.selectionSet); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = (0, _execute.getFieldDef)(schema, rootType, fieldNodes[0]); + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new _GraphQLError.GraphQLError(`The subscription field "${fieldName}" is not defined.`, { + nodes: fieldNodes + }); + } + const path = (0, _Path.addPath)(undefined, responseName, rootType.name); + const info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, rootType, path); + try { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + const resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + if (eventStream instanceof Error) { + throw eventStream; + } + return eventStream; + } catch (error) { + throw (0, _locatedError.locatedError)(error, fieldNodes, (0, _Path.pathToArray)(path)); + } } /***/ }), @@ -25517,6 +24479,7 @@ exports.getArgumentValues = getArgumentValues; exports.getDirectiveValues = getDirectiveValues; exports.getVariableValues = getVariableValues; var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); +var _keyMap = __webpack_require__(/*! ../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _printPathArray = __webpack_require__(/*! ../jsutils/printPathArray.mjs */ "../../../node_modules/graphql/jsutils/printPathArray.mjs"); var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); @@ -25570,7 +24533,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) { })); continue; } - if (!Object.hasOwn(inputs, varName)) { + if (!hasOwnProperty(inputs, varName)) { if (varDefNode.defaultValue) { coercedValues[varName] = (0, _valueFromAST.valueFromAST)(varDefNode.defaultValue, varType); } else if ((0, _definition.isNonNullType)(varType)) { @@ -25610,18 +24573,20 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) { * exposed to user code. Care should be taken to not pull values from the * Object prototype. */ + function getArgumentValues(def, node, variableValues) { var _node$arguments; - const coercedValues = {}; - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 ? _node$arguments : []; - const argNodeMap = new Map(argumentNodes.map(arg => [arg.name.value, arg])); + const argNodeMap = (0, _keyMap.keyMap)(argumentNodes, arg => arg.name.value); for (const argDef of def.args) { const name = argDef.name; const argType = argDef.type; - const argumentNode = argNodeMap.get(name); - if (argumentNode == null) { + const argumentNode = argNodeMap[name]; + if (!argumentNode) { if (argDef.defaultValue !== undefined) { coercedValues[name] = argDef.defaultValue; } else if ((0, _definition.isNonNullType)(argType)) { @@ -25635,7 +24600,7 @@ function getArgumentValues(def, node, variableValues) { let isNull = valueNode.kind === _kinds.Kind.NULL; if (valueNode.kind === _kinds.Kind.VARIABLE) { const variableName = valueNode.name.value; - if (variableValues == null || !Object.hasOwn(variableValues, variableName)) { + if (variableValues == null || !hasOwnProperty(variableValues, variableName)) { if (argDef.defaultValue !== undefined) { coercedValues[name] = argDef.defaultValue; } else if ((0, _definition.isNonNullType)(argType)) { @@ -25676,6 +24641,7 @@ function getArgumentValues(def, node, variableValues) { * exposed to user code. Care should be taken to not pull values from the * Object prototype. */ + function getDirectiveValues(directiveDef, node, variableValues) { var _node$directives; const directiveNode = (_node$directives = node.directives) === null || _node$directives === void 0 ? void 0 : _node$directives.find(directive => directive.name.value === directiveDef.name); @@ -25683,6 +24649,9 @@ function getDirectiveValues(directiveDef, node, variableValues) { return getArgumentValues(directiveDef, directiveNode, variableValues); } } +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} /***/ }), @@ -25699,11 +24668,52 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.graphql = graphql; exports.graphqlSync = graphqlSync; +var _devAssert = __webpack_require__(/*! ./jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _isPromise = __webpack_require__(/*! ./jsutils/isPromise.mjs */ "../../../node_modules/graphql/jsutils/isPromise.mjs"); var _parser = __webpack_require__(/*! ./language/parser.mjs */ "../../../node_modules/graphql/language/parser.mjs"); var _validate = __webpack_require__(/*! ./type/validate.mjs */ "../../../node_modules/graphql/type/validate.mjs"); var _validate2 = __webpack_require__(/*! ./validation/validate.mjs */ "../../../node_modules/graphql/validation/validate.mjs"); var _execute = __webpack_require__(/*! ./execution/execute.mjs */ "../../../node_modules/graphql/execution/execute.mjs"); +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ + function graphql(args) { // Always return a Promise for a consistent API. return new Promise(resolve => resolve(graphqlImpl(args))); @@ -25714,15 +24724,18 @@ function graphql(args) { * However, it guarantees to complete synchronously (or throw an error) assuming * that all field resolvers are also synchronous. */ + function graphqlSync(args) { - const result = graphqlImpl(args); - // Assert that the execution was synchronous. + const result = graphqlImpl(args); // Assert that the execution was synchronous. + if ((0, _isPromise.isPromise)(result)) { throw new Error('GraphQL execution failed to complete synchronously.'); } return result; } function graphqlImpl(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || (0, _devAssert.devAssert)(false, 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.'); const { schema, source, @@ -25732,15 +24745,15 @@ function graphqlImpl(args) { operationName, fieldResolver, typeResolver - } = args; - // Validate Schema + } = args; // Validate Schema + const schemaValidationErrors = (0, _validate.validateSchema)(schema); if (schemaValidationErrors.length > 0) { return { errors: schemaValidationErrors }; - } - // Parse + } // Parse + let document; try { document = (0, _parser.parse)(source); @@ -25748,15 +24761,15 @@ function graphqlImpl(args) { return { errors: [syntaxError] }; - } - // Validate + } // Validate + const validationErrors = (0, _validate2.validate)(schema, document); if (validationErrors.length > 0) { return { errors: validationErrors }; - } - // Execute + } // Execute + return (0, _execute.execute)({ schema, document, @@ -25848,12 +24861,6 @@ Object.defineProperty(exports, "GraphQLBoolean", ({ return _index.GraphQLBoolean; } })); -Object.defineProperty(exports, "GraphQLDeferDirective", ({ - enumerable: true, - get: function () { - return _index.GraphQLDeferDirective; - } -})); Object.defineProperty(exports, "GraphQLDeprecatedDirective", ({ enumerable: true, get: function () { @@ -25962,12 +24969,6 @@ Object.defineProperty(exports, "GraphQLSpecifiedByDirective", ({ return _index.GraphQLSpecifiedByDirective; } })); -Object.defineProperty(exports, "GraphQLStreamDirective", ({ - enumerable: true, - get: function () { - return _index.GraphQLStreamDirective; - } -})); Object.defineProperty(exports, "GraphQLString", ({ enumerable: true, get: function () { @@ -26430,6 +25431,12 @@ Object.defineProperty(exports, "assertUnionType", ({ return _index.assertUnionType; } })); +Object.defineProperty(exports, "assertValidName", ({ + enumerable: true, + get: function () { + return _index6.assertValidName; + } +})); Object.defineProperty(exports, "assertValidSchema", ({ enumerable: true, get: function () { @@ -26514,12 +25521,6 @@ Object.defineProperty(exports, "executeSync", ({ return _index3.executeSync; } })); -Object.defineProperty(exports, "experimentalExecuteIncrementally", ({ - enumerable: true, - get: function () { - return _index3.experimentalExecuteIncrementally; - } -})); Object.defineProperty(exports, "extendSchema", ({ enumerable: true, get: function () { @@ -26538,6 +25539,12 @@ Object.defineProperty(exports, "findDangerousChanges", ({ return _index6.findDangerousChanges; } })); +Object.defineProperty(exports, "formatError", ({ + enumerable: true, + get: function () { + return _index5.formatError; + } +})); Object.defineProperty(exports, "getArgumentValues", ({ enumerable: true, get: function () { @@ -26586,12 +25593,24 @@ Object.defineProperty(exports, "getOperationAST", ({ return _index6.getOperationAST; } })); +Object.defineProperty(exports, "getOperationRootType", ({ + enumerable: true, + get: function () { + return _index6.getOperationRootType; + } +})); Object.defineProperty(exports, "getVariableValues", ({ enumerable: true, get: function () { return _index3.getVariableValues; } })); +Object.defineProperty(exports, "getVisitFn", ({ + enumerable: true, + get: function () { + return _index2.getVisitFn; + } +})); Object.defineProperty(exports, "graphql", ({ enumerable: true, get: function () { @@ -26712,12 +25731,6 @@ Object.defineProperty(exports, "isNonNullType", ({ return _index.isNonNullType; } })); -Object.defineProperty(exports, "isNullabilityAssertionNode", ({ - enumerable: true, - get: function () { - return _index2.isNullabilityAssertionNode; - } -})); Object.defineProperty(exports, "isNullableType", ({ enumerable: true, get: function () { @@ -26826,6 +25839,12 @@ Object.defineProperty(exports, "isUnionType", ({ return _index.isUnionType; } })); +Object.defineProperty(exports, "isValidNameError", ({ + enumerable: true, + get: function () { + return _index6.isValidNameError; + } +})); Object.defineProperty(exports, "isValueNode", ({ enumerable: true, get: function () { @@ -26880,10 +25899,10 @@ Object.defineProperty(exports, "print", ({ return _index2.print; } })); -Object.defineProperty(exports, "printDirective", ({ +Object.defineProperty(exports, "printError", ({ enumerable: true, get: function () { - return _index6.printDirective; + return _index5.printError; } })); Object.defineProperty(exports, "printIntrospectionSchema", ({ @@ -27053,76 +26072,6 @@ var _index6 = __webpack_require__(/*! ./utilities/index.mjs */ "../../../node_mo /***/ }), -/***/ "../../../node_modules/graphql/jsutils/AccumulatorMap.mjs": -/*!****************************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/AccumulatorMap.mjs ***! - \****************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.AccumulatorMap = void 0; -/** - * ES6 Map with additional `add` method to accumulate items. - */ -class AccumulatorMap extends Map { - get [Symbol.toStringTag]() { - return 'AccumulatorMap'; - } - add(key, item) { - const group = this.get(key); - if (group === undefined) { - this.set(key, [item]); - } else { - group.push(item); - } - } -} -exports.AccumulatorMap = AccumulatorMap; - -/***/ }), - -/***/ "../../../node_modules/graphql/jsutils/BoxedPromiseOrValue.mjs": -/*!*********************************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/BoxedPromiseOrValue.mjs ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.BoxedPromiseOrValue = void 0; -var _isPromise = __webpack_require__(/*! ./isPromise.mjs */ "../../../node_modules/graphql/jsutils/isPromise.mjs"); -/** - * A BoxedPromiseOrValue is a container for a value or promise where the value - * will be updated when the promise resolves. - * - * A BoxedPromiseOrValue may only be used with promises whose possible - * rejection has already been handled, otherwise this will lead to unhandled - * promise rejections. - * - * @internal - * */ -class BoxedPromiseOrValue { - constructor(value) { - this.value = value; - if ((0, _isPromise.isPromise)(value)) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - value.then(resolved => { - this.value = resolved; - }); - } - } -} -exports.BoxedPromiseOrValue = BoxedPromiseOrValue; - -/***/ }), - /***/ "../../../node_modules/graphql/jsutils/Path.mjs": /*!******************************************************!*\ !*** ../../../node_modules/graphql/jsutils/Path.mjs ***! @@ -27149,6 +26098,7 @@ function addPath(prev, key, typename) { /** * Given a Path, return an Array of the path keys. */ + function pathToArray(path) { const flattened = []; let curr = path; @@ -27161,27 +26111,6 @@ function pathToArray(path) { /***/ }), -/***/ "../../../node_modules/graphql/jsutils/capitalize.mjs": -/*!************************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/capitalize.mjs ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.capitalize = capitalize; -/** - * Converts the first character of string to upper case and the remaining to lower case. - */ -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); -} - -/***/ }), - /***/ "../../../node_modules/graphql/jsutils/devAssert.mjs": /*!***********************************************************!*\ !*** ../../../node_modules/graphql/jsutils/devAssert.mjs ***! @@ -27195,7 +26124,8 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.devAssert = devAssert; function devAssert(condition, message) { - if (!condition) { + const booleanCondition = Boolean(condition); + if (!booleanCondition) { throw new Error(message); } } @@ -27206,7 +26136,7 @@ function devAssert(condition, message) { /*!************************************************************!*\ !*** ../../../node_modules/graphql/jsutils/didYouMean.mjs ***! \************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ (function(__unused_webpack_module, exports) { @@ -27214,84 +26144,29 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.didYouMean = didYouMean; -var _formatList = __webpack_require__(/*! ./formatList.mjs */ "../../../node_modules/graphql/jsutils/formatList.mjs"); const MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + function didYouMean(firstArg, secondArg) { - const [subMessage, suggestions] = secondArg ? [firstArg, secondArg] : [undefined, firstArg]; - if (suggestions.length === 0) { - return ''; - } + const [subMessage, suggestionsArg] = secondArg ? [firstArg, secondArg] : [undefined, firstArg]; let message = ' Did you mean '; - if (subMessage != null) { + if (subMessage) { message += subMessage + ' '; } - const suggestionList = (0, _formatList.orList)(suggestions.slice(0, MAX_SUGGESTIONS).map(x => `"${x}"`)); - return message + suggestionList + '?'; -} - -/***/ }), - -/***/ "../../../node_modules/graphql/jsutils/formatList.mjs": -/*!************************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/formatList.mjs ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.andList = andList; -exports.orList = orList; -var _invariant = __webpack_require__(/*! ./invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); -/** - * Given [ A, B, C ] return 'A, B, or C'. - */ -function orList(items) { - return formatList('or', items); -} -/** - * Given [ A, B, C ] return 'A, B, and C'. - */ -function andList(items) { - return formatList('and', items); -} -function formatList(conjunction, items) { - items.length !== 0 || (0, _invariant.invariant)(false); - switch (items.length) { + const suggestions = suggestionsArg.map(x => `"${x}"`); + switch (suggestions.length) { + case 0: + return ''; case 1: - return items[0]; + return message + suggestions[0] + '?'; case 2: - return items[0] + ' ' + conjunction + ' ' + items[1]; + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; } - const allButLast = items.slice(0, -1); - const lastItem = items.at(-1); - return allButLast.join(', ') + ', ' + conjunction + ' ' + lastItem; -} - -/***/ }), - -/***/ "../../../node_modules/graphql/jsutils/getBySet.mjs": -/*!**********************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/getBySet.mjs ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.getBySet = getBySet; -var _isSameSet = __webpack_require__(/*! ./isSameSet.mjs */ "../../../node_modules/graphql/jsutils/isSameSet.mjs"); -function getBySet(map, setToMatch) { - for (const set of map.keys()) { - if ((0, _isSameSet.isSameSet)(set, setToMatch)) { - return map.get(set); - } - } - return undefined; + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; } /***/ }), @@ -27300,7 +26175,7 @@ function getBySet(map, setToMatch) { /*!*********************************************************!*\ !*** ../../../node_modules/graphql/jsutils/groupBy.mjs ***! \*********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ (function(__unused_webpack_module, exports) { @@ -27308,14 +26183,19 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.groupBy = groupBy; -var _AccumulatorMap = __webpack_require__(/*! ./AccumulatorMap.mjs */ "../../../node_modules/graphql/jsutils/AccumulatorMap.mjs"); /** * Groups array items into a Map, given a function to produce grouping key. */ function groupBy(list, keyFn) { - const result = new _AccumulatorMap.AccumulatorMap(); + const result = new Map(); for (const item of list) { - result.add(keyFn(item), item); + const key = keyFn(item); + const group = result.get(key); + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } } return result; } @@ -27360,6 +26240,7 @@ const MAX_RECURSIVE_DEPTH = 2; /** * Used to print values in error messages. */ + function inspect(value) { return formatValue(value, []); } @@ -27384,8 +26265,8 @@ function formatObjectValue(value, previouslySeenValues) { } const seenValues = [...previouslySeenValues, value]; if (isJSONable(value)) { - const jsonValue = value.toJSON(); - // check for infinite recursion + const jsonValue = value.toJSON(); // check for infinite recursion + if (jsonValue !== value) { return typeof jsonValue === 'string' ? jsonValue : formatValue(jsonValue, seenValues); } @@ -27454,15 +26335,21 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.instanceOf = void 0; var _inspect = __webpack_require__(/*! ./inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); +/* c8 ignore next 3 */ + +const isProduction = globalThis.process && +// eslint-disable-next-line no-undef +"development" === 'production'; /** * A replacement for instanceof which includes an error warning when multi-realm * constructors are detected. * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production * See: https://webpack.js.org/guides/production/ */ + const instanceOf = exports.instanceOf = /* c8 ignore next 6 */ // FIXME: https://github.com/graphql/graphql-js/issues/2317 -globalThis.process != null && globalThis.process.env.NODE_ENV === 'production' ? function instanceOf(value, constructor) { +isProduction ? function instanceOf(value, constructor) { return value instanceof constructor; } : function instanceOf(value, constructor) { if (value instanceof constructor) { @@ -27470,11 +26357,13 @@ globalThis.process != null && globalThis.process.env.NODE_ENV === 'production' ? } if (typeof value === 'object' && value !== null) { var _value$constructor; + // Prefer Symbol.toStringTag since it is immune to minification. const className = constructor.prototype[Symbol.toStringTag]; const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. - Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name; + Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name; if (className === valueClassName) { const stringifiedValue = (0, _inspect.inspect)(value); throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. @@ -27509,7 +26398,8 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.invariant = invariant; function invariant(condition, message) { - if (!condition) { + const booleanCondition = Boolean(condition); + if (!booleanCondition) { throw new Error(message != null ? message : 'Unexpected invariant triggered.'); } } @@ -27617,32 +26507,6 @@ function isPromise(value) { /***/ }), -/***/ "../../../node_modules/graphql/jsutils/isSameSet.mjs": -/*!***********************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/isSameSet.mjs ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.isSameSet = isSameSet; -function isSameSet(setA, setB) { - if (setA.size !== setB.size) { - return false; - } - for (const item of setA) { - if (!setB.has(item)) { - return false; - } - } - return true; -} - -/***/ }), - /***/ "../../../node_modules/graphql/jsutils/keyMap.mjs": /*!********************************************************!*\ !*** ../../../node_modules/graphql/jsutils/keyMap.mjs ***! @@ -27904,15 +26768,14 @@ exports.promiseForObject = promiseForObject; * This is akin to bluebird's `Promise.props`, but implemented only using * `Promise.all` so it will work with any implementation of ES6 promises. */ -async function promiseForObject(object, callback) { - const keys = Object.keys(object); - const values = Object.values(object); - const resolvedValues = await Promise.all(values); - const resolvedObject = Object.create(null); - for (let i = 0; i < keys.length; ++i) { - resolvedObject[keys[i]] = resolvedValues[i]; - } - return callback(resolvedObject); +function promiseForObject(object) { + return Promise.all(Object.values(object)).then(resolvedValues => { + const resolvedObject = Object.create(null); + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + return resolvedObject; + }); } /***/ }), @@ -27947,39 +26810,6 @@ function promiseReduce(values, callbackFn, initialValue) { /***/ }), -/***/ "../../../node_modules/graphql/jsutils/promiseWithResolvers.mjs": -/*!**********************************************************************!*\ - !*** ../../../node_modules/graphql/jsutils/promiseWithResolvers.mjs ***! - \**********************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.promiseWithResolvers = promiseWithResolvers; -/** - * Based on Promise.withResolvers proposal - * https://github.com/tc39/proposal-promise-with-resolvers - */ -function promiseWithResolvers() { - // these are assigned synchronously within the Promise constructor - let resolve; - let reject; - const promise = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - return { - promise, - resolve, - reject - }; -} - -/***/ }), - /***/ "../../../node_modules/graphql/jsutils/suggestionList.mjs": /*!****************************************************************!*\ !*** ../../../node_modules/graphql/jsutils/suggestionList.mjs ***! @@ -27997,6 +26827,7 @@ var _naturalCompare = __webpack_require__(/*! ./naturalCompare.mjs */ "../../../ * Given an invalid input string and a list of valid options, returns a filtered * list of valid options sorted based on their similarity with the input. */ + function suggestionList(input, options) { const optionsByDistance = Object.create(null); const lexicalDistance = new LexicalDistance(input); @@ -28026,6 +26857,7 @@ function suggestionList(input, options) { * * This distance can be useful for detecting typos in input or sorting */ + class LexicalDistance { constructor(input) { this._input = input; @@ -28037,8 +26869,8 @@ class LexicalDistance { if (this._input === option) { return 0; } - const optionLowerCase = option.toLowerCase(); - // Any case change counts as a single edit + const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + if (this._inputLowerCase === optionLowerCase) { return 1; } @@ -28068,7 +26900,8 @@ class LexicalDistance { // delete currentRow[j - 1] + 1, // insert - upRow[j - 1] + cost); + upRow[j - 1] + cost // substitute + ); if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { // transposition const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; @@ -28078,8 +26911,8 @@ class LexicalDistance { smallestCell = currentCell; } currentRow[j] = currentCell; - } - // Early exit, since distance can't go smaller than smallest element of the previous row. + } // Early exit, since distance can't go smaller than smallest element of the previous row. + if (smallestCell > threshold) { return undefined; } @@ -28115,6 +26948,7 @@ var _inspect = __webpack_require__(/*! ./inspect.mjs */ "../../../node_modules/g /** * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. */ + function toError(thrownValue) { return thrownValue instanceof Error ? thrownValue : new NonErrorThrown(thrownValue); } @@ -28174,6 +27008,25 @@ exports.isNode = isNode; * identify the region of the source from which the AST derived. */ class Location { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ constructor(startToken, endToken, source) { this.start = startToken.start; this.end = endToken.end; @@ -28197,14 +27050,45 @@ class Location { */ exports.Location = Location; class Token { - // eslint-disable-next-line max-params + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ constructor(kind, start, end, line, column, value) { this.kind = kind; this.start = start; this.end = end; this.line = line; - this.column = column; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.value = value; this.prev = null; this.next = null; @@ -28221,6 +27105,10 @@ class Token { }; } } +/** + * The list of all possible AST node types. + */ + /** * @internal */ @@ -28232,16 +27120,8 @@ const QueryDocumentKeys = exports.QueryDocumentKeys = { VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], Variable: ['name'], SelectionSet: ['selections'], - Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet', - // Note: Client Controlled Nullability is experimental and may be changed - // or removed in the future. - 'nullabilityAssertion'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], Argument: ['name', 'value'], - // Note: Client Controlled Nullability is experimental and may be changed - // or removed in the future. - ListNullabilityOperator: ['nullabilityAssertion'], - NonNullAssertion: ['nullabilityAssertion'], - ErrorBoundary: ['nullabilityAssertion'], FragmentSpread: ['name', 'directives'], InlineFragment: ['typeCondition', 'directives', 'selectionSet'], FragmentDefinition: ['name', @@ -28284,10 +27164,13 @@ const kindValues = new Set(Object.keys(QueryDocumentKeys)); /** * @internal */ + function isNode(maybeNode) { const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; return typeof maybeKind === 'string' && kindValues.has(maybeKind); } +/** Name */ + var OperationTypeNode; (function (OperationTypeNode) { OperationTypeNode['QUERY'] = 'query'; @@ -28320,28 +27203,28 @@ var _characterClasses = __webpack_require__(/*! ./characterClasses.mjs */ "../.. * * @internal */ + function dedentBlockStringLines(lines) { - var _firstNonEmptyLine; + var _firstNonEmptyLine2; let commonIndent = Number.MAX_SAFE_INTEGER; let firstNonEmptyLine = null; let lastNonEmptyLine = -1; for (let i = 0; i < lines.length; ++i) { + var _firstNonEmptyLine; const line = lines[i]; const indent = leadingWhitespace(line); if (indent === line.length) { continue; // skip empty lines } - firstNonEmptyLine ??= i; + firstNonEmptyLine = (_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : i; lastNonEmptyLine = i; if (i !== 0 && indent < commonIndent) { commonIndent = indent; } } - return lines - // Remove common indentation from all lines but first. - .map((line, i) => i === 0 ? line : line.slice(commonIndent)) - // Remove leading and trailing blank lines. - .slice((_firstNonEmptyLine = firstNonEmptyLine) !== null && _firstNonEmptyLine !== void 0 ? _firstNonEmptyLine : 0, lastNonEmptyLine + 1); + return lines // Remove common indentation from all lines but first. + .map((line, i) => i === 0 ? line : line.slice(commonIndent)) // Remove leading and trailing blank lines. + .slice((_firstNonEmptyLine2 = firstNonEmptyLine) !== null && _firstNonEmptyLine2 !== void 0 ? _firstNonEmptyLine2 : 0, lastNonEmptyLine + 1); } function leadingWhitespace(str) { let i = 0; @@ -28353,6 +27236,7 @@ function leadingWhitespace(str) { /** * @internal */ + function isPrintableAsBlockString(value) { if (value === '') { return true; // empty string is printable @@ -28378,10 +27262,12 @@ function isPrintableAsBlockString(value) { case 0x000f: return false; // Has non-printable characters + case 0x000d: // \r return false; // Has \r or \r\n which will be replaced as \n + case 10: // \n if (isEmptyLine && !seenNonEmptyLine) { @@ -28392,12 +27278,13 @@ function isPrintableAsBlockString(value) { hasIndent = false; break; case 9: // \t + case 32: // - hasIndent ||= isEmptyLine; + hasIndent || (hasIndent = isEmptyLine); break; default: - hasCommonIndent &&= hasIndent; + hasCommonIndent && (hasCommonIndent = hasIndent); isEmptyLine = false; } } @@ -28416,24 +27303,25 @@ function isPrintableAsBlockString(value) { * * @internal */ + function printBlockString(value, options) { - const escapedValue = value.replaceAll('"""', '\\"""'); - // Expand a block string's raw value into independent lines. + const escapedValue = value.replace(/"""/g, '\\"""'); // Expand a block string's raw value into independent lines. + const lines = escapedValue.split(/\r\n|[\n\r]/g); - const isSingleLine = lines.length === 1; - // If common indentation is found we can fix some of those cases by adding leading new line - const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every(line => line.length === 0 || (0, _characterClasses.isWhiteSpace)(line.charCodeAt(0))); - // Trailing triple quotes just looks confusing but doesn't force trailing new line - const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); - // Trailing quote (single or double) or slash forces trailing new line + const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line + + const forceLeadingNewLine = lines.length > 1 && lines.slice(1).every(line => line.length === 0 || (0, _characterClasses.isWhiteSpace)(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line + + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); // Trailing quote (single or double) or slash forces trailing new line + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; const hasTrailingSlash = value.endsWith('\\'); const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; const printAsMultipleLines = !(options !== null && options !== void 0 && options.minimize) && ( // add leading and trailing new lines only if it improves readability !isSingleLine || value.length > 70 || forceTrailingNewline || forceLeadingNewLine || hasTrailingTripleQuotes); - let result = ''; - // Format a multi-line block quote to account for leading space. + let result = ''; // Format a multi-line block quote to account for leading space. + const skipLeadingNewLine = isSingleLine && (0, _characterClasses.isWhiteSpace)(value.charCodeAt(0)); if (printAsMultipleLines && !skipLeadingNewLine || forceLeadingNewLine) { result += '\n'; @@ -28481,6 +27369,7 @@ function isWhiteSpace(code) { * ``` * @internal */ + function isDigit(code) { return code >= 0x0030 && code <= 0x0039; } @@ -28494,6 +27383,7 @@ function isDigit(code) { * ``` * @internal */ + function isLetter(code) { return code >= 0x0061 && code <= 0x007a || // A-Z @@ -28508,6 +27398,7 @@ function isLetter(code) { * ``` * @internal */ + function isNameStart(code) { return isLetter(code) || code === 0x005f; } @@ -28520,6 +27411,7 @@ function isNameStart(code) { * ``` * @internal */ + function isNameContinue(code) { return isLetter(code) || isDigit(code) || code === 0x005f; } @@ -28543,7 +27435,6 @@ exports.DirectiveLocation = void 0; */ var DirectiveLocation; (function (DirectiveLocation) { - /** Request Definitions */ DirectiveLocation['QUERY'] = 'QUERY'; DirectiveLocation['MUTATION'] = 'MUTATION'; DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION'; @@ -28552,7 +27443,6 @@ var DirectiveLocation; DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD'; DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT'; DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION'; - /** Type System Definitions */ DirectiveLocation['SCHEMA'] = 'SCHEMA'; DirectiveLocation['SCALAR'] = 'SCALAR'; DirectiveLocation['OBJECT'] = 'OBJECT'; @@ -28566,6 +27456,12 @@ var DirectiveLocation; DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION'; })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {})); +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ + /***/ }), /***/ "../../../node_modules/graphql/language/index.mjs": @@ -28645,6 +27541,12 @@ Object.defineProperty(exports, "getLocation", ({ return _location.getLocation; } })); +Object.defineProperty(exports, "getVisitFn", ({ + enumerable: true, + get: function () { + return _visitor.getVisitFn; + } +})); Object.defineProperty(exports, "isConstValueNode", ({ enumerable: true, get: function () { @@ -28663,12 +27565,6 @@ Object.defineProperty(exports, "isExecutableDefinitionNode", ({ return _predicates.isExecutableDefinitionNode; } })); -Object.defineProperty(exports, "isNullabilityAssertionNode", ({ - enumerable: true, - get: function () { - return _predicates.isNullabilityAssertionNode; - } -})); Object.defineProperty(exports, "isSelectionNode", ({ enumerable: true, get: function () { @@ -28797,24 +27693,16 @@ exports.Kind = void 0; */ var Kind; (function (Kind) { - /** Name */ Kind['NAME'] = 'Name'; - /** Document */ Kind['DOCUMENT'] = 'Document'; Kind['OPERATION_DEFINITION'] = 'OperationDefinition'; Kind['VARIABLE_DEFINITION'] = 'VariableDefinition'; Kind['SELECTION_SET'] = 'SelectionSet'; Kind['FIELD'] = 'Field'; Kind['ARGUMENT'] = 'Argument'; - /** Nullability Modifiers */ - Kind['LIST_NULLABILITY_OPERATOR'] = 'ListNullabilityOperator'; - Kind['NON_NULL_ASSERTION'] = 'NonNullAssertion'; - Kind['ERROR_BOUNDARY'] = 'ErrorBoundary'; - /** Fragments */ Kind['FRAGMENT_SPREAD'] = 'FragmentSpread'; Kind['INLINE_FRAGMENT'] = 'InlineFragment'; Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition'; - /** Values */ Kind['VARIABLE'] = 'Variable'; Kind['INT'] = 'IntValue'; Kind['FLOAT'] = 'FloatValue'; @@ -28825,16 +27713,12 @@ var Kind; Kind['LIST'] = 'ListValue'; Kind['OBJECT'] = 'ObjectValue'; Kind['OBJECT_FIELD'] = 'ObjectField'; - /** Directives */ Kind['DIRECTIVE'] = 'Directive'; - /** Types */ Kind['NAMED_TYPE'] = 'NamedType'; Kind['LIST_TYPE'] = 'ListType'; Kind['NON_NULL_TYPE'] = 'NonNullType'; - /** Type System Definitions */ Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition'; Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition'; - /** Type Definitions */ Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition'; Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition'; Kind['FIELD_DEFINITION'] = 'FieldDefinition'; @@ -28844,11 +27728,8 @@ var Kind; Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition'; Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition'; Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition'; - /** Directive Definitions */ Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition'; - /** Type System Extensions */ Kind['SCHEMA_EXTENSION'] = 'SchemaExtension'; - /** Type Extensions */ Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension'; Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension'; Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension'; @@ -28857,6 +27738,12 @@ var Kind; Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension'; })(Kind || (exports.Kind = Kind = {})); +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ + /***/ }), /***/ "../../../node_modules/graphql/language/lexer.mjs": @@ -28885,7 +27772,23 @@ var _tokenKind = __webpack_require__(/*! ./tokenKind.mjs */ "../../../node_modul * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. */ + class Lexer { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ constructor(source) { const startOfFileToken = new _ast.Token(_tokenKind.TokenKind.SOF, 0, 0, 0, 0); this.source = source; @@ -28900,6 +27803,7 @@ class Lexer { /** * Advances the token stream to the next non-ignored token. */ + advance() { this.lastToken = this.token; const token = this.token = this.lookahead(); @@ -28909,6 +27813,7 @@ class Lexer { * Looks ahead and returns the next non-ignored token, but does not change * the state of Lexer. */ + lookahead() { let token = this.token; if (token.kind !== _tokenKind.TokenKind.EOF) { @@ -28917,10 +27822,10 @@ class Lexer { token = token.next; } else { // Read the next token and form a link in the token linked-list. - const nextToken = readNextToken(this, token.end); - // @ts-expect-error next is only mutable during parsing. - token.next = nextToken; - // @ts-expect-error prev is only mutable during parsing. + const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing. + + token.next = nextToken; // @ts-expect-error prev is only mutable during parsing. + nextToken.prev = token; token = nextToken; } @@ -28934,7 +27839,7 @@ class Lexer { */ exports.Lexer = Lexer; function isPunctuatorTokenKind(kind) { - return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.QUESTION_MARK || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; + return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; } /** * A Unicode scalar value is any Unicode code point except surrogate code @@ -28944,6 +27849,7 @@ function isPunctuatorTokenKind(kind) { * SourceCharacter :: * - "Any Unicode scalar value" */ + function isUnicodeScalarValue(code) { return code >= 0x0000 && code <= 0xd7ff || code >= 0xe000 && code <= 0x10ffff; } @@ -28955,6 +27861,7 @@ function isUnicodeScalarValue(code) { * encodes a supplementary code point (above U+FFFF), but unpaired surrogate * code points are not valid source characters. */ + function isSupplementaryCodePoint(body, location) { return isLeadingSurrogate(body.charCodeAt(location)) && isTrailingSurrogate(body.charCodeAt(location + 1)); } @@ -28971,6 +27878,7 @@ function isTrailingSurrogate(code) { * Printable ASCII is printed quoted, while other points are printed in Unicode * code point form (ie. U+1234). */ + function printCodePointAt(lexer, location) { const code = lexer.source.body.codePointAt(location); if (code === undefined) { @@ -28979,13 +27887,14 @@ function printCodePointAt(lexer, location) { // Printable ASCII const char = String.fromCodePoint(code); return char === '"' ? "'\"'" : `"${char}"`; - } - // Unicode code point + } // Unicode code point + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); } /** * Create a token with line and column location information. */ + function createToken(lexer, kind, start, end, value) { const line = lexer.line; const col = 1 + start - lexer.lineStart; @@ -28998,13 +27907,14 @@ function createToken(lexer, kind, start, end, value) { * punctuators immediately or calls the appropriate helper function for more * complicated tokens. */ + function readNextToken(lexer, start) { const body = lexer.source.body; const bodyLength = body.length; let position = start; while (position < bodyLength) { - const code = body.charCodeAt(position); - // SourceCharacter + const code = body.charCodeAt(position); // SourceCharacter + switch (code) { // Ignored :: // - UnicodeBOM @@ -29021,8 +27931,11 @@ function readNextToken(lexer, start) { // // Comma :: , case 0xfeff: // + case 0x0009: // \t + case 0x0020: // + case 0x002c: // , ++position; @@ -29031,6 +27944,7 @@ function readNextToken(lexer, start) { // - "New Line (U+000A)" // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] // - "Carriage Return (U+000D)" "New Line (U+000A)" + case 0x000a: // \n ++position; @@ -29048,6 +27962,7 @@ function readNextToken(lexer, start) { lexer.lineStart = position; continue; // Comment + case 0x0023: // # return readComment(lexer, position); @@ -29059,6 +27974,7 @@ function readNextToken(lexer, start) { // - StringValue // // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + case 0x0021: // ! return createToken(lexer, _tokenKind.TokenKind.BANG, position, position + 1); @@ -29104,22 +28020,20 @@ function readNextToken(lexer, start) { case 0x007d: // } return createToken(lexer, _tokenKind.TokenKind.BRACE_R, position, position + 1); - case 0x003f: - // ? - return createToken(lexer, _tokenKind.TokenKind.QUESTION_MARK, position, position + 1); // StringValue + case 0x0022: // " if (body.charCodeAt(position + 1) === 0x0022 && body.charCodeAt(position + 2) === 0x0022) { return readBlockString(lexer, position); } return readString(lexer, position); - } - // IntValue | FloatValue (Digit | -) + } // IntValue | FloatValue (Digit | -) + if ((0, _characterClasses.isDigit)(code) || code === 0x002d) { return readNumber(lexer, position, code); - } - // Name + } // Name + if ((0, _characterClasses.isNameStart)(code)) { return readName(lexer, position); } @@ -29136,17 +28050,18 @@ function readNextToken(lexer, start) { * CommentChar :: SourceCharacter but not LineTerminator * ``` */ + function readComment(lexer, start) { const body = lexer.source.body; const bodyLength = body.length; let position = start + 1; while (position < bodyLength) { - const code = body.charCodeAt(position); - // LineTerminator (\n | \r) + const code = body.charCodeAt(position); // LineTerminator (\n | \r) + if (code === 0x000a || code === 0x000d) { break; - } - // SourceCharacter + } // SourceCharacter + if (isUnicodeScalarValue(code)) { ++position; } else if (isSupplementaryCodePoint(body, position)) { @@ -29186,16 +28101,17 @@ function readComment(lexer, start) { * Sign :: one of + - * ``` */ + function readNumber(lexer, start, firstCode) { const body = lexer.source.body; let position = start; let code = firstCode; - let isFloat = false; - // NegativeSign (-) + let isFloat = false; // NegativeSign (-) + if (code === 0x002d) { code = body.charCodeAt(++position); - } - // Zero (0) + } // Zero (0) + if (code === 0x0030) { code = body.charCodeAt(++position); if ((0, _characterClasses.isDigit)(code)) { @@ -29204,26 +28120,26 @@ function readNumber(lexer, start, firstCode) { } else { position = readDigits(lexer, position, code); code = body.charCodeAt(position); - } - // Full stop (.) + } // Full stop (.) + if (code === 0x002e) { isFloat = true; code = body.charCodeAt(++position); position = readDigits(lexer, position, code); code = body.charCodeAt(position); - } - // E e + } // E e + if (code === 0x0045 || code === 0x0065) { isFloat = true; - code = body.charCodeAt(++position); - // + - + code = body.charCodeAt(++position); // + - + if (code === 0x002b || code === 0x002d) { code = body.charCodeAt(++position); } position = readDigits(lexer, position, code); code = body.charCodeAt(position); - } - // Numbers cannot be followed by . or NameStart + } // Numbers cannot be followed by . or NameStart + if (code === 0x002e || (0, _characterClasses.isNameStart)(code)) { throw (0, _syntaxError.syntaxError)(lexer.source, position, `Invalid number, expected digit but got: ${printCodePointAt(lexer, position)}.`); } @@ -29232,12 +28148,14 @@ function readNumber(lexer, start, firstCode) { /** * Returns the new position in the source after reading one or more digits. */ + function readDigits(lexer, start, firstCode) { if (!(0, _characterClasses.isDigit)(firstCode)) { throw (0, _syntaxError.syntaxError)(lexer.source, start, `Invalid number, expected digit but got: ${printCodePointAt(lexer, start)}.`); } const body = lexer.source.body; let position = start + 1; // +1 to skip first firstCode + while ((0, _characterClasses.isDigit)(body.charCodeAt(position))) { ++position; } @@ -29263,6 +28181,7 @@ function readDigits(lexer, start, firstCode) { * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` * ``` */ + function readString(lexer, start) { const body = lexer.source.body; const bodyLength = body.length; @@ -29270,13 +28189,13 @@ function readString(lexer, start) { let chunkStart = position; let value = ''; while (position < bodyLength) { - const code = body.charCodeAt(position); - // Closing Quote (") + const code = body.charCodeAt(position); // Closing Quote (") + if (code === 0x0022) { value += body.slice(chunkStart, position); return createToken(lexer, _tokenKind.TokenKind.STRING, start, position + 1, value); - } - // Escape Sequence (\) + } // Escape Sequence (\) + if (code === 0x005c) { value += body.slice(chunkStart, position); const escape = body.charCodeAt(position + 1) === 0x0075 // u @@ -29286,12 +28205,12 @@ function readString(lexer, start) { position += escape.size; chunkStart = position; continue; - } - // LineTerminator (\n | \r) + } // LineTerminator (\n | \r) + if (code === 0x000a || code === 0x000d) { break; - } - // SourceCharacter + } // SourceCharacter + if (isUnicodeScalarValue(code)) { ++position; } else if (isSupplementaryCodePoint(body, position)) { @@ -29301,15 +28220,16 @@ function readString(lexer, start) { } } throw (0, _syntaxError.syntaxError)(lexer.source, position, 'Unterminated string.'); -} +} // The string value and lexed size of an escape sequence. + function readEscapedUnicodeVariableWidth(lexer, position) { const body = lexer.source.body; let point = 0; - let size = 3; - // Cannot be larger than 12 chars (\u{00000000}). + let size = 3; // Cannot be larger than 12 chars (\u{00000000}). + while (size < 12) { - const code = body.charCodeAt(position + size++); - // Closing Brace (}) + const code = body.charCodeAt(position + size++); // Closing Brace (}) + if (code === 0x007d) { // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. if (size < 5 || !isUnicodeScalarValue(point)) { @@ -29319,8 +28239,8 @@ function readEscapedUnicodeVariableWidth(lexer, position) { value: String.fromCodePoint(point), size }; - } - // Append this hex digit to the code point. + } // Append this hex digit to the code point. + point = point << 4 | readHexDigit(code); if (point < 0) { break; @@ -29336,9 +28256,9 @@ function readEscapedUnicodeFixedWidth(lexer, position) { value: String.fromCodePoint(code), size: 6 }; - } - // GraphQL allows JSON-style surrogate pair escape sequences, but only when + } // GraphQL allows JSON-style surrogate pair escape sequences, but only when // a valid pair is formed. + if (isLeadingSurrogate(code)) { // \u if (body.charCodeAt(position + 6) === 0x005c && body.charCodeAt(position + 7) === 0x0075) { @@ -29366,6 +28286,7 @@ function readEscapedUnicodeFixedWidth(lexer, position) { * * Returns a negative number if any char was not a valid hexadecimal digit. */ + function read16BitHexCode(body, position) { // readHexDigit() returns -1 on error. ORing a negative value with any other // value always produces a negative value. @@ -29385,6 +28306,7 @@ function read16BitHexCode(body, position) { * - `A` `B` `C` `D` `E` `F` * - `a` `b` `c` `d` `e` `f` */ + function readHexDigit(code) { return code >= 0x0030 && code <= 0x0039 // 0-9 ? code - 0x0030 : code >= 0x0041 && code <= 0x0046 // A-F @@ -29403,6 +28325,7 @@ function readHexDigit(code) { * | `r` | U+000D | carriage return | * | `t` | U+0009 | horizontal tab | */ + function readEscapedCharacter(lexer, position) { const body = lexer.source.body; const code = body.charCodeAt(position + 1); @@ -29470,6 +28393,7 @@ function readEscapedCharacter(lexer, position) { * - `\"""` * ``` */ + function readBlockString(lexer, start) { const body = lexer.source.body; const bodyLength = body.length; @@ -29479,8 +28403,8 @@ function readBlockString(lexer, start) { let currentLine = ''; const blockLines = []; while (position < bodyLength) { - const code = body.charCodeAt(position); - // Closing Triple-Quote (""") + const code = body.charCodeAt(position); // Closing Triple-Quote (""") + if (code === 0x0022 && body.charCodeAt(position + 1) === 0x0022 && body.charCodeAt(position + 2) === 0x0022) { currentLine += body.slice(chunkStart, position); blockLines.push(currentLine); @@ -29490,15 +28414,16 @@ function readBlockString(lexer, start) { lexer.line += blockLines.length - 1; lexer.lineStart = lineStart; return token; - } - // Escaped Triple-Quote (\""") + } // Escaped Triple-Quote (\""") + if (code === 0x005c && body.charCodeAt(position + 1) === 0x0022 && body.charCodeAt(position + 2) === 0x0022 && body.charCodeAt(position + 3) === 0x0022) { currentLine += body.slice(chunkStart, position); chunkStart = position + 1; // skip only slash + position += 4; continue; - } - // LineTerminator + } // LineTerminator + if (code === 0x000a || code === 0x000d) { currentLine += body.slice(chunkStart, position); blockLines.push(currentLine); @@ -29511,8 +28436,8 @@ function readBlockString(lexer, start) { chunkStart = position; lineStart = position; continue; - } - // SourceCharacter + } // SourceCharacter + if (isUnicodeScalarValue(code)) { ++position; } else if (isSupplementaryCodePoint(body, position)) { @@ -29531,6 +28456,7 @@ function readBlockString(lexer, start) { * - NameStart NameContinue* [lookahead != NameContinue] * ``` */ + function readName(lexer, start) { const body = lexer.source.body; const bodyLength = body.length; @@ -29562,6 +28488,10 @@ Object.defineProperty(exports, "__esModule", ({ exports.getLocation = getLocation; var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); const LineRegExp = /\r\n|[\n\r]/g; +/** + * Represents a location in a Source. + */ + /** * Takes a Source and a UTF-8 character offset, and returns the corresponding * line and column as a SourceLocation. @@ -29608,6 +28538,10 @@ var _kinds = __webpack_require__(/*! ./kinds.mjs */ "../../../node_modules/graph var _lexer = __webpack_require__(/*! ./lexer.mjs */ "../../../node_modules/graphql/language/lexer.mjs"); var _source = __webpack_require__(/*! ./source.mjs */ "../../../node_modules/graphql/language/source.mjs"); var _tokenKind = __webpack_require__(/*! ./tokenKind.mjs */ "../../../node_modules/graphql/language/tokenKind.mjs"); +/** + * Configuration options to control parser behavior + */ + /** * Given a GraphQL source, parses it into a Document. * Throws GraphQLError if a syntax error is encountered. @@ -29626,6 +28560,7 @@ function parse(source, options) { * * Consider providing the results to the utility function: valueFromAST(). */ + function parseValue(source, options) { const parser = new Parser(source, options); parser.expectToken(_tokenKind.TokenKind.SOF); @@ -29637,6 +28572,7 @@ function parseValue(source, options) { * Similar to parseValue(), but raises a parse error if it encounters a * variable. The return type will be a constant value. */ + function parseConstValue(source, options) { const parser = new Parser(source, options); parser.expectToken(_tokenKind.TokenKind.SOF); @@ -29654,6 +28590,7 @@ function parseConstValue(source, options) { * * Consider providing the results to the utility function: typeFromAST(). */ + function parseType(source, options) { const parser = new Parser(source, options); parser.expectToken(_tokenKind.TokenKind.SOF); @@ -29672,6 +28609,7 @@ function parseType(source, options) { * * @internal */ + class Parser { constructor(source, options = {}) { const sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); @@ -29682,17 +28620,19 @@ class Parser { /** * Converts a name lex token into a name parse node. */ + parseName() { const token = this.expectToken(_tokenKind.TokenKind.NAME); return this.node(token, { kind: _kinds.Kind.NAME, value: token.value }); - } - // Implements the parsing rules in the Document section. + } // Implements the parsing rules in the Document section. + /** * Document : Definition+ */ + parseDocument() { return this.node(this._lexer.token, { kind: _kinds.Kind.DOCUMENT, @@ -29722,11 +28662,12 @@ class Parser { * - EnumTypeDefinition * - InputObjectTypeDefinition */ + parseDefinition() { if (this.peek(_tokenKind.TokenKind.BRACE_L)) { return this.parseOperationDefinition(); - } - // Many definitions begin with a description and require a lookahead. + } // Many definitions begin with a description and require a lookahead. + const hasDescription = this.peekDescription(); const keywordToken = hasDescription ? this._lexer.lookahead() : this._lexer.token; if (keywordToken.kind === _tokenKind.TokenKind.NAME) { @@ -29763,13 +28704,14 @@ class Parser { } } throw this.unexpected(keywordToken); - } - // Implements the parsing rules in the Operations section. + } // Implements the parsing rules in the Operations section. + /** * OperationDefinition : * - SelectionSet * - OperationType Name? VariableDefinitions? Directives? SelectionSet */ + parseOperationDefinition() { const start = this._lexer.token; if (this.peek(_tokenKind.TokenKind.BRACE_L)) { @@ -29799,6 +28741,7 @@ class Parser { /** * OperationType : one of query mutation subscription */ + parseOperationType() { const operationToken = this.expectToken(_tokenKind.TokenKind.NAME); switch (operationToken.value) { @@ -29814,12 +28757,14 @@ class Parser { /** * VariableDefinitions : ( VariableDefinition+ ) */ + parseVariableDefinitions() { return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseVariableDefinition, _tokenKind.TokenKind.PAREN_R); } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ + parseVariableDefinition() { return this.node(this._lexer.token, { kind: _kinds.Kind.VARIABLE_DEFINITION, @@ -29832,6 +28777,7 @@ class Parser { /** * Variable : $ Name */ + parseVariable() { const start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.DOLLAR); @@ -29845,6 +28791,7 @@ class Parser { * SelectionSet : { Selection+ } * ``` */ + parseSelectionSet() { return this.node(this._lexer.token, { kind: _kinds.Kind.SELECTION_SET, @@ -29857,6 +28804,7 @@ class Parser { * - FragmentSpread * - InlineFragment */ + parseSelection() { return this.peek(_tokenKind.TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); } @@ -29865,6 +28813,7 @@ class Parser { * * Alias : Name : */ + parseField() { const start = this._lexer.token; const nameOrAlias = this.parseName(); @@ -29881,47 +28830,22 @@ class Parser { alias, name, arguments: this.parseArguments(false), - // Experimental support for Client Controlled Nullability changes - // the grammar of Field: - nullabilityAssertion: this.parseNullabilityAssertion(), directives: this.parseDirectives(false), selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined }); } - // TODO: add grammar comment after it finalizes - parseNullabilityAssertion() { - // Note: Client Controlled Nullability is experimental and may be changed or - // removed in the future. - if (this._options.experimentalClientControlledNullability !== true) { - return undefined; - } - const start = this._lexer.token; - let nullabilityAssertion; - if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { - const innerModifier = this.parseNullabilityAssertion(); - this.expectToken(_tokenKind.TokenKind.BRACKET_R); - nullabilityAssertion = this.node(start, { - kind: _kinds.Kind.LIST_NULLABILITY_OPERATOR, - nullabilityAssertion: innerModifier - }); - } - if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { - nullabilityAssertion = this.node(start, { - kind: _kinds.Kind.NON_NULL_ASSERTION, - nullabilityAssertion - }); - } else if (this.expectOptionalToken(_tokenKind.TokenKind.QUESTION_MARK)) { - nullabilityAssertion = this.node(start, { - kind: _kinds.Kind.ERROR_BOUNDARY, - nullabilityAssertion - }); - } - return nullabilityAssertion; - } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + parseArguments(isConst) { const item = isConst ? this.parseConstArgument : this.parseArgument; return this.optionalMany(_tokenKind.TokenKind.PAREN_L, item, _tokenKind.TokenKind.PAREN_R); } + /** + * Argument[Const] : Name : Value[?Const] + */ + parseArgument(isConst = false) { const start = this._lexer.token; const name = this.parseName(); @@ -29934,8 +28858,8 @@ class Parser { } parseConstArgument() { return this.parseArgument(true); - } - // Implements the parsing rules in the Fragments section. + } // Implements the parsing rules in the Fragments section. + /** * Corresponds to both FragmentSpread and InlineFragment in the spec. * @@ -29943,6 +28867,7 @@ class Parser { * * InlineFragment : ... TypeCondition? Directives? SelectionSet */ + parseFragment() { const start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.SPREAD); @@ -29967,12 +28892,13 @@ class Parser { * * TypeCondition : NamedType */ + parseFragmentDefinition() { const start = this._lexer.token; - this.expectKeyword('fragment'); - // Legacy support for defining variables within fragments changes + this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes // the grammar of FragmentDefinition: // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + if (this._options.allowLegacyFragmentVariables === true) { return this.node(start, { kind: _kinds.Kind.FRAGMENT_DEFINITION, @@ -29994,12 +28920,33 @@ class Parser { /** * FragmentName : Name but not `on` */ + parseFragmentName() { if (this._lexer.token.value === 'on') { throw this.unexpected(); } return this.parseName(); - } + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + parseValueLiteral(isConst) { const token = this._lexer.token; switch (token.kind) { @@ -30072,6 +29019,12 @@ class Parser { block: token.kind === _tokenKind.TokenKind.BLOCK_STRING }); } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + parseList(isConst) { const item = () => this.parseValueLiteral(isConst); return this.node(this._lexer.token, { @@ -30079,6 +29032,14 @@ class Parser { values: this.any(_tokenKind.TokenKind.BRACKET_L, item, _tokenKind.TokenKind.BRACKET_R) }); } + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + parseObject(isConst) { const item = () => this.parseObjectField(isConst); return this.node(this._lexer.token, { @@ -30086,6 +29047,10 @@ class Parser { fields: this.any(_tokenKind.TokenKind.BRACE_L, item, _tokenKind.TokenKind.BRACE_R) }); } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + parseObjectField(isConst) { const start = this._lexer.token; const name = this.parseName(); @@ -30095,7 +29060,12 @@ class Parser { name, value: this.parseValueLiteral(isConst) }); - } + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + parseDirectives(isConst) { const directives = []; while (this.peek(_tokenKind.TokenKind.AT)) { @@ -30106,6 +29076,12 @@ class Parser { parseConstDirectives() { return this.parseDirectives(true); } + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + parseDirective(isConst) { const start = this._lexer.token; this.expectToken(_tokenKind.TokenKind.AT); @@ -30114,14 +29090,15 @@ class Parser { name: this.parseName(), arguments: this.parseArguments(isConst) }); - } - // Implements the parsing rules in the Types section. + } // Implements the parsing rules in the Types section. + /** * Type : * - NamedType * - ListType * - NonNullType */ + parseTypeReference() { const start = this._lexer.token; let type; @@ -30146,19 +29123,21 @@ class Parser { /** * NamedType : Name */ + parseNamedType() { return this.node(this._lexer.token, { kind: _kinds.Kind.NAMED_TYPE, name: this.parseName() }); - } - // Implements the parsing rules in the Type Definition section. + } // Implements the parsing rules in the Type Definition section. + peekDescription() { return this.peek(_tokenKind.TokenKind.STRING) || this.peek(_tokenKind.TokenKind.BLOCK_STRING); } /** * Description : StringValue */ + parseDescription() { if (this.peekDescription()) { return this.parseStringLiteral(); @@ -30169,6 +29148,7 @@ class Parser { * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } * ``` */ + parseSchemaDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30185,6 +29165,7 @@ class Parser { /** * OperationTypeDefinition : OperationType : NamedType */ + parseOperationTypeDefinition() { const start = this._lexer.token; const operation = this.parseOperationType(); @@ -30199,6 +29180,7 @@ class Parser { /** * ScalarTypeDefinition : Description? scalar Name Directives[Const]? */ + parseScalarTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30217,6 +29199,7 @@ class Parser { * Description? * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? */ + parseObjectTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30239,6 +29222,7 @@ class Parser { * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ + parseImplementsInterfaces() { return this.expectOptionalKeyword('implements') ? this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType) : []; } @@ -30247,6 +29231,7 @@ class Parser { * FieldsDefinition : { FieldDefinition+ } * ``` */ + parseFieldsDefinition() { return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseFieldDefinition, _tokenKind.TokenKind.BRACE_R); } @@ -30254,6 +29239,7 @@ class Parser { * FieldDefinition : * - Description? Name ArgumentsDefinition? : Type Directives[Const]? */ + parseFieldDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30274,6 +29260,7 @@ class Parser { /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ + parseArgumentDefs() { return this.optionalMany(_tokenKind.TokenKind.PAREN_L, this.parseInputValueDef, _tokenKind.TokenKind.PAREN_R); } @@ -30281,6 +29268,7 @@ class Parser { * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ + parseInputValueDef() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30305,6 +29293,7 @@ class Parser { * InterfaceTypeDefinition : * - Description? interface Name Directives[Const]? FieldsDefinition? */ + parseInterfaceTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30326,6 +29315,7 @@ class Parser { * UnionTypeDefinition : * - Description? union Name Directives[Const]? UnionMemberTypes? */ + parseUnionTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30346,6 +29336,7 @@ class Parser { * - = `|`? NamedType * - UnionMemberTypes | NamedType */ + parseUnionMemberTypes() { return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) : []; } @@ -30353,6 +29344,7 @@ class Parser { * EnumTypeDefinition : * - Description? enum Name Directives[Const]? EnumValuesDefinition? */ + parseEnumTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30373,12 +29365,14 @@ class Parser { * EnumValuesDefinition : { EnumValueDefinition+ } * ``` */ + parseEnumValuesDefinition() { return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseEnumValueDefinition, _tokenKind.TokenKind.BRACE_R); } /** * EnumValueDefinition : Description? EnumValue Directives[Const]? */ + parseEnumValueDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30394,6 +29388,7 @@ class Parser { /** * EnumValue : Name but not `true`, `false` or `null` */ + parseEnumValueName() { if (this._lexer.token.value === 'true' || this._lexer.token.value === 'false' || this._lexer.token.value === 'null') { throw (0, _syntaxError.syntaxError)(this._lexer.source, this._lexer.token.start, `${getTokenDesc(this._lexer.token)} is reserved and cannot be used for an enum value.`); @@ -30404,6 +29399,7 @@ class Parser { * InputObjectTypeDefinition : * - Description? input Name Directives[Const]? InputFieldsDefinition? */ + parseInputObjectTypeDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30424,6 +29420,7 @@ class Parser { * InputFieldsDefinition : { InputValueDefinition+ } * ``` */ + parseInputFieldsDefinition() { return this.optionalMany(_tokenKind.TokenKind.BRACE_L, this.parseInputValueDef, _tokenKind.TokenKind.BRACE_R); } @@ -30440,6 +29437,7 @@ class Parser { * - EnumTypeExtension * - InputObjectTypeDefinition */ + parseTypeSystemExtension() { const keywordToken = this._lexer.lookahead(); if (keywordToken.kind === _tokenKind.TokenKind.NAME) { @@ -30469,6 +29467,7 @@ class Parser { * - extend schema Directives[Const] * ``` */ + parseSchemaExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30488,6 +29487,7 @@ class Parser { * ScalarTypeExtension : * - extend scalar Name Directives[Const] */ + parseScalarTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30509,6 +29509,7 @@ class Parser { * - extend type Name ImplementsInterfaces? Directives[Const] * - extend type Name ImplementsInterfaces */ + parseObjectTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30534,6 +29535,7 @@ class Parser { * - extend interface Name ImplementsInterfaces? Directives[Const] * - extend interface Name ImplementsInterfaces */ + parseInterfaceTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30558,6 +29560,7 @@ class Parser { * - extend union Name Directives[Const]? UnionMemberTypes * - extend union Name Directives[Const] */ + parseUnionTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30580,6 +29583,7 @@ class Parser { * - extend enum Name Directives[Const]? EnumValuesDefinition * - extend enum Name Directives[Const] */ + parseEnumTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30602,6 +29606,7 @@ class Parser { * - extend input Name Directives[Const]? InputFieldsDefinition * - extend input Name Directives[Const] */ + parseInputObjectTypeExtension() { const start = this._lexer.token; this.expectKeyword('extend'); @@ -30625,6 +29630,7 @@ class Parser { * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations * ``` */ + parseDirectiveDefinition() { const start = this._lexer.token; const description = this.parseDescription(); @@ -30649,6 +29655,7 @@ class Parser { * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ + parseDirectiveLocations() { return this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseDirectiveLocation); } @@ -30679,20 +29686,22 @@ class Parser { * `INPUT_OBJECT` * `INPUT_FIELD_DEFINITION` */ + parseDirectiveLocation() { const start = this._lexer.token; const name = this.parseName(); - if (Object.hasOwn(_directiveLocation.DirectiveLocation, name.value)) { + if (Object.prototype.hasOwnProperty.call(_directiveLocation.DirectiveLocation, name.value)) { return name; } throw this.unexpected(start); - } - // Core parsing utility functions + } // Core parsing utility functions + /** * Returns a node that, if configured to do so, sets a "loc" field as a * location object, used to identify the place in the source that created a * given parsed object. */ + node(startToken, node) { if (this._options.noLocation !== true) { node.loc = new _ast.Location(startToken, this._lexer.lastToken, this._lexer.source); @@ -30702,6 +29711,7 @@ class Parser { /** * Determines if the next token is of a given kind */ + peek(kind) { return this._lexer.token.kind === kind; } @@ -30709,6 +29719,7 @@ class Parser { * If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error. */ + expectToken(kind) { const token = this._lexer.token; if (token.kind === kind) { @@ -30721,6 +29732,7 @@ class Parser { * If the next token is of the given kind, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ + expectOptionalToken(kind) { const token = this._lexer.token; if (token.kind === kind) { @@ -30733,6 +29745,7 @@ class Parser { * If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error. */ + expectKeyword(value) { const token = this._lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { @@ -30745,6 +29758,7 @@ class Parser { * If the next token is a given keyword, return "true" after advancing the lexer. * Otherwise, do not change the parser state and return "false". */ + expectOptionalKeyword(value) { const token = this._lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { @@ -30756,6 +29770,7 @@ class Parser { /** * Helper function for creating an error when an unexpected lexed token is encountered. */ + unexpected(atToken) { const token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; return (0, _syntaxError.syntaxError)(this._lexer.source, token.start, `Unexpected ${getTokenDesc(token)}.`); @@ -30765,6 +29780,7 @@ class Parser { * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ + any(openKind, parseFn, closeKind) { this.expectToken(openKind); const nodes = []; @@ -30779,6 +29795,7 @@ class Parser { * that begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ + optionalMany(openKind, parseFn, closeKind) { if (this.expectOptionalToken(openKind)) { const nodes = []; @@ -30794,6 +29811,7 @@ class Parser { * This list begins with a lex token of openKind and ends with a lex token of closeKind. * Advances the parser to the next lex token after the closing token. */ + many(openKind, parseFn, closeKind) { this.expectToken(openKind); const nodes = []; @@ -30807,6 +29825,7 @@ class Parser { * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. * Advances the parser to the next lex token after last item in the list. */ + delimitedMany(delimiterKind, parseFn) { this.expectOptionalToken(delimiterKind); const nodes = []; @@ -30823,7 +29842,7 @@ class Parser { if (maxTokens !== undefined && token.kind !== _tokenKind.TokenKind.EOF) { ++this._tokenCounter; if (this._tokenCounter > maxTokens) { - throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, `Document contains more than ${maxTokens} tokens. Parsing aborted.`); + throw (0, _syntaxError.syntaxError)(this._lexer.source, token.start, `Document contains more that ${maxTokens} tokens. Parsing aborted.`); } } } @@ -30839,6 +29858,7 @@ function getTokenDesc(token) { /** * A helper function to describe a token kind as a string for debugging. */ + function getTokenKindDesc(kind) { return (0, _lexer.isPunctuatorTokenKind)(kind) ? `"${kind}"` : kind; } @@ -30859,7 +29879,6 @@ Object.defineProperty(exports, "__esModule", ({ exports.isConstValueNode = isConstValueNode; exports.isDefinitionNode = isDefinitionNode; exports.isExecutableDefinitionNode = isExecutableDefinitionNode; -exports.isNullabilityAssertionNode = isNullabilityAssertionNode; exports.isSelectionNode = isSelectionNode; exports.isTypeDefinitionNode = isTypeDefinitionNode; exports.isTypeExtensionNode = isTypeExtensionNode; @@ -30877,9 +29896,6 @@ function isExecutableDefinitionNode(node) { function isSelectionNode(node) { return node.kind === _kinds.Kind.FIELD || node.kind === _kinds.Kind.FRAGMENT_SPREAD || node.kind === _kinds.Kind.INLINE_FRAGMENT; } -function isNullabilityAssertionNode(node) { - return node.kind === _kinds.Kind.LIST_NULLABILITY_OPERATOR || node.kind === _kinds.Kind.NON_NULL_ASSERTION || node.kind === _kinds.Kind.ERROR_BOUNDARY; -} function isValueNode(node) { return node.kind === _kinds.Kind.VARIABLE || node.kind === _kinds.Kind.INT || node.kind === _kinds.Kind.FLOAT || node.kind === _kinds.Kind.STRING || node.kind === _kinds.Kind.BOOLEAN || node.kind === _kinds.Kind.NULL || node.kind === _kinds.Kind.ENUM || node.kind === _kinds.Kind.LIST || node.kind === _kinds.Kind.OBJECT; } @@ -30927,6 +29943,7 @@ function printLocation(location) { /** * Render a helpful description of the location in the GraphQL Source document. */ + function printSourceLocation(source, sourceLocation) { const firstLineColumnOffset = source.locationOffset.column - 1; const body = ''.padStart(firstLineColumnOffset) + source.body; @@ -30937,8 +29954,8 @@ function printSourceLocation(source, sourceLocation) { const columnNum = sourceLocation.column + columnOffset; const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; const lines = body.split(/\r\n|[\n\r]/g); - const locationLine = lines[lineIndex]; - // Special case for minified documents + const locationLine = lines[lineIndex]; // Special case for minified documents + if (locationLine.length > 120) { const subLineIndex = Math.floor(columnNum / 80); const subLineColumnNum = columnNum % 80; @@ -30978,14 +29995,24 @@ exports.printString = printString; */ function printString(str) { return `"${str.replace(escapedRegExp, escapedReplacer)}"`; -} -// eslint-disable-next-line no-control-regex +} // eslint-disable-next-line no-control-regex + const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; function escapedReplacer(str) { return escapeSequences[str.charCodeAt(0)]; -} -// prettier-ignore -const escapeSequences = ['\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004', '\\u0005', '\\u0006', '\\u0007', '\\b', '\\t', '\\n', '\\u000B', '\\f', '\\r', '\\u000E', '\\u000F', '\\u0010', '\\u0011', '\\u0012', '\\u0013', '\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018', '\\u0019', '\\u001A', '\\u001B', '\\u001C', '\\u001D', '\\u001E', '\\u001F', '', '', '\\"', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '\\\\', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '\\u007F', '\\u0080', '\\u0081', '\\u0082', '\\u0083', '\\u0084', '\\u0085', '\\u0086', '\\u0087', '\\u0088', '\\u0089', '\\u008A', '\\u008B', '\\u008C', '\\u008D', '\\u008E', '\\u008F', '\\u0090', '\\u0091', '\\u0092', '\\u0093', '\\u0094', '\\u0095', '\\u0096', '\\u0097', '\\u0098', '\\u0099', '\\u009A', '\\u009B', '\\u009C', '\\u009D', '\\u009E', '\\u009F']; +} // prettier-ignore + +const escapeSequences = ['\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004', '\\u0005', '\\u0006', '\\u0007', '\\b', '\\t', '\\n', '\\u000B', '\\f', '\\r', '\\u000E', '\\u000F', '\\u0010', '\\u0011', '\\u0012', '\\u0013', '\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018', '\\u0019', '\\u001A', '\\u001B', '\\u001C', '\\u001D', '\\u001E', '\\u001F', '', '', '\\"', '', '', '', '', '', '', '', '', '', '', '', '', '', +// 2F +'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', +// 3F +'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', +// 4F +'', '', '', '', '', '', '', '', '', '', '', '', '\\\\', '', '', '', +// 5F +'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', +// 6F +'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '\\u007F', '\\u0080', '\\u0081', '\\u0082', '\\u0083', '\\u0084', '\\u0085', '\\u0086', '\\u0087', '\\u0088', '\\u0089', '\\u008A', '\\u008B', '\\u008C', '\\u008D', '\\u008E', '\\u008F', '\\u0090', '\\u0091', '\\u0092', '\\u0093', '\\u0094', '\\u0095', '\\u0096', '\\u0097', '\\u0098', '\\u0099', '\\u009A', '\\u009B', '\\u009C', '\\u009D', '\\u009E', '\\u009F']; /***/ }), @@ -31008,6 +30035,7 @@ var _visitor = __webpack_require__(/*! ./visitor.mjs */ "../../../node_modules/g * Converts an AST into a string, using one set of reasonable * formatting rules. */ + function print(ast) { return (0, _visitor.visit)(ast, printDocASTReducer); } @@ -31026,9 +30054,9 @@ const printDocASTReducer = { OperationDefinition: { leave(node) { const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); - const prefix = join([node.operation, join([node.name, varDefs]), join(node.directives, ' ')], ' '); - // Anonymous queries with no directives or variable definitions can use + const prefix = join([node.operation, join([node.name, varDefs]), join(node.directives, ' ')], ' '); // Anonymous queries with no directives or variable definitions can use // the query short form. + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; } }, @@ -31050,19 +30078,15 @@ const printDocASTReducer = { alias, name, arguments: args, - nullabilityAssertion, directives, selectionSet }) { - const prefix = join([wrap('', alias, ': '), name], ''); + const prefix = wrap('', alias, ': ') + name; let argsLine = prefix + wrap('(', join(args, ', '), ')'); if (argsLine.length > MAX_LINE_LENGTH) { argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); } - return join([argsLine, - // Note: Client Controlled Nullability is experimental and may be - // changed or removed in the future. - nullabilityAssertion, wrap(' ', join(directives, ' ')), wrap(' ', selectionSet)]); + return join([argsLine, join(directives, ' '), selectionSet], ' '); } }, Argument: { @@ -31071,28 +30095,6 @@ const printDocASTReducer = { value }) => name + ': ' + value }, - // Nullability Modifiers - ListNullabilityOperator: { - leave({ - nullabilityAssertion - }) { - return join(['[', nullabilityAssertion, ']']); - } - }, - NonNullAssertion: { - leave({ - nullabilityAssertion - }) { - return join([nullabilityAssertion, '!']); - } - }, - ErrorBoundary: { - leave({ - nullabilityAssertion - }) { - return join([nullabilityAssertion, '?']); - } - }, // Fragments FragmentSpread: { leave: ({ @@ -31114,8 +30116,8 @@ const printDocASTReducer = { variableDefinitions, directives, selectionSet - }) => - // Note: fragment variable definitions are experimental and may be changed + } // Note: fragment variable definitions are experimental and may be changed + ) => // or removed in the future. `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + selectionSet }, @@ -31134,7 +30136,7 @@ const printDocASTReducer = { leave: ({ value, block: isBlockString - }) => isBlockString === true ? (0, _blockString.printBlockString)(value) : (0, _printString.printString)(value) + }) => isBlockString ? (0, _blockString.printBlockString)(value) : (0, _printString.printString)(value) }, BooleanValue: { leave: ({ @@ -31152,21 +30154,12 @@ const printDocASTReducer = { ListValue: { leave: ({ values - }) => { - const valuesLine = '[' + join(values, ', ') + ']'; - if (valuesLine.length > MAX_LINE_LENGTH) { - return '[\n' + indent(join(values, '\n')) + '\n]'; - } - return valuesLine; - } + }) => '[' + join(values, ', ') + ']' }, ObjectValue: { leave: ({ fields - }) => { - const fieldsLine = '{ ' + join(fields, ', ') + ' }'; - return fieldsLine.length > MAX_LINE_LENGTH ? block(fields) : fieldsLine; - } + }) => '{' + join(fields, ', ') + '}' }, ObjectField: { leave: ({ @@ -31348,6 +30341,7 @@ const printDocASTReducer = { * Given maybeArray, print an empty string if it is null or empty, otherwise * print all items together separated by separator if provided */ + function join(maybeArray, separator = '') { var _maybeArray$filter$jo; return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(x => x).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; @@ -31355,21 +30349,25 @@ function join(maybeArray, separator = '') { /** * Given array, print each item on its own line, wrapped in an indented `{ }` block. */ + function block(array) { return wrap('{\n', indent(join(array, '\n')), '\n}'); } /** * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. */ + function wrap(start, maybeString, end = '') { return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; } function indent(str) { - return wrap(' ', str.replaceAll('\n', '\n ')); + return wrap(' ', str.replace(/\n/g, '\n ')); } function hasMultilineItems(maybeArray) { var _maybeArray$some; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ return (_maybeArray$some = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.some(str => str.includes('\n'))) !== null && _maybeArray$some !== void 0 ? _maybeArray$some : false; } @@ -31390,6 +30388,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.Source = void 0; exports.isSource = isSource; var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); +var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _instanceOf = __webpack_require__(/*! ../jsutils/instanceOf.mjs */ "../../../node_modules/graphql/jsutils/instanceOf.mjs"); /** * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are @@ -31403,6 +30402,7 @@ class Source { line: 1, column: 1 }) { + typeof body === 'string' || (0, _devAssert.devAssert)(false, `Body must be a string. Received: ${(0, _inspect.inspect)(body)}.`); this.body = body; this.name = name; this.locationOffset = locationOffset; @@ -31446,7 +30446,6 @@ var TokenKind; TokenKind['SOF'] = ''; TokenKind['EOF'] = ''; TokenKind['BANG'] = '!'; - TokenKind['QUESTION_MARK'] = '?'; TokenKind['DOLLAR'] = '$'; TokenKind['AMP'] = '&'; TokenKind['PAREN_L'] = '('; @@ -31468,6 +30467,12 @@ var TokenKind; TokenKind['COMMENT'] = 'Comment'; })(TokenKind || (exports.TokenKind = TokenKind = {})); +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ + /***/ }), /***/ "../../../node_modules/graphql/language/visitor.mjs": @@ -31483,19 +30488,105 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.BREAK = void 0; exports.getEnterLeaveForKind = getEnterLeaveForKind; +exports.getVisitFn = getVisitFn; exports.visit = visit; exports.visitInParallel = visitInParallel; var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _ast = __webpack_require__(/*! ./ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); var _kinds = __webpack_require__(/*! ./kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ + const BREAK = exports.BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ + function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { const enterLeaveMap = new Map(); for (const kind of Object.values(_kinds.Kind)) { enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); } /* eslint-disable no-undef-init */ + let stack = undefined; let inArray = Array.isArray(root); let keys = [root]; @@ -31507,6 +30598,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { const path = []; const ancestors = []; /* eslint-enable no-undef-init */ + do { index++; const isLeaving = index === keys.length; @@ -31540,7 +30632,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { edits = stack.edits; inArray = stack.inArray; stack = stack.prev; - } else if (parent != null) { + } else if (parent) { key = inArray ? index : keys[index]; node = parent[key]; if (node === null || node === undefined) { @@ -31580,7 +30672,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { if (isLeaving) { path.pop(); } else { - var _visitorKeys$node$kin; + var _node$kind; stack = { inArray, index, @@ -31589,10 +30681,10 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { prev: stack }; inArray = Array.isArray(node); - keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; + keys = inArray ? node : (_node$kind = visitorKeys[node.kind]) !== null && _node$kind !== void 0 ? _node$kind : []; index = -1; edits = []; - if (parent != null) { + if (parent) { ancestors.push(parent); } parent = node; @@ -31600,7 +30692,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { } while (stack !== undefined); if (edits.length !== 0) { // New root - return edits.at(-1)[1]; + return edits[edits.length - 1][1]; } return root; } @@ -31610,6 +30702,7 @@ function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { * * If a prior visitor edits a node, no following visitors will see that node. */ + function visitInParallel(visitors) { const skipping = new Array(visitors.length).fill(null); const mergedVisitor = Object.create(null); @@ -31622,7 +30715,7 @@ function visitInParallel(visitors) { enter, leave } = getEnterLeaveForKind(visitors[i], kind); - hasVisitor ||= enter != null || leave != null; + hasVisitor || (hasVisitor = enter != null || leave != null); enterList[i] = enter; leaveList[i] = leave; } @@ -31670,6 +30763,7 @@ function visitInParallel(visitors) { /** * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. */ + function getEnterLeaveForKind(visitor, kind) { const kindVisitor = visitor[kind]; if (typeof kindVisitor === 'object') { @@ -31681,13 +30775,29 @@ function getEnterLeaveForKind(visitor, kind) { enter: kindVisitor, leave: undefined }; - } - // { enter() {}, leave() {} } + } // { enter() {}, leave() {} } + return { enter: visitor.enter, leave: visitor.leave }; } +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ + +/* c8 ignore next 8 */ + +function getVisitFn(visitor, kind, isLeaving) { + const { + enter, + leave + } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} /***/ }), @@ -31704,12 +30814,16 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.assertEnumValueName = assertEnumValueName; exports.assertName = assertName; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _characterClasses = __webpack_require__(/*! ../language/characterClasses.mjs */ "../../../node_modules/graphql/language/characterClasses.mjs"); /** * Upholds the spec rules about naming. */ + function assertName(name) { + name != null || (0, _devAssert.devAssert)(false, 'Must provide name.'); + typeof name === 'string' || (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); if (name.length === 0) { throw new _GraphQLError.GraphQLError('Expected name to be a non-empty string.'); } @@ -31728,6 +30842,7 @@ function assertName(name) { * * @internal */ + function assertEnumValueName(name) { if (name === 'true' || name === 'false' || name === 'null') { throw new _GraphQLError.GraphQLError(`Enum values cannot be named: ${name}`); @@ -31796,6 +30911,7 @@ var _didYouMean = __webpack_require__(/*! ../jsutils/didYouMean.mjs */ "../../.. var _identityFunc = __webpack_require__(/*! ../jsutils/identityFunc.mjs */ "../../../node_modules/graphql/jsutils/identityFunc.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _instanceOf = __webpack_require__(/*! ../jsutils/instanceOf.mjs */ "../../../node_modules/graphql/jsutils/instanceOf.mjs"); +var _isObjectLike = __webpack_require__(/*! ../jsutils/isObjectLike.mjs */ "../../../node_modules/graphql/jsutils/isObjectLike.mjs"); var _keyMap = __webpack_require__(/*! ../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _keyValMap = __webpack_require__(/*! ../jsutils/keyValMap.mjs */ "../../../node_modules/graphql/jsutils/keyValMap.mjs"); var _mapValue = __webpack_require__(/*! ../jsutils/mapValue.mjs */ "../../../node_modules/graphql/jsutils/mapValue.mjs"); @@ -31818,6 +30934,7 @@ function assertType(type) { /** * There are predicates for each kind of GraphQL type. */ + function isScalarType(type) { return (0, _instanceOf.instanceOf)(type, GraphQLScalarType); } @@ -31890,6 +31007,10 @@ function assertNonNullType(type) { } return type; } +/** + * These types may be used as input types for arguments and directives. + */ + function isInputType(type) { return isScalarType(type) || isEnumType(type) || isInputObjectType(type) || isWrappingType(type) && isInputType(type.ofType); } @@ -31899,6 +31020,10 @@ function assertInputType(type) { } return type; } +/** + * These types may be used as output types as the result of fields. + */ + function isOutputType(type) { return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isWrappingType(type) && isOutputType(type.ofType); } @@ -31908,6 +31033,10 @@ function assertOutputType(type) { } return type; } +/** + * These types may describe types which may be leaf values. + */ + function isLeafType(type) { return isScalarType(type) || isEnumType(type); } @@ -31917,6 +31046,10 @@ function assertLeafType(type) { } return type; } +/** + * These types may describe the parent context of a selection set. + */ + function isCompositeType(type) { return isObjectType(type) || isInterfaceType(type) || isUnionType(type); } @@ -31926,6 +31059,10 @@ function assertCompositeType(type) { } return type; } +/** + * These types may describe the parent context of a selection set. + */ + function isAbstractType(type) { return isInterfaceType(type) || isUnionType(type); } @@ -31954,8 +31091,10 @@ function assertAbstractType(type) { * }) * ``` */ + class GraphQLList { constructor(ofType) { + isType(ofType) || (0, _devAssert.devAssert)(false, `Expected ${(0, _inspect.inspect)(ofType)} to be a GraphQL type.`); this.ofType = ofType; } get [Symbol.toStringTag]() { @@ -31992,6 +31131,7 @@ class GraphQLList { exports.GraphQLList = GraphQLList; class GraphQLNonNull { constructor(ofType) { + isNullableType(ofType) || (0, _devAssert.devAssert)(false, `Expected ${(0, _inspect.inspect)(ofType)} to be a GraphQL nullable type.`); this.ofType = ofType; } get [Symbol.toStringTag]() { @@ -32004,6 +31144,9 @@ class GraphQLNonNull { return this.toString(); } } +/** + * These types wrap and modify other types + */ exports.GraphQLNonNull = GraphQLNonNull; function isWrappingType(type) { return isListType(type) || isNonNullType(type); @@ -32014,6 +31157,10 @@ function assertWrappingType(type) { } return type; } +/** + * These types can all accept null as a value. + */ + function isNullableType(type) { return isType(type) && !isNonNullType(type); } @@ -32028,6 +31175,10 @@ function getNullableType(type) { return isNonNullType(type) ? type.ofType : type; } } +/** + * These named types do not include modifiers like List or NonNull. + */ + function isNamedType(type) { return isScalarType(type) || isObjectType(type) || isInterfaceType(type) || isUnionType(type) || isEnumType(type) || isInputObjectType(type); } @@ -32046,12 +31197,27 @@ function getNamedType(type) { return unwrappedType; } } +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + function resolveReadonlyArrayThunk(thunk) { return typeof thunk === 'function' ? thunk() : thunk; } function resolveObjMapThunk(thunk) { return typeof thunk === 'function' ? thunk() : thunk; } +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + /** * Scalar Type Definition * @@ -32096,6 +31262,8 @@ class GraphQLScalarType { this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== void 0 ? _config$extensionASTN : []; + config.specifiedByURL == null || typeof config.specifiedByURL === 'string' || (0, _devAssert.devAssert)(false, `${this.name} must provide "specifiedByURL" as a string, ` + `but got: ${(0, _inspect.inspect)(config.specifiedByURL)}.`); + config.serialize == null || typeof config.serialize === 'function' || (0, _devAssert.devAssert)(false, `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`); if (config.parseLiteral) { typeof config.parseValue === 'function' && typeof config.parseLiteral === 'function' || (0, _devAssert.devAssert)(false, `${this.name} must provide both "parseValue" and "parseLiteral" functions.`); } @@ -32123,6 +31291,7 @@ class GraphQLScalarType { return this.toString(); } } + /** * Object Type Definition * @@ -32173,10 +31342,9 @@ class GraphQLObjectType { this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN2 = config.extensionASTNodes) !== null && _config$extensionASTN2 !== void 0 ? _config$extensionASTN2 : []; - // prettier-ignore - // FIXME: blocked by https://github.com/prettier/prettier/issues/14625 - this._fields = defineFieldMap.bind(undefined, config.fields); - this._interfaces = defineInterfaces.bind(undefined, config.interfaces); + this._fields = () => defineFieldMap(config); + this._interfaces = () => defineInterfaces(config); + config.isTypeOf == null || typeof config.isTypeOf === 'function' || (0, _devAssert.devAssert)(false, `${this.name} must provide "isTypeOf" as a function, ` + `but got: ${(0, _inspect.inspect)(config.isTypeOf)}.`); } get [Symbol.toStringTag]() { return 'GraphQLObjectType'; @@ -32213,14 +31381,21 @@ class GraphQLObjectType { } } exports.GraphQLObjectType = GraphQLObjectType; -function defineInterfaces(interfaces) { - return resolveReadonlyArrayThunk(interfaces !== null && interfaces !== void 0 ? interfaces : []); +function defineInterfaces(config) { + var _config$interfaces; + const interfaces = resolveReadonlyArrayThunk((_config$interfaces = config.interfaces) !== null && _config$interfaces !== void 0 ? _config$interfaces : []); + Array.isArray(interfaces) || (0, _devAssert.devAssert)(false, `${config.name} interfaces must be an Array or a function which returns an Array.`); + return interfaces; } -function defineFieldMap(fields) { - const fieldMap = resolveObjMapThunk(fields); +function defineFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || (0, _devAssert.devAssert)(false, `${config.name} fields must be an object with field names as keys or a function which returns such an object.`); return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { var _fieldConfig$args; + isPlainObj(fieldConfig) || (0, _devAssert.devAssert)(false, `${config.name}.${fieldName} field config must be an object.`); + fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function' || (0, _devAssert.devAssert)(false, `${config.name}.${fieldName} field resolver must be a function if ` + `provided, but got: ${(0, _inspect.inspect)(fieldConfig.resolve)}.`); const argsConfig = (_fieldConfig$args = fieldConfig.args) !== null && _fieldConfig$args !== void 0 ? _fieldConfig$args : {}; + isPlainObj(argsConfig) || (0, _devAssert.devAssert)(false, `${config.name}.${fieldName} args must be an object with argument names as keys.`); return { name: (0, _assertName.assertName)(fieldName), description: fieldConfig.description, @@ -32234,8 +31409,8 @@ function defineFieldMap(fields) { }; }); } -function defineArguments(args) { - return Object.entries(args).map(([argName, argConfig]) => ({ +function defineArguments(config) { + return Object.entries(config).map(([argName, argConfig]) => ({ name: (0, _assertName.assertName)(argName), description: argConfig.description, type: argConfig.type, @@ -32245,6 +31420,9 @@ function defineArguments(args) { astNode: argConfig.astNode })); } +function isPlainObj(obj) { + return (0, _isObjectLike.isObjectLike)(obj) && !Array.isArray(obj); +} function fieldsToFieldsConfig(fields) { return (0, _mapValue.mapValue)(fields, field => ({ description: field.description, @@ -32260,6 +31438,7 @@ function fieldsToFieldsConfig(fields) { /** * @internal */ + function argsToArgsConfig(args) { return (0, _keyValMap.keyValMap)(args, arg => arg.name, arg => ({ description: arg.description, @@ -32273,6 +31452,7 @@ function argsToArgsConfig(args) { function isRequiredArgument(arg) { return isNonNullType(arg.type) && arg.defaultValue === undefined; } + /** * Interface Type Definition * @@ -32301,10 +31481,9 @@ class GraphQLInterfaceType { this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN3 = config.extensionASTNodes) !== null && _config$extensionASTN3 !== void 0 ? _config$extensionASTN3 : []; - // prettier-ignore - // FIXME: blocked by https://github.com/prettier/prettier/issues/14625 - this._fields = defineFieldMap.bind(undefined, config.fields); - this._interfaces = defineInterfaces.bind(undefined, config.interfaces); + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.devAssert)(false, `${this.name} must provide "resolveType" as a function, ` + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`); } get [Symbol.toStringTag]() { return 'GraphQLInterfaceType'; @@ -32340,6 +31519,7 @@ class GraphQLInterfaceType { return this.toString(); } } + /** * Union Type Definition * @@ -32374,7 +31554,8 @@ class GraphQLUnionType { this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN4 = config.extensionASTNodes) !== null && _config$extensionASTN4 !== void 0 ? _config$extensionASTN4 : []; - this._types = defineTypes.bind(undefined, config.types); + this._types = defineTypes.bind(undefined, config); + config.resolveType == null || typeof config.resolveType === 'function' || (0, _devAssert.devAssert)(false, `${this.name} must provide "resolveType" as a function, ` + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`); } get [Symbol.toStringTag]() { return 'GraphQLUnionType'; @@ -32404,19 +31585,12 @@ class GraphQLUnionType { } } exports.GraphQLUnionType = GraphQLUnionType; -function defineTypes(types) { - return resolveReadonlyArrayThunk(types); -} -function enumValuesFromConfig(values) { - return Object.entries(values).map(([valueName, valueConfig]) => ({ - name: (0, _assertName.assertEnumValueName)(valueName), - description: valueConfig.description, - value: valueConfig.value !== undefined ? valueConfig.value : valueName, - deprecationReason: valueConfig.deprecationReason, - extensions: (0, _toObjMap.toObjMap)(valueConfig.extensions), - astNode: valueConfig.astNode - })); +function defineTypes(config) { + const types = resolveReadonlyArrayThunk(config.types); + Array.isArray(types) || (0, _devAssert.devAssert)(false, `Must provide Array of types or a function which returns such an array for Union ${config.name}.`); + return types; } + /** * Enum Type Definition * @@ -32440,7 +31614,8 @@ function enumValuesFromConfig(values) { * Note: If a value is not provided in a definition, the name of the enum value * will be used as its internal value. */ -class GraphQLEnumType /* */ { +class GraphQLEnumType { + /* */ constructor(config) { var _config$extensionASTN5; this.name = (0, _assertName.assertName)(config.name); @@ -32448,7 +31623,7 @@ class GraphQLEnumType /* */ { this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN5 = config.extensionASTNodes) !== null && _config$extensionASTN5 !== void 0 ? _config$extensionASTN5 : []; - this._values = typeof config.values === 'function' ? config.values : enumValuesFromConfig(config.values); + this._values = typeof config.values === 'function' ? config.values : defineEnumValues(this.name, config.values); this._valueLookup = null; this._nameLookup = null; } @@ -32457,7 +31632,7 @@ class GraphQLEnumType /* */ { } getValues() { if (typeof this._values === 'function') { - this._values = enumValuesFromConfig(this._values()); + this._values = defineEnumValues(this.name, this._values()); } return this._values; } @@ -32467,7 +31642,7 @@ class GraphQLEnumType /* */ { } return this._nameLookup[name]; } - serialize(outputValue /* T */) { + serialize(outputValue) { if (this._valueLookup === null) { this._valueLookup = new Map(this.getValues().map(enumValue => [enumValue.value, enumValue])); } @@ -32477,7 +31652,8 @@ class GraphQLEnumType /* */ { } return enumValue.name; } - parseValue(inputValue) { + parseValue(inputValue) /* T */ + { if (typeof inputValue !== 'string') { const valueStr = (0, _inspect.inspect)(inputValue); throw new _GraphQLError.GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + didYouMeanEnumValue(this, valueStr)); @@ -32488,7 +31664,8 @@ class GraphQLEnumType /* */ { } return enumValue.value; } - parseLiteral(valueNode, _variables) { + parseLiteral(valueNode, _variables) /* T */ + { // Note: variables will be resolved to a value before calling this function. if (valueNode.kind !== _kinds.Kind.ENUM) { const valueStr = (0, _printer.print)(valueNode); @@ -32535,6 +31712,21 @@ function didYouMeanEnumValue(enumType, unknownValueStr) { const suggestedValues = (0, _suggestionList.suggestionList)(unknownValueStr, allNames); return (0, _didYouMean.didYouMean)('the enum value', suggestedValues); } +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || (0, _devAssert.devAssert)(false, `${typeName} values must be an object with value names as keys.`); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + isPlainObj(valueConfig) || (0, _devAssert.devAssert)(false, `${typeName}.${valueName} must refer to an object with a "value" key ` + `representing an internal value but got: ${(0, _inspect.inspect)(valueConfig)}.`); + return { + name: (0, _assertName.assertEnumValueName)(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(valueConfig.extensions), + astNode: valueConfig.astNode + }; + }); +} + /** * Input Object Type Definition * @@ -32565,7 +31757,7 @@ class GraphQLInputObjectType { this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN6 = config.extensionASTNodes) !== null && _config$extensionASTN6 !== void 0 ? _config$extensionASTN6 : []; this.isOneOf = (_config$isOneOf = config.isOneOf) !== null && _config$isOneOf !== void 0 ? _config$isOneOf : false; - this._fields = defineInputFieldMap.bind(undefined, config.fields); + this._fields = defineInputFieldMap.bind(undefined, config); } get [Symbol.toStringTag]() { return 'GraphQLInputObjectType'; @@ -32603,17 +31795,21 @@ class GraphQLInputObjectType { } } exports.GraphQLInputObjectType = GraphQLInputObjectType; -function defineInputFieldMap(fields) { - const fieldMap = resolveObjMapThunk(fields); - return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => ({ - name: (0, _assertName.assertName)(fieldName), - description: fieldConfig.description, - type: fieldConfig.type, - defaultValue: fieldConfig.defaultValue, - deprecationReason: fieldConfig.deprecationReason, - extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), - astNode: fieldConfig.astNode - })); +function defineInputFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || (0, _devAssert.devAssert)(false, `${config.name} fields must be an object with field names as keys or a function which returns such an object.`); + return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { + !('resolve' in fieldConfig) || (0, _devAssert.devAssert)(false, `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`); + return { + name: (0, _assertName.assertName)(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), + astNode: fieldConfig.astNode + }; + }); } function isRequiredInputField(field) { return isNonNullType(field.type) && field.defaultValue === undefined; @@ -32632,13 +31828,15 @@ function isRequiredInputField(field) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.GraphQLStreamDirective = exports.GraphQLSpecifiedByDirective = exports.GraphQLSkipDirective = exports.GraphQLOneOfDirective = exports.GraphQLIncludeDirective = exports.GraphQLDirective = exports.GraphQLDeprecatedDirective = exports.GraphQLDeferDirective = exports.DEFAULT_DEPRECATION_REASON = void 0; +exports.GraphQLSpecifiedByDirective = exports.GraphQLSkipDirective = exports.GraphQLOneOfDirective = exports.GraphQLIncludeDirective = exports.GraphQLDirective = exports.GraphQLDeprecatedDirective = exports.DEFAULT_DEPRECATION_REASON = void 0; exports.assertDirective = assertDirective; exports.isDirective = isDirective; exports.isSpecifiedDirective = isSpecifiedDirective; exports.specifiedDirectives = void 0; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _instanceOf = __webpack_require__(/*! ../jsutils/instanceOf.mjs */ "../../../node_modules/graphql/jsutils/instanceOf.mjs"); +var _isObjectLike = __webpack_require__(/*! ../jsutils/isObjectLike.mjs */ "../../../node_modules/graphql/jsutils/isObjectLike.mjs"); var _toObjMap = __webpack_require__(/*! ../jsutils/toObjMap.mjs */ "../../../node_modules/graphql/jsutils/toObjMap.mjs"); var _directiveLocation = __webpack_require__(/*! ../language/directiveLocation.mjs */ "../../../node_modules/graphql/language/directiveLocation.mjs"); var _assertName = __webpack_require__(/*! ./assertName.mjs */ "../../../node_modules/graphql/type/assertName.mjs"); @@ -32647,6 +31845,7 @@ var _scalars = __webpack_require__(/*! ./scalars.mjs */ "../../../node_modules/g /** * Test if the given value is a GraphQL directive. */ + function isDirective(directive) { return (0, _instanceOf.instanceOf)(directive, GraphQLDirective); } @@ -32656,6 +31855,16 @@ function assertDirective(directive) { } return directive; } +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + /** * Directives are used by the GraphQL runtime as a way of modifying execution * behavior. Type system creators will usually not create these directly. @@ -32669,7 +31878,9 @@ class GraphQLDirective { this.isRepeatable = (_config$isRepeatable = config.isRepeatable) !== null && _config$isRepeatable !== void 0 ? _config$isRepeatable : false; this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; + Array.isArray(config.locations) || (0, _devAssert.devAssert)(false, `@${config.name} locations must be an Array.`); const args = (_config$args = config.args) !== null && _config$args !== void 0 ? _config$args : {}; + (0, _isObjectLike.isObjectLike)(args) && !Array.isArray(args) || (0, _devAssert.devAssert)(false, `@${config.name} args must be an object with argument names as keys.`); this.args = (0, _definition.defineArguments)(args); } get [Symbol.toStringTag]() { @@ -32693,6 +31904,7 @@ class GraphQLDirective { return this.toString(); } } + /** * Used to conditionally include fields or fragments. */ @@ -32711,6 +31923,7 @@ const GraphQLIncludeDirective = exports.GraphQLIncludeDirective = new GraphQLDir /** * Used to conditionally skip (exclude) fields or fragments. */ + const GraphQLSkipDirective = exports.GraphQLSkipDirective = new GraphQLDirective({ name: 'skip', description: 'Directs the executor to skip this field or fragment when the `if` argument is true.', @@ -32722,56 +31935,15 @@ const GraphQLSkipDirective = exports.GraphQLSkipDirective = new GraphQLDirective } } }); -/** - * Used to conditionally defer fragments. - */ -const GraphQLDeferDirective = exports.GraphQLDeferDirective = new GraphQLDirective({ - name: 'defer', - description: 'Directs the executor to defer this fragment when the `if` argument is true or undefined.', - locations: [_directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, _directiveLocation.DirectiveLocation.INLINE_FRAGMENT], - args: { - if: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - description: 'Deferred when true or undefined.', - defaultValue: true - }, - label: { - type: _scalars.GraphQLString, - description: 'Unique name' - } - } -}); -/** - * Used to conditionally stream list fields. - */ -const GraphQLStreamDirective = exports.GraphQLStreamDirective = new GraphQLDirective({ - name: 'stream', - description: 'Directs the executor to stream plural fields when the `if` argument is true or undefined.', - locations: [_directiveLocation.DirectiveLocation.FIELD], - args: { - if: { - type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), - description: 'Stream when true or undefined.', - defaultValue: true - }, - label: { - type: _scalars.GraphQLString, - description: 'Unique name' - }, - initialCount: { - defaultValue: 0, - type: _scalars.GraphQLInt, - description: 'Number of items to return immediately' - } - } -}); /** * Constant string used for default reason for a deprecation. */ + const DEFAULT_DEPRECATION_REASON = exports.DEFAULT_DEPRECATION_REASON = 'No longer supported'; /** * Used to declare element of a GraphQL schema as deprecated. */ + const GraphQLDeprecatedDirective = exports.GraphQLDeprecatedDirective = new GraphQLDirective({ name: 'deprecated', description: 'Marks an element of a GraphQL schema as no longer supported.', @@ -32787,6 +31959,7 @@ const GraphQLDeprecatedDirective = exports.GraphQLDeprecatedDirective = new Grap /** * Used to provide a URL for specifying the behavior of custom scalar definitions. */ + const GraphQLSpecifiedByDirective = exports.GraphQLSpecifiedByDirective = new GraphQLDirective({ name: 'specifiedBy', description: 'Exposes a URL that specifies the behavior of this scalar.', @@ -32801,6 +31974,7 @@ const GraphQLSpecifiedByDirective = exports.GraphQLSpecifiedByDirective = new Gr /** * Used to indicate an Input Object is a OneOf Input Object. */ + const GraphQLOneOfDirective = exports.GraphQLOneOfDirective = new GraphQLDirective({ name: 'oneOf', description: 'Indicates exactly one field must be supplied and this field must not be `null`.', @@ -32810,6 +31984,7 @@ const GraphQLOneOfDirective = exports.GraphQLOneOfDirective = new GraphQLDirecti /** * The full list of specified directives. */ + const specifiedDirectives = exports.specifiedDirectives = Object.freeze([GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective, GraphQLOneOfDirective]); function isSpecifiedDirective(directive) { return specifiedDirectives.some(({ @@ -32854,12 +32029,6 @@ Object.defineProperty(exports, "GraphQLBoolean", ({ return _scalars.GraphQLBoolean; } })); -Object.defineProperty(exports, "GraphQLDeferDirective", ({ - enumerable: true, - get: function () { - return _directives.GraphQLDeferDirective; - } -})); Object.defineProperty(exports, "GraphQLDeprecatedDirective", ({ enumerable: true, get: function () { @@ -32962,12 +32131,6 @@ Object.defineProperty(exports, "GraphQLSpecifiedByDirective", ({ return _directives.GraphQLSpecifiedByDirective; } })); -Object.defineProperty(exports, "GraphQLStreamDirective", ({ - enumerable: true, - get: function () { - return _directives.GraphQLStreamDirective; - } -})); Object.defineProperty(exports, "GraphQLString", ({ enumerable: true, get: function () { @@ -33474,7 +32637,7 @@ const __Directive = exports.__Directive = new _definition.GraphQLObjectType({ resolve(field, { includeDeprecated }) { - return includeDeprecated === true ? field.args : field.args.filter(arg => arg.deprecationReason == null); + return includeDeprecated ? field.args : field.args.filter(arg => arg.deprecationReason == null); } } }) @@ -33594,6 +32757,7 @@ const __Type = exports.__Type = new _definition.GraphQLObjectType({ } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered) + false || (0, _invariant.invariant)(false, `Unexpected type: "${(0, _inspect.inspect)(type)}".`); } }, @@ -33603,9 +32767,8 @@ const __Type = exports.__Type = new _definition.GraphQLObjectType({ }, description: { type: _scalars.GraphQLString, - resolve: type => - // FIXME: add test case - /* c8 ignore next */ + resolve: (type // FIXME: add test case + ) => /* c8 ignore next */ 'description' in type ? type.description : undefined }, specifiedByURL: { @@ -33625,7 +32788,7 @@ const __Type = exports.__Type = new _definition.GraphQLObjectType({ }) { if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { const fields = Object.values(type.getFields()); - return includeDeprecated === true ? fields : fields.filter(field => field.deprecationReason == null); + return includeDeprecated ? fields : fields.filter(field => field.deprecationReason == null); } } }, @@ -33660,7 +32823,7 @@ const __Type = exports.__Type = new _definition.GraphQLObjectType({ }) { if ((0, _definition.isEnumType)(type)) { const values = type.getValues(); - return includeDeprecated === true ? values : values.filter(field => field.deprecationReason == null); + return includeDeprecated ? values : values.filter(field => field.deprecationReason == null); } } }, @@ -33677,7 +32840,7 @@ const __Type = exports.__Type = new _definition.GraphQLObjectType({ }) { if ((0, _definition.isInputObjectType)(type)) { const values = Object.values(type.getFields()); - return includeDeprecated === true ? values : values.filter(field => field.deprecationReason == null); + return includeDeprecated ? values : values.filter(field => field.deprecationReason == null); } } }, @@ -33718,7 +32881,7 @@ const __Field = exports.__Field = new _definition.GraphQLObjectType({ resolve(field, { includeDeprecated }) { - return includeDeprecated === true ? field.args : field.args.filter(arg => arg.deprecationReason == null); + return includeDeprecated ? field.args : field.args.filter(arg => arg.deprecationReason == null); } }, type: { @@ -33848,6 +33011,7 @@ const __TypeKind = exports.__TypeKind = new _definition.GraphQLEnumType({ * Note that these are GraphQLField and not GraphQLFieldConfig, * so the format for args is different. */ + const SchemaMetaFieldDef = exports.SchemaMetaFieldDef = { name: '__schema', type: new _definition.GraphQLNonNull(__Schema), @@ -33927,11 +33091,13 @@ var _definition = __webpack_require__(/*! ./definition.mjs */ "../../../node_mod * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 * */ + const GRAPHQL_MAX_INT = exports.GRAPHQL_MAX_INT = 2147483647; /** * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) * */ + const GRAPHQL_MIN_INT = exports.GRAPHQL_MIN_INT = -2147483648; const GraphQLInt = exports.GraphQLInt = new _definition.GraphQLScalarType({ name: 'Int', @@ -34002,9 +33168,7 @@ const GraphQLFloat = exports.GraphQLFloat = new _definition.GraphQLScalarType({ }, parseLiteral(valueNode) { if (valueNode.kind !== _kinds.Kind.FLOAT && valueNode.kind !== _kinds.Kind.INT) { - throw new _GraphQLError.GraphQLError(`Float cannot represent non numeric value: ${(0, _printer.print)(valueNode)}`, { - nodes: valueNode - }); + throw new _GraphQLError.GraphQLError(`Float cannot represent non numeric value: ${(0, _printer.print)(valueNode)}`, valueNode); } return parseFloat(valueNode.value); } @@ -34013,9 +33177,9 @@ const GraphQLString = exports.GraphQLString = new _definition.GraphQLScalarType( name: 'String', description: 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', serialize(outputValue) { - const coercedValue = serializeObject(outputValue); - // Serialize string, boolean and number values to a string, but do not + const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not // attempt to coerce object, function, symbol, or other types as strings. + if (typeof coercedValue === 'string') { return coercedValue; } @@ -34106,10 +33270,10 @@ function isSpecifiedScalarType(type) { return specifiedScalarTypes.some(({ name }) => type.name === name); -} -// Support serializing objects with custom valueOf() or toJSON() functions - +} // Support serializing objects with custom valueOf() or toJSON() functions - // a common way to represent a complex value which can be represented as // a string (ex: MongoDB id objects). + function serializeObject(outputValue) { if ((0, _isObjectLike.isObjectLike)(outputValue)) { if (typeof outputValue.valueOf === 'function') { @@ -34141,8 +33305,10 @@ Object.defineProperty(exports, "__esModule", ({ exports.GraphQLSchema = void 0; exports.assertSchema = assertSchema; exports.isSchema = isSchema; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _instanceOf = __webpack_require__(/*! ../jsutils/instanceOf.mjs */ "../../../node_modules/graphql/jsutils/instanceOf.mjs"); +var _isObjectLike = __webpack_require__(/*! ../jsutils/isObjectLike.mjs */ "../../../node_modules/graphql/jsutils/isObjectLike.mjs"); var _toObjMap = __webpack_require__(/*! ../jsutils/toObjMap.mjs */ "../../../node_modules/graphql/jsutils/toObjMap.mjs"); var _ast = __webpack_require__(/*! ../language/ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); var _definition = __webpack_require__(/*! ./definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); @@ -34151,6 +33317,7 @@ var _introspection = __webpack_require__(/*! ./introspection.mjs */ "../../../no /** * Test if the given value is a GraphQL schema. */ + function isSchema(schema) { return (0, _instanceOf.instanceOf)(schema, GraphQLSchema); } @@ -34160,6 +33327,16 @@ function assertSchema(schema) { } return schema; } +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + /** * Schema Definition * @@ -34229,22 +33406,28 @@ function assertSchema(schema) { * ``` */ class GraphQLSchema { + // Used as a cache for validateSchema(). constructor(config) { var _config$extensionASTN, _config$directives; + // If this schema was built from a source known to be valid, then it may be // marked with assumeValid to avoid an additional type system validation. - this.__validationErrors = config.assumeValid === true ? [] : undefined; + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + (0, _isObjectLike.isObjectLike)(config) || (0, _devAssert.devAssert)(false, 'Must provide configuration object.'); + !config.types || Array.isArray(config.types) || (0, _devAssert.devAssert)(false, `"types" must be Array if provided but got: ${(0, _inspect.inspect)(config.types)}.`); + !config.directives || Array.isArray(config.directives) || (0, _devAssert.devAssert)(false, '"directives" must be Array if provided but got: ' + `${(0, _inspect.inspect)(config.directives)}.`); this.description = config.description; this.extensions = (0, _toObjMap.toObjMap)(config.extensions); this.astNode = config.astNode; this.extensionASTNodes = (_config$extensionASTN = config.extensionASTNodes) !== null && _config$extensionASTN !== void 0 ? _config$extensionASTN : []; this._queryType = config.query; this._mutationType = config.mutation; - this._subscriptionType = config.subscription; - // Provide specified directives (e.g. @include and @skip) by default. - this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : _directives.specifiedDirectives; - // To preserve order of user-provided types, we add first to add them to + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = (_config$directives = config.directives) !== null && _config$directives !== void 0 ? _config$directives : _directives.specifiedDirectives; // To preserve order of user-provided types, we add first to add them to // the set of "collected" types, so `collectReferencedTypes` ignore them. + const allReferencedTypes = new Set(config.types); if (config.types != null) { for (const type of config.types) { @@ -34271,17 +33454,18 @@ class GraphQLSchema { } } } - collectReferencedTypes(_introspection.__Schema, allReferencedTypes); - // Storing the resulting map for reference by the schema. + collectReferencedTypes(_introspection.__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + this._typeMap = Object.create(null); - this._subTypeMap = new Map(); - // Keep track of all implementations by interface name. + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + this._implementationsMap = Object.create(null); for (const namedType of allReferencedTypes) { if (namedType == null) { continue; } const typeName = namedType.name; + typeName || (0, _devAssert.devAssert)(false, 'One of the provided types for building the Schema is missing a name.'); if (this._typeMap[typeName] !== undefined) { throw new Error(`Schema must contain uniquely named types but contains multiple types named "${typeName}".`); } @@ -34356,17 +33540,25 @@ class GraphQLSchema { }; } isSubType(abstractType, maybeSubType) { - let set = this._subTypeMap.get(abstractType); - if (set === undefined) { + let map = this._subTypeMap[abstractType.name]; + if (map === undefined) { + map = Object.create(null); if ((0, _definition.isUnionType)(abstractType)) { - set = new Set(abstractType.getTypes()); + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } } else { const implementations = this.getImplementations(abstractType); - set = new Set([...implementations.objects, ...implementations.interfaces]); + for (const type of implementations.objects) { + map[type.name] = true; + } + for (const type of implementations.interfaces) { + map[type.name] = true; + } } - this._subTypeMap.set(abstractType, set); + this._subTypeMap[abstractType.name] = map; } - return set.has(maybeSubType); + return map[maybeSubType.name] !== undefined; } getDirectives() { return this._directives; @@ -34374,33 +33566,6 @@ class GraphQLSchema { getDirective(name) { return this.getDirectives().find(directive => directive.name === name); } - /** - * This method looks up the field on the given type definition. - * It has special casing for the three introspection fields, `__schema`, - * `__type` and `__typename`. - * - * `__typename` is special because it can always be queried as a field, even - * in situations where no other fields are allowed, like on a Union. - * - * `__schema` and `__type` could get automatically added to the query type, - * but that would require mutating type definitions, which would cause issues. - */ - getField(parentType, fieldName) { - switch (fieldName) { - case _introspection.SchemaMetaFieldDef.name: - return this.getQueryType() === parentType ? _introspection.SchemaMetaFieldDef : undefined; - case _introspection.TypeMetaFieldDef.name: - return this.getQueryType() === parentType ? _introspection.TypeMetaFieldDef : undefined; - case _introspection.TypeNameMetaFieldDef.name: - return _introspection.TypeNameMetaFieldDef; - } - // this function is part "hot" path inside executor and check presence - // of 'getFields' is faster than to use `!isUnionType` - if ('getFields' in parentType) { - return parentType.getFields()[fieldName]; - } - return undefined; - } toConfig() { return { description: this.description, @@ -34459,9 +33624,6 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.assertValidSchema = assertValidSchema; exports.validateSchema = validateSchema; -var _AccumulatorMap = __webpack_require__(/*! ../jsutils/AccumulatorMap.mjs */ "../../../node_modules/graphql/jsutils/AccumulatorMap.mjs"); -var _capitalize = __webpack_require__(/*! ../jsutils/capitalize.mjs */ "../../../node_modules/graphql/jsutils/capitalize.mjs"); -var _formatList = __webpack_require__(/*! ../jsutils/formatList.mjs */ "../../../node_modules/graphql/jsutils/formatList.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _ast = __webpack_require__(/*! ../language/ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); @@ -34477,20 +33639,21 @@ var _schema = __webpack_require__(/*! ./schema.mjs */ "../../../node_modules/gra * Validation runs synchronously, returning an array of encountered errors, or * an empty array if no errors were encountered and the Schema is valid. */ + function validateSchema(schema) { // First check to ensure the provided value is in fact a GraphQLSchema. - (0, _schema.assertSchema)(schema); - // If this Schema has already been validated, return the previous results. + (0, _schema.assertSchema)(schema); // If this Schema has already been validated, return the previous results. + if (schema.__validationErrors) { return schema.__validationErrors; - } - // Validate the schema, producing a list of errors. + } // Validate the schema, producing a list of errors. + const context = new SchemaValidationContext(schema); validateRootTypes(context); validateDirectives(context); - validateTypes(context); - // Persist the results of validation before returning to ensure validation + validateTypes(context); // Persist the results of validation before returning to ensure validation // does not run multiple times for this schema. + const errors = context.getErrors(); schema.__validationErrors = errors; return errors; @@ -34499,6 +33662,7 @@ function validateSchema(schema) { * Utility function which asserts a schema is valid by throwing an error if * it is invalid. */ + function assertValidSchema(schema) { const errors = validateSchema(schema); if (errors.length !== 0) { @@ -34522,28 +33686,22 @@ class SchemaValidationContext { } function validateRootTypes(context) { const schema = context.schema; - if (schema.getQueryType() == null) { + const queryType = schema.getQueryType(); + if (!queryType) { context.reportError('Query root type must be provided.', schema.astNode); + } else if (!(0, _definition.isObjectType)(queryType)) { + var _getOperationTypeNode; + context.reportError(`Query root type must be Object type, it cannot be ${(0, _inspect.inspect)(queryType)}.`, (_getOperationTypeNode = getOperationTypeNode(schema, _ast.OperationTypeNode.QUERY)) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode); } - const rootTypesMap = new _AccumulatorMap.AccumulatorMap(); - for (const operationType of Object.values(_ast.OperationTypeNode)) { - const rootType = schema.getRootType(operationType); - if (rootType != null) { - if (!(0, _definition.isObjectType)(rootType)) { - var _getOperationTypeNode; - const operationTypeStr = (0, _capitalize.capitalize)(operationType); - const rootTypeStr = (0, _inspect.inspect)(rootType); - context.reportError(operationType === _ast.OperationTypeNode.QUERY ? `${operationTypeStr} root type must be Object type, it cannot be ${rootTypeStr}.` : `${operationTypeStr} root type must be Object type if provided, it cannot be ${rootTypeStr}.`, (_getOperationTypeNode = getOperationTypeNode(schema, operationType)) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : rootType.astNode); - } else { - rootTypesMap.add(rootType, operationType); - } - } + const mutationType = schema.getMutationType(); + if (mutationType && !(0, _definition.isObjectType)(mutationType)) { + var _getOperationTypeNode2; + context.reportError('Mutation root type must be Object type if provided, it cannot be ' + `${(0, _inspect.inspect)(mutationType)}.`, (_getOperationTypeNode2 = getOperationTypeNode(schema, _ast.OperationTypeNode.MUTATION)) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode); } - for (const [rootType, operationTypes] of rootTypesMap) { - if (operationTypes.length > 1) { - const operationList = (0, _formatList.andList)(operationTypes); - context.reportError(`All root types must be different, "${rootType.name}" type is used as ${operationList} root types.`, operationTypes.map(operationType => getOperationTypeNode(schema, operationType))); - } + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType && !(0, _definition.isObjectType)(subscriptionType)) { + var _getOperationTypeNode3; + context.reportError('Subscription root type must be Object type if provided, it cannot be ' + `${(0, _inspect.inspect)(subscriptionType)}.`, (_getOperationTypeNode3 = getOperationTypeNode(schema, _ast.OperationTypeNode.SUBSCRIPTION)) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode); } } function getOperationTypeNode(schema, operation) { @@ -34552,7 +33710,9 @@ function getOperationTypeNode(schema, operation) { // FIXME: https://github.com/graphql/graphql-js/issues/2203 schemaNode => { var _schemaNode$operation; - return /* c8 ignore next */(_schemaNode$operation = schemaNode === null || schemaNode === void 0 ? void 0 : schemaNode.operationTypes) !== null && _schemaNode$operation !== void 0 ? _schemaNode$operation : []; + return /* c8 ignore next */( + (_schemaNode$operation = schemaNode === null || schemaNode === void 0 ? void 0 : schemaNode.operationTypes) !== null && _schemaNode$operation !== void 0 ? _schemaNode$operation : [] + ); }).find(operationNode => operationNode.operation === operation)) === null || _flatMap$find === void 0 ? void 0 : _flatMap$find.type; } function validateDirectives(context) { @@ -34561,17 +33721,15 @@ function validateDirectives(context) { if (!(0, _directives.isDirective)(directive)) { context.reportError(`Expected directive but got: ${(0, _inspect.inspect)(directive)}.`, directive === null || directive === void 0 ? void 0 : directive.astNode); continue; - } - // Ensure they are named correctly. - validateName(context, directive); - if (directive.locations.length === 0) { - context.reportError(`Directive @${directive.name} must include 1 or more locations.`, directive.astNode); - } + } // Ensure they are named correctly. + + validateName(context, directive); // TODO: Ensure proper locations. // Ensure the arguments are valid. + for (const arg of directive.args) { // Ensure they are named correctly. - validateName(context, arg); - // Ensure the type is an input type. + validateName(context, arg); // Ensure the type is an input type. + if (!(0, _definition.isInputType)(arg.type)) { context.reportError(`The type of @${directive.name}(${arg.name}:) must be Input Type ` + `but got: ${(0, _inspect.inspect)(arg.type)}.`, arg.astNode); } @@ -34596,20 +33754,20 @@ function validateTypes(context) { if (!(0, _definition.isNamedType)(type)) { context.reportError(`Expected GraphQL named type but got: ${(0, _inspect.inspect)(type)}.`, type.astNode); continue; - } - // Ensure it is named correctly (excluding introspection types). + } // Ensure it is named correctly (excluding introspection types). + if (!(0, _introspection.isIntrospectionType)(type)) { validateName(context, type); } if ((0, _definition.isObjectType)(type)) { // Ensure fields are valid - validateFields(context, type); - // Ensure objects implement the interfaces they claim to. + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + validateInterfaces(context, type); } else if ((0, _definition.isInterfaceType)(type)) { // Ensure fields are valid. - validateFields(context, type); - // Ensure interfaces implement the interfaces they claim to. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + validateInterfaces(context, type); } else if ((0, _definition.isUnionType)(type)) { // Ensure Unions include valid member types. @@ -34619,32 +33777,32 @@ function validateTypes(context) { validateEnumValues(context, type); } else if ((0, _definition.isInputObjectType)(type)) { // Ensure Input Object fields are valid. - validateInputFields(context, type); - // Ensure Input Objects do not contain non-nullable circular references + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + validateInputObjectCircularRefs(type); } } } function validateFields(context, type) { - const fields = Object.values(type.getFields()); - // Objects and Interfaces both must define one or more fields. + const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields. + if (fields.length === 0) { context.reportError(`Type ${type.name} must define one or more fields.`, [type.astNode, ...type.extensionASTNodes]); } for (const field of fields) { // Ensure they are named correctly. - validateName(context, field); - // Ensure the type is an output type + validateName(context, field); // Ensure the type is an output type + if (!(0, _definition.isOutputType)(field.type)) { var _field$astNode; context.reportError(`The type of ${type.name}.${field.name} must be Output Type ` + `but got: ${(0, _inspect.inspect)(field.type)}.`, (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type); - } - // Ensure the arguments are valid + } // Ensure the arguments are valid + for (const arg of field.args) { - const argName = arg.name; - // Ensure they are named correctly. - validateName(context, arg); - // Ensure the type is an input type + const argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + if (!(0, _definition.isInputType)(arg.type)) { var _arg$astNode2; context.reportError(`The type of ${type.name}.${field.name}(${argName}:) must be Input ` + `Type but got: ${(0, _inspect.inspect)(arg.type)}.`, (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type); @@ -34657,7 +33815,7 @@ function validateFields(context, type) { } } function validateInterfaces(context, type) { - const ifaceTypeNames = new Set(); + const ifaceTypeNames = Object.create(null); for (const iface of type.getInterfaces()) { if (!(0, _definition.isInterfaceType)(iface)) { context.reportError(`Type ${(0, _inspect.inspect)(type)} must only implement Interface types, ` + `it cannot implement ${(0, _inspect.inspect)(iface)}.`, getAllImplementsInterfaceNodes(type, iface)); @@ -34667,51 +33825,50 @@ function validateInterfaces(context, type) { context.reportError(`Type ${type.name} cannot implement itself because it would create a circular reference.`, getAllImplementsInterfaceNodes(type, iface)); continue; } - if (ifaceTypeNames.has(iface.name)) { + if (ifaceTypeNames[iface.name]) { context.reportError(`Type ${type.name} can only implement ${iface.name} once.`, getAllImplementsInterfaceNodes(type, iface)); continue; } - ifaceTypeNames.add(iface.name); + ifaceTypeNames[iface.name] = true; validateTypeImplementsAncestors(context, type, iface); validateTypeImplementsInterface(context, type, iface); } } function validateTypeImplementsInterface(context, type, iface) { - const typeFieldMap = type.getFields(); - // Assert each interface field is implemented. + const typeFieldMap = type.getFields(); // Assert each interface field is implemented. + for (const ifaceField of Object.values(iface.getFields())) { const fieldName = ifaceField.name; - const typeField = typeFieldMap[fieldName]; - // Assert interface field exists on type. - if (typeField == null) { + const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { context.reportError(`Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, [ifaceField.astNode, type.astNode, ...type.extensionASTNodes]); continue; - } - // Assert interface field type is satisfied by type field type, by being + } // Assert interface field type is satisfied by type field type, by being // a valid subtype. (covariant) + if (!(0, _typeComparators.isTypeSubTypeOf)(context.schema, typeField.type, ifaceField.type)) { var _ifaceField$astNode, _typeField$astNode; context.reportError(`Interface field ${iface.name}.${fieldName} expects type ` + `${(0, _inspect.inspect)(ifaceField.type)} but ${type.name}.${fieldName} ` + `is type ${(0, _inspect.inspect)(typeField.type)}.`, [(_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type, (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type]); - } - // Assert each interface field arg is implemented. + } // Assert each interface field arg is implemented. + for (const ifaceArg of ifaceField.args) { const argName = ifaceArg.name; - const typeArg = typeField.args.find(arg => arg.name === argName); - // Assert interface field arg exists on object field. + const typeArg = typeField.args.find(arg => arg.name === argName); // Assert interface field arg exists on object field. + if (!typeArg) { context.reportError(`Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, [ifaceArg.astNode, typeField.astNode]); continue; - } - // Assert interface field arg type matches object field arg type. + } // Assert interface field arg type matches object field arg type. // (invariant) // TODO: change to contravariant? + if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) { var _ifaceArg$astNode, _typeArg$astNode; context.reportError(`Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + `expects type ${(0, _inspect.inspect)(ifaceArg.type)} but ` + `${type.name}.${fieldName}(${argName}:) is type ` + `${(0, _inspect.inspect)(typeArg.type)}.`, [(_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type, (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type]); - } - // TODO: validate default values? - } - // Assert additional arguments must not be required. + } // TODO: validate default values? + } // Assert additional arguments must not be required. + for (const typeArg of typeField.args) { const argName = typeArg.name; const ifaceArg = ifaceField.args.find(arg => arg.name === argName); @@ -34734,13 +33891,13 @@ function validateUnionMembers(context, union) { if (memberTypes.length === 0) { context.reportError(`Union type ${union.name} must define one or more member types.`, [union.astNode, ...union.extensionASTNodes]); } - const includedTypeNames = new Set(); + const includedTypeNames = Object.create(null); for (const memberType of memberTypes) { - if (includedTypeNames.has(memberType.name)) { + if (includedTypeNames[memberType.name]) { context.reportError(`Union type ${union.name} can only include type ${memberType.name} once.`, getUnionMemberTypeNodes(union, memberType.name)); continue; } - includedTypeNames.add(memberType.name); + includedTypeNames[memberType.name] = true; if (!(0, _definition.isObjectType)(memberType)) { context.reportError(`Union type ${union.name} can only include Object types, ` + `it cannot include ${(0, _inspect.inspect)(memberType)}.`, getUnionMemberTypeNodes(union, String(memberType))); } @@ -34760,12 +33917,12 @@ function validateInputFields(context, inputObj) { const fields = Object.values(inputObj.getFields()); if (fields.length === 0) { context.reportError(`Input Object type ${inputObj.name} must define one or more fields.`, [inputObj.astNode, ...inputObj.extensionASTNodes]); - } - // Ensure the arguments are valid + } // Ensure the arguments are valid + for (const field of fields) { // Ensure they are named correctly. - validateName(context, field); - // Ensure the type is an input type + validateName(context, field); // Ensure the type is an input type + if (!(0, _definition.isInputType)(field.type)) { var _field$astNode2; context.reportError(`The type of ${inputObj.name}.${field.name} must be Input Type ` + `but got: ${(0, _inspect.inspect)(field.type)}.`, (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type); @@ -34792,20 +33949,20 @@ function createInputObjectCircularRefsValidator(context) { // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. // Tracks already visited types to maintain O(N) and to ensure that cycles // are not redundantly reported. - const visitedTypes = new Set(); - // Array of types nodes used to produce meaningful errors - const fieldPath = []; - // Position in the type path + const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + const fieldPath = []; // Position in the type path + const fieldPathIndexByTypeName = Object.create(null); - return detectCycleRecursive; - // This does a straight-forward DFS to find cycles. + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. // It does not terminate when a cycle was found but continues to explore // the graph to find all possible cycles. + function detectCycleRecursive(inputObj) { - if (visitedTypes.has(inputObj)) { + if (visitedTypes[inputObj.name]) { return; } - visitedTypes.add(inputObj); + visitedTypes[inputObj.name] = true; fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; const fields = Object.values(inputObj.getFields()); for (const field of fields) { @@ -34831,11 +33988,13 @@ function getAllImplementsInterfaceNodes(type, iface) { astNode, extensionASTNodes } = type; - const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + return nodes.flatMap(typeNode => { var _typeNode$interfaces; - return /* c8 ignore next */(_typeNode$interfaces = typeNode.interfaces) !== null && _typeNode$interfaces !== void 0 ? _typeNode$interfaces : []; + return /* c8 ignore next */( + (_typeNode$interfaces = typeNode.interfaces) !== null && _typeNode$interfaces !== void 0 ? _typeNode$interfaces : [] + ); }).filter(ifaceNode => ifaceNode.name.value === iface.name); } function getUnionMemberTypeNodes(union, typeName) { @@ -34843,11 +34002,13 @@ function getUnionMemberTypeNodes(union, typeName) { astNode, extensionASTNodes } = union; - const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + return nodes.flatMap(unionNode => { var _unionNode$types; - return /* c8 ignore next */(_unionNode$types = unionNode.types) !== null && _unionNode$types !== void 0 ? _unionNode$types : []; + return /* c8 ignore next */( + (_unionNode$types = unionNode.types) !== null && _unionNode$types !== void 0 ? _unionNode$types : [] + ); }).filter(typeNode => typeNode.name.value === typeName); } function getDeprecatedDirectiveNode(definitionNode) { @@ -34874,12 +34035,14 @@ var _ast = __webpack_require__(/*! ../language/ast.mjs */ "../../../node_modules var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _visitor = __webpack_require__(/*! ../language/visitor.mjs */ "../../../node_modules/graphql/language/visitor.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); +var _introspection = __webpack_require__(/*! ../type/introspection.mjs */ "../../../node_modules/graphql/type/introspection.mjs"); var _typeFromAST = __webpack_require__(/*! ./typeFromAST.mjs */ "../../../node_modules/graphql/utilities/typeFromAST.mjs"); /** * TypeInfo is a utility class which, given a GraphQL schema, can keep track * of the current field and type definitions at any point in a GraphQL document * AST during a recursive descent by calling `enter(node)` and `leave(node)`. */ + class TypeInfo { constructor(schema, /** @@ -34914,22 +34077,34 @@ class TypeInfo { return 'TypeInfo'; } getType() { - return this._typeStack.at(-1); + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } } getParentType() { - return this._parentTypeStack.at(-1); + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } } getInputType() { - return this._inputTypeStack.at(-1); + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } } getParentInputType() { - return this._inputTypeStack.at(-2); + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } } getFieldDef() { - return this._fieldDefStack.at(-1); + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } } getDefaultValue() { - return this._defaultValueStack.at(-1); + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } } getDirective() { return this._directive; @@ -34941,11 +34116,11 @@ class TypeInfo { return this._enumValue; } enter(node) { - const schema = this._schema; - // Note: many of the types below are explicitly typed as "unknown" to drop + const schema = this._schema; // Note: many of the types below are explicitly typed as "unknown" to drop // any assumptions of a valid schema to ensure runtime types are properly // checked before continuing since TypeInfo is used as part of validation // which occurs before guarantees of schema and document validity. + switch (node.kind) { case _kinds.Kind.SELECTION_SET: { @@ -35011,8 +34186,8 @@ class TypeInfo { case _kinds.Kind.LIST: { const listType = (0, _definition.getNullableType)(this.getInputType()); - const itemType = (0, _definition.isListType)(listType) ? listType.ofType : listType; - // List positions never have a default value. + const itemType = (0, _definition.isListType)(listType) ? listType.ofType : listType; // List positions never have a default value. + this._defaultValueStack.push(undefined); this._inputTypeStack.push((0, _definition.isInputType)(itemType) ? itemType : undefined); break; @@ -35024,7 +34199,7 @@ class TypeInfo { let inputField; if ((0, _definition.isInputObjectType)(objectType)) { inputField = objectType.getFields()[node.name.value]; - if (inputField != null) { + if (inputField) { inputFieldType = inputField.type; } } @@ -35042,8 +34217,7 @@ class TypeInfo { this._enumValue = enumValue; break; } - default: - // Ignore other nodes + default: // Ignore other nodes } } leave(node) { @@ -35079,19 +34253,37 @@ class TypeInfo { case _kinds.Kind.ENUM: this._enumValue = null; break; - default: - // Ignore other nodes + default: // Ignore other nodes } } } + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ exports.TypeInfo = TypeInfo; function getFieldDef(schema, parentType, fieldNode) { - return schema.getField(parentType, fieldNode.name.value); + const name = fieldNode.name.value; + if (name === _introspection.SchemaMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.SchemaMetaFieldDef; + } + if (name === _introspection.TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return _introspection.TypeMetaFieldDef; + } + if (name === _introspection.TypeNameMetaFieldDef.name && (0, _definition.isCompositeType)(parentType)) { + return _introspection.TypeNameMetaFieldDef; + } + if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { + return parentType.getFields()[name]; + } } /** * Creates a new visitor instance which maintains a provided TypeInfo instance * along with visiting visitor. */ + function visitWithTypeInfo(typeInfo, visitor) { return { enter(...args) { @@ -35124,6 +34316,56 @@ function visitWithTypeInfo(typeInfo, visitor) { /***/ }), +/***/ "../../../node_modules/graphql/utilities/assertValidName.mjs": +/*!*******************************************************************!*\ + !*** ../../../node_modules/graphql/utilities/assertValidName.mjs ***! + \*******************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.assertValidName = assertValidName; +exports.isValidNameError = isValidNameError; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); +var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); +var _assertName = __webpack_require__(/*! ../type/assertName.mjs */ "../../../node_modules/graphql/type/assertName.mjs"); +/* c8 ignore start */ + +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +function assertValidName(name) { + const error = isValidNameError(name); + if (error) { + throw error; + } + return name; +} +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +function isValidNameError(name) { + typeof name === 'string' || (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); + if (name.startsWith('__')) { + return new _GraphQLError.GraphQLError(`Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`); + } + try { + (0, _assertName.assertName)(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ + +/***/ }), + /***/ "../../../node_modules/graphql/utilities/astFromValue.mjs": /*!****************************************************************!*\ !*** ../../../node_modules/graphql/utilities/astFromValue.mjs ***! @@ -35164,6 +34406,7 @@ var _scalars = __webpack_require__(/*! ../type/scalars.mjs */ "../../../node_mod * | null | NullValue | * */ + function astFromValue(value, type) { if ((0, _definition.isNonNullType)(type)) { const astValue = astFromValue(value, type.ofType); @@ -35171,19 +34414,19 @@ function astFromValue(value, type) { return null; } return astValue; - } - // only explicit null, not undefined, NaN + } // only explicit null, not undefined, NaN + if (value === null) { return { kind: _kinds.Kind.NULL }; - } - // undefined + } // undefined + if (value === undefined) { return null; - } - // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but // the value is not an array, convert the value using the list's item type. + if ((0, _definition.isListType)(type)) { const itemType = type.ofType; if ((0, _isIterableObject.isIterableObject)(value)) { @@ -35200,9 +34443,9 @@ function astFromValue(value, type) { }; } return astFromValue(value, itemType); - } - // Populate the fields of the input object by creating ASTs from each value + } // Populate the fields of the input object by creating ASTs from each value // in the JavaScript object according to the fields in the input type. + if ((0, _definition.isInputObjectType)(type)) { if (!(0, _isObjectLike.isObjectLike)(value)) { return null; @@ -35232,15 +34475,15 @@ function astFromValue(value, type) { const serialized = type.serialize(value); if (serialized == null) { return null; - } - // Others serialize based on their corresponding JavaScript scalar types. + } // Others serialize based on their corresponding JavaScript scalar types. + if (typeof serialized === 'boolean') { return { kind: _kinds.Kind.BOOLEAN, value: serialized }; - } - // JavaScript numbers can be Int or Float values. + } // JavaScript numbers can be Int or Float values. + if (typeof serialized === 'number' && Number.isFinite(serialized)) { const stringNum = String(serialized); return integerStringRegExp.test(stringNum) ? { @@ -35258,8 +34501,8 @@ function astFromValue(value, type) { kind: _kinds.Kind.ENUM, value: serialized }; - } - // ID types can use Int literals. + } // ID types can use Int literals. + if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) { return { kind: _kinds.Kind.INT, @@ -35275,6 +34518,7 @@ function astFromValue(value, type) { } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected input type: ' + (0, _inspect.inspect)(type)); } /** @@ -35282,6 +34526,7 @@ function astFromValue(value, type) { * - NegativeSign? 0 * - NegativeSign? NonZeroDigit ( Digit+ )? */ + const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; /***/ }), @@ -35299,6 +34544,8 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.buildASTSchema = buildASTSchema; exports.buildSchema = buildSchema; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); +var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _parser = __webpack_require__(/*! ../language/parser.mjs */ "../../../node_modules/graphql/language/parser.mjs"); var _directives = __webpack_require__(/*! ../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); var _schema = __webpack_require__(/*! ../type/schema.mjs */ "../../../node_modules/graphql/type/schema.mjs"); @@ -35315,6 +34562,7 @@ var _extendSchema = __webpack_require__(/*! ./extendSchema.mjs */ "../../../node * has no resolve methods, so execution will use default resolvers. */ function buildASTSchema(documentAST, options) { + documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { (0, _validate.assertValidSDL)(documentAST); } @@ -35360,6 +34608,7 @@ function buildASTSchema(documentAST, options) { * A helper function to build a GraphQLSchema directly from a source * document. */ + function buildSchema(source, options) { const document = (0, _parser.parse)(source, { noLocation: options === null || options === void 0 ? void 0 : options.noLocation, @@ -35408,50 +34657,49 @@ var _valueFromAST = __webpack_require__(/*! ./valueFromAST.mjs */ "../../../node * This function expects a complete introspection result. Don't forget to check * the "errors" field of a server response before calling this function. */ + function buildClientSchema(introspection, options) { - // Even though the `introspection` argument is typed, in most cases it's received - // as an untyped value from the server, so we will do an additional check here. - (0, _isObjectLike.isObjectLike)(introspection) && (0, _isObjectLike.isObjectLike)(introspection.__schema) || (0, _devAssert.devAssert)(false, `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${(0, _inspect.inspect)(introspection)}.`); - // Get the schema from the introspection result. - const schemaIntrospection = introspection.__schema; - // Iterate through all types, getting the type definition for each. - const typeMap = new Map(schemaIntrospection.types.map(typeIntrospection => [typeIntrospection.name, buildType(typeIntrospection)])); - // Include standard types only if they are used. + (0, _isObjectLike.isObjectLike)(introspection) && (0, _isObjectLike.isObjectLike)(introspection.__schema) || (0, _devAssert.devAssert)(false, `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${(0, _inspect.inspect)(introspection)}.`); // Get the schema from the introspection result. + + const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + const typeMap = (0, _keyValMap.keyValMap)(schemaIntrospection.types, typeIntrospection => typeIntrospection.name, typeIntrospection => buildType(typeIntrospection)); // Include standard types only if they are used. + for (const stdType of [..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes]) { - if (typeMap.has(stdType.name)) { - typeMap.set(stdType.name, stdType); + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; } - } - // Get the root Query, Mutation, and Subscription types. - const queryType = schemaIntrospection.queryType != null ? getObjectType(schemaIntrospection.queryType) : null; - const mutationType = schemaIntrospection.mutationType != null ? getObjectType(schemaIntrospection.mutationType) : null; - const subscriptionType = schemaIntrospection.subscriptionType != null ? getObjectType(schemaIntrospection.subscriptionType) : null; - // Get the directives supported by Introspection, assuming empty-set if + } // Get the root Query, Mutation, and Subscription types. + + const queryType = schemaIntrospection.queryType ? getObjectType(schemaIntrospection.queryType) : null; + const mutationType = schemaIntrospection.mutationType ? getObjectType(schemaIntrospection.mutationType) : null; + const subscriptionType = schemaIntrospection.subscriptionType ? getObjectType(schemaIntrospection.subscriptionType) : null; // Get the directives supported by Introspection, assuming empty-set if // directives were not queried for. - const directives = schemaIntrospection.directives != null ? schemaIntrospection.directives.map(buildDirective) : []; - // Then produce and return a Schema with these types. + + const directives = schemaIntrospection.directives ? schemaIntrospection.directives.map(buildDirective) : []; // Then produce and return a Schema with these types. + return new _schema.GraphQLSchema({ description: schemaIntrospection.description, query: queryType, mutation: mutationType, subscription: subscriptionType, - types: [...typeMap.values()], + types: Object.values(typeMap), directives, assumeValid: options === null || options === void 0 ? void 0 : options.assumeValid - }); - // Given a type reference in introspection, return the GraphQLType instance. + }); // Given a type reference in introspection, return the GraphQLType instance. // preferring cached instances before building new instances. + function getType(typeRef) { if (typeRef.kind === _introspection.TypeKind.LIST) { const itemRef = typeRef.ofType; - if (itemRef == null) { + if (!itemRef) { throw new Error('Decorated type deeper than introspection query.'); } return new _definition.GraphQLList(getType(itemRef)); } if (typeRef.kind === _introspection.TypeKind.NON_NULL) { const nullableRef = typeRef.ofType; - if (nullableRef == null) { + if (!nullableRef) { throw new Error('Decorated type deeper than introspection query.'); } const nullableType = getType(nullableRef); @@ -35464,8 +34712,8 @@ function buildClientSchema(introspection, options) { if (!typeName) { throw new Error(`Unknown type reference: ${(0, _inspect.inspect)(typeRef)}.`); } - const type = typeMap.get(typeName); - if (type == null) { + const type = typeMap[typeName]; + if (!type) { throw new Error(`Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`); } return type; @@ -35475,9 +34723,9 @@ function buildClientSchema(introspection, options) { } function getInterfaceType(typeRef) { return (0, _definition.assertInterfaceType)(getNamedType(typeRef)); - } - // Given a type's introspection result, construct the correct + } // Given a type's introspection result, construct the correct // GraphQLType instance. + function buildType(type) { // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (type != null && type.name != null && type.kind != null) { @@ -35514,7 +34762,7 @@ function buildClientSchema(introspection, options) { if (implementingIntrospection.interfaces === null && implementingIntrospection.kind === _introspection.TypeKind.INTERFACE) { return []; } - if (implementingIntrospection.interfaces == null) { + if (!implementingIntrospection.interfaces) { const implementingIntrospectionStr = (0, _inspect.inspect)(implementingIntrospection); throw new Error(`Introspection result missing interfaces: ${implementingIntrospectionStr}.`); } @@ -35537,7 +34785,7 @@ function buildClientSchema(introspection, options) { }); } function buildUnionDef(unionIntrospection) { - if (unionIntrospection.possibleTypes == null) { + if (!unionIntrospection.possibleTypes) { const unionIntrospectionStr = (0, _inspect.inspect)(unionIntrospection); throw new Error(`Introspection result missing possibleTypes: ${unionIntrospectionStr}.`); } @@ -35548,7 +34796,7 @@ function buildClientSchema(introspection, options) { }); } function buildEnumDef(enumIntrospection) { - if (enumIntrospection.enumValues == null) { + if (!enumIntrospection.enumValues) { const enumIntrospectionStr = (0, _inspect.inspect)(enumIntrospection); throw new Error(`Introspection result missing enumValues: ${enumIntrospectionStr}.`); } @@ -35562,7 +34810,7 @@ function buildClientSchema(introspection, options) { }); } function buildInputObjectDef(inputObjectIntrospection) { - if (inputObjectIntrospection.inputFields == null) { + if (!inputObjectIntrospection.inputFields) { const inputObjectIntrospectionStr = (0, _inspect.inspect)(inputObjectIntrospection); throw new Error(`Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`); } @@ -35574,7 +34822,7 @@ function buildClientSchema(introspection, options) { }); } function buildFieldDefMap(typeIntrospection) { - if (typeIntrospection.fields == null) { + if (!typeIntrospection.fields) { throw new Error(`Introspection result missing fields: ${(0, _inspect.inspect)(typeIntrospection)}.`); } return (0, _keyValMap.keyValMap)(typeIntrospection.fields, fieldIntrospection => fieldIntrospection.name, buildField); @@ -35585,7 +34833,7 @@ function buildClientSchema(introspection, options) { const typeStr = (0, _inspect.inspect)(type); throw new Error(`Introspection must provide output type for fields, but received: ${typeStr}.`); } - if (fieldIntrospection.args == null) { + if (!fieldIntrospection.args) { const fieldIntrospectionStr = (0, _inspect.inspect)(fieldIntrospection); throw new Error(`Introspection result missing field args: ${fieldIntrospectionStr}.`); } @@ -35614,11 +34862,11 @@ function buildClientSchema(introspection, options) { }; } function buildDirective(directiveIntrospection) { - if (directiveIntrospection.args == null) { + if (!directiveIntrospection.args) { const directiveIntrospectionStr = (0, _inspect.inspect)(directiveIntrospection); throw new Error(`Introspection result missing directive args: ${directiveIntrospectionStr}.`); } - if (directiveIntrospection.locations == null) { + if (!directiveIntrospection.locations) { const directiveIntrospectionStr = (0, _inspect.inspect)(directiveIntrospection); throw new Error(`Introspection result missing directive locations: ${directiveIntrospectionStr}.`); } @@ -35689,8 +34937,8 @@ function coerceInputValueImpl(inputValue, type, onError, path) { const itemPath = (0, _Path.addPath)(path, index, undefined); return coerceInputValueImpl(itemValue, itemType, onError, itemPath); }); - } - // Lists accept a non-list value as a list of one. + } // Lists accept a non-list value as a list of one. + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; } if ((0, _definition.isInputObjectType)(type)) { @@ -35712,10 +34960,10 @@ function coerceInputValueImpl(inputValue, type, onError, path) { continue; } coercedValue[field.name] = coerceInputValueImpl(fieldValue, field.type, onError, (0, _Path.addPath)(path, field.name, type.name)); - } - // Ensure every provided field is defined. + } // Ensure every provided field is defined. + for (const fieldName of Object.keys(inputValue)) { - if (fieldDefs[fieldName] == null) { + if (!fieldDefs[fieldName]) { const suggestions = (0, _suggestionList.suggestionList)(fieldName, Object.keys(type.getFields())); onError((0, _Path.pathToArray)(path), inputValue, new _GraphQLError.GraphQLError(`Field "${fieldName}" is not defined by type "${type.name}".` + (0, _didYouMean.didYouMean)(suggestions))); } @@ -35734,10 +34982,10 @@ function coerceInputValueImpl(inputValue, type, onError, path) { return coercedValue; } if ((0, _definition.isLeafType)(type)) { - let parseResult; - // Scalars and Enums determine if an input value is valid via parseValue(), + let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), // which can throw to indicate failure. If it throws, maintain a reference // to the original error. + try { parseResult = type.parseValue(inputValue); } catch (error) { @@ -35757,6 +35005,7 @@ function coerceInputValueImpl(inputValue, type, onError, path) { } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected input type: ' + (0, _inspect.inspect)(type)); } @@ -35780,6 +35029,7 @@ var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_mod * concatenate the ASTs together into batched AST, useful for validating many * GraphQL source files which together represent one conceptual application. */ + function concatAST(documents) { const definitions = []; for (const doc of documents) { @@ -35806,11 +35056,13 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.extendSchema = extendSchema; exports.extendSchemaImpl = extendSchemaImpl; -var _AccumulatorMap = __webpack_require__(/*! ../jsutils/AccumulatorMap.mjs */ "../../../node_modules/graphql/jsutils/AccumulatorMap.mjs"); +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); +var _keyMap = __webpack_require__(/*! ../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _mapValue = __webpack_require__(/*! ../jsutils/mapValue.mjs */ "../../../node_modules/graphql/jsutils/mapValue.mjs"); var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); +var _predicates = __webpack_require__(/*! ../language/predicates.mjs */ "../../../node_modules/graphql/language/predicates.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); var _directives = __webpack_require__(/*! ../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); var _introspection = __webpack_require__(/*! ../type/introspection.mjs */ "../../../node_modules/graphql/type/introspection.mjs"); @@ -35833,6 +35085,7 @@ var _valueFromAST = __webpack_require__(/*! ./valueFromAST.mjs */ "../../../node */ function extendSchema(schema, documentAST, options) { (0, _schema.assertSchema)(schema); + documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT || (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); if ((options === null || options === void 0 ? void 0 : options.assumeValid) !== true && (options === null || options === void 0 ? void 0 : options.assumeValidSDL) !== true) { (0, _validate.assertValidSDLExtension)(documentAST, schema); } @@ -35843,77 +35096,47 @@ function extendSchema(schema, documentAST, options) { /** * @internal */ + function extendSchemaImpl(schemaConfig, documentAST, options) { - var _schemaDef$descriptio, _schemaDef, _schemaDef$descriptio2, _schemaDef2, _options$assumeValid; + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + // Collect the type definitions and extensions found in the document. const typeDefs = []; - const scalarExtensions = new _AccumulatorMap.AccumulatorMap(); - const objectExtensions = new _AccumulatorMap.AccumulatorMap(); - const interfaceExtensions = new _AccumulatorMap.AccumulatorMap(); - const unionExtensions = new _AccumulatorMap.AccumulatorMap(); - const enumExtensions = new _AccumulatorMap.AccumulatorMap(); - const inputObjectExtensions = new _AccumulatorMap.AccumulatorMap(); - // New directives and types are separate because a directives and types can + const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can // have the same name. For example, a type named "skip". + const directiveDefs = []; - let schemaDef; - // Schema extensions are collected which may add additional operation types. + let schemaDef; // Schema extensions are collected which may add additional operation types. + const schemaExtensions = []; - let isSchemaChanged = false; for (const def of documentAST.definitions) { - switch (def.kind) { - case _kinds.Kind.SCHEMA_DEFINITION: - schemaDef = def; - break; - case _kinds.Kind.SCHEMA_EXTENSION: - schemaExtensions.push(def); - break; - case _kinds.Kind.DIRECTIVE_DEFINITION: - directiveDefs.push(def); - break; - // Type Definitions - case _kinds.Kind.SCALAR_TYPE_DEFINITION: - case _kinds.Kind.OBJECT_TYPE_DEFINITION: - case _kinds.Kind.INTERFACE_TYPE_DEFINITION: - case _kinds.Kind.UNION_TYPE_DEFINITION: - case _kinds.Kind.ENUM_TYPE_DEFINITION: - case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: - typeDefs.push(def); - break; - // Type System Extensions - case _kinds.Kind.SCALAR_TYPE_EXTENSION: - scalarExtensions.add(def.name.value, def); - break; - case _kinds.Kind.OBJECT_TYPE_EXTENSION: - objectExtensions.add(def.name.value, def); - break; - case _kinds.Kind.INTERFACE_TYPE_EXTENSION: - interfaceExtensions.add(def.name.value, def); - break; - case _kinds.Kind.UNION_TYPE_EXTENSION: - unionExtensions.add(def.name.value, def); - break; - case _kinds.Kind.ENUM_TYPE_EXTENSION: - enumExtensions.add(def.name.value, def); - break; - case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: - inputObjectExtensions.add(def.name.value, def); - break; - default: - continue; + if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if ((0, _predicates.isTypeDefinitionNode)(def)) { + typeDefs.push(def); + } else if ((0, _predicates.isTypeExtensionNode)(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions ? existingTypeExtensions.concat([def]) : [def]; + } else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); } - isSchemaChanged = true; - } - // If this document contains no new types, extensions, or directives then + } // If this document contains no new types, extensions, or directives then // return the same unmodified GraphQLSchema instance. - if (!isSchemaChanged) { + + if (Object.keys(typeExtensionsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExtensions.length === 0 && schemaDef == null) { return schemaConfig; } - const typeMap = new Map(schemaConfig.types.map(type => [type.name, extendNamedType(type)])); + const typeMap = Object.create(null); + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } for (const typeNode of typeDefs) { - var _stdTypeMap$get; + var _stdTypeMap$name; const name = typeNode.name.value; - typeMap.set(name, (_stdTypeMap$get = stdTypeMap.get(name)) !== null && _stdTypeMap$get !== void 0 ? _stdTypeMap$get : buildType(typeNode)); + typeMap[name] = (_stdTypeMap$name = stdTypeMap[name]) !== null && _stdTypeMap$name !== void 0 ? _stdTypeMap$name : buildType(typeNode); } const operationTypes = { // Get the extended root operation types. @@ -35923,20 +35146,20 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { // Then, incorporate schema definition and all schema extensions. ...(schemaDef && getOperationTypes([schemaDef])), ...getOperationTypes(schemaExtensions) - }; - // Then produce and return a Schema config with these types. + }; // Then produce and return a Schema config with these types. + return { - description: (_schemaDef$descriptio = (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio2 = _schemaDef.description) === null || _schemaDef$descriptio2 === void 0 ? void 0 : _schemaDef$descriptio2.value) !== null && _schemaDef$descriptio !== void 0 ? _schemaDef$descriptio : schemaConfig.description, + description: (_schemaDef = schemaDef) === null || _schemaDef === void 0 ? void 0 : (_schemaDef$descriptio = _schemaDef.description) === null || _schemaDef$descriptio === void 0 ? void 0 : _schemaDef$descriptio.value, ...operationTypes, - types: Array.from(typeMap.values()), + types: Object.values(typeMap), directives: [...schemaConfig.directives.map(replaceDirective), ...directiveDefs.map(buildDirective)], - extensions: schemaConfig.extensions, + extensions: Object.create(null), astNode: (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 ? _schemaDef2 : schemaConfig.astNode, extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), assumeValid: (_options$assumeValid = options === null || options === void 0 ? void 0 : options.assumeValid) !== null && _options$assumeValid !== void 0 ? _options$assumeValid : false - }; - // Below are functions used for producing this schema that have closed over + }; // Below are functions used for producing this schema that have closed over // this scope and have access to the schema, cache, and newly defined types. + function replaceType(type) { if ((0, _definition.isListType)(type)) { // @ts-expect-error @@ -35945,21 +35168,17 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { if ((0, _definition.isNonNullType)(type)) { // @ts-expect-error return new _definition.GraphQLNonNull(replaceType(type.ofType)); - } - // @ts-expect-error FIXME + } // @ts-expect-error FIXME + return replaceNamedType(type); } function replaceNamedType(type) { // Note: While this could make early assertions to get the correctly // typed values, that would throw immediately while type system // validation with validateSchema() will produce more actionable results. - return typeMap.get(type.name); + return typeMap[type.name]; } function replaceDirective(directive) { - if ((0, _directives.isSpecifiedDirective)(directive)) { - // Builtin directives are not extended. - return directive; - } const config = directive.toConfig(); return new _directives.GraphQLDirective({ ...config, @@ -35991,12 +35210,13 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } /* c8 ignore next 3 */ // Not reachable, all possible type definition nodes have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected type: ' + (0, _inspect.inspect)(type)); } function extendInputObjectType(type) { - var _inputObjectExtension; + var _typeExtensionsMap$co; const config = type.toConfig(); - const extensions = (_inputObjectExtension = inputObjectExtensions.get(config.name)) !== null && _inputObjectExtension !== void 0 ? _inputObjectExtension : []; + const extensions = (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co !== void 0 ? _typeExtensionsMap$co : []; return new _definition.GraphQLInputObjectType({ ...config, fields: () => ({ @@ -36010,9 +35230,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { }); } function extendEnumType(type) { - var _enumExtensions$get; + var _typeExtensionsMap$ty; const config = type.toConfig(); - const extensions = (_enumExtensions$get = enumExtensions.get(type.name)) !== null && _enumExtensions$get !== void 0 ? _enumExtensions$get : []; + const extensions = (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && _typeExtensionsMap$ty !== void 0 ? _typeExtensionsMap$ty : []; return new _definition.GraphQLEnumType({ ...config, values: { @@ -36023,9 +35243,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { }); } function extendScalarType(type) { - var _scalarExtensions$get; + var _typeExtensionsMap$co2; const config = type.toConfig(); - const extensions = (_scalarExtensions$get = scalarExtensions.get(config.name)) !== null && _scalarExtensions$get !== void 0 ? _scalarExtensions$get : []; + const extensions = (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co2 !== void 0 ? _typeExtensionsMap$co2 : []; let specifiedByURL = config.specifiedByURL; for (const extensionNode of extensions) { var _getSpecifiedByURL; @@ -36038,9 +35258,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { }); } function extendObjectType(type) { - var _objectExtensions$get; + var _typeExtensionsMap$co3; const config = type.toConfig(); - const extensions = (_objectExtensions$get = objectExtensions.get(config.name)) !== null && _objectExtensions$get !== void 0 ? _objectExtensions$get : []; + const extensions = (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co3 !== void 0 ? _typeExtensionsMap$co3 : []; return new _definition.GraphQLObjectType({ ...config, interfaces: () => [...type.getInterfaces().map(replaceNamedType), ...buildInterfaces(extensions)], @@ -36052,9 +35272,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { }); } function extendInterfaceType(type) { - var _interfaceExtensions$; + var _typeExtensionsMap$co4; const config = type.toConfig(); - const extensions = (_interfaceExtensions$ = interfaceExtensions.get(config.name)) !== null && _interfaceExtensions$ !== void 0 ? _interfaceExtensions$ : []; + const extensions = (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co4 !== void 0 ? _typeExtensionsMap$co4 : []; return new _definition.GraphQLInterfaceType({ ...config, interfaces: () => [...type.getInterfaces().map(replaceNamedType), ...buildInterfaces(extensions)], @@ -36066,9 +35286,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { }); } function extendUnionType(type) { - var _unionExtensions$get; + var _typeExtensionsMap$co5; const config = type.toConfig(); - const extensions = (_unionExtensions$get = unionExtensions.get(config.name)) !== null && _unionExtensions$get !== void 0 ? _unionExtensions$get : []; + const extensions = (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && _typeExtensionsMap$co5 !== void 0 ? _typeExtensionsMap$co5 : []; return new _definition.GraphQLUnionType({ ...config, types: () => [...type.getTypes().map(replaceNamedType), ...buildUnionTypes(extensions)], @@ -36092,8 +35312,10 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { const opTypes = {}; for (const node of nodes) { var _node$operationTypes; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 - const operationTypesNodes = /* c8 ignore next */(_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; + const operationTypesNodes = /* c8 ignore next */ + (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; for (const operationType of operationTypesNodes) { // Note: While this could make early assertions to get the correctly // typed values below, that would throw immediately while type system @@ -36105,9 +35327,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { return opTypes; } function getNamedType(node) { - var _stdTypeMap$get2; + var _stdTypeMap$name2; const name = node.name.value; - const type = (_stdTypeMap$get2 = stdTypeMap.get(name)) !== null && _stdTypeMap$get2 !== void 0 ? _stdTypeMap$get2 : typeMap.get(name); + const type = (_stdTypeMap$name2 = stdTypeMap[name]) !== null && _stdTypeMap$name2 !== void 0 ? _stdTypeMap$name2 : typeMap[name]; if (type === undefined) { throw new Error(`Unknown type: "${name}".`); } @@ -36140,8 +35362,10 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { const fieldConfigMap = Object.create(null); for (const node of nodes) { var _node$fields; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 - const nodeFields = /* c8 ignore next */(_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; + const nodeFields = /* c8 ignore next */ + (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; for (const field of nodeFields) { var _field$description; fieldConfigMap[field.name.value] = { @@ -36160,10 +35384,12 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } function buildArgumentMap(args) { // FIXME: https://github.com/graphql/graphql-js/issues/2203 - const argsNodes = /* c8 ignore next */args !== null && args !== void 0 ? args : []; + const argsNodes = /* c8 ignore next */ + args !== null && args !== void 0 ? args : []; const argConfigMap = Object.create(null); for (const arg of argsNodes) { var _arg$description; + // Note: While this could make assertions to get the correctly typed // value, that would throw immediately while type system validation // with validateSchema() will produce more actionable results. @@ -36182,10 +35408,13 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { const inputFieldMap = Object.create(null); for (const node of nodes) { var _node$fields2; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 - const fieldsNodes = /* c8 ignore next */(_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : []; + const fieldsNodes = /* c8 ignore next */ + (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 ? _node$fields2 : []; for (const field of fieldsNodes) { var _field$description2; + // Note: While this could make assertions to get the correctly typed // value, that would throw immediately while type system validation // with validateSchema() will produce more actionable results. @@ -36205,8 +35434,10 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { const enumValueMap = Object.create(null); for (const node of nodes) { var _node$values; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 - const valuesNodes = /* c8 ignore next */(_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; + const valuesNodes = /* c8 ignore next */ + (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; for (const value of valuesNodes) { var _value$description; enumValueMap[value.name.value] = { @@ -36227,7 +35458,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { // FIXME: https://github.com/graphql/graphql-js/issues/2203 node => { var _node$interfaces$map, _node$interfaces; - return /* c8 ignore next */(_node$interfaces$map = (_node$interfaces = node.interfaces) === null || _node$interfaces === void 0 ? void 0 : _node$interfaces.map(getNamedType)) !== null && _node$interfaces$map !== void 0 ? _node$interfaces$map : []; + return /* c8 ignore next */( + (_node$interfaces$map = (_node$interfaces = node.interfaces) === null || _node$interfaces === void 0 ? void 0 : _node$interfaces.map(getNamedType)) !== null && _node$interfaces$map !== void 0 ? _node$interfaces$map : [] + ); }); } function buildUnionTypes(nodes) { @@ -36239,16 +35472,19 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { // FIXME: https://github.com/graphql/graphql-js/issues/2203 node => { var _node$types$map, _node$types; - return /* c8 ignore next */(_node$types$map = (_node$types = node.types) === null || _node$types === void 0 ? void 0 : _node$types.map(getNamedType)) !== null && _node$types$map !== void 0 ? _node$types$map : []; + return /* c8 ignore next */( + (_node$types$map = (_node$types = node.types) === null || _node$types === void 0 ? void 0 : _node$types.map(getNamedType)) !== null && _node$types$map !== void 0 ? _node$types$map : [] + ); }); } function buildType(astNode) { + var _typeExtensionsMap$na; const name = astNode.name.value; + const extensionASTNodes = (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && _typeExtensionsMap$na !== void 0 ? _typeExtensionsMap$na : []; switch (astNode.kind) { case _kinds.Kind.OBJECT_TYPE_DEFINITION: { - var _objectExtensions$get2, _astNode$description; - const extensionASTNodes = (_objectExtensions$get2 = objectExtensions.get(name)) !== null && _objectExtensions$get2 !== void 0 ? _objectExtensions$get2 : []; + var _astNode$description; const allNodes = [astNode, ...extensionASTNodes]; return new _definition.GraphQLObjectType({ name, @@ -36261,8 +35497,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } case _kinds.Kind.INTERFACE_TYPE_DEFINITION: { - var _interfaceExtensions$2, _astNode$description2; - const extensionASTNodes = (_interfaceExtensions$2 = interfaceExtensions.get(name)) !== null && _interfaceExtensions$2 !== void 0 ? _interfaceExtensions$2 : []; + var _astNode$description2; const allNodes = [astNode, ...extensionASTNodes]; return new _definition.GraphQLInterfaceType({ name, @@ -36275,8 +35510,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } case _kinds.Kind.ENUM_TYPE_DEFINITION: { - var _enumExtensions$get2, _astNode$description3; - const extensionASTNodes = (_enumExtensions$get2 = enumExtensions.get(name)) !== null && _enumExtensions$get2 !== void 0 ? _enumExtensions$get2 : []; + var _astNode$description3; const allNodes = [astNode, ...extensionASTNodes]; return new _definition.GraphQLEnumType({ name, @@ -36288,8 +35522,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } case _kinds.Kind.UNION_TYPE_DEFINITION: { - var _unionExtensions$get2, _astNode$description4; - const extensionASTNodes = (_unionExtensions$get2 = unionExtensions.get(name)) !== null && _unionExtensions$get2 !== void 0 ? _unionExtensions$get2 : []; + var _astNode$description4; const allNodes = [astNode, ...extensionASTNodes]; return new _definition.GraphQLUnionType({ name, @@ -36301,8 +35534,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } case _kinds.Kind.SCALAR_TYPE_DEFINITION: { - var _scalarExtensions$get2, _astNode$description5; - const extensionASTNodes = (_scalarExtensions$get2 = scalarExtensions.get(name)) !== null && _scalarExtensions$get2 !== void 0 ? _scalarExtensions$get2 : []; + var _astNode$description5; return new _definition.GraphQLScalarType({ name, description: (_astNode$description5 = astNode.description) === null || _astNode$description5 === void 0 ? void 0 : _astNode$description5.value, @@ -36313,8 +35545,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: { - var _inputObjectExtension2, _astNode$description6; - const extensionASTNodes = (_inputObjectExtension2 = inputObjectExtensions.get(name)) !== null && _inputObjectExtension2 !== void 0 ? _inputObjectExtension2 : []; + var _astNode$description6; const allNodes = [astNode, ...extensionASTNodes]; return new _definition.GraphQLInputObjectType({ name, @@ -36328,27 +35559,30 @@ function extendSchemaImpl(schemaConfig, documentAST, options) { } } } -const stdTypeMap = new Map([..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes].map(type => [type.name, type])); +const stdTypeMap = (0, _keyMap.keyMap)([..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes], type => type.name); /** * Given a field or enum value node, returns the string value for the * deprecation reason. */ + function getDeprecationReason(node) { - const deprecated = (0, _values.getDirectiveValues)(_directives.GraphQLDeprecatedDirective, node); - // @ts-expect-error validated by `getDirectiveValues` + const deprecated = (0, _values.getDirectiveValues)(_directives.GraphQLDeprecatedDirective, node); // @ts-expect-error validated by `getDirectiveValues` + return deprecated === null || deprecated === void 0 ? void 0 : deprecated.reason; } /** * Given a scalar node, returns the string value for the specifiedByURL. */ + function getSpecifiedByURL(node) { - const specifiedBy = (0, _values.getDirectiveValues)(_directives.GraphQLSpecifiedByDirective, node); - // @ts-expect-error validated by `getDirectiveValues` + const specifiedBy = (0, _values.getDirectiveValues)(_directives.GraphQLSpecifiedByDirective, node); // @ts-expect-error validated by `getDirectiveValues` + return specifiedBy === null || specifiedBy === void 0 ? void 0 : specifiedBy.url; } /** * Given an input object node, returns if the node should be OneOf. */ + function isOneOf(node) { return Boolean((0, _values.getDirectiveValues)(_directives.GraphQLOneOfDirective, node)); } @@ -36417,6 +35651,7 @@ function findBreakingChanges(oldSchema, newSchema) { * Given two schemas, returns an Array containing descriptions of all the types * of potentially dangerous changes covered by the other functions down below. */ + function findDangerousChanges(oldSchema, newSchema) { // @ts-expect-error return findSchemaChanges(oldSchema, newSchema).filter(change => change.type in DangerousChangeType); @@ -36685,8 +35920,8 @@ function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { // moving from non-null to nullable of the same underlying type is safe !(0, _definition.isNonNullType)(newType) && isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType) ); - } - // if they're both named types, see if their names are equivalent + } // if they're both named types, see if their names are equivalent + return (0, _definition.isNamedType)(newType) && oldType.name === newType.name; } function typeKindName(type) { @@ -36710,6 +35945,7 @@ function typeKindName(type) { } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected type: ' + (0, _inspect.inspect)(type)); } function stringifyValue(value, type) { @@ -36912,6 +36148,7 @@ var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_mod * name. If a name is not provided, an operation is only returned if only one is * provided in the document. */ + function getOperationAST(documentAST, operationName) { let operation = null; for (const definition of documentAST.definitions) { @@ -36935,6 +36172,59 @@ function getOperationAST(documentAST, operationName) { /***/ }), +/***/ "../../../node_modules/graphql/utilities/getOperationRootType.mjs": +/*!************************************************************************!*\ + !*** ../../../node_modules/graphql/utilities/getOperationRootType.mjs ***! + \************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getOperationRootType = getOperationRootType; +var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + if (!queryType) { + throw new _GraphQLError.GraphQLError('Schema does not define the required query root type.', { + nodes: operation + }); + } + return queryType; + } + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + if (!mutationType) { + throw new _GraphQLError.GraphQLError('Schema is not configured for mutations.', { + nodes: operation + }); + } + return mutationType; + } + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + if (!subscriptionType) { + throw new _GraphQLError.GraphQLError('Schema is not configured for subscriptions.', { + nodes: operation + }); + } + return subscriptionType; + } + throw new _GraphQLError.GraphQLError('Can only have query, mutation and subscription operations.', { + nodes: operation + }); +} + +/***/ }), + /***/ "../../../node_modules/graphql/utilities/index.mjs": /*!*********************************************************!*\ !*** ../../../node_modules/graphql/utilities/index.mjs ***! @@ -36964,6 +36254,12 @@ Object.defineProperty(exports, "TypeInfo", ({ return _TypeInfo.TypeInfo; } })); +Object.defineProperty(exports, "assertValidName", ({ + enumerable: true, + get: function () { + return _assertValidName.assertValidName; + } +})); Object.defineProperty(exports, "astFromValue", ({ enumerable: true, get: function () { @@ -37036,6 +36332,12 @@ Object.defineProperty(exports, "getOperationAST", ({ return _getOperationAST.getOperationAST; } })); +Object.defineProperty(exports, "getOperationRootType", ({ + enumerable: true, + get: function () { + return _getOperationRootType.getOperationRootType; + } +})); Object.defineProperty(exports, "introspectionFromSchema", ({ enumerable: true, get: function () { @@ -37054,18 +36356,18 @@ Object.defineProperty(exports, "isTypeSubTypeOf", ({ return _typeComparators.isTypeSubTypeOf; } })); +Object.defineProperty(exports, "isValidNameError", ({ + enumerable: true, + get: function () { + return _assertValidName.isValidNameError; + } +})); Object.defineProperty(exports, "lexicographicSortSchema", ({ enumerable: true, get: function () { return _lexicographicSortSchema.lexicographicSortSchema; } })); -Object.defineProperty(exports, "printDirective", ({ - enumerable: true, - get: function () { - return _printSchema.printDirective; - } -})); Object.defineProperty(exports, "printIntrospectionSchema", ({ enumerable: true, get: function () { @@ -37122,6 +36424,7 @@ Object.defineProperty(exports, "visitWithTypeInfo", ({ })); var _getIntrospectionQuery = __webpack_require__(/*! ./getIntrospectionQuery.mjs */ "../../../node_modules/graphql/utilities/getIntrospectionQuery.mjs"); var _getOperationAST = __webpack_require__(/*! ./getOperationAST.mjs */ "../../../node_modules/graphql/utilities/getOperationAST.mjs"); +var _getOperationRootType = __webpack_require__(/*! ./getOperationRootType.mjs */ "../../../node_modules/graphql/utilities/getOperationRootType.mjs"); var _introspectionFromSchema = __webpack_require__(/*! ./introspectionFromSchema.mjs */ "../../../node_modules/graphql/utilities/introspectionFromSchema.mjs"); var _buildClientSchema = __webpack_require__(/*! ./buildClientSchema.mjs */ "../../../node_modules/graphql/utilities/buildClientSchema.mjs"); var _buildASTSchema = __webpack_require__(/*! ./buildASTSchema.mjs */ "../../../node_modules/graphql/utilities/buildASTSchema.mjs"); @@ -37138,6 +36441,7 @@ var _concatAST = __webpack_require__(/*! ./concatAST.mjs */ "../../../node_modul var _separateOperations = __webpack_require__(/*! ./separateOperations.mjs */ "../../../node_modules/graphql/utilities/separateOperations.mjs"); var _stripIgnoredCharacters = __webpack_require__(/*! ./stripIgnoredCharacters.mjs */ "../../../node_modules/graphql/utilities/stripIgnoredCharacters.mjs"); var _typeComparators = __webpack_require__(/*! ./typeComparators.mjs */ "../../../node_modules/graphql/utilities/typeComparators.mjs"); +var _assertValidName = __webpack_require__(/*! ./assertValidName.mjs */ "../../../node_modules/graphql/utilities/assertValidName.mjs"); var _findBreakingChanges = __webpack_require__(/*! ./findBreakingChanges.mjs */ "../../../node_modules/graphql/utilities/findBreakingChanges.mjs"); /***/ }), @@ -37167,6 +36471,7 @@ var _getIntrospectionQuery = __webpack_require__(/*! ./getIntrospectionQuery.mjs * This is the inverse of buildClientSchema. The primary use case is outside * of the server context, for instance when doing schema comparisons. */ + function introspectionFromSchema(schema, options) { const optionsWithDefaults = { specifiedByUrl: true, @@ -37181,7 +36486,7 @@ function introspectionFromSchema(schema, options) { schema, document }); - result.errors == null && result.data != null || (0, _invariant.invariant)(false); + !result.errors && result.data || (0, _invariant.invariant)(false); return result.data; } @@ -37201,6 +36506,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.lexicographicSortSchema = lexicographicSortSchema; var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); +var _keyValMap = __webpack_require__(/*! ../jsutils/keyValMap.mjs */ "../../../node_modules/graphql/jsutils/keyValMap.mjs"); var _naturalCompare = __webpack_require__(/*! ../jsutils/naturalCompare.mjs */ "../../../node_modules/graphql/jsutils/naturalCompare.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); var _directives = __webpack_require__(/*! ../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); @@ -37211,12 +36517,13 @@ var _schema = __webpack_require__(/*! ../type/schema.mjs */ "../../../node_modul * * This function returns a sorted copy of the given GraphQLSchema. */ + function lexicographicSortSchema(schema) { const schemaConfig = schema.toConfig(); - const typeMap = new Map(sortByName(schemaConfig.types).map(type => [type.name, sortNamedType(type)])); + const typeMap = (0, _keyValMap.keyValMap)(sortByName(schemaConfig.types), type => type.name, sortNamedType); return new _schema.GraphQLSchema({ ...schemaConfig, - types: Array.from(typeMap.values()), + types: Object.values(typeMap), directives: sortByName(schemaConfig.directives).map(sortDirective), query: replaceMaybeType(schemaConfig.query), mutation: replaceMaybeType(schemaConfig.mutation), @@ -37229,12 +36536,12 @@ function lexicographicSortSchema(schema) { } else if ((0, _definition.isNonNullType)(type)) { // @ts-expect-error return new _definition.GraphQLNonNull(replaceType(type.ofType)); - } - // @ts-expect-error FIXME: TS Conversion + } // @ts-expect-error FIXME: TS Conversion + return replaceNamedType(type); } function replaceNamedType(type) { - return typeMap.get(type.name); + return typeMap[type.name]; } function replaceMaybeType(maybeType) { return maybeType && replaceNamedType(maybeType); @@ -37312,6 +36619,7 @@ function lexicographicSortSchema(schema) { } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected type: ' + (0, _inspect.inspect)(type)); } } @@ -37346,7 +36654,6 @@ function sortBy(array, mapToKey) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.printDirective = printDirective; exports.printIntrospectionSchema = printIntrospectionSchema; exports.printSchema = printSchema; exports.printType = printType; @@ -37375,19 +36682,23 @@ function printFilteredSchema(schema, directiveFilter, typeFilter) { return [printSchemaDefinition(schema), ...directives.map(directive => printDirective(directive)), ...types.map(type => printType(type))].filter(Boolean).join('\n\n'); } function printSchemaDefinition(schema) { - const queryType = schema.getQueryType(); - const mutationType = schema.getMutationType(); - const subscriptionType = schema.getSubscriptionType(); - // Special case: When a schema has no root operation types, no valid schema - // definition can be printed. - if (!queryType && !mutationType && !subscriptionType) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { return; } - // Only print a schema definition if there is a description or if it should - // not be omitted because of having default type names. - if (schema.description != null || !hasDefaultRootOperationTypes(schema)) { - return printDescription(schema) + 'schema {\n' + (queryType ? ` query: ${queryType.name}\n` : '') + (mutationType ? ` mutation: ${mutationType.name}\n` : '') + (subscriptionType ? ` subscription: ${subscriptionType.name}\n` : '') + '}'; + const operationTypes = []; + const queryType = schema.getQueryType(); + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); } + const mutationType = schema.getMutationType(); + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; } /** * GraphQL schema define root types for each type of operation. These types are @@ -37402,16 +36713,23 @@ function printSchemaDefinition(schema) { * } * ``` * - * When using this naming convention, the schema description can be omitted so - * long as these names are only used for operation types. - * - * Note however that if any of these default names are used elsewhere in the - * schema but not as a root operation type, the schema definition must still - * be printed to avoid ambiguity. + * When using this naming convention, the schema description can be omitted. */ -function hasDefaultRootOperationTypes(schema) { - /* eslint-disable eqeqeq */ - return schema.getQueryType() == schema.getType('Query') && schema.getMutationType() == schema.getType('Mutation') && schema.getSubscriptionType() == schema.getType('Subscription'); + +function isSchemaOfCommonNames(schema) { + const queryType = schema.getQueryType(); + if (queryType && queryType.name !== 'Query') { + return false; + } + const mutationType = schema.getMutationType(); + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + return true; } function printType(type) { if ((0, _definition.isScalarType)(type)) { @@ -37434,6 +36752,7 @@ function printType(type) { } /* c8 ignore next 3 */ // Not reachable, all possible types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected type: ' + (0, _inspect.inspect)(type)); } function printScalar(type) { @@ -37472,9 +36791,9 @@ function printBlock(items) { function printArgs(args, indentation = '') { if (args.length === 0) { return ''; - } - // If every arg does not have a description, print them on one line. - if (args.every(arg => arg.description == null)) { + } // If every arg does not have a description, print them on one line. + + if (args.every(arg => !arg.description)) { return '(' + args.map(printInputValue).join(', ') + ')'; } return '(\n' + args.map((arg, i) => printDescription(arg, ' ' + indentation, !i) + ' ' + indentation + printInputValue(arg)).join('\n') + '\n' + indentation + ')'; @@ -37526,7 +36845,7 @@ function printDescription(def, indentation = '', firstInBlock = true) { block: (0, _blockString.isPrintableAsBlockString)(description) }); const prefix = indentation && !firstInBlock ? '\n' + indentation : indentation; - return prefix + blockString.replaceAll('\n', '\n' + indentation) + '\n'; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; } /***/ }), @@ -37551,10 +36870,11 @@ var _visitor = __webpack_require__(/*! ../language/visitor.mjs */ "../../../node * which contains a single operation as well the fragment definitions it * refers to. */ + function separateOperations(documentAST) { const operations = []; - const depGraph = Object.create(null); - // Populate metadata and build a dependency graph. + const depGraph = Object.create(null); // Populate metadata and build a dependency graph. + for (const definitionNode of documentAST.definitions) { switch (definitionNode.kind) { case _kinds.Kind.OPERATION_DEFINITION: @@ -37563,22 +36883,21 @@ function separateOperations(documentAST) { case _kinds.Kind.FRAGMENT_DEFINITION: depGraph[definitionNode.name.value] = collectDependencies(definitionNode.selectionSet); break; - default: - // ignore non-executable definitions + default: // ignore non-executable definitions } - } - // For each operation, produce a new synthesized AST which includes only what + } // For each operation, produce a new synthesized AST which includes only what // is necessary for completing that operation. + const separatedDocumentASTs = Object.create(null); for (const operation of operations) { const dependencies = new Set(); for (const fragmentName of collectDependencies(operation.selectionSet)) { collectTransitiveDependencies(dependencies, depGraph, fragmentName); - } - // Provides the empty string for anonymous operations. - const operationName = operation.name ? operation.name.value : ''; - // The list of definition nodes to be included for this operation, sorted + } // Provides the empty string for anonymous operations. + + const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted // to retain the same order as the original document. + separatedDocumentASTs[operationName] = { kind: _kinds.Kind.DOCUMENT, definitions: documentAST.definitions.filter(node => node === operation || node.kind === _kinds.Kind.FRAGMENT_DEFINITION && dependencies.has(node.name.value)) @@ -37586,6 +36905,7 @@ function separateOperations(documentAST) { } return separatedDocumentASTs; } + // From a dependency graph, collects a list of transitive dependencies by // recursing through a dependency graph. function collectTransitiveDependencies(collected, depGraph, fromName) { @@ -37632,6 +36952,7 @@ var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_mod * * @internal */ + function sortValueNode(valueNode) { switch (valueNode.kind) { case _kinds.Kind.OBJECT: @@ -37739,6 +37060,7 @@ var _tokenKind = __webpack_require__(/*! ../language/tokenKind.mjs */ "../../../ * """Type description""" type Foo{"""Field description""" bar:String} * ``` */ + function stripIgnoredCharacters(source) { const sourceObj = (0, _source.isSource)(source) ? source : new _source.Source(source); const body = sourceObj.body; @@ -37753,6 +37075,7 @@ function stripIgnoredCharacters(source) { * Also prevent case of non-punctuator token following by spread resulting * in invalid token (e.g. `1...` is invalid Float token). */ + const isNonPunctuator = !(0, _lexer.isPunctuatorTokenKind)(currentToken.kind); if (wasLastAddedTokenNonPunctuator) { if (isNonPunctuator || currentToken.kind === _tokenKind.TokenKind.SPREAD) { @@ -37796,28 +37119,29 @@ function isEqualType(typeA, typeB) { // Equivalent types are equal. if (typeA === typeB) { return true; - } - // If either type is non-null, the other must also be non-null. + } // If either type is non-null, the other must also be non-null. + if ((0, _definition.isNonNullType)(typeA) && (0, _definition.isNonNullType)(typeB)) { return isEqualType(typeA.ofType, typeB.ofType); - } - // If either type is a list, the other must also be a list. + } // If either type is a list, the other must also be a list. + if ((0, _definition.isListType)(typeA) && (0, _definition.isListType)(typeB)) { return isEqualType(typeA.ofType, typeB.ofType); - } - // Otherwise the types are not equal. + } // Otherwise the types are not equal. + return false; } /** * Provided a type and a super type, return true if the first type is either * equal or a subset of the second super type (covariant). */ + function isTypeSubTypeOf(schema, maybeSubType, superType) { // Equivalent type is a valid subtype if (maybeSubType === superType) { return true; - } - // If superType is non-null, maybeSubType must also be non-null. + } // If superType is non-null, maybeSubType must also be non-null. + if ((0, _definition.isNonNullType)(superType)) { if ((0, _definition.isNonNullType)(maybeSubType)) { return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); @@ -37827,8 +37151,8 @@ function isTypeSubTypeOf(schema, maybeSubType, superType) { if ((0, _definition.isNonNullType)(maybeSubType)) { // If superType is nullable, maybeSubType may be non-null or nullable. return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); - } - // If superType type is a list, maybeSubType type must also be a list. + } // If superType type is a list, maybeSubType type must also be a list. + if ((0, _definition.isListType)(superType)) { if ((0, _definition.isListType)(maybeSubType)) { return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); @@ -37838,9 +37162,9 @@ function isTypeSubTypeOf(schema, maybeSubType, superType) { if ((0, _definition.isListType)(maybeSubType)) { // If superType is not a list, maybeSubType must also be not a list. return false; - } - // If superType type is an abstract type, check if it is super type of maybeSubType. + } // If superType type is an abstract type, check if it is super type of maybeSubType. // Otherwise, the child type is not a valid subtype of the parent type. + return (0, _definition.isAbstractType)(superType) && ((0, _definition.isInterfaceType)(maybeSubType) || (0, _definition.isObjectType)(maybeSubType)) && schema.isSubType(superType, maybeSubType); } /** @@ -37852,6 +37176,7 @@ function isTypeSubTypeOf(schema, maybeSubType, superType) { * * This function is commutative. */ + function doTypesOverlap(schema, typeA, typeB) { // Equivalent types overlap if (typeA === typeB) { @@ -37862,15 +37187,15 @@ function doTypesOverlap(schema, typeA, typeB) { // If both types are abstract, then determine if there is any intersection // between possible concrete types of each. return schema.getPossibleTypes(typeA).some(type => schema.isSubType(typeB, type)); - } - // Determine if the latter type is a possible concrete type of the former. + } // Determine if the latter type is a possible concrete type of the former. + return schema.isSubType(typeA, typeB); } if ((0, _definition.isAbstractType)(typeB)) { // Determine if the former type is a possible concrete type of the latter. return schema.isSubType(typeB, typeA); - } - // Otherwise the types do not overlap. + } // Otherwise the types do not overlap. + return false; } @@ -37923,6 +37248,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.valueFromAST = valueFromAST; var _inspect = __webpack_require__(/*! ../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); var _invariant = __webpack_require__(/*! ../jsutils/invariant.mjs */ "../../../node_modules/graphql/jsutils/invariant.mjs"); +var _keyMap = __webpack_require__(/*! ../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); /** @@ -37945,6 +37271,7 @@ var _definition = __webpack_require__(/*! ../type/definition.mjs */ "../../../no * | NullValue | null | * */ + function valueFromAST(valueNode, type, variables) { if (!valueNode) { // When there is no node, then there is also no value. @@ -37960,10 +37287,10 @@ function valueFromAST(valueNode, type, variables) { const variableValue = variables[variableName]; if (variableValue === null && (0, _definition.isNonNullType)(type)) { return; // Invalid: intentionally return no value. - } - // Note: This does no further checking that this variable is correct. + } // Note: This does no further checking that this variable is correct. // This assumes that this query has been validated and the variable // usage here is of the correct type. + return variableValue; } if ((0, _definition.isNonNullType)(type)) { @@ -38009,10 +37336,10 @@ function valueFromAST(valueNode, type, variables) { return; // Invalid: intentionally return no value. } const coercedObj = Object.create(null); - const fieldNodes = new Map(valueNode.fields.map(field => [field.name.value, field])); + const fieldNodes = (0, _keyMap.keyMap)(valueNode.fields, field => field.name.value); for (const field of Object.values(type.getFields())) { - const fieldNode = fieldNodes.get(field.name); - if (fieldNode == null || isMissingVariable(fieldNode.value, variables)) { + const fieldNode = fieldNodes[field.name]; + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { if (field.defaultValue !== undefined) { coercedObj[field.name] = field.defaultValue; } else if ((0, _definition.isNonNullType)(field.type)) { @@ -38054,10 +37381,11 @@ function valueFromAST(valueNode, type, variables) { } /* c8 ignore next 3 */ // Not reachable, all possible input types have been considered. + false || (0, _invariant.invariant)(false, 'Unexpected input type: ' + (0, _inspect.inspect)(type)); -} -// Returns true if the provided valueNode is a variable which is not defined +} // Returns true if the provided valueNode is a variable which is not defined // in the set of variables. + function isMissingVariable(valueNode, variables) { return valueNode.kind === _kinds.Kind.VARIABLE && (variables == null || variables[valueNode.name.value] === undefined); } @@ -38094,6 +37422,7 @@ var _kinds = __webpack_require__(/*! ../language/kinds.mjs */ "../../../node_mod * | Null | null | * */ + function valueFromASTUntyped(valueNode, variables) { switch (valueNode.kind) { case _kinds.Kind.NULL: @@ -38192,14 +37521,14 @@ class ASTValidationContext { let fragments = this._recursivelyReferencedFragments.get(operation); if (!fragments) { fragments = []; - const collectedNames = new Set(); + const collectedNames = Object.create(null); const nodesToVisit = [operation.selectionSet]; let node; while (node = nodesToVisit.pop()) { for (const spread of this.getFragmentSpreads(node)) { const fragName = spread.name.value; - if (!collectedNames.has(fragName)) { - collectedNames.add(fragName); + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; const fragment = this.getFragment(fragName); if (fragment) { fragments.push(fragment); @@ -38312,24 +37641,6 @@ exports.ValidationContext = ValidationContext; Object.defineProperty(exports, "__esModule", ({ value: true })); -Object.defineProperty(exports, "DeferStreamDirectiveLabelRule", ({ - enumerable: true, - get: function () { - return _DeferStreamDirectiveLabelRule.DeferStreamDirectiveLabelRule; - } -})); -Object.defineProperty(exports, "DeferStreamDirectiveOnRootFieldRule", ({ - enumerable: true, - get: function () { - return _DeferStreamDirectiveOnRootFieldRule.DeferStreamDirectiveOnRootFieldRule; - } -})); -Object.defineProperty(exports, "DeferStreamDirectiveOnValidOperationsRule", ({ - enumerable: true, - get: function () { - return _DeferStreamDirectiveOnValidOperationsRule.DeferStreamDirectiveOnValidOperationsRule; - } -})); Object.defineProperty(exports, "ExecutableDefinitionsRule", ({ enumerable: true, get: function () { @@ -38462,12 +37773,6 @@ Object.defineProperty(exports, "SingleFieldSubscriptionsRule", ({ return _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule; } })); -Object.defineProperty(exports, "StreamDirectiveOnListFieldRule", ({ - enumerable: true, - get: function () { - return _StreamDirectiveOnListFieldRule.StreamDirectiveOnListFieldRule; - } -})); Object.defineProperty(exports, "UniqueArgumentDefinitionNamesRule", ({ enumerable: true, get: function () { @@ -38585,9 +37890,6 @@ Object.defineProperty(exports, "validate", ({ var _validate = __webpack_require__(/*! ./validate.mjs */ "../../../node_modules/graphql/validation/validate.mjs"); var _ValidationContext = __webpack_require__(/*! ./ValidationContext.mjs */ "../../../node_modules/graphql/validation/ValidationContext.mjs"); var _specifiedRules = __webpack_require__(/*! ./specifiedRules.mjs */ "../../../node_modules/graphql/validation/specifiedRules.mjs"); -var _DeferStreamDirectiveLabelRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveLabelRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveLabelRule.mjs"); -var _DeferStreamDirectiveOnRootFieldRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveOnRootFieldRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs"); -var _DeferStreamDirectiveOnValidOperationsRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveOnValidOperationsRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs"); var _ExecutableDefinitionsRule = __webpack_require__(/*! ./rules/ExecutableDefinitionsRule.mjs */ "../../../node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs"); var _FieldsOnCorrectTypeRule = __webpack_require__(/*! ./rules/FieldsOnCorrectTypeRule.mjs */ "../../../node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs"); var _FragmentsOnCompositeTypesRule = __webpack_require__(/*! ./rules/FragmentsOnCompositeTypesRule.mjs */ "../../../node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs"); @@ -38605,7 +37907,6 @@ var _PossibleFragmentSpreadsRule = __webpack_require__(/*! ./rules/PossibleFragm var _ProvidedRequiredArgumentsRule = __webpack_require__(/*! ./rules/ProvidedRequiredArgumentsRule.mjs */ "../../../node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs"); var _ScalarLeafsRule = __webpack_require__(/*! ./rules/ScalarLeafsRule.mjs */ "../../../node_modules/graphql/validation/rules/ScalarLeafsRule.mjs"); var _SingleFieldSubscriptionsRule = __webpack_require__(/*! ./rules/SingleFieldSubscriptionsRule.mjs */ "../../../node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs"); -var _StreamDirectiveOnListFieldRule = __webpack_require__(/*! ./rules/StreamDirectiveOnListFieldRule.mjs */ "../../../node_modules/graphql/validation/rules/StreamDirectiveOnListFieldRule.mjs"); var _UniqueArgumentNamesRule = __webpack_require__(/*! ./rules/UniqueArgumentNamesRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs"); var _UniqueDirectivesPerLocationRule = __webpack_require__(/*! ./rules/UniqueDirectivesPerLocationRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs"); var _UniqueFragmentNamesRule = __webpack_require__(/*! ./rules/UniqueFragmentNamesRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs"); @@ -38629,182 +37930,6 @@ var _NoSchemaIntrospectionCustomRule = __webpack_require__(/*! ./rules/custom/No /***/ }), -/***/ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveLabelRule.mjs": -/*!****************************************************************************************!*\ - !*** ../../../node_modules/graphql/validation/rules/DeferStreamDirectiveLabelRule.mjs ***! - \****************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.DeferStreamDirectiveLabelRule = DeferStreamDirectiveLabelRule; -var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); -var _kinds = __webpack_require__(/*! ../../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); -var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); -/** - * Defer and stream directive labels are unique - * - * A GraphQL document is only valid if defer and stream directives' label argument is static and unique. - */ -function DeferStreamDirectiveLabelRule(context) { - const knownLabels = new Map(); - return { - Directive(node) { - if (node.name.value === _directives.GraphQLDeferDirective.name || node.name.value === _directives.GraphQLStreamDirective.name) { - var _node$arguments; - const labelArgument = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments.find(arg => arg.name.value === 'label'); - const labelValue = labelArgument === null || labelArgument === void 0 ? void 0 : labelArgument.value; - if (!labelValue) { - return; - } - if (labelValue.kind !== _kinds.Kind.STRING) { - context.reportError(new _GraphQLError.GraphQLError(`Directive "${node.name.value}"'s label argument must be a static string.`, { - nodes: node - })); - return; - } - const knownLabel = knownLabels.get(labelValue.value); - if (knownLabel != null) { - context.reportError(new _GraphQLError.GraphQLError('Defer/Stream directive label argument must be unique.', { - nodes: [knownLabel, node] - })); - } else { - knownLabels.set(labelValue.value, node); - } - } - } - }; -} - -/***/ }), - -/***/ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs": -/*!**********************************************************************************************!*\ - !*** ../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.DeferStreamDirectiveOnRootFieldRule = DeferStreamDirectiveOnRootFieldRule; -var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); -var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); -/** - * Defer and stream directives are used on valid root field - * - * A GraphQL document is only valid if defer directives are not used on root mutation or subscription types. - */ -function DeferStreamDirectiveOnRootFieldRule(context) { - return { - Directive(node) { - const mutationType = context.getSchema().getMutationType(); - const subscriptionType = context.getSchema().getSubscriptionType(); - const parentType = context.getParentType(); - if (parentType && node.name.value === _directives.GraphQLDeferDirective.name) { - if (mutationType && parentType === mutationType) { - context.reportError(new _GraphQLError.GraphQLError(`Defer directive cannot be used on root mutation type "${parentType.name}".`, { - nodes: node - })); - } - if (subscriptionType && parentType === subscriptionType) { - context.reportError(new _GraphQLError.GraphQLError(`Defer directive cannot be used on root subscription type "${parentType.name}".`, { - nodes: node - })); - } - } - if (parentType && node.name.value === _directives.GraphQLStreamDirective.name) { - if (mutationType && parentType === mutationType) { - context.reportError(new _GraphQLError.GraphQLError(`Stream directive cannot be used on root mutation type "${parentType.name}".`, { - nodes: node - })); - } - if (subscriptionType && parentType === subscriptionType) { - context.reportError(new _GraphQLError.GraphQLError(`Stream directive cannot be used on root subscription type "${parentType.name}".`, { - nodes: node - })); - } - } - } - }; -} - -/***/ }), - -/***/ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs": -/*!****************************************************************************************************!*\ - !*** ../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs ***! - \****************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.DeferStreamDirectiveOnValidOperationsRule = DeferStreamDirectiveOnValidOperationsRule; -var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); -var _ast = __webpack_require__(/*! ../../language/ast.mjs */ "../../../node_modules/graphql/language/ast.mjs"); -var _kinds = __webpack_require__(/*! ../../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); -var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); -function ifArgumentCanBeFalse(node) { - var _node$arguments; - const ifArgument = (_node$arguments = node.arguments) === null || _node$arguments === void 0 ? void 0 : _node$arguments.find(arg => arg.name.value === 'if'); - if (!ifArgument) { - return false; - } - if (ifArgument.value.kind === _kinds.Kind.BOOLEAN) { - if (ifArgument.value.value) { - return false; - } - } else if (ifArgument.value.kind !== _kinds.Kind.VARIABLE) { - return false; - } - return true; -} -/** - * Defer And Stream Directives Are Used On Valid Operations - * - * A GraphQL document is only valid if defer directives are not used on root mutation or subscription types. - */ -function DeferStreamDirectiveOnValidOperationsRule(context) { - const fragmentsUsedOnSubscriptions = new Set(); - return { - OperationDefinition(operation) { - if (operation.operation === _ast.OperationTypeNode.SUBSCRIPTION) { - for (const fragment of context.getRecursivelyReferencedFragments(operation)) { - fragmentsUsedOnSubscriptions.add(fragment.name.value); - } - } - }, - Directive(node, _key, _parent, _path, ancestors) { - const definitionNode = ancestors[2]; - if ('kind' in definitionNode && (definitionNode.kind === _kinds.Kind.FRAGMENT_DEFINITION && fragmentsUsedOnSubscriptions.has(definitionNode.name.value) || definitionNode.kind === _kinds.Kind.OPERATION_DEFINITION && definitionNode.operation === _ast.OperationTypeNode.SUBSCRIPTION)) { - if (node.name.value === _directives.GraphQLDeferDirective.name) { - if (!ifArgumentCanBeFalse(node)) { - context.reportError(new _GraphQLError.GraphQLError('Defer directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.', { - nodes: node - })); - } - } else if (node.name.value === _directives.GraphQLStreamDirective.name) { - if (!ifArgumentCanBeFalse(node)) { - context.reportError(new _GraphQLError.GraphQLError('Stream directive not supported on subscription operations. Disable `@stream` by setting the `if` argument to `false`.', { - nodes: node - })); - } - } - } - } - }; -} - -/***/ }), - /***/ "../../../node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs": /*!************************************************************************************!*\ !*** ../../../node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs ***! @@ -38880,14 +38005,14 @@ function FieldsOnCorrectTypeRule(context) { if (!fieldDef) { // This field doesn't exist, lets look for suggestions. const schema = context.getSchema(); - const fieldName = node.name.value; - // First determine if there are any suggested types to condition on. - let suggestion = (0, _didYouMean.didYouMean)('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); - // If there are no suggested types, then perhaps this was a typo? + const fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + let suggestion = (0, _didYouMean.didYouMean)('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? + if (suggestion === '') { suggestion = (0, _didYouMean.didYouMean)(getSuggestedFieldNames(type, fieldName)); - } - // Report an error, including helpful suggestions. + } // Report an error, including helpful suggestions. + context.reportError(new _GraphQLError.GraphQLError(`Cannot query field "${fieldName}" on type "${type.name}".` + suggestion, { nodes: node })); @@ -38901,6 +38026,7 @@ function FieldsOnCorrectTypeRule(context) { * they implement. If any of those types include the provided field, suggest them, * sorted by how often the type is referenced. */ + function getSuggestedTypeNames(schema, type, fieldName) { if (!(0, _definition.isAbstractType)(type)) { // Must be an Object type, which does not have possible fields. @@ -38909,18 +38035,18 @@ function getSuggestedTypeNames(schema, type, fieldName) { const suggestedTypes = new Set(); const usageCount = Object.create(null); for (const possibleType of schema.getPossibleTypes(type)) { - if (possibleType.getFields()[fieldName] == null) { + if (!possibleType.getFields()[fieldName]) { continue; - } - // This object type defines this field. + } // This object type defines this field. + suggestedTypes.add(possibleType); usageCount[possibleType.name] = 1; for (const possibleInterface of possibleType.getInterfaces()) { var _usageCount$possibleI; - if (possibleInterface.getFields()[fieldName] == null) { + if (!possibleInterface.getFields()[fieldName]) { continue; - } - // This interface type defines this field. + } // This interface type defines this field. + suggestedTypes.add(possibleInterface); usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; } @@ -38930,8 +38056,8 @@ function getSuggestedTypeNames(schema, type, fieldName) { const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; if (usageCountDiff !== 0) { return usageCountDiff; - } - // Suggest super types first followed by subtypes + } // Suggest super types first followed by subtypes + if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) { return -1; } @@ -38945,12 +38071,13 @@ function getSuggestedTypeNames(schema, type, fieldName) { * For the field name provided, determine if there are any similar field names * that may be the result of a typo. */ + function getSuggestedFieldNames(type, fieldName) { if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { const possibleFieldNames = Object.keys(type.getFields()); return (0, _suggestionList.suggestionList)(fieldName, possibleFieldNames); - } - // Otherwise, must be a Union type, which does not define fields. + } // Otherwise, must be a Union type, which does not define fields. + return []; } @@ -39058,28 +38185,31 @@ function KnownArgumentNamesRule(context) { /** * @internal */ + function KnownArgumentNamesOnDirectivesRule(context) { - const directiveArgs = new Map(); + const directiveArgs = Object.create(null); const schema = context.getSchema(); const definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; for (const directive of definedDirectives) { - directiveArgs.set(directive.name, directive.args.map(arg => arg.name)); + directiveArgs[directive.name] = directive.args.map(arg => arg.name); } const astDefinitions = context.getDocument().definitions; for (const def of astDefinitions) { if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { var _def$arguments; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs.set(def.name.value, argsNodes.map(arg => arg.name.value)); + directiveArgs[def.name.value] = argsNodes.map(arg => arg.name.value); } } return { Directive(directiveNode) { const directiveName = directiveNode.name.value; - const knownArgs = directiveArgs.get(directiveName); - if (directiveNode.arguments != null && knownArgs != null) { + const knownArgs = directiveArgs[directiveName]; + if (directiveNode.arguments && knownArgs) { for (const argNode of directiveNode.arguments) { const argName = argNode.name.value; if (!knownArgs.includes(argName)) { @@ -39125,30 +38255,30 @@ var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../.. * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined */ function KnownDirectivesRule(context) { - const locationsMap = new Map(); + const locationsMap = Object.create(null); const schema = context.getSchema(); const definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; for (const directive of definedDirectives) { - locationsMap.set(directive.name, directive.locations); + locationsMap[directive.name] = directive.locations; } const astDefinitions = context.getDocument().definitions; for (const def of astDefinitions) { if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - locationsMap.set(def.name.value, def.locations.map(name => name.value)); + locationsMap[def.name.value] = def.locations.map(name => name.value); } } return { Directive(node, _key, _parent, _path, ancestors) { const name = node.name.value; - const locations = locationsMap.get(name); - if (locations == null) { + const locations = locationsMap[name]; + if (!locations) { context.reportError(new _GraphQLError.GraphQLError(`Unknown directive "@${name}".`, { nodes: node })); return; } const candidateLocation = getDirectiveLocationForASTPath(ancestors); - if (candidateLocation != null && !locations.includes(candidateLocation)) { + if (candidateLocation && !locations.includes(candidateLocation)) { context.reportError(new _GraphQLError.GraphQLError(`Directive "@${name}" may not be used on ${candidateLocation}.`, { nodes: node })); @@ -39157,8 +38287,8 @@ function KnownDirectivesRule(context) { }; } function getDirectiveLocationForASTPath(ancestors) { - const appliedTo = ancestors.at(-1); - appliedTo != null && 'kind' in appliedTo || (0, _invariant.invariant)(false); + const appliedTo = ancestors[ancestors.length - 1]; + 'kind' in appliedTo || (0, _invariant.invariant)(false); switch (appliedTo.kind) { case _kinds.Kind.OPERATION_DEFINITION: return getDirectiveLocationForOperation(appliedTo.operation); @@ -39199,12 +38329,14 @@ function getDirectiveLocationForASTPath(ancestors) { return _directiveLocation.DirectiveLocation.INPUT_OBJECT; case _kinds.Kind.INPUT_VALUE_DEFINITION: { - const parentNode = ancestors.at(-3); - parentNode != null && 'kind' in parentNode || (0, _invariant.invariant)(false); + const parentNode = ancestors[ancestors.length - 3]; + 'kind' in parentNode || (0, _invariant.invariant)(false); return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; } // Not reachable, all possible types have been considered. - /* c8 ignore next 2 */ + + /* c8 ignore next */ + default: false || (0, _invariant.invariant)(false, 'Unexpected kind: ' + (0, _inspect.inspect)(appliedTo.kind)); } @@ -39286,23 +38418,26 @@ var _scalars = __webpack_require__(/*! ../../type/scalars.mjs */ "../../../node_ * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence */ function KnownTypeNamesRule(context) { - var _context$getSchema$ge, _context$getSchema; - const { - definitions - } = context.getDocument(); - const existingTypesMap = (_context$getSchema$ge = (_context$getSchema = context.getSchema()) === null || _context$getSchema === void 0 ? void 0 : _context$getSchema.getTypeMap()) !== null && _context$getSchema$ge !== void 0 ? _context$getSchema$ge : {}; - const typeNames = new Set([...Object.keys(existingTypesMap), ...definitions.filter(_predicates.isTypeDefinitionNode).map(def => def.name.value)]); + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + const definedTypes = Object.create(null); + for (const def of context.getDocument().definitions) { + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = true; + } + } + const typeNames = [...Object.keys(existingTypesMap), ...Object.keys(definedTypes)]; return { NamedType(node, _1, parent, _2, ancestors) { const typeName = node.name.value; - if (!typeNames.has(typeName)) { + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { var _ancestors$; const definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; const isSDL = definitionNode != null && isSDLNode(definitionNode); - if (isSDL && standardTypeNames.has(typeName)) { + if (isSDL && standardTypeNames.includes(typeName)) { return; } - const suggestedTypes = (0, _suggestionList.suggestionList)(typeName, isSDL ? [...standardTypeNames, ...typeNames] : [...typeNames]); + const suggestedTypes = (0, _suggestionList.suggestionList)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); context.reportError(new _GraphQLError.GraphQLError(`Unknown type "${typeName}".` + (0, _didYouMean.didYouMean)(suggestedTypes), { nodes: node })); @@ -39310,7 +38445,7 @@ function KnownTypeNamesRule(context) { } }; } -const standardTypeNames = new Set([..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes].map(type => type.name)); +const standardTypeNames = [..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes].map(type => type.name); function isSDLNode(value) { return 'kind' in value && ((0, _predicates.isTypeSystemDefinitionNode)(value) || (0, _predicates.isTypeSystemExtensionNode)(value)); } @@ -39429,14 +38564,14 @@ function MaxIntrospectionDepthRule(context) { } const fragment = context.getFragment(fragmentName); if (!fragment) { - // Missing fragments checks are handled by the `KnownFragmentNamesRule`. + // Missing fragments checks are handled by `KnownFragmentNamesRule`. return false; - } - // Rather than following an immutable programming pattern which has + } // Rather than following an immutable programming pattern which has // significant memory and garbage collection overhead, we've opted to // take a mutable approach for efficiency's sake. Importantly visiting a // fragment twice is fine, so long as you don't do one visit inside the // other. + try { visitedFragments[fragmentName] = true; return checkDepth(fragment, visitedFragments, depth); @@ -39446,15 +38581,14 @@ function MaxIntrospectionDepthRule(context) { } if (node.kind === _kinds.Kind.FIELD && ( // check all introspection lists - // TODO: instead of relying on field names, check whether the type is a list node.name.value === 'fields' || node.name.value === 'interfaces' || node.name.value === 'possibleTypes' || node.name.value === 'inputFields')) { // eslint-disable-next-line no-param-reassign depth++; if (depth >= MAX_LISTS_DEPTH) { return true; } - } - // handles fields and inline fragments + } // handles fields and inline fragments + if ('selectionSet' in node && node.selectionSet) { for (const child of node.selectionSet.selections) { if (checkDepth(child, visitedFragments, depth)) { @@ -39504,10 +38638,10 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ function NoFragmentCyclesRule(context) { // Tracks already visited fragments to maintain O(N) and to ensure that cycles // are not redundantly reported. - const visitedFrags = new Set(); - // Array of AST nodes used to produce meaningful errors - const spreadPath = []; - // Position in the spread path + const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + const spreadPath = []; // Position in the spread path + const spreadPathIndexByName = Object.create(null); return { OperationDefinition: () => false, @@ -39515,16 +38649,16 @@ function NoFragmentCyclesRule(context) { detectCycleRecursive(node); return false; } - }; - // This does a straight-forward DFS to find cycles. + }; // This does a straight-forward DFS to find cycles. // It does not terminate when a cycle was found but continues to explore // the graph to find all possible cycles. + function detectCycleRecursive(fragment) { - if (visitedFrags.has(fragment.name.value)) { + if (visitedFrags[fragment.name.value]) { return; } const fragmentName = fragment.name.value; - visitedFrags.add(fragmentName); + visitedFrags[fragmentName] = true; const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); if (spreadNodes.length === 0) { return; @@ -39576,21 +38710,28 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined */ function NoUndefinedVariablesRule(context) { + let variableNameDefined = Object.create(null); return { - OperationDefinition(operation) { - var _operation$variableDe; - const variableNameDefined = new Set((_operation$variableDe = operation.variableDefinitions) === null || _operation$variableDe === void 0 ? void 0 : _operation$variableDe.map(node => node.variable.name.value)); - const usages = context.getRecursiveVariableUsages(operation); - for (const { - node - } of usages) { - const varName = node.name.value; - if (!variableNameDefined.has(varName)) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` : `Variable "$${varName}" is not defined.`, { - nodes: [node, operation] - })); + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + for (const { + node + } of usages) { + const varName = node.name.value; + if (variableNameDefined[varName] !== true) { + context.reportError(new _GraphQLError.GraphQLError(operation.name ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` : `Variable "$${varName}" is not defined.`, { + nodes: [node, operation] + })); + } } } + }, + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; } }; } @@ -39619,13 +38760,11 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used */ function NoUnusedFragmentsRule(context) { - const fragmentNameUsed = new Set(); + const operationDefs = []; const fragmentDefs = []; return { - OperationDefinition(operation) { - for (const fragment of context.getRecursivelyReferencedFragments(operation)) { - fragmentNameUsed.add(fragment.name.value); - } + OperationDefinition(node) { + operationDefs.push(node); return false; }, FragmentDefinition(node) { @@ -39634,9 +38773,15 @@ function NoUnusedFragmentsRule(context) { }, Document: { leave() { + const fragmentNameUsed = Object.create(null); + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments(operation)) { + fragmentNameUsed[fragment.name.value] = true; + } + } for (const fragmentDef of fragmentDefs) { const fragName = fragmentDef.name.value; - if (!fragmentNameUsed.has(fragName)) { + if (fragmentNameUsed[fragName] !== true) { context.reportError(new _GraphQLError.GraphQLError(`Fragment "${fragName}" is never used.`, { nodes: fragmentDef })); @@ -39671,24 +38816,32 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * See https://spec.graphql.org/draft/#sec-All-Variables-Used */ function NoUnusedVariablesRule(context) { + let variableDefs = []; return { - OperationDefinition(operation) { - var _operation$variableDe; - const usages = context.getRecursiveVariableUsages(operation); - const variableNameUsed = new Set(usages.map(({ - node - }) => node.name.value)); - // FIXME: https://github.com/graphql/graphql-js/issues/2203 - /* c8 ignore next */ - const variableDefinitions = (_operation$variableDe = operation.variableDefinitions) !== null && _operation$variableDe !== void 0 ? _operation$variableDe : []; - for (const variableDef of variableDefinitions) { - const variableName = variableDef.variable.name.value; - if (!variableNameUsed.has(variableName)) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` : `Variable "$${variableName}" is never used.`, { - nodes: variableDef - })); + OperationDefinition: { + enter() { + variableDefs = []; + }, + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + for (const { + node + } of usages) { + variableNameUsed[node.name.value] = true; + } + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + if (variableNameUsed[variableName] !== true) { + context.reportError(new _GraphQLError.GraphQLError(operation.name ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` : `Variable "$${variableName}" is never used.`, { + nodes: variableDef + })); + } } } + }, + VariableDefinition(def) { + variableDefs.push(def); } }; } @@ -39714,9 +38867,6 @@ var _printer = __webpack_require__(/*! ../../language/printer.mjs */ "../../../n var _definition = __webpack_require__(/*! ../../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); var _sortValueNode = __webpack_require__(/*! ../../utilities/sortValueNode.mjs */ "../../../node_modules/graphql/utilities/sortValueNode.mjs"); var _typeFromAST = __webpack_require__(/*! ../../utilities/typeFromAST.mjs */ "../../../node_modules/graphql/utilities/typeFromAST.mjs"); -/* eslint-disable max-params */ -// This file contains a lot of such errors but we plan to refactor it anyway -// so just disable it for entire file. function reasonMessage(reason) { if (Array.isArray(reason)) { return reason.map(([responseName, subReason]) => `subfields "${responseName}" conflict because ` + reasonMessage(subReason)).join(' and '); @@ -39732,14 +38882,15 @@ function reasonMessage(reason) { * * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging */ + function OverlappingFieldsCanBeMergedRule(context) { // A memoization for when two fragments are compared "between" each other for // conflicts. Two fragments may be compared many times, so memoizing this can // dramatically improve the performance of this validator. - const comparedFragmentPairs = new PairSet(); - // A cache for the "field map" and list of fragment names found in any given + const comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given // selection set. Selection sets may be asked for this information multiple // times, so this improves the performance of this validator. + const cachedFieldsAndFragmentNames = new Map(); return { SelectionSet(selectionSet) { @@ -39753,6 +38904,7 @@ function OverlappingFieldsCanBeMergedRule(context) { } }; } + /** * Algorithm: * @@ -39812,43 +38964,43 @@ function OverlappingFieldsCanBeMergedRule(context) { // GraphQL Document. function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { const conflicts = []; - const [fieldMap, fragmentNames] = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet); - // (A) Find find all conflicts "within" the fields of this selection set. + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet); // (A) Find find all conflicts "within" the fields of this selection set. // Note: this is the *only place* `collectConflictsWithin` is called. + collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); if (fragmentNames.length !== 0) { // (B) Then collect conflicts between these fields and those represented by // each spread fragment name found. for (let i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); - // (C) Then compare this fragment with all other fragments found in this + collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this // selection set to collect conflicts between fragments spread together. // This compares each item in the list of fragment names to every other // item in that same list (except for itself). + for (let j = i + 1; j < fragmentNames.length; j++) { collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); } } } return conflicts; -} -// Collect all conflicts found between a set of fields and a fragment reference +} // Collect all conflicts found between a set of fields and a fragment reference // including via spreading in any nested fragments. + function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { const fragment = context.getFragment(fragmentName); if (!fragment) { return; } - const [fieldMap2, referencedFragmentNames] = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment); - // Do not compare a fragment's fieldMap to itself. + const [fieldMap2, referencedFragmentNames] = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment); // Do not compare a fragment's fieldMap to itself. + if (fieldMap === fieldMap2) { return; - } - // (D) First collect any conflicts between the provided collection of fields + } // (D) First collect any conflicts between the provided collection of fields // and the collection of fields represented by the given fragment. - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); - // (E) Then collect any conflicts between the provided collection of fields + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields // and any fragment names found in the given fragment. + for (const referencedFragmentName of referencedFragmentNames) { // Memoize so two fragments are not compared for conflicts more than once. if (comparedFragmentPairs.has(referencedFragmentName, fragmentName, areMutuallyExclusive)) { @@ -39857,15 +39009,15 @@ function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFiel comparedFragmentPairs.add(referencedFragmentName, fragmentName, areMutuallyExclusive); collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, referencedFragmentName); } -} -// Collect all conflicts found between two fragments, including via spreading in +} // Collect all conflicts found between two fragments, including via spreading in // any nested fragments. + function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { // No need to compare a fragment to itself. if (fragmentName1 === fragmentName2) { return; - } - // Memoize so two fragments are not compared for conflicts more than once. + } // Memoize so two fragments are not compared for conflicts more than once. + if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { return; } @@ -39876,57 +39028,57 @@ function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFra return; } const [fieldMap1, referencedFragmentNames1] = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1); - const [fieldMap2, referencedFragmentNames2] = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2); - // (F) First, collect all conflicts between these two collections of fields + const [fieldMap2, referencedFragmentNames2] = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2); // (F) First, collect all conflicts between these two collections of fields // (not including any nested fragments). - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); - // (G) Then collect conflicts between the first fragment and any nested + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested // fragments spread in the second fragment. + for (const referencedFragmentName2 of referencedFragmentNames2) { collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, referencedFragmentName2); - } - // (G) Then collect conflicts between the second fragment and any nested + } // (G) Then collect conflicts between the second fragment and any nested // fragments spread in the first fragment. + for (const referencedFragmentName1 of referencedFragmentNames1) { collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, referencedFragmentName1, fragmentName2); } -} -// Find all conflicts found between two selection sets, including those found +} // Find all conflicts found between two selection sets, including those found // via spreading in fragments. Called when determining if conflicts exist // between the sub-fields of two overlapping fields. + function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { const conflicts = []; const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1); - const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2); - // (H) First, collect all conflicts between these two collections of field. - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); - // (I) Then collect conflicts between the first collection of fields and + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2); // (H) First, collect all conflicts between these two collections of field. + + collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and // those referenced by each fragment name associated with the second. + for (const fragmentName2 of fragmentNames2) { collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentName2); - } - // (I) Then collect conflicts between the second collection of fields and + } // (I) Then collect conflicts between the second collection of fields and // those referenced by each fragment name associated with the first. + for (const fragmentName1 of fragmentNames1) { collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentName1); - } - // (J) Also collect conflicts between any fragment names by the first and + } // (J) Also collect conflicts between any fragment names by the first and // fragment names by the second. This compares each item in the first set of // names to each item in the second set of names. + for (const fragmentName1 of fragmentNames1) { for (const fragmentName2 of fragmentNames2) { collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2); } } return conflicts; -} -// Collect all Conflicts "within" one collection of fields. +} // Collect all Conflicts "within" one collection of fields. + function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { // A field map is a keyed collection, where each key represents a response // name and the value at that key is a list of all fields which provide that // response name. For every response name, if there are multiple fields, they // must be compared to find a potential conflict. - for (const [responseName, fields] of fieldMap.entries()) { + for (const [responseName, fields] of Object.entries(fieldMap)) { // This compares every field in the list to every other field in this list // (except to itself). If the list only has one item, nothing needs to // be compared. @@ -39943,21 +39095,21 @@ function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames } } } -} -// Collect all Conflicts between two collections of fields. This is similar to, +} // Collect all Conflicts between two collections of fields. This is similar to, // but different from the `collectConflictsWithin` function above. This check // assumes that `collectConflictsWithin` has already been called on each // provided collection of fields. This is true because this validator traverses // each individual selection set. + function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { // A field map is a keyed collection, where each key represents a response // name and the value at that key is a list of all fields which provide that // response name. For any response name which appears in both provided field // maps, each field from the first field map must be compared to every field // in the second field map to find potential conflicts. - for (const [responseName, fields1] of fieldMap1.entries()) { - const fields2 = fieldMap2.get(responseName); - if (fields2 != null) { + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + if (fields2) { for (const field1 of fields1) { for (const field2 of fields2) { const conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2); @@ -39968,14 +39120,12 @@ function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentName } } } -} -// Determines if there is a conflict between two particular fields, including +} // Determines if there is a conflict between two particular fields, including // comparing their sub-fields. + function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - var _node1$directives, _node2$directives; const [parentType1, node1, def1] = field1; - const [parentType2, node2, def2] = field2; - // If it is known that two fields could not possibly apply at the same + const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same // time, due to the parent types, then it is safe to permit them to diverge // in aliased field or arguments used as they will not present any ambiguity // by differing. @@ -39983,6 +39133,7 @@ function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPai // different Object types. Interface or Union types might overlap - if not // in the current state of the schema, then perhaps in some future version, // thus may not safely diverge. + const areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && (0, _definition.isObjectType)(parentType1) && (0, _definition.isObjectType)(parentType2); if (!areMutuallyExclusive) { // Two aliases must refer to the same field. @@ -39990,27 +39141,21 @@ function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPai const name2 = node2.name.value; if (name1 !== name2) { return [[responseName, `"${name1}" and "${name2}" are different fields`], [node1], [node2]]; - } - // Two field calls must have the same arguments. + } // Two field calls must have the same arguments. + if (!sameArguments(node1, node2)) { return [[responseName, 'they have differing arguments'], [node1], [node2]]; } - } - // FIXME https://github.com/graphql/graphql-js/issues/2203 - const directives1 = /* c8 ignore next */(_node1$directives = node1.directives) !== null && _node1$directives !== void 0 ? _node1$directives : []; - const directives2 = /* c8 ignore next */(_node2$directives = node2.directives) !== null && _node2$directives !== void 0 ? _node2$directives : []; - if (!sameStreams(directives1, directives2)) { - return [[responseName, 'they have differing stream directives'], [node1], [node2]]; - } - // The return type for each field. + } // The return type for each field. + const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; if (type1 && type2 && doTypesConflict(type1, type2)) { return [[responseName, `they return conflicting types "${(0, _inspect.inspect)(type1)}" and "${(0, _inspect.inspect)(type2)}"`], [node1], [node2]]; - } - // Collect and compare sub-fields. Use the same "visited fragment names" list + } // Collect and compare sub-fields. Use the same "visited fragment names" list // for both collections so fields in a fragment reference are never // compared to themselves. + const selectionSet1 = node1.selectionSet; const selectionSet2 = node2.selectionSet; if (selectionSet1 && selectionSet2) { @@ -40027,8 +39172,12 @@ function sameArguments(node1, node2) { if (args2 === undefined || args2.length === 0) { return false; } + /* c8 ignore next */ + if (args1.length !== args2.length) { + /* c8 ignore next */ return false; + /* c8 ignore next */ } const values2 = new Map(args2.map(({ name, @@ -40045,26 +39194,10 @@ function sameArguments(node1, node2) { } function stringifyValue(value) { return (0, _printer.print)((0, _sortValueNode.sortValueNode)(value)); -} -function getStreamDirective(directives) { - return directives.find(directive => directive.name.value === 'stream'); -} -function sameStreams(directives1, directives2) { - const stream1 = getStreamDirective(directives1); - const stream2 = getStreamDirective(directives2); - if (!stream1 && !stream2) { - // both fields do not have streams - return true; - } else if (stream1 && stream2) { - // check if both fields have equivalent streams - return sameArguments(stream1, stream2); - } - // fields have a mix of stream and no stream - return false; -} -// Two types conflict if both types could not apply to a value simultaneously. +} // Two types conflict if both types could not apply to a value simultaneously. // Composite types are ignored as their individual field types will be compared // later recursively. However List and Non-Null types must match. + function doTypesConflict(type1, type2) { if ((0, _definition.isListType)(type1)) { return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; @@ -40082,24 +39215,24 @@ function doTypesConflict(type1, type2) { return type1 !== type2; } return false; -} -// Given a selection set, return the collection of fields (a mapping of response +} // Given a selection set, return the collection of fields (a mapping of response // name to field nodes and definitions) as well as a list of fragment names // referenced via fragment spreads. + function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { const cached = cachedFieldsAndFragmentNames.get(selectionSet); if (cached) { return cached; } - const nodeAndDefs = new Map(); - const fragmentNames = new Set(); + const nodeAndDefs = Object.create(null); + const fragmentNames = Object.create(null); _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); - const result = [nodeAndDefs, [...fragmentNames]]; + const result = [nodeAndDefs, Object.keys(fragmentNames)]; cachedFieldsAndFragmentNames.set(selectionSet, result); return result; -} -// Given a reference to a fragment, return the represented collection of fields +} // Given a reference to a fragment, return the represented collection of fields // as well as a list of nested fragment names referenced via fragment spreads. + function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { // Short-circuit building a type from the node if possible. const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); @@ -40120,16 +39253,14 @@ function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeA fieldDef = parentType.getFields()[fieldName]; } const responseName = selection.alias ? selection.alias.value : fieldName; - let nodeAndDefsList = nodeAndDefs.get(responseName); - if (nodeAndDefsList == null) { - nodeAndDefsList = []; - nodeAndDefs.set(responseName, nodeAndDefsList); + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; } - nodeAndDefsList.push([parentType, selection, fieldDef]); + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); break; } case _kinds.Kind.FRAGMENT_SPREAD: - fragmentNames.add(selection.name.value); + fragmentNames[selection.name.value] = true; break; case _kinds.Kind.INLINE_FRAGMENT: { @@ -40140,9 +39271,9 @@ function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeA } } } -} -// Given a series of Conflicts which occurred between two sub-fields, generate +} // Given a series of Conflicts which occurred between two sub-fields, generate // a single Conflict. + function subfieldConflicts(conflicts, responseName, node1, node2) { if (conflicts.length > 0) { return [[responseName, conflicts.map(([reason]) => reason)], [node1, ...conflicts.map(([, fields1]) => fields1).flat()], [node2, ...conflicts.map(([,, fields2]) => fields2).flat()]]; @@ -40151,6 +39282,7 @@ function subfieldConflicts(conflicts, responseName, node1, node2) { /** * A way to keep track of pairs of things when the ordering of the pair does not matter. */ + class PairSet { constructor() { this._data = new Map(); @@ -40161,10 +39293,10 @@ class PairSet { const result = (_this$_data$get = this._data.get(key1)) === null || _this$_data$get === void 0 ? void 0 : _this$_data$get.get(key2); if (result === undefined) { return false; - } - // areMutuallyExclusive being false is a superset of being true, hence if + } // areMutuallyExclusive being false is a superset of being true, hence if // we want to know if this PairSet "has" these two with no exclusivity, // we have to ensure it was added as such. + return areMutuallyExclusive ? true : areMutuallyExclusive === result; } add(a, b, areMutuallyExclusive) { @@ -40270,10 +39402,10 @@ var _definition = __webpack_require__(/*! ../../type/definition.mjs */ "../../.. */ function PossibleTypeExtensionsRule(context) { const schema = context.getSchema(); - const definedTypes = new Map(); + const definedTypes = Object.create(null); for (const def of context.getDocument().definitions) { if ((0, _predicates.isTypeDefinitionNode)(def)) { - definedTypes.set(def.name.value, def); + definedTypes[def.name.value] = def; } } return { @@ -40286,15 +39418,15 @@ function PossibleTypeExtensionsRule(context) { }; function checkExtension(node) { const typeName = node.name.value; - const defNode = definedTypes.get(typeName); + const defNode = definedTypes[typeName]; const existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); let expectedKind; - if (defNode != null) { + if (defNode) { expectedKind = defKindToExtKind[defNode.kind]; } else if (existingType) { expectedKind = typeToExtKind(existingType); } - if (expectedKind != null) { + if (expectedKind) { if (expectedKind !== node.kind) { const kindStr = extensionKindToTypeName(node.kind); context.reportError(new _GraphQLError.GraphQLError(`Cannot extend non-${kindStr} type "${typeName}".`, { @@ -40302,8 +39434,10 @@ function PossibleTypeExtensionsRule(context) { })); } } else { - var _schema$getTypeMap; - const allTypeNames = [...definedTypes.keys(), ...Object.keys((_schema$getTypeMap = schema === null || schema === void 0 ? void 0 : schema.getTypeMap()) !== null && _schema$getTypeMap !== void 0 ? _schema$getTypeMap : {})]; + const allTypeNames = Object.keys({ + ...definedTypes, + ...(schema === null || schema === void 0 ? void 0 : schema.getTypeMap()) + }); const suggestedTypes = (0, _suggestionList.suggestionList)(typeName, allTypeNames); context.reportError(new _GraphQLError.GraphQLError(`Cannot extend type "${typeName}" because it is not defined.` + (0, _didYouMean.didYouMean)(suggestedTypes), { nodes: node.name @@ -40340,6 +39474,7 @@ function typeToExtKind(type) { } /* c8 ignore next 3 */ // Not reachable. All possible types have been considered + false || (0, _invariant.invariant)(false, 'Unexpected type: ' + (0, _inspect.inspect)(type)); } function extensionKindToTypeName(kind) { @@ -40357,7 +39492,9 @@ function extensionKindToTypeName(kind) { case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: return 'input object'; // Not reachable. All possible types have been considered - /* c8 ignore next 2 */ + + /* c8 ignore next */ + default: false || (0, _invariant.invariant)(false, 'Unexpected kind: ' + (0, _inspect.inspect)(kind)); } @@ -40379,6 +39516,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.ProvidedRequiredArgumentsOnDirectivesRule = ProvidedRequiredArgumentsOnDirectivesRule; exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; var _inspect = __webpack_require__(/*! ../../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); +var _keyMap = __webpack_require__(/*! ../../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _kinds = __webpack_require__(/*! ../../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _printer = __webpack_require__(/*! ../../language/printer.mjs */ "../../../node_modules/graphql/language/printer.mjs"); @@ -40402,7 +39540,8 @@ function ProvidedRequiredArgumentsRule(context) { if (!fieldDef) { return false; } - const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const providedArgs = new Set( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 /* c8 ignore next */ (_fieldNode$arguments = fieldNode.arguments) === null || _fieldNode$arguments === void 0 ? void 0 : _fieldNode$arguments.map(arg => arg.name.value)); for (const argDef of fieldDef.args) { @@ -40420,22 +39559,25 @@ function ProvidedRequiredArgumentsRule(context) { /** * @internal */ + function ProvidedRequiredArgumentsOnDirectivesRule(context) { var _schema$getDirectives; - const requiredArgsMap = new Map(); + const requiredArgsMap = Object.create(null); const schema = context.getSchema(); const definedDirectives = (_schema$getDirectives = schema === null || schema === void 0 ? void 0 : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 ? _schema$getDirectives : _directives.specifiedDirectives; for (const directive of definedDirectives) { - requiredArgsMap.set(directive.name, new Map(directive.args.filter(_definition.isRequiredArgument).map(arg => [arg.name, arg]))); + requiredArgsMap[directive.name] = (0, _keyMap.keyMap)(directive.args.filter(_definition.isRequiredArgument), arg => arg.name); } const astDefinitions = context.getDocument().definitions; for (const def of astDefinitions) { if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { var _def$arguments; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap.set(def.name.value, new Map(argNodes.filter(isRequiredArgumentNode).map(arg => [arg.name.value, arg]))); + requiredArgsMap[def.name.value] = (0, _keyMap.keyMap)(argNodes.filter(isRequiredArgumentNode), arg => arg.name.value); } } return { @@ -40443,14 +39585,16 @@ function ProvidedRequiredArgumentsOnDirectivesRule(context) { // Validate on leave to allow for deeper errors to appear first. leave(directiveNode) { const directiveName = directiveNode.name.value; - const requiredArgs = requiredArgsMap.get(directiveName); - if (requiredArgs != null) { + const requiredArgs = requiredArgsMap[directiveName]; + if (requiredArgs) { var _directiveNode$argume; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; const argNodeMap = new Set(argNodes.map(arg => arg.name.value)); - for (const [argName, argDef] of requiredArgs.entries()) { + for (const [argName, argDef] of Object.entries(requiredArgs)) { if (!argNodeMap.has(argName)) { const argType = (0, _definition.isType)(argDef.type) ? (0, _inspect.inspect)(argDef.type) : (0, _printer.print)(argDef.type); context.reportError(new _GraphQLError.GraphQLError(`Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, { @@ -40533,9 +39677,6 @@ exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _kinds = __webpack_require__(/*! ../../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); var _collectFields = __webpack_require__(/*! ../../execution/collectFields.mjs */ "../../../node_modules/graphql/execution/collectFields.mjs"); -function toNodes(fieldGroup) { - return fieldGroup.map(fieldDetails => fieldDetails.node); -} /** * Subscriptions must only include a non-introspection field. * @@ -40560,22 +39701,21 @@ function SingleFieldSubscriptionsRule(context) { fragments[definition.name.value] = definition; } } - const { - groupedFieldSet - } = (0, _collectFields.collectFields)(schema, fragments, variableValues, subscriptionType, node); - if (groupedFieldSet.size > 1) { - const fieldGroups = [...groupedFieldSet.values()]; - const extraFieldGroups = fieldGroups.slice(1); - const extraFieldSelections = extraFieldGroups.flatMap(fieldGroup => toNodes(fieldGroup)); + const fields = (0, _collectFields.collectFields)(schema, fragments, variableValues, subscriptionType, node.selectionSet); + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); context.reportError(new _GraphQLError.GraphQLError(operationName != null ? `Subscription "${operationName}" must select only one top level field.` : 'Anonymous Subscription must select only one top level field.', { nodes: extraFieldSelections })); } - for (const fieldGroup of groupedFieldSet.values()) { - const fieldName = toNodes(fieldGroup)[0].name.value; + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; if (fieldName.startsWith('__')) { context.reportError(new _GraphQLError.GraphQLError(operationName != null ? `Subscription "${operationName}" must not select an introspection top level field.` : 'Anonymous Subscription must not select an introspection top level field.', { - nodes: toNodes(fieldGroup) + nodes: fieldNodes })); } } @@ -40587,42 +39727,6 @@ function SingleFieldSubscriptionsRule(context) { /***/ }), -/***/ "../../../node_modules/graphql/validation/rules/StreamDirectiveOnListFieldRule.mjs": -/*!*****************************************************************************************!*\ - !*** ../../../node_modules/graphql/validation/rules/StreamDirectiveOnListFieldRule.mjs ***! - \*****************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.StreamDirectiveOnListFieldRule = StreamDirectiveOnListFieldRule; -var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); -var _definition = __webpack_require__(/*! ../../type/definition.mjs */ "../../../node_modules/graphql/type/definition.mjs"); -var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../../node_modules/graphql/type/directives.mjs"); -/** - * Stream directives are used on list fields - * - * A GraphQL document is only valid if stream directives are used on list fields. - */ -function StreamDirectiveOnListFieldRule(context) { - return { - Directive(node) { - const fieldDef = context.getFieldDef(); - const parentType = context.getParentType(); - if (fieldDef && parentType && node.name.value === _directives.GraphQLStreamDirective.name && !((0, _definition.isListType)(fieldDef.type) || (0, _definition.isWrappingType)(fieldDef.type) && (0, _definition.isListType)(fieldDef.type.ofType))) { - context.reportError(new _GraphQLError.GraphQLError(`Stream directive cannot be used on non-list field "${fieldDef.name}" on type "${parentType.name}".`, { - nodes: node - })); - } - } - }; -} - -/***/ }), - /***/ "../../../node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs": /*!********************************************************************************************!*\ !*** ../../../node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs ***! @@ -40647,7 +39751,9 @@ function UniqueArgumentDefinitionNamesRule(context) { return { DirectiveDefinition(directiveNode) { var _directiveNode$argume; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const argumentNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); @@ -40659,15 +39765,17 @@ function UniqueArgumentDefinitionNamesRule(context) { }; function checkArgUniquenessPerField(typeNode) { var _typeNode$fields; - const typeName = typeNode.name.value; - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const fieldNodes = (_typeNode$fields = typeNode.fields) !== null && _typeNode$fields !== void 0 ? _typeNode$fields : []; for (const fieldDef of fieldNodes) { var _fieldDef$arguments; - const fieldName = fieldDef.name.value; - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = (_fieldDef$arguments = fieldDef.arguments) !== null && _fieldDef$arguments !== void 0 ? _fieldDef$arguments : []; checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); } @@ -40717,7 +39825,9 @@ function UniqueArgumentNamesRule(context) { }; function checkArgUniqueness(parentNode) { var _parentNode$arguments; + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const argumentNodes = (_parentNode$arguments = parentNode.arguments) !== null && _parentNode$arguments !== void 0 ? _parentNode$arguments : []; const seenArgs = (0, _groupBy.groupBy)(argumentNodes, arg => arg.name.value); @@ -40752,7 +39862,7 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * A GraphQL document is only valid if all defined directives have unique names. */ function UniqueDirectiveNamesRule(context) { - const knownDirectiveNames = new Map(); + const knownDirectiveNames = Object.create(null); const schema = context.getSchema(); return { DirectiveDefinition(node) { @@ -40763,13 +39873,12 @@ function UniqueDirectiveNamesRule(context) { })); return; } - const knownName = knownDirectiveNames.get(directiveName); - if (knownName) { + if (knownDirectiveNames[directiveName]) { context.reportError(new _GraphQLError.GraphQLError(`There can be only one directive named "@${directiveName}".`, { - nodes: [knownName, node.name] + nodes: [knownDirectiveNames[directiveName], node.name] })); } else { - knownDirectiveNames.set(directiveName, node.name); + knownDirectiveNames[directiveName] = node.name; } return false; } @@ -40803,20 +39912,20 @@ var _directives = __webpack_require__(/*! ../../type/directives.mjs */ "../../.. * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location */ function UniqueDirectivesPerLocationRule(context) { - const uniqueDirectiveMap = new Map(); + const uniqueDirectiveMap = Object.create(null); const schema = context.getSchema(); const definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; for (const directive of definedDirectives) { - uniqueDirectiveMap.set(directive.name, !directive.isRepeatable); + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; } const astDefinitions = context.getDocument().definitions; for (const def of astDefinitions) { if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap.set(def.name.value, !def.repeatable); + uniqueDirectiveMap[def.name.value] = !def.repeatable; } } - const schemaDirectives = new Map(); - const typeDirectivesMap = new Map(); + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); return { // Many different AST nodes may contain directives. Rather than listing // them all, just listen for entering any node, and check to see if it @@ -40830,24 +39939,22 @@ function UniqueDirectivesPerLocationRule(context) { seenDirectives = schemaDirectives; } else if ((0, _predicates.isTypeDefinitionNode)(node) || (0, _predicates.isTypeExtensionNode)(node)) { const typeName = node.name.value; - seenDirectives = typeDirectivesMap.get(typeName); + seenDirectives = typeDirectivesMap[typeName]; if (seenDirectives === undefined) { - seenDirectives = new Map(); - typeDirectivesMap.set(typeName, seenDirectives); + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); } } else { - seenDirectives = new Map(); + seenDirectives = Object.create(null); } for (const directive of node.directives) { const directiveName = directive.name.value; - if (uniqueDirectiveMap.get(directiveName) === true) { - const seenDirective = seenDirectives.get(directiveName); - if (seenDirective != null) { + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { context.reportError(new _GraphQLError.GraphQLError(`The directive "@${directiveName}" can only be used once at this location.`, { - nodes: [seenDirective, directive] + nodes: [seenDirectives[directiveName], directive] })); } else { - seenDirectives.set(directiveName, directive); + seenDirectives[directiveName] = directive; } } } @@ -40879,7 +39986,7 @@ var _definition = __webpack_require__(/*! ../../type/definition.mjs */ "../../.. function UniqueEnumValueNamesRule(context) { const schema = context.getSchema(); const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownValueNames = new Map(); + const knownValueNames = Object.create(null); return { EnumTypeDefinition: checkValueUniqueness, EnumTypeExtension: checkValueUniqueness @@ -40887,14 +39994,14 @@ function UniqueEnumValueNamesRule(context) { function checkValueUniqueness(node) { var _node$values; const typeName = node.name.value; - let valueNames = knownValueNames.get(typeName); - if (valueNames == null) { - valueNames = new Map(); - knownValueNames.set(typeName, valueNames); - } - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; + const valueNames = knownValueNames[typeName]; for (const valueDef of valueNodes) { const valueName = valueDef.name.value; const existingType = existingTypeMap[typeName]; @@ -40902,15 +40009,12 @@ function UniqueEnumValueNamesRule(context) { context.reportError(new _GraphQLError.GraphQLError(`Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: valueDef.name })); - continue; - } - const knownValueName = valueNames.get(valueName); - if (knownValueName != null) { + } else if (valueNames[valueName]) { context.reportError(new _GraphQLError.GraphQLError(`Enum value "${typeName}.${valueName}" can only be defined once.`, { - nodes: [knownValueName, valueDef.name] + nodes: [valueNames[valueName], valueDef.name] })); } else { - valueNames.set(valueName, valueDef.name); + valueNames[valueName] = valueDef.name; } } return false; @@ -40941,7 +40045,7 @@ var _definition = __webpack_require__(/*! ../../type/definition.mjs */ "../../.. function UniqueFieldDefinitionNamesRule(context) { const schema = context.getSchema(); const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownFieldNames = new Map(); + const knownFieldNames = Object.create(null); return { InputObjectTypeDefinition: checkFieldUniqueness, InputObjectTypeExtension: checkFieldUniqueness, @@ -40953,29 +40057,26 @@ function UniqueFieldDefinitionNamesRule(context) { function checkFieldUniqueness(node) { var _node$fields; const typeName = node.name.value; - let fieldNames = knownFieldNames.get(typeName); - if (fieldNames == null) { - fieldNames = new Map(); - knownFieldNames.set(typeName, fieldNames); - } - // FIXME: https://github.com/graphql/graphql-js/issues/2203 + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; + const fieldNames = knownFieldNames[typeName]; for (const fieldDef of fieldNodes) { const fieldName = fieldDef.name.value; if (hasField(existingTypeMap[typeName], fieldName)) { context.reportError(new _GraphQLError.GraphQLError(`Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, { nodes: fieldDef.name })); - continue; - } - const knownFieldName = fieldNames.get(fieldName); - if (knownFieldName != null) { + } else if (fieldNames[fieldName]) { context.reportError(new _GraphQLError.GraphQLError(`Field "${typeName}.${fieldName}" can only be defined once.`, { - nodes: [knownFieldName, fieldDef.name] + nodes: [fieldNames[fieldName], fieldDef.name] })); } else { - fieldNames.set(fieldName, fieldDef.name); + fieldNames[fieldName] = fieldDef.name; } } return false; @@ -41011,18 +40112,17 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness */ function UniqueFragmentNamesRule(context) { - const knownFragmentNames = new Map(); + const knownFragmentNames = Object.create(null); return { OperationDefinition: () => false, FragmentDefinition(node) { const fragmentName = node.name.value; - const knownFragmentName = knownFragmentNames.get(fragmentName); - if (knownFragmentName != null) { + if (knownFragmentNames[fragmentName]) { context.reportError(new _GraphQLError.GraphQLError(`There can be only one fragment named "${fragmentName}".`, { - nodes: [knownFragmentName, node.name] + nodes: [knownFragmentNames[fragmentName], node.name] })); } else { - knownFragmentNames.set(fragmentName, node.name); + knownFragmentNames[fragmentName] = node.name; } return false; } @@ -41055,28 +40155,27 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ */ function UniqueInputFieldNamesRule(context) { const knownNameStack = []; - let knownNames = new Map(); + let knownNames = Object.create(null); return { ObjectValue: { enter() { knownNameStack.push(knownNames); - knownNames = new Map(); + knownNames = Object.create(null); }, leave() { const prevKnownNames = knownNameStack.pop(); - prevKnownNames != null || (0, _invariant.invariant)(false); + prevKnownNames || (0, _invariant.invariant)(false); knownNames = prevKnownNames; } }, ObjectField(node) { const fieldName = node.name.value; - const knownName = knownNames.get(fieldName); - if (knownName != null) { + if (knownNames[fieldName]) { context.reportError(new _GraphQLError.GraphQLError(`There can be only one input field named "${fieldName}".`, { - nodes: [knownName, node.name] + nodes: [knownNames[fieldName], node.name] })); } else { - knownNames.set(fieldName, node.name); + knownNames[fieldName] = node.name; } } }; @@ -41105,18 +40204,17 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness */ function UniqueOperationNamesRule(context) { - const knownOperationNames = new Map(); + const knownOperationNames = Object.create(null); return { OperationDefinition(node) { const operationName = node.name; - if (operationName != null) { - const knownOperationName = knownOperationNames.get(operationName.value); - if (knownOperationName != null) { + if (operationName) { + if (knownOperationNames[operationName.value]) { context.reportError(new _GraphQLError.GraphQLError(`There can be only one operation named "${operationName.value}".`, { - nodes: [knownOperationName, operationName] + nodes: [knownOperationNames[operationName.value], operationName] })); } else { - knownOperationNames.set(operationName.value, operationName); + knownOperationNames[operationName.value] = operationName; } } return false; @@ -41147,7 +40245,7 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ */ function UniqueOperationTypesRule(context) { const schema = context.getSchema(); - const definedOperationTypes = new Map(); + const definedOperationTypes = Object.create(null); const existingOperationTypes = schema ? { query: schema.getQueryType(), mutation: schema.getMutationType(), @@ -41159,12 +40257,14 @@ function UniqueOperationTypesRule(context) { }; function checkOperationTypes(node) { var _node$operationTypes; + // See: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; for (const operationType of operationTypesNodes) { const operation = operationType.operation; - const alreadyDefinedOperationType = definedOperationTypes.get(operation); + const alreadyDefinedOperationType = definedOperationTypes[operation]; if (existingOperationTypes[operation]) { context.reportError(new _GraphQLError.GraphQLError(`Type for ${operation} already defined in the schema. It cannot be redefined.`, { nodes: operationType @@ -41174,7 +40274,7 @@ function UniqueOperationTypesRule(context) { nodes: [alreadyDefinedOperationType, operationType] })); } else { - definedOperationTypes.set(operation, operationType); + definedOperationTypes[operation] = operationType; } } return false; @@ -41202,7 +40302,7 @@ var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../ * A GraphQL document is only valid if all defined types have unique names. */ function UniqueTypeNamesRule(context) { - const knownTypeNames = new Map(); + const knownTypeNames = Object.create(null); const schema = context.getSchema(); return { ScalarTypeDefinition: checkTypeName, @@ -41220,13 +40320,12 @@ function UniqueTypeNamesRule(context) { })); return; } - const knownNameNode = knownTypeNames.get(typeName); - if (knownNameNode != null) { + if (knownTypeNames[typeName]) { context.reportError(new _GraphQLError.GraphQLError(`There can be only one type named "${typeName}".`, { - nodes: [knownNameNode, node.name] + nodes: [knownTypeNames[typeName], node.name] })); } else { - knownTypeNames.set(typeName, node.name); + knownTypeNames[typeName] = node.name; } return false; } @@ -41257,7 +40356,9 @@ function UniqueVariableNamesRule(context) { return { OperationDefinition(operationNode) { var _operationNode$variab; + // See: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ const variableDefinitions = (_operationNode$variab = operationNode.variableDefinitions) !== null && _operationNode$variab !== void 0 ? _operationNode$variab : []; const seenVariableDefinitions = (0, _groupBy.groupBy)(variableDefinitions, node => node.variable.name.value); @@ -41288,6 +40389,7 @@ Object.defineProperty(exports, "__esModule", ({ exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; var _didYouMean = __webpack_require__(/*! ../../jsutils/didYouMean.mjs */ "../../../node_modules/graphql/jsutils/didYouMean.mjs"); var _inspect = __webpack_require__(/*! ../../jsutils/inspect.mjs */ "../../../node_modules/graphql/jsutils/inspect.mjs"); +var _keyMap = __webpack_require__(/*! ../../jsutils/keyMap.mjs */ "../../../node_modules/graphql/jsutils/keyMap.mjs"); var _suggestionList = __webpack_require__(/*! ../../jsutils/suggestionList.mjs */ "../../../node_modules/graphql/jsutils/suggestionList.mjs"); var _GraphQLError = __webpack_require__(/*! ../../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _kinds = __webpack_require__(/*! ../../language/kinds.mjs */ "../../../node_modules/graphql/language/kinds.mjs"); @@ -41326,11 +40428,11 @@ function ValuesOfCorrectTypeRule(context) { if (!(0, _definition.isInputObjectType)(type)) { isValidValueNode(context, node); return false; // Don't traverse further. - } - // Ensure every required field exists. - const fieldNodeMap = new Map(node.fields.map(field => [field.name.value, field])); + } // Ensure every required field exists. + + const fieldNodeMap = (0, _keyMap.keyMap)(node.fields, field => field.name.value); for (const fieldDef of Object.values(type.getFields())) { - const fieldNode = fieldNodeMap.get(fieldDef.name); + const fieldNode = fieldNodeMap[fieldDef.name]; if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { const typeStr = (0, _inspect.inspect)(fieldDef.type); context.reportError(new _GraphQLError.GraphQLError(`Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, { @@ -41371,6 +40473,7 @@ function ValuesOfCorrectTypeRule(context) { * Any value literal may be a valid representation of a Scalar, depending on * that scalar type. */ + function isValidValueNode(context, node) { // Report any error at the full type expected by the location. const locationType = context.getInputType(); @@ -41384,11 +40487,12 @@ function isValidValueNode(context, node) { nodes: node })); return; - } - // Scalars and Enums determine if a literal value is valid via parseLiteral(), + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), // which may throw or return an invalid value to indicate failure. + try { - const parseResult = type.parseLiteral(node, undefined /* variables */); + const parseResult = type.parseLiteral(node, undefined + /* variables */); if (parseResult === undefined) { const typeStr = (0, _inspect.inspect)(locationType); context.reportError(new _GraphQLError.GraphQLError(`Expected value of type "${typeStr}", found ${(0, _printer.print)(node)}.`, { @@ -41408,8 +40512,8 @@ function isValidValueNode(context, node) { } } function validateOneOfInputObject(context, node, type, fieldNodeMap, variableDefinitions) { - var _fieldNodeMap$get; - const keys = Array.from(fieldNodeMap.keys()); + var _fieldNodeMap$keys$; + const keys = Object.keys(fieldNodeMap); const isNotExactlyOneField = keys.length !== 1; if (isNotExactlyOneField) { context.reportError(new _GraphQLError.GraphQLError(`OneOf Input Object "${type.name}" must specify exactly one key.`, { @@ -41417,7 +40521,7 @@ function validateOneOfInputObject(context, node, type, fieldNodeMap, variableDef })); return; } - const value = (_fieldNodeMap$get = fieldNodeMap.get(keys[0])) === null || _fieldNodeMap$get === void 0 ? void 0 : _fieldNodeMap$get.value; + const value = (_fieldNodeMap$keys$ = fieldNodeMap[keys[0]]) === null || _fieldNodeMap$keys$ === void 0 ? void 0 : _fieldNodeMap$keys$.value; const isNullLiteral = !value || value.kind === _kinds.Kind.NULL; const isVariable = (value === null || value === void 0 ? void 0 : value.kind) === _kinds.Kind.VARIABLE; if (isNullLiteral) { @@ -41507,11 +40611,11 @@ var _typeFromAST = __webpack_require__(/*! ../../utilities/typeFromAST.mjs */ ". * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed */ function VariablesInAllowedPositionRule(context) { - let varDefMap; + let varDefMap = Object.create(null); return { OperationDefinition: { enter() { - varDefMap = new Map(); + varDefMap = Object.create(null); }, leave(operation) { const usages = context.getRecursiveVariableUsages(operation); @@ -41521,7 +40625,7 @@ function VariablesInAllowedPositionRule(context) { defaultValue } of usages) { const varName = node.name.value; - const varDef = varDefMap.get(varName); + const varDef = varDefMap[varName]; if (varDef && type) { // A var type is allowed if it is the same or more strict (e.g. is // a subtype of) than the expected type. It can be more strict if @@ -41542,7 +40646,7 @@ function VariablesInAllowedPositionRule(context) { } }, VariableDefinition(node) { - varDefMap.set(node.variable.name.value, node); + varDefMap[node.variable.name.value] = node; } }; } @@ -41551,6 +40655,7 @@ function VariablesInAllowedPositionRule(context) { * which includes considering if default values exist for either the variable * or the location at which it is located. */ + function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { if ((0, _definition.isNonNullType)(locationType) && !(0, _definition.isNonNullType)(varType)) { const hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; @@ -41703,9 +40808,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.specifiedSDLRules = exports.specifiedRules = exports.recommendedRules = void 0; -var _DeferStreamDirectiveLabelRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveLabelRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveLabelRule.mjs"); -var _DeferStreamDirectiveOnRootFieldRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveOnRootFieldRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs"); -var _DeferStreamDirectiveOnValidOperationsRule = __webpack_require__(/*! ./rules/DeferStreamDirectiveOnValidOperationsRule.mjs */ "../../../node_modules/graphql/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs"); var _ExecutableDefinitionsRule = __webpack_require__(/*! ./rules/ExecutableDefinitionsRule.mjs */ "../../../node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs"); var _FieldsOnCorrectTypeRule = __webpack_require__(/*! ./rules/FieldsOnCorrectTypeRule.mjs */ "../../../node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs"); var _FragmentsOnCompositeTypesRule = __webpack_require__(/*! ./rules/FragmentsOnCompositeTypesRule.mjs */ "../../../node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs"); @@ -41726,7 +40828,6 @@ var _PossibleTypeExtensionsRule = __webpack_require__(/*! ./rules/PossibleTypeEx var _ProvidedRequiredArgumentsRule = __webpack_require__(/*! ./rules/ProvidedRequiredArgumentsRule.mjs */ "../../../node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs"); var _ScalarLeafsRule = __webpack_require__(/*! ./rules/ScalarLeafsRule.mjs */ "../../../node_modules/graphql/validation/rules/ScalarLeafsRule.mjs"); var _SingleFieldSubscriptionsRule = __webpack_require__(/*! ./rules/SingleFieldSubscriptionsRule.mjs */ "../../../node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs"); -var _StreamDirectiveOnListFieldRule = __webpack_require__(/*! ./rules/StreamDirectiveOnListFieldRule.mjs */ "../../../node_modules/graphql/validation/rules/StreamDirectiveOnListFieldRule.mjs"); var _UniqueArgumentDefinitionNamesRule = __webpack_require__(/*! ./rules/UniqueArgumentDefinitionNamesRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs"); var _UniqueArgumentNamesRule = __webpack_require__(/*! ./rules/UniqueArgumentNamesRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs"); var _UniqueDirectiveNamesRule = __webpack_require__(/*! ./rules/UniqueDirectiveNamesRule.mjs */ "../../../node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs"); @@ -41742,14 +40843,7 @@ var _UniqueVariableNamesRule = __webpack_require__(/*! ./rules/UniqueVariableNam var _ValuesOfCorrectTypeRule = __webpack_require__(/*! ./rules/ValuesOfCorrectTypeRule.mjs */ "../../../node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs"); var _VariablesAreInputTypesRule = __webpack_require__(/*! ./rules/VariablesAreInputTypesRule.mjs */ "../../../node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs"); var _VariablesInAllowedPositionRule = __webpack_require__(/*! ./rules/VariablesInAllowedPositionRule.mjs */ "../../../node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs"); -// Spec Section: "Defer And Stream Directive Labels Are Unique" - -// Spec Section: "Defer And Stream Directives Are Used On Valid Root Field" - -// Spec Section: "Defer And Stream Directives Are Used On Valid Operations" - // Spec Section: "Executable Definitions" - // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" // Spec Section: "Fragments on Composite Types" @@ -41786,8 +40880,6 @@ var _VariablesInAllowedPositionRule = __webpack_require__(/*! ./rules/VariablesI // Spec Section: "Subscriptions with Single Root Field" -// Spec Section: "Stream Directives Are Used On List Fields" - // Spec Section: "Argument Uniqueness" // Spec Section: "Directives Are Unique Per Location" @@ -41817,10 +40909,12 @@ const recommendedRules = exports.recommendedRules = Object.freeze([_MaxIntrospec * The order of the rules in this list has been adjusted to lead to the * most clear output when encountering multiple validation errors. */ -const specifiedRules = exports.specifiedRules = Object.freeze([_ExecutableDefinitionsRule.ExecutableDefinitionsRule, _UniqueOperationNamesRule.UniqueOperationNamesRule, _LoneAnonymousOperationRule.LoneAnonymousOperationRule, _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, _KnownTypeNamesRule.KnownTypeNamesRule, _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, _VariablesAreInputTypesRule.VariablesAreInputTypesRule, _ScalarLeafsRule.ScalarLeafsRule, _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, _UniqueFragmentNamesRule.UniqueFragmentNamesRule, _KnownFragmentNamesRule.KnownFragmentNamesRule, _NoUnusedFragmentsRule.NoUnusedFragmentsRule, _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, _NoFragmentCyclesRule.NoFragmentCyclesRule, _UniqueVariableNamesRule.UniqueVariableNamesRule, _NoUndefinedVariablesRule.NoUndefinedVariablesRule, _NoUnusedVariablesRule.NoUnusedVariablesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _DeferStreamDirectiveOnRootFieldRule.DeferStreamDirectiveOnRootFieldRule, _DeferStreamDirectiveOnValidOperationsRule.DeferStreamDirectiveOnValidOperationsRule, _DeferStreamDirectiveLabelRule.DeferStreamDirectiveLabelRule, _StreamDirectiveOnListFieldRule.StreamDirectiveOnListFieldRule, _KnownArgumentNamesRule.KnownArgumentNamesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, ...recommendedRules]); + +const specifiedRules = exports.specifiedRules = Object.freeze([_ExecutableDefinitionsRule.ExecutableDefinitionsRule, _UniqueOperationNamesRule.UniqueOperationNamesRule, _LoneAnonymousOperationRule.LoneAnonymousOperationRule, _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, _KnownTypeNamesRule.KnownTypeNamesRule, _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, _VariablesAreInputTypesRule.VariablesAreInputTypesRule, _ScalarLeafsRule.ScalarLeafsRule, _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, _UniqueFragmentNamesRule.UniqueFragmentNamesRule, _KnownFragmentNamesRule.KnownFragmentNamesRule, _NoUnusedFragmentsRule.NoUnusedFragmentsRule, _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, _NoFragmentCyclesRule.NoFragmentCyclesRule, _UniqueVariableNamesRule.UniqueVariableNamesRule, _NoUndefinedVariablesRule.NoUndefinedVariablesRule, _NoUnusedVariablesRule.NoUnusedVariablesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _KnownArgumentNamesRule.KnownArgumentNamesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, ...recommendedRules]); /** * @internal */ + const specifiedSDLRules = exports.specifiedSDLRules = Object.freeze([_LoneSchemaDefinitionRule.LoneSchemaDefinitionRule, _UniqueOperationTypesRule.UniqueOperationTypesRule, _UniqueTypeNamesRule.UniqueTypeNamesRule, _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule, _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule, _UniqueArgumentDefinitionNamesRule.UniqueArgumentDefinitionNamesRule, _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule, _KnownTypeNamesRule.KnownTypeNamesRule, _KnownDirectivesRule.KnownDirectivesRule, _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule, _KnownArgumentNamesRule.KnownArgumentNamesOnDirectivesRule, _UniqueArgumentNamesRule.UniqueArgumentNamesRule, _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsOnDirectivesRule]); /***/ }), @@ -41840,6 +40934,7 @@ exports.assertValidSDL = assertValidSDL; exports.assertValidSDLExtension = assertValidSDLExtension; exports.validate = validate; exports.validateSDL = validateSDL; +var _devAssert = __webpack_require__(/*! ../jsutils/devAssert.mjs */ "../../../node_modules/graphql/jsutils/devAssert.mjs"); var _GraphQLError = __webpack_require__(/*! ../error/GraphQLError.mjs */ "../../../node_modules/graphql/error/GraphQLError.mjs"); var _visitor = __webpack_require__(/*! ../language/visitor.mjs */ "../../../node_modules/graphql/language/visitor.mjs"); var _validate = __webpack_require__(/*! ../type/validate.mjs */ "../../../node_modules/graphql/type/validate.mjs"); @@ -41866,30 +40961,32 @@ var _ValidationContext = __webpack_require__(/*! ./ValidationContext.mjs */ "../ * Optionally a custom TypeInfo instance may be provided. If not provided, one * will be created from the provided schema. */ + function validate(schema, documentAST, rules = _specifiedRules.specifiedRules, options, /** @deprecated will be removed in 17.0.0 */ typeInfo = new _TypeInfo.TypeInfo(schema)) { var _options$maxErrors; const maxErrors = (_options$maxErrors = options === null || options === void 0 ? void 0 : options.maxErrors) !== null && _options$maxErrors !== void 0 ? _options$maxErrors : 100; - // If the schema used for validation is invalid, throw an error. + documentAST || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + (0, _validate.assertValidSchema)(schema); - const abortError = new _GraphQLError.GraphQLError('Too many validation errors, error limit reached. Validation aborted.'); + const abortObj = Object.freeze({}); const errors = []; const context = new _ValidationContext.ValidationContext(schema, documentAST, typeInfo, error => { if (errors.length >= maxErrors) { - throw abortError; + errors.push(new _GraphQLError.GraphQLError('Too many validation errors, error limit reached. Validation aborted.')); // eslint-disable-next-line @typescript-eslint/no-throw-literal + + throw abortObj; } errors.push(error); - }); - // This uses a specialized visitor which runs multiple visitors in parallel, + }); // This uses a specialized visitor which runs multiple visitors in parallel, // while maintaining the visitor skip and break API. - const visitor = (0, _visitor.visitInParallel)(rules.map(rule => rule(context))); - // Visit the whole document with each instance of all provided rules. + + const visitor = (0, _visitor.visitInParallel)(rules.map(rule => rule(context))); // Visit the whole document with each instance of all provided rules. + try { (0, _visitor.visit)(documentAST, (0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor)); } catch (e) { - if (e === abortError) { - errors.push(abortError); - } else { + if (e !== abortObj) { throw e; } } @@ -41898,6 +40995,7 @@ typeInfo = new _TypeInfo.TypeInfo(schema)) { /** * @internal */ + function validateSDL(documentAST, schemaToExtend, rules = _specifiedRules.specifiedSDLRules) { const errors = []; const context = new _ValidationContext.SDLValidationContext(documentAST, schemaToExtend, error => { @@ -41913,6 +41011,7 @@ function validateSDL(documentAST, schemaToExtend, rules = _specifiedRules.specif * * @internal */ + function assertValidSDL(documentAST) { const errors = validateSDL(documentAST); if (errors.length !== 0) { @@ -41925,6 +41024,7 @@ function assertValidSDL(documentAST) { * * @internal */ + function assertValidSDLExtension(documentAST, schema) { const errors = validateSDL(documentAST, schema); if (errors.length !== 0) { @@ -41948,18 +41048,20 @@ Object.defineProperty(exports, "__esModule", ({ exports.versionInfo = exports.version = void 0; // Note: This file is autogenerated using "resources/gen-version.js" script and // automatically updated by "npm version" command. + /** * A string containing the version of the GraphQL.js library */ -const version = exports.version = '17.0.0-alpha.7'; +const version = exports.version = '16.9.0'; /** * An object containing the components of the GraphQL.js version string */ + const versionInfo = exports.versionInfo = Object.freeze({ - major: 17, - minor: 0, + major: 16, + minor: 9, patch: 0, - preReleaseTag: 'alpha.7' + preReleaseTag: null }); /***/ }), @@ -69309,7 +68411,7 @@ function createContextHook(context) { var _a; const value = React.useContext(context); if (value === null && (options == null ? void 0 : options.nonNull)) { - throw new Error(`Tried to use \`${((_a = options.caller) == null ? void 0 : _a.name) || useGivenContext.caller.name}\` without the necessary context. Make sure to render the \`${context.displayName}Provider\` component higher up the tree.`); + throw new Error(`Tried to use \`${((_a = options.caller) == null ? void 0 : _a.name) || "a component"}\` without the necessary context. Make sure to render the \`${context.displayName}Provider\` component higher up the tree.`); } return value; } diff --git a/netbox/project-static/dist/netbox.js b/netbox/project-static/dist/netbox.js index 5e24ee6250e4ad778886c374c7ca972faf2e3ce6..beee9c5781500ba5781fb0ae7b7640961b293848 100644 GIT binary patch literal 390368 zcmcG%dtV#JlK=nz?@@p@FCxVQ#yPv^BCPOrY!W-ij(rTy4YOW>1{hm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2hw)r*|(>_kt`5w&C84zDQdh7j(kSLNz9q9*a$w4=vEoP_mjp1MNI zr|}|#l*~pTYQZpMLlcdfCIfN|#QcovadZyAHb#OnE~Uwj)Cb$-s&_8r3|fQQk&iH4 zoaF(&D(8v(I~l}j!<}d&hkE;YGZ65=42qQFGc@0vouMy&DNo~vEJ~^u6rpJ}h?Dd{ zEFNG3G7mM^UZJndm6vK$_$Q`_%D+X$-Q4#QE$J<)>d4&%wsz-rcBbRz-;?B!E%2ND zQ?z=itt;~tMwBNcsBm+cxo4NHTk^ZuuQaq`fU4q{ja9$`t$N>4F=&K=2dY)v~f_2(Y$8TDBIF;Sy>}@rdoAQvhM)!tGJ~6#eP$0gi;qU|Cpk)Yk@LMww=0` zZMA~R>kO9YI~)YA{!iQ16ESshsmXC$FQ+X^QfI>1a}E!~Z9hTzXe` z<-5Z{0z~b>CXLLixv6qY1Wxm-CUwtBP}Tok6IBot=%2X1<|+gE>_YvaZIBa$CNLF% zPvTnxiZ{{>eIK=8B=X2ouGSK)077@=P31T*Ohqes6-+?Z?+`&3k@zl?N~O# zWL@5JN!jc=N-HY9&nme#Gg)OC1a zfUFDZL-wrYh}OW5=+x{*cXp@d+H3TrIr%1SHOF43N0;g}YiQ1-8wbqYP3e2^hgXl$ zywi zPV?@+XocDNPx|YuO5~aK*J*F3Q!&l!G`3aIKDK=K=N>pG2W^e0sF z33nq(d*c8`kQ5#-K$?|#B;dm44t+u+=BJ-fGz;oB8*k9@*3WOy!VW&iqwU(J67%*=dZMQhi2mKMoq{~VD diff --git a/netbox/project-static/netbox-graphiql/package.json b/netbox/project-static/netbox-graphiql/package.json index 27257e34c..c5b2f3077 100644 --- a/netbox/project-static/netbox-graphiql/package.json +++ b/netbox/project-static/netbox-graphiql/package.json @@ -1,13 +1,13 @@ { "name": "netbox-graphiql", - "version": "4.1.0", + "version": "4.2.0", "description": "NetBox GraphiQL Custom Front End", "main": "dist/graphiql.js", "license": "Apache-2.0", "private": true, "dependencies": { - "@graphiql/plugin-explorer": "3.2.2", - "graphiql": "3.7.1", + "@graphiql/plugin-explorer": "3.2.3", + "graphiql": "3.7.2", "graphql": "16.9.0", "js-cookie": "3.0.5", "react": "18.3.1", diff --git a/netbox/project-static/package.json b/netbox/project-static/package.json index 0750f397b..bbc9c6ff7 100644 --- a/netbox/project-static/package.json +++ b/netbox/project-static/package.json @@ -27,11 +27,11 @@ "bootstrap": "5.3.3", "clipboard": "2.0.11", "flatpickr": "4.6.13", - "gridstack": "10.3.1", + "gridstack": "11.1.1", "htmx.org": "1.9.12", "query-string": "9.1.1", - "sass": "1.80.5", - "tom-select": "2.3.1", + "sass": "1.81.0", + "tom-select": "2.4.1", "typeface-inter": "3.18.1", "typeface-roboto-mono": "1.1.13" }, diff --git a/netbox/project-static/src/select/classes/dynamicTomSelect.ts b/netbox/project-static/src/select/classes/dynamicTomSelect.ts index 72c9fe518..8e44ce6a7 100644 --- a/netbox/project-static/src/select/classes/dynamicTomSelect.ts +++ b/netbox/project-static/src/select/classes/dynamicTomSelect.ts @@ -1,18 +1,17 @@ -import { RecursivePartial, TomInput, TomOption, TomSettings } from 'tom-select/dist/types/types'; -import { addClasses } from 'tom-select/src/vanilla' +import { RecursivePartial, TomOption, TomSettings } from 'tom-select/dist/types/types'; +import { TomInput } from 'tom-select/dist/cjs/types/core'; +import { addClasses } from 'tom-select/src/vanilla.ts'; import queryString from 'query-string'; import TomSelect from 'tom-select'; import type { Stringifiable } from 'query-string'; import { DynamicParamsMap } from './dynamicParamsMap'; // Transitional -import { QueryFilter, PathFilter } from '../types' +import { QueryFilter, PathFilter } from '../types'; import { getElement, replaceAll } from '../../util'; - // Extends TomSelect to provide enhanced fetching of options via the REST API export class DynamicTomSelect extends TomSelect { - public readonly nullOption: Nullable = null; // Transitional code from APISelect @@ -25,7 +24,7 @@ export class DynamicTomSelect extends TomSelect { * Overrides */ - constructor( input_arg: string|TomInput, user_settings: RecursivePartial ) { + constructor(input_arg: string | TomInput, user_settings: RecursivePartial) { super(input_arg, user_settings); // Glean the REST API endpoint URL from the