ipfabric_netbox 3.1.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.
- ipfabric_netbox/__init__.py +42 -0
- ipfabric_netbox/api/__init__.py +2 -0
- ipfabric_netbox/api/nested_serializers.py +99 -0
- ipfabric_netbox/api/serializers.py +160 -0
- ipfabric_netbox/api/urls.py +21 -0
- ipfabric_netbox/api/views.py +111 -0
- ipfabric_netbox/choices.py +226 -0
- ipfabric_netbox/filtersets.py +125 -0
- ipfabric_netbox/forms.py +1063 -0
- ipfabric_netbox/jobs.py +95 -0
- ipfabric_netbox/migrations/0001_initial.py +342 -0
- ipfabric_netbox/migrations/0002_ipfabricsnapshot_status.py +17 -0
- ipfabric_netbox/migrations/0003_ipfabricsource_type_and_more.py +49 -0
- ipfabric_netbox/migrations/0004_ipfabricsync_auto_merge.py +17 -0
- ipfabric_netbox/migrations/0005_alter_ipfabricrelationshipfield_source_model_and_more.py +64 -0
- ipfabric_netbox/migrations/0006_alter_ipfabrictransformmap_target_model.py +48 -0
- ipfabric_netbox/migrations/__init__.py +0 -0
- ipfabric_netbox/models.py +874 -0
- ipfabric_netbox/navigation.py +62 -0
- ipfabric_netbox/signals.py +68 -0
- ipfabric_netbox/tables.py +208 -0
- ipfabric_netbox/template_content.py +13 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html +72 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/json.html +20 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/logs_pending.html +6 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/merge_form.html +22 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_button.html +70 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/site_topology_modal.html +61 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/snapshotdata.html +60 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/sync_delete.html +19 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_field_map.html +11 -0
- ipfabric_netbox/templates/ipfabric_netbox/inc/transform_map_relationship_map.html +11 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabric_table.html +55 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricbranch.html +141 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsnapshot.html +105 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsource.html +111 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabricsync.html +103 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap.html +41 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_list.html +17 -0
- ipfabric_netbox/templates/ipfabric_netbox/ipfabrictransformmap_restore.html +59 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_all.html +10 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_progress.html +19 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/branch_status.html +1 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/job_logs.html +53 -0
- ipfabric_netbox/templates/ipfabric_netbox/partials/sync_last_branch.html +1 -0
- ipfabric_netbox/templates/ipfabric_netbox/sync_list.html +126 -0
- ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css +9 -0
- ipfabric_netbox/tests/__init__.py +0 -0
- ipfabric_netbox/tests/test_models.py +1340 -0
- ipfabric_netbox/urls.py +141 -0
- ipfabric_netbox/utilities/__init__.py +0 -0
- ipfabric_netbox/utilities/ipfutils.py +591 -0
- ipfabric_netbox/utilities/logging.py +93 -0
- ipfabric_netbox/utilities/nbutils.py +105 -0
- ipfabric_netbox/utilities/transform_map.py +35 -0
- ipfabric_netbox/views.py +845 -0
- ipfabric_netbox-3.1.2.dist-info/METADATA +88 -0
- ipfabric_netbox-3.1.2.dist-info/RECORD +59 -0
- ipfabric_netbox-3.1.2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from core.choices import DataSourceStatusChoices
|
|
3
|
+
from django.db.models import Q
|
|
4
|
+
from django.utils.translation import gettext as _
|
|
5
|
+
from extras.choices import ChangeActionChoices
|
|
6
|
+
from netbox.filtersets import BaseFilterSet
|
|
7
|
+
from netbox.filtersets import ChangeLoggedModelFilterSet
|
|
8
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
9
|
+
from netbox.staging import StagedChange
|
|
10
|
+
|
|
11
|
+
from .models import IPFabricBranch
|
|
12
|
+
from .models import IPFabricData
|
|
13
|
+
from .models import IPFabricSnapshot
|
|
14
|
+
from .models import IPFabricSource
|
|
15
|
+
from .models import IPFabricSync
|
|
16
|
+
from .models import IPFabricTransformMap
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class IPFabricStagedChangeFilterSet(BaseFilterSet):
|
|
20
|
+
q = django_filters.CharFilter(method="search")
|
|
21
|
+
action = django_filters.MultipleChoiceFilter(choices=ChangeActionChoices)
|
|
22
|
+
|
|
23
|
+
class Meta:
|
|
24
|
+
model = StagedChange
|
|
25
|
+
fields = ["branch", "action", "object_type"]
|
|
26
|
+
|
|
27
|
+
def search(self, queryset, name, value):
|
|
28
|
+
if not value.strip():
|
|
29
|
+
return queryset
|
|
30
|
+
return queryset.filter(
|
|
31
|
+
Q(data__values__contains=value)
|
|
32
|
+
| Q(action__icontains=value)
|
|
33
|
+
| Q(object_type__model__icontains=value)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class IPFabricDataFilterSet(BaseFilterSet):
|
|
38
|
+
q = django_filters.CharFilter(method="search")
|
|
39
|
+
|
|
40
|
+
class Meta:
|
|
41
|
+
model = IPFabricData
|
|
42
|
+
fields = ["snapshot_data", "type"]
|
|
43
|
+
|
|
44
|
+
def search(self, queryset, name, value):
|
|
45
|
+
if not value.strip():
|
|
46
|
+
return queryset
|
|
47
|
+
return queryset.filter(
|
|
48
|
+
Q(snapshot_data__icontains=value) | Q(type__icontains=value)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class IPFabricSnapshotFilterSet(ChangeLoggedModelFilterSet):
|
|
53
|
+
q = django_filters.CharFilter(method="search")
|
|
54
|
+
source_id = django_filters.ModelMultipleChoiceFilter(
|
|
55
|
+
queryset=IPFabricSource.objects.all(),
|
|
56
|
+
label=_("Source (ID)"),
|
|
57
|
+
)
|
|
58
|
+
source = django_filters.ModelMultipleChoiceFilter(
|
|
59
|
+
field_name="source__name",
|
|
60
|
+
queryset=IPFabricSource.objects.all(),
|
|
61
|
+
to_field_name="name",
|
|
62
|
+
label=_("Source (name)"),
|
|
63
|
+
)
|
|
64
|
+
snapshot_id = django_filters.CharFilter(
|
|
65
|
+
label=_("Snapshot ID"), lookup_expr="icontains"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
class Meta:
|
|
69
|
+
model = IPFabricSnapshot
|
|
70
|
+
fields = ("id", "name", "status", "snapshot_id")
|
|
71
|
+
|
|
72
|
+
def search(self, queryset, name, value):
|
|
73
|
+
if not value.strip():
|
|
74
|
+
return queryset
|
|
75
|
+
return queryset.filter(Q(name__icontains=value))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class IPFabricSourceFilterSet(NetBoxModelFilterSet):
|
|
79
|
+
status = django_filters.MultipleChoiceFilter(
|
|
80
|
+
choices=DataSourceStatusChoices, null_value=None
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
class Meta:
|
|
84
|
+
model = IPFabricSource
|
|
85
|
+
fields = ("id", "name")
|
|
86
|
+
|
|
87
|
+
def search(self, queryset, name, value):
|
|
88
|
+
if not value.strip():
|
|
89
|
+
return queryset
|
|
90
|
+
return queryset.filter(
|
|
91
|
+
Q(name__icontains=value)
|
|
92
|
+
| Q(description__icontains=value)
|
|
93
|
+
| Q(comments__icontains=value)
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class IPFabricBranchFilterSet(BaseFilterSet):
|
|
98
|
+
q = django_filters.CharFilter(method="search")
|
|
99
|
+
sync_id = django_filters.ModelMultipleChoiceFilter(
|
|
100
|
+
queryset=IPFabricSync.objects.all(),
|
|
101
|
+
label=_("Sync (ID)"),
|
|
102
|
+
)
|
|
103
|
+
sync = django_filters.ModelMultipleChoiceFilter(
|
|
104
|
+
field_name="sync__name",
|
|
105
|
+
queryset=IPFabricSync.objects.all(),
|
|
106
|
+
to_field_name="name",
|
|
107
|
+
label=_("Sync (name)"),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
class Meta:
|
|
111
|
+
model = IPFabricBranch
|
|
112
|
+
fields = ("id", "name", "sync")
|
|
113
|
+
|
|
114
|
+
def search(self, queryset, name, value):
|
|
115
|
+
if not value.strip():
|
|
116
|
+
return queryset
|
|
117
|
+
return queryset.filter(
|
|
118
|
+
Q(name__icontains=value) | Q(sync__name__icontains=value)
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class IPFabricTransformFieldFilterSet(BaseFilterSet):
|
|
123
|
+
transform_map = django_filters.ModelMultipleChoiceFilter(
|
|
124
|
+
queryset=IPFabricTransformMap.objects.all(), label=_("Transform Map")
|
|
125
|
+
)
|