ipfabric_netbox 3.2.0__py3-none-any.whl → 3.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.
- ipfabric_netbox/__init__.py +2 -2
- ipfabric_netbox/data/transform_map.json +16 -16
- ipfabric_netbox/exceptions.py +24 -0
- ipfabric_netbox/forms.py +2 -2
- ipfabric_netbox/migrations/0009_transformmap_changes_for_netbox_v4_2.py +0 -3
- ipfabric_netbox/migrations/0010_remove_uuid_from_get_or_create.py +95 -0
- ipfabric_netbox/models.py +58 -63
- ipfabric_netbox/signals.py +29 -0
- ipfabric_netbox/tests/test_models.py +10 -26
- ipfabric_netbox/utilities/ipfutils.py +336 -217
- ipfabric_netbox/utilities/logging.py +12 -7
- ipfabric_netbox/utilities/nbutils.py +0 -26
- {ipfabric_netbox-3.2.0.dist-info → ipfabric_netbox-3.2.2.dist-info}/METADATA +12 -19
- {ipfabric_netbox-3.2.0.dist-info → ipfabric_netbox-3.2.2.dist-info}/RECORD +15 -12
- {ipfabric_netbox-3.2.0.dist-info → ipfabric_netbox-3.2.2.dist-info}/WHEEL +1 -1
|
@@ -14,7 +14,7 @@ class SyncLogging:
|
|
|
14
14
|
self.log_data = {"logs": [], "statistics": {}}
|
|
15
15
|
self.logger = logging.getLogger("ipfabric.sync")
|
|
16
16
|
|
|
17
|
-
def _log(self, obj, message, level=LogLevelChoices.
|
|
17
|
+
def _log(self, obj, message, level=LogLevelChoices.LOG_INFO):
|
|
18
18
|
"""
|
|
19
19
|
Log a message from a test method. Do not call this method directly; use one of the log_* wrappers below.
|
|
20
20
|
"""
|
|
@@ -35,7 +35,7 @@ class SyncLogging:
|
|
|
35
35
|
"""
|
|
36
36
|
Log a message which is not associated with a particular object.
|
|
37
37
|
"""
|
|
38
|
-
self._log(None, message, level=LogLevelChoices.
|
|
38
|
+
self._log(None, message, level=LogLevelChoices.LOG_INFO)
|
|
39
39
|
self.logger.info(message)
|
|
40
40
|
|
|
41
41
|
def log_success(self, message, obj=None):
|
|
@@ -66,18 +66,23 @@ class SyncLogging:
|
|
|
66
66
|
self._log(obj, message, level=LogLevelChoices.LOG_FAILURE)
|
|
67
67
|
self.logger.info(f"Failure | {obj}: {message}")
|
|
68
68
|
|
|
69
|
-
def
|
|
69
|
+
def init_statistics(self, model: str, total: int) -> dict[str, int]:
|
|
70
70
|
statistics = self.log_data.get("statistics")
|
|
71
|
-
|
|
72
71
|
if not statistics.get(model):
|
|
73
|
-
stats = statistics[model] = {"current":
|
|
72
|
+
stats = statistics[model] = {"current": 0, "total": total}
|
|
74
73
|
else:
|
|
75
74
|
stats = statistics.get(model)
|
|
75
|
+
return stats
|
|
76
|
+
|
|
77
|
+
def increment_statistics(self, model: str, total: int = None) -> None:
|
|
78
|
+
stats = self.init_statistics(model, total)
|
|
76
79
|
if total:
|
|
77
80
|
stats["total"] = total
|
|
78
|
-
|
|
79
|
-
stats["current"] = current
|
|
81
|
+
stats["current"] += 1
|
|
80
82
|
cache.set(self.cache_key, self.log_data, self.cache_timeout)
|
|
83
|
+
self.logger.info(
|
|
84
|
+
f"{model} - {stats['current']} out of {stats['total']} processed"
|
|
85
|
+
)
|
|
81
86
|
|
|
82
87
|
def clear_log(self):
|
|
83
88
|
self.log_data["logs"] = []
|
|
@@ -53,32 +53,6 @@ def order_devices(devices, members):
|
|
|
53
53
|
return devices
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def order_vrf(vrfs):
|
|
57
|
-
vrf_dict = {}
|
|
58
|
-
|
|
59
|
-
for vrf in vrfs:
|
|
60
|
-
sn = vrf["sn"]
|
|
61
|
-
if sn in vrf_dict:
|
|
62
|
-
vrf_dict[sn].append(vrf)
|
|
63
|
-
else:
|
|
64
|
-
vrf_dict[sn] = [vrf]
|
|
65
|
-
|
|
66
|
-
return vrf_dict
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def order_pn(part_numbers):
|
|
70
|
-
pn_dict = {}
|
|
71
|
-
|
|
72
|
-
for pn in part_numbers:
|
|
73
|
-
device_sn = pn["deviceSn"]
|
|
74
|
-
if device_sn in pn_dict:
|
|
75
|
-
pn_dict[device_sn].append(pn)
|
|
76
|
-
else:
|
|
77
|
-
pn_dict[device_sn] = [pn]
|
|
78
|
-
|
|
79
|
-
return pn_dict
|
|
80
|
-
|
|
81
|
-
|
|
82
56
|
def create_inventory_items(device: Device, parts: list, manufacturer: Manufacturer):
|
|
83
57
|
for part in parts:
|
|
84
58
|
name = part.get("name", "")
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: ipfabric_netbox
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: NetBox plugin to sync IP Fabric data into NetBox
|
|
5
|
-
Home-page: https://gitlab.com/ip-fabric/integrations/ipfabric-netbox-sync
|
|
6
5
|
License: MIT
|
|
7
6
|
Keywords: netbox,ipfabric,plugin,sync
|
|
8
7
|
Author: Solution Architecture
|
|
9
8
|
Author-email: solution.architecture@ipfabric.io
|
|
10
9
|
Requires-Python: >=3.10,<4.0
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
18
13
|
Provides-Extra: ipfabric-6-10
|
|
19
14
|
Provides-Extra: ipfabric-6-6
|
|
20
15
|
Provides-Extra: ipfabric-6-7
|
|
@@ -30,7 +25,6 @@ Requires-Dist: ipfabric (>=6.9.0,<6.10.0) ; extra != "ipfabric_6_6" and extra !=
|
|
|
30
25
|
Requires-Dist: ipfabric (>=7.0.0,<7.1.0) ; extra != "ipfabric_6_6" and extra != "ipfabric_6_7" and extra != "ipfabric_6_8" and extra != "ipfabric_6_9" and extra != "ipfabric_6_10" and extra == "ipfabric_7_0"
|
|
31
26
|
Requires-Dist: netutils
|
|
32
27
|
Project-URL: Bug Tracker, https://gitlab.com/ip-fabric/integrations/ipfabric-netbox-sync/-/issues
|
|
33
|
-
Project-URL: Repository, https://gitlab.com/ip-fabric/integrations/ipfabric-netbox-sync
|
|
34
28
|
Description-Content-Type: text/markdown
|
|
35
29
|
|
|
36
30
|
# IP Fabric Netbox Plugin
|
|
@@ -63,19 +57,18 @@ The plugin uses IP Fabric collect network data utilizing the [IP Fabric Python S
|
|
|
63
57
|
- Diff Visualization
|
|
64
58
|
|
|
65
59
|
## NetBox Compatibility
|
|
66
|
-
These are the
|
|
60
|
+
These are the required NetBox versions for corresponding plugin version. Any other versions won't work due to breaking changes in NetBox codebase.
|
|
67
61
|
|
|
68
62
|
| Netbox Version | Plugin Version |
|
|
69
63
|
|----------------|----------------|
|
|
70
|
-
|
|
|
71
|
-
| 3
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| 4.0
|
|
75
|
-
| 4.0.
|
|
76
|
-
|
|
|
77
|
-
| 4.
|
|
78
|
-
| 4.2.0 | >=3.2.0 |
|
|
64
|
+
| 4.2.4 and up | 3.2.2 and up |
|
|
65
|
+
| 4.2.0 - 4.2.3 | 3.2.0 |
|
|
66
|
+
| 4.1.5 - 4.1.11 | 3.1.1 - 3.1.3 |
|
|
67
|
+
| 4.1.0 - 4.1.4 | 3.1.0 |
|
|
68
|
+
| 4.0.1 | 3.0.1 - 3.0.3 |
|
|
69
|
+
| 4.0.0 | 3.0.0 |
|
|
70
|
+
| 3.7.0 - 3.7.8 | 2.0.0 - 2.0.6 |
|
|
71
|
+
| 3.4.0 - 3.6.9 | 1.0.0 - 1.0.11 |
|
|
79
72
|
|
|
80
73
|
## Screenshots
|
|
81
74
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
ipfabric_netbox/__init__.py,sha256=
|
|
1
|
+
ipfabric_netbox/__init__.py,sha256=Hx79dSbjd4DIMkPCRqBBdEDb9t9MAVvHEk9TZHXAw3c,315
|
|
2
2
|
ipfabric_netbox/api/__init__.py,sha256=DOkvDAI4BoNgdCiNxfseeExEHyOrK8weG-LvjPRyK8A,101
|
|
3
3
|
ipfabric_netbox/api/nested_serializers.py,sha256=JwIlFpOHeiMB7F-sC0gx1f6qdNevS8NsXTUEHlVZeRs,2719
|
|
4
4
|
ipfabric_netbox/api/serializers.py,sha256=bTR3AJ81Q8HZI3iWLPc1tndGqD0erAbAD9hKLI4DTYY,4341
|
|
5
5
|
ipfabric_netbox/api/urls.py,sha256=BSQ5nqYSx0r-wnbdKGDAb5XH7BBy_0ngV_Q7vDgjMIE,948
|
|
6
6
|
ipfabric_netbox/api/views.py,sha256=X02GwpDlq25_3KlxYTWyd4PnT1RCtfp7uN0zZ5Etjp8,4429
|
|
7
7
|
ipfabric_netbox/choices.py,sha256=GqcnLqsFR4gnhWEwkvQbPxXYNi5SwNoIQz-J15LTMc4,4848
|
|
8
|
-
ipfabric_netbox/data/transform_map.json,sha256=
|
|
8
|
+
ipfabric_netbox/data/transform_map.json,sha256=Xb5x8dmBPDmrVUezjvkI3Wq60TgdHXocaur3W2xZ_k8,21951
|
|
9
|
+
ipfabric_netbox/exceptions.py,sha256=Za-RutEX9ZIi3r0Rpor1vDGwsC5foeyrfSjUKS3Cwdk,744
|
|
9
10
|
ipfabric_netbox/filtersets.py,sha256=P_2VCL892pLplPnsxul27bgGgMpHaZtgn9Vg0UsWErE,3877
|
|
10
|
-
ipfabric_netbox/forms.py,sha256=
|
|
11
|
+
ipfabric_netbox/forms.py,sha256=qtl6htAmyAIwwUoucHsqmXJME2M2SzcA69_BBiuCqs4,42942
|
|
11
12
|
ipfabric_netbox/jobs.py,sha256=jfWWNA42KMyzc-EGit6LJIe-SNob4-4IQRfadQF_GRE,2862
|
|
12
13
|
ipfabric_netbox/migrations/0001_initial.py,sha256=nka6_HJK4Q8BlmQblDntuNzVKLR484SsC6wGSbOQgI4,13813
|
|
13
14
|
ipfabric_netbox/migrations/0002_ipfabricsnapshot_status.py,sha256=xQpouHjOutyj6riN2B592njzSvz_icpkUbo5W7nWLYw,431
|
|
@@ -17,10 +18,12 @@ ipfabric_netbox/migrations/0005_alter_ipfabricrelationshipfield_source_model_and
|
|
|
17
18
|
ipfabric_netbox/migrations/0006_alter_ipfabrictransformmap_target_model.py,sha256=6MmI-Uz9hmzj3nKqhUKdShjLnE8KNa4qthg0NVHjANc,2163
|
|
18
19
|
ipfabric_netbox/migrations/0007_prepare_custom_fields.py,sha256=ohnNcbQn4CMkbh3XHtvmkctThUdYhN-ywN5xerOSmdE,3898
|
|
19
20
|
ipfabric_netbox/migrations/0008_prepare_transform_maps.py,sha256=Jwr-P9MQQv9N-Yx_19V4q6lmZpeIkjoUW1gh4s-lDnI,1541
|
|
20
|
-
ipfabric_netbox/migrations/0009_transformmap_changes_for_netbox_v4_2.py,sha256=
|
|
21
|
+
ipfabric_netbox/migrations/0009_transformmap_changes_for_netbox_v4_2.py,sha256=rEqa3OC8UpbdiZKOHBqnrjEgZXYxl8UFCDXHRl_Lnhk,9256
|
|
22
|
+
ipfabric_netbox/migrations/0010_remove_uuid_from_get_or_create.py,sha256=Sdmyms5sbuuTH0LkF4k4A9JVS00-N41tY11eaqceJSw,3511
|
|
21
23
|
ipfabric_netbox/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
ipfabric_netbox/models.py,sha256=
|
|
24
|
+
ipfabric_netbox/models.py,sha256=krbTm99p7Tj1UHSo0OP5f6RFFdl5RggVG4vp-gkckUU,30725
|
|
23
25
|
ipfabric_netbox/navigation.py,sha256=2kZs341nAB7G76qnZT6mFxsYo68IPy-bmPMkSLA-Nk0,1735
|
|
26
|
+
ipfabric_netbox/signals.py,sha256=AnTxyTlj6iFQVscOlbzSBpplDAkkKYnhsNMP5K0g-ig,991
|
|
24
27
|
ipfabric_netbox/tables.py,sha256=4cZb-_whp132B3EJglRBEkXwkYLUpWzIybkdHfAE9tM,6819
|
|
25
28
|
ipfabric_netbox/template_content.py,sha256=bP2nUf5MM-GUbtQxJ8QoYVNXhrDCrkb8wZnbeqa07EA,315
|
|
26
29
|
ipfabric_netbox/templates/ipfabric_netbox/inc/diff.html,sha256=xOiIrvRIBtqDD65u6xcLo2xdwDKNpAylDmzznaJRGCw,3281
|
|
@@ -49,14 +52,14 @@ ipfabric_netbox/templates/ipfabric_netbox/partials/sync_last_branch.html,sha256=
|
|
|
49
52
|
ipfabric_netbox/templates/ipfabric_netbox/sync_list.html,sha256=3wfwPUIAfzzIP_pu3gL0L3wH65UX5XFLBW5BW-CZJDc,5587
|
|
50
53
|
ipfabric_netbox/templates/static/ipfabric_netbox/css/rack.css,sha256=z1H-RmmsqF2pGdhn5J64TMFiccy62xZUHHlCRd8fJrQ,118
|
|
51
54
|
ipfabric_netbox/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
-
ipfabric_netbox/tests/test_models.py,sha256=
|
|
55
|
+
ipfabric_netbox/tests/test_models.py,sha256=syndh1M3uiZIokn_MJUHfU5jNNMUDPQ5sm8iK-gu1Is,15192
|
|
53
56
|
ipfabric_netbox/urls.py,sha256=V98K_JxHaJAgDbo-DiMj-5FQIIposLMLJCPw3dtREWU,4430
|
|
54
57
|
ipfabric_netbox/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
ipfabric_netbox/utilities/ipfutils.py,sha256=
|
|
56
|
-
ipfabric_netbox/utilities/logging.py,sha256=
|
|
57
|
-
ipfabric_netbox/utilities/nbutils.py,sha256=
|
|
58
|
+
ipfabric_netbox/utilities/ipfutils.py,sha256=c9a_3mQ_GVksYqsCIGJSBnzOVKX1V21Jb9lrU2ASadE,27306
|
|
59
|
+
ipfabric_netbox/utilities/logging.py,sha256=GYknjocMN6LQ2873_az3y0RKm29TCXaWviUIIneH-x0,3445
|
|
60
|
+
ipfabric_netbox/utilities/nbutils.py,sha256=kFBEiJOGvr_49hJWCS2duXojx2-A9kVk0Xp_vj0ohfs,2641
|
|
58
61
|
ipfabric_netbox/utilities/transform_map.py,sha256=g0elxtwSRJvu0ZRZHyMf4Y9R4wiQ-h2o9Er8gxUQ-Bs,2108
|
|
59
62
|
ipfabric_netbox/views.py,sha256=K2iKh6i8kv88c7gVh6wW7d8Adcso24ZE8m6gVUiNZSw,28285
|
|
60
|
-
ipfabric_netbox-3.2.
|
|
61
|
-
ipfabric_netbox-3.2.
|
|
62
|
-
ipfabric_netbox-3.2.
|
|
63
|
+
ipfabric_netbox-3.2.2.dist-info/METADATA,sha256=sFnkbdFcINTc3j0ZYZdTWqQVPzFdfnPXyGEvVhf5-3Y,4947
|
|
64
|
+
ipfabric_netbox-3.2.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
65
|
+
ipfabric_netbox-3.2.2.dist-info/RECORD,,
|