hegemony-steps-netbox 0.57.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.
- hegemony_steps_netbox/__init__.py +43 -0
- hegemony_steps_netbox/client.py +694 -0
- hegemony_steps_netbox/docs/netbox.ipam.allocate.md +82 -0
- hegemony_steps_netbox/docs/netbox.ipam.release.md +49 -0
- hegemony_steps_netbox/docs/netbox.render_config.md +69 -0
- hegemony_steps_netbox/docs/netbox.request.md +132 -0
- hegemony_steps_netbox/ipam.py +714 -0
- hegemony_steps_netbox/render_config.py +336 -0
- hegemony_steps_netbox/request.py +678 -0
- hegemony_steps_netbox-0.57.0.dist-info/METADATA +42 -0
- hegemony_steps_netbox-0.57.0.dist-info/RECORD +14 -0
- hegemony_steps_netbox-0.57.0.dist-info/WHEEL +4 -0
- hegemony_steps_netbox-0.57.0.dist-info/entry_points.txt +3 -0
- hegemony_steps_netbox-0.57.0.dist-info/licenses/LICENSE-AGPL-3.0-or-later.txt +235 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025-2026 Rexonix s.r.o.
|
|
2
|
+
# SPDX-FileContributor: Jakub Trávník <jakub.travnik@gmail.com>
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
|
+
|
|
6
|
+
"""NetBox step handlers for Hegemony.
|
|
7
|
+
|
|
8
|
+
- ``netbox.request``: get, list, create, update or delete NetBox objects, or
|
|
9
|
+
post to a NetBox endpoint.
|
|
10
|
+
- ``netbox.ipam.allocate`` / ``netbox.ipam.release``: take the next free IP
|
|
11
|
+
address, prefix, VLAN or ASN from a pool, and give it back.
|
|
12
|
+
- ``netbox.render_config``: have NetBox render the intended configuration of
|
|
13
|
+
devices from their config templates.
|
|
14
|
+
|
|
15
|
+
Every call goes through ``http.request``'s client, so the flow's egress
|
|
16
|
+
policy and that step's safeguards apply to NetBox too. Registers under the
|
|
17
|
+
``hegemony.step_handlers`` entry-point group; the entry point name is the
|
|
18
|
+
claimed handler-id namespace prefix (``netbox``).
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from hegemony_step_sdk import BaseHandler, StepHandlerRegistry
|
|
24
|
+
|
|
25
|
+
from .ipam import AllocateHandler, ReleaseHandler
|
|
26
|
+
from .render_config import RenderConfigHandler
|
|
27
|
+
from .request import NetBoxRequestHandler
|
|
28
|
+
|
|
29
|
+
ALL_HANDLERS: tuple[type[BaseHandler], ...] = (
|
|
30
|
+
NetBoxRequestHandler,
|
|
31
|
+
AllocateHandler,
|
|
32
|
+
ReleaseHandler,
|
|
33
|
+
RenderConfigHandler,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def register(registry: StepHandlerRegistry) -> None:
|
|
38
|
+
"""Entry point: register this wheel's handlers with the host registry."""
|
|
39
|
+
for handler_class in ALL_HANDLERS:
|
|
40
|
+
registry.register_handler_type(handler_class)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
__all__ = ["ALL_HANDLERS", "register", *sorted(cls.__name__ for cls in ALL_HANDLERS)]
|