annet 3.0.0__py3-none-any.whl → 3.1.0__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/__init__.py +5 -4
- annet/annlib/patching.py +2 -1
- annet/annlib/rbparser/platform.py +0 -66
- annet/annlib/rulebook/common.py +21 -14
- annet/annlib/tabparser.py +0 -18
- annet/api/__init__.py +15 -7
- annet/diff.py +3 -3
- annet/gen.py +6 -6
- annet/generators/__init__.py +15 -22
- annet/rulebook/__init__.py +1 -1
- annet/rulebook/juniper/__init__.py +2 -2
- annet/rulebook/patching.py +3 -3
- annet/vendors/base.py +13 -0
- annet/vendors/registry.py +9 -0
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/METADATA +1 -1
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/RECORD +21 -22
- annet/tabparser.py +0 -53
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/WHEEL +0 -0
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/entry_points.txt +0 -0
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/licenses/AUTHORS +0 -0
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/licenses/LICENSE +0 -0
- {annet-3.0.0.dist-info → annet-3.1.0.dist-info}/top_level.txt +0 -0
annet/__init__.py
CHANGED
|
@@ -7,14 +7,15 @@ from argparse import SUPPRESS, Namespace
|
|
|
7
7
|
|
|
8
8
|
import colorama
|
|
9
9
|
import yaml
|
|
10
|
-
from annet.annlib.errors import ( # pylint: disable=wrong-import-position
|
|
11
|
-
DeployCancelled,
|
|
12
|
-
ExecError,
|
|
13
|
-
)
|
|
14
10
|
from contextlog import patch_logging, patch_threading
|
|
15
11
|
from valkit.python import valid_logging_level
|
|
16
12
|
|
|
17
13
|
import annet.argparse
|
|
14
|
+
from annet.annlib import tabparser # pylint: disable=unused-import
|
|
15
|
+
from annet.annlib.errors import ( # pylint: disable=wrong-import-position
|
|
16
|
+
DeployCancelled,
|
|
17
|
+
ExecError,
|
|
18
|
+
)
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
__all__ = ("DeployCancelled", "ExecError")
|
annet/annlib/patching.py
CHANGED
|
@@ -184,7 +184,8 @@ class Orderer:
|
|
|
184
184
|
f_rule = ""
|
|
185
185
|
children = []
|
|
186
186
|
ordering = self.rb
|
|
187
|
-
|
|
187
|
+
|
|
188
|
+
block_exit = registry_connector.get()[self.vendor].exit
|
|
188
189
|
|
|
189
190
|
for (order, (raw_rule, rule)) in enumerate(ordering.items()):
|
|
190
191
|
if (
|
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
VENDOR_REVERSES = {
|
|
2
|
-
"huawei": "undo",
|
|
3
|
-
"h3c": "undo",
|
|
4
|
-
"optixtrans": "undo",
|
|
5
|
-
"cisco": "no",
|
|
6
|
-
"iosxr": "no",
|
|
7
|
-
"nexus": "no",
|
|
8
|
-
"juniper": "delete",
|
|
9
|
-
"arista": "no",
|
|
10
|
-
"nokia": "delete",
|
|
11
|
-
"routeros": "remove",
|
|
12
|
-
"aruba": "no",
|
|
13
|
-
"pc": "-",
|
|
14
|
-
"ribbon": "delete",
|
|
15
|
-
"b4com": "no",
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
VENDOR_DIFF = {
|
|
19
|
-
"huawei": "common.default_diff",
|
|
20
|
-
"optixtrans": "common.default_diff",
|
|
21
|
-
"cisco": "common.default_diff",
|
|
22
|
-
"iosxr": "common.default_diff",
|
|
23
|
-
"nexus": "common.default_diff",
|
|
24
|
-
"juniper": "juniper.default_diff",
|
|
25
|
-
"arista": "common.default_diff",
|
|
26
|
-
"nokia": "juniper.default_diff",
|
|
27
|
-
"routeros": "common.default_diff",
|
|
28
|
-
"aruba": "aruba.default_diff",
|
|
29
|
-
"pc": "common.default_diff",
|
|
30
|
-
"ribbon": "juniper.default_diff",
|
|
31
|
-
"b4com": "common.default_diff",
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
VENDOR_DIFF_ORDERED = {
|
|
35
|
-
"huawei": "common.ordered_diff",
|
|
36
|
-
"optixtrans": "common.ordered_diff",
|
|
37
|
-
"cisco": "common.ordered_diff",
|
|
38
|
-
"iosxr": "common.ordered_diff",
|
|
39
|
-
"nexus": "common.ordered_diff",
|
|
40
|
-
"juniper": "juniper.ordered_diff",
|
|
41
|
-
"arista": "common.ordered_diff",
|
|
42
|
-
"nokia": "juniper.ordered_diff",
|
|
43
|
-
"routeros": "common.ordered_diff",
|
|
44
|
-
"aruba": "common.ordered_diff",
|
|
45
|
-
"pc": "common.ordered_diff",
|
|
46
|
-
"ribbon": "juniper.ordered_diff",
|
|
47
|
-
"b4com": "common.ordered_diff",
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
VENDOR_EXIT = {
|
|
51
|
-
"huawei": "quit",
|
|
52
|
-
"h3c": "quit",
|
|
53
|
-
"optixtrans": "quit",
|
|
54
|
-
"cisco": "exit",
|
|
55
|
-
"iosxr": "exit",
|
|
56
|
-
"nexus": "exit",
|
|
57
|
-
"arista": "exit",
|
|
58
|
-
"juniper": "",
|
|
59
|
-
"nokia": "",
|
|
60
|
-
"routeros": "",
|
|
61
|
-
"aruba": "exit",
|
|
62
|
-
"pc": "",
|
|
63
|
-
"ribbon": "exit",
|
|
64
|
-
"b4com": "exit",
|
|
65
|
-
}
|
|
66
|
-
|
|
67
1
|
VENDOR_ALIASES = {
|
|
68
2
|
"h3c": "huawei",
|
|
69
3
|
}
|
annet/annlib/rulebook/common.py
CHANGED
|
@@ -135,20 +135,21 @@ class DiffItem(typing.NamedTuple):
|
|
|
135
135
|
diff_pre: typing.Dict[str, typing.Any]
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
Differ = typing.Callable[[odict, odict, odict, tuple[Op, ...]], list[DiffItem]]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def default_diff(old: odict, new: odict, diff_pre: odict, _pops: tuple[Op, ...] = (Op.AFFECTED,)) -> list[DiffItem]:
|
|
139
142
|
diff = base_diff(old, new, diff_pre, _pops, moved_to_affected=True)
|
|
140
143
|
return diff
|
|
141
144
|
|
|
142
145
|
|
|
143
|
-
def ordered_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
146
|
+
def ordered_diff(old: odict, new: odict, diff_pre: odict, _pops: tuple[Op, ...] = (Op.AFFECTED,)) -> list[DiffItem]:
|
|
144
147
|
diff = base_diff(old, new, diff_pre, _pops, moved_to_affected=False)
|
|
145
148
|
return diff
|
|
146
149
|
|
|
147
150
|
|
|
148
|
-
def rewrite_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
149
|
-
def iter_diff(
|
|
150
|
-
diff: typing.List[DiffItem],
|
|
151
|
-
) -> typing.Iterable[typing.Tuple[int, typing.List[DiffItem]]]:
|
|
151
|
+
def rewrite_diff(old: odict, new: odict, diff_pre: odict, _pops: tuple[Op, ...] = (Op.AFFECTED,)) -> list[DiffItem]:
|
|
152
|
+
def iter_diff(diff: list[DiffItem]) -> typing.Iterable[tuple[int, list[DiffItem]]]:
|
|
152
153
|
queue = [diff]
|
|
153
154
|
while queue:
|
|
154
155
|
items, queue = queue[0], queue[1:]
|
|
@@ -173,16 +174,18 @@ def rewrite_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
|
173
174
|
return diff
|
|
174
175
|
|
|
175
176
|
|
|
176
|
-
def multiline_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
177
|
+
def multiline_diff(old: odict, new: odict, diff_pre: odict, _pops: tuple[Op, ...] = (Op.AFFECTED,)) -> list[DiffItem]:
|
|
177
178
|
"""
|
|
178
179
|
Особая логика diff'a для хуавейных мультилайнов.
|
|
179
180
|
Она трактует все дочерние элементы %multiline-команды как
|
|
180
181
|
одну общую команду, покидывая внутрь тот Op который был
|
|
181
182
|
определен на вернем уровне
|
|
182
183
|
"""
|
|
184
|
+
|
|
183
185
|
def process_multiline(op, tree):
|
|
184
|
-
for
|
|
185
|
-
yield
|
|
186
|
+
for row, children in tree.items():
|
|
187
|
+
yield op, row, list(process_multiline(op, children)), None
|
|
188
|
+
|
|
186
189
|
ret = []
|
|
187
190
|
for item in default_diff(old, new, diff_pre, _pops):
|
|
188
191
|
if old.get(item.row, {}) == new.get(item.row, {}):
|
|
@@ -192,23 +195,27 @@ def multiline_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
|
192
195
|
op, tree = Op.REMOVED, old
|
|
193
196
|
children = list(process_multiline(op, tree[item.row]))
|
|
194
197
|
ret.append(DiffItem(item.op, item.row, children, item.diff_pre))
|
|
198
|
+
|
|
195
199
|
return ret
|
|
196
200
|
|
|
197
201
|
|
|
198
|
-
def base_diff(
|
|
202
|
+
def base_diff(
|
|
203
|
+
old: odict, new: odict, diff_pre: odict, pops: tuple[Op, ...], moved_to_affected: bool = False
|
|
204
|
+
) -> list[DiffItem]:
|
|
199
205
|
diff_indexed: typing.List[typing.Tuple[int, DiffItem]] = []
|
|
200
206
|
old = _ignore_case(diff_pre, old)
|
|
201
207
|
new = _ignore_case(diff_pre, new)
|
|
202
208
|
|
|
203
|
-
for
|
|
209
|
+
for index, row in enumerate(old):
|
|
204
210
|
if row not in new:
|
|
205
|
-
children = call_diff_logic(diff_pre[row]["subtree"], old[row],
|
|
211
|
+
children = call_diff_logic(diff_pre[row]["subtree"], old[row], odict(), pops + (Op.REMOVED,))
|
|
206
212
|
diff_indexed.append((index, DiffItem(
|
|
207
213
|
op=Op.REMOVED,
|
|
208
214
|
row=row,
|
|
209
215
|
children=children,
|
|
210
216
|
diff_pre=diff_pre[row]["match"],
|
|
211
217
|
)))
|
|
218
|
+
|
|
212
219
|
old_indexes = {row: index for (index, row) in enumerate(old)}
|
|
213
220
|
block_in_disorder = False
|
|
214
221
|
parent_op = pops[-1]
|
|
@@ -232,13 +239,13 @@ def base_diff(old, new, diff_pre, pops, moved_to_affected=False) -> typing.List[
|
|
|
232
239
|
return [x[1] for x in diff_indexed]
|
|
233
240
|
|
|
234
241
|
|
|
235
|
-
def call_diff_logic(diff_pre, old, new, pops=(Op.AFFECTED,)):
|
|
242
|
+
def call_diff_logic(diff_pre: odict, old: odict, new: odict, pops: tuple[Op, ...] = (Op.AFFECTED,)):
|
|
236
243
|
"""
|
|
237
244
|
Группируем команды в старом и новом конфиге согласно выставленным
|
|
238
245
|
в рулбуке атрибутам %diff_logic и вызывает их поочереди согласно
|
|
239
246
|
порядку команд в old и new, предпочитая old (т.е. сначала удаления)
|
|
240
247
|
"""
|
|
241
|
-
diff_logics = odict()
|
|
248
|
+
diff_logics: odict = odict()
|
|
242
249
|
for row in old:
|
|
243
250
|
logic = diff_pre[row]["match"]["attrs"]["diff_logic"]
|
|
244
251
|
if logic not in diff_logics:
|
annet/annlib/tabparser.py
CHANGED
|
@@ -819,24 +819,6 @@ class RosFormatter(CommonFormatter):
|
|
|
819
819
|
return commands
|
|
820
820
|
|
|
821
821
|
|
|
822
|
-
def make_formatter(vendor, **kwargs):
|
|
823
|
-
formatters = {
|
|
824
|
-
"juniper": JuniperFormatter,
|
|
825
|
-
"cisco": CiscoFormatter,
|
|
826
|
-
"nexus": NexusFormatter,
|
|
827
|
-
"huawei": HuaweiFormatter,
|
|
828
|
-
"optixtrans": OptixtransFormatter,
|
|
829
|
-
"arista": AristaFormatter,
|
|
830
|
-
"nokia": NokiaFormatter,
|
|
831
|
-
"routeros": RosFormatter,
|
|
832
|
-
"aruba": ArubaFormatter,
|
|
833
|
-
"pc": CommonFormatter,
|
|
834
|
-
"ribbon": RibbonFormatter,
|
|
835
|
-
"b4com": B4comFormatter,
|
|
836
|
-
}
|
|
837
|
-
return formatters[vendor](**kwargs)
|
|
838
|
-
|
|
839
|
-
|
|
840
822
|
# ====
|
|
841
823
|
def parse_to_tree(text, splitter, comments=("!", "#")):
|
|
842
824
|
tree = odict()
|
annet/api/__init__.py
CHANGED
|
@@ -25,7 +25,6 @@ import annet.deploy_ui
|
|
|
25
25
|
import annet.lib
|
|
26
26
|
from annet.annlib import jsontools
|
|
27
27
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
28
|
-
from annet.annlib.rbparser.platform import VENDOR_REVERSES
|
|
29
28
|
from annet.annlib.types import GeneratorType
|
|
30
29
|
from contextlog import get_logger
|
|
31
30
|
|
|
@@ -139,16 +138,19 @@ def _read_device_config(path, hw):
|
|
|
139
138
|
_logger = get_logger()
|
|
140
139
|
_logger.debug("Reading %r ...", path)
|
|
141
140
|
score = 1
|
|
141
|
+
vendor_registry = registry_connector.get()
|
|
142
142
|
|
|
143
143
|
with open(path) as cfgdump_file:
|
|
144
144
|
text = cfgdump_file.read()
|
|
145
145
|
try:
|
|
146
146
|
if not hw:
|
|
147
147
|
hw, score = guess_hw(text)
|
|
148
|
+
|
|
148
149
|
config = tabparser.parse_to_tree(
|
|
149
150
|
text=text,
|
|
150
|
-
splitter=
|
|
151
|
+
splitter=vendor_registry.match(hw).make_formatter().split,
|
|
151
152
|
)
|
|
153
|
+
|
|
152
154
|
return config, hw, score
|
|
153
155
|
except tabparser.ParserError:
|
|
154
156
|
_logger.exception("Parser error: %r", path)
|
|
@@ -157,7 +159,7 @@ def _read_device_config(path, hw):
|
|
|
157
159
|
|
|
158
160
|
# =====
|
|
159
161
|
def _format_patch_blocks(patch_tree, hw, indent):
|
|
160
|
-
formatter =
|
|
162
|
+
formatter = registry_connector.get().match(hw).make_formatter(indent=indent)
|
|
161
163
|
return formatter.patch(patch_tree)
|
|
162
164
|
|
|
163
165
|
|
|
@@ -396,9 +398,12 @@ class CliDeployerJob(DeployerJob):
|
|
|
396
398
|
(diff_obj, patch_tree) = _diff_and_patch(device, old, new, acl_rules,
|
|
397
399
|
res.filter_acl_rules, self.add_comments,
|
|
398
400
|
do_commit=not self.args.dont_commit)
|
|
399
|
-
|
|
401
|
+
|
|
402
|
+
formatter = registry_connector.get().match(device.hw).make_formatter(indent="")
|
|
403
|
+
cmds = formatter.cmd_paths(patch_tree)
|
|
400
404
|
if not cmds:
|
|
401
405
|
return
|
|
406
|
+
|
|
402
407
|
self._has_diff = True
|
|
403
408
|
self.diffs[device] = diff_obj
|
|
404
409
|
self.cmd_lines.extend(["= %s " % device.hostname, ""])
|
|
@@ -551,7 +556,7 @@ class Deployer:
|
|
|
551
556
|
dest_name = "= %s" % ", ".join([dev.hostname for dev in devices])
|
|
552
557
|
diff_lines.extend([dest_name, ""])
|
|
553
558
|
|
|
554
|
-
for line in
|
|
559
|
+
for line in registry_connector.get().match(devices[0].hw).make_formatter().diff(diff_obj):
|
|
555
560
|
diff_lines.append(line)
|
|
556
561
|
diff_lines.append("")
|
|
557
562
|
return diff_lines
|
|
@@ -787,14 +792,17 @@ def guess_hw(config_text: str):
|
|
|
787
792
|
текста конфига и annet/rulebook/texts/*.rul"""
|
|
788
793
|
scores = {}
|
|
789
794
|
hw_provider = hardware_connector.get()
|
|
790
|
-
|
|
795
|
+
vendor_registry = registry_connector.get()
|
|
796
|
+
for vendor in vendor_registry:
|
|
791
797
|
hw = hw_provider.vendor_to_hw(vendor)
|
|
792
|
-
fmtr = tabparser.make_formatter(hw)
|
|
793
798
|
rb = rulebook.get_rulebook(hw)
|
|
799
|
+
fmtr = vendor_registry[vendor].make_formatter()
|
|
800
|
+
|
|
794
801
|
try:
|
|
795
802
|
config = tabparser.parse_to_tree(config_text, fmtr.split)
|
|
796
803
|
except Exception:
|
|
797
804
|
continue
|
|
805
|
+
|
|
798
806
|
pre = patching.make_pre(patching.make_diff({}, config, rb, []))
|
|
799
807
|
metric = _count_pre_score(pre)
|
|
800
808
|
scores[metric] = hw
|
annet/diff.py
CHANGED
|
@@ -21,8 +21,8 @@ from annet.cli_args import ShowDiffOptions
|
|
|
21
21
|
from annet.connectors import CachedConnector
|
|
22
22
|
from annet.output import output_driver_connector
|
|
23
23
|
from annet.storage import Device
|
|
24
|
-
from annet.tabparser import make_formatter
|
|
25
24
|
from annet.types import Diff, PCDiff, PCDiffFile
|
|
25
|
+
from annet.vendors import registry_connector
|
|
26
26
|
|
|
27
27
|
from .gen import Loader, old_new
|
|
28
28
|
|
|
@@ -159,7 +159,7 @@ def _transform_text_diff_for_collapsing(text_diff) -> List[str]:
|
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
def _make_text_diff(device: Device, diff: Diff) -> List[str]:
|
|
162
|
-
formatter =
|
|
162
|
+
formatter = registry_connector.get().match(device.hw).make_formatter()
|
|
163
163
|
res = formatter.diff(diff)
|
|
164
164
|
return res
|
|
165
165
|
|
|
@@ -226,7 +226,7 @@ class FrrFileDiffer(UnifiedFileDiffer):
|
|
|
226
226
|
indent = " "
|
|
227
227
|
rb = rulebook.rulebook_provider_connector.get()
|
|
228
228
|
rulebook_data = rb.get_rulebook(hw)
|
|
229
|
-
formatter =
|
|
229
|
+
formatter = registry_connector.get().match(hw).make_formatter(indent=indent)
|
|
230
230
|
|
|
231
231
|
old_tree = tabparser.parse_to_tree(old_text or "", splitter=formatter.split)
|
|
232
232
|
new_tree = tabparser.parse_to_tree(new_text or "", splitter=formatter.split)
|
annet/gen.py
CHANGED
|
@@ -29,7 +29,7 @@ from annet import generators, implicit, patching, tabparser, tracing
|
|
|
29
29
|
from annet.annlib import jsontools
|
|
30
30
|
from annet.annlib.rbparser.acl import compile_acl_text
|
|
31
31
|
from annet.cli_args import DeployOptions, GenOptions, ShowGenOptions
|
|
32
|
-
from annet.deploy import
|
|
32
|
+
from annet.deploy import get_fetcher, scrub_config
|
|
33
33
|
from annet.filtering import Filterer
|
|
34
34
|
from annet.generators import (
|
|
35
35
|
BaseGenerator,
|
|
@@ -40,12 +40,12 @@ from annet.generators import (
|
|
|
40
40
|
PartialGenerator,
|
|
41
41
|
RefGenerator,
|
|
42
42
|
)
|
|
43
|
-
from annet.lib import merge_dicts, percentile
|
|
43
|
+
from annet.lib import do_async, merge_dicts, percentile
|
|
44
44
|
from annet.output import output_driver_connector
|
|
45
|
-
from annet.
|
|
46
|
-
from annet.storage import Device, Storage, storage_connector
|
|
45
|
+
from annet.storage import Device, Storage
|
|
47
46
|
from annet.tracing import tracing_connector
|
|
48
47
|
from annet.types import OldNewResult
|
|
48
|
+
from annet.vendors import registry_connector
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
# Вывод всех генераторов вместе.
|
|
@@ -162,7 +162,7 @@ def _old_new_per_device(ctx: OldNewDeviceContext, device: Device, filterer: Filt
|
|
|
162
162
|
if ctx.config != "empty":
|
|
163
163
|
old = tabparser.parse_to_tree(
|
|
164
164
|
text=text,
|
|
165
|
-
splitter=
|
|
165
|
+
splitter=registry_connector.get().match(device.hw).make_formatter().split,
|
|
166
166
|
)
|
|
167
167
|
if not old:
|
|
168
168
|
res = generators.run_partial_initial(device)
|
|
@@ -638,7 +638,7 @@ def _existing_cfg_file_name(config_dir: str, device) -> Optional[str]:
|
|
|
638
638
|
|
|
639
639
|
|
|
640
640
|
def format_config_blocks(config, hw, indent, _level=0):
|
|
641
|
-
formatter =
|
|
641
|
+
formatter = registry_connector.get().match(hw).make_formatter(indent=indent)
|
|
642
642
|
return formatter.join(config)
|
|
643
643
|
|
|
644
644
|
|
annet/generators/__init__.py
CHANGED
|
@@ -7,24 +7,15 @@ import os
|
|
|
7
7
|
import re
|
|
8
8
|
import textwrap
|
|
9
9
|
from collections import OrderedDict as odict
|
|
10
|
-
from typing import
|
|
11
|
-
FrozenSet,
|
|
12
|
-
Iterable,
|
|
13
|
-
List,
|
|
14
|
-
Optional,
|
|
15
|
-
Union,
|
|
16
|
-
)
|
|
10
|
+
from typing import FrozenSet, Iterable, List, Optional, Union
|
|
17
11
|
|
|
18
|
-
from annet.annlib.rbparser.acl import compile_acl_text
|
|
19
12
|
from contextlog import get_logger
|
|
20
13
|
|
|
21
|
-
from annet.storage import Device
|
|
22
|
-
|
|
23
14
|
from annet import patching, tabparser, tracing
|
|
15
|
+
from annet.annlib.rbparser.acl import compile_acl_text
|
|
24
16
|
from annet.cli_args import GenSelectOptions, ShowGeneratorsOptions
|
|
25
|
-
from annet.lib import
|
|
26
|
-
|
|
27
|
-
)
|
|
17
|
+
from annet.lib import get_context
|
|
18
|
+
from annet.storage import Device
|
|
28
19
|
from annet.tracing import tracing_connector
|
|
29
20
|
from annet.types import (
|
|
30
21
|
GeneratorEntireResult,
|
|
@@ -33,19 +24,20 @@ from annet.types import (
|
|
|
33
24
|
GeneratorPartialRunArgs,
|
|
34
25
|
GeneratorResult,
|
|
35
26
|
)
|
|
36
|
-
from .
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
from .
|
|
27
|
+
from annet.vendors import registry_connector
|
|
28
|
+
|
|
29
|
+
from .base import BaseGenerator
|
|
30
|
+
from .base import ParamsList as ParamsList
|
|
31
|
+
from .base import TextGenerator as TextGenerator
|
|
32
|
+
from .entire import Entire
|
|
33
|
+
from .exceptions import GeneratorError, NotSupportedDevice
|
|
42
34
|
from .jsonfragment import JSONFragment
|
|
43
35
|
from .partial import PartialGenerator
|
|
44
|
-
from .entire import Entire
|
|
45
|
-
from .ref import RefGenerator
|
|
46
36
|
from .perf import GeneratorPerfMesurer
|
|
37
|
+
from .ref import RefGenerator
|
|
47
38
|
from .result import RunGeneratorResult
|
|
48
39
|
|
|
40
|
+
|
|
49
41
|
# =====
|
|
50
42
|
DISABLED_TAG = "disable"
|
|
51
43
|
|
|
@@ -200,7 +192,8 @@ def _run_partial_generator(gen: "PartialGenerator", run_args: GeneratorPartialRu
|
|
|
200
192
|
logger.error("Generator error in file '%s:%i'", filename, lineno)
|
|
201
193
|
raise GeneratorError(f"{gen} on {device}") from err
|
|
202
194
|
|
|
203
|
-
fmtr =
|
|
195
|
+
fmtr = registry_connector.get().match(device.hw).make_formatter()
|
|
196
|
+
|
|
204
197
|
try:
|
|
205
198
|
config = tabparser.parse_to_tree(text=output, splitter=fmtr.split)
|
|
206
199
|
except tabparser.ParserError as err:
|
annet/rulebook/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Iterable, Union
|
|
|
5
5
|
|
|
6
6
|
from annet.annlib.lib import mako_render
|
|
7
7
|
from annet.annlib.rbparser.ordering import compile_ordering_text
|
|
8
|
-
from annet.annlib.rbparser.platform import
|
|
8
|
+
from annet.annlib.rbparser.platform import VENDOR_ALIASES
|
|
9
9
|
|
|
10
10
|
from annet.connectors import CachedConnector
|
|
11
11
|
from annet.rulebook.deploying import compile_deploying_text
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import functools
|
|
1
2
|
import re
|
|
2
3
|
from collections import OrderedDict as odict
|
|
3
|
-
import functools
|
|
4
4
|
|
|
5
5
|
from annet.annlib.lib import jun_activate, jun_is_inactive, merge_dicts
|
|
6
|
+
from annet.annlib.tabparser import JuniperFormatter
|
|
6
7
|
from annet.annlib.types import Op
|
|
7
|
-
from annet.tabparser import JuniperFormatter
|
|
8
8
|
from annet.rulebook import common
|
|
9
9
|
|
|
10
10
|
|
annet/rulebook/patching.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import re
|
|
3
3
|
from collections import OrderedDict as odict
|
|
4
|
-
|
|
5
4
|
from annet.annlib.rbparser import platform, syntax
|
|
6
5
|
from annet.vendors import registry_connector
|
|
7
6
|
from valkit.common import valid_bool, valid_string_list
|
|
@@ -19,6 +18,7 @@ MULTILINE_DIFF_LOGIC = "common.multiline_diff"
|
|
|
19
18
|
# =====
|
|
20
19
|
@functools.lru_cache()
|
|
21
20
|
def compile_patching_text(text, vendor):
|
|
21
|
+
|
|
22
22
|
return _compile_patching(
|
|
23
23
|
tree=syntax.parse_text(text, params_scheme={
|
|
24
24
|
"global": {
|
|
@@ -31,7 +31,7 @@ def compile_patching_text(text, vendor):
|
|
|
31
31
|
},
|
|
32
32
|
"diff_logic": {
|
|
33
33
|
"validator": valid_object_path,
|
|
34
|
-
"default":
|
|
34
|
+
"default": registry_connector.get()[vendor].diff(False),
|
|
35
35
|
},
|
|
36
36
|
"comment": {
|
|
37
37
|
"validator": valid_string_list,
|
|
@@ -86,7 +86,7 @@ def _compile_patching(tree, reverse_prefix, vendor):
|
|
|
86
86
|
}
|
|
87
87
|
else:
|
|
88
88
|
if attrs["params"]["ordered"]:
|
|
89
|
-
attrs["params"]["diff_logic"] =
|
|
89
|
+
attrs["params"]["diff_logic"] = registry_connector.get()[vendor].diff(True)
|
|
90
90
|
attrs["params"]["logic"] = ORDERED_PATCH_LOGIC
|
|
91
91
|
elif attrs["params"]["rewrite"]:
|
|
92
92
|
attrs["params"]["diff_logic"] = REWRITE_DIFF_LOGIC
|
annet/vendors/base.py
CHANGED
|
@@ -2,6 +2,7 @@ import abc
|
|
|
2
2
|
from typing import ClassVar
|
|
3
3
|
|
|
4
4
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
5
|
+
from annet.annlib.tabparser import CommonFormatter
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class AbstractVendor(abc.ABC):
|
|
@@ -16,6 +17,14 @@ class AbstractVendor(abc.ABC):
|
|
|
16
17
|
def reverse(self) -> str:
|
|
17
18
|
raise NotImplementedError
|
|
18
19
|
|
|
20
|
+
def diff(self, order: bool) -> str:
|
|
21
|
+
return "common.ordered_diff" if order else "common.default_diff"
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
@abc.abstractmethod
|
|
25
|
+
def exit(self) -> str:
|
|
26
|
+
raise NotImplementedError
|
|
27
|
+
|
|
19
28
|
@property
|
|
20
29
|
@abc.abstractmethod
|
|
21
30
|
def hardware(self) -> HardwareView:
|
|
@@ -23,3 +32,7 @@ class AbstractVendor(abc.ABC):
|
|
|
23
32
|
|
|
24
33
|
def svi_name(self, num: int) -> str:
|
|
25
34
|
return f"vlan{num}"
|
|
35
|
+
|
|
36
|
+
@abc.abstractmethod
|
|
37
|
+
def make_formatter(self, **kwargs) -> CommonFormatter:
|
|
38
|
+
raise NotImplementedError
|
annet/vendors/registry.py
CHANGED
|
@@ -2,9 +2,11 @@ import enum
|
|
|
2
2
|
from operator import itemgetter
|
|
3
3
|
|
|
4
4
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
5
|
+
from annet.annlib.tabparser import CommonFormatter
|
|
5
6
|
|
|
6
7
|
from .base import AbstractVendor
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
_SENTINEL = enum.Enum("_SENTINEL", "sentinel")
|
|
9
11
|
sentinel = _SENTINEL.sentinel
|
|
10
12
|
|
|
@@ -21,6 +23,13 @@ class GenericVendor(AbstractVendor):
|
|
|
21
23
|
def hardware(self) -> HardwareView:
|
|
22
24
|
return HardwareView("")
|
|
23
25
|
|
|
26
|
+
def make_formatter(self, **kwargs) -> CommonFormatter:
|
|
27
|
+
return CommonFormatter(**kwargs)
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def exit(self) -> str:
|
|
31
|
+
return ""
|
|
32
|
+
|
|
24
33
|
|
|
25
34
|
GENERIC_VENDOR = GenericVendor()
|
|
26
35
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
annet/__init__.py,sha256=
|
|
1
|
+
annet/__init__.py,sha256=mq-nzRTsR4cLd-wy4BL1i1MI57f2iG_5NX0iKViF_9U,1914
|
|
2
2
|
annet/annet.py,sha256=vyQ__n5hkjub3aWO8tksHPoUSbTeK97MyMcR_U8_BSU,1016
|
|
3
3
|
annet/argparse.py,sha256=v1MfhjR0B8qahza0WinmXClpR8UiDFhmwDDWtNroJPA,12855
|
|
4
4
|
annet/bgp_models.py,sha256=oibTSdipNkGL4t8Xn94bhyKHMOtwbPBqmYaAy4FmTxQ,12361
|
|
@@ -7,10 +7,10 @@ annet/cli_args.py,sha256=jzMKRezWe_87k7VBNzgwPjWGMROJksbgrlX-GDd6oQs,13533
|
|
|
7
7
|
annet/connectors.py,sha256=aoiDVLPizx8CW2p8SAwGCzyO_WW8H9xc2aujbGC4bDg,4882
|
|
8
8
|
annet/deploy.py,sha256=JCcJ2hUmUsaOSrcxFuW8SlN0ubXSnHQ7H_nP_tx-PgE,7698
|
|
9
9
|
annet/deploy_ui.py,sha256=KcP1g_c1HSA3n5qFxbGHd8t_arL4_xJV46PFO-7FLg8,28650
|
|
10
|
-
annet/diff.py,sha256=
|
|
10
|
+
annet/diff.py,sha256=rxomgjyewq0VxKqWCqHEjYt6s_Ihv3HXiUr5QVHPlWU,9497
|
|
11
11
|
annet/executor.py,sha256=lcKI-EbYqeCiBNpL729kSltduzxbAzOkQ1L_QK7tNv8,5112
|
|
12
12
|
annet/filtering.py,sha256=ZtqxPsKdV9reZoRxtQyBg22BqyMqd-2SotYcxZ-68AQ,903
|
|
13
|
-
annet/gen.py,sha256=
|
|
13
|
+
annet/gen.py,sha256=3p8HxC17yxTno1Kb4f7csjBTazXnB6FCRmKq000YLmg,31931
|
|
14
14
|
annet/hardware.py,sha256=e7RWc5yPdEDT5hxNqcqWv9g9DRWIgwAieA2iT4FdPqc,1158
|
|
15
15
|
annet/implicit.py,sha256=G6EwZbrtUp089qRAwh96hminp236-1pJbeKAedoEafg,6056
|
|
16
16
|
annet/lib.py,sha256=4N4X6jCCrig5rk7Ua4AofrV9zK9jhzkBq57fLsfBJjw,4812
|
|
@@ -19,7 +19,6 @@ annet/parallel.py,sha256=onkE3q3Pe1CjOa3fI20vWUA5VO50sPlPxzfyiVdo8pI,17703
|
|
|
19
19
|
annet/patching.py,sha256=nILbY5oJajN0b1j3f0HEJm05H3HVThnWvB7vDVh7UQw,559
|
|
20
20
|
annet/reference.py,sha256=B8mH8VUMcecPnzULiTVb_kTQ7jQrCL7zp4pfIZQa5fk,4035
|
|
21
21
|
annet/storage.py,sha256=44f2aHNFOsQMSJwFvGxyu26oRcs3QmS24TKivcfPlxU,4064
|
|
22
|
-
annet/tabparser.py,sha256=oN0pFeO1GEgMD-ti9rHl5SvaYZPZbrYx_BIVedIC5JQ,1257
|
|
23
22
|
annet/text_term_format.py,sha256=y0U6VuFEAEil8Ab3HB8DBbVHisu31EHiRV7AOVruCeA,2816
|
|
24
23
|
annet/tracing.py,sha256=ndpM-au1c88uBBpOuH_z52qWZL773edYozNyys_wA68,4044
|
|
25
24
|
annet/types.py,sha256=f2HwqoKa6AucwFwDMszoouB6m1B8n6VmdjHMktO30Kc,7175
|
|
@@ -60,8 +59,8 @@ annet/annlib/filter_acl.py,sha256=mxDga-3SXqpPEsdQypTq0ScqUqP625lxX-DmJalEc3s,71
|
|
|
60
59
|
annet/annlib/jsontools.py,sha256=BS7s4rI8R9c_y3zz0zYl1l6con65oQ0MvfsC1dsXZts,5535
|
|
61
60
|
annet/annlib/lib.py,sha256=lxmYrbeablFMhFtvFmADVpVShSFi9TN4gNWaBs_Ygm0,14952
|
|
62
61
|
annet/annlib/output.py,sha256=_SjJ6G6bejvnTKqNHw6xeio0FT9oO3OIkLaOC3cEga4,7569
|
|
63
|
-
annet/annlib/patching.py,sha256=
|
|
64
|
-
annet/annlib/tabparser.py,sha256=
|
|
62
|
+
annet/annlib/patching.py,sha256=eSqhiOv98EOEODbRaYxOY8qaW4Ju58EzGB-uddeCId8,21493
|
|
63
|
+
annet/annlib/tabparser.py,sha256=cDo-tAt0gGAToQwK4j0fLh31M0WEBpQclVshPAmanYc,31496
|
|
65
64
|
annet/annlib/types.py,sha256=VHU0CBADfYmO0xzB_c5f-mcuU3dUumuJczQnqGlib9M,852
|
|
66
65
|
annet/annlib/netdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
67
66
|
annet/annlib/netdev/db.py,sha256=fI_u5aya4l61mbYSjj4JwlVfi3s7obt2jqERSuXGRUI,1634
|
|
@@ -74,14 +73,14 @@ annet/annlib/rbparser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
74
73
|
annet/annlib/rbparser/acl.py,sha256=I_1VUZQgF-s4dYTxyEDxQ-GkAP2MeXonzzsc2xROpTM,3974
|
|
75
74
|
annet/annlib/rbparser/deploying.py,sha256=ACT8QNhDAhJx3ZKuGh2nYBOrpdka2qEKuLDxvQAGKLk,1649
|
|
76
75
|
annet/annlib/rbparser/ordering.py,sha256=XknggB92N4IbhHBZZHL0StwCCITt8mkho4D4Nu5Kb4k,2185
|
|
77
|
-
annet/annlib/rbparser/platform.py,sha256=
|
|
76
|
+
annet/annlib/rbparser/platform.py,sha256=d1jFH8hGMOf_qiveKE4H-c0OfNnzwmt2VYpSiSOn9qc,42
|
|
78
77
|
annet/annlib/rbparser/syntax.py,sha256=iZ7Y-4QQBw4L3UtjEh54qisiRDhobl7HZxFNdP8mi54,3577
|
|
79
78
|
annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
|
-
annet/annlib/rulebook/common.py,sha256=-
|
|
81
|
-
annet/api/__init__.py,sha256=
|
|
79
|
+
annet/annlib/rulebook/common.py,sha256=-x4dYuKDi1T5lxk1PRWQ91FGRlV4UAJ0sQC9vnbhzWw,17016
|
|
80
|
+
annet/api/__init__.py,sha256=EMGUgt3pTi2MDF8DfXlS8PGX2zT0iGLY01R6QlQHvGg,33305
|
|
82
81
|
annet/configs/context.yml,sha256=RVLrKLIHpCty7AGwOnmqf7Uu0iZQCn-AjYhophDJer8,259
|
|
83
82
|
annet/configs/logging.yaml,sha256=EUagfir99QqA73Scc3k7sfQccbU3E1SvEQdyhLFtCl4,997
|
|
84
|
-
annet/generators/__init__.py,sha256=
|
|
83
|
+
annet/generators/__init__.py,sha256=wJbNLI1bMppE71tnjJrqNGtbtLZ_gdRd-HytdZPzBiY,16451
|
|
85
84
|
annet/generators/base.py,sha256=rgQLcQBPZm4ecbKmRhVOpBR-GFJAiVfdb_y5f2-LUR8,3670
|
|
86
85
|
annet/generators/entire.py,sha256=Oe7d0VuIn2sLcOKuRVQW9uR8Vuirg0edekFMSZCMnI4,2786
|
|
87
86
|
annet/generators/exceptions.py,sha256=GPXTBgn2xZ3Ev_bdOPlfCLGRC1kQHe_dEq88S-uyi5s,151
|
|
@@ -118,10 +117,10 @@ annet/rpl_generators/execute.py,sha256=wS6e6fwcPWywsHB0gBMqZ17eF0s4YOBgDgwPB_cr5
|
|
|
118
117
|
annet/rpl_generators/policy.py,sha256=j_2EtAsaxldhZZT4kRXKZacuAsGnHr3JSc2BMxr_Pow,37174
|
|
119
118
|
annet/rpl_generators/prefix_lists.py,sha256=5jM5Xj0dtx5xF9ap-TgExs0ofRAzm0LN2j3aL5Ub_yc,4778
|
|
120
119
|
annet/rpl_generators/rd.py,sha256=YGXgx1D2D0-pixgspXJzA6NvW8lx3AmHMxIY2l5rraI,1457
|
|
121
|
-
annet/rulebook/__init__.py,sha256=
|
|
120
|
+
annet/rulebook/__init__.py,sha256=Zm2RycKvIa-x-FwvaLSdJEV3t-V1QhsnjjkQ5dB7SzI,3979
|
|
122
121
|
annet/rulebook/common.py,sha256=zK1s2c5lc5HQbIlMUQ4HARQudXSgOYiZ_Sxc2I_tHqg,721
|
|
123
122
|
annet/rulebook/deploying.py,sha256=9CMeOUw5L1OWdrccSRfpJyH9H_jH7xWNU1JldviBNrk,3015
|
|
124
|
-
annet/rulebook/patching.py,sha256=
|
|
123
|
+
annet/rulebook/patching.py,sha256=7iZvtjR7T8_bK6mCsGlC5uPmntCDQ9OkkDHRWupnMNA,5045
|
|
125
124
|
annet/rulebook/arista/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
125
|
annet/rulebook/arista/aaa.py,sha256=7fBTwBnz9SOqYbwG8GBeEQTJG0e4uC4HkuZJeMG-kAY,2250
|
|
127
126
|
annet/rulebook/arista/iface.py,sha256=bgj6a3r__-OE6VyYbSfnD6ps2QJKyX028W7IFJww-UY,720
|
|
@@ -141,7 +140,7 @@ annet/rulebook/huawei/bgp.py,sha256=dN8T3-44ggGEapt4u4sT3bTn_dsoCbS5qdNeSQ8LSTs,
|
|
|
141
140
|
annet/rulebook/huawei/iface.py,sha256=DvLtQ7tfbDQWFmIYV4lxfih13Tdrt24L4-ZS29mCkuc,1126
|
|
142
141
|
annet/rulebook/huawei/misc.py,sha256=Rpwhtm42IgcueDq4K6VOzN2qORoIDYh42Jb7iWL8AII,14424
|
|
143
142
|
annet/rulebook/huawei/vlandb.py,sha256=B4BEUhZetjsNNhIJOp9cXtJSAYKMOgQucO8oAxSkRI0,4658
|
|
144
|
-
annet/rulebook/juniper/__init__.py,sha256=
|
|
143
|
+
annet/rulebook/juniper/__init__.py,sha256=DZu6Od4Uow0UHE1vNMnBJwCwynOFouHXNs253yStpZ4,5376
|
|
145
144
|
annet/rulebook/nexus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
146
145
|
annet/rulebook/nexus/iface.py,sha256=aeog9iSGT2zZ78tsGlrRcfgfOv7yW3jLwryXqdeplRw,2923
|
|
147
146
|
annet/rulebook/routeros/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -181,10 +180,10 @@ annet/rulebook/texts/ribbon.rul,sha256=609LyLTDCtXPVQNAzqS-VEyCpW3byHP8TCMJLFMn5
|
|
|
181
180
|
annet/rulebook/texts/routeros.order,sha256=M71uy_hf0KAjLNS3zZY3uih4m2xLUcu26FEoVVjC6k0,905
|
|
182
181
|
annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019O1DE,1203
|
|
183
182
|
annet/vendors/__init__.py,sha256=gQcDFlKeWDZB6vxJ_MdPWEoE-C5dg-YgXvgGkuV9YLw,569
|
|
184
|
-
annet/vendors/base.py,sha256=
|
|
185
|
-
annet/vendors/registry.py,sha256=
|
|
186
|
-
annet-3.
|
|
187
|
-
annet-3.
|
|
183
|
+
annet/vendors/base.py,sha256=KLf_lv-Vm3uPH_Kuovdr1V257EALmAS_gYhKEL196FA,919
|
|
184
|
+
annet/vendors/registry.py,sha256=zJUj5vJ105kD7xvxt84MYNTNYZI08AKCNTCmE0YtMzo,2539
|
|
185
|
+
annet-3.1.0.dist-info/licenses/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
|
|
186
|
+
annet-3.1.0.dist-info/licenses/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
|
|
188
187
|
annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
189
188
|
annet_generators/example/__init__.py,sha256=OJ77uj8axc-FIyIu_Xdcnzmde3oQW5mk5qbODkhuVc8,355
|
|
190
189
|
annet_generators/example/hostname.py,sha256=RloLzNVetEoWPLITzfJ13Nk3CC0yi-cZB1RTd6dnuhI,2541
|
|
@@ -197,8 +196,8 @@ annet_generators/rpl_example/generator.py,sha256=EWah19gOH8G-QyNyWqxCqdRi0BK7GbM
|
|
|
197
196
|
annet_generators/rpl_example/items.py,sha256=d99HSXDHFjZq511EvGhIqRTWK3F4ZsCWfdUqFYQcyhE,772
|
|
198
197
|
annet_generators/rpl_example/mesh.py,sha256=z_WgfDZZ4xnyh3cSf75igyH09hGvtexEVwy1gCD_DzA,288
|
|
199
198
|
annet_generators/rpl_example/route_policy.py,sha256=z6nPb0VDeQtKD1NIg9sFvmUxBD5tVs2frfNIuKdM-5c,2318
|
|
200
|
-
annet-3.
|
|
201
|
-
annet-3.
|
|
202
|
-
annet-3.
|
|
203
|
-
annet-3.
|
|
204
|
-
annet-3.
|
|
199
|
+
annet-3.1.0.dist-info/METADATA,sha256=f3Fl0PUMC6covEz71fAYKY8zPOV3ffBitlfF5XM1KVo,815
|
|
200
|
+
annet-3.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
201
|
+
annet-3.1.0.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
|
|
202
|
+
annet-3.1.0.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
|
|
203
|
+
annet-3.1.0.dist-info/RECORD,,
|
annet/tabparser.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
from annet.annlib.tabparser import ( # pylint: disable=unused-import
|
|
2
|
-
AsrFormatter,
|
|
3
|
-
CiscoFormatter,
|
|
4
|
-
CommonFormatter,
|
|
5
|
-
HuaweiFormatter,
|
|
6
|
-
OptixtransFormatter,
|
|
7
|
-
JuniperFormatter,
|
|
8
|
-
JuniperList,
|
|
9
|
-
NokiaFormatter,
|
|
10
|
-
ParserError,
|
|
11
|
-
RibbonFormatter,
|
|
12
|
-
RosFormatter,
|
|
13
|
-
parse_to_tree,
|
|
14
|
-
AristaFormatter,
|
|
15
|
-
NexusFormatter,
|
|
16
|
-
B4comFormatter,
|
|
17
|
-
ArubaFormatter,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def make_formatter(hw, **kwargs):
|
|
22
|
-
if hw.OptiXtrans:
|
|
23
|
-
cls = OptixtransFormatter
|
|
24
|
-
elif hw.Huawei:
|
|
25
|
-
cls = HuaweiFormatter
|
|
26
|
-
elif hw.Cisco.ASR or hw.Cisco.XRV or hw.Cisco.XR:
|
|
27
|
-
cls = AsrFormatter
|
|
28
|
-
elif hw.Nexus:
|
|
29
|
-
cls = NexusFormatter
|
|
30
|
-
elif hw.Cisco:
|
|
31
|
-
cls = CiscoFormatter
|
|
32
|
-
elif hw.B4com:
|
|
33
|
-
cls = B4comFormatter
|
|
34
|
-
elif hw.Aruba:
|
|
35
|
-
cls = ArubaFormatter
|
|
36
|
-
elif hw.Juniper:
|
|
37
|
-
cls = JuniperFormatter
|
|
38
|
-
elif hw.Nokia:
|
|
39
|
-
cls = NokiaFormatter
|
|
40
|
-
elif hw.RouterOS:
|
|
41
|
-
cls = RosFormatter
|
|
42
|
-
elif hw.PC:
|
|
43
|
-
cls = CommonFormatter
|
|
44
|
-
elif hw.Ribbon:
|
|
45
|
-
cls = RibbonFormatter
|
|
46
|
-
elif hw.H3C:
|
|
47
|
-
cls = HuaweiFormatter
|
|
48
|
-
elif hw.Arista:
|
|
49
|
-
cls = AristaFormatter
|
|
50
|
-
else:
|
|
51
|
-
raise NotImplementedError("Unknown formatter for hw '%s'" % hw)
|
|
52
|
-
|
|
53
|
-
return cls(**kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|