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
|
@@ -9204,14 +9204,14 @@
|
|
|
9204
9204
|
<li>Steps to Migrate an App from V1<ul>
|
|
9205
9205
|
<li>Preliminary Steps:<ul>
|
|
9206
9206
|
<li>Add <a href="https://github.com/nautobot/pylint-nautobot"><code>pylint-nautobot</code></a> as a development dependency</li>
|
|
9207
|
-
<li>Run <code>pylint -v --disable=all --enable=nautobot-code-location-changes,nautobot-replaced-models *</code> in order to parse your development environment for changes that need to be fixed before pylint-django can successfully run.</li>
|
|
9207
|
+
<li>Run <code>pylint -v --disable=all --enable=nautobot-code-location-changes,nautobot-replaced-models *</code> in order to parse your development environment for changes that need to be fixed before <code>pylint-django</code> can successfully run.</li>
|
|
9208
9208
|
<li>Specific steps to install and run <code>pylint-nautobot</code> in your development environment is available <a href="https://docs.nautobot.com/projects/pylint-nautobot/en/latest/getting_started/">here</a></li>
|
|
9209
9209
|
</ul>
|
|
9210
9210
|
</li>
|
|
9211
9211
|
<li><a href="dependency-updates.html">Dependency Updates</a><ul>
|
|
9212
9212
|
<li><a href="dependency-updates.html#nautobot-version">Nautobot Version</a></li>
|
|
9213
9213
|
<li><a href="dependency-updates.html#python-version">Python Version</a></li>
|
|
9214
|
-
<li><a href="dependency-updates.html#pylint-nautobot">pylint-nautobot</a></li>
|
|
9214
|
+
<li><a href="dependency-updates.html#pylint-nautobot"><code>pylint-nautobot</code></a></li>
|
|
9215
9215
|
</ul>
|
|
9216
9216
|
</li>
|
|
9217
9217
|
<li><a href="code-updates.html">Code Updates</a><ul>
|
|
@@ -9220,7 +9220,7 @@
|
|
|
9220
9220
|
<li><a href="code-updates.html#remove-tagtags-filter-from-filterset-definitions">Remove Tag/Tags Filter Field from FilterSet Definitions</a></li>
|
|
9221
9221
|
<li><a href="code-updates.html#replace-djangofilterbackend-with-nautobotfilterbackend">Replace DjangoFilterBackend with NautobotFilterBackend</a></li>
|
|
9222
9222
|
<li><a href="code-updates.html#app-model-serializer-inheritance">App Model Serializer Inheritance</a></li>
|
|
9223
|
-
<li><a href="code-updates.html#revamp-rest-api-serializers">Revamp
|
|
9223
|
+
<li><a href="code-updates.html#revamp-rest-api-serializers">Revamp REST API Serializers</a></li>
|
|
9224
9224
|
<li><a href="code-updates.html#revamp-csv-import-and-export">Revamp CSV Import and Export</a></li>
|
|
9225
9225
|
</ul>
|
|
9226
9226
|
</li>
|
|
@@ -9370,9 +9370,6 @@
|
|
|
9370
9370
|
</code></pre></div>
|
|
9371
9371
|
<p>Apps may extend this dictionary with additional data sources and/or data types by calling <code>extras.registry.register_datasource_contents()</code> as desired.</p>
|
|
9372
9372
|
<h3 id="homepage_layout"><code>homepage_layout</code><a class="headerlink" href="#homepage_layout" title="Permanent link">¶</a></h3>
|
|
9373
|
-
<details class="version-added">
|
|
9374
|
-
<summary>Added in version 1.2.0</summary>
|
|
9375
|
-
</details>
|
|
9376
9373
|
<p>A dictionary holding information about the layout of Nautobot's homepage. Each app may register homepage panels and items using objects from the generic app class. Each object has a weight attribute allowing the developer to define the position of the object.</p>
|
|
9377
9374
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="p">{</span>
|
|
9378
9375
|
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a> <span class="s2">"panels"</span><span class="p">:</span> <span class="p">{</span>
|
|
@@ -9445,9 +9442,6 @@
|
|
|
9445
9442
|
</code></pre></div>
|
|
9446
9443
|
<p>For more information visit <a href="model-features.html">model-features</a>.</p>
|
|
9447
9444
|
<h3 id="nav_menu"><code>nav_menu</code><a class="headerlink" href="#nav_menu" title="Permanent link">¶</a></h3>
|
|
9448
|
-
<details class="version-added">
|
|
9449
|
-
<summary>Added in version 1.1.0</summary>
|
|
9450
|
-
</details>
|
|
9451
9445
|
<p>Navigation menu items provided by Nautobot applications. Each app may register its navbar configuration inside of the <code>nav_menu</code> dictionary using <code>navigation.py</code>. Tabs are stored in the top level moving down to groups, items and buttons. Tabs, groups and items can be modified by using the key values inside other core applications and Apps. The <code>nav_menu</code> dict should never be modified directly.</p>
|
|
9452
9446
|
<p>Example:</p>
|
|
9453
9447
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="p">{</span>
|
|
@@ -8333,15 +8333,6 @@
|
|
|
8333
8333
|
</ul>
|
|
8334
8334
|
</nav>
|
|
8335
8335
|
|
|
8336
|
-
</li>
|
|
8337
|
-
|
|
8338
|
-
<li class="md-nav__item">
|
|
8339
|
-
<a href="#using-nautobotuiviewset-for-app-development" class="md-nav__link">
|
|
8340
|
-
<span class="md-ellipsis">
|
|
8341
|
-
Using NautobotUIViewSet for App Development
|
|
8342
|
-
</span>
|
|
8343
|
-
</a>
|
|
8344
|
-
|
|
8345
8336
|
</li>
|
|
8346
8337
|
|
|
8347
8338
|
</ul>
|
|
@@ -9578,15 +9569,6 @@
|
|
|
9578
9569
|
</ul>
|
|
9579
9570
|
</nav>
|
|
9580
9571
|
|
|
9581
|
-
</li>
|
|
9582
|
-
|
|
9583
|
-
<li class="md-nav__item">
|
|
9584
|
-
<a href="#using-nautobotuiviewset-for-app-development" class="md-nav__link">
|
|
9585
|
-
<span class="md-ellipsis">
|
|
9586
|
-
Using NautobotUIViewSet for App Development
|
|
9587
|
-
</span>
|
|
9588
|
-
</a>
|
|
9589
|
-
|
|
9590
9572
|
</li>
|
|
9591
9573
|
|
|
9592
9574
|
</ul>
|
|
@@ -9761,10 +9743,6 @@ For most purposes, this is not the case you are intending to check!</p>
|
|
|
9761
9743
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="kn">from</span> <span class="nn">nautobot.core.utils.lookup</span> <span class="kn">import</span> <span class="n">get_route_for_model</span>
|
|
9762
9744
|
</code></pre></div>
|
|
9763
9745
|
<p>This utility function supports both UI and API views for both Nautobot core apps and Nautobot Apps.</p>
|
|
9764
|
-
<details class="version-added">
|
|
9765
|
-
<summary>Added in version 1.4.3</summary>
|
|
9766
|
-
<p>Support for generating API routes was added to <code>get_route_for_model()</code> by passing the argument <code>api=True</code>.</p>
|
|
9767
|
-
</details>
|
|
9768
9746
|
<h3 id="ui-routes">UI Routes<a class="headerlink" href="#ui-routes" title="Permanent link">¶</a></h3>
|
|
9769
9747
|
<p>Instead of:</p>
|
|
9770
9748
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="n">route</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">model</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">app_label</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">model</span><span class="o">.</span><span class="n">_meta</span><span class="o">.</span><span class="n">model_name</span><span class="si">}</span><span class="s2">_list"</span>
|
|
@@ -9993,7 +9971,7 @@ For most purposes, this is not the case you are intending to check!</p>
|
|
|
9993
9971
|
<a id="__codelineno-22-11" name="__codelineno-22-11" href="#__codelineno-22-11"></a> <span class="nb">breakpoint</span><span class="p">()</span> <span class="c1"># This was added to illustrate debugging with pdb below</span>
|
|
9994
9972
|
<a id="__codelineno-22-12" name="__codelineno-22-12" href="#__codelineno-22-12"></a> <span class="k">return</span> <span class="n">queryset</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">frontports__isnull</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">rearports__isnull</span><span class="o">=</span><span class="n">value</span><span class="p">)</span>
|
|
9995
9973
|
</code></pre></div>
|
|
9996
|
-
<p>The default <code>lookup_expr</code> unless otherwise specified is “exact”, as seen in <a href="https://github.com/carltongibson/django-filter/blob/main/django_filters/conf.py#L10">django_filters.conf</a
|
|
9974
|
+
<p>The default <code>lookup_expr</code> unless otherwise specified is “exact”, as seen in the <a href="https://github.com/carltongibson/django-filter/blob/main/django_filters/conf.py#L10"><code>django_filters.conf</code></a> module:</p>
|
|
9997
9975
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-23-1" name="__codelineno-23-1" href="#__codelineno-23-1"></a> <span class="s1">'DEFAULT_LOOKUP_EXPR'</span><span class="p">:</span> <span class="s1">'exact'</span><span class="p">,</span>
|
|
9998
9976
|
</code></pre></div>
|
|
9999
9977
|
<p>When this method is called, the internal state is default, making reverse introspection impossible, because the <code>lookup_expr</code> is defaulting to “exact”:</p>
|
|
@@ -10054,11 +10032,6 @@ For most purposes, this is not the case you are intending to check!</p>
|
|
|
10054
10032
|
<li>For exceptions such as <code>DeviceFilterSet.has_primary_ip</code> where it checks for both <code>Device.primary_ip4</code> OR <code>Device.primary_ip6</code>, method filters may still be necessary, however, they would be <strong>the exception and not the norm.</strong></li>
|
|
10055
10033
|
<li>The good news is that in the core there are not that many of these filter methods defined, but we also don’t want to see them continue to proliferate.</li>
|
|
10056
10034
|
</ul>
|
|
10057
|
-
<h2 id="using-nautobotuiviewset-for-app-development">Using NautobotUIViewSet for App Development<a class="headerlink" href="#using-nautobotuiviewset-for-app-development" title="Permanent link">¶</a></h2>
|
|
10058
|
-
<details class="version-added">
|
|
10059
|
-
<summary>Added in version 1.4.0</summary>
|
|
10060
|
-
<p>Using <code>NautobotUIViewSet</code> for <a href="../apps/api/views/nautobotuiviewset.html">App development</a> is strongly recommended.</p>
|
|
10061
|
-
</details>
|
|
10062
10035
|
|
|
10063
10036
|
|
|
10064
10037
|
|
|
@@ -9213,7 +9213,7 @@
|
|
|
9213
9213
|
|
|
9214
9214
|
<h1 id="developing-the-bootstrap-3-ui">Developing the Bootstrap 3 UI<a class="headerlink" href="#developing-the-bootstrap-3-ui" title="Permanent link">¶</a></h1>
|
|
9215
9215
|
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">¶</a></h2>
|
|
9216
|
-
<p>Nautobot's current primary UI is based on <a href="https://getbootstrap.com/docs/3.4/">Bootstrap 3</a>. Since Nautobot 2.1.0, this UI has used a Nautobot-specific custom Bootstrap theme built in the <a href="https://github.com/nautobot/nautobot-bootstrap/">nautobot-bootstrap</a> GitHub repository and then customized further in the main <a href="https://github.com/nautobot/nautobot/">nautobot</a> GitHub repository.</p>
|
|
9216
|
+
<p>Nautobot's current primary UI is based on <a href="https://getbootstrap.com/docs/3.4/">Bootstrap 3</a>. Since Nautobot 2.1.0, this UI has used a Nautobot-specific custom Bootstrap theme built in the <a href="https://github.com/nautobot/nautobot-bootstrap/"><code>nautobot-bootstrap</code></a> GitHub repository and then customized further in the main <a href="https://github.com/nautobot/nautobot/"><code>nautobot</code></a> GitHub repository.</p>
|
|
9217
9217
|
<h2 id="theme-files">Theme Files<a class="headerlink" href="#theme-files" title="Permanent link">¶</a></h2>
|
|
9218
9218
|
<ul>
|
|
9219
9219
|
<li><code>nautobot/project-static/bootstrap-3.4.1-dist/css/</code> - the base Nautobot-themed Bootstrap CSS definitions, directly as compiled from <code>nautobot-bootstrap</code>. <em>These should never be edited manually, only recompiled from <code>nautobot-bootstrap</code> and copied as-is into <code>nautobot</code>.</em></li>
|
|
@@ -8208,6 +8208,30 @@
|
|
|
8208
8208
|
</span>
|
|
8209
8209
|
</a>
|
|
8210
8210
|
|
|
8211
|
+
<nav class="md-nav" aria-label="Remote Debugging Configuration">
|
|
8212
|
+
<ul class="md-nav__list">
|
|
8213
|
+
|
|
8214
|
+
<li class="md-nav__item">
|
|
8215
|
+
<a href="#running-inside-the-nautobot-workspace" class="md-nav__link">
|
|
8216
|
+
<span class="md-ellipsis">
|
|
8217
|
+
Running inside the Nautobot workspace
|
|
8218
|
+
</span>
|
|
8219
|
+
</a>
|
|
8220
|
+
|
|
8221
|
+
</li>
|
|
8222
|
+
|
|
8223
|
+
<li class="md-nav__item">
|
|
8224
|
+
<a href="#adding-nautobot-folder-to-an-existing-workspace" class="md-nav__link">
|
|
8225
|
+
<span class="md-ellipsis">
|
|
8226
|
+
Adding Nautobot folder to an existing workspace
|
|
8227
|
+
</span>
|
|
8228
|
+
</a>
|
|
8229
|
+
|
|
8230
|
+
</li>
|
|
8231
|
+
|
|
8232
|
+
</ul>
|
|
8233
|
+
</nav>
|
|
8234
|
+
|
|
8211
8235
|
</li>
|
|
8212
8236
|
|
|
8213
8237
|
</ul>
|
|
@@ -9450,6 +9474,30 @@
|
|
|
9450
9474
|
</span>
|
|
9451
9475
|
</a>
|
|
9452
9476
|
|
|
9477
|
+
<nav class="md-nav" aria-label="Remote Debugging Configuration">
|
|
9478
|
+
<ul class="md-nav__list">
|
|
9479
|
+
|
|
9480
|
+
<li class="md-nav__item">
|
|
9481
|
+
<a href="#running-inside-the-nautobot-workspace" class="md-nav__link">
|
|
9482
|
+
<span class="md-ellipsis">
|
|
9483
|
+
Running inside the Nautobot workspace
|
|
9484
|
+
</span>
|
|
9485
|
+
</a>
|
|
9486
|
+
|
|
9487
|
+
</li>
|
|
9488
|
+
|
|
9489
|
+
<li class="md-nav__item">
|
|
9490
|
+
<a href="#adding-nautobot-folder-to-an-existing-workspace" class="md-nav__link">
|
|
9491
|
+
<span class="md-ellipsis">
|
|
9492
|
+
Adding Nautobot folder to an existing workspace
|
|
9493
|
+
</span>
|
|
9494
|
+
</a>
|
|
9495
|
+
|
|
9496
|
+
</li>
|
|
9497
|
+
|
|
9498
|
+
</ul>
|
|
9499
|
+
</nav>
|
|
9500
|
+
|
|
9453
9501
|
</li>
|
|
9454
9502
|
|
|
9455
9503
|
</ul>
|
|
@@ -9486,6 +9534,7 @@
|
|
|
9486
9534
|
<li><code>compose_dir</code>: the full path to the directory containing the Docker Compose YAML files (default: <code>"<nautobot source directory>/development"</code>)</li>
|
|
9487
9535
|
<li><code>compose_files</code>: the Docker Compose YAML file(s) to use (default: <code>["docker-compose.yml", "docker-compose.postgres.yml", "docker-compose.dev.yml"]</code>)</li>
|
|
9488
9536
|
<li><code>docker_image_names_main</code> and <code>docker_image_names_develop</code>: Used when <a href="release-checklist.html#publish-docker-images">building Docker images for publication</a>; you shouldn't generally need to change these.</li>
|
|
9537
|
+
<li><code>ephemeral_ports</code>: Setting this value to <code>True</code> will make all Nautobot containers with published ports expose themselves with dynamic ports. This is useful when running multiple Nautobot versions at the same time on the same machine so you won't experience system port conflicts.</li>
|
|
9489
9538
|
</ul>
|
|
9490
9539
|
<p>These setting may be overridden several different ways (from highest to lowest precedence):</p>
|
|
9491
9540
|
<ul>
|
|
@@ -9580,11 +9629,11 @@
|
|
|
9580
9629
|
<p>Once all steps are completed Nautobot should now have the <code>Continue to SSO</code> button on the login screen and should immediately redirect the user to sign in with Keycloak.</p>
|
|
9581
9630
|
<h4 id="keycloak-login-credentials">Keycloak Login Credentials<a class="headerlink" href="#keycloak-login-credentials" title="Permanent link">¶</a></h4>
|
|
9582
9631
|
<p>Keycloak admin console is reachable via <code>http://localhost:8087/admin/</code> with user <code>admin</code> and password <code>admin</code>. The below users are pre-configured within Keycloak, at this time their permissions are not directly mapped to any permissions provided by default by Nautobot. This will be a later enhancement to the local development environment.</p>
|
|
9583
|
-
<p>| Username
|
|
9584
|
-
|
|
9585
|
-
| nautobot_unpriv | unpriv123 |
|
|
9586
|
-
| nautobot_admin | admin123 |
|
|
9587
|
-
| nautobot_auditor | audit123 |</p>
|
|
9632
|
+
<p>| Username | Password |
|
|
9633
|
+
+--------------------+-------------+
|
|
9634
|
+
| <code>nautobot_unpriv</code> | <code>unpriv123</code> |
|
|
9635
|
+
| <code>nautobot_admin</code> | <code>admin123</code> |
|
|
9636
|
+
| <code>nautobot_auditor</code> | <code>audit123</code> |</p>
|
|
9588
9637
|
<h2 id="microsoft-visual-studio-code-integration">Microsoft Visual Studio Code Integration<a class="headerlink" href="#microsoft-visual-studio-code-integration" title="Permanent link">¶</a></h2>
|
|
9589
9638
|
<p>For users of Microsoft Visual Studio Code, several files are included to ease development and integrate with the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers">VS Code Remote - Containers extension</a>. The following related files are found relative to the root of the project:</p>
|
|
9590
9639
|
<ul>
|
|
@@ -9596,7 +9645,7 @@
|
|
|
9596
9645
|
<details class="version-changed">
|
|
9597
9646
|
<summary>Changed in version 2.1.2</summary>
|
|
9598
9647
|
</details>
|
|
9599
|
-
<h4 id="python_ver-environment-variable">PYTHON_VER Environment Variable<a class="headerlink" href="#python_ver-environment-variable" title="Permanent link">¶</a></h4>
|
|
9648
|
+
<h4 id="python_ver-environment-variable"><code>PYTHON_VER</code> Environment Variable<a class="headerlink" href="#python_ver-environment-variable" title="Permanent link">¶</a></h4>
|
|
9600
9649
|
<p>The <code>PYTHON_VER</code> environment variable must be set in the <code>development/.env</code> file or the container build will fail.</p>
|
|
9601
9650
|
<p>You can run <code>invoke</code> with the <code>vscode</code> target to generate this file and re-open the VSCode session under the workspace.</p>
|
|
9602
9651
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a>invoke<span class="w"> </span>vscode
|
|
@@ -9621,8 +9670,13 @@
|
|
|
9621
9670
|
<li>As a last step open the folder <code>/opt/nautobot</code> in VS Code.</li>
|
|
9622
9671
|
</ul>
|
|
9623
9672
|
<h3 id="remote-debugging-configuration">Remote Debugging Configuration<a class="headerlink" href="#remote-debugging-configuration" title="Permanent link">¶</a></h3>
|
|
9624
|
-
<p>Using the Remote-Attach functionality of VS Code debugger is an alternative to debugging in a development container. This allows a local VS Code instance to connect to a remote container and debug the code running in the container the same way as when debugging locally
|
|
9625
|
-
<p>Follow the
|
|
9673
|
+
<p>Using the <a href="https://code.visualstudio.com/docs/python/debugging#_debugging-by-attaching-over-a-network-connection">Remote-Attach functionality of VS Code</a> debugger is an alternative to debugging in a development container. This allows a local VS Code instance to connect to a remote container and debug the code running in the container the same way as when debugging locally. To learn more about debugging in VSCode, please <a href="https://code.visualstudio.com/docs/editor/debugging">follow the official docs</a>.</p>
|
|
9674
|
+
<p>Follow either of the options below to configure VS Code to debug Nautobot and Celery Worker running in a remote container:</p>
|
|
9675
|
+
<h4 id="running-inside-the-nautobot-workspace">Running inside the Nautobot workspace<a class="headerlink" href="#running-inside-the-nautobot-workspace" title="Permanent link">¶</a></h4>
|
|
9676
|
+
<p>If you have opened the project via the workspace file <code>nautobot.code-workspace</code> then there are two debug configurations for remote debugging available. These can be run via one of the debug tasks:
|
|
9677
|
+
- <code>Python: Nautobot (Remote)</code> or
|
|
9678
|
+
- <code>Python: Nautobot-Celery (Remote)</code></p>
|
|
9679
|
+
<h4 id="adding-nautobot-folder-to-an-existing-workspace">Adding Nautobot folder to an existing workspace<a class="headerlink" href="#adding-nautobot-folder-to-an-existing-workspace" title="Permanent link">¶</a></h4>
|
|
9626
9680
|
<ol>
|
|
9627
9681
|
<li>
|
|
9628
9682
|
<p><strong>Configure <code>invoke.yml</code> to use the <code>docker-compose.vscode-rdb.yml</code> file.</strong></p>
|
|
@@ -9643,7 +9697,7 @@
|
|
|
9643
9697
|
<p><strong>VS Code debug configuration.</strong></p>
|
|
9644
9698
|
<p>If you have opened the workspace file <code>nautobot.code-workspace</code> then there are two debug
|
|
9645
9699
|
configurations for remote debugging already available.</p>
|
|
9646
|
-
<p>If you add nautobot to an existing VS Code workspace (Menu: <em>File > Add Folder to Workspace...</em>)
|
|
9700
|
+
<p>If you add <code>nautobot</code> to an existing VS Code workspace (Menu: <em>File > Add Folder to Workspace...</em>)
|
|
9647
9701
|
then copy the <code>launch:</code> values to the <code>.vscode/launch.json</code> file.</p>
|
|
9648
9702
|
<ul>
|
|
9649
9703
|
<li>Debug Configurations for Remote Debugging:</li>
|
|
@@ -9662,10 +9716,10 @@ then copy the <code>launch:</code> values to the <code>.vscode/launch.json</code
|
|
|
9662
9716
|
<a id="__codelineno-9-12" name="__codelineno-9-12" href="#__codelineno-9-12"></a><span class="w"> </span><span class="p">]</span>
|
|
9663
9717
|
<a id="__codelineno-9-13" name="__codelineno-9-13" href="#__codelineno-9-13"></a><span class="p">}</span>
|
|
9664
9718
|
</code></pre></div>
|
|
9665
|
-
</li>
|
|
9666
|
-
</ol>
|
|
9667
9719
|
<p>It is now possible to debug the containerized Nautobot and Celery Worker using the VS Code debugger.</p>
|
|
9668
9720
|
<p>After restarting the Celery-Worker container you need to restart the debug session.</p>
|
|
9721
|
+
</li>
|
|
9722
|
+
</ol>
|
|
9669
9723
|
|
|
9670
9724
|
|
|
9671
9725
|
|
|
@@ -10359,10 +10359,6 @@
|
|
|
10359
10359
|
<p>You may install Poetry in your user environment by running:</p>
|
|
10360
10360
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-15-1" name="__codelineno-15-1" href="#__codelineno-15-1"></a>curl -sSL https://install.python-poetry.org | python3 -
|
|
10361
10361
|
</code></pre></div>
|
|
10362
|
-
<details class="version-changed">
|
|
10363
|
-
<summary>Changed in version 1.5.6</summary>
|
|
10364
|
-
<p>Poetry 1.3+ is required to be able to install packages against the latest lockfile.</p>
|
|
10365
|
-
</details>
|
|
10366
10362
|
<div class="admonition danger">
|
|
10367
10363
|
<p class="admonition-title">Danger</p>
|
|
10368
10364
|
<p>Always utilize this documented method to install Poetry for use when developing Nautobot.</p>
|
|
@@ -10549,10 +10545,10 @@
|
|
|
10549
10545
|
<p>Do not use <code>poetry run nautobot-server runserver</code> as it will crash unless you also pass the <code>--noreload</code> flag, which somewhat defeats the purpose of using the development server. It is recommended to use <code>nautobot-server runserver</code> from within an active virtualenv (e.g. <code>poetry shell</code>). This is a <a href="https://github.com/python-poetry/poetry/issues/2435">known issue with Django and Poetry</a>.</p>
|
|
10550
10546
|
</div>
|
|
10551
10547
|
<p>Please see the <a href="https://docs.djangoproject.com/en/stable/ref/django-admin/#runserver">official Django documentation on <code>runserver</code></a> for more information.</p>
|
|
10552
|
-
<p>You can connect to the development server at <code>localhost:8080</code
|
|
10548
|
+
<p>You can connect to the development server in your local web browser at <code>http://localhost:8080</code>. If you are using the ephemeral ports feature (disabled by default), you can make use of the command, <code>invoke open-nautobot-web</code>. This will open up the default web-browser on your system pointing to the correct Nautobot admin port. Note that this command can be used regardless of ephemeral port mode.</p>
|
|
10553
10549
|
<h3 id="starting-the-worker-server">Starting the Worker Server<a class="headerlink" href="#starting-the-worker-server" title="Permanent link">¶</a></h3>
|
|
10554
10550
|
<p>In order to run Nautobot Jobs or anything that requires a worker you must start a Celery worker.</p>
|
|
10555
|
-
<p>The worker is started in Docker Workflow with <a href="https://pythonhosted.org/watchdog/">watchdog</a> and can be setup to be started with watchdog in the Virtual Environment Workflow. Watchdog provides a similar experience to the Django lightweight HTTP/WSGI for restarting your application automatically. Watchdog can watch for changes on your filesystem, this is helpful when adjusting existing Python files to not have to restart the
|
|
10551
|
+
<p>The worker is started in Docker Workflow with <a href="https://pythonhosted.org/watchdog/">watchdog</a> and can be setup to be started with watchdog in the Virtual Environment Workflow. Watchdog provides a similar experience to the Django lightweight HTTP/WSGI for restarting your application automatically. Watchdog can watch for changes on your filesystem, this is helpful when adjusting existing Python files to not have to restart the Celery worker when testing jobs.</p>
|
|
10556
10552
|
<table>
|
|
10557
10553
|
<thead>
|
|
10558
10554
|
<tr>
|
|
@@ -10569,7 +10565,7 @@
|
|
|
10569
10565
|
</table>
|
|
10570
10566
|
<div class="admonition tip">
|
|
10571
10567
|
<p class="admonition-title">Tip</p>
|
|
10572
|
-
<p>You can leverage watchdog for your
|
|
10568
|
+
<p>You can leverage watchdog for your Celery worker as described above, with the following watchmedo command in your development environment <code>watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery worker -l INFO --events</code>.</p>
|
|
10573
10569
|
</div>
|
|
10574
10570
|
<h3 id="starting-the-interactive-shell">Starting the Interactive Shell<a class="headerlink" href="#starting-the-interactive-shell" title="Permanent link">¶</a></h3>
|
|
10575
10571
|
<p>Nautobot provides an <a href="../../user-guide/administration/tools/nautobot-shell.html">interactive Python shell</a> that sets up the server environment and gives you direct access to the database models for debugging. Nautobot extends this slightly to automatically import models and other utilities.</p>
|
|
@@ -10752,10 +10748,10 @@
|
|
|
10752
10748
|
<p class="admonition-title">Tip</p>
|
|
10753
10749
|
<p>You may also use <code>invoke integration-test</code> in the Virtual Environment workflow given that the <code>selenium</code> container is running, and that the <code>INVOKE_NAUTOBOT_LOCAL=True</code> environment variable has been set.</p>
|
|
10754
10750
|
</div>
|
|
10755
|
-
<
|
|
10756
|
-
<
|
|
10751
|
+
<div class="admonition tip">
|
|
10752
|
+
<p class="admonition-title">Tip</p>
|
|
10757
10753
|
<p>The <code>--cache-test-fixtures</code> argument was added to the <code>invoke integration-test</code> and <code>nautobot-server test</code> commands to allow for caching of test factory data between test runs. See the <a href="testing.html#factory-caching">factories documentation</a> for more information.</p>
|
|
10758
|
-
</
|
|
10754
|
+
</div>
|
|
10759
10755
|
<h5 id="customizing-integration-test-executions">Customizing Integration Test Executions<a class="headerlink" href="#customizing-integration-test-executions" title="Permanent link">¶</a></h5>
|
|
10760
10756
|
<p>The following environment variables can be provided when running tests to customize where Nautobot looks for Selenium and where Selenium looks for Nautobot. If using the default setup documented above, there is no need to customize these.</p>
|
|
10761
10757
|
<ul>
|
|
@@ -10845,27 +10841,27 @@
|
|
|
10845
10841
|
<p>Some features require documentation updates or new documentation to be written. The documentation files can be found in the <code>docs</code> directory. To preview these changes locally, you can use <code>mkdocs</code>.</p>
|
|
10846
10842
|
<p>For substantial changes to the code (including new features, removal of existing features, or significant changes in behavior) you should always make corresponding documentation updates. Nautobot's documentation pipeline includes a custom plugin for <code>mkdocs</code> that adds a few useful macros for annotating such changes:</p>
|
|
10847
10843
|
<ul>
|
|
10848
|
-
<li><code>+++
|
|
10849
|
-
<li><code>+/-
|
|
10850
|
-
<li><code>---
|
|
10844
|
+
<li><code>+++ 2.4.3</code>, on a line by itself, is a shorthand for <code>!!! version-added "Added in version 2.4.3"</code></li>
|
|
10845
|
+
<li><code>+/- 2.4.3</code>, on a line by itself, is a shorthand for <code>!!! version-changed "Changed in version 2.4.3"</code></li>
|
|
10846
|
+
<li><code>--- 2.4.3</code>, on a line by itself, is a shorthand for <code>!!! version-removed "Removed in version 2.4.3"</code></li>
|
|
10851
10847
|
</ul>
|
|
10852
10848
|
<p>These admonitions in turn appear in the rendered documentation as follows:</p>
|
|
10853
10849
|
<details class="version-added">
|
|
10854
|
-
<summary>Added in version
|
|
10850
|
+
<summary>Added in version 2.4.3</summary>
|
|
10855
10851
|
</details>
|
|
10856
10852
|
<details class="version-changed">
|
|
10857
|
-
<summary>Changed in version
|
|
10853
|
+
<summary>Changed in version 2.4.3</summary>
|
|
10858
10854
|
</details>
|
|
10859
10855
|
<details class="version-removed">
|
|
10860
|
-
<summary>Removed in version
|
|
10856
|
+
<summary>Removed in version 2.4.3</summary>
|
|
10861
10857
|
</details>
|
|
10862
10858
|
<p>You can also add text to any of these admonitions for further clarity, for example:</p>
|
|
10863
|
-
<div class="highlight"><pre><span></span><code>??? version-added "Added in version
|
|
10859
|
+
<div class="highlight"><pre><span></span><code>??? version-added "Added in version 2.4.3"
|
|
10864
10860
|
The custom `mkdocs` plugin was added.
|
|
10865
10861
|
</code></pre></div>
|
|
10866
10862
|
<p>will render as:</p>
|
|
10867
10863
|
<details class="version-added">
|
|
10868
|
-
<summary>Added in version
|
|
10864
|
+
<summary>Added in version 2.4.3</summary>
|
|
10869
10865
|
<p>The custom <code>mkdocs</code> plugin was added.</p>
|
|
10870
10866
|
</details>
|
|
10871
10867
|
<div class="admonition caution">
|
|
@@ -9176,9 +9176,6 @@
|
|
|
9176
9176
|
|
|
9177
9177
|
|
|
9178
9178
|
<h1 id="populating-the-home-page">Populating the Home Page<a class="headerlink" href="#populating-the-home-page" title="Permanent link">¶</a></h1>
|
|
9179
|
-
<details class="version-added">
|
|
9180
|
-
<summary>Added in version 1.2.0</summary>
|
|
9181
|
-
</details>
|
|
9182
9179
|
<p>Both core applications and Apps can contribute items to the Nautobot home page by defining <code>layout</code> inside of their app's <code>homepage.py</code>. Using a key and weight system, a developer can integrate amongst existing home page panels or can create entirely new panels as desired.</p>
|
|
9183
9180
|
<h2 id="adding-a-new-home-page-panel">Adding a new Home Page Panel<a class="headerlink" href="#adding-a-new-home-page-panel" title="Permanent link">¶</a></h2>
|
|
9184
9181
|
<p>Each panel on the home page is defined by a <code>HomePagePanel</code> object. A <code>HomePagePanel</code> may contain either or both of <code>HomePageItem</code> and/or <code>HomePageGroup</code> objects, or may define custom content via a referenced Django template. A <code>HomePageGroup</code> may itself contain <code>HomePageItem</code> objects as well, and individual <code>HomePageItem</code> objects may also reference custom Django templates.</p>
|
|
@@ -9561,7 +9561,7 @@
|
|
|
9561
9561
|
<p>Communication among the contributors should always occur via public channels. The following outlines the best ways to communicate and engage on all things Nautobot.</p>
|
|
9562
9562
|
<h3 id="slack">Slack<a class="headerlink" href="#slack" title="Permanent link">¶</a></h3>
|
|
9563
9563
|
<ul>
|
|
9564
|
-
<li><a href="http://slack.networktocode.com/"><
|
|
9564
|
+
<li><a href="http://slack.networktocode.com/"><code>#nautobot</code> on Network to Code Slack</a> - Good for quick chats. Avoid any discussion that might need to be referenced later on, as the chat history is not retained long.</li>
|
|
9565
9565
|
</ul>
|
|
9566
9566
|
<h3 id="github">GitHub<a class="headerlink" href="#github" title="Permanent link">¶</a></h3>
|
|
9567
9567
|
<ul>
|
|
@@ -9487,7 +9487,7 @@
|
|
|
9487
9487
|
<p>Run the following command to point your terminal to use the docker daemon inside minikube. This will ensure that your up-to-date local image named <code>local/nautobot-final-dev:local-${NAUTOBOT_VER}-py${PYTHON_VER}</code> is used when you build your kubernetes deployments.</p>
|
|
9488
9488
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="nb">eval</span><span class="w"> </span><span class="k">$(</span>minikube<span class="w"> </span>docker-env<span class="k">)</span>
|
|
9489
9489
|
</code></pre></div>
|
|
9490
|
-
<p>Now you can build your
|
|
9490
|
+
<p>Now you can build your Nautobot image locally using the <code>invoke build</code> command. After the build is complete, you are ready to build your kubernetes deployments.</p>
|
|
9491
9491
|
<h3 id="starting-the-deployments-and-services">Starting the Deployments and Services<a class="headerlink" href="#starting-the-deployments-and-services" title="Permanent link">¶</a></h3>
|
|
9492
9492
|
<p>Once you have confirmed that you have all the files listed above. You can start the required deployments and services:</p>
|
|
9493
9493
|
<p>To start all deployments:</p>
|
|
@@ -9620,7 +9620,7 @@ Check the override default value checkbox on the <code>Default Job Queue</code>
|
|
|
9620
9620
|
<p>You can inspect the job result and the job logs in this page. Notice the two job log entries that reads something like "Creating job pod (pod-name) in namespace default" and "Reading job pod (pod-name) in namespace default". Those entries indicate that a Kubernetes Job pod was executing the job for you.</p>
|
|
9621
9621
|
<p><img alt="K8s Job Result Completed" src="../../media/development/core/kubernetes/k8s_job_result_completed.png" /></p>
|
|
9622
9622
|
<h3 id="running-a-scheduled-job">Running a Scheduled Job<a class="headerlink" href="#running-a-scheduled-job" title="Permanent link">¶</a></h3>
|
|
9623
|
-
<p>You can run scheduled jobs as well. In order to run scheduled jobs, you do need
|
|
9623
|
+
<p>You can run scheduled jobs as well. In order to run scheduled jobs, you do need Celery Beat which should already be running from previous steps. To confirm that the Celery Beat is running, you need to retrieve the Celery Beat pod name by running the command <code>kubectl get pods</code>. You should see the following output or something similar, copy the pod name with prefix <code>celery-beat-*</code>.</p>
|
|
9624
9624
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-29-1" name="__codelineno-29-1" href="#__codelineno-29-1"></a>NAME<span class="w"> </span>READY<span class="w"> </span>STATUS<span class="w"> </span>RESTARTS<span class="w"> </span>AGE
|
|
9625
9625
|
<a id="__codelineno-29-2" name="__codelineno-29-2" href="#__codelineno-29-2"></a>celery-beat-6fb67477b7-rsw62<span class="w"> </span><span class="m">1</span>/1<span class="w"> </span>Running<span class="w"> </span><span class="m">0</span><span class="w"> </span>10m
|
|
9626
9626
|
<a id="__codelineno-29-3" name="__codelineno-29-3" href="#__codelineno-29-3"></a>db-8687b48964-gtvtc<span class="w"> </span><span class="m">1</span>/1<span class="w"> </span>Running<span class="w"> </span><span class="m">0</span><span class="w"> </span>10m
|
|
@@ -9645,7 +9645,7 @@ Check the override default value checkbox on the <code>Default Job Queue</code>
|
|
|
9645
9645
|
<p><img alt="K8s Run Job" src="../../media/development/core/kubernetes/k8s_run_job.png" /></p>
|
|
9646
9646
|
<p>Fill in the data shown below (for the "Starting date and time" field, pick a date and time that is close to the current date and time) and click on the "Schedule Job" button on the bottom right.</p>
|
|
9647
9647
|
<p><img alt="K8s Run Scheduled Job Form" src="../../media/development/core/kubernetes/k8s_run_scheduled_job_form.png" /></p>
|
|
9648
|
-
<p>To confirm that the Scheduled Job is running, you go back to the terminal that was logging
|
|
9648
|
+
<p>To confirm that the Scheduled Job is running, you go back to the terminal that was logging Celery Beat. You should see the following logs or something similar:</p>
|
|
9649
9649
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-31-1" name="__codelineno-31-1" href="#__codelineno-31-1"></a><span class="o">[</span><span class="m">2024</span>-11-21<span class="w"> </span><span class="m">02</span>:09:57,756:<span class="w"> </span>INFO/MainProcess<span class="o">]</span><span class="w"> </span>DatabaseScheduler:<span class="w"> </span>Schedule<span class="w"> </span>changed.
|
|
9650
9650
|
<a id="__codelineno-31-2" name="__codelineno-31-2" href="#__codelineno-31-2"></a><span class="o">[</span><span class="m">2024</span>-11-21<span class="w"> </span><span class="m">02</span>:09:57,774:<span class="w"> </span>INFO/MainProcess<span class="o">]</span><span class="w"> </span>Scheduler:<span class="w"> </span>Sending<span class="w"> </span>due<span class="w"> </span>task<span class="w"> </span>Export<span class="w"> </span>Object<span class="w"> </span>List<span class="w"> </span>Hourly_85413d3f-1342-4adf-8d80-11e740ebb907<span class="w"> </span><span class="o">(</span>nautobot.extras.jobs.run_job<span class="o">)</span>
|
|
9651
9651
|
<a id="__codelineno-31-3" name="__codelineno-31-3" href="#__codelineno-31-3"></a><span class="m">02</span>:09:57.782<span class="w"> </span>INFO<span class="w"> </span>nautobot.extras.utils<span class="w"> </span>utils.py<span class="w"> </span>run_kubernetes_job_and_return_job_result<span class="o">()</span><span class="w"> </span>:
|
|
@@ -9588,7 +9588,7 @@ article ul li {
|
|
|
9588
9588
|
</ul>
|
|
9589
9589
|
</li>
|
|
9590
9590
|
<li>Validate that the field appears correctly in GraphQL<ul>
|
|
9591
|
-
<li>If the field is not compatible with GraphQL or shouldn't be included in GraphQL it's possible to exclude a specific field in the GraphQL Type Object associated with this specific model. You can refer to the <a href="https://docs.graphene-python.org/projects/django/en/latest/queries/#specifying-which-fields-to-include">graphene-django documentation</a> for additional information.</li>
|
|
9591
|
+
<li>If the field is not compatible with GraphQL or shouldn't be included in GraphQL it's possible to exclude a specific field in the GraphQL Type Object associated with this specific model. You can refer to the <a href="https://docs.graphene-python.org/projects/django/en/latest/queries/#specifying-which-fields-to-include"><code>graphene-django</code> documentation</a> for additional information.</li>
|
|
9592
9592
|
</ul>
|
|
9593
9593
|
</li>
|
|
9594
9594
|
<li>Add field to model documentation with an appropriate version annotation</li>
|
|
@@ -9218,7 +9218,7 @@
|
|
|
9218
9218
|
<p>A tab object is being created with the same identifier as an existing object using the <code>name</code> attribute. Then a group is being created with a weight of <code>150</code>, which means it will appear between the already defined <code>Circuits</code> and <code>Provider</code> groups.</p>
|
|
9219
9219
|
<div class="admonition tip">
|
|
9220
9220
|
<p class="admonition-title">Tip</p>
|
|
9221
|
-
<p>Weights for already existing items can be found in the
|
|
9221
|
+
<p>Weights for already existing items can be found in the Nautobot source code (in <code>navigation.py</code>) or with a web session open to your Nautobot instance, you can inspect an element of the navbar using the developer tools. Each type of element will have an attribute <code>data-{type}-weight</code>. The type can be <code>tab</code>, <code>group</code>, <code>item</code> or <code>button</code>.</p>
|
|
9222
9222
|
</div>
|
|
9223
9223
|
<p>This pattern works for modifying all objects in the tree. New items can be added to existing groups and new buttons can be added to existing items.</p>
|
|
9224
9224
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="n">menu_tabs</span> <span class="o">=</span> <span class="p">(</span>
|
|
@@ -9647,7 +9647,7 @@
|
|
|
9647
9647
|
<p>Do not squash merge this branch into <code>main</code>. Make sure to select <code>Create a merge commit</code> when merging in GitHub.</p>
|
|
9648
9648
|
</div>
|
|
9649
9649
|
<h3 id="create-a-new-release-tag">Create a New Release Tag<a class="headerlink" href="#create-a-new-release-tag" title="Permanent link">¶</a></h3>
|
|
9650
|
-
<p>You need to create a release tag locally so that you can use it later when you draft the new release for
|
|
9650
|
+
<p>You need to create a release tag locally so that you can use it later when you draft the new release for Nautobot, for example, <code>v1.4.3</code>.
|
|
9651
9651
|
To create the tag locally:</p>
|
|
9652
9652
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-11-1" name="__codelineno-11-1" href="#__codelineno-11-1"></a>git<span class="w"> </span>tag<span class="w"> </span>v1.4.3
|
|
9653
9653
|
</code></pre></div>
|
|
@@ -9292,7 +9292,7 @@
|
|
|
9292
9292
|
<h1 id="adding-and-updating-nautobot-settings">Adding and Updating Nautobot Settings<a class="headerlink" href="#adding-and-updating-nautobot-settings" title="Permanent link">¶</a></h1>
|
|
9293
9293
|
<p>Best practices when adding, updating, and deprecating/removing Nautobot configuration settings.</p>
|
|
9294
9294
|
<h2 id="consider-constance">Consider Constance<a class="headerlink" href="#consider-constance" title="Permanent link">¶</a></h2>
|
|
9295
|
-
<p>If the setting is one that would be desirable to configure at run time rather than install time, and the nature of the setting is such that it <em>can</em> be changed at run time without requiring a server reload or similar operations to fully take effect, consider implementing it as a <a href="https://django-constance.readthedocs.io/en/latest/">django-constance</a> setting.</p>
|
|
9295
|
+
<p>If the setting is one that would be desirable to configure at run time rather than install time, and the nature of the setting is such that it <em>can</em> be changed at run time without requiring a server reload or similar operations to fully take effect, consider implementing it as a <a href="https://django-constance.readthedocs.io/en/latest/"><code>django-constance</code></a> setting.</p>
|
|
9296
9296
|
<h3 id="constance-advantages">Constance Advantages<a class="headerlink" href="#constance-advantages" title="Permanent link">¶</a></h3>
|
|
9297
9297
|
<ul>
|
|
9298
9298
|
<li>Constance-enabled settings can be configured through the UI by any user with admin privileges, rather than requiring filesystem access to the Nautobot installation to modify.</li>
|
|
@@ -9471,10 +9471,6 @@
|
|
|
9471
9471
|
<li>
|
|
9472
9472
|
<p>The combination of <code>nautobot.core.forms.BootstrapMixin</code>, <code>nautobot.extras.forms.CustomFieldModelFormMixin</code>, <code>nautobot.extras.forms.RelationshipModelFormMixin</code> and <code>nautobot.extras.forms.NoteModelFormMixin</code> is such a common use case throughout the code base that they have a helper class which combines all of these at <code>nautobot.extras.forms.NautobotModelForm</code>. Use this helper class if you need the functionality from these classes.</p>
|
|
9473
9473
|
</li>
|
|
9474
|
-
</ul>
|
|
9475
|
-
<details class="version-added">
|
|
9476
|
-
<summary>Added in version 1.4.0</summary>
|
|
9477
|
-
<ul>
|
|
9478
9474
|
<li>
|
|
9479
9475
|
<p>Similarly, for filter forms, <code>nautobot.extras.forms.NautobotFilterForm</code> combines <code>nautobot.core.forms.BootstrapMixin</code>, <code>nautobot.extras.forms.ContactTeamModelFilterFormMixin</code> (since Nautobot 2.3.0), <code>nautobot.extras.forms.CustomFieldModelFilterFormMixin</code>, and <code>nautobot.extras.forms.RelationshipModelFilterFormMixin</code>, and should be used where appropriate.</p>
|
|
9480
9476
|
</li>
|
|
@@ -9491,17 +9487,16 @@
|
|
|
9491
9487
|
<p>API Views for most models should inherit from <code>nautobot.extras.api.views.NautobotModelViewSet</code>. Only use more abstract base classes such as <code>ModelViewSet</code> where absolutely required.</p>
|
|
9492
9488
|
</li>
|
|
9493
9489
|
</ul>
|
|
9494
|
-
</details>
|
|
9495
9490
|
<h2 id="branding">Branding<a class="headerlink" href="#branding" title="Permanent link">¶</a></h2>
|
|
9496
9491
|
<ul>
|
|
9497
|
-
<li>When referring to Nautobot in writing, use the proper form "Nautobot
|
|
9492
|
+
<li>When referring to Nautobot in writing, use the proper form "<code>Nautobot</code>," with the letter N. The lowercase form "<code>nautobot</code>" should be used in code, filenames, etc.</li>
|
|
9498
9493
|
</ul>
|
|
9499
9494
|
<!-- pyml disable-next-line NAU001 -->
|
|
9500
9495
|
<ul>
|
|
9501
|
-
<li>There is an SVG form of the Nautobot logo at <a href="../../nautobot_logo.svg">nautobot/docs/nautobot_logo.svg</a>. It is preferred to use this logo for all purposes as it scales to arbitrary sizes without loss of resolution. If a raster image is required, the SVG logo should be converted to a PNG image of the prescribed size.</li>
|
|
9496
|
+
<li>There is an SVG form of the Nautobot logo at <a href="../../nautobot_logo.svg"><code>nautobot/docs/nautobot_logo.svg</code></a>. It is preferred to use this logo for all purposes as it scales to arbitrary sizes without loss of resolution. If a raster image is required, the SVG logo should be converted to a PNG image of the prescribed size.</li>
|
|
9502
9497
|
</ul>
|
|
9503
9498
|
<h2 id="importing-python-packages">Importing Python Packages<a class="headerlink" href="#importing-python-packages" title="Permanent link">¶</a></h2>
|
|
9504
|
-
<p>To prevent circular dependency errors and improve code readability, the following standards should be followed when importing from other
|
|
9499
|
+
<p>To prevent circular dependency errors and improve code readability, the following standards should be followed when importing from other Python modules.</p>
|
|
9505
9500
|
<div class="admonition tip">
|
|
9506
9501
|
<p class="admonition-title">Tip</p>
|
|
9507
9502
|
<p>Some of the below rules will be applied automatically when running the <code>ruff</code> linter/formatter against your code. Specifically, you can run <code>invoke ruff --fix</code> to automatically reorder imports.</p>
|
|
@@ -9585,7 +9580,7 @@
|
|
|
9585
9580
|
</code></pre></div>
|
|
9586
9581
|
</div>
|
|
9587
9582
|
<h4 id="convenience-imports">Convenience Imports<a class="headerlink" href="#convenience-imports" title="Permanent link">¶</a></h4>
|
|
9588
|
-
<p>Nautobot uses convenience imports in the same way that <a href="https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#imports">
|
|
9583
|
+
<p>Nautobot uses convenience imports in the same way that <a href="https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#imports">Django</a> implements them. These should be leveraged whenever possible.</p>
|
|
9589
9584
|
<div class="admonition example">
|
|
9590
9585
|
<p class="admonition-title">Example</p>
|
|
9591
9586
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a><span class="kn">from</span> <span class="nn">nautobot.extras</span> <span class="kn">import</span> <span class="n">forms</span>
|
|
@@ -9308,9 +9308,6 @@ This document presents these templates and their features.</p>
|
|
|
9308
9308
|
<p>You can use these templates as the basis for your templates by calling <code>{% extends '<template_name>' %}</code>
|
|
9309
9309
|
at the top of your template file.</p>
|
|
9310
9310
|
<h2 id="object-detail">Object Detail<a class="headerlink" href="#object-detail" title="Permanent link">¶</a></h2>
|
|
9311
|
-
<details class="version-added">
|
|
9312
|
-
<summary>Added in version 1.2.0</summary>
|
|
9313
|
-
</details>
|
|
9314
9311
|
<p>The most customizable template is <code>generic/object_retrieve.html</code>, as object detail views have a wide range of specific requirements to be accommodated. It provides the following blocks:</p>
|
|
9315
9312
|
<ul>
|
|
9316
9313
|
<li><code>header</code>: overloading this block allows for changing the entire top row of
|
|
@@ -9549,9 +9549,6 @@
|
|
|
9549
9549
|
<h3 id="troubleshooting-integration-tests">Troubleshooting Integration Tests<a class="headerlink" href="#troubleshooting-integration-tests" title="Permanent link">¶</a></h3>
|
|
9550
9550
|
<p>Because integration tests normally involve interacting with Nautobot through a browser via <a href="https://www.selenium.dev/selenium/docs/api/py/index.html">Selenium</a> and the <a href="https://splinter.readthedocs.io/en/latest/">Splinter</a> wrapper library, they can be difficult to troubleshoot directly from the Python code when a failure occurs. A common troubleshooting technique is to add a <code>breakpoint()</code> at the appropriate place in the Python test code (i.e., immediately prior to the observed failure). When the breakpoint is hit and the test pauses, you can then use a VNC viewer application (such as macOS's "Screen Sharing" app) to connect to the running Selenium instance (<code>localhost:15900</code> if using the Docker development environment; the default password if prompted is simply "<code>secret</code>"). This will allow you to interact live with the testing web browser in its current state and can often provide invaluable insight into the nature of any test failure.</p>
|
|
9551
9551
|
<h2 id="factories">Factories<a class="headerlink" href="#factories" title="Permanent link">¶</a></h2>
|
|
9552
|
-
<details class="version-added">
|
|
9553
|
-
<summary>Added in version 1.5.0</summary>
|
|
9554
|
-
</details>
|
|
9555
9552
|
<p>Nautobot uses the <a href="https://factoryboy.readthedocs.io/en/stable/"><code>factory_boy</code></a> library as a way to generate randomized but plausible database data for use in unit and integration tests, or for convenience in populating a local development instance.</p>
|
|
9556
9553
|
<p>Factories for each Nautobot app's models are defined in the corresponding <code>nautobot/APPNAME/factory.py</code> files. Helper classes and functions for certain common patterns are defined in <code>nautobot/core/factory.py</code>. Factories can be used directly from <code>nautobot-server nbshell</code> so long as you have <code>factory_boy</code> installed. Examples:</p>
|
|
9557
9554
|
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="o">>>></span> <span class="kn">from</span> <span class="nn">nautobot.tenancy.factory</span> <span class="kn">import</span> <span class="n">TenantFactory</span><span class="p">,</span> <span class="n">TenantGroupFactory</span>
|
|
@@ -9580,9 +9577,6 @@
|
|
|
9580
9577
|
<p>In short, we should only have one place in our tests where factories are called, and that's the <code>generate_test_data</code> management command. Individual tests should use standard <code>create()</code> or <code>save()</code> model methods, never factories.</p>
|
|
9581
9578
|
</div>
|
|
9582
9579
|
<h3 id="factory-caching">Factory Caching<a class="headerlink" href="#factory-caching" title="Permanent link">¶</a></h3>
|
|
9583
|
-
<details class="version-added">
|
|
9584
|
-
<summary>Added in version 1.5.11</summary>
|
|
9585
|
-
</details>
|
|
9586
9580
|
<p>To reduce the time taken between multiple test runs, a new argument has been added to the <code>nautobot-server test</code> command: <code>--cache-test-fixtures</code>. When running tests with <code>--cache-test-fixtures</code> for the first time, after the factory data has been generated it will be saved to a <code>factory_dump.json</code> file in the <code>development</code> directory. On subsequent runs of unit or integration tests, if <code>--cache-test-fixtures</code> is again specified (hint: it is included by default when running <code>invoke unittest</code> or <code>invoke integration-test</code>), the factory data will be loaded from the file instead of being generated again. This can significantly reduce the time taken to run tests.</p>
|
|
9587
9581
|
<details class="version-changed">
|
|
9588
9582
|
<summary>Changed in version 2.2.7 — Hashing of migrations in the factory dump</summary>
|
|
@@ -9601,9 +9595,6 @@
|
|
|
9601
9595
|
</ol>
|
|
9602
9596
|
</div>
|
|
9603
9597
|
<h2 id="performance-tests">Performance Tests<a class="headerlink" href="#performance-tests" title="Permanent link">¶</a></h2>
|
|
9604
|
-
<details class="version-added">
|
|
9605
|
-
<summary>Added in version 1.5.0</summary>
|
|
9606
|
-
</details>
|
|
9607
9598
|
<h3 id="running-performance-tests">Running Performance Tests<a class="headerlink" href="#running-performance-tests" title="Permanent link">¶</a></h3>
|
|
9608
9599
|
<p>Nautobot uses <a href="https://pypi.org/project/django-slowtests/"><code>django-slowtests</code></a> to run performance tests. To run performance tests, you need to install the <code>django-slowtests</code> package.
|
|
9609
9600
|
Once you install the package, you can do <code>invoke performance-test</code> or <code>invoke unittest --performance-test</code> to run unit tests with <code>NautobotPerformanceTestRunner</code>. The invoke commands will automatically add <code>--testrunner nautobot.core.tests.runner.NautobotPerformanceTestRunner</code> to the <code>coverage run</code> command and this flag will replace the default <code>NautobotTestRunner</code> while retaining all its functionalities with the addition of performance evaluation after test runs.</p>
|