nautobot 2.4.2__py3-none-any.whl → 2.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nautobot/apps/filters.py +2 -0
- nautobot/circuits/filters.py +1 -1
- nautobot/circuits/templates/circuits/inc/circuit_termination.html +1 -1
- nautobot/circuits/tests/integration/test_circuit.py +135 -0
- nautobot/circuits/tests/test_models.py +5 -3
- nautobot/circuits/views.py +4 -1
- nautobot/cloud/api/views.py +3 -3
- nautobot/cloud/filters.py +3 -6
- nautobot/cloud/tests/test_filters.py +21 -0
- nautobot/core/admin.py +2 -0
- nautobot/core/constants.py +0 -1
- nautobot/core/forms/__init__.py +2 -0
- nautobot/core/forms/forms.py +2 -1
- nautobot/core/forms/widgets.py +8 -0
- nautobot/core/jobs/__init__.py +2 -1
- nautobot/core/management/commands/generate_performance_test_endpoints.py +271 -0
- nautobot/core/models/utils.py +6 -1
- nautobot/core/templates/generic/object_bulk_delete.html +1 -1
- nautobot/core/templates/generic/object_bulk_edit.html +1 -1
- nautobot/core/templates/generic/object_bulk_import.html +1 -1
- nautobot/core/templates/generic/object_create.html +5 -0
- nautobot/core/templates/generic/object_delete.html +1 -1
- nautobot/core/templates/generic/object_detail.html +1 -1
- nautobot/core/templates/generic/object_edit.html +1 -1
- nautobot/core/templates/inc/javascript.html +3 -0
- nautobot/core/templates/widgets/clearable_file.html +5 -0
- nautobot/core/templatetags/helpers.py +3 -3
- nautobot/core/templatetags/ui_framework.py +20 -4
- nautobot/core/testing/forms.py +1 -1
- nautobot/core/testing/integration.py +37 -7
- nautobot/core/tests/test_api.py +1 -1
- nautobot/core/tests/test_commands.py +31 -0
- nautobot/core/tests/test_graphql.py +3 -3
- nautobot/core/tests/test_jobs.py +4 -1
- nautobot/core/tests/test_utils.py +17 -2
- nautobot/core/ui/object_detail.py +1 -1
- nautobot/core/utils/lookup.py +12 -1
- nautobot/core/views/generic.py +9 -1
- nautobot/core/views/mixins.py +9 -1
- nautobot/dcim/api/serializers.py +36 -0
- nautobot/dcim/api/views.py +12 -11
- nautobot/dcim/elevations.py +17 -4
- nautobot/dcim/factory.py +9 -1
- nautobot/dcim/filters/__init__.py +27 -1
- nautobot/dcim/forms.py +16 -7
- nautobot/dcim/models/devices.py +12 -7
- nautobot/dcim/signals.py +26 -0
- nautobot/dcim/templates/dcim/cable_trace.html +4 -4
- nautobot/dcim/templates/dcim/consoleport.html +14 -4
- nautobot/dcim/templates/dcim/consoleserverport.html +14 -4
- nautobot/dcim/templates/dcim/device/lldp_neighbors.html +3 -3
- nautobot/dcim/templates/dcim/frontport.html +7 -2
- nautobot/dcim/templates/dcim/interface.html +9 -4
- nautobot/dcim/templates/dcim/powerfeed.html +8 -3
- nautobot/dcim/templates/dcim/poweroutlet.html +14 -4
- nautobot/dcim/templates/dcim/powerport.html +14 -4
- nautobot/dcim/templates/dcim/rearport.html +7 -2
- nautobot/dcim/templates/dcim/virtualdevicecontext_retrieve.html +0 -62
- nautobot/dcim/templates/dcim/virtualdevicecontext_update.html +6 -0
- nautobot/dcim/tests/integration/test_fileinputpicker.py +87 -0
- nautobot/dcim/tests/test_api.py +176 -0
- nautobot/dcim/tests/test_filters.py +56 -3
- nautobot/dcim/tests/test_models.py +41 -1
- nautobot/dcim/views.py +24 -14
- nautobot/extras/api/mixins.py +1 -1
- nautobot/extras/api/views.py +4 -4
- nautobot/extras/filters/__init__.py +4 -0
- nautobot/extras/forms/forms.py +4 -0
- nautobot/extras/jobs.py +8 -1
- nautobot/extras/models/datasources.py +7 -3
- nautobot/extras/plugins/__init__.py +26 -1
- nautobot/extras/templates/extras/inc/jobresult.html +12 -13
- nautobot/extras/templates/extras/job.html +1 -0
- nautobot/extras/templates/extras/objectchange.html +28 -12
- nautobot/extras/tests/test_api.py +16 -15
- nautobot/extras/tests/test_dynamicgroups.py +14 -0
- nautobot/extras/tests/test_filters.py +2 -0
- nautobot/extras/tests/test_plugins.py +32 -1
- nautobot/extras/tests/test_views.py +209 -11
- nautobot/extras/utils.py +30 -0
- nautobot/extras/views.py +32 -14
- nautobot/ipam/api/serializers.py +7 -8
- nautobot/ipam/api/views.py +5 -5
- nautobot/ipam/factory.py +27 -8
- nautobot/ipam/filters.py +67 -29
- nautobot/ipam/formfields.py +51 -0
- nautobot/ipam/forms.py +15 -7
- nautobot/ipam/migrations/0051_added_optional_vrf_relationship_to_vdc.py +41 -0
- nautobot/ipam/models.py +63 -5
- nautobot/ipam/tables.py +21 -7
- nautobot/ipam/tests/test_api.py +107 -66
- nautobot/ipam/tests/test_filters.py +145 -5
- nautobot/ipam/tests/test_views.py +15 -2
- nautobot/project-static/bootstrap-filestyle-1.2.3/bootstrap-filestyle.min.js +11 -0
- nautobot/project-static/css/base.css +11 -0
- nautobot/project-static/css/dark.css +2 -1
- nautobot/project-static/docs/apps/index.html +1 -1
- nautobot/project-static/docs/apps/nautobot-apps.html +1 -1
- nautobot/project-static/docs/code-reference/nautobot/apps/filters.html +62 -0
- nautobot/project-static/docs/development/apps/api/configuration-view.html +0 -3
- nautobot/project-static/docs/development/apps/api/models/graphql.html +9 -13
- nautobot/project-static/docs/development/apps/api/platform-features/custom-validators.html +94 -1
- nautobot/project-static/docs/development/apps/api/platform-features/filter-extensions.html +2 -5
- nautobot/project-static/docs/development/apps/api/platform-features/jinja2-filters.html +0 -3
- nautobot/project-static/docs/development/apps/api/platform-features/populating-extensibility-features.html +0 -3
- nautobot/project-static/docs/development/apps/api/platform-features/secrets-providers.html +0 -3
- nautobot/project-static/docs/development/apps/api/prometheus.html +0 -3
- nautobot/project-static/docs/development/apps/api/setup.html +1 -1
- nautobot/project-static/docs/development/apps/api/testing.html +0 -6
- nautobot/project-static/docs/development/apps/api/ui-extensions/banners.html +0 -3
- nautobot/project-static/docs/development/apps/api/ui-extensions/home-page.html +0 -3
- nautobot/project-static/docs/development/apps/api/ui-extensions/object-views.html +0 -3
- nautobot/project-static/docs/development/apps/api/views/core-view-overrides.html +0 -3
- nautobot/project-static/docs/development/apps/api/views/nautobot-generic-views.html +1 -7
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewset.html +0 -7
- nautobot/project-static/docs/development/apps/api/views/nautobotuiviewsetrouter.html +0 -4
- nautobot/project-static/docs/development/apps/api/views/notes.html +0 -3
- nautobot/project-static/docs/development/apps/index.html +2 -35
- nautobot/project-static/docs/development/apps/migration/code-updates.html +7 -6
- nautobot/project-static/docs/development/apps/migration/dependency-updates.html +2 -2
- nautobot/project-static/docs/development/apps/migration/from-v1.html +3 -3
- nautobot/project-static/docs/development/core/application-registry.html +0 -6
- nautobot/project-static/docs/development/core/best-practices.html +1 -28
- nautobot/project-static/docs/development/core/bootstrap-ui.html +1 -1
- nautobot/project-static/docs/development/core/docker-compose-advanced-use-cases.html +65 -11
- nautobot/project-static/docs/development/core/getting-started.html +14 -18
- nautobot/project-static/docs/development/core/homepage.html +0 -3
- nautobot/project-static/docs/development/core/index.html +1 -1
- nautobot/project-static/docs/development/core/minikube-dev-environment-for-k8s-jobs.html +3 -3
- nautobot/project-static/docs/development/core/model-checklist.html +1 -1
- nautobot/project-static/docs/development/core/navigation-menu.html +1 -1
- nautobot/project-static/docs/development/core/release-checklist.html +1 -1
- nautobot/project-static/docs/development/core/settings.html +1 -1
- nautobot/project-static/docs/development/core/style-guide.html +4 -9
- nautobot/project-static/docs/development/core/templates.html +0 -3
- nautobot/project-static/docs/development/core/testing.html +0 -9
- nautobot/project-static/docs/development/jobs/index.html +11 -30
- nautobot/project-static/docs/development/jobs/migration/from-v1.html +3 -2
- nautobot/project-static/docs/index.html +3 -2
- nautobot/project-static/docs/objects.inv +0 -0
- nautobot/project-static/docs/overview/application_stack.html +2 -20
- nautobot/project-static/docs/release-notes/version-1.0.html +2 -2
- nautobot/project-static/docs/release-notes/version-1.1.html +2 -2
- nautobot/project-static/docs/release-notes/version-1.2.html +3 -3
- nautobot/project-static/docs/release-notes/version-1.3.html +1 -1
- nautobot/project-static/docs/release-notes/version-1.4.html +17 -17
- nautobot/project-static/docs/release-notes/version-1.5.html +8 -8
- nautobot/project-static/docs/release-notes/version-1.6.html +4 -4
- nautobot/project-static/docs/release-notes/version-2.0.html +10 -10
- nautobot/project-static/docs/release-notes/version-2.1.html +7 -7
- nautobot/project-static/docs/release-notes/version-2.2.html +1 -1
- nautobot/project-static/docs/release-notes/version-2.3.html +4 -4
- nautobot/project-static/docs/release-notes/version-2.4.html +379 -0
- nautobot/project-static/docs/requirements.txt +1 -1
- nautobot/project-static/docs/search/search_index.json +1 -1
- nautobot/project-static/docs/sitemap.xml +290 -290
- nautobot/project-static/docs/sitemap.xml.gz +0 -0
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/ldap.html +3 -3
- nautobot/project-static/docs/user-guide/administration/configuration/authentication/sso.html +4 -4
- nautobot/project-static/docs/user-guide/administration/configuration/redis.html +1 -1
- nautobot/project-static/docs/user-guide/administration/configuration/settings.html +3 -13
- nautobot/project-static/docs/user-guide/administration/guides/celery-queues.html +5 -5
- nautobot/project-static/docs/user-guide/administration/guides/docker.html +3 -18
- nautobot/project-static/docs/user-guide/administration/guides/health-checks.html +1 -1
- nautobot/project-static/docs/user-guide/administration/guides/prometheus-metrics.html +4 -4
- nautobot/project-static/docs/user-guide/administration/guides/request-profiling.html +15 -15
- nautobot/project-static/docs/user-guide/administration/guides/s3-django-storage.html +2 -2
- nautobot/project-static/docs/user-guide/administration/installation/app-install.html +1 -1
- nautobot/project-static/docs/user-guide/administration/installation/index.html +0 -16
- nautobot/project-static/docs/user-guide/administration/installation/install_system.html +1 -1
- nautobot/project-static/docs/user-guide/administration/installation/nautobot.html +7 -10
- nautobot/project-static/docs/user-guide/administration/installation/services.html +1 -12
- nautobot/project-static/docs/user-guide/administration/migration/migrating-from-postgresql.html +3 -3
- nautobot/project-static/docs/user-guide/administration/security/index.html +1 -1
- nautobot/project-static/docs/user-guide/administration/security/notices.html +1 -0
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-server.html +5 -35
- nautobot/project-static/docs/user-guide/administration/tools/nautobot-shell.html +1 -1
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/tables/v2-code-location-changes.yaml +1 -1
- nautobot/project-static/docs/user-guide/administration/upgrading/from-v1/upgrading-from-nautobot-v1.html +12 -9
- nautobot/project-static/docs/user-guide/administration/upgrading/upgrading.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/circuits/providernetwork.html +0 -3
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleport.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleporttemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverport.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/consoleserverporttemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebay.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicebaytemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/deviceredundancygroup.html +0 -3
- nautobot/project-static/docs/user-guide/core-data-model/dcim/devicetype.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontport.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/frontporttemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interface.html +1 -17
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfaceredundancygroup.html +0 -3
- nautobot/project-static/docs/user-guide/core-data-model/dcim/interfacetemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/inventoryitem.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/location.html +0 -3
- nautobot/project-static/docs/user-guide/core-data-model/dcim/locationtype.html +1 -7
- nautobot/project-static/docs/user-guide/core-data-model/dcim/platform.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlet.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/poweroutlettemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerport.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/powerporttemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearport.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/dcim/rearporttemplate.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontext.html +0 -6
- nautobot/project-static/docs/user-guide/core-data-model/extras/configcontextschema.html +0 -3
- nautobot/project-static/docs/user-guide/core-data-model/ipam/ipaddress.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/ipam/vlan.html +0 -4
- nautobot/project-static/docs/user-guide/core-data-model/virtualization/vminterface.html +0 -8
- nautobot/project-static/docs/user-guide/feature-guides/custom-fields.html +15 -15
- nautobot/project-static/docs/user-guide/feature-guides/git-data-source.html +1 -1
- nautobot/project-static/docs/user-guide/feature-guides/graphql.html +0 -6
- nautobot/project-static/docs/user-guide/platform-functionality/computedfield.html +0 -3
- nautobot/project-static/docs/user-guide/platform-functionality/customfield.html +3 -15
- nautobot/project-static/docs/user-guide/platform-functionality/dynamicgroup.html +1 -27
- nautobot/project-static/docs/user-guide/platform-functionality/gitrepository.html +0 -8
- nautobot/project-static/docs/user-guide/platform-functionality/graphql.html +3 -6
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/index.html +0 -8
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/job-scheduling-and-approvals.html +0 -7
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobbutton.html +0 -3
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobhook.html +0 -3
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/jobqueue.html +2 -2
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/kubernetes-job-support.html +6 -6
- nautobot/project-static/docs/user-guide/platform-functionality/jobs/models.html +0 -14
- nautobot/project-static/docs/user-guide/platform-functionality/note.html +0 -3
- nautobot/project-static/docs/user-guide/platform-functionality/relationship.html +1 -10
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/authentication.html +0 -3
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/filtering.html +0 -14
- nautobot/project-static/docs/user-guide/platform-functionality/rest-api/overview.html +0 -19
- nautobot/project-static/docs/user-guide/platform-functionality/secret.html +3 -9
- nautobot/project-static/docs/user-guide/platform-functionality/status.html +0 -8
- nautobot/project-static/docs/user-guide/platform-functionality/tag.html +0 -4
- nautobot/project-static/docs/user-guide/platform-functionality/template-filters.html +1 -13
- nautobot/project-static/docs/user-guide/platform-functionality/webhook.html +0 -5
- nautobot/project-static/js/dropdown.js +28 -0
- nautobot/project-static/js/editor.js +292 -0
- nautobot/project-static/monaco-editor-0.52.2/README.md +81 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/base/worker/workerMain.js +31 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/basic-languages/xml/xml.js +10 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/basic-languages/yaml/yaml.js +10 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/editor/editor.main.css +8 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/editor/editor.main.js +798 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/language/json/jsonMode.js +19 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/language/json/jsonWorker.js +42 -0
- nautobot/project-static/monaco-editor-0.52.2/vs/loader.js +11 -0
- nautobot/tenancy/filters/__init__.py +3 -5
- nautobot/tenancy/forms.py +9 -0
- nautobot/tenancy/templates/tenancy/tenant_create.html +21 -0
- nautobot/tenancy/templates/tenancy/tenant_edit.html +2 -21
- nautobot/tenancy/templates/tenancy/tenantgroup.html +2 -44
- nautobot/tenancy/templates/tenancy/tenantgroup_retrieve.html +1 -0
- nautobot/tenancy/tests/test_filters.py +10 -0
- nautobot/tenancy/tests/test_views.py +5 -1
- nautobot/tenancy/urls.py +7 -79
- nautobot/tenancy/views.py +51 -80
- nautobot/virtualization/views.py +0 -1
- nautobot/wireless/api/serializers.py +6 -1
- nautobot/wireless/api/views.py +3 -3
- nautobot/wireless/tables.py +9 -4
- nautobot/wireless/tests/test_api.py +5 -9
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/METADATA +9 -9
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/RECORD +267 -246
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/LICENSE.txt +0 -0
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/NOTICE +0 -0
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/WHEEL +0 -0
- {nautobot-2.4.2.dist-info → nautobot-2.4.4.dist-info}/entry_points.txt +0 -0
nautobot/ipam/tests/test_api.py
CHANGED
|
@@ -13,7 +13,15 @@ from rest_framework import status
|
|
|
13
13
|
from nautobot.core.testing import APITestCase, APIViewTestCases, disable_warnings
|
|
14
14
|
from nautobot.core.testing.api import APITransactionTestCase
|
|
15
15
|
from nautobot.dcim.choices import InterfaceTypeChoices
|
|
16
|
-
from nautobot.dcim.models import
|
|
16
|
+
from nautobot.dcim.models import (
|
|
17
|
+
Device,
|
|
18
|
+
DeviceType,
|
|
19
|
+
Interface,
|
|
20
|
+
Location,
|
|
21
|
+
LocationType,
|
|
22
|
+
Manufacturer,
|
|
23
|
+
VirtualDeviceContext,
|
|
24
|
+
)
|
|
17
25
|
from nautobot.extras.models import CustomField, Role, Status
|
|
18
26
|
from nautobot.ipam import choices
|
|
19
27
|
from nautobot.ipam.models import (
|
|
@@ -118,6 +126,7 @@ class VRFDeviceAssignmentTest(APIViewTestCases.APIViewTestCase):
|
|
|
118
126
|
def setUpTestData(cls):
|
|
119
127
|
cls.vrfs = VRF.objects.all()
|
|
120
128
|
cls.devices = Device.objects.all()
|
|
129
|
+
cls.vdcs = VirtualDeviceContext.objects.all()
|
|
121
130
|
locations = Location.objects.filter(location_type__name="Campus")
|
|
122
131
|
cluster_type = ClusterType.objects.create(name="Test Cluster Type")
|
|
123
132
|
clusters = (
|
|
@@ -154,25 +163,42 @@ class VRFDeviceAssignmentTest(APIViewTestCases.APIViewTestCase):
|
|
|
154
163
|
virtual_machine=cls.test_vm,
|
|
155
164
|
rd="65000:4",
|
|
156
165
|
)
|
|
166
|
+
VRFDeviceAssignment.objects.create(
|
|
167
|
+
vrf=cls.vrfs[0],
|
|
168
|
+
virtual_device_context=cls.vdcs[0],
|
|
169
|
+
name="VRFDeviceAssignment 1",
|
|
170
|
+
rd="65000:5",
|
|
171
|
+
)
|
|
172
|
+
VRFDeviceAssignment.objects.create(
|
|
173
|
+
vrf=cls.vrfs[0],
|
|
174
|
+
virtual_device_context=cls.vdcs[1],
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
cls.update_data = {
|
|
178
|
+
"name": "VRFDeviceAssignment 2",
|
|
179
|
+
"rd": "65000:7",
|
|
180
|
+
}
|
|
157
181
|
|
|
158
182
|
cls.create_data = [
|
|
159
183
|
{
|
|
160
184
|
"vrf": cls.vrfs[2].pk,
|
|
161
185
|
"device": cls.devices[4].pk,
|
|
162
|
-
"
|
|
163
|
-
"rd": "65000:4",
|
|
186
|
+
"rd": "65000:7",
|
|
164
187
|
},
|
|
165
188
|
{
|
|
166
189
|
"vrf": cls.vrfs[3].pk,
|
|
167
|
-
"device": None,
|
|
168
190
|
"virtual_machine": cls.test_vm.pk,
|
|
169
|
-
"rd": "65000:
|
|
191
|
+
"rd": "65000:8",
|
|
170
192
|
},
|
|
171
193
|
{
|
|
172
194
|
"vrf": cls.vrfs[4].pk,
|
|
173
195
|
"device": cls.devices[6].pk,
|
|
174
|
-
"
|
|
175
|
-
"rd": "65000:
|
|
196
|
+
"name": "VRFDeviceAssignment 3",
|
|
197
|
+
"rd": "65000:9",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"vrf": cls.vrfs[4].pk,
|
|
201
|
+
"virtual_device_context": cls.vdcs[0].pk,
|
|
176
202
|
},
|
|
177
203
|
]
|
|
178
204
|
cls.bulk_update_data = {
|
|
@@ -181,39 +207,66 @@ class VRFDeviceAssignmentTest(APIViewTestCases.APIViewTestCase):
|
|
|
181
207
|
|
|
182
208
|
def test_creating_invalid_vrf_device_assignments(self):
|
|
183
209
|
# Add object-level permission
|
|
184
|
-
duplicate_device_create_data = {
|
|
185
|
-
"vrf": self.vrfs[0].pk,
|
|
186
|
-
"device": self.devices[1].pk,
|
|
187
|
-
"virtual_machine": None,
|
|
188
|
-
"rd": "65000:6",
|
|
189
|
-
}
|
|
190
|
-
duplicate_vm_create_data = {
|
|
191
|
-
"vrf": self.vrfs[1].pk,
|
|
192
|
-
"device": None,
|
|
193
|
-
"virtual_machine": self.test_vm.pk,
|
|
194
|
-
"rd": "65000:6",
|
|
195
|
-
}
|
|
196
|
-
invalid_create_data = {
|
|
197
|
-
"vrf": self.vrfs[2].pk,
|
|
198
|
-
"device": self.devices[6].pk,
|
|
199
|
-
"virtual_machine": self.test_vm.pk,
|
|
200
|
-
"rd": "65000:6",
|
|
201
|
-
}
|
|
202
210
|
self.add_permissions("ipam.add_vrfdeviceassignment")
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
duplicate_create_data = [
|
|
212
|
+
{
|
|
213
|
+
"vrf": self.vrfs[0].pk,
|
|
214
|
+
"device": self.devices[1].pk,
|
|
215
|
+
"rd": "65000:6",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"vrf": self.vrfs[1].pk,
|
|
219
|
+
"virtual_machine": self.test_vm.pk,
|
|
220
|
+
"rd": "65000:6",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"vrf": self.vrfs[0].pk,
|
|
224
|
+
"virtual_device_context": self.vdcs[1].pk,
|
|
225
|
+
"rd": "65000:6",
|
|
226
|
+
},
|
|
227
|
+
]
|
|
228
|
+
expected_responses = [
|
|
229
|
+
"The fields device, vrf must make a unique set.",
|
|
230
|
+
"The fields virtual_machine, vrf must make a unique set.",
|
|
231
|
+
"The fields virtual_device_context, vrf must make a unique set.",
|
|
232
|
+
]
|
|
233
|
+
for i, data in enumerate(duplicate_create_data):
|
|
234
|
+
response = self.client.post(self._get_list_url(), data, format="json", **self.header)
|
|
235
|
+
self.assertContains(response, expected_responses[i], status_code=status.HTTP_400_BAD_REQUEST)
|
|
236
|
+
|
|
237
|
+
# Test VRFDeviceAssignment model clean() code paths
|
|
238
|
+
vrf = VRF.objects.create(name="New VRF ", namespace=Namespace.objects.first())
|
|
239
|
+
invalid_create_data = [
|
|
240
|
+
{
|
|
241
|
+
"vrf": vrf.pk,
|
|
242
|
+
"device": self.devices[6].pk,
|
|
243
|
+
"virtual_machine": self.test_vm.pk,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"vrf": vrf.pk,
|
|
247
|
+
"device": self.devices[7].pk,
|
|
248
|
+
"virtual_device_context": self.vdcs[2].pk,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"vrf": vrf.pk,
|
|
252
|
+
"virtual_machine": self.test_vm.pk,
|
|
253
|
+
"virtual_device_context": self.vdcs[3].pk,
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"vrf": vrf.pk,
|
|
257
|
+
"name": "VRFDeviceAssignment 5",
|
|
258
|
+
"rd": "65000:6",
|
|
259
|
+
},
|
|
260
|
+
]
|
|
261
|
+
expected_responses = [
|
|
262
|
+
"A VRFDeviceAssignment entry cannot be associated with both a device and a virtual machine.",
|
|
263
|
+
"A VRFDeviceAssignment entry cannot be associated with both a device and a virtual device context.",
|
|
264
|
+
"A VRFDeviceAssignment entry cannot be associated with both a virtual machine and a virtual device context.",
|
|
265
|
+
"A VRFDeviceAssignment entry must be associated with a device, a virtual machine, or a virtual device context.",
|
|
266
|
+
]
|
|
267
|
+
for i, data in enumerate(invalid_create_data):
|
|
268
|
+
response = self.client.post(self._get_list_url(), data, format="json", **self.header)
|
|
269
|
+
self.assertContains(response, expected_responses[i], status_code=status.HTTP_400_BAD_REQUEST)
|
|
217
270
|
|
|
218
271
|
|
|
219
272
|
class VRFPrefixAssignmentTest(APIViewTestCases.APIViewTestCase):
|
|
@@ -221,50 +274,38 @@ class VRFPrefixAssignmentTest(APIViewTestCases.APIViewTestCase):
|
|
|
221
274
|
|
|
222
275
|
@classmethod
|
|
223
276
|
def setUpTestData(cls):
|
|
277
|
+
cls.namespace = (
|
|
278
|
+
Namespace.objects.annotate(prefixes_count=Count("prefixes")).filter(prefixes_count__gte=3).first()
|
|
279
|
+
)
|
|
224
280
|
cls.vrfs = (
|
|
225
|
-
VRF.objects.
|
|
281
|
+
VRF.objects.create(name="TEST VRF 1", namespace=cls.namespace),
|
|
282
|
+
VRF.objects.create(name="TEST VRF 2", namespace=cls.namespace),
|
|
226
283
|
)
|
|
227
|
-
cls.prefixes = Prefix.objects.
|
|
284
|
+
cls.prefixes = Prefix.objects.filter(namespace=cls.namespace)
|
|
228
285
|
|
|
229
|
-
VRFPrefixAssignment.objects.create(
|
|
230
|
-
vrf=cls.vrfs[0],
|
|
231
|
-
prefix=cls.prefixes.filter(namespace=cls.vrfs[0].namespace)[0],
|
|
232
|
-
)
|
|
233
|
-
VRFPrefixAssignment.objects.create(
|
|
234
|
-
vrf=cls.vrfs[0],
|
|
235
|
-
prefix=cls.prefixes.filter(namespace=cls.vrfs[0].namespace)[1],
|
|
236
|
-
)
|
|
237
|
-
VRFPrefixAssignment.objects.create(
|
|
238
|
-
vrf=cls.vrfs[1],
|
|
239
|
-
prefix=cls.prefixes.filter(namespace=cls.vrfs[1].namespace)[0],
|
|
240
|
-
)
|
|
241
|
-
VRFPrefixAssignment.objects.create(
|
|
242
|
-
vrf=cls.vrfs[1],
|
|
243
|
-
prefix=cls.prefixes.filter(namespace=cls.vrfs[1].namespace)[1],
|
|
244
|
-
)
|
|
245
286
|
cls.create_data = [
|
|
246
287
|
{
|
|
247
|
-
"vrf": cls.vrfs[
|
|
248
|
-
"prefix": cls.prefixes.
|
|
288
|
+
"vrf": cls.vrfs[0].pk,
|
|
289
|
+
"prefix": cls.prefixes.first().pk,
|
|
249
290
|
},
|
|
250
291
|
{
|
|
251
|
-
"vrf": cls.vrfs[
|
|
252
|
-
"prefix": cls.prefixes.
|
|
292
|
+
"vrf": cls.vrfs[0].pk,
|
|
293
|
+
"prefix": cls.prefixes.last().pk,
|
|
253
294
|
},
|
|
254
295
|
{
|
|
255
|
-
"vrf": cls.vrfs[
|
|
256
|
-
"prefix": cls.prefixes.
|
|
296
|
+
"vrf": cls.vrfs[1].pk,
|
|
297
|
+
"prefix": cls.prefixes.first().pk,
|
|
257
298
|
},
|
|
258
299
|
]
|
|
259
300
|
|
|
260
301
|
def test_creating_invalid_vrf_prefix_assignments(self):
|
|
261
302
|
duplicate_create_data = {
|
|
262
|
-
"vrf":
|
|
263
|
-
"prefix":
|
|
303
|
+
"vrf": VRFPrefixAssignment.objects.first().vrf.pk,
|
|
304
|
+
"prefix": VRFPrefixAssignment.objects.first().prefix.pk,
|
|
264
305
|
}
|
|
265
306
|
wrong_namespace_create_data = {
|
|
266
307
|
"vrf": self.vrfs[0].pk,
|
|
267
|
-
"prefix":
|
|
308
|
+
"prefix": Prefix.objects.exclude(namespace=self.namespace)[0].pk,
|
|
268
309
|
}
|
|
269
310
|
missing_field_create_data = {
|
|
270
311
|
"vrf": self.vrfs[0].pk,
|
|
@@ -10,6 +10,7 @@ from nautobot.dcim.models import (
|
|
|
10
10
|
Location,
|
|
11
11
|
LocationType,
|
|
12
12
|
Manufacturer,
|
|
13
|
+
VirtualDeviceContext,
|
|
13
14
|
)
|
|
14
15
|
from nautobot.extras.models import Role, Status, Tag
|
|
15
16
|
from nautobot.ipam.choices import PrefixTypeChoices, ServiceProtocolChoices
|
|
@@ -24,7 +25,9 @@ from nautobot.ipam.filters import (
|
|
|
24
25
|
VLANFilterSet,
|
|
25
26
|
VLANGroupFilterSet,
|
|
26
27
|
VLANLocationAssignmentFilterSet,
|
|
28
|
+
VRFDeviceAssignmentFilterSet,
|
|
27
29
|
VRFFilterSet,
|
|
30
|
+
VRFPrefixAssignmentFilterSet,
|
|
28
31
|
)
|
|
29
32
|
from nautobot.ipam.models import (
|
|
30
33
|
IPAddress,
|
|
@@ -39,6 +42,8 @@ from nautobot.ipam.models import (
|
|
|
39
42
|
VLANGroup,
|
|
40
43
|
VLANLocationAssignment,
|
|
41
44
|
VRF,
|
|
45
|
+
VRFDeviceAssignment,
|
|
46
|
+
VRFPrefixAssignment,
|
|
42
47
|
)
|
|
43
48
|
from nautobot.tenancy.models import Tenant
|
|
44
49
|
from nautobot.virtualization.models import (
|
|
@@ -66,12 +71,19 @@ class VRFTestCase(FilterTestCases.FilterTestCase, FilterTestCases.TenancyFilterT
|
|
|
66
71
|
# skip testing "rd" attribute for generic q filter test as it's not trivially modifiable
|
|
67
72
|
exclude_q_filter_predicates = ["rd"]
|
|
68
73
|
generic_filter_tests = (
|
|
74
|
+
# ("device", "devices__id"),
|
|
75
|
+
# ("device", "devices__name"),
|
|
69
76
|
("export_targets", "export_targets__id"),
|
|
70
77
|
("export_targets", "export_targets__name"),
|
|
71
78
|
("import_targets", "import_targets__id"),
|
|
72
79
|
("import_targets", "import_targets__name"),
|
|
80
|
+
("prefix", "prefixes__id"),
|
|
73
81
|
("name",),
|
|
82
|
+
("namespace", "namespace__id"),
|
|
83
|
+
("namespace", "namespace__name"),
|
|
74
84
|
("rd",),
|
|
85
|
+
# ("virtual_machines", "virtual_machines__id"),
|
|
86
|
+
# ("virtual_machines", "virtual_machines__name"),
|
|
75
87
|
)
|
|
76
88
|
|
|
77
89
|
@classmethod
|
|
@@ -79,6 +91,36 @@ class VRFTestCase(FilterTestCases.FilterTestCase, FilterTestCases.TenancyFilterT
|
|
|
79
91
|
instance = cls.queryset.first()
|
|
80
92
|
instance.tags.set(Tag.objects.all()[:2])
|
|
81
93
|
|
|
94
|
+
def test_prefix_filter_by_string(self):
|
|
95
|
+
"""Test filtering by prefix strings as an alternative to pk."""
|
|
96
|
+
prefix = self.queryset.filter(prefixes__isnull=False).first().prefixes.first()
|
|
97
|
+
params = {"prefix": [prefix.prefix]}
|
|
98
|
+
self.assertQuerysetEqualAndNotEmpty(
|
|
99
|
+
self.filterset(params, self.queryset).qs,
|
|
100
|
+
self.queryset.filter(prefixes__network=prefix.network, prefixes__prefix_length=prefix.prefix_length),
|
|
101
|
+
ordered=False,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class VRFPrefixAssignmentTestCase(FilterTestCases.FilterTestCase):
|
|
106
|
+
queryset = VRFPrefixAssignment.objects.all()
|
|
107
|
+
filterset = VRFPrefixAssignmentFilterSet
|
|
108
|
+
generic_filter_tests = (
|
|
109
|
+
("prefix", "prefix__id"),
|
|
110
|
+
("vrf", "vrf__id"),
|
|
111
|
+
("vrf", "vrf__name"),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def test_prefix_filter_by_string(self):
|
|
115
|
+
"""Test filtering by prefix strings as an alternative to pk."""
|
|
116
|
+
prefix = self.queryset.first().prefix
|
|
117
|
+
params = {"prefix": [prefix.prefix]}
|
|
118
|
+
self.assertQuerysetEqualAndNotEmpty(
|
|
119
|
+
self.filterset(params, self.queryset).qs,
|
|
120
|
+
self.queryset.filter(prefix__network=prefix.network, prefix__prefix_length=prefix.prefix_length),
|
|
121
|
+
ordered=False,
|
|
122
|
+
)
|
|
123
|
+
|
|
82
124
|
|
|
83
125
|
class RouteTargetTestCase(FilterTestCases.FilterTestCase, FilterTestCases.TenancyFilterTestCaseMixin):
|
|
84
126
|
queryset = RouteTarget.objects.all()
|
|
@@ -190,15 +232,32 @@ class PrefixLocationAssignmentTestCase(FilterTestCases.FilterTestCase):
|
|
|
190
232
|
# )
|
|
191
233
|
|
|
192
234
|
def test_prefix(self):
|
|
193
|
-
ipv4_prefix =
|
|
194
|
-
ipv6_prefix =
|
|
235
|
+
ipv4_prefix = self.queryset.filter(prefix__ip_version=4).first().prefix
|
|
236
|
+
ipv6_prefix = self.queryset.filter(prefix__ip_version=6).first().prefix
|
|
237
|
+
|
|
238
|
+
params = {"prefix": [ipv4_prefix.prefix, ipv6_prefix.pk]}
|
|
239
|
+
|
|
240
|
+
self.assertQuerysetEqualAndNotEmpty(
|
|
241
|
+
self.filterset(params, self.queryset).qs,
|
|
242
|
+
self.queryset.filter(prefix=ipv6_prefix)
|
|
243
|
+
| self.queryset.filter(
|
|
244
|
+
prefix__network=ipv4_prefix.network,
|
|
245
|
+
prefix__prefix_length=ipv4_prefix.prefix_length,
|
|
246
|
+
prefix__broadcast=ipv4_prefix.broadcast,
|
|
247
|
+
),
|
|
248
|
+
ordered=False,
|
|
249
|
+
)
|
|
195
250
|
|
|
196
|
-
params = {"prefix": [ipv4_prefix, ipv6_prefix]}
|
|
197
|
-
prefix_queryset = Prefix.objects.net_equals(ipv4_prefix, ipv6_prefix)
|
|
251
|
+
params = {"prefix": [ipv4_prefix.pk, ipv6_prefix.prefix]}
|
|
198
252
|
|
|
199
253
|
self.assertQuerysetEqualAndNotEmpty(
|
|
200
254
|
self.filterset(params, self.queryset).qs,
|
|
201
|
-
self.queryset.filter(
|
|
255
|
+
self.queryset.filter(prefix=ipv4_prefix)
|
|
256
|
+
| self.queryset.filter(
|
|
257
|
+
prefix__network=ipv6_prefix.network,
|
|
258
|
+
prefix__prefix_length=ipv6_prefix.prefix_length,
|
|
259
|
+
prefix__broadcast=ipv6_prefix.broadcast,
|
|
260
|
+
),
|
|
202
261
|
ordered=False,
|
|
203
262
|
)
|
|
204
263
|
|
|
@@ -289,11 +348,21 @@ class PrefixFilterCustomDataTestCase(TestCase):
|
|
|
289
348
|
self.assertQuerysetEqualAndNotEmpty(
|
|
290
349
|
self.filterset(params, self.queryset).qs, self.queryset.filter(parent=parent4)
|
|
291
350
|
)
|
|
351
|
+
params = {"parent": ["10.0.0.0/16"]}
|
|
352
|
+
self.assertQuerysetEqualAndNotEmpty(
|
|
353
|
+
self.filterset(params, self.queryset).qs,
|
|
354
|
+
self.queryset.filter(parent__network="10.0.0.0", parent__prefix_length=16),
|
|
355
|
+
)
|
|
292
356
|
parent6 = Prefix.objects.get(prefix="2001:db8::/32", namespace=self.namespace)
|
|
293
357
|
params = {"parent": [str(parent6.pk)]}
|
|
294
358
|
self.assertQuerysetEqualAndNotEmpty(
|
|
295
359
|
self.filterset(params, self.queryset).qs, self.queryset.filter(parent=parent6)
|
|
296
360
|
)
|
|
361
|
+
params = {"parent": ["2001:db8::/32"]}
|
|
362
|
+
self.assertQuerysetEqualAndNotEmpty(
|
|
363
|
+
self.filterset(params, self.queryset).qs,
|
|
364
|
+
self.queryset.filter(parent__network="2001:db8::", parent__prefix_length=32),
|
|
365
|
+
)
|
|
297
366
|
|
|
298
367
|
def test_ip_version(self):
|
|
299
368
|
params = {"ip_version": "6"}
|
|
@@ -980,6 +1049,77 @@ class IPAddressToInterfaceTestCase(FilterTestCases.FilterTestCase):
|
|
|
980
1049
|
)
|
|
981
1050
|
|
|
982
1051
|
|
|
1052
|
+
class VRFDeviceAssignmentTestCase(FilterTestCases.FilterTestCase):
|
|
1053
|
+
queryset = VRFDeviceAssignment.objects.all()
|
|
1054
|
+
filterset = VRFDeviceAssignmentFilterSet
|
|
1055
|
+
generic_filter_tests = (
|
|
1056
|
+
["vrf", "vrf__id"],
|
|
1057
|
+
["vrf", "vrf__name"],
|
|
1058
|
+
["device", "device__id"],
|
|
1059
|
+
["device", "device__name"],
|
|
1060
|
+
["virtual_machine", "virtual_machine__id"],
|
|
1061
|
+
["virtual_machine", "virtual_machine__name"],
|
|
1062
|
+
["virtual_device_context", "virtual_device_context__id"],
|
|
1063
|
+
["virtual_device_context", "virtual_device_context__name"],
|
|
1064
|
+
["name"],
|
|
1065
|
+
["rd"],
|
|
1066
|
+
)
|
|
1067
|
+
|
|
1068
|
+
@classmethod
|
|
1069
|
+
def setUpTestData(cls):
|
|
1070
|
+
# Creating VRFDeviceAssignment instances manually until VRFFactory is enhanced to generate VRFDeviceAssignments
|
|
1071
|
+
cls.vrfs = VRF.objects.all()
|
|
1072
|
+
cls.devices = Device.objects.all()
|
|
1073
|
+
cls.vdcs = VirtualDeviceContext.objects.all()
|
|
1074
|
+
locations = Location.objects.filter(location_type__name="Campus")
|
|
1075
|
+
cluster_type = ClusterType.objects.create(name="Test Cluster Type")
|
|
1076
|
+
cluster = Cluster.objects.create(name="Cluster 1", cluster_type=cluster_type, location=locations[0])
|
|
1077
|
+
vm_status = Status.objects.get_for_model(VirtualMachine).first()
|
|
1078
|
+
vm_role = Role.objects.get_for_model(VirtualMachine).first()
|
|
1079
|
+
cls.test_vm_1 = VirtualMachine.objects.create(
|
|
1080
|
+
cluster=cluster,
|
|
1081
|
+
name="VM 1",
|
|
1082
|
+
role=vm_role,
|
|
1083
|
+
status=vm_status,
|
|
1084
|
+
)
|
|
1085
|
+
cls.test_vm_2 = VirtualMachine.objects.create(
|
|
1086
|
+
cluster=cluster,
|
|
1087
|
+
name="VM 2",
|
|
1088
|
+
role=vm_role,
|
|
1089
|
+
status=vm_status,
|
|
1090
|
+
)
|
|
1091
|
+
VRFDeviceAssignment.objects.create(
|
|
1092
|
+
vrf=cls.vrfs[0],
|
|
1093
|
+
device=cls.devices[0],
|
|
1094
|
+
rd="65000:1",
|
|
1095
|
+
)
|
|
1096
|
+
VRFDeviceAssignment.objects.create(
|
|
1097
|
+
vrf=cls.vrfs[0],
|
|
1098
|
+
device=cls.devices[1],
|
|
1099
|
+
rd="65000:2",
|
|
1100
|
+
)
|
|
1101
|
+
VRFDeviceAssignment.objects.create(
|
|
1102
|
+
vrf=cls.vrfs[0],
|
|
1103
|
+
virtual_machine=cls.test_vm_1,
|
|
1104
|
+
rd="65000:3",
|
|
1105
|
+
)
|
|
1106
|
+
VRFDeviceAssignment.objects.create(
|
|
1107
|
+
vrf=cls.vrfs[1],
|
|
1108
|
+
virtual_machine=cls.test_vm_2,
|
|
1109
|
+
rd="65000:4",
|
|
1110
|
+
)
|
|
1111
|
+
VRFDeviceAssignment.objects.create(
|
|
1112
|
+
vrf=cls.vrfs[0],
|
|
1113
|
+
virtual_device_context=cls.vdcs[0],
|
|
1114
|
+
name="VRFDeviceAssignment 1",
|
|
1115
|
+
rd="65000:5",
|
|
1116
|
+
)
|
|
1117
|
+
VRFDeviceAssignment.objects.create(
|
|
1118
|
+
vrf=cls.vrfs[0],
|
|
1119
|
+
virtual_device_context=cls.vdcs[1],
|
|
1120
|
+
)
|
|
1121
|
+
|
|
1122
|
+
|
|
983
1123
|
class VLANGroupTestCase(FilterTestCases.FilterTestCase):
|
|
984
1124
|
queryset = VLANGroup.objects.all()
|
|
985
1125
|
filterset = VLANGroupFilterSet
|
|
@@ -2,6 +2,7 @@ import datetime
|
|
|
2
2
|
import random
|
|
3
3
|
|
|
4
4
|
from django.contrib.contenttypes.models import ContentType
|
|
5
|
+
from django.db.models import Count
|
|
5
6
|
from django.test import override_settings
|
|
6
7
|
from django.urls import reverse
|
|
7
8
|
from django.utils.html import strip_tags
|
|
@@ -13,7 +14,15 @@ from nautobot.core.templatetags.helpers import hyperlinked_object, queryset_to_p
|
|
|
13
14
|
from nautobot.core.testing import ModelViewTestCase, post_data, ViewTestCases
|
|
14
15
|
from nautobot.core.testing.utils import extract_page_body
|
|
15
16
|
from nautobot.core.utils.lookup import get_route_for_model
|
|
16
|
-
from nautobot.dcim.models import
|
|
17
|
+
from nautobot.dcim.models import (
|
|
18
|
+
Device,
|
|
19
|
+
DeviceType,
|
|
20
|
+
Interface,
|
|
21
|
+
Location,
|
|
22
|
+
LocationType,
|
|
23
|
+
Manufacturer,
|
|
24
|
+
VirtualDeviceContext,
|
|
25
|
+
)
|
|
17
26
|
from nautobot.extras.choices import CustomFieldTypeChoices, RelationshipTypeChoices
|
|
18
27
|
from nautobot.extras.models import (
|
|
19
28
|
CustomField,
|
|
@@ -72,8 +81,9 @@ class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|
|
72
81
|
@classmethod
|
|
73
82
|
def setUpTestData(cls):
|
|
74
83
|
tenants = Tenant.objects.all()[:2]
|
|
75
|
-
namespace =
|
|
84
|
+
namespace = Namespace.objects.annotate(prefix_count=Count("prefixes")).filter(prefix_count__gt=2).first()
|
|
76
85
|
prefixes = Prefix.objects.filter(namespace=namespace)
|
|
86
|
+
vdcs = VirtualDeviceContext.objects.all()
|
|
77
87
|
vrf_statuses = Status.objects.get_for_model(VRF)
|
|
78
88
|
|
|
79
89
|
cls.form_data = {
|
|
@@ -85,6 +95,7 @@ class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|
|
85
95
|
"prefixes": [prefixes[1].id],
|
|
86
96
|
"tags": [t.pk for t in Tag.objects.get_for_model(VRF)],
|
|
87
97
|
"status": vrf_statuses.first().pk,
|
|
98
|
+
"virtual_device_contexts": [vdcs[0].id, vdcs[1].id],
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
cls.bulk_edit_data = {
|
|
@@ -94,6 +105,8 @@ class VRFTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|
|
94
105
|
"namespace": prefixes[0].namespace.id,
|
|
95
106
|
"add_prefixes": [prefixes[0].id],
|
|
96
107
|
"remove_prefixes": [prefixes[1].id],
|
|
108
|
+
"add_virtual_device_contexts": [vdcs[2].id, vdcs[3].id],
|
|
109
|
+
"remove_virtual_device_contexts": [vdcs[0].id],
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* bootstrap-filestyle
|
|
3
|
+
* doc: http://markusslima.github.io/bootstrap-filestyle/
|
|
4
|
+
* github: https://github.com/markusslima/bootstrap-filestyle
|
|
5
|
+
* fork additions: https://github.com/msheiny/bootstrap-filestyle
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2017 Markus Vinicius da Silva Lima
|
|
8
|
+
* Version 1.2.3
|
|
9
|
+
* Licensed under the MIT license.
|
|
10
|
+
*/
|
|
11
|
+
(function($){"use strict";var nextId=0;var Filestyle=function(element,options){this.options=options;this.$elementFilestyle=[];this.$element=$(element)};Filestyle.prototype={clear:function(){this.$element.val("");this.$elementFilestyle.find(":text").val("");this.$elementFilestyle.find(".badge").remove()},destroy:function(){this.$element.removeAttr("style").removeData("filestyle");this.$elementFilestyle.remove()},disabled:function(value){if(value===true){if(!this.options.disabled){this.$element.attr("disabled","true");this.$elementFilestyle.find("label").attr("disabled","true");this.options.disabled=true}}else if(value===false){if(this.options.disabled){this.$element.removeAttr("disabled");this.$elementFilestyle.find("label").removeAttr("disabled");this.options.disabled=false}}else{return this.options.disabled}},clearButton:function(value){if(value===true){if(!this.options.clearButton){this.options.clearButton=true;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else if(value===false){if(this.options.clearButton){this.options.clearButton=false;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else{return this.options.clearButton}},buttonBefore:function(value){if(value===true){if(!this.options.buttonBefore){this.options.buttonBefore=true;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else if(value===false){if(this.options.buttonBefore){this.options.buttonBefore=false;if(this.options.input){this.$elementFilestyle.remove();this.constructor();this.pushNameFiles()}}}else{return this.options.buttonBefore}},icon:function(value){if(value===true){if(!this.options.icon){this.options.icon=true;this.$elementFilestyle.find("label").prepend(this.htmlIcon())}}else if(value===false){if(this.options.icon){this.options.icon=false;this.$elementFilestyle.find(".icon-span-filestyle").remove()}}else{return this.options.icon}},input:function(value){if(value===true){if(!this.options.input){this.options.input=true;if(this.options.buttonBefore){this.$elementFilestyle.append(this.htmlInput())}else{this.$elementFilestyle.prepend(this.htmlInput())}this.$elementFilestyle.find(".badge").remove();this.pushNameFiles();this.$elementFilestyle.find(".group-span-filestyle").addClass("input-group-btn")}}else if(value===false){if(this.options.input){this.options.input=false;this.$elementFilestyle.find(":text").remove();var files=this.pushNameFiles();if(files.length>0&&this.options.badge){this.$elementFilestyle.find("label").append(' <span class="badge">'+files.length+"</span>")}this.$elementFilestyle.find(".group-span-filestyle").removeClass("input-group-btn")}}else{return this.options.input}},size:function(value){if(value!==undefined){var btn=this.$elementFilestyle.find("label"),input=this.$elementFilestyle.find("input");btn.removeClass("btn-lg btn-sm");input.removeClass("input-lg input-sm");if(value!="nr"){btn.addClass("btn-"+value);input.addClass("input-"+value)}}else{return this.options.size}},placeholder:function(value){if(value!==undefined){this.options.placeholder=value;this.$elementFilestyle.find("input").attr("placeholder",value)}else{return this.options.placeholder}},buttonText:function(value){if(value!==undefined){this.options.buttonText=value;this.$elementFilestyle.find("label .buttonText").html(this.options.buttonText)}else{return this.options.buttonText}},buttonName:function(value){if(value!==undefined){this.options.buttonName=value;this.$elementFilestyle.find("label").attr({class:"btn "+this.options.buttonName})}else{return this.options.buttonName}},iconName:function(value){if(value!==undefined){this.$elementFilestyle.find(".icon-span-filestyle").attr({class:"icon-span-filestyle "+this.options.iconName})}else{return this.options.iconName}},inputText:function(value){if(value!==undefined){this.options.inputText=value;this.$elementFilestyle.find("input").text(this.options.inputText)}else{return this.options.inputText}},htmlIcon:function(){if(this.options.icon){return'<span style="margin-right: 3px;" class="icon-span-filestyle '+this.options.iconName+'"></span> '}else{return""}},htmlInput:function(){if(this.options.input){return'<input type="text" class="form-control '+(this.options.size=="nr"?"":"input-"+this.options.size)+'" placeholder="'+this.options.placeholder+'" '+(this.options.inputText?'value="'+this.options.inputText+'" ':"")+'" disabled> '}else{return""}},pushNameFiles:function(){var content="",files=[];if(this.$element[0].files===undefined){files[0]={name:this.$element[0]&&this.$element[0].value}}else{files=this.$element[0].files}for(var i=0;i<files.length;i++){content+=files[i].name.split("\\").pop()+", "}if(content!==""){this.$elementFilestyle.find(":text").val(content.replace(/\, $/g,""));this.$elementFilestyle.find(".clear-button").removeClass("hidden")}else{this.$elementFilestyle.find(":text").val("");this.$elementFilestyle.find(".clear-button").addClass("hidden")}return files},constructor:function(){var _self=this,html="",id=_self.$element.attr("id"),files=[],btn="",clearBtn="",$label;if(id===""||!id){id="filestyle-"+nextId;_self.$element.attr({id:id});nextId++}btn='<span class="group-span-filestyle '+(_self.options.input?"input-group-btn":"")+'">'+'<label for="'+id+'" class="btn '+_self.options.buttonName+" "+(_self.options.size=="nr"?"":"btn-"+_self.options.size)+'" '+(_self.options.disabled?'disabled="true"':"")+">"+_self.htmlIcon()+'<span class="buttonText">'+_self.options.buttonText+"</span>"+"</label>"+"</span>";clearBtn=_self.options.clearButton?'<span class="input-group-btn"><button class="btn btn-default clear-button'+(_self.options.inputText?"":" hidden")+'" type="button">x</button></span>':"";html=_self.options.buttonBefore?btn+_self.htmlInput()+clearBtn:clearBtn+_self.htmlInput()+btn;_self.$elementFilestyle=$('<div class="bootstrap-filestyle input-group">'+html+"</div>");_self.$elementFilestyle.find(".group-span-filestyle").attr("tabindex","0").keypress(function(e){if(e.keyCode===13||e.charCode===32){_self.$elementFilestyle.find("label").click();return false}});_self.$element.css({position:"absolute",clip:"rect(0px 0px 0px 0px)"}).attr("tabindex","-1").after(_self.$elementFilestyle);if(_self.options.disabled||_self.$element.attr("disabled")){_self.$element.attr("disabled","true")}_self.$element.change(function(){var files=_self.pushNameFiles();if(_self.options.input==false&&_self.options.badge){if(_self.$elementFilestyle.find(".badge").length==0){_self.$elementFilestyle.find("label").append(' <span class="badge">'+files.length+"</span>")}else if(files.length==0){_self.$elementFilestyle.find(".badge").remove()}else{_self.$elementFilestyle.find(".badge").html(files.length)}}else{_self.$elementFilestyle.find(".badge").remove()}});if(window.navigator.userAgent.search(/firefox/i)>-1){_self.$elementFilestyle.find("label").click(function(){_self.$element.click();return false})}if(_self.options.clearButton){var $clearButton=_self.$elementFilestyle.find(".clear-button");$clearButton.on("click",function(e){var $input=_self.$element,input=$input[0];try{$input.val("");if(input.value){input.type="text";input.type="file"}$clearButton.addClass("hidden");$input.trigger("change")}catch(e){}})}}};var old=$.fn.filestyle;$.fn.filestyle=function(option,value){var get="",element=this.each(function(){if($(this).attr("type")==="file"){var $this=$(this),data=$this.data("filestyle"),options=$.extend({},$.fn.filestyle.defaults,option,typeof option==="object"&&option);if(!data){$this.data("filestyle",data=new Filestyle(this,options));data.constructor()}if(typeof option==="string"){get=data[option](value)}}});if(typeof get!==undefined){return get}else{return element}};$.fn.filestyle.defaults={buttonText:"Choose file",iconName:"glyphicon glyphicon-folder-open",buttonName:"btn-default",size:"nr",input:true,inputText:"",badge:true,icon:true,buttonBefore:false,disabled:false,clearButton:true};$.fn.filestyle.noConflict=function(){$.fn.filestyle=old;return this};$(function(){$(".filestyle").each(function(){var $this=$(this),options={input:$this.attr("data-input")!=="false",icon:$this.attr("data-icon")!=="false",buttonBefore:$this.attr("data-buttonBefore")==="true",disabled:$this.attr("data-disabled")==="true",size:$this.attr("data-size"),buttonText:$this.attr("data-buttonText"),buttonName:$this.attr("data-buttonName"),iconName:$this.attr("data-iconName"),badge:$this.attr("data-badge")!=="false",placeholder:$this.attr("data-placeholder")};$this.filestyle(options)})})})(window.jQuery);
|
|
@@ -1022,3 +1022,14 @@ a.tile.clickable:visited {
|
|
|
1022
1022
|
text-decoration: none;
|
|
1023
1023
|
background-color: #646464;
|
|
1024
1024
|
}
|
|
1025
|
+
|
|
1026
|
+
/* Monaco Editor container */
|
|
1027
|
+
.editor-container {
|
|
1028
|
+
display: flex; /* Use flexbox for layout */
|
|
1029
|
+
flex-direction: column;
|
|
1030
|
+
flex: 1; /* Allow container to grow */
|
|
1031
|
+
min-height: 100px;
|
|
1032
|
+
position: relative; /* Required for Monaco's absolute positioning */
|
|
1033
|
+
overflow: hidden; /* Let Monaco handle scrolling */
|
|
1034
|
+
}
|
|
1035
|
+
|
|
@@ -21,7 +21,8 @@ html[data-theme="dark"] .color-block, /* Colored choices, li
|
|
|
21
21
|
html[data-theme="dark"] .select2-selection__choice, /* Colored choices, like statuses */
|
|
22
22
|
html[data-theme="dark"] #select2-id_color-results, /* Colored choices, like statuses */
|
|
23
23
|
html[data-theme="dark"] #select2-id_color-container, /* Colored choices, like statuses */
|
|
24
|
-
html[data-theme="dark"] .hljs
|
|
24
|
+
html[data-theme="dark"] .hljs, /* highlight.js maintains its own dark theme */
|
|
25
|
+
html[data-theme="dark"] .editor-container { /* Monaco editor maintains its own dark theme */
|
|
25
26
|
filter: invert(1) hue-rotate(180deg);
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -9181,7 +9181,7 @@
|
|
|
9181
9181
|
<tr>
|
|
9182
9182
|
<td><img alt="Logo" src="../assets/app-icons/icon-NautobotPluginNornir.png" /></td>
|
|
9183
9183
|
<td><a href="https://docs.nautobot.com/projects/plugin-nornir/en/latest/">Nautobot Plugin Nornir</a></td>
|
|
9184
|
-
<td>Provides a small shim layer between <a href="https://github.com/nautobot/nornir-nautobot">nornir-nautobot</a> and other plugins. The primary abilities that the plugin provides are a native Nornir ORM based inventory and a credential manager.</td>
|
|
9184
|
+
<td>Provides a small shim layer between <a href="https://github.com/nautobot/nornir-nautobot"><code>nornir-nautobot</code></a> and other plugins. The primary abilities that the plugin provides are a native Nornir ORM based inventory and a credential manager.</td>
|
|
9185
9185
|
</tr>
|
|
9186
9186
|
<tr>
|
|
9187
9187
|
<td><img alt="Logo" src="../assets/app-icons/icon-SSoT.png" /></td>
|
|
@@ -9117,7 +9117,7 @@
|
|
|
9117
9117
|
|
|
9118
9118
|
<h1 id="nautobot-community-apps">Nautobot Community Apps<a class="headerlink" href="#nautobot-community-apps" title="Permanent link">¶</a></h1>
|
|
9119
9119
|
<p>The following is a manually curated list of Apps from the wider Nautobot community, which have some sort of documentation.</p>
|
|
9120
|
-
<!-- pyml disable-num-lines 4 no-inline-html -->
|
|
9120
|
+
<!-- pyml disable-num-lines 4 no-inline-html,proper-names -->
|
|
9121
9121
|
<table>
|
|
9122
9122
|
<thead>
|
|
9123
9123
|
<tr>
|
|
@@ -7487,6 +7487,15 @@
|
|
|
7487
7487
|
</span>
|
|
7488
7488
|
</a>
|
|
7489
7489
|
|
|
7490
|
+
</li>
|
|
7491
|
+
|
|
7492
|
+
<li class="md-nav__item">
|
|
7493
|
+
<a href="#nautobot.apps.filters.PrefixFilter" class="md-nav__link">
|
|
7494
|
+
<span class="md-ellipsis">
|
|
7495
|
+
PrefixFilter
|
|
7496
|
+
</span>
|
|
7497
|
+
</a>
|
|
7498
|
+
|
|
7490
7499
|
</li>
|
|
7491
7500
|
|
|
7492
7501
|
<li class="md-nav__item">
|
|
@@ -9724,6 +9733,15 @@
|
|
|
9724
9733
|
</span>
|
|
9725
9734
|
</a>
|
|
9726
9735
|
|
|
9736
|
+
</li>
|
|
9737
|
+
|
|
9738
|
+
<li class="md-nav__item">
|
|
9739
|
+
<a href="#nautobot.apps.filters.PrefixFilter" class="md-nav__link">
|
|
9740
|
+
<span class="md-ellipsis">
|
|
9741
|
+
PrefixFilter
|
|
9742
|
+
</span>
|
|
9743
|
+
</a>
|
|
9744
|
+
|
|
9727
9745
|
</li>
|
|
9728
9746
|
|
|
9729
9747
|
<li class="md-nav__item">
|
|
@@ -10755,6 +10773,50 @@ are needed.</p>
|
|
|
10755
10773
|
|
|
10756
10774
|
|
|
10757
10775
|
|
|
10776
|
+
</div>
|
|
10777
|
+
|
|
10778
|
+
</div>
|
|
10779
|
+
|
|
10780
|
+
</div>
|
|
10781
|
+
|
|
10782
|
+
<div class="doc doc-object doc-class">
|
|
10783
|
+
|
|
10784
|
+
|
|
10785
|
+
|
|
10786
|
+
<h2 id="nautobot.apps.filters.PrefixFilter" class="doc doc-heading">
|
|
10787
|
+
<code>nautobot.apps.filters.PrefixFilter</code>
|
|
10788
|
+
|
|
10789
|
+
|
|
10790
|
+
<a href="#nautobot.apps.filters.PrefixFilter" class="headerlink" title="Permanent link">¶</a></h2>
|
|
10791
|
+
|
|
10792
|
+
|
|
10793
|
+
<div class="doc doc-contents ">
|
|
10794
|
+
<p class="doc doc-class-bases">
|
|
10795
|
+
Bases: <code><a class="autorefs autorefs-internal" title="nautobot.core.filters.NaturalKeyOrPKMultipleChoiceFilter" href="#nautobot.apps.filters.NaturalKeyOrPKMultipleChoiceFilter">NaturalKeyOrPKMultipleChoiceFilter</a></code></p>
|
|
10796
|
+
|
|
10797
|
+
|
|
10798
|
+
<p>Filter that supports filtering a foreign key to Prefix by either its PK or by a literal <code>prefix</code> string.</p>
|
|
10799
|
+
|
|
10800
|
+
|
|
10801
|
+
|
|
10802
|
+
|
|
10803
|
+
|
|
10804
|
+
|
|
10805
|
+
|
|
10806
|
+
|
|
10807
|
+
|
|
10808
|
+
<div class="doc doc-children">
|
|
10809
|
+
|
|
10810
|
+
|
|
10811
|
+
|
|
10812
|
+
|
|
10813
|
+
|
|
10814
|
+
|
|
10815
|
+
|
|
10816
|
+
|
|
10817
|
+
|
|
10818
|
+
|
|
10819
|
+
|
|
10758
10820
|
</div>
|
|
10759
10821
|
|
|
10760
10822
|
</div>
|