annet 2.5.4__py3-none-any.whl → 3.0.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.

Files changed (37) hide show
  1. annet/adapters/file/provider.py +49 -26
  2. annet/adapters/netbox/common/manufacturer.py +3 -21
  3. annet/adapters/netbox/common/models.py +4 -3
  4. annet/adapters/netbox/v24/models.py +4 -3
  5. annet/annet.py +8 -1
  6. annet/annlib/netdev/devdb/data/devdb.json +1 -0
  7. annet/annlib/netdev/views/hardware.py +15 -67
  8. annet/annlib/patching.py +7 -5
  9. annet/annlib/rbparser/acl.py +3 -2
  10. annet/annlib/rbparser/ordering.py +3 -2
  11. annet/annlib/rbparser/platform.py +4 -0
  12. annet/annlib/rulebook/common.py +1 -1
  13. annet/api/__init__.py +2 -1
  14. annet/generators/__init__.py +1 -1
  15. annet/hardware.py +8 -12
  16. annet/parallel.py +28 -9
  17. annet/rulebook/__init__.py +2 -1
  18. annet/rulebook/deploying.py +3 -2
  19. annet/rulebook/patching.py +2 -2
  20. annet/rulebook/texts/arista.rul +25 -3
  21. annet/rulebook/texts/iosxr.deploy +27 -0
  22. annet/rulebook/texts/iosxr.order +85 -0
  23. annet/rulebook/texts/iosxr.rul +110 -0
  24. annet/tabparser.py +1 -1
  25. annet/vendors/__init__.py +33 -0
  26. annet/vendors/base.py +25 -0
  27. annet/vendors/registry.py +84 -0
  28. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/METADATA +1 -1
  29. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/RECORD +37 -30
  30. annet_generators/example/__init__.py +6 -1
  31. annet_generators/example/hostname.py +113 -0
  32. annet_generators/rpl_example/generator.py +3 -0
  33. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/WHEEL +0 -0
  34. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/entry_points.txt +0 -0
  35. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/licenses/AUTHORS +0 -0
  36. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/licenses/LICENSE +0 -0
  37. {annet-2.5.4.dist-info → annet-3.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,113 @@
1
+ from typing import List
2
+
3
+ from annet.generators import BaseGenerator, PartialGenerator
4
+ from annet.storage import Storage
5
+
6
+
7
+ class Hostname(PartialGenerator):
8
+ TAGS = ["hostname"]
9
+
10
+ def acl_huawei(self, _):
11
+ return """
12
+ sysname
13
+ header
14
+ """
15
+
16
+ def acl_safe_huawei(self, _):
17
+ return """
18
+ sysname
19
+ header
20
+ """
21
+
22
+ def run_huawei(self, device):
23
+ yield "sysname", device.hostname
24
+ yield 'header login information "%s"' % device.hostname
25
+
26
+ def acl_cisco(self, _):
27
+ return """
28
+ hostname
29
+ banner login
30
+ """
31
+
32
+ def acl_safe_cisco(self, _):
33
+ return """
34
+ hostname
35
+ banner login
36
+ """
37
+
38
+ def run_cisco(self, device):
39
+ if device.hw.Cisco.AIR and device.tags["Lightweight WiFi точка"]:
40
+ return
41
+ elif device.hw.Catalyst:
42
+ yield "banner login ^C%s^C" % device.hostname
43
+ yield "hostname", device.hostname
44
+
45
+ def acl_arista(self, _):
46
+ return """
47
+ hostname
48
+ """
49
+
50
+ def acl_safe_arista(self, _):
51
+ return """
52
+ hostname
53
+ """
54
+
55
+ def run_arista(self, device):
56
+ yield "hostname", device.hostname
57
+
58
+ acl_nexus = acl_arista
59
+ run_nexus = run_arista
60
+
61
+ def acl_juniper(self, _):
62
+ return """
63
+ system %cant_delete
64
+ host-name
65
+ """
66
+
67
+ def acl_safe_juniper(self, _):
68
+ return """
69
+ system %cant_delete
70
+ host-name
71
+ """
72
+
73
+ def run_juniper(self, device):
74
+ with self.block("system"):
75
+ yield "host-name", device.hostname
76
+
77
+ acl_ribbon = acl_juniper
78
+ acl_safe_ribbon = acl_safe_juniper
79
+ run_ribbon = run_juniper
80
+
81
+ def acl_nokia(self, _):
82
+ return """
83
+ system
84
+ name
85
+ """
86
+
87
+ def acl_safe_nokia(self, _):
88
+ return """
89
+ system
90
+ name
91
+ """
92
+
93
+ def run_nokia(self, device):
94
+ with self.block("system"):
95
+ yield "name", self.literal(device.hostname)
96
+
97
+ def acl_routeros(self, _):
98
+ return """
99
+ system %cant_delete
100
+ identity %cant_delete
101
+ set ~ %cant_delete
102
+ """
103
+
104
+ def run_routeros(self, device):
105
+ with self.block("system"):
106
+ with self.block("identity"):
107
+ yield f"set name={device.hostname}"
108
+
109
+
110
+ def get_generators(store: Storage) -> List[BaseGenerator]:
111
+ return [
112
+ Hostname(store),
113
+ ]
@@ -30,6 +30,9 @@ class CommunityGenerator(CommunityListGenerator):
30
30
 
31
31
 
32
32
  class PolicyGenerator(RoutingPolicyGenerator):
33
+ def get_prefix_lists(self, device: Any) -> list[IpPrefixList]:
34
+ return PREFIX_LISTS
35
+
33
36
  def get_policies(self, device: Any) -> list[RoutingPolicy]:
34
37
  return get_policies(
35
38
  routemap=routemap,
File without changes