ipfabric_netbox 4.2.1__py3-none-any.whl → 4.2.1b2__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.
- ipfabric_netbox/__init__.py +1 -1
- ipfabric_netbox/api/__init__.py +0 -1
- ipfabric_netbox/api/serializers.py +147 -90
- ipfabric_netbox/api/urls.py +4 -4
- ipfabric_netbox/api/views.py +18 -19
- ipfabric_netbox/choices.py +0 -12
- ipfabric_netbox/filtersets.py +67 -4
- ipfabric_netbox/forms.py +92 -140
- ipfabric_netbox/graphql/__init__.py +23 -0
- ipfabric_netbox/graphql/enums.py +35 -0
- ipfabric_netbox/graphql/filters.py +317 -0
- ipfabric_netbox/graphql/schema.py +101 -0
- ipfabric_netbox/graphql/types.py +216 -0
- ipfabric_netbox/migrations/0016_tags_and_changelog_for_snapshots.py +31 -0
- ipfabric_netbox/migrations/0017_ipfabricsync_update_custom_fields.py +17 -0
- ipfabric_netbox/migrations/0018_remove_type_field.py +17 -0
- ipfabric_netbox/models.py +10 -10
- ipfabric_netbox/tables.py +30 -9
- ipfabric_netbox/tests/api/__init__.py +0 -0
- ipfabric_netbox/tests/api/test_api.py +879 -0
- ipfabric_netbox/tests/test_forms.py +1440 -0
- ipfabric_netbox/tests/test_models.py +47 -11
- ipfabric_netbox/utilities/ipfutils.py +43 -23
- ipfabric_netbox/views.py +6 -8
- {ipfabric_netbox-4.2.1.dist-info → ipfabric_netbox-4.2.1b2.dist-info}/METADATA +6 -6
- {ipfabric_netbox-4.2.1.dist-info → ipfabric_netbox-4.2.1b2.dist-info}/RECORD +27 -18
- ipfabric_netbox/api/nested_serializers.py +0 -78
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync_list.html +0 -71
- {ipfabric_netbox-4.2.1.dist-info → ipfabric_netbox-4.2.1b2.dist-info}/WHEEL +0 -0
|
@@ -8,6 +8,7 @@ from django.test import TestCase
|
|
|
8
8
|
from django.utils import timezone
|
|
9
9
|
|
|
10
10
|
from ipfabric_netbox.choices import IPFabricSnapshotStatusModelChoices
|
|
11
|
+
from ipfabric_netbox.models import IPFabricIngestion
|
|
11
12
|
from ipfabric_netbox.models import IPFabricSnapshot
|
|
12
13
|
from ipfabric_netbox.models import IPFabricSource
|
|
13
14
|
from ipfabric_netbox.models import IPFabricSync
|
|
@@ -118,9 +119,9 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
118
119
|
)
|
|
119
120
|
sync = IPFabricSync.objects.create(
|
|
120
121
|
name="ingest",
|
|
121
|
-
type="dcim",
|
|
122
122
|
status="new",
|
|
123
123
|
snapshot_data=snapshot,
|
|
124
|
+
update_custom_fields=True,
|
|
124
125
|
parameters={
|
|
125
126
|
"vrf": False,
|
|
126
127
|
"site": True,
|
|
@@ -138,6 +139,8 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
138
139
|
},
|
|
139
140
|
)
|
|
140
141
|
|
|
142
|
+
ingestion = IPFabricIngestion.objects.create(sync=sync)
|
|
143
|
+
|
|
141
144
|
runner = IPFabricSyncRunner(
|
|
142
145
|
settings={
|
|
143
146
|
"site": True,
|
|
@@ -152,7 +155,11 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
152
155
|
"snapshot_id": "12dd8c61-129c-431a-b98b-4c9211571f89",
|
|
153
156
|
},
|
|
154
157
|
sync=sync,
|
|
158
|
+
ingestion=ingestion,
|
|
155
159
|
)
|
|
160
|
+
# Need to monkeypatch since we are not in active Branch (different schema)
|
|
161
|
+
# Using default schema "default" here since we are in "test_netbox" DB
|
|
162
|
+
runner.get_db_connection_name = lambda: "default"
|
|
156
163
|
|
|
157
164
|
site_data = {
|
|
158
165
|
"siteName": "MPLS",
|
|
@@ -166,7 +173,9 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
166
173
|
"networksCount": 6,
|
|
167
174
|
}
|
|
168
175
|
|
|
169
|
-
self.site = runner.
|
|
176
|
+
self.site = runner.sync_item(
|
|
177
|
+
item=site_data, app_label="dcim", model="site", cf=sync.update_custom_fields
|
|
178
|
+
)
|
|
170
179
|
|
|
171
180
|
device_data = {
|
|
172
181
|
"id": "961251111",
|
|
@@ -204,14 +213,36 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
204
213
|
"slug": None,
|
|
205
214
|
}
|
|
206
215
|
|
|
207
|
-
self.mf_obj = runner.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
self.mf_obj = runner.sync_item(
|
|
217
|
+
item=device_data,
|
|
218
|
+
app_label="dcim",
|
|
219
|
+
model="manufacturer",
|
|
220
|
+
cf=sync.update_custom_fields,
|
|
221
|
+
)
|
|
222
|
+
self.dt_obj = runner.sync_item(
|
|
223
|
+
item=device_data,
|
|
224
|
+
app_label="dcim",
|
|
225
|
+
model="devicetype",
|
|
226
|
+
cf=sync.update_custom_fields,
|
|
227
|
+
)
|
|
228
|
+
self.platform = runner.sync_item(
|
|
229
|
+
item=device_data,
|
|
230
|
+
app_label="dcim",
|
|
231
|
+
model="platform",
|
|
232
|
+
cf=sync.update_custom_fields,
|
|
233
|
+
)
|
|
234
|
+
self.role = runner.sync_item(
|
|
235
|
+
item=device_data,
|
|
236
|
+
app_label="dcim",
|
|
237
|
+
model="devicerole",
|
|
238
|
+
cf=sync.update_custom_fields,
|
|
239
|
+
)
|
|
240
|
+
self.device_object = runner.sync_item(
|
|
241
|
+
item=device_data,
|
|
242
|
+
app_label="dcim",
|
|
243
|
+
model="device",
|
|
244
|
+
cf=sync.update_custom_fields,
|
|
245
|
+
)
|
|
215
246
|
|
|
216
247
|
def test_transform_map(self):
|
|
217
248
|
site_transform_map = IPFabricTransformMap.objects.get(name="Site Transform Map")
|
|
@@ -383,5 +414,10 @@ class IPFabricTransformMapModelTestCase(TestCase):
|
|
|
383
414
|
)
|
|
384
415
|
transform_field.template = "{{ object.hostname }} - test"
|
|
385
416
|
transform_field.save()
|
|
386
|
-
device_object = runner.
|
|
417
|
+
device_object = runner.sync_item(
|
|
418
|
+
item=device_data,
|
|
419
|
+
app_label="dcim",
|
|
420
|
+
model="device",
|
|
421
|
+
cf=sync.update_custom_fields,
|
|
422
|
+
)
|
|
387
423
|
self.assertEqual(device_object.name, "L21PE152 - test")
|
|
@@ -589,6 +589,35 @@ class IPFabricSyncRunner(object):
|
|
|
589
589
|
|
|
590
590
|
return instance
|
|
591
591
|
|
|
592
|
+
def sync_item(
|
|
593
|
+
self,
|
|
594
|
+
item,
|
|
595
|
+
app_label: str,
|
|
596
|
+
model: str,
|
|
597
|
+
cf: bool = False,
|
|
598
|
+
ingestion: "IPFabricIngestion" = None,
|
|
599
|
+
) -> ModelTypeVar | None:
|
|
600
|
+
"""Sync a single item to NetBox."""
|
|
601
|
+
synced_object = self.sync_model(
|
|
602
|
+
app_label=app_label,
|
|
603
|
+
model=model,
|
|
604
|
+
data=item,
|
|
605
|
+
sync=self.settings.get(model),
|
|
606
|
+
)
|
|
607
|
+
if synced_object is None:
|
|
608
|
+
return None
|
|
609
|
+
|
|
610
|
+
if cf:
|
|
611
|
+
synced_object.snapshot()
|
|
612
|
+
synced_object.custom_field_data[
|
|
613
|
+
"ipfabric_source"
|
|
614
|
+
] = self.sync.snapshot_data.source.pk
|
|
615
|
+
if ingestion:
|
|
616
|
+
synced_object.custom_field_data["ipfabric_ingestion"] = ingestion.pk
|
|
617
|
+
synced_object.save()
|
|
618
|
+
|
|
619
|
+
return synced_object
|
|
620
|
+
|
|
592
621
|
def sync_items(
|
|
593
622
|
self,
|
|
594
623
|
items,
|
|
@@ -605,23 +634,7 @@ class IPFabricSyncRunner(object):
|
|
|
605
634
|
return
|
|
606
635
|
|
|
607
636
|
for item in items:
|
|
608
|
-
|
|
609
|
-
app_label=app_label,
|
|
610
|
-
model=model,
|
|
611
|
-
data=item,
|
|
612
|
-
sync=self.settings.get(model),
|
|
613
|
-
)
|
|
614
|
-
if synced_object is None:
|
|
615
|
-
continue
|
|
616
|
-
|
|
617
|
-
if cf:
|
|
618
|
-
synced_object.snapshot()
|
|
619
|
-
synced_object.custom_field_data[
|
|
620
|
-
"ipfabric_source"
|
|
621
|
-
] = self.sync.snapshot_data.source.pk
|
|
622
|
-
if ingestion:
|
|
623
|
-
synced_object.custom_field_data["ipfabric_ingestion"] = ingestion.pk
|
|
624
|
-
synced_object.save()
|
|
637
|
+
self.sync_item(item, app_label, model, cf, ingestion)
|
|
625
638
|
|
|
626
639
|
@handle_errors
|
|
627
640
|
def sync_devices(
|
|
@@ -684,11 +697,14 @@ class IPFabricSyncRunner(object):
|
|
|
684
697
|
|
|
685
698
|
if device_object and self.settings.get("device"):
|
|
686
699
|
device_object.snapshot()
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
700
|
+
if self.sync.update_custom_fields:
|
|
701
|
+
device_object.custom_field_data[
|
|
702
|
+
"ipfabric_source"
|
|
703
|
+
] = self.sync.snapshot_data.source.pk
|
|
704
|
+
if ingestion:
|
|
705
|
+
device_object.custom_field_data[
|
|
706
|
+
"ipfabric_ingestion"
|
|
707
|
+
] = ingestion.pk
|
|
692
708
|
device_object.save()
|
|
693
709
|
|
|
694
710
|
self.logger.increment_statistics(model="device")
|
|
@@ -829,7 +845,11 @@ class IPFabricSyncRunner(object):
|
|
|
829
845
|
) = self.collect_data()
|
|
830
846
|
|
|
831
847
|
self.sync_items(
|
|
832
|
-
app_label="dcim",
|
|
848
|
+
app_label="dcim",
|
|
849
|
+
model="site",
|
|
850
|
+
items=sites,
|
|
851
|
+
cf=self.sync.update_custom_fields,
|
|
852
|
+
ingestion=ingestion,
|
|
833
853
|
)
|
|
834
854
|
self.sync_devices(
|
|
835
855
|
ingestion,
|
ipfabric_netbox/views.py
CHANGED
|
@@ -37,6 +37,7 @@ from .filtersets import IPFabricIngestionFilterSet
|
|
|
37
37
|
from .filtersets import IPFabricIngestionIssueFilterSet
|
|
38
38
|
from .filtersets import IPFabricSnapshotFilterSet
|
|
39
39
|
from .filtersets import IPFabricSourceFilterSet
|
|
40
|
+
from .filtersets import IPFabricSyncFilterSet
|
|
40
41
|
from .filtersets import IPFabricTransformMapFilterSet
|
|
41
42
|
from .filtersets import IPFabricTransformMapGroupFilterSet
|
|
42
43
|
from .forms import IPFabricIngestionFilterForm
|
|
@@ -69,6 +70,7 @@ from .tables import IPFabricIngestionTable
|
|
|
69
70
|
from .tables import IPFabricRelationshipFieldTable
|
|
70
71
|
from .tables import IPFabricSnapshotTable
|
|
71
72
|
from .tables import IPFabricSourceTable
|
|
73
|
+
from .tables import IPFabricSyncTable
|
|
72
74
|
from .tables import IPFabricTransformFieldTable
|
|
73
75
|
from .tables import IPFabricTransformMapGroupTable
|
|
74
76
|
from .tables import IPFabricTransformMapTable
|
|
@@ -528,14 +530,10 @@ class IPFabricSourceBulkDeleteView(generic.BulkDeleteView):
|
|
|
528
530
|
|
|
529
531
|
|
|
530
532
|
# Sync
|
|
531
|
-
class IPFabricSyncListView(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
request,
|
|
536
|
-
"ipfabric_netbox/ipfabricsync_list.html",
|
|
537
|
-
{"model": IPFabricSync, "syncs": syncs},
|
|
538
|
-
)
|
|
533
|
+
class IPFabricSyncListView(generic.ObjectListView):
|
|
534
|
+
queryset = IPFabricSync.objects.all()
|
|
535
|
+
table = IPFabricSyncTable
|
|
536
|
+
filterset = IPFabricSyncFilterSet
|
|
539
537
|
|
|
540
538
|
|
|
541
539
|
@register_model_view(IPFabricSync, "edit")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ipfabric_netbox
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.1b2
|
|
4
4
|
Summary: NetBox plugin to sync IP Fabric data into NetBox
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: netbox,ipfabric,plugin,sync
|
|
@@ -18,11 +18,11 @@ Provides-Extra: ipfabric-6-10
|
|
|
18
18
|
Provides-Extra: ipfabric-7-0
|
|
19
19
|
Provides-Extra: ipfabric-7-2
|
|
20
20
|
Provides-Extra: ipfabric-7-3
|
|
21
|
-
Requires-Dist: ipfabric (>=6.10.0,<6.11.0) ; extra == "ipfabric_6_10" and extra != "ipfabric_7_0" and extra != "ipfabric_7_2"
|
|
22
|
-
Requires-Dist: ipfabric (>=6.6.4) ; extra != "ipfabric_6_10" and extra != "ipfabric_7_0" and extra != "ipfabric_7_2"
|
|
23
|
-
Requires-Dist: ipfabric (>=7.0.0,<7.1.0) ; extra != "ipfabric_6_10" and extra == "ipfabric_7_0" and extra != "ipfabric_7_2"
|
|
24
|
-
Requires-Dist: ipfabric (>=7.2.0,<7.3.0) ; extra
|
|
25
|
-
Requires-Dist: ipfabric (>=7.3.0,<7.4.0) ; extra
|
|
21
|
+
Requires-Dist: ipfabric (>=6.10.0,<6.11.0) ; extra == "ipfabric_6_10" and extra != "ipfabric_7_0" and extra != "ipfabric_7_2" and extra != "ipfabric_7_3"
|
|
22
|
+
Requires-Dist: ipfabric (>=6.6.4) ; extra != "ipfabric_6_10" and extra != "ipfabric_7_0" and extra != "ipfabric_7_2" and extra != "ipfabric_7_3"
|
|
23
|
+
Requires-Dist: ipfabric (>=7.0.0,<7.1.0) ; extra != "ipfabric_6_10" and extra == "ipfabric_7_0" and extra != "ipfabric_7_2" and extra != "ipfabric_7_3"
|
|
24
|
+
Requires-Dist: ipfabric (>=7.2.0,<7.3.0) ; extra != "ipfabric_6_10" and extra != "ipfabric_7_0" and extra == "ipfabric_7_2" and extra != "ipfabric_7_3"
|
|
25
|
+
Requires-Dist: ipfabric (>=7.3.0,<7.4.0) ; extra != "ipfabric_6_10" and extra != "ipfabric_7_0" and extra != "ipfabric_7_2" and extra == "ipfabric_7_3"
|
|
26
26
|
Requires-Dist: netboxlabs-netbox-branching (>=0.5.5,<0.6.0)
|
|
27
27
|
Requires-Dist: netutils
|
|
28
28
|
Project-URL: Bug Tracker, https://gitlab.com/ip-fabric/integrations/ipfabric-netbox-sync/-/issues
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
ipfabric_netbox/__init__.py,sha256=
|
|
2
|
-
ipfabric_netbox/api/__init__.py,sha256=
|
|
3
|
-
ipfabric_netbox/api/
|
|
4
|
-
ipfabric_netbox/api/
|
|
5
|
-
ipfabric_netbox/api/
|
|
6
|
-
ipfabric_netbox/
|
|
7
|
-
ipfabric_netbox/choices.py,sha256=tQ5RHwmuArQ7dCLcE3A_Bnw2ctGHgw67z--AawyyPPg,5261
|
|
1
|
+
ipfabric_netbox/__init__.py,sha256=mPmx18s2DiIlJi3Nwvk1cjWzGkAlxTJmAGM406w5lts,674
|
|
2
|
+
ipfabric_netbox/api/__init__.py,sha256=XRclTGWVR0ZhAAwgYul5Wm_loug5_hUjEumbLQEwKYM,47
|
|
3
|
+
ipfabric_netbox/api/serializers.py,sha256=7cmVsIzGzz9u6htLKizLr2Ar0OC7uV8rMX3U7EzRmG4,6482
|
|
4
|
+
ipfabric_netbox/api/urls.py,sha256=1fXXVTxNY5E64Nfz6b7zXD9bZI3FcefuxAWKMe0w_QU,1240
|
|
5
|
+
ipfabric_netbox/api/views.py,sha256=gluK311fDx3sLsQ6iE6O1M_s3Kz1_sjD0sfmWR_UE2Q,5064
|
|
6
|
+
ipfabric_netbox/choices.py,sha256=27ePh1IUU3zETbceNcAgjsHvqhPlGpayFRFr5luqW1k,5039
|
|
8
7
|
ipfabric_netbox/data/transform_map.json,sha256=4PsucgMHcLW3SPoKEptQCd0gA5tCF4hjrR4bGQFCWy8,21744
|
|
9
8
|
ipfabric_netbox/exceptions.py,sha256=DT4dpbakvqoROtBR_F0LzvQCMNWpGhufFcUbZTx0OLY,2655
|
|
10
|
-
ipfabric_netbox/filtersets.py,sha256=
|
|
11
|
-
ipfabric_netbox/forms.py,sha256=
|
|
9
|
+
ipfabric_netbox/filtersets.py,sha256=vaWlxf8DTwduv_aQ35kJxwyzmM1XvE781GjUj2z4QGQ,7845
|
|
10
|
+
ipfabric_netbox/forms.py,sha256=8xKVE_MneFKCILPGDrfEIskGD1BjCoH9UtrteOSSihU,42939
|
|
11
|
+
ipfabric_netbox/graphql/__init__.py,sha256=-a5w_VY7pc-RVt8MvThkTzeAqCC3xCan4Ue6iMefmjI,754
|
|
12
|
+
ipfabric_netbox/graphql/enums.py,sha256=QFhwiwUKJekxQfsOGk_-70_WnkzrKEP_zIBMrin0S0Q,1343
|
|
13
|
+
ipfabric_netbox/graphql/filters.py,sha256=B8xy9r9a18vWfV6a6tHXAN1FUcoxI6MOrbsdNmzusNI,12991
|
|
14
|
+
ipfabric_netbox/graphql/schema.py,sha256=5UVHA1hHRvho5eLuuS-HLXTVTbxpUUx68ovG03gumGE,3209
|
|
15
|
+
ipfabric_netbox/graphql/types.py,sha256=8RxdxiA-WnoaWSzh-tUJCuZBYGmd6QjfJiJcLirRMKY,5961
|
|
12
16
|
ipfabric_netbox/jobs.py,sha256=KrTUeCuFUIU7vKCUS3RiBYCBG7g7GzhGagM_qFMGQJ4,3089
|
|
13
17
|
ipfabric_netbox/migrations/0001_initial.py,sha256=VphxkWL6QzWq2tcrdXlog718xQtiEGizKwS830z_fOs,13824
|
|
14
18
|
ipfabric_netbox/migrations/0001_initial_squashed_0013_switch_to_branching_plugin.py,sha256=xDj5QJfTmG7ZgUSTRiJRndjSOv25dORtzzs-LySbr-c,20874
|
|
@@ -26,11 +30,14 @@ ipfabric_netbox/migrations/0012_remove_status_field.py,sha256=UZTY2BOBuV4Y_7zuPR
|
|
|
26
30
|
ipfabric_netbox/migrations/0013_switch_to_branching_plugin.py,sha256=JfdTNerjuFyjW3pDm4vueOp2lrDh2xt6lL1Et5i4crg,10754
|
|
27
31
|
ipfabric_netbox/migrations/0014_ipfabrictransformmapgroup_ipfabrictransformmap_group.py,sha256=RCfgKyqQhTkfSPhf0IukI3fjeAEBUs5pKWIpsLxgzp0,2272
|
|
28
32
|
ipfabric_netbox/migrations/0015_ipfabricingestionissue.py,sha256=AjAkyboa4BSXsN53BqzO1k_U6QHu4rlA2IhzhubocJw,1732
|
|
33
|
+
ipfabric_netbox/migrations/0016_tags_and_changelog_for_snapshots.py,sha256=XqftTQ4GFnoCoGSHPa2WL_bjSVCGxdP2MFXCUa6LN1k,929
|
|
34
|
+
ipfabric_netbox/migrations/0017_ipfabricsync_update_custom_fields.py,sha256=IVbAL2WdigYT40sXN0A8K3HweJ_O4QqyzjB06TbkG5E,447
|
|
35
|
+
ipfabric_netbox/migrations/0018_remove_type_field.py,sha256=ffxW6IS3BLCbvM5M9DbDb_x6spMmRxnV1iq8IuXxMGw,385
|
|
29
36
|
ipfabric_netbox/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
ipfabric_netbox/models.py,sha256=
|
|
37
|
+
ipfabric_netbox/models.py,sha256=T2VOnlKyWkYpwnsGkkgt5-zwvVbxT1eqTnEfCvTV5jc,36072
|
|
31
38
|
ipfabric_netbox/navigation.py,sha256=2dEJ_wKHb52Tl0FOV1TH3JbxRe8YZ56ewrTsBFGKpCg,2210
|
|
32
39
|
ipfabric_netbox/signals.py,sha256=cGa5PVD2i24pGXiVNfbu6ruIDqPVdwKQHTSWe9Ura84,1838
|
|
33
|
-
ipfabric_netbox/tables.py,sha256=
|
|
40
|
+
ipfabric_netbox/tables.py,sha256=zJUCoOrJgBNVxOmQrvlUyoD_0_Kq988GjregdcSAa68,8854
|
|
34
41
|
ipfabric_netbox/template_content.py,sha256=ZT0uxqaC-Xnvrvm3nr89P9r43vsIuie3xcXIuT0UCN0,959
|
|
35
42
|
ipfabric_netbox/templates/ipfabric_netbox/inc/clone_form.html,sha256=K-2TTDaS1F4wUIR8FFFPqex4KJbySXtHiz5V-OEwelY,967
|
|
36
43
|
ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html,sha256=xOiIrvRIBtqDD65u6xcLo2xdwDKNpAylDmzznaJRGCw,3281
|
|
@@ -47,7 +54,6 @@ ipfabric_netbox/templates/ipfabric_netbox/ipfabricingestion.html,sha256=fm_X2FLn
|
|
|
47
54
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabricsnapshot.html,sha256=hj8ORs_4mM_xTjmw3McHN-da5seC8nbbkzobn0f1TSc,3482
|
|
48
55
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabricsource.html,sha256=koR_t6Mf2FhWlPZHchWsTOQDSLB7AWrqtY0TRnIzrrM,3864
|
|
49
56
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync.html,sha256=BicVS7mCP85fFZJEt46GUm5xppi1Jw3byw1el9BB2WE,4448
|
|
50
|
-
ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync_list.html,sha256=b6uE317N69oeknOOqnJo5I-qm44QezDlBTRqslbEO8I,2593
|
|
51
57
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap.html,sha256=qFo_Ku5oksx5co4HVtVq0xAVFI6CLWs-iBrwYzGsEGA,1460
|
|
52
58
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_list.html,sha256=p8zqn0-B6mawSUM3zQrus6dsKUM5SRBTO0X94pLboX8,452
|
|
53
59
|
ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_restore.html,sha256=cuvOBKnlMudMI-CX77W3vTpwhtc4CBcc6j6Ye-IBBMQ,2562
|
|
@@ -63,14 +69,17 @@ ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css,sha256=z1H-RmmsqF2
|
|
|
63
69
|
ipfabric_netbox/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
70
|
ipfabric_netbox/templatetags/ipfabric_netbox_helpers.py,sha256=STw4pAd2qG7hgf-O6UNTwsO5VqEa_gxf5wLv50BWL4Q,417
|
|
65
71
|
ipfabric_netbox/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
|
-
ipfabric_netbox/tests/
|
|
72
|
+
ipfabric_netbox/tests/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
|
+
ipfabric_netbox/tests/api/test_api.py,sha256=mZp0CUBJb0MUcnfKAWWrQ4Kab11OXtSI9XQtMZ4q40U,30282
|
|
74
|
+
ipfabric_netbox/tests/test_forms.py,sha256=8sW0MHu2MtCDVHoaKM78U1_GioLjQk6UIvgN2Vijvv4,57518
|
|
75
|
+
ipfabric_netbox/tests/test_models.py,sha256=FFrIT5xxv_yvujKpxGjRJPNPBDF2Pqi8zbY0vxuJeQs,16043
|
|
67
76
|
ipfabric_netbox/urls.py,sha256=ok66LP09rYi01qJmwdGGlBzV9wrGWVwVAIngPcreJxg,5449
|
|
68
77
|
ipfabric_netbox/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
-
ipfabric_netbox/utilities/ipfutils.py,sha256=
|
|
78
|
+
ipfabric_netbox/utilities/ipfutils.py,sha256=wFmL5oriuF-is1ZlrIcLmoeYUY5ih-CA9weRQrx5AiA,31885
|
|
70
79
|
ipfabric_netbox/utilities/logging.py,sha256=GYknjocMN6LQ2873_az3y0RKm29TCXaWviUIIneH-x0,3445
|
|
71
80
|
ipfabric_netbox/utilities/nbutils.py,sha256=kFBEiJOGvr_49hJWCS2duXojx2-A9kVk0Xp_vj0ohfs,2641
|
|
72
81
|
ipfabric_netbox/utilities/transform_map.py,sha256=QotbGc2TksINJrb62STgAigpC5Nsgi5umYHu_0rZd8k,2204
|
|
73
|
-
ipfabric_netbox/views.py,sha256=
|
|
74
|
-
ipfabric_netbox-4.2.
|
|
75
|
-
ipfabric_netbox-4.2.
|
|
76
|
-
ipfabric_netbox-4.2.
|
|
82
|
+
ipfabric_netbox/views.py,sha256=W7By73eiopwX-Q10S4kcFVL-lkz0WG0pwe2doNpvYg0,36807
|
|
83
|
+
ipfabric_netbox-4.2.1b2.dist-info/METADATA,sha256=wOESiw1nulaTl2RnMx1UmLIVY3pniBXZlmKQWLHvb7U,4638
|
|
84
|
+
ipfabric_netbox-4.2.1b2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
85
|
+
ipfabric_netbox-4.2.1b2.dist-info/RECORD,,
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
from drf_spectacular.types import OpenApiTypes
|
|
2
|
-
from drf_spectacular.utils import extend_schema_field
|
|
3
|
-
from netbox.api.fields import ContentTypeField
|
|
4
|
-
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
-
from netbox.api.serializers import WritableNestedSerializer
|
|
6
|
-
from rest_framework import serializers
|
|
7
|
-
|
|
8
|
-
from ipfabric_netbox.models import IPFabricSnapshot
|
|
9
|
-
from ipfabric_netbox.models import IPFabricSource
|
|
10
|
-
from ipfabric_netbox.models import IPFabricSync
|
|
11
|
-
from ipfabric_netbox.models import IPFabricTransformMap
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__all__ = (
|
|
15
|
-
"NestedIPFabricSourceSerializer",
|
|
16
|
-
"NestedIPFabricSnapshotSerializer",
|
|
17
|
-
"NestedIPFabricTransformMapSerializer",
|
|
18
|
-
"NestedIPFabricSyncSerializer",
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class NestedIPFabricSourceSerializer(WritableNestedSerializer):
|
|
23
|
-
url = serializers.URLField()
|
|
24
|
-
|
|
25
|
-
class Meta:
|
|
26
|
-
model = IPFabricSource
|
|
27
|
-
fields = ["id", "url", "display", "name", "type"]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class NestedIPFabricSnapshotSerializer(NetBoxModelSerializer):
|
|
31
|
-
source = NestedIPFabricSourceSerializer(read_only=True)
|
|
32
|
-
display = serializers.SerializerMethodField(read_only=True)
|
|
33
|
-
|
|
34
|
-
class Meta:
|
|
35
|
-
model = IPFabricSnapshot
|
|
36
|
-
fields = [
|
|
37
|
-
"id",
|
|
38
|
-
"name",
|
|
39
|
-
"source",
|
|
40
|
-
"snapshot_id",
|
|
41
|
-
"status",
|
|
42
|
-
"date",
|
|
43
|
-
"display",
|
|
44
|
-
"sites",
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
@extend_schema_field(OpenApiTypes.STR)
|
|
48
|
-
def get_display(self, obj):
|
|
49
|
-
return f"{obj.name} ({obj.snapshot_id})"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class NestedIPFabricSyncSerializer(NetBoxModelSerializer):
|
|
53
|
-
snapshot_data = NestedIPFabricSnapshotSerializer(read_only=True)
|
|
54
|
-
|
|
55
|
-
class Meta:
|
|
56
|
-
model = IPFabricSync
|
|
57
|
-
fields = [
|
|
58
|
-
"id",
|
|
59
|
-
"name",
|
|
60
|
-
"display",
|
|
61
|
-
"snapshot_data",
|
|
62
|
-
"type",
|
|
63
|
-
"status",
|
|
64
|
-
"parameters",
|
|
65
|
-
"last_synced",
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class NestedIPFabricTransformMapSerializer(NetBoxModelSerializer):
|
|
70
|
-
target_model = ContentTypeField(read_only=True)
|
|
71
|
-
|
|
72
|
-
class Meta:
|
|
73
|
-
model = IPFabricTransformMap
|
|
74
|
-
fields = [
|
|
75
|
-
"id",
|
|
76
|
-
"source_model",
|
|
77
|
-
"target_model",
|
|
78
|
-
]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{% extends 'base/layout.html' %}
|
|
2
|
-
{% load buttons %}
|
|
3
|
-
{% load helpers %}
|
|
4
|
-
{% load perms %}
|
|
5
|
-
|
|
6
|
-
{% block title %}Ingestion{% endblock %}
|
|
7
|
-
|
|
8
|
-
{% block tabs %}
|
|
9
|
-
<ul class="nav nav-tabs px-3">
|
|
10
|
-
<li class="nav-item" role="presentation">
|
|
11
|
-
<a class="nav-link active" role="tab">Ingestion</a>
|
|
12
|
-
</li>
|
|
13
|
-
</ul>
|
|
14
|
-
{% endblock tabs %}
|
|
15
|
-
|
|
16
|
-
{% block controls %}
|
|
17
|
-
<div class="controls">
|
|
18
|
-
<div class="control-group">
|
|
19
|
-
{% block extra_controls %}{% endblock %}
|
|
20
|
-
{% add_button model %}
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
{% endblock controls %}
|
|
24
|
-
|
|
25
|
-
{% block content %}
|
|
26
|
-
<div class="tab-content">
|
|
27
|
-
{% for sync in syncs %}
|
|
28
|
-
<div class="card">
|
|
29
|
-
<h5 class="card-header d-flex justify-content-between" id="module{{ module.pk }}">
|
|
30
|
-
<div>
|
|
31
|
-
<i class="mdi mdi-cloud-sync"></i><i class="mdi mdi-sync"></i> <a href="{% url 'plugins:ipfabric_netbox:ipfabricsync' pk=sync.pk %}">{{ sync.name}}</a>
|
|
32
|
-
</div>
|
|
33
|
-
{% if perms.ipfabric_netbox.delete_ipfabricsync %}
|
|
34
|
-
<a href="{% url 'plugins:ipfabric_netbox:ipfabricsync_delete' pk=sync.pk %}" class="btn btn-danger btn-sm">
|
|
35
|
-
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete
|
|
36
|
-
</a>
|
|
37
|
-
{% endif %}
|
|
38
|
-
|
|
39
|
-
</h5>
|
|
40
|
-
<div class="card-body">
|
|
41
|
-
{% include 'inc/sync_warning.html' with object=module %}
|
|
42
|
-
<table class="table table-hover table-headings reports">
|
|
43
|
-
<thead>
|
|
44
|
-
<tr>
|
|
45
|
-
<th width="200">Source</th>
|
|
46
|
-
<th width="400">Snapshot</th>
|
|
47
|
-
<th>Status</th>
|
|
48
|
-
<th>Last Run</th>
|
|
49
|
-
</tr>
|
|
50
|
-
</thead>
|
|
51
|
-
<tbody>
|
|
52
|
-
<tr>
|
|
53
|
-
<td><a href="{% url 'plugins:ipfabric_netbox:ipfabricsource' pk=sync.snapshot_data.source.pk %}">{{ sync.snapshot_data.source.name }}</a></td>
|
|
54
|
-
<td><a href="{% url 'plugins:ipfabric_netbox:ipfabricsnapshot' pk=sync.snapshot_data.pk %}">{{ sync.snapshot_data.name}}</a></td>
|
|
55
|
-
<td>{% badge sync.get_status_display last_job.get_status_color %}</td>
|
|
56
|
-
<td>{{sync.last_synced}}</td>
|
|
57
|
-
</tr>
|
|
58
|
-
</tbody>
|
|
59
|
-
</table>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
{% empty %}
|
|
63
|
-
<div class="alert alert-info" role="alert">
|
|
64
|
-
<h4 class="alert-heading">Sync Jobs Settings Found</h4>
|
|
65
|
-
{% if perms.extras.add_reportmodule %}
|
|
66
|
-
Get started by <a href="{% url 'plugins:ipfabric_netbox:ipfabricsync_add' %}">creating a sync</a> from an IP Fabric source.
|
|
67
|
-
{% endif %}
|
|
68
|
-
</div>
|
|
69
|
-
{% endfor %}
|
|
70
|
-
</div>
|
|
71
|
-
{% endblock content %}
|
|
File without changes
|