annet 0.16.17__py3-none-any.whl → 0.16.19__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 +4 -1
- annet/annlib/netdev/devdb/data/devdb.json +1 -0
- annet/annlib/rbparser/platform.py +6 -0
- annet/annlib/rulebook/common.py +4 -0
- annet/annlib/tabparser.py +57 -2
- annet/configs/context.yml +1 -0
- annet/rpl/__init__.py +27 -0
- annet/rpl/action.py +51 -0
- annet/rpl/condition.py +94 -0
- annet/rpl/match_builder.py +103 -0
- annet/rpl/policy.py +22 -0
- annet/rpl/result.py +8 -0
- annet/rpl/routemap.py +76 -0
- annet/rpl/statement_builder.py +267 -0
- annet/rulebook/__init__.py +3 -2
- annet/rulebook/cisco/misc.py +0 -90
- annet/rulebook/texts/arista.rul +1 -0
- annet/rulebook/texts/cisco.rul +1 -1
- annet/tabparser.py +2 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/METADATA +1 -1
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/RECORD +30 -18
- annet_generators/rpl_example/__init__.py +9 -0
- annet_generators/rpl_example/items.py +31 -0
- annet_generators/rpl_example/policy_generator.py +233 -0
- annet_generators/rpl_example/route_policy.py +33 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/AUTHORS +0 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/LICENSE +0 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/WHEEL +0 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/entry_points.txt +0 -0
- {annet-0.16.17.dist-info → annet-0.16.19.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from dataclasses import field
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Optional, Literal, TypeVar, Union, Any
|
|
6
|
+
|
|
7
|
+
from .action import SingleAction, ActionType
|
|
8
|
+
from .policy import RoutingPolicyStatement
|
|
9
|
+
from .result import ResultType
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ThenField(str, Enum):
|
|
13
|
+
community = "community"
|
|
14
|
+
extcommunity = "extcommunity"
|
|
15
|
+
as_path = "as_path"
|
|
16
|
+
local_pref = "local_pref"
|
|
17
|
+
metric = "metric"
|
|
18
|
+
rpki_valid_state = "rpki_valid_state"
|
|
19
|
+
resolution = "resolution"
|
|
20
|
+
mpls_label = "mpls_label"
|
|
21
|
+
metric_type = "metric_type"
|
|
22
|
+
origin = "origin"
|
|
23
|
+
tag = "tag"
|
|
24
|
+
|
|
25
|
+
next_hop = "next_hop"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
ValueT = TypeVar("ValueT")
|
|
29
|
+
_Setter = Callable[[ValueT], SingleAction[ValueT]]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class CommunityActionValue:
|
|
34
|
+
replaced: Optional[list[str]] = None # None means no replacement is done
|
|
35
|
+
added: list[str] = field(default_factory=list)
|
|
36
|
+
removed: list[str] = field(default_factory=list)
|
|
37
|
+
|
|
38
|
+
def __bool__(self) -> bool: # check if any action required
|
|
39
|
+
return bool(self.replaced is not None or self.added or self.removed)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CommunityActionBuilder:
|
|
43
|
+
def __init__(self, community: CommunityActionValue):
|
|
44
|
+
self._community = community
|
|
45
|
+
|
|
46
|
+
def add(self, *community: str) -> None:
|
|
47
|
+
for c in community:
|
|
48
|
+
self._community.added.append(c)
|
|
49
|
+
|
|
50
|
+
def remove(self, *community: str) -> None:
|
|
51
|
+
for c in community:
|
|
52
|
+
self._community.removed.append(c)
|
|
53
|
+
|
|
54
|
+
def set(self, *community: str) -> None:
|
|
55
|
+
self._community.added.clear()
|
|
56
|
+
self._community.removed.clear()
|
|
57
|
+
self._community.replaced = list(community)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class AsPathActionValue:
|
|
62
|
+
set: Optional[list[str]] = None # None means no replacement is done
|
|
63
|
+
prepend: list[str] = field(default_factory=list)
|
|
64
|
+
expand: list[str] = field(default_factory=list)
|
|
65
|
+
expand_last_as: str = ""
|
|
66
|
+
delete: list[str] = field(default_factory=list)
|
|
67
|
+
|
|
68
|
+
def __bool__(self) -> bool: # check if any action required
|
|
69
|
+
return bool(
|
|
70
|
+
self.set is not None or self.prepend or self.expand or self.expand_last_as or self.delete
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
RawAsNum = Union[str, int]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class AsPathActionBuilder:
|
|
78
|
+
def __init__(self, as_path_value: AsPathActionValue):
|
|
79
|
+
self._as_path_value = as_path_value
|
|
80
|
+
|
|
81
|
+
def prepend(self, *values: RawAsNum) -> None:
|
|
82
|
+
self._as_path_value.prepend = list(map(str, values))
|
|
83
|
+
|
|
84
|
+
def delete(self, *values: RawAsNum) -> None:
|
|
85
|
+
self._as_path_value.delete = list(map(str, values))
|
|
86
|
+
|
|
87
|
+
def expand(self, *values: RawAsNum) -> None:
|
|
88
|
+
self._as_path_value.expand = list(map(str, values))
|
|
89
|
+
|
|
90
|
+
def expand_last_as(self, value: RawAsNum) -> None:
|
|
91
|
+
self._as_path_value.expand_last_as = str(value)
|
|
92
|
+
|
|
93
|
+
def set(self, *values: RawAsNum) -> None:
|
|
94
|
+
self._as_path_value.expand.clear()
|
|
95
|
+
self._as_path_value.expand_last_as = ""
|
|
96
|
+
self._as_path_value.delete.clear()
|
|
97
|
+
self._as_path_value.prepend.clear()
|
|
98
|
+
self._as_path_value.set = list(map(str, values))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass
|
|
102
|
+
class NextHopActionValue:
|
|
103
|
+
target: Optional[Literal["self", "discard", "peer", "ipv4_addr", "ipv6_addr", "mapped_ipv4"]] = None
|
|
104
|
+
addr: str = ""
|
|
105
|
+
|
|
106
|
+
def __bool__(self) -> bool:
|
|
107
|
+
return bool(self.target)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class NextHopActionBuilder:
|
|
111
|
+
def __init__(self, next_hop_value: NextHopActionValue):
|
|
112
|
+
self._next_hop_value = next_hop_value
|
|
113
|
+
|
|
114
|
+
def ipv4_addr(self, value: str) -> None:
|
|
115
|
+
self._next_hop_value.target = "ipv4_addr"
|
|
116
|
+
self._next_hop_value.addr = value
|
|
117
|
+
|
|
118
|
+
def ipv6_addr(self, value: str) -> None:
|
|
119
|
+
self._next_hop_value.target = "ipv6_addr"
|
|
120
|
+
self._next_hop_value.addr = value
|
|
121
|
+
|
|
122
|
+
def mapped_ipv4(self, value: str) -> None:
|
|
123
|
+
self._next_hop_value.target = "mapped_ipv4"
|
|
124
|
+
self._next_hop_value.addr = value
|
|
125
|
+
|
|
126
|
+
def self(self) -> None:
|
|
127
|
+
self._next_hop_value.target = "self"
|
|
128
|
+
self._next_hop_value.addr = ""
|
|
129
|
+
|
|
130
|
+
def peer(self) -> None:
|
|
131
|
+
self._next_hop_value.target = "peer"
|
|
132
|
+
self._next_hop_value.addr = ""
|
|
133
|
+
|
|
134
|
+
def discard(self) -> None:
|
|
135
|
+
self._next_hop_value.target = "discard"
|
|
136
|
+
self._next_hop_value.addr = ""
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class StatementBuilder:
|
|
140
|
+
def __init__(self, statement: RoutingPolicyStatement) -> None:
|
|
141
|
+
self._statement = statement
|
|
142
|
+
self._added_as_path: list[int] = []
|
|
143
|
+
self._community = CommunityActionValue()
|
|
144
|
+
self._extcommunity = CommunityActionValue()
|
|
145
|
+
self._as_path = AsPathActionValue()
|
|
146
|
+
self._next_hop = NextHopActionValue()
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def next_hop(self) -> NextHopActionBuilder:
|
|
150
|
+
return NextHopActionBuilder(self._next_hop)
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def as_path(self) -> AsPathActionBuilder:
|
|
154
|
+
return AsPathActionBuilder(self._as_path)
|
|
155
|
+
|
|
156
|
+
@property
|
|
157
|
+
def community(self) -> CommunityActionBuilder:
|
|
158
|
+
return CommunityActionBuilder(self._community)
|
|
159
|
+
|
|
160
|
+
@property
|
|
161
|
+
def extcommunity(self) -> CommunityActionBuilder:
|
|
162
|
+
return CommunityActionBuilder(self._extcommunity)
|
|
163
|
+
|
|
164
|
+
def _set(self, field: str, value: ValueT) -> None:
|
|
165
|
+
action = self._statement.then
|
|
166
|
+
if field in action:
|
|
167
|
+
action[field].type = ActionType.SET
|
|
168
|
+
action[field].value = value
|
|
169
|
+
else:
|
|
170
|
+
action.append(SingleAction(
|
|
171
|
+
field=field,
|
|
172
|
+
type=ActionType.SET,
|
|
173
|
+
value=value,
|
|
174
|
+
))
|
|
175
|
+
|
|
176
|
+
def set_local_pref(self, value: int) -> None:
|
|
177
|
+
self._set(ThenField.local_pref, value)
|
|
178
|
+
|
|
179
|
+
def set_metric_type(self, value: str) -> None:
|
|
180
|
+
self._set(ThenField.metric_type, value)
|
|
181
|
+
|
|
182
|
+
def set_metric(self, value: int) -> None:
|
|
183
|
+
self._set(ThenField.metric, value)
|
|
184
|
+
|
|
185
|
+
def add_metric(self, value: int) -> None:
|
|
186
|
+
action = self._statement.then
|
|
187
|
+
field = ThenField.metric
|
|
188
|
+
if field in action:
|
|
189
|
+
old_action = action[field]
|
|
190
|
+
if old_action.type == ActionType.SET:
|
|
191
|
+
action[field].value += value
|
|
192
|
+
elif old_action.type == ActionType.ADD:
|
|
193
|
+
action[field].value = value
|
|
194
|
+
else:
|
|
195
|
+
raise RuntimeError(f"Unknown action type {old_action.type} for metric")
|
|
196
|
+
else:
|
|
197
|
+
action.append(SingleAction(
|
|
198
|
+
field=field,
|
|
199
|
+
type=ActionType.ADD,
|
|
200
|
+
value=value,
|
|
201
|
+
))
|
|
202
|
+
|
|
203
|
+
def set_rpki_valid_state(self, value: str) -> None:
|
|
204
|
+
self._set(ThenField.rpki_valid_state, value)
|
|
205
|
+
|
|
206
|
+
def set_resolution(self, value: str) -> None:
|
|
207
|
+
self._set(ThenField.resolution, value)
|
|
208
|
+
|
|
209
|
+
def set_mpls_label(self) -> None:
|
|
210
|
+
self._set(ThenField.mpls_label, True)
|
|
211
|
+
|
|
212
|
+
def set_origin(self, value: str) -> None:
|
|
213
|
+
self._set(ThenField.origin, value)
|
|
214
|
+
|
|
215
|
+
def set_tag(self, value: int) -> None:
|
|
216
|
+
self._set(ThenField.tag, value)
|
|
217
|
+
|
|
218
|
+
def set_next_hop(self, value: Literal["self", "peer"]) -> None: # ???
|
|
219
|
+
self._set(ThenField.next_hop, value)
|
|
220
|
+
|
|
221
|
+
def __enter__(self) -> "StatementBuilder":
|
|
222
|
+
return self
|
|
223
|
+
|
|
224
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
225
|
+
if self._community:
|
|
226
|
+
self._statement.then.append(SingleAction(
|
|
227
|
+
field=ThenField.community,
|
|
228
|
+
type=ActionType.CUSTOM,
|
|
229
|
+
value=self._community,
|
|
230
|
+
))
|
|
231
|
+
if self._extcommunity:
|
|
232
|
+
self._statement.then.append(SingleAction(
|
|
233
|
+
field=ThenField.extcommunity,
|
|
234
|
+
type=ActionType.CUSTOM,
|
|
235
|
+
value=self._extcommunity,
|
|
236
|
+
))
|
|
237
|
+
if self._as_path:
|
|
238
|
+
self._statement.then.append(SingleAction(
|
|
239
|
+
field=ThenField.as_path,
|
|
240
|
+
type=ActionType.CUSTOM,
|
|
241
|
+
value=self._as_path,
|
|
242
|
+
))
|
|
243
|
+
if self._next_hop:
|
|
244
|
+
self._statement.then.append(SingleAction(
|
|
245
|
+
field=ThenField.next_hop,
|
|
246
|
+
type=ActionType.CUSTOM,
|
|
247
|
+
value=self._next_hop,
|
|
248
|
+
))
|
|
249
|
+
return None
|
|
250
|
+
|
|
251
|
+
def allow(self) -> None:
|
|
252
|
+
self._statement.result = ResultType.ALLOW
|
|
253
|
+
|
|
254
|
+
def deny(self) -> None:
|
|
255
|
+
self._statement.result = ResultType.DENY
|
|
256
|
+
|
|
257
|
+
def next(self) -> None:
|
|
258
|
+
self._statement.result = ResultType.NEXT
|
|
259
|
+
|
|
260
|
+
def next_policy(self) -> None:
|
|
261
|
+
self._statement.result = ResultType.NEXT_POLICY
|
|
262
|
+
|
|
263
|
+
def add_as_path(self, *as_path: int) -> None:
|
|
264
|
+
self._added_as_path.extend(as_path)
|
|
265
|
+
|
|
266
|
+
def custom_action(self, action: SingleAction[Any]) -> None:
|
|
267
|
+
self._statement.then.append(action)
|
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 VENDOR_REVERSES
|
|
8
|
+
from annet.annlib.rbparser.platform import VENDOR_REVERSES, VENDOR_ALIASES
|
|
9
9
|
|
|
10
10
|
from annet.connectors import CachedConnector
|
|
11
11
|
from annet.rulebook.deploying import compile_deploying_text
|
|
@@ -64,7 +64,8 @@ class DefaultRulebookProvider(RulebookProvider):
|
|
|
64
64
|
return self._rulebook_cache[hw]
|
|
65
65
|
|
|
66
66
|
assert hw.vendor in VENDOR_REVERSES, "Unknown vendor: %s" % (hw.vendor)
|
|
67
|
-
|
|
67
|
+
rul_vendor_name = VENDOR_ALIASES.get(hw.vendor, hw.vendor)
|
|
68
|
+
patching = compile_patching_text(self._render_rul(rul_vendor_name + ".rul", hw), rul_vendor_name)
|
|
68
69
|
|
|
69
70
|
try:
|
|
70
71
|
ordering_text = self._render_rul(hw.vendor + ".order", hw)
|
annet/rulebook/cisco/misc.py
CHANGED
|
@@ -57,93 +57,3 @@ def banner_login(rule, key, diff, **_):
|
|
|
57
57
|
yield (False, f"banner login {key}", None)
|
|
58
58
|
else:
|
|
59
59
|
yield from common.default(rule, key, diff)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def bgp_diff(old, new, diff_pre, _pops=(Op.AFFECTED,)):
|
|
63
|
-
"""
|
|
64
|
-
Some oder versions of Cisco IOS doesn't create subsection for address family block.
|
|
65
|
-
|
|
66
|
-
it looks like:
|
|
67
|
-
|
|
68
|
-
router bgp 65111
|
|
69
|
-
bgp router-id 1.1.1.1
|
|
70
|
-
bgp log-neighbor-changes
|
|
71
|
-
neighbor SPINE peer-group
|
|
72
|
-
!
|
|
73
|
-
address-family ipv4
|
|
74
|
-
neighbor SPINE send-community both
|
|
75
|
-
neighbor SPINE soft-reconfiguration inbound
|
|
76
|
-
neighbor SPINE route-map TOR_IMPORT_SPINE in
|
|
77
|
-
neighbor SPINE route-map TOR_EXPORT_SPINE out
|
|
78
|
-
exit-address-family
|
|
79
|
-
|
|
80
|
-
but should be
|
|
81
|
-
|
|
82
|
-
router bgp 65111
|
|
83
|
-
bgp router-id 1.1.1.1
|
|
84
|
-
bgp log-neighbor-changes
|
|
85
|
-
neighbor SPINE peer-group
|
|
86
|
-
!
|
|
87
|
-
address-family ipv4
|
|
88
|
-
neighbor SPINE send-community both
|
|
89
|
-
neighbor SPINE soft-reconfiguration inbound
|
|
90
|
-
neighbor SPINE route-map TOR_IMPORT_SPINE in
|
|
91
|
-
neighbor SPINE route-map TOR_EXPORT_SPINE out
|
|
92
|
-
exit-address-family
|
|
93
|
-
|
|
94
|
-
The diff_logic func do it before make diff.
|
|
95
|
-
"""
|
|
96
|
-
corrected_old = _create_subsections(old, "address-family")
|
|
97
|
-
|
|
98
|
-
yield from common.default_diff(corrected_old, new, diff_pre, _pops)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def _create_subsections(data: OrderedDict[str, Any], sub_section_prefix: str) -> OrderedDict[str, Any]:
|
|
102
|
-
"""
|
|
103
|
-
Reorganizes the given OrderedDict to nest commands under their respective
|
|
104
|
-
sub_section_prefix keys.
|
|
105
|
-
|
|
106
|
-
This function traverses the entries in the provided OrderedDict and groups
|
|
107
|
-
together all entries that are between keys with sub_section_prefix under those
|
|
108
|
-
keys as nested OrderedDicts. The reorganization keeps the order of entries
|
|
109
|
-
stable, only adding nesting where appropriate.
|
|
110
|
-
|
|
111
|
-
Args:
|
|
112
|
-
data (OrderedDict): The original configuration to be transformed.
|
|
113
|
-
sub_section_prefix (str): Prefix of subsection key
|
|
114
|
-
|
|
115
|
-
Returns:
|
|
116
|
-
OrderedDict: A new OrderedDict with nested 'address-family' sections.
|
|
117
|
-
"""
|
|
118
|
-
|
|
119
|
-
result = OrderedDict()
|
|
120
|
-
sub_section = None
|
|
121
|
-
temp: OrderedDict = OrderedDict()
|
|
122
|
-
|
|
123
|
-
for key, value in data.items():
|
|
124
|
-
# make nested loop if found nested values
|
|
125
|
-
if value:
|
|
126
|
-
fixed_value: OrderedDict[str, Any] = _create_subsections(value, sub_section_prefix)
|
|
127
|
-
else:
|
|
128
|
-
fixed_value = value
|
|
129
|
-
if key.startswith(sub_section_prefix):
|
|
130
|
-
# in case of data has already had subsections
|
|
131
|
-
if value:
|
|
132
|
-
result[key] = fixed_value
|
|
133
|
-
continue
|
|
134
|
-
# if previous subsection present save collected data from temporary dict
|
|
135
|
-
if sub_section:
|
|
136
|
-
result[sub_section] = temp
|
|
137
|
-
# find a new subsection and initialize new dict
|
|
138
|
-
sub_section = key
|
|
139
|
-
temp = OrderedDict()
|
|
140
|
-
# put found data to temporary dict
|
|
141
|
-
elif sub_section:
|
|
142
|
-
temp[key] = fixed_value
|
|
143
|
-
else:
|
|
144
|
-
result[key] = fixed_value
|
|
145
|
-
# if data is finished save collected data from temporary dict
|
|
146
|
-
if sub_section:
|
|
147
|
-
result[sub_section] = temp
|
|
148
|
-
|
|
149
|
-
return result
|
annet/rulebook/texts/arista.rul
CHANGED
annet/rulebook/texts/cisco.rul
CHANGED
annet/tabparser.py
CHANGED
|
@@ -18,7 +18,7 @@ annet/parallel.py,sha256=hLkzEht0KhzmzUWDdO4QFYQHzhxs3wPlTA8DxbB2ziw,17160
|
|
|
18
18
|
annet/patching.py,sha256=nILbY5oJajN0b1j3f0HEJm05H3HVThnWvB7vDVh7UQw,559
|
|
19
19
|
annet/reference.py,sha256=B8mH8VUMcecPnzULiTVb_kTQ7jQrCL7zp4pfIZQa5fk,4035
|
|
20
20
|
annet/storage.py,sha256=eAHEvPbRuKDUJdnkzSrHmW_lBJS3Y0g93Y2VJ4qzifQ,3941
|
|
21
|
-
annet/tabparser.py,sha256=
|
|
21
|
+
annet/tabparser.py,sha256=hf-_9R14C-_Q17lxUqbyT377QkrKhJLnaL-cG_YpUIQ,1016
|
|
22
22
|
annet/text_term_format.py,sha256=CHb6viv45vmYl-SK1A1vyPHGhaEni6jVybBusaQnct8,2813
|
|
23
23
|
annet/tracing.py,sha256=ndpM-au1c88uBBpOuH_z52qWZL773edYozNyys_wA68,4044
|
|
24
24
|
annet/types.py,sha256=f2HwqoKa6AucwFwDMszoouB6m1B8n6VmdjHMktO30Kc,7175
|
|
@@ -32,7 +32,7 @@ annet/adapters/netbox/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
32
32
|
annet/adapters/netbox/provider.py,sha256=3IrfZ6CfCxf-lTnJlIC2TQ8M_rDxOB_B7HGXZ92vAgA,1643
|
|
33
33
|
annet/adapters/netbox/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
annet/adapters/netbox/common/client.py,sha256=PaxHG4W9H8_uunIwMBNYkLq4eQJYoO6p6gY-ciQs7Nc,2563
|
|
35
|
-
annet/adapters/netbox/common/manufacturer.py,sha256=
|
|
35
|
+
annet/adapters/netbox/common/manufacturer.py,sha256=1kmw3YzitXwOh4zitsWfZda4CQiMr4CnAxkUkUm_z3A,1678
|
|
36
36
|
annet/adapters/netbox/common/models.py,sha256=JAAtbUB6UOzA3-VF5Fa33XktgKC3C2csareTZnHyqd0,7177
|
|
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
|
|
@@ -50,12 +50,12 @@ annet/annlib/jsontools.py,sha256=4-2r_mPNbecKreuUr3vlLv3ykJdhRmyUD8AdF2nSAxc,543
|
|
|
50
50
|
annet/annlib/lib.py,sha256=eJ4hcVuQ6pdYBzLs4YKCHFtq45idOfZCYp92XfF7_QI,15317
|
|
51
51
|
annet/annlib/output.py,sha256=_SjJ6G6bejvnTKqNHw6xeio0FT9oO3OIkLaOC3cEga4,7569
|
|
52
52
|
annet/annlib/patching.py,sha256=2CpAT3T43IUFJR57qTYSwjQ0smg0uHWN43df4n1WArs,19937
|
|
53
|
-
annet/annlib/tabparser.py,sha256=
|
|
53
|
+
annet/annlib/tabparser.py,sha256=OrRAkXv0vb0erZ3YLM2_LzoOo-A8qXTnaTHHyI1WYKY,28175
|
|
54
54
|
annet/annlib/types.py,sha256=VHU0CBADfYmO0xzB_c5f-mcuU3dUumuJczQnqGlib9M,852
|
|
55
55
|
annet/annlib/netdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
annet/annlib/netdev/db.py,sha256=fI_u5aya4l61mbYSjj4JwlVfi3s7obt2jqERSuXGRUI,1634
|
|
57
57
|
annet/annlib/netdev/devdb/__init__.py,sha256=aKYjjLbJebdKBjnGDpVLQdSqrV2JL24spGm58tmMWVU,892
|
|
58
|
-
annet/annlib/netdev/devdb/data/devdb.json,sha256=
|
|
58
|
+
annet/annlib/netdev/devdb/data/devdb.json,sha256=sv8c-Uwx6ByM5ZMvMCwwDtPZU3CmIzkti76bTtN7bnk,6066
|
|
59
59
|
annet/annlib/netdev/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
60
60
|
annet/annlib/netdev/views/dump.py,sha256=rIlyvnA3uM8bB_7oq1nS2KDxTp6dQh2hz-FbNhYIpOU,4630
|
|
61
61
|
annet/annlib/netdev/views/hardware.py,sha256=3JCZLH7deIHhCguwPJTUX-WDvWjG_xt6BdSEZSO6zkQ,4226
|
|
@@ -63,12 +63,12 @@ annet/annlib/rbparser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
63
63
|
annet/annlib/rbparser/acl.py,sha256=RR8yPt6t96_IiyuKVbeZ-3x32cyhBAT2wC1y99oWBO8,3931
|
|
64
64
|
annet/annlib/rbparser/deploying.py,sha256=ACT8QNhDAhJx3ZKuGh2nYBOrpdka2qEKuLDxvQAGKLk,1649
|
|
65
65
|
annet/annlib/rbparser/ordering.py,sha256=DiKqyY8Khz-5MTxNF1GSNtZgtyKwT3YYCXpahIPB6Ps,1779
|
|
66
|
-
annet/annlib/rbparser/platform.py,sha256=
|
|
66
|
+
annet/annlib/rbparser/platform.py,sha256=hnxznTfV9txXi1PkR1hZrprTrQJvlwgqXVL8vXkYmv4,1558
|
|
67
67
|
annet/annlib/rbparser/syntax.py,sha256=iZ7Y-4QQBw4L3UtjEh54qisiRDhobl7HZxFNdP8mi54,3577
|
|
68
68
|
annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
|
-
annet/annlib/rulebook/common.py,sha256=
|
|
69
|
+
annet/annlib/rulebook/common.py,sha256=bx_Iwui-JJeyctUPF1OsEll0Aa-IQZadBPQjaeuoWgw,16638
|
|
70
70
|
annet/api/__init__.py,sha256=7EB3d89kGXKf4Huw7cqyOULTGC9ydL4sHiVw8K0Aeqg,33722
|
|
71
|
-
annet/configs/context.yml,sha256=
|
|
71
|
+
annet/configs/context.yml,sha256=RVLrKLIHpCty7AGwOnmqf7Uu0iZQCn-AjYhophDJer8,259
|
|
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
|
|
@@ -89,7 +89,15 @@ annet/mesh/match_args.py,sha256=CR3kdIV9NGtyk9E2JbcOQ3TRuYEryTWP3m2yCo2VCWg,5751
|
|
|
89
89
|
annet/mesh/models_converter.py,sha256=3q2zs7K8S3pfYSUKKRdtl5CJGbeg4TtYxofAVs_MBsk,3085
|
|
90
90
|
annet/mesh/peer_models.py,sha256=xyLbWtwJ5Y4OLf-OVZeHwRn2qyWhipOvhD4pDHTbvTE,2665
|
|
91
91
|
annet/mesh/registry.py,sha256=G-FszWc_VKeN3eVpb-MRGbAGzbcSuEVAzbDC2k747XA,8611
|
|
92
|
-
annet/
|
|
92
|
+
annet/rpl/__init__.py,sha256=0kcIktE3AmS0rlm9xzVDf53xk08OeZXgD-6ZLCt_KCs,731
|
|
93
|
+
annet/rpl/action.py,sha256=PY6W66j908RuqQ1_ioxayqVN-70rxDk5Z59EGHtxI98,1246
|
|
94
|
+
annet/rpl/condition.py,sha256=MJri4MbWtPkLHIsLMAtsIEF7e8IAS9dIImjmJs5vS5U,3418
|
|
95
|
+
annet/rpl/match_builder.py,sha256=6uutlI9TU75ClpcKZx0t8pqYxr20vr0h9itBrtrm_tQ,4194
|
|
96
|
+
annet/rpl/policy.py,sha256=P1Kt-8fHFxEczeP-RwkK_wrGN0p7IR-hOApEd2vC55E,448
|
|
97
|
+
annet/rpl/result.py,sha256=PHFn1zhDeqLBn07nkYw5vsoXew4nTwkklOwqvFWzBLg,141
|
|
98
|
+
annet/rpl/routemap.py,sha256=ZxYSRXWtk3CG5OQuVVVYePpPP9Zbwk-ajWvQ0wqWP_8,2422
|
|
99
|
+
annet/rpl/statement_builder.py,sha256=dSYrLosInUb4ewHzX4PeEzbRlIaz6Df4N1EytIJGccQ,8442
|
|
100
|
+
annet/rulebook/__init__.py,sha256=oafL5HC8QHdkO9CH2q_fxohPMxOgjn-dNQa5kPjuqsA,3942
|
|
93
101
|
annet/rulebook/common.py,sha256=zK1s2c5lc5HQbIlMUQ4HARQudXSgOYiZ_Sxc2I_tHqg,721
|
|
94
102
|
annet/rulebook/deploying.py,sha256=XV0XQvc3YvwM8SOgOQlc-fCW4bnjQg_1CTZkTwMp14A,2972
|
|
95
103
|
annet/rulebook/patching.py,sha256=ve_D-9lnWs6Qb_NwqOLUWX-b_tI_L3pwQ7cgUPnqndY,4970
|
|
@@ -102,7 +110,7 @@ annet/rulebook/b4com/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
102
110
|
annet/rulebook/b4com/file.py,sha256=zK7RwBk1YaVoDSFSg1u7Pt8u0Fk3nhhu27aJRngemwc,137
|
|
103
111
|
annet/rulebook/cisco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
104
112
|
annet/rulebook/cisco/iface.py,sha256=WISkzjp_G7WKPpg098FCIm4b7ipOxtRLOQbu-7gMUL0,1792
|
|
105
|
-
annet/rulebook/cisco/misc.py,sha256=
|
|
113
|
+
annet/rulebook/cisco/misc.py,sha256=zgKdWGmjRYmvq58dh7Lbn7ofwSYZoISgXsUh5lkGKF8,2318
|
|
106
114
|
annet/rulebook/cisco/vlandb.py,sha256=pdQ0Ca976_5_cNBbTI6ADN1SP8aAngVBs1AZWltmpsw,3319
|
|
107
115
|
annet/rulebook/huawei/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
108
116
|
annet/rulebook/huawei/aaa.py,sha256=Xi8nWyBFaUz4SgoN1NQeOcXzBGCfINQDNiC-crq08uA,3445
|
|
@@ -118,7 +126,7 @@ annet/rulebook/routeros/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
118
126
|
annet/rulebook/routeros/file.py,sha256=zK7RwBk1YaVoDSFSg1u7Pt8u0Fk3nhhu27aJRngemwc,137
|
|
119
127
|
annet/rulebook/texts/arista.deploy,sha256=OS9eFyJpEPztcOHkBwajw_RTJfTT7ivaMHfx4_HXaUg,792
|
|
120
128
|
annet/rulebook/texts/arista.order,sha256=TKy3S56tIypwfVaw0akK1sXGatCpLVwpB4Jvq-dIu90,1457
|
|
121
|
-
annet/rulebook/texts/arista.rul,sha256=
|
|
129
|
+
annet/rulebook/texts/arista.rul,sha256=QQbro8eFlc7DCHk0-CTHX_rnj5rqumRzXlY60ga72jo,815
|
|
122
130
|
annet/rulebook/texts/aruba.deploy,sha256=hI432Bq-of_LMXuUflCu7eNSEFpx6qmj0KItEw6sgHI,841
|
|
123
131
|
annet/rulebook/texts/aruba.order,sha256=ZMakkn0EJ9zomgY6VssoptJImrHrUmYnCqivzLBFTRo,1158
|
|
124
132
|
annet/rulebook/texts/aruba.rul,sha256=zvGVpoYyJvMoL0fb1NQ8we_GCLZXno8nwWpZIOScLQQ,2584
|
|
@@ -127,7 +135,7 @@ annet/rulebook/texts/b4com.order,sha256=G3aToAIHHzKzDCM3q7_lyr9wJvuVOXVbVvF3wm5P
|
|
|
127
135
|
annet/rulebook/texts/b4com.rul,sha256=5mqyUg_oLRSny2iH6QdhfDWVu6kzgDURtlSATD7DFno,1056
|
|
128
136
|
annet/rulebook/texts/cisco.deploy,sha256=XvXWeOMahE8Uc9RF0xkJj8jGknD4vit8H_f24ubPX7w,1226
|
|
129
137
|
annet/rulebook/texts/cisco.order,sha256=OvNHMNqkCc-DN2dEjLCTKv_7ZhiaHt4q2X4Y4Z8dvR4,1901
|
|
130
|
-
annet/rulebook/texts/cisco.rul,sha256=
|
|
138
|
+
annet/rulebook/texts/cisco.rul,sha256=jgL5_xnSwd_H4E8cx4gcneSvJC5W1zz6_BWSb64iuxI,3017
|
|
131
139
|
annet/rulebook/texts/huawei.deploy,sha256=azEC6_jQRzwnTSrNgag0hHh6L7hezS_eMk6ZDZfWyXI,10444
|
|
132
140
|
annet/rulebook/texts/huawei.order,sha256=ENllPX4kO6xNw2mUQcx11yhxo3tKStZ5mUyc0C6s3d0,10657
|
|
133
141
|
annet/rulebook/texts/huawei.rul,sha256=02Fi1RG4YYea2clHCluBuJDKNbT0hS9jtsk6_h6GK8k,12958
|
|
@@ -152,10 +160,14 @@ annet_generators/example/lldp.py,sha256=24bGvShxbio-JxUdaehyPRu31LhH9YwSwFDrWVRn
|
|
|
152
160
|
annet_generators/mesh_example/__init__.py,sha256=NfNWgXn1TNiWI6A5tmU6Y-4QV2i33td0Qs3re0MNNMo,218
|
|
153
161
|
annet_generators/mesh_example/bgp.py,sha256=jzyDndSSGYyYBquDnLlR-7P5lzmUKcSyYCml3VsoMC0,1385
|
|
154
162
|
annet_generators/mesh_example/mesh_logic.py,sha256=DJS5JMCTs0rs0LN__0LulNgo2ekUcWiOMe02BlOeFas,1454
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
annet-0.16.
|
|
160
|
-
annet-0.16.
|
|
161
|
-
annet-0.16.
|
|
163
|
+
annet_generators/rpl_example/__init__.py,sha256=z4-gsDv06BBpgTwRohc50VBQYFD26QVu8Zr8Ngi_iqY,244
|
|
164
|
+
annet_generators/rpl_example/items.py,sha256=6x7b0wZ7Vjn6yCaJ-aGbpTHm7fyqO77b-LRqzzhEbh4,615
|
|
165
|
+
annet_generators/rpl_example/policy_generator.py,sha256=KFCqn347CIPcnllOHfINYeKgNSr6Wl-bdM5Xj_YKhYM,11183
|
|
166
|
+
annet_generators/rpl_example/route_policy.py,sha256=QjxFjkePHfTo2CpMeRVaDqZXNXLM-gGlE8EocHuOR4Y,1189
|
|
167
|
+
annet-0.16.19.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
|
|
168
|
+
annet-0.16.19.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
|
|
169
|
+
annet-0.16.19.dist-info/METADATA,sha256=jVn5a9AeXl48iehZGqytQ9Y96qIXvmou5iRf2wwb3Uo,728
|
|
170
|
+
annet-0.16.19.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
171
|
+
annet-0.16.19.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
|
|
172
|
+
annet-0.16.19.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
|
|
173
|
+
annet-0.16.19.dist-info/RECORD,,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
AS_PATH_FILTERS = {
|
|
5
|
+
"ASP_EXAMPLE": [".*123456.*"],
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
IPV6_PREFIX_LISTS = {
|
|
9
|
+
"IPV6_LIST_EXAMPLE": ["2a13:5941::/32"],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class Community:
|
|
15
|
+
values: Sequence[str]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass(frozen=True)
|
|
19
|
+
class ExtCommunity:
|
|
20
|
+
values: Sequence[str]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
COMMUNITIES = {
|
|
24
|
+
"COMMUNITY_EXAMPLE_ADD": Community(["1234:1000"]),
|
|
25
|
+
"COMMUNITY_EXAMPLE_REMOVE": Community(["12345:999"]),
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
EXT_COMMUNITIES = {
|
|
29
|
+
"COMMUNITY_EXAMPLE_ADD": ExtCommunity(["1234:1000"]),
|
|
30
|
+
"COMMUNITY_EXAMPLE_REMOVE": ExtCommunity(["12345:999"]),
|
|
31
|
+
}
|