annet 0.1__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.

Files changed (113) hide show
  1. annet/__init__.py +61 -0
  2. annet/annet.py +25 -0
  3. annet/annlib/__init__.py +7 -0
  4. annet/annlib/command.py +49 -0
  5. annet/annlib/diff.py +158 -0
  6. annet/annlib/errors.py +8 -0
  7. annet/annlib/filter_acl.py +196 -0
  8. annet/annlib/jsontools.py +89 -0
  9. annet/annlib/lib.py +495 -0
  10. annet/annlib/netdev/__init__.py +0 -0
  11. annet/annlib/netdev/db.py +62 -0
  12. annet/annlib/netdev/devdb/__init__.py +28 -0
  13. annet/annlib/netdev/devdb/data/devdb.json +137 -0
  14. annet/annlib/netdev/views/__init__.py +0 -0
  15. annet/annlib/netdev/views/dump.py +121 -0
  16. annet/annlib/netdev/views/hardware.py +112 -0
  17. annet/annlib/output.py +246 -0
  18. annet/annlib/patching.py +533 -0
  19. annet/annlib/rbparser/__init__.py +0 -0
  20. annet/annlib/rbparser/acl.py +120 -0
  21. annet/annlib/rbparser/deploying.py +55 -0
  22. annet/annlib/rbparser/ordering.py +52 -0
  23. annet/annlib/rbparser/platform.py +51 -0
  24. annet/annlib/rbparser/syntax.py +115 -0
  25. annet/annlib/rulebook/__init__.py +0 -0
  26. annet/annlib/rulebook/common.py +350 -0
  27. annet/annlib/tabparser.py +648 -0
  28. annet/annlib/types.py +35 -0
  29. annet/api/__init__.py +807 -0
  30. annet/argparse.py +415 -0
  31. annet/cli.py +192 -0
  32. annet/cli_args.py +493 -0
  33. annet/configs/context.yml +18 -0
  34. annet/configs/logging.yaml +39 -0
  35. annet/connectors.py +64 -0
  36. annet/deploy.py +441 -0
  37. annet/diff.py +85 -0
  38. annet/executor.py +551 -0
  39. annet/filtering.py +40 -0
  40. annet/gen.py +828 -0
  41. annet/generators/__init__.py +987 -0
  42. annet/generators/common/__init__.py +0 -0
  43. annet/generators/common/initial.py +33 -0
  44. annet/hardware.py +45 -0
  45. annet/implicit.py +139 -0
  46. annet/lib.py +128 -0
  47. annet/output.py +170 -0
  48. annet/parallel.py +448 -0
  49. annet/patching.py +25 -0
  50. annet/reference.py +148 -0
  51. annet/rulebook/__init__.py +114 -0
  52. annet/rulebook/arista/__init__.py +0 -0
  53. annet/rulebook/arista/iface.py +16 -0
  54. annet/rulebook/aruba/__init__.py +16 -0
  55. annet/rulebook/aruba/ap_env.py +146 -0
  56. annet/rulebook/aruba/misc.py +8 -0
  57. annet/rulebook/cisco/__init__.py +0 -0
  58. annet/rulebook/cisco/iface.py +68 -0
  59. annet/rulebook/cisco/misc.py +57 -0
  60. annet/rulebook/cisco/vlandb.py +90 -0
  61. annet/rulebook/common.py +19 -0
  62. annet/rulebook/deploying.py +87 -0
  63. annet/rulebook/huawei/__init__.py +0 -0
  64. annet/rulebook/huawei/aaa.py +75 -0
  65. annet/rulebook/huawei/bgp.py +97 -0
  66. annet/rulebook/huawei/iface.py +33 -0
  67. annet/rulebook/huawei/misc.py +337 -0
  68. annet/rulebook/huawei/vlandb.py +115 -0
  69. annet/rulebook/juniper/__init__.py +107 -0
  70. annet/rulebook/nexus/__init__.py +0 -0
  71. annet/rulebook/nexus/iface.py +92 -0
  72. annet/rulebook/patching.py +143 -0
  73. annet/rulebook/ribbon/__init__.py +12 -0
  74. annet/rulebook/texts/arista.deploy +20 -0
  75. annet/rulebook/texts/arista.order +125 -0
  76. annet/rulebook/texts/arista.rul +59 -0
  77. annet/rulebook/texts/aruba.deploy +20 -0
  78. annet/rulebook/texts/aruba.order +83 -0
  79. annet/rulebook/texts/aruba.rul +87 -0
  80. annet/rulebook/texts/cisco.deploy +27 -0
  81. annet/rulebook/texts/cisco.order +82 -0
  82. annet/rulebook/texts/cisco.rul +105 -0
  83. annet/rulebook/texts/huawei.deploy +188 -0
  84. annet/rulebook/texts/huawei.order +388 -0
  85. annet/rulebook/texts/huawei.rul +471 -0
  86. annet/rulebook/texts/juniper.rul +120 -0
  87. annet/rulebook/texts/nexus.deploy +24 -0
  88. annet/rulebook/texts/nexus.order +85 -0
  89. annet/rulebook/texts/nexus.rul +83 -0
  90. annet/rulebook/texts/nokia.rul +31 -0
  91. annet/rulebook/texts/pc.order +5 -0
  92. annet/rulebook/texts/pc.rul +9 -0
  93. annet/rulebook/texts/ribbon.deploy +22 -0
  94. annet/rulebook/texts/ribbon.rul +77 -0
  95. annet/rulebook/texts/routeros.order +38 -0
  96. annet/rulebook/texts/routeros.rul +45 -0
  97. annet/storage.py +121 -0
  98. annet/tabparser.py +36 -0
  99. annet/text_term_format.py +95 -0
  100. annet/tracing.py +170 -0
  101. annet/types.py +223 -0
  102. annet-0.1.dist-info/AUTHORS +21 -0
  103. annet-0.1.dist-info/LICENSE +21 -0
  104. annet-0.1.dist-info/METADATA +24 -0
  105. annet-0.1.dist-info/RECORD +113 -0
  106. annet-0.1.dist-info/WHEEL +5 -0
  107. annet-0.1.dist-info/entry_points.txt +6 -0
  108. annet-0.1.dist-info/top_level.txt +3 -0
  109. annet_generators/__init__.py +0 -0
  110. annet_generators/example/__init__.py +12 -0
  111. annet_generators/example/lldp.py +52 -0
  112. annet_nbexport/__init__.py +220 -0
  113. annet_nbexport/main.py +46 -0
annet/tracing.py ADDED
@@ -0,0 +1,170 @@
1
+ import contextlib
2
+ import inspect
3
+ from abc import ABC, abstractmethod
4
+ from functools import wraps
5
+ from typing import Optional, Type, Union
6
+
7
+ from annet.connectors import CachedConnector
8
+
9
+
10
+ MinDurationT = Optional[Union[str, int]]
11
+
12
+
13
+ class _Nop:
14
+ def __getattr__(self, item):
15
+ return _Nop()
16
+
17
+ def __enter__(self):
18
+ return self
19
+
20
+ def __exit__(self, exc_type, exc_val, exc_tb):
21
+ pass
22
+
23
+ def __call__(self, *args, **kwargs):
24
+ return _Nop()
25
+
26
+ def __bool__(self):
27
+ return False
28
+
29
+
30
+ class Tracing(ABC):
31
+ enabled = False
32
+
33
+ @abstractmethod
34
+ def function(self, arg=None, /, **kwargs):
35
+ pass
36
+
37
+ @abstractmethod
38
+ def contextmanager(self, arg=None, /, **kwargs):
39
+ pass
40
+
41
+ @abstractmethod
42
+ def get_current_span(self, context_value=None):
43
+ pass
44
+
45
+ @abstractmethod
46
+ def set_device_attributes(self, span, device):
47
+ pass
48
+
49
+ @abstractmethod
50
+ def start_as_current_span(self, *args, **kwargs):
51
+ pass
52
+
53
+ @abstractmethod
54
+ def start_as_linked_span(self, *args, **kwargs):
55
+ pass
56
+
57
+ @abstractmethod
58
+ def attach_context(self, *args, **kwargs):
59
+ pass
60
+
61
+ @abstractmethod
62
+ def inject_context(self, *args, **kwargs):
63
+ pass
64
+
65
+ @abstractmethod
66
+ def extract_context(self, *args, **kwargs):
67
+ pass
68
+
69
+ @abstractmethod
70
+ def get_context(self, *args, **kwargs):
71
+ pass
72
+
73
+ @abstractmethod
74
+ def force_flush(self):
75
+ pass
76
+
77
+
78
+ class DummyTracing(Tracing):
79
+ def function(self, arg=None, /, **kwargs):
80
+ def decorator(func):
81
+ return func
82
+
83
+ return decorator if arg is None else decorator(arg)
84
+
85
+ def contextmanager(self, arg=None, /, **kwargs):
86
+ def decorator(cls_or_func):
87
+ return cls_or_func
88
+
89
+ return decorator if arg is None else decorator(arg)
90
+
91
+ def get_current_span(self, context_value=None):
92
+ return None
93
+
94
+ def set_device_attributes(self, span, device):
95
+ return None
96
+
97
+ def start_as_current_span(self, *args, **kwargs):
98
+ return _Nop()
99
+
100
+ def start_as_linked_span(self, *args, **kwargs):
101
+ return _Nop()
102
+
103
+ def attach_context(self, *args, **kwargs):
104
+ return
105
+
106
+ def inject_context(self, *args, **kwargs):
107
+ return
108
+
109
+ def extract_context(self, *args, **kwargs):
110
+ return
111
+
112
+ def get_context(self, *args, **kwargs):
113
+ return
114
+
115
+ def force_flush(self):
116
+ return
117
+
118
+
119
+ class _TracingConnector(CachedConnector[Tracing]):
120
+ name = "Tracing"
121
+ ep_name = "tracing"
122
+
123
+ def _get_default(self) -> Type[Tracing]:
124
+ return DummyTracing
125
+
126
+
127
+ tracing_connector = _TracingConnector()
128
+
129
+
130
+ def function(arg=None, /, **outer_kwargs):
131
+ def decorator(func):
132
+ cache = None
133
+
134
+ @wraps(func)
135
+ def wrapper(*args, **kwargs):
136
+ nonlocal cache
137
+ if cache is None:
138
+ cache = tracing_connector.get().function(func, **outer_kwargs)
139
+ return cache(*args, **kwargs)
140
+
141
+ return wrapper
142
+
143
+ return decorator if arg is None else decorator(arg)
144
+
145
+
146
+ def contextmanager(arg=None, /, **outer_kwargs):
147
+ def decorator(cls_or_func):
148
+ if inspect.isfunction(cls_or_func):
149
+ cache = None
150
+
151
+ @contextlib.contextmanager
152
+ @wraps(cls_or_func)
153
+ def wrapper(*args, **kwargs):
154
+ nonlocal cache
155
+ if cache is None:
156
+ cache = tracing_connector.get().contextmanager(cls_or_func, **outer_kwargs)
157
+ with cache(*args, **kwargs) as val:
158
+ yield val
159
+
160
+ return wrapper
161
+ else:
162
+ @wraps(cls_or_func.__enter__)
163
+ def enter(*args, **kwargs):
164
+ tracing_connector.get().contextmanager(cls_or_func, **outer_kwargs) # redefine __enter__ and __exit__
165
+ return cls_or_func.__enter__(*args, **kwargs) # pylint: disable=unnecessary-dunder-call
166
+
167
+ setattr(cls_or_func, "__enter__", enter)
168
+ return cls_or_func
169
+
170
+ return decorator if arg is None else decorator(arg)
annet/types.py ADDED
@@ -0,0 +1,223 @@
1
+ from collections import OrderedDict
2
+ from typing import Any, Dict, List, MutableMapping, NamedTuple, Optional, Tuple, Union
3
+
4
+ from annet.annlib.types import Op # pylint: disable=unused-import
5
+
6
+ from annet.storage import Device, Storage
7
+
8
+
9
+ class PCDiffFile(NamedTuple):
10
+ label: str
11
+ diff_lines: List[str]
12
+
13
+
14
+ class PCDiff(NamedTuple):
15
+ hostname: str
16
+ diff_files: List[PCDiffFile]
17
+
18
+
19
+ Diff = List[Tuple]
20
+ ExitCode = int
21
+
22
+
23
+ class GeneratorPerf:
24
+ """
25
+ Рантайм статистика времени выполнения генератора
26
+ """
27
+
28
+ def __init__(self, total: float, rt: float, meta: Optional[Dict[str, Any]] = None):
29
+ self.total = total
30
+ self.rt = rt
31
+ self._meta = meta
32
+
33
+ @property
34
+ def meta(self) -> Dict[str, Any]:
35
+ return self._meta or {}
36
+
37
+
38
+ class GeneratorPartialRunArgs:
39
+ """
40
+ Параметры и модификаторы для запуска run_partial_generators
41
+ """
42
+
43
+ def __init__(
44
+ self,
45
+ device: Device,
46
+ storage: Storage,
47
+ use_acl: bool = False,
48
+ use_acl_safe: bool = False,
49
+ annotate: bool = False,
50
+ generators_context: Optional[str] = None,
51
+ no_new: bool = False,
52
+ ):
53
+ self.device = device
54
+ self.storage = storage
55
+ self.use_acl = use_acl # фильтруем по acl ввыод генератора (--no-acl для дебага)
56
+ self.use_acl_safe = use_acl_safe # [NOCDEV-6190] используем более строгий генераторный acl
57
+ self.annotate = annotate # добавляем в каждую строку вывода информацию откуда она была заyield'ена
58
+ self.generators_context = generators_context # строка с именем контекста генераторов
59
+ self.no_new = no_new # для опции --clear, не пытаемся запустить генераторы, выдаем только acl
60
+
61
+
62
+ class GeneratorPartialResult:
63
+ """
64
+ Результат запуска Partial-генератора
65
+ """
66
+
67
+ def __init__(
68
+ self,
69
+ name: str,
70
+ tags: List[str],
71
+ acl: str,
72
+ acl_rules: Dict[str, Any], # OrderedDict
73
+ acl_safe: str,
74
+ acl_safe_rules: Dict[str, Any], # OrderedDict
75
+ output: str,
76
+ config: Dict[str, Any], # OrderedDict
77
+ safe_config: Dict[str, Any], # OrderedDict
78
+ perf: GeneratorPerf,
79
+ ):
80
+ self.name = name
81
+ self.tags = tags
82
+ self.acl = acl
83
+ self.acl_rules = acl_rules
84
+ self.acl_safe = acl_safe
85
+ self.acl_safe_rules = acl_safe_rules
86
+ self.output = output
87
+ self.config = config
88
+ self.safe_config = safe_config
89
+ self.perf = perf
90
+
91
+
92
+ class GeneratorEntireResult:
93
+ """
94
+ Результат запуска Entire-генератора
95
+ """
96
+
97
+ def __init__(
98
+ self,
99
+ name: str,
100
+ tags: List[str],
101
+ path: Optional[str],
102
+ output: str,
103
+ reload: str,
104
+ prio: int,
105
+ perf: GeneratorPerf,
106
+ is_safe: bool,
107
+ ):
108
+ self.name = name
109
+ self.tags = tags
110
+ self.path = path
111
+ self.output = output
112
+ self.reload = reload
113
+ self.prio = prio
114
+ self.perf = perf
115
+ self.is_safe = is_safe
116
+
117
+
118
+ class GeneratorJSONFragmentResult:
119
+ """
120
+ Результат запуска JSONFragment-генератора
121
+ """
122
+
123
+ def __init__(
124
+ self,
125
+ name: str,
126
+ tags: List[str],
127
+ path: str,
128
+ acl: List[str],
129
+ config: Dict[str, Any],
130
+ reload: str,
131
+ perf: GeneratorPerf,
132
+ is_safe: bool,
133
+ ):
134
+ self.name = name
135
+ self.tags = tags
136
+ self.path = path
137
+ self.acl = acl
138
+ self.config = config
139
+ self.reload = reload
140
+ self.perf = perf
141
+ self.is_safe = is_safe
142
+
143
+
144
+ GeneratorResult = Union[GeneratorEntireResult, GeneratorPartialResult, GeneratorJSONFragmentResult]
145
+
146
+
147
+ class OldNewResult:
148
+ """Результат запуска old_new
149
+ """
150
+
151
+ # pylint: disable=too-many-arguments
152
+ def __init__(
153
+ self,
154
+ device=None,
155
+ old=None,
156
+ new=None,
157
+ acl_rules=None,
158
+ new_files=None,
159
+ old_files=None,
160
+ err=None,
161
+ partial_result=None,
162
+ entire_result=None,
163
+ old_json_fragment_files=None,
164
+ new_json_fragment_files=None,
165
+ json_fragment_result=None,
166
+ implicit_rules=None,
167
+ perf=None,
168
+ acl_safe_rules=None,
169
+ safe_old=None,
170
+ safe_new=None,
171
+ safe_new_files=None,
172
+ filter_acl_rules=None
173
+ ):
174
+ self.device: Device = device
175
+ self.old: MutableMapping = old if old else OrderedDict()
176
+ self.new: MutableMapping = new if new else OrderedDict()
177
+ self.acl_rules: MutableMapping = acl_rules
178
+ self.new_files: MutableMapping = new_files if new_files else {}
179
+ self.old_files: MutableMapping = old_files if old_files else {}
180
+ self.err: Optional[Exception] = err
181
+ self.partial_results: Dict[str, GeneratorPartialResult] = partial_result or {}
182
+ self.entire_results: Dict[str, GeneratorEntireResult] = entire_result or {}
183
+ self.old_json_fragment_files: Dict[str, Any] = old_json_fragment_files or {}
184
+ self.new_json_fragment_files: Dict[str, Tuple[Any, Optional[str]]] = new_json_fragment_files or {}
185
+ self.json_fragment_results: Dict[str, GeneratorJSONFragmentResult] = json_fragment_result or {}
186
+ self.implicit_rules: Dict[str, Any] = implicit_rules or OrderedDict()
187
+ self.perf: Dict[str, Dict[str, float]] = perf or {}
188
+
189
+ # safe acl and configs with it applied
190
+ self.acl_safe_rules: MutableMapping = acl_safe_rules or {}
191
+ self.safe_old: MutableMapping = safe_old if safe_old else OrderedDict()
192
+ self.safe_new: MutableMapping = safe_new if safe_new else OrderedDict()
193
+ self.safe_new_files: MutableMapping = safe_new_files if safe_new_files else {}
194
+
195
+ self.filter_acl_rules: Optional[MutableMapping] = filter_acl_rules
196
+
197
+ def get_old(self, safe: bool = False) -> MutableMapping:
198
+ if safe:
199
+ return self.safe_old
200
+
201
+ return self.old
202
+
203
+ def get_new(self, safe: bool = False) -> MutableMapping:
204
+ if safe:
205
+ return self.safe_new
206
+
207
+ return self.new
208
+
209
+ def get_acl_rules(self, safe: bool = False) -> MutableMapping:
210
+ if safe:
211
+ return self.acl_safe_rules
212
+
213
+ return self.acl_rules
214
+
215
+ def get_new_files(self, safe: bool = False) -> MutableMapping:
216
+ if safe:
217
+ return self.safe_new_files
218
+
219
+ return self.new_files
220
+
221
+ def get_new_file_fragments(self, safe: bool = False) -> Dict[str, Tuple[Any, Optional[str]]]: # pylint: disable=unused-argument
222
+ # TODO: safe
223
+ return self.new_json_fragment_files
@@ -0,0 +1,21 @@
1
+ The following authors have created the source code of "annet" published and distributed by YANDEX LLC as the owner:
2
+
3
+ Aleksandr Balezin <gescheit@yandex-team.ru>
4
+ Aleksandr Klimenko <v0lk@yandex-team.ru>
5
+ Aleksei Lymar <alymar@nebius.com>
6
+ Alexey Andriyanov <alan@yandex-team.ru>
7
+ Alexey Esin <adess@yandex-team.ru>
8
+ Anton Egorov <eg0rov@yandex-team.ru>
9
+ Artem Denisov <artemdenisov@yandex-team.ru>
10
+ Azat Kurbanov <azatkurbanov@yandex-team.ru>
11
+ Devaev Maxim <mdevaev@yandex-team.ru>
12
+ Fedor Zhukov <azryve@nebius.com>
13
+ Grigorii Ozhegov <ozhegov@yandex-team.ru>
14
+ Grigorii Solovev <gslv@yandex-team.ru>
15
+ Konstantin Sazonov <moonug@yandex-team.ru>
16
+ Roman Glebov <kitaro@yandex-team.ru>
17
+ Roman Karaulanov <anteron92@yandex-team.ru>
18
+ Sergey Mishchenko <smishche@yandex-team.ru>
19
+ Vlad Starostin <vladstar@yandex-team.ru>
20
+ Vladimir Sukhonosov <xornet@yandex-team.ru>
21
+ Vladislav Daniliuk <jayt@nebius.com>
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) [2023] YANDEX LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: annet
3
+ Version: 0.1
4
+ Summary: annet
5
+ Home-page: https://github.com/annetutil/annet
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ License-File: LICENSE
9
+ License-File: AUTHORS
10
+ Requires-Dist: colorama >=0.4.6
11
+ Requires-Dist: tabulate >=0.9.0
12
+ Requires-Dist: jsonpatch >=1.33
13
+ Requires-Dist: jsonpointer >=2.4
14
+ Requires-Dist: PyYAML >=6.0.1
15
+ Requires-Dist: Pygments >=2.14.0
16
+ Requires-Dist: Mako >=1.2.4
17
+ Requires-Dist: Jinja2 >=3.1.2
18
+ Requires-Dist: psutil >=5.8.0
19
+ Requires-Dist: packaging >=23.2
20
+ Requires-Dist: contextlog >=1.1
21
+ Requires-Dist: valkit >=0.1.4
22
+ Requires-Dist: aiohttp >=3.8.4
23
+ Requires-Dist: yarl >=1.8.2
24
+
@@ -0,0 +1,113 @@
1
+ annet/__init__.py,sha256=oyElxAW97sHgQccGafhaWVBveBn1gSjjdP_xHROaRLg,2139
2
+ annet/annet.py,sha256=TMdEuM7GJQ4TjRVmuK3bCTZN-21lxjQ9sXqEdILUuBk,725
3
+ annet/argparse.py,sha256=MoBD0LPnHdA6HU7z1uQNArYlkD92znoeGIFTMnS4dRM,12608
4
+ annet/cli.py,sha256=HoVD9DDZZurxG7YHrU8d2kDJS2tBOCMsmMgJFgarNKI,8284
5
+ annet/cli_args.py,sha256=FuyHLANmTXZl4W9Q4pfT3mMtRiVswM88L5WFhSzu6eA,15871
6
+ annet/connectors.py,sha256=M2NeyFgBEGJ_tMR9HgQ4cpli0nBciqZJDVMQXEueMws,1908
7
+ annet/deploy.py,sha256=KYbq_EbO6-dwJT6r3Ou6JhJmZIiwFWHrlJt6AlCtc0I,15319
8
+ annet/diff.py,sha256=0QG_3Ur5k7ajRuWUrM089yt_Fxss06OTBSUE3h54Nxw,3460
9
+ annet/executor.py,sha256=bw7COJNtssuxIqbQehlHYJnkdUeYvvL8WO5B-c67XE0,19040
10
+ annet/filtering.py,sha256=F4ZKUCU3Yb1RlL2zKdyHtVUaWPzjWF4vWyMcdygKNYk,852
11
+ annet/gen.py,sha256=bqrz1Ef8Z61ezqPCotRyZgZPCPTnM7v2mesNFScws04,31370
12
+ annet/hardware.py,sha256=HYPDfji_GdRn5S0_0fl4rvM7byOY9aHxG6VMAtsLaxE,1090
13
+ annet/implicit.py,sha256=QigK4uoxvrFho2h9yFjOq1d9rLsC5xFlAU4bKkCuMWk,5139
14
+ annet/lib.py,sha256=zQIfNBg7fAAk2BHbHAqy_McAiXhz0RqpBAcfdU-6pAA,3742
15
+ annet/output.py,sha256=fEKQ_EncOeZzzlO43tctZVbi37QS1j2m4MYxbvpLxAo,6984
16
+ annet/parallel.py,sha256=hLkzEht0KhzmzUWDdO4QFYQHzhxs3wPlTA8DxbB2ziw,17160
17
+ annet/patching.py,sha256=nILbY5oJajN0b1j3f0HEJm05H3HVThnWvB7vDVh7UQw,559
18
+ annet/reference.py,sha256=B8mH8VUMcecPnzULiTVb_kTQ7jQrCL7zp4pfIZQa5fk,4035
19
+ annet/storage.py,sha256=V1AQDGxaAEKC5EXOcPy2DqglR_sUdp3l_AS_2c1CFfA,2299
20
+ annet/tabparser.py,sha256=ZjiI43ZVbrpMVR8qNbTbNh_U3oZ26VDc_2Y9wkkDkYA,874
21
+ annet/text_term_format.py,sha256=CHb6viv45vmYl-SK1A1vyPHGhaEni6jVybBusaQnct8,2813
22
+ annet/tracing.py,sha256=ndpM-au1c88uBBpOuH_z52qWZL773edYozNyys_wA68,4044
23
+ annet/types.py,sha256=bTJ8KbIpDZzgyN_QXi-Wnr5RW4uGpDRDelgnh-uLtfg,6897
24
+ annet/annlib/__init__.py,sha256=fT1l4xV5fqqg8HPw9HqmZVN2qwS8i6X1aIm2zGDjxKY,252
25
+ annet/annlib/command.py,sha256=uuBddMQphtn8P5MO5kzIa8_QrtMns-k05VeKv1bcAuA,1043
26
+ annet/annlib/diff.py,sha256=UPt3kYFQdQdVVy3ePYzNHPAxMVmHxCrCnZnMCV6ou2Q,4587
27
+ annet/annlib/errors.py,sha256=jBcSFzY6Vj-FxR__vqjFm-87AwYQ0xHuAopTirii5AU,287
28
+ annet/annlib/filter_acl.py,sha256=0NAifQyFpNuLCxlQy1lMLv6sy_SxpuFW-9SjvdJx6Lg,7201
29
+ annet/annlib/jsontools.py,sha256=X4gtKcnDArnzKcZDJmRKcZGuUgi3nEFSVKdGPi2uGDw,2644
30
+ annet/annlib/lib.py,sha256=eJ4hcVuQ6pdYBzLs4YKCHFtq45idOfZCYp92XfF7_QI,15317
31
+ annet/annlib/output.py,sha256=_SjJ6G6bejvnTKqNHw6xeio0FT9oO3OIkLaOC3cEga4,7569
32
+ annet/annlib/patching.py,sha256=Gh8uUjFyYND9TJBBQH-DH6-AwFiiR-dXVXOisMS7elg,19784
33
+ annet/annlib/tabparser.py,sha256=bhYbuGJIg6VP5CLiq09UZjgrenP9DegKvw_kYy-Hus0,22910
34
+ annet/annlib/types.py,sha256=VHU0CBADfYmO0xzB_c5f-mcuU3dUumuJczQnqGlib9M,852
35
+ annet/annlib/netdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ annet/annlib/netdev/db.py,sha256=fI_u5aya4l61mbYSjj4JwlVfi3s7obt2jqERSuXGRUI,1634
37
+ annet/annlib/netdev/devdb/__init__.py,sha256=x0LlxU6kkF6WoIg-Uctthdeg2uMGEJyWoeP6mwe1zFI,863
38
+ annet/annlib/netdev/devdb/data/devdb.json,sha256=DJ0IsXqEvnuf27nL3qaQ6VseX_deSfROkOPijQjF86U,4733
39
+ annet/annlib/netdev/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
+ annet/annlib/netdev/views/dump.py,sha256=XJ6UO6sYSO5pIoe5R4eTQmKwx0_JJ71_h8QSYAURtyk,4184
41
+ annet/annlib/netdev/views/hardware.py,sha256=_ZgaZgT6l4UEf94QaLtKIV31rRNJH4MPXh0-3xbesOc,3192
42
+ annet/annlib/rbparser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ annet/annlib/rbparser/acl.py,sha256=RR8yPt6t96_IiyuKVbeZ-3x32cyhBAT2wC1y99oWBO8,3931
44
+ annet/annlib/rbparser/deploying.py,sha256=ACT8QNhDAhJx3ZKuGh2nYBOrpdka2qEKuLDxvQAGKLk,1649
45
+ annet/annlib/rbparser/ordering.py,sha256=DiKqyY8Khz-5MTxNF1GSNtZgtyKwT3YYCXpahIPB6Ps,1779
46
+ annet/annlib/rbparser/platform.py,sha256=iyqy4A-6vUKM4j6hrOA6tsgWBXk7LcvkFrS2QHgkqho,1231
47
+ annet/annlib/rbparser/syntax.py,sha256=eEUmszwPjdw57aofUYNQVcaxHPNV9yx9JNapjYY-BGM,3572
48
+ annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
+ annet/annlib/rulebook/common.py,sha256=9kCZwZpsH5UliF2OzaN9nLs2eLlz_d__4L7_oZ3SrCw,16054
50
+ annet/api/__init__.py,sha256=mvrGvcZDPvPvhreJa_fTFCwf7zo9R7NX4nWduBm5lB4,33212
51
+ annet/configs/context.yml,sha256=nt4QnzYzrG2hqmaWOUsab2wgFl-CXmFSzbto6rqqFt4,291
52
+ annet/configs/logging.yaml,sha256=Hu42lRK248dssp9TgkbHCaZNl0E6f4IChGb0XaQnTVo,970
53
+ annet/generators/__init__.py,sha256=iQ4E-AWtmDDtp4bVKHuiaHhmOqj9aPKuN6ISvKgRNJg,33542
54
+ annet/generators/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ annet/generators/common/initial.py,sha256=XI7uWLMuLrHC-uXm38oRbM1YVuELAvMHLZFHM9x5IF8,1229
56
+ annet/rulebook/__init__.py,sha256=14IpOfTbeJtre7JKrfXVYiH0qAXsUSOL7AatUFmSQs0,3847
57
+ annet/rulebook/common.py,sha256=zK1s2c5lc5HQbIlMUQ4HARQudXSgOYiZ_Sxc2I_tHqg,721
58
+ annet/rulebook/deploying.py,sha256=XV0XQvc3YvwM8SOgOQlc-fCW4bnjQg_1CTZkTwMp14A,2972
59
+ annet/rulebook/patching.py,sha256=ve_D-9lnWs6Qb_NwqOLUWX-b_tI_L3pwQ7cgUPnqndY,4970
60
+ annet/rulebook/arista/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
+ annet/rulebook/arista/iface.py,sha256=bgj6a3r__-OE6VyYbSfnD6ps2QJKyX028W7IFJww-UY,720
62
+ annet/rulebook/aruba/__init__.py,sha256=ILggeID6kNWcDBGzhXm_mebcfkuLSq5prBFU5DyPFs4,500
63
+ annet/rulebook/aruba/ap_env.py,sha256=dHEoZpSVV-DY5Ti1ZlzYwanXfayBggJGnXoRnpB56T4,4761
64
+ annet/rulebook/aruba/misc.py,sha256=O0p_wsR07gtB8rm1eJvJ7VYnGm5T8Uau_SVKR9FVInI,234
65
+ annet/rulebook/cisco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
+ annet/rulebook/cisco/iface.py,sha256=WISkzjp_G7WKPpg098FCIm4b7ipOxtRLOQbu-7gMUL0,1792
67
+ annet/rulebook/cisco/misc.py,sha256=l9NTR6cAsrfFyeC_yoOeQ0fOFoPiJfFwnRva5W9vyL0,2259
68
+ annet/rulebook/cisco/vlandb.py,sha256=pdQ0Ca976_5_cNBbTI6ADN1SP8aAngVBs1AZWltmpsw,3319
69
+ annet/rulebook/huawei/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ annet/rulebook/huawei/aaa.py,sha256=Xi8nWyBFaUz4SgoN1NQeOcXzBGCfINQDNiC-crq08uA,3445
71
+ annet/rulebook/huawei/bgp.py,sha256=dN8T3-44ggGEapt4u4sT3bTn_dsoCbS5qdNeSQ8LSTs,4015
72
+ annet/rulebook/huawei/iface.py,sha256=DvLtQ7tfbDQWFmIYV4lxfih13Tdrt24L4-ZS29mCkuc,1126
73
+ annet/rulebook/huawei/misc.py,sha256=Rpwhtm42IgcueDq4K6VOzN2qORoIDYh42Jb7iWL8AII,14424
74
+ annet/rulebook/huawei/vlandb.py,sha256=B4BEUhZetjsNNhIJOp9cXtJSAYKMOgQucO8oAxSkRI0,4658
75
+ annet/rulebook/juniper/__init__.py,sha256=WByFrqKCdr-ORCme2AURQGnYbN66t3omB3-9dWktT9o,3887
76
+ annet/rulebook/nexus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
+ annet/rulebook/nexus/iface.py,sha256=aeog9iSGT2zZ78tsGlrRcfgfOv7yW3jLwryXqdeplRw,2923
78
+ annet/rulebook/ribbon/__init__.py,sha256=TRbkQVvk0-HxkUQW9-LmiG6XIfTZ-8t3SiaDemNCzK4,347
79
+ annet/rulebook/texts/arista.deploy,sha256=OS9eFyJpEPztcOHkBwajw_RTJfTT7ivaMHfx4_HXaUg,792
80
+ annet/rulebook/texts/arista.order,sha256=TKy3S56tIypwfVaw0akK1sXGatCpLVwpB4Jvq-dIu90,1457
81
+ annet/rulebook/texts/arista.rul,sha256=HUYiN55s8Y6Wrd5q1Awe7-o5BYBh7gIxthUC5NvrfJI,786
82
+ annet/rulebook/texts/aruba.deploy,sha256=hI432Bq-of_LMXuUflCu7eNSEFpx6qmj0KItEw6sgHI,841
83
+ annet/rulebook/texts/aruba.order,sha256=ZMakkn0EJ9zomgY6VssoptJImrHrUmYnCqivzLBFTRo,1158
84
+ annet/rulebook/texts/aruba.rul,sha256=zvGVpoYyJvMoL0fb1NQ8we_GCLZXno8nwWpZIOScLQQ,2584
85
+ annet/rulebook/texts/cisco.deploy,sha256=XvXWeOMahE8Uc9RF0xkJj8jGknD4vit8H_f24ubPX7w,1226
86
+ annet/rulebook/texts/cisco.order,sha256=eE9ddPQr8ZumjffQsMvl-BBymOwV6juETZU3r7kpRvk,1709
87
+ annet/rulebook/texts/cisco.rul,sha256=HGg62zXCn8UVXu9x_Ja5QivPcY5Yo5BYi1CaOXCaDHA,2869
88
+ annet/rulebook/texts/huawei.deploy,sha256=azEC6_jQRzwnTSrNgag0hHh6L7hezS_eMk6ZDZfWyXI,10444
89
+ annet/rulebook/texts/huawei.order,sha256=ENllPX4kO6xNw2mUQcx11yhxo3tKStZ5mUyc0C6s3d0,10657
90
+ annet/rulebook/texts/huawei.rul,sha256=oElI5rRXx3ncbYBVlZIX2W9tVYcRJ7NHOWdfhPwTnP8,12956
91
+ annet/rulebook/texts/juniper.rul,sha256=EmtrEJZesnmc2nXjURRD2G0WOq4zLluI_PNupKhSOJs,2654
92
+ annet/rulebook/texts/nexus.deploy,sha256=9YNAQEw7aQxtYZJbE-dMD6qJrTzs_G92Ifrx3Ft4Wn4,1120
93
+ annet/rulebook/texts/nexus.order,sha256=AZMKCD5Zf_mBOlE36aMDvO4w5rdbepTz1Dsyv7xP9Qs,1834
94
+ annet/rulebook/texts/nexus.rul,sha256=veixbi_ztbX6OMV_WjdkgpEXa47yDxOkPE0YQ6r4wqs,2558
95
+ annet/rulebook/texts/nokia.rul,sha256=gxK7FCRdjGUs7tDHTUebVOgkzWINAGibMPtz8tzvwg4,1077
96
+ annet/rulebook/texts/pc.order,sha256=WTSosHmIA5LyHO_DNAH1VDeuXHEgZ9e_aDFyAtIW6rE,275
97
+ annet/rulebook/texts/pc.rul,sha256=zwIkSdOsJ6gmIj1sfy0xa4_yQRRBRjSQEqopsqFE2u8,302
98
+ annet/rulebook/texts/ribbon.deploy,sha256=hCq2XeAcwaYanyQ8lTdnez6Pgq-gRqpNuR8dAleIn3U,864
99
+ annet/rulebook/texts/ribbon.rul,sha256=609LyLTDCtXPVQNAzqS-VEyCpW3byHP8TCMJLFMn5cc,2108
100
+ annet/rulebook/texts/routeros.order,sha256=M71uy_hf0KAjLNS3zZY3uih4m2xLUcu26FEoVVjC6k0,905
101
+ annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019O1DE,1203
102
+ annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
+ annet_generators/example/__init__.py,sha256=zVd8_DrXuOASrNzg2Ab94rPyvJff83L-_HppDFxnUjM,228
104
+ annet_generators/example/lldp.py,sha256=4zcI8QnB8KDd8NTJeVVUUpzf317VA1bznOEN-02VpeY,1145
105
+ annet_nbexport/__init__.py,sha256=-repcOrdwQQWzzJ2yCngdiNHSw5qJWis7vogRBX9cRI,6380
106
+ annet_nbexport/main.py,sha256=f65WKdS2xvbttllCe5IYkoenPEy8C4SzvNydhh4ZEVM,1216
107
+ annet-0.1.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
108
+ annet-0.1.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
109
+ annet-0.1.dist-info/METADATA,sha256=6tY-squhKoIxgVQmr9gaI6kOO0WNBG5xDCEzJDSZh9Y,622
110
+ annet-0.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
111
+ annet-0.1.dist-info/entry_points.txt,sha256=g_pJ55300jUXfafHl7izmDJ6RVSo6iW9IaNfysM3Y0w,151
112
+ annet-0.1.dist-info/top_level.txt,sha256=uL47QByRwuZV5yWC58gd4IkHM8sVSAJ1pZb-6W-gMfY,38
113
+ annet-0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.3)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,6 @@
1
+ [annet.connectors]
2
+ storage = annet_nbexport:AnnetNbExportProvder
3
+
4
+ [console_scripts]
5
+ annet = annet.annet:main
6
+ annet_nbexport = annet_nbexport.main:main
@@ -0,0 +1,3 @@
1
+ annet
2
+ annet_generators
3
+ annet_nbexport
File without changes
@@ -0,0 +1,12 @@
1
+ from typing import List
2
+
3
+ from annet.generators import BaseGenerator
4
+ from annet.storage import Storage
5
+
6
+ from . import lldp
7
+
8
+
9
+ def get_generators(store: Storage) -> List[BaseGenerator]:
10
+ return [
11
+ lldp.Lldp(store),
12
+ ]
@@ -0,0 +1,52 @@
1
+
2
+ from typing import List
3
+
4
+ from annet.generators import BaseGenerator, PartialGenerator
5
+ from annet.storage import Storage
6
+
7
+
8
+ # ====
9
+ class Lldp(PartialGenerator):
10
+ TAGS = ["mgmt", "lldp"]
11
+
12
+ def acl_huawei(self, device):
13
+ return """
14
+ lldp
15
+ """
16
+
17
+ def run_huawei(self, device):
18
+ yield "lldp enable"
19
+
20
+ if device.hw.CE:
21
+ yield "lldp transmit interval 10"
22
+
23
+ def acl_nexus(self, device):
24
+ return """
25
+ feature lldp
26
+ lldp
27
+ """
28
+
29
+ def run_nexus(self, device):
30
+ yield "feature lldp"
31
+ yield "lldp timer 10"
32
+
33
+ def acl_juniper(self, _):
34
+ return """
35
+ protocols %cant_delete
36
+ lldp
37
+ *
38
+ """
39
+
40
+ def run_juniper(self, device):
41
+ with self.multiblock("protocols", "lldp"):
42
+ yield """
43
+ neighbour-port-info-display port-id
44
+ port-description-type interface-alias
45
+ port-id-subtype interface-name
46
+ interface all
47
+ """
48
+
49
+ def get_generators(store: Storage) -> List[BaseGenerator]:
50
+ return [
51
+ Lldp(store),
52
+ ]