annet 0.16.9__py3-none-any.whl → 0.16.10__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 annet might be problematic. Click here for more details.
- annet/adapters/netbox/common/manufacturer.py +2 -0
- annet/adapters/netbox/common/models.py +1 -1
- annet/configs/context.yml +0 -9
- annet/generators/jsonfragment.py +13 -12
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/METADATA +3 -3
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/RECORD +11 -11
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/AUTHORS +0 -0
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/LICENSE +0 -0
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/WHEEL +0 -0
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/entry_points.txt +0 -0
- {annet-0.16.9.dist-info → annet-0.16.10.dist-info}/top_level.txt +0 -0
|
@@ -207,7 +207,7 @@ class NetboxDevice(Entity):
|
|
|
207
207
|
return type(self) is type(other) and self.url == other.url
|
|
208
208
|
|
|
209
209
|
def is_pc(self) -> bool:
|
|
210
|
-
return self.device_type.manufacturer.name == "Mellanox"
|
|
210
|
+
return self.device_type.manufacturer.name == "Mellanox" or self.breed == "pc"
|
|
211
211
|
|
|
212
212
|
def _make_interface(self, name: str, type: InterfaceType) -> Interface:
|
|
213
213
|
return Interface(
|
annet/configs/context.yml
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
connection:
|
|
2
|
-
default:
|
|
3
|
-
login: ~
|
|
4
|
-
passwords: ~
|
|
5
|
-
enable_ssh_conf: false
|
|
6
|
-
no_nocauth: false
|
|
7
|
-
ssh_forward_agent: ~
|
|
8
|
-
tunnel: ~
|
|
9
1
|
generators:
|
|
10
2
|
default:
|
|
11
3
|
- annet_generators.example
|
|
@@ -17,7 +9,6 @@ storage:
|
|
|
17
9
|
|
|
18
10
|
context:
|
|
19
11
|
default:
|
|
20
|
-
connection: default
|
|
21
12
|
generators: default
|
|
22
13
|
storage: default
|
|
23
14
|
|
annet/generators/jsonfragment.py
CHANGED
|
@@ -86,9 +86,12 @@ class JSONFragment(TreeGenerator):
|
|
|
86
86
|
self._config_pointer.pop()
|
|
87
87
|
|
|
88
88
|
def __call__(self, device: Device, annotate: bool = False):
|
|
89
|
-
|
|
90
|
-
self.
|
|
91
|
-
|
|
89
|
+
try:
|
|
90
|
+
for cfg_fragment in self.run(device):
|
|
91
|
+
self._set_or_replace_dict(self._config_pointer, cfg_fragment)
|
|
92
|
+
return self._json_config
|
|
93
|
+
finally:
|
|
94
|
+
self._json_config = {}
|
|
92
95
|
|
|
93
96
|
def _set_or_replace_dict(self, pointer, value):
|
|
94
97
|
if not pointer:
|
|
@@ -99,27 +102,25 @@ class JSONFragment(TreeGenerator):
|
|
|
99
102
|
else:
|
|
100
103
|
self._set_dict(self._json_config, pointer, value)
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
def _to_str(cls, value: Any) -> str:
|
|
105
|
+
def process_value(self, value: Any) -> Any:
|
|
104
106
|
if isinstance(value, str):
|
|
105
107
|
return value
|
|
106
108
|
elif isinstance(value, list):
|
|
107
|
-
return [
|
|
109
|
+
return [self.process_value(x) for x in value]
|
|
108
110
|
elif isinstance(value, dict):
|
|
109
111
|
for k, v in value.items():
|
|
110
|
-
value[k] =
|
|
112
|
+
value[k] = self.process_value(v)
|
|
111
113
|
return value
|
|
112
114
|
return str(value)
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
def _set_dict(cls, cfg, pointer, value):
|
|
116
|
+
def _set_dict(self, cfg, pointer, value):
|
|
116
117
|
# pointer has at least one key
|
|
117
118
|
if len(pointer) == 1:
|
|
118
119
|
if pointer[0] in cfg:
|
|
119
|
-
cfg[pointer[0]] = [cfg[pointer[0]],
|
|
120
|
+
cfg[pointer[0]] = [cfg[pointer[0]], self.process_value(value)]
|
|
120
121
|
else:
|
|
121
|
-
cfg[pointer[0]] =
|
|
122
|
+
cfg[pointer[0]] = self.process_value(value)
|
|
122
123
|
else:
|
|
123
124
|
if pointer[0] not in cfg:
|
|
124
125
|
cfg[pointer[0]] = {}
|
|
125
|
-
|
|
126
|
+
self._set_dict(cfg[pointer[0]], pointer[1:], self.process_value(value))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: annet
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.10
|
|
4
4
|
Summary: annet
|
|
5
5
|
Home-page: https://github.com/annetutil/annet
|
|
6
6
|
License: MIT
|
|
@@ -23,6 +23,6 @@ Requires-Dist: aiohttp >=3.8.4
|
|
|
23
23
|
Requires-Dist: yarl >=1.8.2
|
|
24
24
|
Requires-Dist: adaptix ==3.0.0b7
|
|
25
25
|
Requires-Dist: dataclass-rest ==0.4
|
|
26
|
-
|
|
27
|
-
Requires-Dist: annetbox >=0.1.8 ;
|
|
26
|
+
Provides-Extra: netbox
|
|
27
|
+
Requires-Dist: annetbox[sync] >=0.1.8 ; extra == 'netbox'
|
|
28
28
|
|
|
@@ -32,8 +32,8 @@ annet/adapters/netbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
32
32
|
annet/adapters/netbox/provider.py,sha256=IIs37QFHuJHxq4A0WfBS4JENk--v3BxqgNPal1Or4Xc,1470
|
|
33
33
|
annet/adapters/netbox/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
annet/adapters/netbox/common/client.py,sha256=-lWZmphD-OPuLIHNKhW_h2bnjrVaiyKYAD_MUPasEbo,2483
|
|
35
|
-
annet/adapters/netbox/common/manufacturer.py,sha256=
|
|
36
|
-
annet/adapters/netbox/common/models.py,sha256=
|
|
35
|
+
annet/adapters/netbox/common/manufacturer.py,sha256=QoTjmuBAg5klOJqeo8HuS2HybIUGsjTkknLkQL_Tiec,1606
|
|
36
|
+
annet/adapters/netbox/common/models.py,sha256=SeWQZV-zvaKvK2YT2Bwf-iapkIs5pr7I7rAI7vlFMB8,6886
|
|
37
37
|
annet/adapters/netbox/common/query.py,sha256=ziUFM7cUEbEIf3k1szTll4aO-OCUa-2Ogxbebi7Tegs,646
|
|
38
38
|
annet/adapters/netbox/common/status_client.py,sha256=W4nTb2yvBlJ2UkWUmUhKQ2PaSQb1shjhHj5ebb4s2s4,591
|
|
39
39
|
annet/adapters/netbox/common/storage_opts.py,sha256=iadgWGMb-rfSp3SnFAw8SH5bMKjwvcAsJ74v_z0CCXQ,507
|
|
@@ -68,13 +68,13 @@ annet/annlib/rbparser/syntax.py,sha256=iZ7Y-4QQBw4L3UtjEh54qisiRDhobl7HZxFNdP8mi
|
|
|
68
68
|
annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
69
|
annet/annlib/rulebook/common.py,sha256=Kd9Xout0xC6ZZDnyaORx0W-1kSM-gTgjQbp1iIXWxic,16489
|
|
70
70
|
annet/api/__init__.py,sha256=7EB3d89kGXKf4Huw7cqyOULTGC9ydL4sHiVw8K0Aeqg,33722
|
|
71
|
-
annet/configs/context.yml,sha256=
|
|
71
|
+
annet/configs/context.yml,sha256=mzJF3K9lM-Fvj9oFOZrDEjQHWJ4W5t96ewMeeWbKDAY,224
|
|
72
72
|
annet/configs/logging.yaml,sha256=EUagfir99QqA73Scc3k7sfQccbU3E1SvEQdyhLFtCl4,997
|
|
73
73
|
annet/generators/__init__.py,sha256=rVHHDTPKHPZsml1eNEAj3o-8RweFTN8J7LX3tKMXdIY,16402
|
|
74
74
|
annet/generators/base.py,sha256=rgQLcQBPZm4ecbKmRhVOpBR-GFJAiVfdb_y5f2-LUR8,3670
|
|
75
75
|
annet/generators/entire.py,sha256=7WySkVaXNT3ZAiHcQ0JUKdlhGJAN8cNUxF6c7ilYnO8,2928
|
|
76
76
|
annet/generators/exceptions.py,sha256=GPXTBgn2xZ3Ev_bdOPlfCLGRC1kQHe_dEq88S-uyi5s,151
|
|
77
|
-
annet/generators/jsonfragment.py,sha256=
|
|
77
|
+
annet/generators/jsonfragment.py,sha256=_jcEjfX9hIiEXSbOPbDAx2WvBkTGMRNrJmluUtIE8C4,4107
|
|
78
78
|
annet/generators/partial.py,sha256=XI01KDA--XwjSEU33SOQCCJZRXFq5boRz1uJA8lVA1g,3502
|
|
79
79
|
annet/generators/perf.py,sha256=K72ivUuXbNXrsHrLeKWhGmczGYWsB7kUDdDzqOX6j3c,2370
|
|
80
80
|
annet/generators/ref.py,sha256=QVdeL8po1D0kBsVLOpCjFR81D8yNTk-kaQj5WUM4hng,438
|
|
@@ -152,10 +152,10 @@ annet_generators/example/lldp.py,sha256=24bGvShxbio-JxUdaehyPRu31LhH9YwSwFDrWVRn
|
|
|
152
152
|
annet_generators/mesh_example/__init__.py,sha256=NfNWgXn1TNiWI6A5tmU6Y-4QV2i33td0Qs3re0MNNMo,218
|
|
153
153
|
annet_generators/mesh_example/bgp.py,sha256=ck--yU_lUdAX9DWaaVQ-C29eQN-EGf1gEpOTBxmMnWA,1317
|
|
154
154
|
annet_generators/mesh_example/mesh_logic.py,sha256=5Wt17LPt-EWe126IFAdaQQGWIOR3mxTJjAMUY8K0c0w,971
|
|
155
|
-
annet-0.16.
|
|
156
|
-
annet-0.16.
|
|
157
|
-
annet-0.16.
|
|
158
|
-
annet-0.16.
|
|
159
|
-
annet-0.16.
|
|
160
|
-
annet-0.16.
|
|
161
|
-
annet-0.16.
|
|
155
|
+
annet-0.16.10.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
|
|
156
|
+
annet-0.16.10.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
|
|
157
|
+
annet-0.16.10.dist-info/METADATA,sha256=nS_AbW4YJ7cjneZlyiKTA1CsSPnk1VcOLfi_KkMipdU,776
|
|
158
|
+
annet-0.16.10.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
159
|
+
annet-0.16.10.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
|
|
160
|
+
annet-0.16.10.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
|
|
161
|
+
annet-0.16.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|