annet 3.1.4__py3-none-any.whl → 3.2.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/annlib/rulebook/common.py +4 -86
- annet/vendors/base.py +6 -0
- annet/vendors/library/arista.py +14 -0
- annet/vendors/library/aruba.py +13 -0
- annet/vendors/library/b4com.py +19 -0
- annet/vendors/library/cisco.py +11 -0
- annet/vendors/library/h3c.py +10 -0
- annet/vendors/library/huawei.py +13 -0
- annet/vendors/library/iosxr.py +11 -0
- annet/vendors/library/juniper.py +11 -0
- annet/vendors/library/nexus.py +11 -0
- annet/vendors/library/nokia.py +10 -0
- annet/vendors/library/optixtrans.py +6 -10
- annet/vendors/library/pc.py +12 -0
- annet/vendors/library/ribbon.py +11 -0
- annet/vendors/library/routeros.py +13 -0
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/METADATA +1 -1
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/RECORD +23 -23
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/WHEEL +0 -0
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/entry_points.txt +0 -0
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/licenses/AUTHORS +0 -0
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/licenses/LICENSE +0 -0
- {annet-3.1.4.dist-info → annet-3.2.0.dist-info}/top_level.txt +0 -0
annet/annlib/rulebook/common.py
CHANGED
|
@@ -2,9 +2,9 @@ import os
|
|
|
2
2
|
import typing
|
|
3
3
|
from collections import OrderedDict as odict
|
|
4
4
|
|
|
5
|
-
from annet.annlib.command import
|
|
6
|
-
|
|
5
|
+
from annet.annlib.command import Command, CommandList
|
|
7
6
|
from annet.types import Op
|
|
7
|
+
from annet.vendors import registry_connector
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
# =====
|
|
@@ -287,87 +287,5 @@ class ApplyItem(typing.NamedTuple):
|
|
|
287
287
|
after: CommandList
|
|
288
288
|
|
|
289
289
|
|
|
290
|
-
def apply(hw, do_commit, do_finalize,
|
|
291
|
-
|
|
292
|
-
if hw.Huawei:
|
|
293
|
-
before.add_cmd(Command("system-view"))
|
|
294
|
-
if do_commit and (hw.Huawei.CE or hw.Huawei.NE):
|
|
295
|
-
after.add_cmd(Command("commit"))
|
|
296
|
-
after.add_cmd(Command("q"))
|
|
297
|
-
if do_finalize:
|
|
298
|
-
after.add_cmd(Command("save", timeout=20))
|
|
299
|
-
elif hw.Arista:
|
|
300
|
-
before.add_cmd(Command("conf s"))
|
|
301
|
-
if do_commit:
|
|
302
|
-
after.add_cmd(Command("commit"))
|
|
303
|
-
else:
|
|
304
|
-
after.add_cmd(Command("abort")) # просто exit оставит висеть configure session
|
|
305
|
-
if do_finalize:
|
|
306
|
-
after.add_cmd(Command("write memory"))
|
|
307
|
-
elif hw.ASR or hw.XRV or hw.XR:
|
|
308
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
309
|
-
before.add_cmd(Command("configure exclusive"))
|
|
310
|
-
if do_commit:
|
|
311
|
-
after.add_cmd(Command("commit"))
|
|
312
|
-
after.add_cmd(Command("exit"))
|
|
313
|
-
elif hw.Cisco or hw.Nexus:
|
|
314
|
-
# классический ios и nxos не умеет коммиты
|
|
315
|
-
before.add_cmd(Command("conf t"))
|
|
316
|
-
after.add_cmd(Command("exit"))
|
|
317
|
-
if do_finalize:
|
|
318
|
-
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
319
|
-
elif hw.Juniper:
|
|
320
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
321
|
-
before.add_cmd(Command("configure exclusive"))
|
|
322
|
-
if do_commit:
|
|
323
|
-
after.add_cmd(Command("commit", timeout=30))
|
|
324
|
-
after.add_cmd(Command("exit"))
|
|
325
|
-
elif hw.PC:
|
|
326
|
-
if hw.soft.startswith(("Cumulus", "SwitchDev")):
|
|
327
|
-
if os.environ.get("ETCKEEPER_CHECK", False):
|
|
328
|
-
before.add_cmd(Command("etckeeper check"))
|
|
329
|
-
elif hw.Nokia:
|
|
330
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
331
|
-
before.add_cmd(Command("configure private"))
|
|
332
|
-
if do_commit:
|
|
333
|
-
after.add_cmd(Command("commit"))
|
|
334
|
-
elif hw.RouterOS:
|
|
335
|
-
# FIXME: пока не удалось победить \x1b[c после включения safe mode
|
|
336
|
-
# if len(cmds) > 99:
|
|
337
|
-
# raise Exception("RouterOS does not support more 100 actions in safe mode")
|
|
338
|
-
# before.add_cmd(RosDevice.SAFE_MODE)
|
|
339
|
-
pass
|
|
340
|
-
# after.add_cmd(RosDevice.SAFE_MODE)
|
|
341
|
-
elif hw.Aruba:
|
|
342
|
-
before.add_cmd(Command("conf t"))
|
|
343
|
-
after.add_cmd(Command("end"))
|
|
344
|
-
if do_commit:
|
|
345
|
-
after.add_cmd(Command("commit apply"))
|
|
346
|
-
if do_finalize:
|
|
347
|
-
after.add_cmd(Command("write memory"))
|
|
348
|
-
elif hw.Ribbon:
|
|
349
|
-
# коммит сам сохраняет изменения в стартап do_finalize не применим
|
|
350
|
-
before.add_cmd(Command("configure exclusive"))
|
|
351
|
-
if do_commit:
|
|
352
|
-
after.add_cmd(Command("commit", timeout=30))
|
|
353
|
-
after.add_cmd(Command("exit"))
|
|
354
|
-
elif hw.B4com.CS2148P:
|
|
355
|
-
before.add_cmd(Command("conf t"))
|
|
356
|
-
after.add_cmd(Command("end"))
|
|
357
|
-
if do_finalize:
|
|
358
|
-
after.add_cmd(Command("write", timeout=40))
|
|
359
|
-
elif hw.B4com:
|
|
360
|
-
before.add_cmd(Command("conf t"))
|
|
361
|
-
if do_commit:
|
|
362
|
-
after.add_cmd(Command("commit"))
|
|
363
|
-
after.add_cmd(Command("end"))
|
|
364
|
-
if do_finalize:
|
|
365
|
-
after.add_cmd(Command("write", timeout=40))
|
|
366
|
-
elif hw.H3C:
|
|
367
|
-
before.add_cmd(Command("system-view"))
|
|
368
|
-
if do_finalize:
|
|
369
|
-
after.add_cmd(Command("save force", timeout=90))
|
|
370
|
-
else:
|
|
371
|
-
raise Exception("unknown hw %s" % hw)
|
|
372
|
-
|
|
373
|
-
return before, after
|
|
290
|
+
def apply(hw, do_commit, do_finalize, path):
|
|
291
|
+
return registry_connector.get().match(hw).apply(hw, do_commit, do_finalize, path)
|
annet/vendors/base.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
from typing import ClassVar
|
|
3
3
|
|
|
4
|
+
from annet.annlib.command import CommandList
|
|
4
5
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
5
6
|
from annet.annlib.tabparser import CommonFormatter
|
|
6
7
|
|
|
@@ -12,6 +13,11 @@ class AbstractVendor(abc.ABC):
|
|
|
12
13
|
def match(self) -> list[str]:
|
|
13
14
|
raise NotImplementedError
|
|
14
15
|
|
|
16
|
+
def apply(
|
|
17
|
+
self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str
|
|
18
|
+
) -> tuple[CommandList, CommandList]:
|
|
19
|
+
return CommandList(), CommandList()
|
|
20
|
+
|
|
15
21
|
@property
|
|
16
22
|
@abc.abstractmethod
|
|
17
23
|
def reverse(self) -> str:
|
annet/vendors/library/arista.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import AristaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,19 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class AristaVendor(AbstractVendor):
|
|
9
10
|
NAME = "arista"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf s"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
else:
|
|
19
|
+
after.add_cmd(Command("abort")) # просто exit оставит висеть configure session
|
|
20
|
+
if do_finalize:
|
|
21
|
+
after.add_cmd(Command("write memory"))
|
|
22
|
+
|
|
23
|
+
return before, after
|
|
24
|
+
|
|
11
25
|
def match(self) -> list[str]:
|
|
12
26
|
return ["Arista"]
|
|
13
27
|
|
annet/vendors/library/aruba.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import ArubaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,18 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class ArubaVendor(AbstractVendor):
|
|
9
10
|
NAME = "aruba"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("end"))
|
|
17
|
+
if do_commit:
|
|
18
|
+
after.add_cmd(Command("commit apply"))
|
|
19
|
+
if do_finalize:
|
|
20
|
+
after.add_cmd(Command("write memory"))
|
|
21
|
+
|
|
22
|
+
return before, after
|
|
23
|
+
|
|
11
24
|
def match(self) -> list[str]:
|
|
12
25
|
return ["Aruba"]
|
|
13
26
|
|
annet/vendors/library/b4com.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import B4comFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,24 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class B4ComVendor(AbstractVendor):
|
|
9
10
|
NAME = "b4com"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
if hw.B4com.CS2148P:
|
|
16
|
+
before.add_cmd(Command("conf t"))
|
|
17
|
+
after.add_cmd(Command("end"))
|
|
18
|
+
if do_finalize:
|
|
19
|
+
after.add_cmd(Command("write", timeout=40))
|
|
20
|
+
else:
|
|
21
|
+
before.add_cmd(Command("conf t"))
|
|
22
|
+
if do_commit:
|
|
23
|
+
after.add_cmd(Command("commit"))
|
|
24
|
+
after.add_cmd(Command("end"))
|
|
25
|
+
if do_finalize:
|
|
26
|
+
after.add_cmd(Command("write", timeout=40))
|
|
27
|
+
|
|
28
|
+
return before, after
|
|
29
|
+
|
|
11
30
|
def match(self) -> list[str]:
|
|
12
31
|
return ["B4com"]
|
|
13
32
|
|
annet/vendors/library/cisco.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import CiscoFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class CiscoVendor(AbstractVendor):
|
|
9
10
|
NAME = "cisco"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("exit"))
|
|
17
|
+
if do_finalize:
|
|
18
|
+
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco"]
|
|
13
24
|
|
annet/vendors/library/h3c.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import HuaweiFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,15 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class H3CVendor(AbstractVendor):
|
|
9
10
|
NAME = "h3c"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("system-view"))
|
|
16
|
+
if do_finalize:
|
|
17
|
+
after.add_cmd(Command("save force", timeout=90))
|
|
18
|
+
|
|
19
|
+
return before, after
|
|
20
|
+
|
|
11
21
|
def match(self) -> list[str]:
|
|
12
22
|
return ["H3C"]
|
|
13
23
|
|
annet/vendors/library/huawei.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import HuaweiFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,18 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class HuaweiVendor(AbstractVendor):
|
|
9
10
|
NAME = "huawei"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("system-view"))
|
|
16
|
+
if do_commit and (hw.Huawei.CE or hw.Huawei.NE):
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
after.add_cmd(Command("q"))
|
|
19
|
+
if do_finalize:
|
|
20
|
+
after.add_cmd(Command("save", timeout=20))
|
|
21
|
+
|
|
22
|
+
return before, after
|
|
23
|
+
|
|
11
24
|
def match(self) -> list[str]:
|
|
12
25
|
return ["Huawei"]
|
|
13
26
|
|
annet/vendors/library/iosxr.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import AsrFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class IosXrVendor(AbstractVendor):
|
|
9
10
|
NAME = "iosxr"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure exclusive"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
after.add_cmd(Command("exit"))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco.ASR", "Cisco.XR", "Cisco.XRV"]
|
|
13
24
|
|
annet/vendors/library/juniper.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import JuniperFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class JuniperVendor(AbstractVendor):
|
|
9
10
|
NAME = "juniper"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure exclusive"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit", timeout=30))
|
|
18
|
+
after.add_cmd(Command("exit"))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Juniper"]
|
|
13
24
|
|
annet/vendors/library/nexus.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import NexusFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class NexusVendor(AbstractVendor):
|
|
9
10
|
NAME = "nexus"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("conf t"))
|
|
16
|
+
after.add_cmd(Command("exit"))
|
|
17
|
+
if do_finalize:
|
|
18
|
+
after.add_cmd(Command("copy running-config startup-config", timeout=40))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Cisco.Nexus"]
|
|
13
24
|
|
annet/vendors/library/nokia.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import NokiaFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,15 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class NokiaVendor(AbstractVendor):
|
|
9
10
|
NAME = "nokia"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure private"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit"))
|
|
18
|
+
|
|
19
|
+
return before, after
|
|
20
|
+
|
|
11
21
|
def match(self) -> list[str]:
|
|
12
22
|
return ["Nokia"]
|
|
13
23
|
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
2
|
from annet.annlib.tabparser import OptixtransFormatter
|
|
3
|
-
from annet.vendors.base import AbstractVendor
|
|
4
3
|
from annet.vendors.registry import registry
|
|
5
4
|
|
|
5
|
+
from .huawei import HuaweiVendor
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
@registry.register
|
|
8
|
-
class OptixTransVendor(
|
|
9
|
+
class OptixTransVendor(HuaweiVendor):
|
|
9
10
|
NAME = "optixtrans"
|
|
10
11
|
|
|
11
12
|
def match(self) -> list[str]:
|
|
12
|
-
return ["OptiXtrans"]
|
|
13
|
-
|
|
14
|
-
@property
|
|
15
|
-
def reverse(self) -> str:
|
|
16
|
-
return "undo"
|
|
13
|
+
return ["Huawei.OptiXtrans"]
|
|
17
14
|
|
|
18
15
|
@property
|
|
19
16
|
def hardware(self) -> HardwareView:
|
|
@@ -22,6 +19,5 @@ class OptixTransVendor(AbstractVendor):
|
|
|
22
19
|
def make_formatter(self, **kwargs) -> OptixtransFormatter:
|
|
23
20
|
return OptixtransFormatter(**kwargs)
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return "quit"
|
|
22
|
+
def svi_name(self, num: int) -> str:
|
|
23
|
+
return f"vlan{num}"
|
annet/vendors/library/pc.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from annet.annlib.command import Command, CommandList
|
|
1
4
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
5
|
from annet.annlib.tabparser import CommonFormatter
|
|
3
6
|
from annet.vendors.base import AbstractVendor
|
|
@@ -15,6 +18,15 @@ class PCVendor(AbstractVendor):
|
|
|
15
18
|
def reverse(self) -> str:
|
|
16
19
|
return "-"
|
|
17
20
|
|
|
21
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
22
|
+
before, after = CommandList(), CommandList()
|
|
23
|
+
|
|
24
|
+
if hw.soft.startswith(("Cumulus", "SwitchDev")):
|
|
25
|
+
if os.environ.get("ETCKEEPER_CHECK", False):
|
|
26
|
+
before.add_cmd(Command("etckeeper check"))
|
|
27
|
+
|
|
28
|
+
return before, after
|
|
29
|
+
|
|
18
30
|
@property
|
|
19
31
|
def hardware(self) -> HardwareView:
|
|
20
32
|
return HardwareView("PC")
|
annet/vendors/library/ribbon.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import RibbonFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,16 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class RibbonVendor(AbstractVendor):
|
|
9
10
|
NAME = "ribbon"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
before.add_cmd(Command("configure exclusive"))
|
|
16
|
+
if do_commit:
|
|
17
|
+
after.add_cmd(Command("commit", timeout=30))
|
|
18
|
+
after.add_cmd(Command("exit"))
|
|
19
|
+
|
|
20
|
+
return before, after
|
|
21
|
+
|
|
11
22
|
def match(self) -> list[str]:
|
|
12
23
|
return ["Ribbon"]
|
|
13
24
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from annet.annlib.command import Command, CommandList
|
|
1
2
|
from annet.annlib.netdev.views.hardware import HardwareView
|
|
2
3
|
from annet.annlib.tabparser import RosFormatter
|
|
3
4
|
from annet.vendors.base import AbstractVendor
|
|
@@ -8,6 +9,18 @@ from annet.vendors.registry import registry
|
|
|
8
9
|
class RouterOSVendor(AbstractVendor):
|
|
9
10
|
NAME = "routeros"
|
|
10
11
|
|
|
12
|
+
def apply(self, hw: HardwareView, do_commit: bool, do_finalize: bool, path: str) -> tuple[CommandList, CommandList]:
|
|
13
|
+
before, after = CommandList(), CommandList()
|
|
14
|
+
|
|
15
|
+
# FIXME: пока не удалось победить \x1b[c после включения safe mode
|
|
16
|
+
# if len(cmds) > 99:
|
|
17
|
+
# raise Exception("RouterOS does not support more 100 actions in safe mode")
|
|
18
|
+
# before.add_cmd(RosDevice.SAFE_MODE)
|
|
19
|
+
pass
|
|
20
|
+
# after.add_cmd(RosDevice.SAFE_MODE)
|
|
21
|
+
|
|
22
|
+
return before, after
|
|
23
|
+
|
|
11
24
|
def match(self) -> list[str]:
|
|
12
25
|
return ["RouterOS"]
|
|
13
26
|
|
|
@@ -76,7 +76,7 @@ annet/annlib/rbparser/ordering.py,sha256=XknggB92N4IbhHBZZHL0StwCCITt8mkho4D4Nu5
|
|
|
76
76
|
annet/annlib/rbparser/platform.py,sha256=d1jFH8hGMOf_qiveKE4H-c0OfNnzwmt2VYpSiSOn9qc,42
|
|
77
77
|
annet/annlib/rbparser/syntax.py,sha256=iZ7Y-4QQBw4L3UtjEh54qisiRDhobl7HZxFNdP8mi54,3577
|
|
78
78
|
annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
79
|
-
annet/annlib/rulebook/common.py,sha256=
|
|
79
|
+
annet/annlib/rulebook/common.py,sha256=2ZMu7Z47Ip7d8yMjihDNKKhwl9aV5U4IeCcyXM4CjeA,13527
|
|
80
80
|
annet/api/__init__.py,sha256=EMGUgt3pTi2MDF8DfXlS8PGX2zT0iGLY01R6QlQHvGg,33305
|
|
81
81
|
annet/configs/context.yml,sha256=RVLrKLIHpCty7AGwOnmqf7Uu0iZQCn-AjYhophDJer8,259
|
|
82
82
|
annet/configs/logging.yaml,sha256=EUagfir99QqA73Scc3k7sfQccbU3E1SvEQdyhLFtCl4,997
|
|
@@ -180,25 +180,25 @@ annet/rulebook/texts/ribbon.rul,sha256=609LyLTDCtXPVQNAzqS-VEyCpW3byHP8TCMJLFMn5
|
|
|
180
180
|
annet/rulebook/texts/routeros.order,sha256=M71uy_hf0KAjLNS3zZY3uih4m2xLUcu26FEoVVjC6k0,905
|
|
181
181
|
annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019O1DE,1203
|
|
182
182
|
annet/vendors/__init__.py,sha256=gQcDFlKeWDZB6vxJ_MdPWEoE-C5dg-YgXvgGkuV9YLw,569
|
|
183
|
-
annet/vendors/base.py,sha256=
|
|
183
|
+
annet/vendors/base.py,sha256=J9Bz7pDdBE7nCceHm2t9EzZ0MJChEugKLWaoOKZlP9Q,1144
|
|
184
184
|
annet/vendors/registry.py,sha256=zJUj5vJ105kD7xvxt84MYNTNYZI08AKCNTCmE0YtMzo,2539
|
|
185
185
|
annet/vendors/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
186
|
-
annet/vendors/library/arista.py,sha256=
|
|
187
|
-
annet/vendors/library/aruba.py,sha256=
|
|
188
|
-
annet/vendors/library/b4com.py,sha256=
|
|
189
|
-
annet/vendors/library/cisco.py,sha256=
|
|
190
|
-
annet/vendors/library/h3c.py,sha256
|
|
191
|
-
annet/vendors/library/huawei.py,sha256=
|
|
192
|
-
annet/vendors/library/iosxr.py,sha256=
|
|
193
|
-
annet/vendors/library/juniper.py,sha256=
|
|
194
|
-
annet/vendors/library/nexus.py,sha256=
|
|
195
|
-
annet/vendors/library/nokia.py,sha256=
|
|
196
|
-
annet/vendors/library/optixtrans.py,sha256=
|
|
197
|
-
annet/vendors/library/pc.py,sha256=
|
|
198
|
-
annet/vendors/library/ribbon.py,sha256=
|
|
199
|
-
annet/vendors/library/routeros.py,sha256=
|
|
200
|
-
annet-3.
|
|
201
|
-
annet-3.
|
|
186
|
+
annet/vendors/library/arista.py,sha256=tp01vFmPDa2H3-3MSHzJ0iWVwe3kI_IKNViHa0VWB8M,1301
|
|
187
|
+
annet/vendors/library/aruba.py,sha256=vGRUlbe48LRZs67o19wLOLnbDW-GDbAASWwsPuAzUro,1256
|
|
188
|
+
annet/vendors/library/b4com.py,sha256=GMgOLd_JT-96gWb4KKGlZcaJ5Cfbp_cwXtYbwrPimNM,1389
|
|
189
|
+
annet/vendors/library/cisco.py,sha256=ccKLOqxPQPFKUxb-SMdYR6-CCcILRvUB8shXZa7y_VU,1175
|
|
190
|
+
annet/vendors/library/h3c.py,sha256=-gY4DKAMqMcoMcVCWORxM945SfI9r8zekPXFqqKi52o,1044
|
|
191
|
+
annet/vendors/library/huawei.py,sha256=rDI3ScgJ7Cq8SlnGTZsZT8JcM8PxjyeGsQUMA5Xo4i8,1260
|
|
192
|
+
annet/vendors/library/iosxr.py,sha256=5QUN0ERGhBvXRA6G2FC7fHeE-GNuk58Wog28sqzFU2k,1173
|
|
193
|
+
annet/vendors/library/juniper.py,sha256=1Zih2jPdq34ZUZpjUX5nZKxOq4eiqgypaVqkmTmvTbc,1288
|
|
194
|
+
annet/vendors/library/nexus.py,sha256=GW3fWz0W10V9AuW17FFDM9vVUoCQgUVIGDufJaU6B2w,1117
|
|
195
|
+
annet/vendors/library/nokia.py,sha256=IPAwBux11cM2YdEK_b9dal7NAdmcMAo9HCLbWxjdZzo,1151
|
|
196
|
+
annet/vendors/library/optixtrans.py,sha256=xNurVzIrr7cefVUCzhxI-7xnCnayk1kIyRfU8Ug5t8M,631
|
|
197
|
+
annet/vendors/library/pc.py,sha256=4lPTvtvjGDCUuZ6yDyi-U4X9HPZRtj_CoYZM38jxwzo,1085
|
|
198
|
+
annet/vendors/library/ribbon.py,sha256=55tlhY8weGTE9x-CDpFUMvEX6pg0KnrXnd-P8bxceGk,1215
|
|
199
|
+
annet/vendors/library/routeros.py,sha256=0Hi-tDBjgBwfewiZi0EAnXkgGGHlOc_uwpY8xd9p3TM,1253
|
|
200
|
+
annet-3.2.0.dist-info/licenses/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
|
|
201
|
+
annet-3.2.0.dist-info/licenses/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
|
|
202
202
|
annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
203
203
|
annet_generators/example/__init__.py,sha256=OJ77uj8axc-FIyIu_Xdcnzmde3oQW5mk5qbODkhuVc8,355
|
|
204
204
|
annet_generators/example/hostname.py,sha256=RloLzNVetEoWPLITzfJ13Nk3CC0yi-cZB1RTd6dnuhI,2541
|
|
@@ -211,8 +211,8 @@ annet_generators/rpl_example/generator.py,sha256=EWah19gOH8G-QyNyWqxCqdRi0BK7GbM
|
|
|
211
211
|
annet_generators/rpl_example/items.py,sha256=d99HSXDHFjZq511EvGhIqRTWK3F4ZsCWfdUqFYQcyhE,772
|
|
212
212
|
annet_generators/rpl_example/mesh.py,sha256=z_WgfDZZ4xnyh3cSf75igyH09hGvtexEVwy1gCD_DzA,288
|
|
213
213
|
annet_generators/rpl_example/route_policy.py,sha256=z6nPb0VDeQtKD1NIg9sFvmUxBD5tVs2frfNIuKdM-5c,2318
|
|
214
|
-
annet-3.
|
|
215
|
-
annet-3.
|
|
216
|
-
annet-3.
|
|
217
|
-
annet-3.
|
|
218
|
-
annet-3.
|
|
214
|
+
annet-3.2.0.dist-info/METADATA,sha256=z0WLRhcHfc4EychYiW7rFhzAu8MT3YZSvFrkFCxiRCk,815
|
|
215
|
+
annet-3.2.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
216
|
+
annet-3.2.0.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
|
|
217
|
+
annet-3.2.0.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
|
|
218
|
+
annet-3.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|