netbox-cesnet-services-plugin 5.0.0__tar.gz → 5.2.0__tar.gz
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.
- {netbox_cesnet_services_plugin-5.0.0/netbox_cesnet_services_plugin.egg-info → netbox_cesnet_services_plugin-5.2.0}/PKG-INFO +3 -1
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/README.md +2 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/__init__.py +4 -1
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/service_core_link.py +10 -1
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/service_core_trunk.py +8 -1
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/service_ip.py +16 -11
- netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin/filtersets/utils.py +57 -0
- netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin/template_content.py +286 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/details/multiple_children.html +1 -1
- netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/details/related_tables_tab.html +13 -0
- netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/inc/related_cards.html +10 -0
- netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin/tests/test_related_objects.py +346 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0/netbox_cesnet_services_plugin.egg-info}/PKG-INFO +3 -1
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin.egg-info/SOURCES.txt +4 -2
- netbox_cesnet_services_plugin-5.0.0/netbox_cesnet_services_plugin/template_content.py +0 -330
- netbox_cesnet_services_plugin-5.0.0/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/bgpconnection/bgpconnection_include.html +0 -5
- netbox_cesnet_services_plugin-5.0.0/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighbor/lldpneighbor_include.html +0 -5
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/CONTRIBUTING.md +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/LICENSE +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/MANIFEST.in +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/api/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/api/serializers.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/api/urls.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/api/views.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/choices.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/bgpconnection.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/bgpconnection_aggregation.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/filtersets/lldpneighborleaf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/bgpconnection.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/bgpconnection_aggregation.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/lldpneighborleaf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/service_core_link.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/service_core_trunk.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/forms/service_ip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/graphql/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/graphql/filters.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/graphql/schema.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/graphql/types.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0001_initial.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0002_bgpconnection_comments.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0003_alter_bgpconnection_options_bgpconnection_device.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0004_alter_bgpconnection_options_bgpconnection_raw_vrf_and_more.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0005_alter_bgpconnection_role.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0006_lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0007_lldpneighbor_comments.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0008_alter_lldpneighbor_device_a_and_more.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0009_lldpneighbor_status_lldpneighborleaf_status.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0010_alter_bgpconnection_raw_vrf_and_more.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0011_lldpneighbor_last_seen_lldpneighbor_status_detail.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0012_alter_lldpneighbor_last_seen.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0013_bgpconnection_last_seen.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0014_servicecoretrunk_servicecorelink_serviceip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0015_alter_service_status_to_circuit_choices.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0016_serviceip_physical_device_and_more.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0017_serviceip_vrf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0018_serviceip_encapsulation_vlan_fks.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/0019_serviceip_endpoints_bgp_sessions.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/migrations/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/bgpconnection.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/cesnet_service_base.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/lldpneighborleaf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/service_core_link.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/service_core_trunk.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/models/service_ip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/navigation.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/bgpconnection.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/bgpconnection_aggregation.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/lldpneighborleaf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/service_core_link.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/service_core_trunk.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tables/service_ip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/bgpconnection/bgpconnection.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/bgpconnection/bgpconnection_aggregation_list.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/bgpconnection.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/details/connection_endpoints.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/details/detail_interface_inc.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighbor/lldpneighbor.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighbor.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighborleaf/lldpneighborleaf.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighborleaf/lldpneighborleaf_include.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/lldpneighborleaf.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/servicecorelink/servicecorelink.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/servicecorelink.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/servicecoretrunk/servicecoretrunk.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/servicecoretrunk.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceip/serviceip.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceip.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceipbgpsession/serviceipbgpsession.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceipbgpsession.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceipendpoint/serviceipendpoint.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/templates/netbox_cesnet_services_plugin/serviceipendpoint.html +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tests/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tests/test_service_core_link.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tests/test_service_core_trunk.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/tests/test_service_ip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/urls.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/bgpconnection.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/bgpconnection_aggregation.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/lldpneighbor.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/lldpneighborleaf.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/service_core_link.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/service_core_trunk.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin/views/service_ip.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin.egg-info/dependency_links.txt +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin.egg-info/entry_points.txt +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin.egg-info/requires.txt +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/netbox_cesnet_services_plugin.egg-info/top_level.txt +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/pyproject.toml +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/setup.cfg +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/tests/__init__.py +0 -0
- {netbox_cesnet_services_plugin-5.0.0 → netbox_cesnet_services_plugin-5.2.0}/tests/test_netbox_cesnet_services_plugin.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox_cesnet_services_plugin
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.0
|
|
4
4
|
Summary: NetBox plugin for CESNET services.
|
|
5
5
|
Author-email: Jan Krupa <jan.krupa@cesnet.cz>, Jiri Vrany <jiri.vrany@cesnet.cz>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -55,6 +55,8 @@ Enables CESNET services in NetBox:
|
|
|
55
55
|
|
|
56
56
|
| NetBox Version | Plugin Version | Notes |
|
|
57
57
|
|-----------------|----------------|-------|
|
|
58
|
+
| 4.7.0 – 4.7.99 | 5.2.0 | Related services on Tenant, incl. child tenants via the `parent_tenant` custom field (`tenant_parent_custom_field`) |
|
|
59
|
+
| 4.7.0 – 4.7.99 | 5.1.0 | Related services (CoreLink / CoreTrunk / ServiceIP) on Device, Interface, Site and ASN detail pages (`services_ext_page`) |
|
|
58
60
|
| 4.7.0 – 4.7.99 | 5.0.0 | **Breaking**: ServiceIP split into ServiceIP / ServiceIPEndpoint / ServiceIPBGPSession; requires netbox-bgp >= 0.20.2 |
|
|
59
61
|
| 4.7.0 – 4.7.99 | 4.0.0 | **NetBox 4.7 only** (django-tables2 3.0: `RelatedLinkColumn` → `Column(linkify=True)`); requires cesnet-service-path-plugin >= 6.3.0 |
|
|
60
62
|
| 4.5.4 – 4.6.99 | 3.0.5 | ServiceIP QinQ VLAN fields converted to `ipam.VLAN` FKs |
|
|
@@ -22,6 +22,8 @@ Enables CESNET services in NetBox:
|
|
|
22
22
|
|
|
23
23
|
| NetBox Version | Plugin Version | Notes |
|
|
24
24
|
|-----------------|----------------|-------|
|
|
25
|
+
| 4.7.0 – 4.7.99 | 5.2.0 | Related services on Tenant, incl. child tenants via the `parent_tenant` custom field (`tenant_parent_custom_field`) |
|
|
26
|
+
| 4.7.0 – 4.7.99 | 5.1.0 | Related services (CoreLink / CoreTrunk / ServiceIP) on Device, Interface, Site and ASN detail pages (`services_ext_page`) |
|
|
25
27
|
| 4.7.0 – 4.7.99 | 5.0.0 | **Breaking**: ServiceIP split into ServiceIP / ServiceIPEndpoint / ServiceIPBGPSession; requires netbox-bgp >= 0.20.2 |
|
|
26
28
|
| 4.7.0 – 4.7.99 | 4.0.0 | **NetBox 4.7 only** (django-tables2 3.0: `RelatedLinkColumn` → `Column(linkify=True)`); requires cesnet-service-path-plugin >= 6.3.0 |
|
|
27
29
|
| 4.5.4 – 4.6.99 | 3.0.5 | ServiceIP QinQ VLAN fields converted to `ipam.VLAN` FKs |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
__author__ = """Jan Krupa"""
|
|
4
4
|
__email__ = "jan.krupa@cesnet.cz"
|
|
5
|
-
__version__ = "5.
|
|
5
|
+
__version__ = "5.2.0"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
from netbox.plugins import PluginConfig
|
|
@@ -21,6 +21,9 @@ class CesnetServicesConfig(PluginConfig):
|
|
|
21
21
|
default_settings = {
|
|
22
22
|
"bgp_last_seen_warning_days": 2,
|
|
23
23
|
"bgp_last_seen_danger_days": 5,
|
|
24
|
+
# object custom field on Tenant pointing to its parent tenant (services of child tenants
|
|
25
|
+
# are listed on the parent); set to None to list only the tenant's own services
|
|
26
|
+
"tenant_parent_custom_field": "parent_tenant",
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import django_filters
|
|
2
|
-
from dcim.models import Device, Interface
|
|
2
|
+
from dcim.models import Device, Interface, Site
|
|
3
3
|
from django.db.models import Q
|
|
4
4
|
from extras.filters import TagFilter
|
|
5
5
|
from netbox.filtersets import NetBoxModelFilterSet
|
|
@@ -10,6 +10,7 @@ from circuits.choices import CircuitStatusChoices
|
|
|
10
10
|
from netbox_cesnet_services_plugin.choices import (
|
|
11
11
|
EncapsulationModeChoices,
|
|
12
12
|
)
|
|
13
|
+
from netbox_cesnet_services_plugin.filtersets.utils import any_of_filter, tenant_tree_filter
|
|
13
14
|
from netbox_cesnet_services_plugin.models import ServiceCoreLink, ServiceCoreTrunk
|
|
14
15
|
|
|
15
16
|
|
|
@@ -33,6 +34,7 @@ class ServiceCoreLinkFilterSet(NetBoxModelFilterSet):
|
|
|
33
34
|
to_field_name="slug",
|
|
34
35
|
label="Tenant (slug)",
|
|
35
36
|
)
|
|
37
|
+
tenant_tree_id = tenant_tree_filter()
|
|
36
38
|
|
|
37
39
|
node_a_id = django_filters.ModelMultipleChoiceFilter(
|
|
38
40
|
field_name="node_a__id",
|
|
@@ -59,6 +61,13 @@ class ServiceCoreLinkFilterSet(NetBoxModelFilterSet):
|
|
|
59
61
|
label="Physical Interface B (ID)",
|
|
60
62
|
)
|
|
61
63
|
|
|
64
|
+
# any side of the link (used by the related-services tables on core objects)
|
|
65
|
+
device_id = any_of_filter(Device.objects.all(), "Device (ID, any side)", "node_a", "node_b")
|
|
66
|
+
interface_id = any_of_filter(
|
|
67
|
+
Interface.objects.all(), "Interface (ID, any side or SAP)", "phy_if_a", "phy_if_b", "saps"
|
|
68
|
+
)
|
|
69
|
+
site_id = any_of_filter(Site.objects.all(), "Site (ID, via devices)", "node_a__site", "node_b__site")
|
|
70
|
+
|
|
62
71
|
core_trunk_id = django_filters.ModelMultipleChoiceFilter(
|
|
63
72
|
field_name="core_trunks__id",
|
|
64
73
|
queryset=ServiceCoreTrunk.objects.all(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import django_filters
|
|
2
|
-
from dcim.models import Device, Interface
|
|
2
|
+
from dcim.models import Device, Interface, Site
|
|
3
3
|
from django.db.models import Q
|
|
4
4
|
from extras.filters import TagFilter
|
|
5
5
|
from netbox.filtersets import NetBoxModelFilterSet
|
|
@@ -7,6 +7,7 @@ from utilities.filtersets import register_filterset
|
|
|
7
7
|
from tenancy.models import Tenant
|
|
8
8
|
|
|
9
9
|
from circuits.choices import CircuitStatusChoices
|
|
10
|
+
from netbox_cesnet_services_plugin.filtersets.utils import any_of_filter, tenant_tree_filter
|
|
10
11
|
from netbox_cesnet_services_plugin.models import ServiceCoreTrunk
|
|
11
12
|
|
|
12
13
|
|
|
@@ -30,6 +31,7 @@ class ServiceCoreTrunkFilterSet(NetBoxModelFilterSet):
|
|
|
30
31
|
to_field_name="slug",
|
|
31
32
|
label="Tenant (slug)",
|
|
32
33
|
)
|
|
34
|
+
tenant_tree_id = tenant_tree_filter()
|
|
33
35
|
|
|
34
36
|
node_a_id = django_filters.ModelMultipleChoiceFilter(
|
|
35
37
|
field_name="node_a__id",
|
|
@@ -56,6 +58,11 @@ class ServiceCoreTrunkFilterSet(NetBoxModelFilterSet):
|
|
|
56
58
|
label="Interface B (ID)",
|
|
57
59
|
)
|
|
58
60
|
|
|
61
|
+
# any side of the trunk (used by the related-services tables on core objects)
|
|
62
|
+
device_id = any_of_filter(Device.objects.all(), "Device (ID, any side)", "node_a", "node_b")
|
|
63
|
+
interface_id = any_of_filter(Interface.objects.all(), "Interface (ID, any side)", "if_a", "if_b")
|
|
64
|
+
site_id = any_of_filter(Site.objects.all(), "Site (ID, via devices)", "node_a__site", "node_b__site")
|
|
65
|
+
|
|
59
66
|
tag = TagFilter()
|
|
60
67
|
|
|
61
68
|
class Meta:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import django_filters
|
|
2
2
|
from circuits.choices import CircuitStatusChoices
|
|
3
|
-
from dcim.models import Device, Interface
|
|
3
|
+
from dcim.models import Device, Interface, Site
|
|
4
4
|
from django.db.models import Q
|
|
5
5
|
from extras.filters import TagFilter
|
|
6
6
|
from ipam.models import ASN, VLAN, VRF, Prefix
|
|
@@ -14,6 +14,7 @@ from netbox_cesnet_services_plugin.choices import (
|
|
|
14
14
|
EncapsulationModeChoices,
|
|
15
15
|
RoutingTypeChoices,
|
|
16
16
|
)
|
|
17
|
+
from netbox_cesnet_services_plugin.filtersets.utils import any_of_filter, tenant_tree_filter
|
|
17
18
|
from netbox_cesnet_services_plugin.models import (
|
|
18
19
|
ServiceIP,
|
|
19
20
|
ServiceIPBGPSession,
|
|
@@ -42,6 +43,7 @@ class ServiceIPFilterSet(NetBoxModelFilterSet):
|
|
|
42
43
|
to_field_name="slug",
|
|
43
44
|
label="Tenant (slug)",
|
|
44
45
|
)
|
|
46
|
+
tenant_tree_id = tenant_tree_filter()
|
|
45
47
|
vrf_id = _model_filter("vrf__id", VRF.objects.all(), "VRF (ID)")
|
|
46
48
|
routing_type = django_filters.MultipleChoiceFilter(choices=RoutingTypeChoices)
|
|
47
49
|
routing_prefix_id = _model_filter("routing_prefixes__id", Prefix.objects.all(), "Routing Prefix (ID)")
|
|
@@ -62,10 +64,20 @@ class ServiceIPFilterSet(NetBoxModelFilterSet):
|
|
|
62
64
|
physical_device_id = _model_filter(
|
|
63
65
|
"endpoints__physical_device__id", Device.objects.all(), "Physical Device (ID)"
|
|
64
66
|
)
|
|
65
|
-
# any device of the service, routed or physical
|
|
66
|
-
device_id =
|
|
67
|
-
|
|
67
|
+
# any device / interface / site of the service, routed or physical side of any endpoint
|
|
68
|
+
device_id = any_of_filter(
|
|
69
|
+
Device.objects.all(), "Device (ID)", "endpoints__routed_device", "endpoints__physical_device"
|
|
68
70
|
)
|
|
71
|
+
interface_id = any_of_filter(
|
|
72
|
+
Interface.objects.all(), "Interface (ID)", "endpoints__routed_interface", "endpoints__physical_interface"
|
|
73
|
+
)
|
|
74
|
+
site_id = any_of_filter(
|
|
75
|
+
Site.objects.all(),
|
|
76
|
+
"Site (ID, via devices)",
|
|
77
|
+
"endpoints__routed_device__site",
|
|
78
|
+
"endpoints__physical_device__site",
|
|
79
|
+
)
|
|
80
|
+
asn_id = _model_filter("bgp_peer_as__id", ASN.objects.all(), "ASN (ID)")
|
|
69
81
|
|
|
70
82
|
tag = TagFilter()
|
|
71
83
|
|
|
@@ -85,13 +97,6 @@ class ServiceIPFilterSet(NetBoxModelFilterSet):
|
|
|
85
97
|
| Q(endpoints__routed_interface__name__icontains=value)
|
|
86
98
|
).distinct()
|
|
87
99
|
|
|
88
|
-
def filter_device(self, queryset, name, value):
|
|
89
|
-
if not value:
|
|
90
|
-
return queryset
|
|
91
|
-
return queryset.filter(
|
|
92
|
-
Q(endpoints__routed_device__in=value) | Q(endpoints__physical_device__in=value)
|
|
93
|
-
).distinct()
|
|
94
|
-
|
|
95
100
|
|
|
96
101
|
@register_filterset
|
|
97
102
|
class ServiceIPEndpointFilterSet(NetBoxModelFilterSet):
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from django.db.models import Q
|
|
3
|
+
from netbox.plugins.utils import get_plugin_config
|
|
4
|
+
from tenancy.models import Tenant
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def any_of_filter(queryset, label, *paths):
|
|
8
|
+
"""A multi-choice filter matching objects related to the value through *any* of the given paths.
|
|
9
|
+
|
|
10
|
+
E.g. ``any_of_filter(Device.objects.all(), "Device (ID)", "node_a", "node_b")`` matches services
|
|
11
|
+
whose A or B node is one of the selected devices. ``distinct()`` collapses the duplicates a match
|
|
12
|
+
on several paths (or across a to-many relation) would produce.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def method(queryset, name, value):
|
|
16
|
+
if not value:
|
|
17
|
+
return queryset
|
|
18
|
+
condition = Q()
|
|
19
|
+
for path in paths:
|
|
20
|
+
condition |= Q(**{f"{path}__in": value})
|
|
21
|
+
return queryset.filter(condition).distinct()
|
|
22
|
+
|
|
23
|
+
return django_filters.ModelMultipleChoiceFilter(queryset=queryset, method=method, label=label)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def tenant_tree_ids(tenants):
|
|
27
|
+
"""IDs of ``tenants`` and all their descendants through the parent-tenant custom field.
|
|
28
|
+
|
|
29
|
+
The custom field (plugin setting ``tenant_parent_custom_field``, an object field pointing to a
|
|
30
|
+
Tenant) is followed level by level; tenants already collected are skipped, so a cycle in the
|
|
31
|
+
data cannot loop forever. A missing custom field simply yields no children.
|
|
32
|
+
"""
|
|
33
|
+
parent_field = get_plugin_config("netbox_cesnet_services_plugin", "tenant_parent_custom_field")
|
|
34
|
+
found = {tenant.pk for tenant in tenants}
|
|
35
|
+
frontier = set(found)
|
|
36
|
+
while frontier and parent_field:
|
|
37
|
+
children = set(
|
|
38
|
+
Tenant.objects.filter(**{f"custom_field_data__{parent_field}__in": list(frontier)}).values_list(
|
|
39
|
+
"pk", flat=True
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
frontier = children - found
|
|
43
|
+
found |= frontier
|
|
44
|
+
return found
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def tenant_tree_filter(path="tenant"):
|
|
48
|
+
"""A multi-choice tenant filter that also matches the selected tenants' descendants."""
|
|
49
|
+
|
|
50
|
+
def method(queryset, name, value):
|
|
51
|
+
if not value:
|
|
52
|
+
return queryset
|
|
53
|
+
return queryset.filter(**{f"{path}__in": tenant_tree_ids(value)})
|
|
54
|
+
|
|
55
|
+
return django_filters.ModelMultipleChoiceFilter(
|
|
56
|
+
queryset=Tenant.objects.all(), method=method, label="Tenant (ID), including child tenants"
|
|
57
|
+
)
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"""Plugin objects shown on the detail pages of NetBox core objects.
|
|
2
|
+
|
|
3
|
+
Every ``RelatedGroup`` lists plugin objects (BGP connections, LLDP neighbors, services) related to a
|
|
4
|
+
core object (Device, Interface, ...). A group is rendered either as cards on the detail page
|
|
5
|
+
(``left`` / ``right`` / ``full_width``) or as a tab of its own (``tabview``, the default), chosen by
|
|
6
|
+
the group's plugin setting.
|
|
7
|
+
|
|
8
|
+
Each ``RelatedTable`` wraps the child model's list view and selects its objects through that view's
|
|
9
|
+
filterset with a single query parameter. The card embeds the list view via htmx, the tab filters the
|
|
10
|
+
list view's queryset in-process (keeping its annotations, e.g. ServiceIP endpoint counts), so both
|
|
11
|
+
always list exactly the same objects with the same columns. Adding a core model to a table is one entry in its ``filters`` mapping,
|
|
12
|
+
provided the filterset has the parameter.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from dataclasses import dataclass, field
|
|
16
|
+
|
|
17
|
+
from django.conf import settings
|
|
18
|
+
from django.http import QueryDict
|
|
19
|
+
from django.utils.translation import gettext_lazy as _
|
|
20
|
+
from netbox.plugins import PluginTemplateExtension
|
|
21
|
+
from netbox.views import generic
|
|
22
|
+
from utilities.permissions import get_permission_for_model
|
|
23
|
+
from utilities.views import ViewTab, get_default_template, get_viewname, register_model_view
|
|
24
|
+
|
|
25
|
+
from netbox_cesnet_services_plugin.filtersets import LLDPNeighborLeafFilterSet
|
|
26
|
+
from netbox_cesnet_services_plugin.models import LLDPNeighborLeaf
|
|
27
|
+
from netbox_cesnet_services_plugin.tables import LLDPNeighborLeafTable
|
|
28
|
+
from netbox_cesnet_services_plugin.views import (
|
|
29
|
+
ServiceCoreLinkListView,
|
|
30
|
+
ServiceCoreTrunkListView,
|
|
31
|
+
ServiceIPListView,
|
|
32
|
+
)
|
|
33
|
+
from netbox_cesnet_services_plugin.views.bgpconnection import BGPConnectionListView
|
|
34
|
+
from netbox_cesnet_services_plugin.views.lldpneighbor import LLDPNeighborListView
|
|
35
|
+
|
|
36
|
+
plugin_settings = settings.PLUGINS_CONFIG.get("netbox_cesnet_services_plugin", {})
|
|
37
|
+
|
|
38
|
+
TABVIEW = "tabview"
|
|
39
|
+
CARD_POSITIONS = ("left", "right", "full_width")
|
|
40
|
+
|
|
41
|
+
CARDS_TEMPLATE = "netbox_cesnet_services_plugin/inc/related_cards.html"
|
|
42
|
+
MULTI_TABLE_TAB_TEMPLATE = "netbox_cesnet_services_plugin/details/related_tables_tab.html"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _label(obj):
|
|
46
|
+
return obj._meta.label_lower
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass(frozen=True)
|
|
50
|
+
class RelatedTable:
|
|
51
|
+
"""Objects listed by ``list_view`` that relate to a core object, selected by a filterset parameter."""
|
|
52
|
+
|
|
53
|
+
list_view: type # the child model's ObjectListView: queryset, table and filterset
|
|
54
|
+
# core model label (e.g. "dcim.device") -> filterset parameter selecting the related objects
|
|
55
|
+
filters: dict
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def model(self):
|
|
59
|
+
return self.list_view.queryset.model
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def table(self):
|
|
63
|
+
return self.list_view.table
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def filterset(self):
|
|
67
|
+
return self.list_view.filterset
|
|
68
|
+
|
|
69
|
+
def applies_to(self, obj):
|
|
70
|
+
return _label(obj) in self.filters
|
|
71
|
+
|
|
72
|
+
def _filter(self, obj, queryset):
|
|
73
|
+
params = QueryDict(mutable=True)
|
|
74
|
+
params[self.filters[_label(obj)]] = obj.pk
|
|
75
|
+
filterset = self.filterset(params, queryset)
|
|
76
|
+
# an invalid filterset would silently drop the filter and return everything
|
|
77
|
+
return filterset.qs if filterset.is_valid() else queryset.none()
|
|
78
|
+
|
|
79
|
+
def queryset(self, obj, user):
|
|
80
|
+
"""The related objects ``user`` may view."""
|
|
81
|
+
return self._filter(obj, self.list_view.queryset.restrict(user, "view"))
|
|
82
|
+
|
|
83
|
+
def count(self, obj):
|
|
84
|
+
"""Unrestricted count; tab badges are rendered without access to the user."""
|
|
85
|
+
return self._filter(obj, self.model.objects.all()).count()
|
|
86
|
+
|
|
87
|
+
def has_view_permission(self, user):
|
|
88
|
+
return user.has_perm(get_permission_for_model(self.model, "view"))
|
|
89
|
+
|
|
90
|
+
def card(self, obj, request):
|
|
91
|
+
"""Context for an htmx-embedded list table, or None when there is nothing to show the user."""
|
|
92
|
+
if not self.has_view_permission(request.user) or not self.queryset(obj, request.user).exists():
|
|
93
|
+
return None
|
|
94
|
+
url_params = QueryDict(mutable=True)
|
|
95
|
+
url_params[self.filters[_label(obj)]] = obj.pk
|
|
96
|
+
url_params["return_url"] = request.path
|
|
97
|
+
return {
|
|
98
|
+
"title": _("Related {objects}").format(objects=self.model._meta.verbose_name_plural),
|
|
99
|
+
"viewname": get_viewname(self.model, "list"),
|
|
100
|
+
"url_params": url_params,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass(frozen=True)
|
|
105
|
+
class RelatedGroup:
|
|
106
|
+
"""A set of related tables shown together, as cards or as one tab."""
|
|
107
|
+
|
|
108
|
+
slug: str # URL suffix of the tab view: "<model_name>-<slug>"
|
|
109
|
+
label: str # tab label
|
|
110
|
+
setting: str # plugin setting selecting the position
|
|
111
|
+
tables: tuple
|
|
112
|
+
tab_template: str = None # single-table tabs only; defaults to NetBox's generic children template
|
|
113
|
+
tab_extra_context: callable = field(default=None) # (request, obj) -> dict, single-table tabs only
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def position(self):
|
|
117
|
+
return plugin_settings.get(self.setting, TABVIEW)
|
|
118
|
+
|
|
119
|
+
def tables_for(self, obj_or_model):
|
|
120
|
+
label = obj_or_model._meta.label_lower
|
|
121
|
+
return [table for table in self.tables if label in table.filters]
|
|
122
|
+
|
|
123
|
+
def models(self):
|
|
124
|
+
return {label for table in self.tables for label in table.filters}
|
|
125
|
+
|
|
126
|
+
def count(self, obj):
|
|
127
|
+
return sum(table.count(obj) for table in self.tables_for(obj))
|
|
128
|
+
|
|
129
|
+
def cards(self, obj, request):
|
|
130
|
+
return [card for table in self.tables_for(obj) if (card := table.card(obj, request))]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _lldp_leaf_context(request, obj):
|
|
134
|
+
"""The LLDP tab also lists the leaf neighbors seen from the object (device_nb / interface_nb)."""
|
|
135
|
+
leaf_filter = {"dcim.device": "device_nb", "dcim.interface": "interface_nb"}[_label(obj)]
|
|
136
|
+
leafs = LLDPNeighborLeafFilterSet(
|
|
137
|
+
{leaf_filter: [obj.pk]}, LLDPNeighborLeaf.objects.restrict(request.user, "view")
|
|
138
|
+
).qs
|
|
139
|
+
return {"leaf_table": LLDPNeighborLeafTable(leafs)}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
SERVICE_FILTERS = {
|
|
143
|
+
"dcim.device": "device_id",
|
|
144
|
+
"dcim.interface": "interface_id",
|
|
145
|
+
"dcim.site": "site_id",
|
|
146
|
+
"tenancy.tenant": "tenant_tree_id",
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
RELATED_GROUPS = (
|
|
150
|
+
RelatedGroup(
|
|
151
|
+
slug="bgpconnections",
|
|
152
|
+
label=_("BGP Connections"),
|
|
153
|
+
setting="bgp_ext_page",
|
|
154
|
+
tables=(
|
|
155
|
+
RelatedTable(
|
|
156
|
+
BGPConnectionListView,
|
|
157
|
+
{
|
|
158
|
+
"tenancy.tenant": "bgp_prefix_tenant_id",
|
|
159
|
+
"dcim.device": "device_id",
|
|
160
|
+
"dcim.interface": "next_hop_interface_id",
|
|
161
|
+
"ipam.ipaddress": "next_hop_id",
|
|
162
|
+
"ipam.prefix": "bgp_prefix_id",
|
|
163
|
+
"ipam.vrf": "vrf_id",
|
|
164
|
+
},
|
|
165
|
+
),
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
RelatedGroup(
|
|
169
|
+
slug="lldpneighbors",
|
|
170
|
+
label=_("LLDP Neighbors"),
|
|
171
|
+
setting="lldp_ext_page",
|
|
172
|
+
tables=(
|
|
173
|
+
RelatedTable(
|
|
174
|
+
LLDPNeighborListView,
|
|
175
|
+
{"dcim.device": "device_a_id", "dcim.interface": "interface_a_id"},
|
|
176
|
+
),
|
|
177
|
+
),
|
|
178
|
+
tab_template="netbox_cesnet_services_plugin/details/multiple_children.html",
|
|
179
|
+
tab_extra_context=_lldp_leaf_context,
|
|
180
|
+
),
|
|
181
|
+
RelatedGroup(
|
|
182
|
+
slug="services",
|
|
183
|
+
label=_("Services"),
|
|
184
|
+
setting="services_ext_page",
|
|
185
|
+
tables=(
|
|
186
|
+
RelatedTable(ServiceCoreLinkListView, SERVICE_FILTERS),
|
|
187
|
+
RelatedTable(ServiceCoreTrunkListView, SERVICE_FILTERS),
|
|
188
|
+
RelatedTable(ServiceIPListView, {**SERVICE_FILTERS, "ipam.asn": "asn_id"}),
|
|
189
|
+
),
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# ---------------------------------------------------------------------------
|
|
195
|
+
# Cards on the detail page
|
|
196
|
+
# ---------------------------------------------------------------------------
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class RelatedObjectsExtension(PluginTemplateExtension):
|
|
200
|
+
models = sorted(set().union(*(group.models() for group in RELATED_GROUPS)))
|
|
201
|
+
|
|
202
|
+
def left_page(self):
|
|
203
|
+
return self._render_cards("left")
|
|
204
|
+
|
|
205
|
+
def right_page(self):
|
|
206
|
+
return self._render_cards("right")
|
|
207
|
+
|
|
208
|
+
def full_width_page(self):
|
|
209
|
+
return self._render_cards("full_width")
|
|
210
|
+
|
|
211
|
+
def _render_cards(self, position):
|
|
212
|
+
obj = self.context["object"]
|
|
213
|
+
request = self.context["request"]
|
|
214
|
+
cards = [card for group in RELATED_GROUPS if group.position == position for card in group.cards(obj, request)]
|
|
215
|
+
if not cards:
|
|
216
|
+
return ""
|
|
217
|
+
return self.render(CARDS_TEMPLATE, extra_context={"cards": cards})
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
template_extensions = [RelatedObjectsExtension]
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# ---------------------------------------------------------------------------
|
|
224
|
+
# Tabs
|
|
225
|
+
# ---------------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def register_related_tab(group, model):
|
|
229
|
+
"""Register ``group`` as a tab on ``model``'s detail page.
|
|
230
|
+
|
|
231
|
+
A single-table group keeps NetBox's children view (filtering, bulk edit/delete); a multi-table
|
|
232
|
+
group shows one htmx-embedded table per related model, as the cards do.
|
|
233
|
+
"""
|
|
234
|
+
tables = group.tables_for(model)
|
|
235
|
+
tab = ViewTab(
|
|
236
|
+
label=group.label,
|
|
237
|
+
badge=group.count,
|
|
238
|
+
# a single permission only fits a single table; multi-table tabs check each table instead
|
|
239
|
+
permission=get_permission_for_model(tables[0].model, "view") if len(tables) == 1 else None,
|
|
240
|
+
hide_if_empty=True,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
if len(tables) == 1:
|
|
244
|
+
related = tables[0]
|
|
245
|
+
|
|
246
|
+
class View(generic.ObjectChildrenView):
|
|
247
|
+
queryset = model.objects.all()
|
|
248
|
+
child_model = related.model
|
|
249
|
+
table = related.table
|
|
250
|
+
filterset = related.filterset
|
|
251
|
+
template_name = group.tab_template or "generic/object_children.html"
|
|
252
|
+
|
|
253
|
+
def get_children(self, request, parent):
|
|
254
|
+
return related.queryset(parent, request.user)
|
|
255
|
+
|
|
256
|
+
def get_extra_context(self, request, instance):
|
|
257
|
+
return group.tab_extra_context(request, instance) if group.tab_extra_context else {}
|
|
258
|
+
|
|
259
|
+
else:
|
|
260
|
+
|
|
261
|
+
class View(generic.ObjectView):
|
|
262
|
+
queryset = model.objects.all()
|
|
263
|
+
template_name = MULTI_TABLE_TAB_TEMPLATE
|
|
264
|
+
|
|
265
|
+
def get_extra_context(self, request, instance):
|
|
266
|
+
return {
|
|
267
|
+
"base_template": get_default_template(model),
|
|
268
|
+
"cards": group.cards(instance, request),
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
View.tab = tab
|
|
272
|
+
View.__name__ = f"{model.__name__}{group.slug.title()}TabView"
|
|
273
|
+
name = f"{model._meta.model_name}-{group.slug}"
|
|
274
|
+
register_model_view(model, name=name, path=name)(View)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _model_for_label(label):
|
|
278
|
+
from django.apps import apps
|
|
279
|
+
|
|
280
|
+
return apps.get_model(label)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
for _group in RELATED_GROUPS:
|
|
284
|
+
if _group.position == TABVIEW:
|
|
285
|
+
for _label_name in sorted(_group.models()):
|
|
286
|
+
register_related_tab(_group, _model_for_label(_label_name))
|
|
@@ -42,7 +42,7 @@ Context:
|
|
|
42
42
|
<div class="card">
|
|
43
43
|
<h5>LLDP Leafs</h5>
|
|
44
44
|
<div class="htmx-container table-responsive" id="object_list">
|
|
45
|
-
{% include 'htmx/table.html' with table=
|
|
45
|
+
{% include 'htmx/table.html' with table=leaf_table %}
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{% extends base_template %}
|
|
2
|
+
{% load i18n %}
|
|
3
|
+
|
|
4
|
+
{% block content %}
|
|
5
|
+
<div class="row">
|
|
6
|
+
<div class="col col-md-12">
|
|
7
|
+
{% include "netbox_cesnet_services_plugin/inc/related_cards.html" %}
|
|
8
|
+
{% if not cards %}
|
|
9
|
+
<div class="alert alert-info">{% trans "No related objects you are permitted to view." %}</div>
|
|
10
|
+
{% endif %}
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
{% endblock content %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{% comment %}
|
|
2
|
+
Cards of related plugin objects, one htmx-embedded list table each.
|
|
3
|
+
Context: cards - list of {title, viewname, url_params} (see template_content.RelatedTable.card)
|
|
4
|
+
{% endcomment %}
|
|
5
|
+
{% for card in cards %}
|
|
6
|
+
<div class="card">
|
|
7
|
+
<h2 class="card-header">{{ card.title }}</h2>
|
|
8
|
+
{% include "builtins/htmx_table.html" with viewname=card.viewname url_params=card.url_params %}
|
|
9
|
+
</div>
|
|
10
|
+
{% endfor %}
|