annet 0.12.10__tar.gz → 0.13.1__tar.gz

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 (144) hide show
  1. {annet-0.12.10/annet.egg-info → annet-0.13.1}/PKG-INFO +3 -2
  2. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/v24/storage.py +7 -6
  3. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/v37/storage.py +9 -7
  4. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/devdb/data/devdb.json +1 -1
  5. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/views/hardware.py +3 -0
  6. {annet-0.12.10 → annet-0.13.1/annet.egg-info}/PKG-INFO +3 -2
  7. {annet-0.12.10 → annet-0.13.1}/annet.egg-info/SOURCES.txt +0 -4
  8. {annet-0.12.10 → annet-0.13.1}/annet.egg-info/requires.txt +2 -1
  9. {annet-0.12.10 → annet-0.13.1}/requirements.txt +2 -1
  10. annet-0.12.10/annet/adapters/netbox/v24/api_models.py +0 -73
  11. annet-0.12.10/annet/adapters/netbox/v24/client.py +0 -59
  12. annet-0.12.10/annet/adapters/netbox/v37/api_models.py +0 -38
  13. annet-0.12.10/annet/adapters/netbox/v37/client.py +0 -62
  14. {annet-0.12.10 → annet-0.13.1}/AUTHORS +0 -0
  15. {annet-0.12.10 → annet-0.13.1}/LICENSE +0 -0
  16. {annet-0.12.10 → annet-0.13.1}/MANIFEST.in +0 -0
  17. {annet-0.12.10 → annet-0.13.1}/README.md +0 -0
  18. {annet-0.12.10 → annet-0.13.1}/annet/__init__.py +0 -0
  19. {annet-0.12.10 → annet-0.13.1}/annet/adapters/__init__.py +0 -0
  20. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/__init__.py +0 -0
  21. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/__init__.py +0 -0
  22. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/client.py +0 -0
  23. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/manufacturer.py +0 -0
  24. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/models.py +0 -0
  25. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/query.py +0 -0
  26. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/status_client.py +0 -0
  27. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/common/storage_opts.py +0 -0
  28. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/provider.py +0 -0
  29. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/v24/__init__.py +0 -0
  30. {annet-0.12.10 → annet-0.13.1}/annet/adapters/netbox/v37/__init__.py +0 -0
  31. {annet-0.12.10 → annet-0.13.1}/annet/annet.py +0 -0
  32. {annet-0.12.10 → annet-0.13.1}/annet/annlib/__init__.py +0 -0
  33. {annet-0.12.10 → annet-0.13.1}/annet/annlib/command.py +0 -0
  34. {annet-0.12.10 → annet-0.13.1}/annet/annlib/diff.py +0 -0
  35. {annet-0.12.10 → annet-0.13.1}/annet/annlib/errors.py +0 -0
  36. {annet-0.12.10 → annet-0.13.1}/annet/annlib/filter_acl.py +0 -0
  37. {annet-0.12.10 → annet-0.13.1}/annet/annlib/jsontools.py +0 -0
  38. {annet-0.12.10 → annet-0.13.1}/annet/annlib/lib.py +0 -0
  39. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/__init__.py +0 -0
  40. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/db.py +0 -0
  41. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/devdb/__init__.py +0 -0
  42. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/views/__init__.py +0 -0
  43. {annet-0.12.10 → annet-0.13.1}/annet/annlib/netdev/views/dump.py +0 -0
  44. {annet-0.12.10 → annet-0.13.1}/annet/annlib/output.py +0 -0
  45. {annet-0.12.10 → annet-0.13.1}/annet/annlib/patching.py +0 -0
  46. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/__init__.py +0 -0
  47. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/acl.py +0 -0
  48. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/deploying.py +0 -0
  49. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/ordering.py +0 -0
  50. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/platform.py +0 -0
  51. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rbparser/syntax.py +0 -0
  52. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rulebook/__init__.py +0 -0
  53. {annet-0.12.10 → annet-0.13.1}/annet/annlib/rulebook/common.py +0 -0
  54. {annet-0.12.10 → annet-0.13.1}/annet/annlib/tabparser.py +0 -0
  55. {annet-0.12.10 → annet-0.13.1}/annet/annlib/types.py +0 -0
  56. {annet-0.12.10 → annet-0.13.1}/annet/api/__init__.py +0 -0
  57. {annet-0.12.10 → annet-0.13.1}/annet/argparse.py +0 -0
  58. {annet-0.12.10 → annet-0.13.1}/annet/cli.py +0 -0
  59. {annet-0.12.10 → annet-0.13.1}/annet/cli_args.py +0 -0
  60. {annet-0.12.10 → annet-0.13.1}/annet/configs/context.yml +0 -0
  61. {annet-0.12.10 → annet-0.13.1}/annet/configs/logging.yaml +0 -0
  62. {annet-0.12.10 → annet-0.13.1}/annet/connectors.py +0 -0
  63. {annet-0.12.10 → annet-0.13.1}/annet/deploy.py +0 -0
  64. {annet-0.12.10 → annet-0.13.1}/annet/diff.py +0 -0
  65. {annet-0.12.10 → annet-0.13.1}/annet/executor.py +0 -0
  66. {annet-0.12.10 → annet-0.13.1}/annet/filtering.py +0 -0
  67. {annet-0.12.10 → annet-0.13.1}/annet/gen.py +0 -0
  68. {annet-0.12.10 → annet-0.13.1}/annet/generators/__init__.py +0 -0
  69. {annet-0.12.10 → annet-0.13.1}/annet/generators/base.py +0 -0
  70. {annet-0.12.10 → annet-0.13.1}/annet/generators/common/__init__.py +0 -0
  71. {annet-0.12.10 → annet-0.13.1}/annet/generators/common/initial.py +0 -0
  72. {annet-0.12.10 → annet-0.13.1}/annet/generators/entire.py +0 -0
  73. {annet-0.12.10 → annet-0.13.1}/annet/generators/exceptions.py +0 -0
  74. {annet-0.12.10 → annet-0.13.1}/annet/generators/jsonfragment.py +0 -0
  75. {annet-0.12.10 → annet-0.13.1}/annet/generators/partial.py +0 -0
  76. {annet-0.12.10 → annet-0.13.1}/annet/generators/perf.py +0 -0
  77. {annet-0.12.10 → annet-0.13.1}/annet/generators/ref.py +0 -0
  78. {annet-0.12.10 → annet-0.13.1}/annet/generators/result.py +0 -0
  79. {annet-0.12.10 → annet-0.13.1}/annet/hardware.py +0 -0
  80. {annet-0.12.10 → annet-0.13.1}/annet/implicit.py +0 -0
  81. {annet-0.12.10 → annet-0.13.1}/annet/lib.py +0 -0
  82. {annet-0.12.10 → annet-0.13.1}/annet/output.py +0 -0
  83. {annet-0.12.10 → annet-0.13.1}/annet/parallel.py +0 -0
  84. {annet-0.12.10 → annet-0.13.1}/annet/patching.py +0 -0
  85. {annet-0.12.10 → annet-0.13.1}/annet/reference.py +0 -0
  86. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/__init__.py +0 -0
  87. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/arista/__init__.py +0 -0
  88. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/arista/iface.py +0 -0
  89. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/aruba/__init__.py +0 -0
  90. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/aruba/ap_env.py +0 -0
  91. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/aruba/misc.py +0 -0
  92. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/cisco/__init__.py +0 -0
  93. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/cisco/iface.py +0 -0
  94. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/cisco/misc.py +0 -0
  95. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/cisco/vlandb.py +0 -0
  96. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/common.py +0 -0
  97. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/deploying.py +0 -0
  98. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/__init__.py +0 -0
  99. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/aaa.py +0 -0
  100. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/bgp.py +0 -0
  101. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/iface.py +0 -0
  102. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/misc.py +0 -0
  103. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/huawei/vlandb.py +0 -0
  104. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/juniper/__init__.py +0 -0
  105. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/nexus/__init__.py +0 -0
  106. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/nexus/iface.py +0 -0
  107. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/patching.py +0 -0
  108. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/ribbon/__init__.py +0 -0
  109. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/arista.deploy +0 -0
  110. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/arista.order +0 -0
  111. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/arista.rul +0 -0
  112. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/aruba.deploy +0 -0
  113. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/aruba.order +0 -0
  114. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/aruba.rul +0 -0
  115. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/cisco.deploy +0 -0
  116. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/cisco.order +0 -0
  117. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/cisco.rul +0 -0
  118. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/huawei.deploy +0 -0
  119. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/huawei.order +0 -0
  120. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/huawei.rul +0 -0
  121. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/juniper.rul +0 -0
  122. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/nexus.deploy +0 -0
  123. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/nexus.order +0 -0
  124. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/nexus.rul +0 -0
  125. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/nokia.rul +0 -0
  126. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/pc.order +0 -0
  127. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/pc.rul +0 -0
  128. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/ribbon.deploy +0 -0
  129. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/ribbon.rul +0 -0
  130. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/routeros.order +0 -0
  131. {annet-0.12.10 → annet-0.13.1}/annet/rulebook/texts/routeros.rul +0 -0
  132. {annet-0.12.10 → annet-0.13.1}/annet/storage.py +0 -0
  133. {annet-0.12.10 → annet-0.13.1}/annet/tabparser.py +0 -0
  134. {annet-0.12.10 → annet-0.13.1}/annet/text_term_format.py +0 -0
  135. {annet-0.12.10 → annet-0.13.1}/annet/tracing.py +0 -0
  136. {annet-0.12.10 → annet-0.13.1}/annet/types.py +0 -0
  137. {annet-0.12.10 → annet-0.13.1}/annet.egg-info/dependency_links.txt +0 -0
  138. {annet-0.12.10 → annet-0.13.1}/annet.egg-info/entry_points.txt +0 -0
  139. {annet-0.12.10 → annet-0.13.1}/annet.egg-info/top_level.txt +0 -0
  140. {annet-0.12.10 → annet-0.13.1}/annet_generators/__init__.py +0 -0
  141. {annet-0.12.10 → annet-0.13.1}/annet_generators/example/__init__.py +0 -0
  142. {annet-0.12.10 → annet-0.13.1}/annet_generators/example/lldp.py +0 -0
  143. {annet-0.12.10 → annet-0.13.1}/setup.cfg +0 -0
  144. {annet-0.12.10 → annet-0.13.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: annet
3
- Version: 0.12.10
3
+ Version: 0.13.1
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -21,5 +21,6 @@ Requires-Dist: contextlog>=1.1
21
21
  Requires-Dist: valkit>=0.1.4
22
22
  Requires-Dist: aiohttp>=3.8.4
23
23
  Requires-Dist: yarl>=1.8.2
24
- Requires-Dist: adaptix==3.0.0b2
24
+ Requires-Dist: adaptix==3.0.0b5
25
25
  Requires-Dist: dataclass-rest==0.4
26
+ Requires-Dist: annetbox[sync]>=0.1.0
@@ -1,6 +1,9 @@
1
1
  from logging import getLogger
2
2
  from typing import Optional, List, Union
3
3
 
4
+ from annetbox.v24 import models as api_models
5
+ from annetbox.v24.client_sync import NetboxV24
6
+
4
7
  from annet.adapters.netbox.common import models
5
8
  from annet.adapters.netbox.common.manufacturer import (
6
9
  is_supported, get_hw, get_breed,
@@ -8,8 +11,6 @@ from annet.adapters.netbox.common.manufacturer import (
8
11
  from annet.adapters.netbox.common.query import NetboxQuery
9
12
  from annet.adapters.netbox.common.storage_opts import NetboxStorageOpts
10
13
  from annet.storage import Storage
11
- from . import api_models
12
- from .client import NetboxV24
13
14
 
14
15
  logger = getLogger(__name__)
15
16
 
@@ -156,20 +157,20 @@ class NetboxStorageV24(Storage):
156
157
  return []
157
158
  return [
158
159
  device
159
- for device in self.netbox.all_devices().results
160
+ for device in self.netbox.dcim_all_devices().results
160
161
  if _match_query(query, device)
161
162
  if is_supported(device.device_type.manufacturer.name)
162
163
  ]
163
164
 
164
165
  def _load_interfaces(self, device_ids: List[int]) -> List[
165
166
  models.Interface]:
166
- interfaces = self.netbox.all_interfaces(device_id=device_ids)
167
+ interfaces = self.netbox.dcim_all_interfaces(device_id=device_ids)
167
168
  extended_ifaces = {
168
169
  interface.id: extend_interface(interface)
169
170
  for interface in interfaces.results
170
171
  }
171
172
 
172
- ips = self.netbox.all_ip_addresses(interface_id=list(extended_ifaces))
173
+ ips = self.netbox.ipam_all_ip_addresses(interface_id=list(extended_ifaces))
173
174
  for ip in ips.results:
174
175
  extended_ip = extend_ip(ip)
175
176
  interface = extended_ifaces[extended_ip.assigned_object_id]
@@ -180,7 +181,7 @@ class NetboxStorageV24(Storage):
180
181
  self, obj_id, preload_neighbors=False, use_mesh=None,
181
182
  **kwargs,
182
183
  ) -> models.NetboxDevice:
183
- device = self.netbox.get_device(obj_id)
184
+ device = self.netbox.dcim_device(obj_id)
184
185
  res = extend_device(device=device, storage=self)
185
186
  res.interfaces = self._load_interfaces([device.id])
186
187
  return res
@@ -3,6 +3,8 @@ from typing import Optional, List, Union
3
3
 
4
4
  from adaptix import P
5
5
  from adaptix.conversion import impl_converter, link
6
+ from annetbox.v37 import models as api_models
7
+ from annetbox.v37.client_sync import NetboxV37
6
8
 
7
9
  from annet.adapters.netbox.common import models
8
10
  from annet.adapters.netbox.common.manufacturer import (
@@ -12,8 +14,7 @@ from annet.adapters.netbox.common.query import NetboxQuery
12
14
  from annet.adapters.netbox.common.storage_opts import NetboxStorageOpts
13
15
  from annet.annlib.netdev.views.hardware import HardwareView
14
16
  from annet.storage import Storage
15
- from . import api_models
16
- from .client import NetboxV37
17
+
17
18
 
18
19
  logger = getLogger(__name__)
19
20
 
@@ -54,7 +55,8 @@ def extend_device(
54
55
 
55
56
  @impl_converter
56
57
  def extend_interface(
57
- interface: api_models.Interface, ip_addresses: List[models.IpAddress],
58
+ interface: api_models.Interface,
59
+ ip_addresses: List[models.IpAddress],
58
60
  ) -> models.Interface:
59
61
  ...
60
62
 
@@ -109,7 +111,7 @@ class NetboxStorageV37(Storage):
109
111
  return []
110
112
  return [
111
113
  device
112
- for device in self.netbox.all_devices(
114
+ for device in self.netbox.dcim_all_devices(
113
115
  name__ic=query.globs,
114
116
  ).results
115
117
  if _match_query(query, device)
@@ -118,13 +120,13 @@ class NetboxStorageV37(Storage):
118
120
 
119
121
  def _load_interfaces(self, device_ids: List[int]) -> List[
120
122
  models.Interface]:
121
- interfaces = self.netbox.all_interfaces(device_id=device_ids)
123
+ interfaces = self.netbox.dcim_all_interfaces(device_id=device_ids)
122
124
  extended_ifaces = {
123
125
  interface.id: extend_interface(interface, [])
124
126
  for interface in interfaces.results
125
127
  }
126
128
 
127
- ips = self.netbox.all_ip_addresses(interface_id=list(extended_ifaces))
129
+ ips = self.netbox.ipam_all_ip_addresses(interface_id=list(extended_ifaces))
128
130
  for ip in ips.results:
129
131
  extended_ifaces[ip.assigned_object_id].ip_addresses.append(ip)
130
132
  return list(extended_ifaces.values())
@@ -133,7 +135,7 @@ class NetboxStorageV37(Storage):
133
135
  self, obj_id, preload_neighbors=False, use_mesh=None,
134
136
  **kwargs,
135
137
  ) -> models.NetboxDevice:
136
- device = self.netbox.get_device(obj_id)
138
+ device = self.netbox.dcim_device(obj_id)
137
139
  res = extend_device(device=device, storage=self)
138
140
  res.interfaces = self._load_interfaces([device.id])
139
141
  return res
@@ -98,7 +98,7 @@
98
98
 
99
99
  "PC": "^(PC|pc|[Mm]ellanox SN|[Ee]dge-?[Cc]ore|[Mm]oxa|[Aa]sterfusion CX)",
100
100
 
101
- "PC.Whitebox": "([Mm]ellanox SN|[Ee]dge-?[Cc]ore)",
101
+ "PC.Whitebox": "([Mm]ellanox SN|[Ee]dge-?[Cc]ore|[Aa]sterfusion CX)",
102
102
  "PC.Whitebox.Mellanox": "[Mm]ellanox",
103
103
  "PC.Whitebox.Mellanox.SN": " SN",
104
104
  "PC.Whitebox.Mellanox.SN.SN2100": " SN2100",
@@ -89,6 +89,8 @@ def hw_to_vendor(hw: HardwareView) -> Optional[str]:
89
89
  return "aruba"
90
90
  elif hw.Ribbon:
91
91
  return "ribbon"
92
+ elif hw.H3C:
93
+ return "h3c"
92
94
  return None
93
95
 
94
96
 
@@ -106,6 +108,7 @@ def vendor_to_hw(vendor):
106
108
  "aruba": "Aruba",
107
109
  "routeros": "RouterOS",
108
110
  "ribbon": "Ribbon",
111
+ "h3c": "H3C",
109
112
  }.get(vendor.lower(), vendor),
110
113
  None,
111
114
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: annet
3
- Version: 0.12.10
3
+ Version: 0.13.1
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -21,5 +21,6 @@ Requires-Dist: contextlog>=1.1
21
21
  Requires-Dist: valkit>=0.1.4
22
22
  Requires-Dist: aiohttp>=3.8.4
23
23
  Requires-Dist: yarl>=1.8.2
24
- Requires-Dist: adaptix==3.0.0b2
24
+ Requires-Dist: adaptix==3.0.0b5
25
25
  Requires-Dist: dataclass-rest==0.4
26
+ Requires-Dist: annetbox[sync]>=0.1.0
@@ -44,12 +44,8 @@ annet/adapters/netbox/common/query.py
44
44
  annet/adapters/netbox/common/status_client.py
45
45
  annet/adapters/netbox/common/storage_opts.py
46
46
  annet/adapters/netbox/v24/__init__.py
47
- annet/adapters/netbox/v24/api_models.py
48
- annet/adapters/netbox/v24/client.py
49
47
  annet/adapters/netbox/v24/storage.py
50
48
  annet/adapters/netbox/v37/__init__.py
51
- annet/adapters/netbox/v37/api_models.py
52
- annet/adapters/netbox/v37/client.py
53
49
  annet/adapters/netbox/v37/storage.py
54
50
  annet/annlib/__init__.py
55
51
  annet/annlib/command.py
@@ -12,5 +12,6 @@ contextlog>=1.1
12
12
  valkit>=0.1.4
13
13
  aiohttp>=3.8.4
14
14
  yarl>=1.8.2
15
- adaptix==3.0.0b2
15
+ adaptix==3.0.0b5
16
16
  dataclass-rest==0.4
17
+ annetbox[sync]>=0.1.0
@@ -12,5 +12,6 @@ contextlog>=1.1
12
12
  valkit>=0.1.4
13
13
  aiohttp>=3.8.4
14
14
  yarl>=1.8.2
15
- adaptix==3.0.0b2
15
+ adaptix==3.0.0b5
16
16
  dataclass-rest==0.4
17
+ annetbox[sync]>=0.1.0
@@ -1,73 +0,0 @@
1
- from dataclasses import dataclass
2
- from datetime import datetime
3
- from typing import List, Optional, Any, Dict
4
-
5
- from annet.adapters.netbox.common.models import Entity, DeviceType
6
-
7
-
8
- @dataclass
9
- class Label:
10
- value: int
11
- label: str
12
-
13
-
14
- @dataclass
15
- class DeviceIp:
16
- id: int
17
- address: str
18
- family: int
19
-
20
-
21
- @dataclass
22
- class Device(Entity):
23
- url: str
24
- display_name: str
25
- device_type: DeviceType
26
- device_role: Entity
27
- tenant: Optional[Entity]
28
- platform: Optional[Entity]
29
- serial: str
30
- asset_tag: Optional[str]
31
- site: Entity
32
- rack: Optional[Entity]
33
- position: Optional[float]
34
- face: Optional[Label]
35
- status: Label
36
- primary_ip: Optional[DeviceIp]
37
- primary_ip4: Optional[DeviceIp]
38
- primary_ip6: Optional[DeviceIp]
39
- tags: List[str]
40
- custom_fields: Dict[str, Any]
41
- created: datetime
42
- last_updated: datetime
43
-
44
-
45
- @dataclass
46
- class Interface(Entity):
47
- device: Entity
48
- enabled: bool
49
-
50
-
51
- @dataclass
52
- class Vrf(Entity):
53
- rd: str
54
-
55
-
56
- @dataclass
57
- class IpAddress:
58
- id: int
59
- family: int
60
- address: str
61
- vrf: Optional[Vrf]
62
- tenant: Any # ???
63
- status: Label
64
- description: Optional[str]
65
- custom_fields: Dict[str, Any]
66
- tags: List[str]
67
- created: datetime
68
- last_updated: datetime
69
-
70
- interface: Entity
71
-
72
- nat_inside: Any # ???
73
- nat_outside: Any # ???
@@ -1,59 +0,0 @@
1
- from datetime import datetime
2
- from typing import List, Optional
3
-
4
- import dateutil.parser
5
- from adaptix import Retort, loader
6
- from dataclass_rest import get
7
-
8
- from annet.adapters.netbox.common.client import (
9
- BaseNetboxClient, collect, PagingResponse,
10
- )
11
- from .api_models import Device, Interface, IpAddress
12
-
13
-
14
- class NetboxV24(BaseNetboxClient):
15
- def _init_response_body_factory(self) -> Retort:
16
- return Retort(recipe=[
17
- loader(datetime, dateutil.parser.parse)
18
- ])
19
-
20
- @get("dcim/interfaces")
21
- def interfaces(
22
- self,
23
- device_id: Optional[List[int]] = None,
24
- limit: int = 20,
25
- offset: int = 0,
26
- ) -> PagingResponse[Interface]:
27
- pass
28
-
29
- all_interfaces = collect(interfaces, field="device_id")
30
-
31
- @get("ipam/ip-addresses")
32
- def ip_addresses(
33
- self,
34
- interface_id: Optional[List[int]] = None,
35
- limit: int = 20,
36
- offset: int = 0,
37
- ) -> PagingResponse[IpAddress]:
38
- pass
39
-
40
- all_ip_addresses = collect(ip_addresses, field="interface_id")
41
-
42
- @get("dcim/devices")
43
- def devices(
44
- self,
45
- name: Optional[List[str]] = None,
46
- tag: Optional[str] = None,
47
- limit: int = 20,
48
- offset: int = 0,
49
- ) -> PagingResponse[Device]:
50
- pass
51
-
52
- all_devices = collect(devices)
53
-
54
- @get("dcim/devices/{device_id}")
55
- def get_device(
56
- self,
57
- device_id: int,
58
- ) -> Device:
59
- pass
@@ -1,38 +0,0 @@
1
- from dataclasses import dataclass
2
- from datetime import datetime
3
- from typing import List, Optional, Any, Dict
4
-
5
- from annet.adapters.netbox.common.models import (
6
- Entity, Label, DeviceType, DeviceIp,
7
- )
8
-
9
-
10
- @dataclass
11
- class Interface(Entity):
12
- device: Entity
13
- enabled: bool
14
- display: str = "" # added in 3.x
15
-
16
-
17
- @dataclass
18
- class Device(Entity):
19
- url: str
20
- display: str # renamed in 3.x from display_name
21
- device_type: DeviceType
22
- device_role: Entity
23
- tenant: Optional[Entity]
24
- platform: Optional[Entity]
25
- serial: str
26
- asset_tag: Optional[str]
27
- site: Entity
28
- rack: Optional[Entity]
29
- position: Optional[float]
30
- face: Optional[Label]
31
- status: Label
32
- primary_ip: Optional[DeviceIp]
33
- primary_ip4: Optional[DeviceIp]
34
- primary_ip6: Optional[DeviceIp]
35
- tags: List[Entity]
36
- custom_fields: Dict[str, Any]
37
- created: datetime
38
- last_updated: datetime
@@ -1,62 +0,0 @@
1
- from datetime import datetime
2
- from typing import List, Optional
3
-
4
- import dateutil.parser
5
- from adaptix import Retort, loader
6
- from dataclass_rest import get
7
- from dataclass_rest.client_protocol import FactoryProtocol
8
-
9
- from annet.adapters.netbox.common.client import (
10
- BaseNetboxClient, collect, PagingResponse,
11
- )
12
- from annet.adapters.netbox.common.models import IpAddress
13
- from .api_models import Device, Interface
14
-
15
-
16
- class NetboxV37(BaseNetboxClient):
17
- def _init_response_body_factory(self) -> FactoryProtocol:
18
- return Retort(recipe=[
19
- loader(datetime, dateutil.parser.parse)
20
- ])
21
-
22
- @get("dcim/interfaces")
23
- def interfaces(
24
- self,
25
- device_id: Optional[List[int]] = None,
26
- limit: int = 20,
27
- offset: int = 0,
28
- ) -> PagingResponse[Interface]:
29
- pass
30
-
31
- all_interfaces = collect(interfaces, field="device_id")
32
-
33
- @get("ipam/ip-addresses")
34
- def ip_addresses(
35
- self,
36
- interface_id: Optional[List[int]] = None,
37
- limit: int = 20,
38
- offset: int = 0,
39
- ) -> PagingResponse[IpAddress]:
40
- pass
41
-
42
- all_ip_addresses = collect(ip_addresses, field="interface_id")
43
-
44
- @get("dcim/devices")
45
- def devices(
46
- self,
47
- name: Optional[List[str]] = None,
48
- name__ic: Optional[List[str]] = None,
49
- tag: Optional[List[str]] = None,
50
- limit: int = 20,
51
- offset: int = 0,
52
- ) -> PagingResponse[Device]:
53
- pass
54
-
55
- all_devices = collect(devices)
56
-
57
- @get("dcim/devices/{device_id}")
58
- def get_device(
59
- self,
60
- device_id: int,
61
- ) -> Device:
62
- pass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes