ipfabric_netbox 4.2.1b2__py3-none-any.whl → 4.2.2__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.

Potentially problematic release.


This version of ipfabric_netbox might be problematic. Click here for more details.

@@ -589,35 +589,6 @@ 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
-
621
592
  def sync_items(
622
593
  self,
623
594
  items,
@@ -634,7 +605,23 @@ class IPFabricSyncRunner(object):
634
605
  return
635
606
 
636
607
  for item in items:
637
- self.sync_item(item, app_label, model, cf, ingestion)
608
+ synced_object = self.sync_model(
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()
638
625
 
639
626
  @handle_errors
640
627
  def sync_devices(
@@ -697,14 +684,11 @@ class IPFabricSyncRunner(object):
697
684
 
698
685
  if device_object and self.settings.get("device"):
699
686
  device_object.snapshot()
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
687
+ device_object.custom_field_data[
688
+ "ipfabric_source"
689
+ ] = self.sync.snapshot_data.source.pk
690
+ if ingestion:
691
+ device_object.custom_field_data["ipfabric_ingestion"] = ingestion.pk
708
692
  device_object.save()
709
693
 
710
694
  self.logger.increment_statistics(model="device")
@@ -845,11 +829,7 @@ class IPFabricSyncRunner(object):
845
829
  ) = self.collect_data()
846
830
 
847
831
  self.sync_items(
848
- app_label="dcim",
849
- model="site",
850
- items=sites,
851
- cf=self.sync.update_custom_fields,
852
- ingestion=ingestion,
832
+ app_label="dcim", model="site", items=sites, cf=True, ingestion=ingestion
853
833
  )
854
834
  self.sync_devices(
855
835
  ingestion,
ipfabric_netbox/views.py CHANGED
@@ -37,7 +37,6 @@ 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
41
40
  from .filtersets import IPFabricTransformMapFilterSet
42
41
  from .filtersets import IPFabricTransformMapGroupFilterSet
43
42
  from .forms import IPFabricIngestionFilterForm
@@ -70,7 +69,6 @@ from .tables import IPFabricIngestionTable
70
69
  from .tables import IPFabricRelationshipFieldTable
71
70
  from .tables import IPFabricSnapshotTable
72
71
  from .tables import IPFabricSourceTable
73
- from .tables import IPFabricSyncTable
74
72
  from .tables import IPFabricTransformFieldTable
75
73
  from .tables import IPFabricTransformMapGroupTable
76
74
  from .tables import IPFabricTransformMapTable
@@ -479,21 +477,15 @@ class IPFabricSourceEditView(generic.ObjectEditView):
479
477
 
480
478
 
481
479
  @register_model_view(IPFabricSource)
482
- class IPFabricSourceView(generic.ObjectView):
480
+ class IPFabricSourceView(GetRelatedModelsMixin, generic.ObjectView):
483
481
  queryset = IPFabricSource.objects.all()
484
482
 
485
483
  def get_extra_context(self, request, instance):
486
- related_models = (
487
- (
488
- IPFabricSnapshot.objects.restrict(request.user, "view").filter(
489
- source=instance
490
- ),
491
- "source_id",
492
- ),
493
- )
494
-
495
484
  job = instance.jobs.order_by("id").last()
496
- data = {"related_models": related_models, "job": job}
485
+ data = {
486
+ "related_models": self.get_related_models(request, instance),
487
+ "job": job,
488
+ }
497
489
  if job:
498
490
  data["job_results"] = job.data
499
491
  return data
@@ -530,10 +522,14 @@ class IPFabricSourceBulkDeleteView(generic.BulkDeleteView):
530
522
 
531
523
 
532
524
  # Sync
533
- class IPFabricSyncListView(generic.ObjectListView):
534
- queryset = IPFabricSync.objects.all()
535
- table = IPFabricSyncTable
536
- filterset = IPFabricSyncFilterSet
525
+ class IPFabricSyncListView(View):
526
+ def get(self, request):
527
+ syncs = IPFabricSync.objects.prefetch_related("snapshot_data")
528
+ return render(
529
+ request,
530
+ "ipfabric_netbox/ipfabricsync_list.html",
531
+ {"model": IPFabricSync, "syncs": syncs},
532
+ )
537
533
 
538
534
 
539
535
  @register_model_view(IPFabricSync, "edit")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ipfabric_netbox
3
- Version: 4.2.1b2
3
+ Version: 4.2.2
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" 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"
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 == "ipfabric-6-10" or extra == "ipfabric-7-0" or extra == "ipfabric-7-2" or extra == "ipfabric-7-3"
25
+ Requires-Dist: ipfabric (>=7.3.0,<7.4.0) ; extra == "ipfabric-6-10" or extra == "ipfabric-7-0" or extra == "ipfabric-7-2" or 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,18 +1,14 @@
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
1
+ ipfabric_netbox/__init__.py,sha256=99nc1UHxI76Uk2ZU7o_21OqiT9hL2h1Z722PHZtVjCI,672
2
+ ipfabric_netbox/api/__init__.py,sha256=DOkvDAI4BoNgdCiNxfseeExEHyOrK8weG-LvjPRyK8A,101
3
+ ipfabric_netbox/api/nested_serializers.py,sha256=dG9YdK6wY6dDEvUWsjzsla-J_GnB5szzDjrcZhdWoEg,2124
4
+ ipfabric_netbox/api/serializers.py,sha256=KihGDzoYTM9M9lrU0uUQPFl3ru7t59MuIebBdQe_DhY,5130
5
+ ipfabric_netbox/api/urls.py,sha256=oZuDEJ6C7dpz8c9J3aJGi1CBSAij8Y4ClLa3Lu5AWk0,1236
6
+ ipfabric_netbox/api/views.py,sha256=j-5-t22519p-4iJxx6PwUNaJumdweIHCdUkYKijiTyI,5041
7
+ ipfabric_netbox/choices.py,sha256=tQ5RHwmuArQ7dCLcE3A_Bnw2ctGHgw67z--AawyyPPg,5261
7
8
  ipfabric_netbox/data/transform_map.json,sha256=4PsucgMHcLW3SPoKEptQCd0gA5tCF4hjrR4bGQFCWy8,21744
8
9
  ipfabric_netbox/exceptions.py,sha256=DT4dpbakvqoROtBR_F0LzvQCMNWpGhufFcUbZTx0OLY,2655
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
10
+ ipfabric_netbox/filtersets.py,sha256=unVb64gR_m5oMRo1nP4yWrcogMRvfnzVQRmna6-9fKw,6121
11
+ ipfabric_netbox/forms.py,sha256=07p_vngzsnHG0aev83JqBhb8fSBts0w-MTKu4BuoNLw,44494
16
12
  ipfabric_netbox/jobs.py,sha256=KrTUeCuFUIU7vKCUS3RiBYCBG7g7GzhGagM_qFMGQJ4,3089
17
13
  ipfabric_netbox/migrations/0001_initial.py,sha256=VphxkWL6QzWq2tcrdXlog718xQtiEGizKwS830z_fOs,13824
18
14
  ipfabric_netbox/migrations/0001_initial_squashed_0013_switch_to_branching_plugin.py,sha256=xDj5QJfTmG7ZgUSTRiJRndjSOv25dORtzzs-LySbr-c,20874
@@ -30,14 +26,11 @@ ipfabric_netbox/migrations/0012_remove_status_field.py,sha256=UZTY2BOBuV4Y_7zuPR
30
26
  ipfabric_netbox/migrations/0013_switch_to_branching_plugin.py,sha256=JfdTNerjuFyjW3pDm4vueOp2lrDh2xt6lL1Et5i4crg,10754
31
27
  ipfabric_netbox/migrations/0014_ipfabrictransformmapgroup_ipfabrictransformmap_group.py,sha256=RCfgKyqQhTkfSPhf0IukI3fjeAEBUs5pKWIpsLxgzp0,2272
32
28
  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
36
29
  ipfabric_netbox/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- ipfabric_netbox/models.py,sha256=T2VOnlKyWkYpwnsGkkgt5-zwvVbxT1eqTnEfCvTV5jc,36072
30
+ ipfabric_netbox/models.py,sha256=CXRMO1nKlcVz_R9WbTjQ0FWsXe1C6ZHIEoRhavI8Jyo,36067
38
31
  ipfabric_netbox/navigation.py,sha256=2dEJ_wKHb52Tl0FOV1TH3JbxRe8YZ56ewrTsBFGKpCg,2210
39
32
  ipfabric_netbox/signals.py,sha256=cGa5PVD2i24pGXiVNfbu6ruIDqPVdwKQHTSWe9Ura84,1838
40
- ipfabric_netbox/tables.py,sha256=zJUCoOrJgBNVxOmQrvlUyoD_0_Kq988GjregdcSAa68,8854
33
+ ipfabric_netbox/tables.py,sha256=pHKv6Bosjnc-7aApak3nLhzxqBiA30olPdaMO8F1PQg,8262
41
34
  ipfabric_netbox/template_content.py,sha256=ZT0uxqaC-Xnvrvm3nr89P9r43vsIuie3xcXIuT0UCN0,959
42
35
  ipfabric_netbox/templates/ipfabric_netbox/inc/clone_form.html,sha256=K-2TTDaS1F4wUIR8FFFPqex4KJbySXtHiz5V-OEwelY,967
43
36
  ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html,sha256=xOiIrvRIBtqDD65u6xcLo2xdwDKNpAylDmzznaJRGCw,3281
@@ -54,6 +47,7 @@ ipfabric_netbox/templates/ipfabric_netbox/ipfabricingestion.html,sha256=fm_X2FLn
54
47
  ipfabric_netbox/templates/ipfabric_netbox/ipfabricsnapshot.html,sha256=hj8ORs_4mM_xTjmw3McHN-da5seC8nbbkzobn0f1TSc,3482
55
48
  ipfabric_netbox/templates/ipfabric_netbox/ipfabricsource.html,sha256=koR_t6Mf2FhWlPZHchWsTOQDSLB7AWrqtY0TRnIzrrM,3864
56
49
  ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync.html,sha256=BicVS7mCP85fFZJEt46GUm5xppi1Jw3byw1el9BB2WE,4448
50
+ ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync_list.html,sha256=b6uE317N69oeknOOqnJo5I-qm44QezDlBTRqslbEO8I,2593
57
51
  ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap.html,sha256=qFo_Ku5oksx5co4HVtVq0xAVFI6CLWs-iBrwYzGsEGA,1460
58
52
  ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_list.html,sha256=p8zqn0-B6mawSUM3zQrus6dsKUM5SRBTO0X94pLboX8,452
59
53
  ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_restore.html,sha256=cuvOBKnlMudMI-CX77W3vTpwhtc4CBcc6j6Ye-IBBMQ,2562
@@ -69,17 +63,14 @@ ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css,sha256=z1H-RmmsqF2
69
63
  ipfabric_netbox/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
64
  ipfabric_netbox/templatetags/ipfabric_netbox_helpers.py,sha256=STw4pAd2qG7hgf-O6UNTwsO5VqEa_gxf5wLv50BWL4Q,417
71
65
  ipfabric_netbox/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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
66
+ ipfabric_netbox/tests/test_models.py,sha256=4SGMX0LZ_fThkc-F1AMZIQbpmJvQNVFnS6QYZpIZkNA,14998
76
67
  ipfabric_netbox/urls.py,sha256=ok66LP09rYi01qJmwdGGlBzV9wrGWVwVAIngPcreJxg,5449
77
68
  ipfabric_netbox/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
- ipfabric_netbox/utilities/ipfutils.py,sha256=wFmL5oriuF-is1ZlrIcLmoeYUY5ih-CA9weRQrx5AiA,31885
69
+ ipfabric_netbox/utilities/ipfutils.py,sha256=4W6fYuguvVdhNlWok-dTUhI0M4CK7hrBiMcLAtPuKIQ,31411
79
70
  ipfabric_netbox/utilities/logging.py,sha256=GYknjocMN6LQ2873_az3y0RKm29TCXaWviUIIneH-x0,3445
80
71
  ipfabric_netbox/utilities/nbutils.py,sha256=kFBEiJOGvr_49hJWCS2duXojx2-A9kVk0Xp_vj0ohfs,2641
81
72
  ipfabric_netbox/utilities/transform_map.py,sha256=QotbGc2TksINJrb62STgAigpC5Nsgi5umYHu_0rZd8k,2204
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,,
73
+ ipfabric_netbox/views.py,sha256=D1sdb2pJXjucdmghEwHoxasXZe2eQIKGwb3nYAfRiFE,36710
74
+ ipfabric_netbox-4.2.2.dist-info/METADATA,sha256=Z7Nh3TLGEgwnkyRFFQVMjqpONaXpZ5O5mT2U3qJnFaY,4546
75
+ ipfabric_netbox-4.2.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
76
+ ipfabric_netbox-4.2.2.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- from .schema import IPFabricDataQuery
2
- from .schema import IPFabricIngestionIssueQuery
3
- from .schema import IPFabricIngestionQuery
4
- from .schema import IPFabricRelationshipFieldQuery
5
- from .schema import IPFabricSnapshotQuery
6
- from .schema import IPFabricSourceQuery
7
- from .schema import IPFabricSyncQuery
8
- from .schema import IPFabricTransformFieldQuery
9
- from .schema import IPFabricTransformMapGroupQuery
10
- from .schema import IPFabricTransformMapQuery
11
-
12
- schema = [
13
- IPFabricTransformMapGroupQuery,
14
- IPFabricTransformMapQuery,
15
- IPFabricTransformFieldQuery,
16
- IPFabricRelationshipFieldQuery,
17
- IPFabricSourceQuery,
18
- IPFabricSnapshotQuery,
19
- IPFabricSyncQuery,
20
- IPFabricIngestionQuery,
21
- IPFabricIngestionIssueQuery,
22
- IPFabricDataQuery,
23
- ]
@@ -1,35 +0,0 @@
1
- import strawberry
2
- from core.choices import DataSourceStatusChoices
3
- from core.choices import JobStatusChoices
4
- from netbox_branching.choices import BranchStatusChoices
5
-
6
- from ipfabric_netbox.choices import IPFabricRawDataTypeChoices
7
- from ipfabric_netbox.choices import IPFabricSnapshotStatusModelChoices
8
- from ipfabric_netbox.choices import IPFabricSourceTypeChoices
9
- from ipfabric_netbox.choices import IPFabricTransformMapSourceModelChoices
10
-
11
- __all__ = (
12
- "DataSourceStatusEnum",
13
- "IPFabricTransformMapSourceModelEnum",
14
- "IPFabricSourceTypeEnum",
15
- "IPFabricSnapshotStatusModelEnum",
16
- "IPFabricRawDataTypeEnum",
17
- "BranchStatusEnum",
18
- "JobStatusEnum",
19
- )
20
-
21
- DataSourceStatusEnum = strawberry.enum(DataSourceStatusChoices.as_enum(prefix="type"))
22
- IPFabricTransformMapSourceModelEnum = strawberry.enum(
23
- IPFabricTransformMapSourceModelChoices.as_enum(prefix="type")
24
- )
25
- IPFabricSourceTypeEnum = strawberry.enum(
26
- IPFabricSourceTypeChoices.as_enum(prefix="type")
27
- )
28
- IPFabricSnapshotStatusModelEnum = strawberry.enum(
29
- IPFabricSnapshotStatusModelChoices.as_enum(prefix="type")
30
- )
31
- IPFabricRawDataTypeEnum = strawberry.enum(
32
- IPFabricRawDataTypeChoices.as_enum(prefix="type")
33
- )
34
- BranchStatusEnum = strawberry.enum(BranchStatusChoices.as_enum(prefix="type"))
35
- JobStatusEnum = strawberry.enum(JobStatusChoices.as_enum(prefix="type"))
@@ -1,317 +0,0 @@
1
- from datetime import datetime
2
- from typing import Annotated
3
-
4
- import strawberry
5
- import strawberry_django
6
- from core.graphql.filter_mixins import BaseFilterMixin
7
- from core.graphql.filters import ContentTypeFilter
8
- from core.models import Job
9
- from netbox.graphql.filter_lookups import IntegerLookup
10
- from netbox.graphql.filter_lookups import JSONFilter
11
- from netbox.graphql.filter_lookups import StringArrayLookup
12
- from netbox.graphql.filter_mixins import ChangeLogFilterMixin
13
- from netbox.graphql.filter_mixins import NetBoxModelFilterMixin
14
- from netbox.graphql.filter_mixins import PrimaryModelFilterMixin
15
- from netbox.graphql.filter_mixins import TagsFilterMixin
16
- from netbox_branching.models import Branch
17
- from strawberry.scalars import ID
18
- from strawberry_django import DatetimeFilterLookup
19
- from strawberry_django import FilterLookup
20
- from users.graphql.filters import UserFilter
21
-
22
- from ipfabric_netbox import models
23
- from ipfabric_netbox.graphql.enums import BranchStatusEnum
24
- from ipfabric_netbox.graphql.enums import DataSourceStatusEnum
25
- from ipfabric_netbox.graphql.enums import IPFabricRawDataTypeEnum
26
- from ipfabric_netbox.graphql.enums import IPFabricSnapshotStatusModelEnum
27
- from ipfabric_netbox.graphql.enums import IPFabricSourceTypeEnum
28
- from ipfabric_netbox.graphql.enums import IPFabricTransformMapSourceModelEnum
29
- from ipfabric_netbox.graphql.enums import JobStatusEnum
30
-
31
- __all__ = (
32
- "IPFabricTransformMapGroupFilter",
33
- "IPFabricTransformMapFilter",
34
- "IPFabricTransformFieldFilter",
35
- "IPFabricRelationshipFieldFilter",
36
- "IPFabricSourceFilter",
37
- "IPFabricSnapshotFilter",
38
- "IPFabricSyncFilter",
39
- "IPFabricIngestionFilter",
40
- "IPFabricIngestionIssueFilter",
41
- "IPFabricDataFilter",
42
- "BranchFilter",
43
- "JobFilter",
44
- )
45
-
46
-
47
- @strawberry_django.filter(models.IPFabricTransformMapGroup, lookups=True)
48
- class IPFabricTransformMapGroupFilter(NetBoxModelFilterMixin):
49
- id: ID | None = strawberry_django.filter_field()
50
- name: FilterLookup[str] | None = strawberry_django.filter_field()
51
- description: FilterLookup[str] | None = strawberry_django.filter_field()
52
-
53
-
54
- @strawberry_django.filter(models.IPFabricTransformMap, lookups=True)
55
- class IPFabricTransformMapFilter(NetBoxModelFilterMixin):
56
- id: ID | None = strawberry_django.filter_field()
57
- name: FilterLookup[str] | None = strawberry_django.filter_field()
58
- source_model: (
59
- Annotated[
60
- "IPFabricTransformMapSourceModelEnum",
61
- strawberry.lazy("ipfabric_netbox.graphql.enums"),
62
- ]
63
- | None
64
- ) = strawberry_django.filter_field()
65
- target_model: (
66
- Annotated["ContentTypeFilter", strawberry.lazy("core.graphql.filters")] | None
67
- ) = strawberry_django.filter_field()
68
- group: (
69
- Annotated[
70
- "IPFabricTransformMapGroupFilter",
71
- strawberry.lazy("ipfabric_netbox.graphql.filters"),
72
- ]
73
- | None
74
- ) = strawberry_django.filter_field()
75
-
76
-
77
- @strawberry_django.filter(models.IPFabricTransformField, lookups=True)
78
- class IPFabricTransformFieldFilter(BaseFilterMixin):
79
- id: ID | None = strawberry_django.filter_field()
80
- transform_map: (
81
- Annotated[
82
- "IPFabricTransformMapFilter",
83
- strawberry.lazy("ipfabric_netbox.graphql.filters"),
84
- ]
85
- | None
86
- ) = strawberry_django.filter_field()
87
- source_field: FilterLookup[str] | None = strawberry_django.filter_field()
88
- target_field: FilterLookup[str] | None = strawberry_django.filter_field()
89
- coalesce: (
90
- Annotated["IntegerLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
91
- | None
92
- ) = strawberry_django.filter_field()
93
- template: FilterLookup[str] | None = strawberry_django.filter_field()
94
-
95
-
96
- @strawberry_django.filter(models.IPFabricRelationshipField, lookups=True)
97
- class IPFabricRelationshipFieldFilter(BaseFilterMixin):
98
- id: ID | None = strawberry_django.filter_field()
99
- transform_map: (
100
- Annotated[
101
- "IPFabricTransformMapFilter",
102
- strawberry.lazy("ipfabric_netbox.graphql.filters"),
103
- ]
104
- | None
105
- ) = strawberry_django.filter_field()
106
- source_model: (
107
- Annotated["ContentTypeFilter", strawberry.lazy("core.graphql.filters")] | None
108
- ) = strawberry_django.filter_field()
109
- target_field: FilterLookup[str] | None = strawberry_django.filter_field()
110
- coalesce: (
111
- Annotated["IntegerLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
112
- | None
113
- ) = strawberry_django.filter_field()
114
- template: FilterLookup[str] | None = strawberry_django.filter_field()
115
-
116
-
117
- @strawberry_django.filter(models.IPFabricSource, lookups=True)
118
- class IPFabricSourceFilter(PrimaryModelFilterMixin):
119
- id: ID | None = strawberry_django.filter_field()
120
- name: FilterLookup[str] | None = strawberry_django.filter_field()
121
- type: (
122
- Annotated[
123
- "IPFabricSourceTypeEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
124
- ]
125
- | None
126
- ) = strawberry_django.filter_field()
127
- url: FilterLookup[str] | None = strawberry_django.filter_field()
128
- status: (
129
- Annotated[
130
- "DataSourceStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
131
- ]
132
- | None
133
- ) = strawberry_django.filter_field()
134
- parameters: (
135
- Annotated["JSONFilter", strawberry.lazy("netbox.graphql.filter_lookups")] | None
136
- ) = strawberry_django.filter_field()
137
- last_synced: DatetimeFilterLookup[
138
- datetime
139
- ] | None = strawberry_django.filter_field()
140
-
141
-
142
- @strawberry_django.filter(models.IPFabricSnapshot, lookups=True)
143
- class IPFabricSnapshotFilter(TagsFilterMixin, ChangeLogFilterMixin, BaseFilterMixin):
144
- id: ID | None = strawberry_django.filter_field()
145
- created: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
146
- last_updated: DatetimeFilterLookup[
147
- datetime
148
- ] | None = strawberry_django.filter_field()
149
- source: (
150
- Annotated[
151
- "IPFabricSourceFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")
152
- ]
153
- | None
154
- ) = strawberry_django.filter_field()
155
- name: FilterLookup[str] | None = strawberry_django.filter_field()
156
- snapshot_id: FilterLookup[str] | None = strawberry_django.filter_field()
157
- data: (
158
- Annotated["JSONFilter", strawberry.lazy("netbox.graphql.filter_lookups")] | None
159
- ) = strawberry_django.filter_field()
160
- date: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
161
- status: (
162
- Annotated[
163
- "IPFabricSnapshotStatusModelEnum",
164
- strawberry.lazy("ipfabric_netbox.graphql.enums"),
165
- ]
166
- | None
167
- ) = strawberry_django.filter_field()
168
-
169
-
170
- @strawberry_django.filter(models.IPFabricSync, lookups=True)
171
- class IPFabricSyncFilter(TagsFilterMixin, ChangeLogFilterMixin, BaseFilterMixin):
172
- id: ID | None = strawberry_django.filter_field()
173
- name: FilterLookup[str] | None = strawberry_django.filter_field()
174
- snapshot_data: (
175
- Annotated[
176
- "IPFabricSnapshotFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")
177
- ]
178
- | None
179
- ) = strawberry_django.filter_field()
180
- status: (
181
- Annotated[
182
- "DataSourceStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
183
- ]
184
- | None
185
- ) = strawberry_django.filter_field()
186
- parameters: (
187
- Annotated["JSONFilter", strawberry.lazy("netbox.graphql.filter_lookups")] | None
188
- ) = strawberry_django.filter_field()
189
- auto_merge: FilterLookup[bool] | None = strawberry_django.filter_field()
190
- last_synced: DatetimeFilterLookup[
191
- datetime
192
- ] | None = strawberry_django.filter_field()
193
- scheduled: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
194
- interval: (
195
- Annotated["IntegerLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
196
- | None
197
- ) = strawberry_django.filter_field()
198
- user: Annotated[
199
- "UserFilter", strawberry.lazy("users.graphql.filters")
200
- ] | None = strawberry_django.filter_field()
201
-
202
-
203
- @strawberry_django.filter(models.IPFabricIngestion, lookups=True)
204
- class IPFabricIngestionFilter(BaseFilterMixin):
205
- id: ID | None = strawberry_django.filter_field()
206
- sync: (
207
- Annotated[
208
- "IPFabricSyncFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")
209
- ]
210
- | None
211
- ) = strawberry_django.filter_field()
212
- job: (
213
- Annotated["JobFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")]
214
- | None
215
- ) = strawberry_django.filter_field()
216
- branch: (
217
- Annotated["BranchFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")]
218
- | None
219
- ) = strawberry_django.filter_field()
220
-
221
-
222
- @strawberry_django.filter(models.IPFabricIngestionIssue, lookups=True)
223
- class IPFabricIngestionIssueFilter(BaseFilterMixin):
224
- id: ID | None = strawberry_django.filter_field()
225
- ingestion: (
226
- Annotated[
227
- "IPFabricIngestionFilter",
228
- strawberry.lazy("ipfabric_netbox.graphql.filters"),
229
- ]
230
- | None
231
- ) = strawberry_django.filter_field()
232
- timestamp: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
233
- model: FilterLookup[str] | None = strawberry_django.filter_field()
234
- message: FilterLookup[str] | None = strawberry_django.filter_field()
235
- raw_data: FilterLookup[str] | None = strawberry_django.filter_field()
236
- coalesce_fields: FilterLookup[str] | None = strawberry_django.filter_field()
237
- defaults: FilterLookup[str] | None = strawberry_django.filter_field()
238
- exception: FilterLookup[str] | None = strawberry_django.filter_field()
239
-
240
-
241
- @strawberry_django.filter(models.IPFabricData, lookups=True)
242
- class IPFabricDataFilter(BaseFilterMixin):
243
- id: ID | None = strawberry_django.filter_field()
244
- snapshot_data: (
245
- Annotated[
246
- "IPFabricSnapshotFilter", strawberry.lazy("ipfabric_netbox.graphql.filters")
247
- ]
248
- | None
249
- ) = strawberry_django.filter_field()
250
- data: (
251
- Annotated["JSONFilter", strawberry.lazy("netbox.graphql.filter_lookups")] | None
252
- ) = strawberry_django.filter_field()
253
- type: (
254
- Annotated[
255
- "IPFabricRawDataTypeEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")
256
- ]
257
- | None
258
- ) = strawberry_django.filter_field()
259
-
260
-
261
- # These filters are not defined in the libs, so need to define them here
262
- @strawberry_django.filter(Branch, lookups=True)
263
- class BranchFilter(PrimaryModelFilterMixin):
264
- id: ID | None = strawberry_django.filter_field()
265
- name: FilterLookup[str] | None = strawberry_django.filter_field()
266
- owner: Annotated[
267
- "UserFilter", strawberry.lazy("users.graphql.filters")
268
- ] | None = strawberry_django.filter_field()
269
- schema_id: FilterLookup[str] | None = strawberry_django.filter_field()
270
- status: (
271
- Annotated["BranchStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")]
272
- | None
273
- ) = strawberry_django.filter_field()
274
- applied_migrations: (
275
- Annotated["StringArrayLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
276
- | None
277
- ) = strawberry_django.filter_field()
278
- last_sync: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
279
- merged_time: DatetimeFilterLookup[
280
- datetime
281
- ] | None = strawberry_django.filter_field()
282
- merged_by: (
283
- Annotated["UserFilter", strawberry.lazy("users.graphql.filters")] | None
284
- ) = strawberry_django.filter_field()
285
-
286
-
287
- @strawberry_django.filter(Job, lookups=True)
288
- class JobFilter(BaseFilterMixin):
289
- id: ID | None = strawberry_django.filter_field()
290
- object_type: (
291
- Annotated["ContentTypeFilter", strawberry.lazy("core.graphql.filters")] | None
292
- ) = strawberry_django.filter_field()
293
- object_id: (
294
- Annotated["IntegerLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
295
- | None
296
- ) = strawberry_django.filter_field()
297
- name: FilterLookup[str] | None = strawberry_django.filter_field()
298
- created: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
299
- scheduled: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
300
- interval: (
301
- Annotated["IntegerLookup", strawberry.lazy("netbox.graphql.filter_lookups")]
302
- | None
303
- ) = strawberry_django.filter_field()
304
- started: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
305
- completed: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
306
- user: Annotated[
307
- "UserFilter", strawberry.lazy("users.graphql.filters")
308
- ] | None = strawberry_django.filter_field()
309
- status: (
310
- Annotated["JobStatusEnum", strawberry.lazy("ipfabric_netbox.graphql.enums")]
311
- | None
312
- ) = strawberry_django.filter_field()
313
- data: (
314
- Annotated["JSONFilter", strawberry.lazy("netbox.graphql.filter_lookups")] | None
315
- ) = strawberry_django.filter_field()
316
- error: FilterLookup[str] | None = strawberry_django.filter_field()
317
- job_id: FilterLookup[str] | None = strawberry_django.filter_field()