ipfabric_netbox 4.3.1b1__tar.gz → 4.3.1b3__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.
Potentially problematic release.
This version of ipfabric_netbox might be problematic. Click here for more details.
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/PKG-INFO +1 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/__init__.py +1 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/api/serializers.py +4 -2
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/choices.py +56 -20
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/filtersets.py +6 -2
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/forms.py +24 -19
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/graphql/enums.py +10 -3
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/graphql/filters.py +4 -3
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/jobs.py +6 -5
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/models.py +46 -45
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/navigation.py +10 -9
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tables.py +12 -10
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/clone_form.html +7 -4
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html +10 -8
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/json.html +4 -2
- ipfabric_netbox-4.3.1b3/ipfabric_netbox/templates/ipfabric_netbox/inc/logs_pending.html +7 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/merge_form.html +7 -5
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_button.html +8 -6
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_modal.html +8 -4
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_field_map.html +2 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_relationship_map.html +2 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabric_table.html +4 -4
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabricingestion.html +12 -11
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabricsnapshot.html +15 -14
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabricsource.html +13 -12
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync.html +16 -15
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap.html +7 -6
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_list.html +2 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_restore.html +1 -1
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmapgroup.html +4 -3
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/ingestion_progress.html +5 -4
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/ingestion_statistics.html +5 -4
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/job_logs.html +10 -9
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/api/test_api.py +6 -5
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/test_forms.py +16 -15
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/test_views.py +24 -23
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/utilities/ipfutils.py +2 -2
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/views.py +8 -7
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/pyproject.toml +1 -1
- ipfabric_netbox-4.3.1b1/ipfabric_netbox/templates/ipfabric_netbox/inc/logs_pending.html +0 -6
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/README.md +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/api/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/api/urls.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/api/views.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/data/transform_map.json +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/exceptions.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/graphql/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/graphql/schema.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/graphql/types.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0001_initial.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0001_initial_squashed_0013_switch_to_branching_plugin.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0002_ipfabricsnapshot_status.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0003_ipfabricsource_type_and_more.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0004_ipfabricsync_auto_merge.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0005_alter_ipfabricrelationshipfield_source_model_and_more.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0006_alter_ipfabrictransformmap_target_model.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0007_prepare_custom_fields.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0008_prepare_transform_maps.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0009_transformmap_changes_for_netbox_v4_2.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0010_remove_uuid_from_get_or_create.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0011_update_part_number_DCIM_inventory_item_template.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0012_remove_status_field.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0013_switch_to_branching_plugin.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0014_ipfabrictransformmapgroup_ipfabrictransformmap_group.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0015_ipfabricingestionissue.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0016_tags_and_changelog_for_snapshots.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0017_ipfabricsync_update_custom_fields.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0018_remove_type_field.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0019_alter_ipfabrictransformmap_options_and_more.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/0020_clean_scheduled_jobs.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/migrations/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/signals.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/template_content.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/inc/snapshotdata.html +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/ingestion_all.html +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/ingestion_status.html +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/object_tabs.html +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/ipfabric_netbox/partials/sync_last_ingestion.html +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templatetags/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/templatetags/ipfabric_netbox_helpers.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/api/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/tests/test_models.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/urls.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/utilities/__init__.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/utilities/logging.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/utilities/nbutils.py +0 -0
- {ipfabric_netbox-4.3.1b1 → ipfabric_netbox-4.3.1b3}/ipfabric_netbox/utilities/transform_map.py +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from core.choices import DataSourceStatusChoices
|
|
2
1
|
from django.contrib.contenttypes.models import ContentType
|
|
3
2
|
from netbox.api.fields import ChoiceField
|
|
4
3
|
from netbox.api.fields import ContentTypeField
|
|
@@ -7,6 +6,8 @@ from netbox.api.serializers import NestedGroupModelSerializer
|
|
|
7
6
|
from netbox_branching.api.serializers import BranchSerializer
|
|
8
7
|
from rest_framework import serializers
|
|
9
8
|
|
|
9
|
+
from ipfabric_netbox.choices import IPFabricSourceStatusChoices
|
|
10
|
+
from ipfabric_netbox.choices import IPFabricSyncStatusChoices
|
|
10
11
|
from ipfabric_netbox.models import IPFabricIngestion
|
|
11
12
|
from ipfabric_netbox.models import IPFabricIngestionIssue
|
|
12
13
|
from ipfabric_netbox.models import IPFabricRelationshipField
|
|
@@ -114,7 +115,7 @@ class IPFabricRelationshipFieldSerializer(NestedGroupModelSerializer):
|
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
class IPFabricSourceSerializer(NestedGroupModelSerializer):
|
|
117
|
-
status = ChoiceField(choices=
|
|
118
|
+
status = ChoiceField(choices=IPFabricSourceStatusChoices, read_only=True)
|
|
118
119
|
url = serializers.URLField()
|
|
119
120
|
|
|
120
121
|
class Meta:
|
|
@@ -175,6 +176,7 @@ class IPFabricSnapshotSerializer(NestedGroupModelSerializer):
|
|
|
175
176
|
|
|
176
177
|
|
|
177
178
|
class IPFabricSyncSerializer(NestedGroupModelSerializer):
|
|
179
|
+
status = ChoiceField(choices=IPFabricSyncStatusChoices, read_only=True)
|
|
178
180
|
snapshot_data = IPFabricSnapshotSerializer(nested=True)
|
|
179
181
|
parameters = serializers.JSONField()
|
|
180
182
|
|
|
@@ -173,16 +173,16 @@ class IPFabricTransformMapSourceModelChoices(ChoiceSet):
|
|
|
173
173
|
PARTNUMBERS = "part_number"
|
|
174
174
|
|
|
175
175
|
CHOICES = (
|
|
176
|
-
(SITE, "Site", "cyan"),
|
|
177
|
-
(INVENTORY, "Inventory", "gray"),
|
|
178
|
-
(DEVICE, "Device", "gray"),
|
|
179
|
-
(VIRTUALCHASSIS, "Virtual Chassis", "grey"),
|
|
180
|
-
(INTERFACE, "Interface", "gray"),
|
|
181
|
-
(VLAN, "VLAN", "gray"),
|
|
182
|
-
(VRF, "VRF", "gray"),
|
|
183
|
-
(PREFIX, "Prefix", "gray"),
|
|
184
|
-
(IPADDRESS, "IP Address", "gray"),
|
|
185
|
-
(PARTNUMBERS, "Part Number", "gray"),
|
|
176
|
+
(SITE, _("Site"), "cyan"),
|
|
177
|
+
(INVENTORY, _("Inventory"), "gray"),
|
|
178
|
+
(DEVICE, _("Device"), "gray"),
|
|
179
|
+
(VIRTUALCHASSIS, _("Virtual Chassis"), "grey"),
|
|
180
|
+
(INTERFACE, _("Interface"), "gray"),
|
|
181
|
+
(VLAN, _("VLAN"), "gray"),
|
|
182
|
+
(VRF, _("VRF"), "gray"),
|
|
183
|
+
(PREFIX, _("Prefix"), "gray"),
|
|
184
|
+
(IPADDRESS, _("IP Address"), "gray"),
|
|
185
|
+
(PARTNUMBERS, _("Part Number"), "gray"),
|
|
186
186
|
)
|
|
187
187
|
|
|
188
188
|
|
|
@@ -203,8 +203,8 @@ class IPFabricSourceTypeChoices(ChoiceSet):
|
|
|
203
203
|
REMOTE = "remote"
|
|
204
204
|
|
|
205
205
|
CHOICES = (
|
|
206
|
-
(LOCAL, "Local", "cyan"),
|
|
207
|
-
(REMOTE, "Remote", "gray"),
|
|
206
|
+
(LOCAL, _("Local"), "cyan"),
|
|
207
|
+
(REMOTE, _("Remote"), "gray"),
|
|
208
208
|
)
|
|
209
209
|
|
|
210
210
|
|
|
@@ -220,12 +220,48 @@ class IPFabricRawDataTypeChoices(ChoiceSet):
|
|
|
220
220
|
SITE = "site"
|
|
221
221
|
|
|
222
222
|
CHOICES = (
|
|
223
|
-
(DEVICE, "Local", "cyan"),
|
|
224
|
-
(VLAN, "VLAN", "gray"),
|
|
225
|
-
(VIRTUALCHASSIS, "Virtual Chassis", "gray"),
|
|
226
|
-
(PREFIX, "Prefix", "gray"),
|
|
227
|
-
(INTERFACE, "Interface", "gray"),
|
|
228
|
-
(INVENTORYITEM, "Inventory Item", "gray"),
|
|
229
|
-
(IPADDRESS, "IP Address", "gray"),
|
|
230
|
-
(SITE, "Site", "gray"),
|
|
223
|
+
(DEVICE, _("Local"), "cyan"),
|
|
224
|
+
(VLAN, _("VLAN"), "gray"),
|
|
225
|
+
(VIRTUALCHASSIS, _("Virtual Chassis"), "gray"),
|
|
226
|
+
(PREFIX, _("Prefix"), "gray"),
|
|
227
|
+
(INTERFACE, _("Interface"), "gray"),
|
|
228
|
+
(INVENTORYITEM, _("Inventory Item"), "gray"),
|
|
229
|
+
(IPADDRESS, _("IP Address"), "gray"),
|
|
230
|
+
(SITE, _("Site"), "gray"),
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class IPFabricSourceStatusChoices(ChoiceSet):
|
|
235
|
+
NEW = "new"
|
|
236
|
+
QUEUED = "queued"
|
|
237
|
+
SYNCING = "syncing"
|
|
238
|
+
COMPLETED = "completed"
|
|
239
|
+
FAILED = "failed"
|
|
240
|
+
|
|
241
|
+
CHOICES = (
|
|
242
|
+
(NEW, _("New"), "blue"),
|
|
243
|
+
(QUEUED, _("Queued"), "orange"),
|
|
244
|
+
(SYNCING, _("Syncing"), "cyan"),
|
|
245
|
+
(COMPLETED, _("Completed"), "green"),
|
|
246
|
+
(FAILED, _("Failed"), "red"),
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class IPFabricSyncStatusChoices(ChoiceSet):
|
|
251
|
+
NEW = "new"
|
|
252
|
+
QUEUED = "queued"
|
|
253
|
+
SYNCING = "syncing"
|
|
254
|
+
READY_TO_MERGE = "ready_to_merge"
|
|
255
|
+
MERGING = "merging"
|
|
256
|
+
COMPLETED = "completed"
|
|
257
|
+
FAILED = "failed"
|
|
258
|
+
|
|
259
|
+
CHOICES = (
|
|
260
|
+
(NEW, _("New"), "blue"),
|
|
261
|
+
(QUEUED, _("Queued"), "orange"),
|
|
262
|
+
(SYNCING, _("Syncing"), "cyan"),
|
|
263
|
+
(READY_TO_MERGE, _("Ready to merge"), "purple"),
|
|
264
|
+
(MERGING, _("Merging"), "cyan"),
|
|
265
|
+
(COMPLETED, _("Completed"), "green"),
|
|
266
|
+
(FAILED, _("Failed"), "red"),
|
|
231
267
|
)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import django_filters
|
|
2
|
-
from core.choices import DataSourceStatusChoices
|
|
3
2
|
from core.choices import ObjectChangeActionChoices
|
|
4
3
|
from django.db.models import Q
|
|
5
4
|
from django.utils.translation import gettext as _
|
|
@@ -8,6 +7,8 @@ from netbox.filtersets import ChangeLoggedModelFilterSet
|
|
|
8
7
|
from netbox.filtersets import NetBoxModelFilterSet
|
|
9
8
|
from netbox_branching.models import ChangeDiff
|
|
10
9
|
|
|
10
|
+
from .choices import IPFabricSourceStatusChoices
|
|
11
|
+
from .choices import IPFabricSyncStatusChoices
|
|
11
12
|
from .models import IPFabricData
|
|
12
13
|
from .models import IPFabricIngestion
|
|
13
14
|
from .models import IPFabricIngestionIssue
|
|
@@ -110,7 +111,7 @@ class IPFabricSnapshotFilterSet(ChangeLoggedModelFilterSet):
|
|
|
110
111
|
|
|
111
112
|
class IPFabricSourceFilterSet(NetBoxModelFilterSet):
|
|
112
113
|
status = django_filters.MultipleChoiceFilter(
|
|
113
|
-
choices=
|
|
114
|
+
choices=IPFabricSourceStatusChoices, null_value=None
|
|
114
115
|
)
|
|
115
116
|
|
|
116
117
|
class Meta:
|
|
@@ -235,6 +236,9 @@ class IPFabricSyncFilterSet(ChangeLoggedModelFilterSet):
|
|
|
235
236
|
to_field_name="name",
|
|
236
237
|
label=_("Snapshot (name)"),
|
|
237
238
|
)
|
|
239
|
+
status = django_filters.MultipleChoiceFilter(
|
|
240
|
+
choices=IPFabricSyncStatusChoices, null_value=None
|
|
241
|
+
)
|
|
238
242
|
|
|
239
243
|
class Meta:
|
|
240
244
|
model = IPFabricSync
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
|
|
3
|
-
from core.choices import DataSourceStatusChoices
|
|
4
3
|
from core.choices import JobIntervalChoices
|
|
5
4
|
from django import forms
|
|
6
5
|
from django.contrib.contenttypes.models import ContentType
|
|
@@ -31,7 +30,9 @@ from utilities.forms.widgets import HTMXSelect
|
|
|
31
30
|
from utilities.forms.widgets import NumberWithOptions
|
|
32
31
|
|
|
33
32
|
from .choices import IPFabricSnapshotStatusModelChoices
|
|
33
|
+
from .choices import IPFabricSourceStatusChoices
|
|
34
34
|
from .choices import IPFabricSourceTypeChoices
|
|
35
|
+
from .choices import IPFabricSyncStatusChoices
|
|
35
36
|
from .choices import IPFabricTransformMapSourceModelChoices
|
|
36
37
|
from .choices import required_transform_map_contenttypes
|
|
37
38
|
from .choices import transform_field_source_columns
|
|
@@ -119,9 +120,9 @@ def list_to_choices(choices: list[str]) -> tuple[tuple[str, str], ...]:
|
|
|
119
120
|
class IPFabricRelationshipFieldForm(NetBoxModelForm):
|
|
120
121
|
coalesce = forms.BooleanField(required=False, initial=False)
|
|
121
122
|
target_field = forms.CharField(
|
|
122
|
-
label="Target Field",
|
|
123
|
+
label=_("Target Field"),
|
|
123
124
|
required=True,
|
|
124
|
-
help_text="Select target model field.",
|
|
125
|
+
help_text=_("Select target model field."),
|
|
125
126
|
widget=forms.Select(),
|
|
126
127
|
)
|
|
127
128
|
|
|
@@ -190,15 +191,15 @@ class IPFabricRelationshipFieldForm(NetBoxModelForm):
|
|
|
190
191
|
class IPFabricTransformFieldForm(NetBoxModelForm):
|
|
191
192
|
coalesce = forms.BooleanField(required=False, initial=False)
|
|
192
193
|
source_field = forms.CharField(
|
|
193
|
-
label="Source Field",
|
|
194
|
+
label=_("Source Field"),
|
|
194
195
|
required=True,
|
|
195
|
-
help_text="Select column from IP Fabric.",
|
|
196
|
+
help_text=_("Select column from IP Fabric."),
|
|
196
197
|
widget=forms.Select(),
|
|
197
198
|
)
|
|
198
199
|
target_field = forms.CharField(
|
|
199
|
-
label="Target Field",
|
|
200
|
+
label=_("Target Field"),
|
|
200
201
|
required=True,
|
|
201
|
-
help_text="Select target model field.",
|
|
202
|
+
help_text=_("Select target model field."),
|
|
202
203
|
widget=forms.Select(),
|
|
203
204
|
)
|
|
204
205
|
|
|
@@ -305,7 +306,7 @@ class IPFabricTransformMapBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
305
306
|
group = forms.ModelChoiceField(
|
|
306
307
|
queryset=IPFabricTransformMapGroup.objects.all(),
|
|
307
308
|
required=False,
|
|
308
|
-
label="Target Group",
|
|
309
|
+
label=_("Target Group"),
|
|
309
310
|
)
|
|
310
311
|
model = IPFabricTransformMap
|
|
311
312
|
fields = ("group",)
|
|
@@ -341,25 +342,27 @@ class IPFabricTransformMapBulkImportForm(NetBoxModelImportForm):
|
|
|
341
342
|
|
|
342
343
|
class IPFabricTransformMapCloneForm(forms.Form):
|
|
343
344
|
name = forms.CharField(
|
|
344
|
-
required=True,
|
|
345
|
+
required=True,
|
|
346
|
+
label=_("Name"),
|
|
347
|
+
help_text=_("Name for the cloned transform map."),
|
|
345
348
|
)
|
|
346
349
|
group = forms.ModelChoiceField(
|
|
347
350
|
queryset=IPFabricTransformMapGroup.objects.all(),
|
|
348
351
|
required=False,
|
|
349
|
-
label="Target Group",
|
|
350
|
-
help_text="Select the group to assign the cloned transform map to.",
|
|
352
|
+
label=_("Target Group"),
|
|
353
|
+
help_text=_("Select the group to assign the cloned transform map to."),
|
|
351
354
|
)
|
|
352
355
|
clone_fields = forms.BooleanField(
|
|
353
356
|
required=False,
|
|
354
357
|
initial=True,
|
|
355
|
-
label="Clone Child Fields",
|
|
356
|
-
help_text="Clone all child fields of this transform map.",
|
|
358
|
+
label=_("Clone Child Fields"),
|
|
359
|
+
help_text=_("Clone all child fields of this transform map."),
|
|
357
360
|
)
|
|
358
361
|
clone_relationships = forms.BooleanField(
|
|
359
362
|
required=False,
|
|
360
363
|
initial=True,
|
|
361
|
-
label="Clone Child Relationships",
|
|
362
|
-
help_text="Clone all child relationships of this transform map.",
|
|
364
|
+
label=_("Clone Child Relationships"),
|
|
365
|
+
help_text=_("Clone all child relationships of this transform map."),
|
|
363
366
|
)
|
|
364
367
|
|
|
365
368
|
|
|
@@ -383,7 +386,9 @@ class IPFabricSourceFilterForm(NetBoxModelFilterSetForm):
|
|
|
383
386
|
FieldSet("q", "filter_id"),
|
|
384
387
|
FieldSet("status", name=_("Source")),
|
|
385
388
|
)
|
|
386
|
-
status = forms.MultipleChoiceField(
|
|
389
|
+
status = forms.MultipleChoiceField(
|
|
390
|
+
choices=IPFabricSourceStatusChoices, required=False
|
|
391
|
+
)
|
|
387
392
|
|
|
388
393
|
|
|
389
394
|
class IPFabricIngestionFilterForm(SavedFiltersMixin, FilterForm):
|
|
@@ -481,7 +486,7 @@ class IPFabricSourceForm(NetBoxModelForm):
|
|
|
481
486
|
parameters["timeout"] = self.cleaned_data[name]
|
|
482
487
|
|
|
483
488
|
self.instance.parameters = parameters
|
|
484
|
-
self.instance.status =
|
|
489
|
+
self.instance.status = IPFabricSourceStatusChoices.NEW
|
|
485
490
|
|
|
486
491
|
instance = super().save(*args, **kwargs)
|
|
487
492
|
|
|
@@ -760,7 +765,7 @@ class IPFabricSyncForm(NetBoxModelForm):
|
|
|
760
765
|
)
|
|
761
766
|
]
|
|
762
767
|
raise ValidationError(
|
|
763
|
-
{"sites": f"Sites {invalid_sites} not part of the snapshot."}
|
|
768
|
+
{"sites": _(f"Sites {invalid_sites} not part of the snapshot.")}
|
|
764
769
|
)
|
|
765
770
|
|
|
766
771
|
scheduled_time = self.cleaned_data.get("scheduled")
|
|
@@ -801,7 +806,7 @@ class IPFabricSyncForm(NetBoxModelForm):
|
|
|
801
806
|
group.pk for group in self.cleaned_data["groups"]
|
|
802
807
|
]
|
|
803
808
|
self.instance.parameters = parameters
|
|
804
|
-
self.instance.status =
|
|
809
|
+
self.instance.status = IPFabricSyncStatusChoices.NEW
|
|
805
810
|
return super().save(*args, **kwargs)
|
|
806
811
|
|
|
807
812
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import strawberry
|
|
2
|
-
from core.choices import DataSourceStatusChoices
|
|
3
2
|
from core.choices import JobStatusChoices
|
|
4
3
|
from netbox_branching.choices import BranchStatusChoices
|
|
5
4
|
|
|
6
5
|
from ipfabric_netbox.choices import IPFabricRawDataTypeChoices
|
|
7
6
|
from ipfabric_netbox.choices import IPFabricSnapshotStatusModelChoices
|
|
7
|
+
from ipfabric_netbox.choices import IPFabricSourceStatusChoices
|
|
8
8
|
from ipfabric_netbox.choices import IPFabricSourceTypeChoices
|
|
9
|
+
from ipfabric_netbox.choices import IPFabricSyncStatusChoices
|
|
9
10
|
from ipfabric_netbox.choices import IPFabricTransformMapSourceModelChoices
|
|
10
11
|
|
|
11
12
|
__all__ = (
|
|
12
|
-
"
|
|
13
|
+
"IPFabricSourceStatusEnum",
|
|
14
|
+
"IPFabricSyncStatusEnum",
|
|
13
15
|
"IPFabricTransformMapSourceModelEnum",
|
|
14
16
|
"IPFabricSourceTypeEnum",
|
|
15
17
|
"IPFabricSnapshotStatusModelEnum",
|
|
@@ -18,7 +20,12 @@ __all__ = (
|
|
|
18
20
|
"JobStatusEnum",
|
|
19
21
|
)
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
IPFabricSourceStatusEnum = strawberry.enum(
|
|
24
|
+
IPFabricSourceStatusChoices.as_enum(prefix="type")
|
|
25
|
+
)
|
|
26
|
+
IPFabricSyncStatusEnum = strawberry.enum(
|
|
27
|
+
IPFabricSyncStatusChoices.as_enum(prefix="type")
|
|
28
|
+
)
|
|
22
29
|
IPFabricTransformMapSourceModelEnum = strawberry.enum(
|
|
23
30
|
IPFabricTransformMapSourceModelChoices.as_enum(prefix="type")
|
|
24
31
|
)
|
|
@@ -21,10 +21,11 @@ from users.graphql.filters import UserFilter
|
|
|
21
21
|
|
|
22
22
|
from ipfabric_netbox import models
|
|
23
23
|
from ipfabric_netbox.graphql.enums import BranchStatusEnum
|
|
24
|
-
from ipfabric_netbox.graphql.enums import DataSourceStatusEnum
|
|
25
24
|
from ipfabric_netbox.graphql.enums import IPFabricRawDataTypeEnum
|
|
26
25
|
from ipfabric_netbox.graphql.enums import IPFabricSnapshotStatusModelEnum
|
|
26
|
+
from ipfabric_netbox.graphql.enums import IPFabricSourceStatusEnum
|
|
27
27
|
from ipfabric_netbox.graphql.enums import IPFabricSourceTypeEnum
|
|
28
|
+
from ipfabric_netbox.graphql.enums import IPFabricSyncStatusEnum
|
|
28
29
|
from ipfabric_netbox.graphql.enums import IPFabricTransformMapSourceModelEnum
|
|
29
30
|
from ipfabric_netbox.graphql.enums import JobStatusEnum
|
|
30
31
|
|
|
@@ -127,7 +128,7 @@ class IPFabricSourceFilter(PrimaryModelFilterMixin):
|
|
|
127
128
|
url: FilterLookup[str] | None = strawberry_django.filter_field()
|
|
128
129
|
status: (
|
|
129
130
|
Annotated[
|
|
130
|
-
"
|
|
131
|
+
"IPFabricSourceStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
|
|
131
132
|
]
|
|
132
133
|
| None
|
|
133
134
|
) = strawberry_django.filter_field()
|
|
@@ -179,7 +180,7 @@ class IPFabricSyncFilter(TagsFilterMixin, ChangeLogFilterMixin, BaseFilterMixin)
|
|
|
179
180
|
) = strawberry_django.filter_field()
|
|
180
181
|
status: (
|
|
181
182
|
Annotated[
|
|
182
|
-
"
|
|
183
|
+
"IPFabricSyncStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
|
|
183
184
|
]
|
|
184
185
|
| None
|
|
185
186
|
) = strawberry_django.filter_field()
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from datetime import timedelta
|
|
3
3
|
|
|
4
|
-
from core.choices import DataSourceStatusChoices
|
|
5
4
|
from core.choices import JobStatusChoices
|
|
6
5
|
from core.exceptions import SyncError
|
|
7
6
|
from netbox.context_managers import event_tracking
|
|
@@ -9,6 +8,8 @@ from rq.timeouts import JobTimeoutException
|
|
|
9
8
|
from utilities.datetime import local_now
|
|
10
9
|
from utilities.request import NetBoxFakeRequest
|
|
11
10
|
|
|
11
|
+
from .choices import IPFabricSourceStatusChoices
|
|
12
|
+
from .choices import IPFabricSyncStatusChoices
|
|
12
13
|
from .models import IPFabricIngestion
|
|
13
14
|
from .models import IPFabricSource
|
|
14
15
|
from .models import IPFabricSync
|
|
@@ -26,7 +27,7 @@ def sync_ipfabricsource(job, *args, **kwargs):
|
|
|
26
27
|
except Exception as e:
|
|
27
28
|
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
|
|
28
29
|
IPFabricSource.objects.filter(pk=ipfsource.pk).update(
|
|
29
|
-
status=
|
|
30
|
+
status=IPFabricSourceStatusChoices.FAILED
|
|
30
31
|
)
|
|
31
32
|
if type(e) in (SyncError, JobTimeoutException):
|
|
32
33
|
logging.error(e)
|
|
@@ -44,7 +45,7 @@ def sync_ipfabric(job, *args, **kwargs):
|
|
|
44
45
|
except Exception as e:
|
|
45
46
|
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
|
|
46
47
|
IPFabricSync.objects.filter(pk=sync.pk).update(
|
|
47
|
-
status=
|
|
48
|
+
status=IPFabricSyncStatusChoices.FAILED
|
|
48
49
|
)
|
|
49
50
|
if type(e) in (SyncError, JobTimeoutException):
|
|
50
51
|
logging.error(e)
|
|
@@ -90,7 +91,7 @@ def sync_ipfabric(job, *args, **kwargs):
|
|
|
90
91
|
|
|
91
92
|
with event_tracking(request):
|
|
92
93
|
sync.scheduled = new_scheduled_time
|
|
93
|
-
sync.status =
|
|
94
|
+
sync.status = IPFabricSyncStatusChoices.QUEUED
|
|
94
95
|
sync.full_clean()
|
|
95
96
|
sync.save()
|
|
96
97
|
logger.info(
|
|
@@ -126,7 +127,7 @@ def merge_ipfabric_ingestion(job, remove_branch=False, *args, **kwargs):
|
|
|
126
127
|
print(e)
|
|
127
128
|
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
|
|
128
129
|
IPFabricSync.objects.filter(pk=ingestion.sync.pk).update(
|
|
129
|
-
status=
|
|
130
|
+
status=IPFabricSyncStatusChoices.FAILED
|
|
130
131
|
)
|
|
131
132
|
if type(e) in (SyncError, JobTimeoutException):
|
|
132
133
|
logging.error(e)
|