annet 0.16.1__py3-none-any.whl → 0.16.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.
- annet/adapters/netbox/common/models.py +1 -0
- annet/adapters/netbox/provider.py +5 -3
- annet/annlib/netdev/devdb/data/devdb.json +1 -0
- annet/connectors.py +14 -10
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/METADATA +1 -1
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/RECORD +11 -11
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/AUTHORS +0 -0
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/LICENSE +0 -0
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/WHEEL +0 -0
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/entry_points.txt +0 -0
- {annet-0.16.1.dist-info → annet-0.16.2.dist-info}/top_level.txt +0 -0
|
@@ -31,8 +31,9 @@ class NetboxProvider(StorageProvider, AdapterWithName, AdapterWithConfig):
|
|
|
31
31
|
self.url = url
|
|
32
32
|
self.token = token
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
@classmethod
|
|
35
|
+
def with_config(cls, **kwargs: Dict[str, Any]) -> T:
|
|
36
|
+
return cls(**kwargs)
|
|
36
37
|
|
|
37
38
|
def storage(self):
|
|
38
39
|
return storage_factory
|
|
@@ -43,5 +44,6 @@ class NetboxProvider(StorageProvider, AdapterWithName, AdapterWithConfig):
|
|
|
43
44
|
def query(self):
|
|
44
45
|
return NetboxQuery
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
@classmethod
|
|
48
|
+
def name(cls) -> str:
|
|
47
49
|
return "netbox"
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"Huawei.CE.CE8800": " CE88\\d\\d",
|
|
53
53
|
"Huawei.CE.CE8800.CE8850": " CE8850",
|
|
54
54
|
"Huawei.CE.CE8800.CE8851": " CE8851",
|
|
55
|
+
"Huawei.CE.CE8800.CE8855": " CE8855",
|
|
55
56
|
"Huawei.CE.CE9800": " CE98\\d\\d",
|
|
56
57
|
"Huawei.Quidway": " (LS-)?S",
|
|
57
58
|
"Huawei.Quidway.S2x": "2\\d{3}",
|
annet/connectors.py
CHANGED
|
@@ -42,11 +42,11 @@ class Connector(ABC, Generic[T]):
|
|
|
42
42
|
res = self._classes[0]
|
|
43
43
|
return res(*args, **kwargs)
|
|
44
44
|
|
|
45
|
-
def get_all(self
|
|
45
|
+
def get_all(self) -> List[T]:
|
|
46
46
|
if self._classes is None:
|
|
47
47
|
self._classes = self._entry_point or [self._get_default()]
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return self._classes.copy()
|
|
50
50
|
|
|
51
51
|
def set(self, cls: Type[T]):
|
|
52
52
|
if self._classes is not None:
|
|
@@ -97,18 +97,20 @@ def load_entry_point_new(group: str) -> List:
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
class AdapterWithConfig(ABC, Generic[T]):
|
|
100
|
+
@classmethod
|
|
100
101
|
@abstractmethod
|
|
101
|
-
def with_config(
|
|
102
|
+
def with_config(cls, **kwargs: Dict[str, Any]) -> T:
|
|
102
103
|
pass
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
class AdapterWithName(ABC):
|
|
107
|
+
@classmethod
|
|
106
108
|
@abstractmethod
|
|
107
|
-
def name(
|
|
109
|
+
def name(cls) -> str:
|
|
108
110
|
pass
|
|
109
111
|
|
|
110
112
|
|
|
111
|
-
def get_connector_from_config(config_key: str, connectors: List[Connector]) -> Tuple[Connector, Dict[str, Any]]:
|
|
113
|
+
def get_connector_from_config(config_key: str, connectors: List[Type[Connector]]) -> Tuple[Connector, Dict[str, Any]]:
|
|
112
114
|
seen: list[str] = []
|
|
113
115
|
if not connectors:
|
|
114
116
|
raise Exception("empty connectors")
|
|
@@ -119,8 +121,8 @@ def get_connector_from_config(config_key: str, connectors: List[Connector]) -> T
|
|
|
119
121
|
connector_params = context_storage.get("params", {})
|
|
120
122
|
if adapter_name:
|
|
121
123
|
for con in connectors:
|
|
122
|
-
con_name = connector.
|
|
123
|
-
if
|
|
124
|
+
con_name = connector.__name__
|
|
125
|
+
if issubclass(con, AdapterWithName):
|
|
124
126
|
con_name = con.name()
|
|
125
127
|
seen.append(con_name)
|
|
126
128
|
if adapter_name == con_name:
|
|
@@ -136,8 +138,10 @@ def get_connector_from_config(config_key: str, connectors: List[Connector]) -> T
|
|
|
136
138
|
connector = connectors[0]
|
|
137
139
|
if len(connectors) > 1:
|
|
138
140
|
warnings.warn(f"Please specify '{config_key}'. Found more than one classes {connectors}", UserWarning)
|
|
139
|
-
if
|
|
140
|
-
|
|
141
|
+
if issubclass(connector, AdapterWithConfig):
|
|
142
|
+
connector_ins = connector.with_config(**connector_params)
|
|
143
|
+
else:
|
|
144
|
+
connector_ins = connector()
|
|
141
145
|
# return connector_params only for storage
|
|
142
146
|
# TODO: switch storage interface to AdapterWithConfig
|
|
143
|
-
return
|
|
147
|
+
return connector_ins, connector_params
|
|
@@ -3,7 +3,7 @@ annet/annet.py,sha256=TMdEuM7GJQ4TjRVmuK3bCTZN-21lxjQ9sXqEdILUuBk,725
|
|
|
3
3
|
annet/argparse.py,sha256=v1MfhjR0B8qahza0WinmXClpR8UiDFhmwDDWtNroJPA,12855
|
|
4
4
|
annet/cli.py,sha256=hDpjIr3w47lgQ_CvCQS1SXFDK-SJrf5slbT__5u6GIA,12342
|
|
5
5
|
annet/cli_args.py,sha256=KQlihxSl-Phhq1-9oJDdNSbIllEX55LlPfH6viEKOuw,13483
|
|
6
|
-
annet/connectors.py,sha256
|
|
6
|
+
annet/connectors.py,sha256=-Lghz3PtWCBU8Ohrp0KKQcmm1AUZtN0EnOaZ6IQgCQI,5105
|
|
7
7
|
annet/deploy.py,sha256=pM7r8ipk7y-b4OIenc8FMqZpy5F6TmKdo8DDUJNRBlY,18956
|
|
8
8
|
annet/diff.py,sha256=zLcaCnb4lZRUb7frpH1CstQ3kacRcCblZs1uLG8J5lk,3391
|
|
9
9
|
annet/executor.py,sha256=FrYAUuh2TpSVX42SlTN_PhuSHmXG4Wj1nieY9Wqv9so,19122
|
|
@@ -23,11 +23,11 @@ annet/tracing.py,sha256=ndpM-au1c88uBBpOuH_z52qWZL773edYozNyys_wA68,4044
|
|
|
23
23
|
annet/types.py,sha256=f2HwqoKa6AucwFwDMszoouB6m1B8n6VmdjHMktO30Kc,7175
|
|
24
24
|
annet/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
annet/adapters/netbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
annet/adapters/netbox/provider.py,sha256=
|
|
26
|
+
annet/adapters/netbox/provider.py,sha256=IIs37QFHuJHxq4A0WfBS4JENk--v3BxqgNPal1Or4Xc,1470
|
|
27
27
|
annet/adapters/netbox/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
annet/adapters/netbox/common/client.py,sha256=-lWZmphD-OPuLIHNKhW_h2bnjrVaiyKYAD_MUPasEbo,2483
|
|
29
29
|
annet/adapters/netbox/common/manufacturer.py,sha256=WZsBfHq6kohbbkszxPARjMdXB5rWGBO4Gz1rA-IlqL8,1555
|
|
30
|
-
annet/adapters/netbox/common/models.py,sha256=
|
|
30
|
+
annet/adapters/netbox/common/models.py,sha256=zWxsChKZiJ_VQ5_K-l_o-iyDQgxNLvYpk4EvVSoga5o,3316
|
|
31
31
|
annet/adapters/netbox/common/query.py,sha256=ziUFM7cUEbEIf3k1szTll4aO-OCUa-2Ogxbebi7Tegs,646
|
|
32
32
|
annet/adapters/netbox/common/status_client.py,sha256=W4nTb2yvBlJ2UkWUmUhKQ2PaSQb1shjhHj5ebb4s2s4,591
|
|
33
33
|
annet/adapters/netbox/common/storage_opts.py,sha256=iadgWGMb-rfSp3SnFAw8SH5bMKjwvcAsJ74v_z0CCXQ,507
|
|
@@ -49,7 +49,7 @@ annet/annlib/types.py,sha256=VHU0CBADfYmO0xzB_c5f-mcuU3dUumuJczQnqGlib9M,852
|
|
|
49
49
|
annet/annlib/netdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
50
|
annet/annlib/netdev/db.py,sha256=fI_u5aya4l61mbYSjj4JwlVfi3s7obt2jqERSuXGRUI,1634
|
|
51
51
|
annet/annlib/netdev/devdb/__init__.py,sha256=aKYjjLbJebdKBjnGDpVLQdSqrV2JL24spGm58tmMWVU,892
|
|
52
|
-
annet/annlib/netdev/devdb/data/devdb.json,sha256=
|
|
52
|
+
annet/annlib/netdev/devdb/data/devdb.json,sha256=Qph7WxZBEbgBqbCFeYu6ZM0qkEBn80WmJEjfJkcaZ-0,5940
|
|
53
53
|
annet/annlib/netdev/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
annet/annlib/netdev/views/dump.py,sha256=rIlyvnA3uM8bB_7oq1nS2KDxTp6dQh2hz-FbNhYIpOU,4630
|
|
55
55
|
annet/annlib/netdev/views/hardware.py,sha256=1JdTkrumOTYd5GKz4_LKg8G-B6ccrzl5VdNT-JhX40A,3495
|
|
@@ -133,10 +133,10 @@ annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019
|
|
|
133
133
|
annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
134
134
|
annet_generators/example/__init__.py,sha256=zVd8_DrXuOASrNzg2Ab94rPyvJff83L-_HppDFxnUjM,228
|
|
135
135
|
annet_generators/example/lldp.py,sha256=24bGvShxbio-JxUdaehyPRu31LhH9YwSwFDrWVRn6yo,2100
|
|
136
|
-
annet-0.16.
|
|
137
|
-
annet-0.16.
|
|
138
|
-
annet-0.16.
|
|
139
|
-
annet-0.16.
|
|
140
|
-
annet-0.16.
|
|
141
|
-
annet-0.16.
|
|
142
|
-
annet-0.16.
|
|
136
|
+
annet-0.16.2.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
|
|
137
|
+
annet-0.16.2.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
|
|
138
|
+
annet-0.16.2.dist-info/METADATA,sha256=YdQdLWLVxedQwFGAEbcsgOd3arNJ0M2DdRV8K9NxE_k,694
|
|
139
|
+
annet-0.16.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
140
|
+
annet-0.16.2.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
|
|
141
|
+
annet-0.16.2.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
|
|
142
|
+
annet-0.16.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|