netbox-opennebula-sync 0.3.0__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.
Files changed (43) hide show
  1. netbox_opennebula_sync-0.3.0/LICENSE +190 -0
  2. netbox_opennebula_sync-0.3.0/PKG-INFO +141 -0
  3. netbox_opennebula_sync-0.3.0/README.md +112 -0
  4. netbox_opennebula_sync-0.3.0/pyproject.toml +60 -0
  5. netbox_opennebula_sync-0.3.0/setup.cfg +4 -0
  6. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/__init__.py +27 -0
  7. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/bridge.py +49 -0
  8. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/cli.py +127 -0
  9. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/config.py +200 -0
  10. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/crypto_util.py +29 -0
  11. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/django_store.py +419 -0
  12. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/forms.py +67 -0
  13. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/inventory.py +71 -0
  14. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/jobs.py +61 -0
  15. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/management/__init__.py +0 -0
  16. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/management/commands/__init__.py +0 -0
  17. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/management/commands/opennebula_sync.py +48 -0
  18. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/migrations/0001_initial.py +62 -0
  19. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/migrations/0002_site_cluster_fk.py +57 -0
  20. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/migrations/0003_remove_netbox_http_creds.py +26 -0
  21. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/migrations/__init__.py +0 -0
  22. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/models.py +115 -0
  23. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/navigation.py +23 -0
  24. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/netbox.py +213 -0
  25. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/opennebula.py +341 -0
  26. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/reconciler.py +734 -0
  27. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/rest_store.py +7 -0
  28. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/snmp.py +107 -0
  29. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/status.py +80 -0
  30. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/store.py +46 -0
  31. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/templates/netbox_opennebula_sync/settings.html +38 -0
  32. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/templates/netbox_opennebula_sync/status.html +74 -0
  33. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/urls.py +8 -0
  34. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync/views.py +81 -0
  35. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/PKG-INFO +141 -0
  36. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/SOURCES.txt +41 -0
  37. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/dependency_links.txt +1 -0
  38. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/entry_points.txt +2 -0
  39. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/requires.txt +6 -0
  40. netbox_opennebula_sync-0.3.0/src/netbox_opennebula_sync.egg-info/top_level.txt +1 -0
  41. netbox_opennebula_sync-0.3.0/tests/test_config.py +61 -0
  42. netbox_opennebula_sync-0.3.0/tests/test_opennebula.py +53 -0
  43. netbox_opennebula_sync-0.3.0/tests/test_snmp.py +69 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 netbox-opennebula-sync contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-opennebula-sync
3
+ Version: 0.3.0
4
+ Summary: NetBox plugin to discover and synchronize OpenNebula infrastructure
5
+ Author: NetBox OpenNebula Sync contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/mael-chouteau/netbox-opennebula-sync
8
+ Project-URL: Issues, https://github.com/mael-chouteau/netbox-opennebula-sync/issues
9
+ Project-URL: Documentation, https://github.com/mael-chouteau/netbox-opennebula-sync#readme
10
+ Keywords: netbox,opennebula,ipam,dcim,virtualization,plugin
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Framework :: Django
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: System :: Systems Administration
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx[socks]>=0.27
24
+ Requires-Dist: PyYAML>=6.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.6; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # netbox-opennebula-sync
31
+
32
+ [![CI](https://github.com/mael-chouteau/netbox-opennebula-sync/actions/workflows/ci.yml/badge.svg)](https://github.com/mael-chouteau/netbox-opennebula-sync/actions/workflows/ci.yml)
33
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
34
+ [![NetBox](https://img.shields.io/badge/NetBox-4.2%2B-green.svg)](https://github.com/netbox-community/netbox)
35
+
36
+ NetBox Community plugin that discovers **OpenNebula** zones, hypervisors and VMs and reconciles them into NetBox **Virtualization**, **DCIM** and **IPAM** — using the Django ORM in-process (no NetBox API token required for the plugin path).
37
+
38
+ Ideal for operators who already run OpenNebula and want NetBox as the single source of truth for guests, interfaces, MACs and IPs.
39
+
40
+ ## Features
41
+
42
+ | Area | What you get |
43
+ |------|----------------|
44
+ | **UI** | Plugins → OpenNebula → **Live Status** (ONE probe) + **Settings** |
45
+ | **Sync** | RQ job: on-demand *Sync now* + configurable interval (minutes) |
46
+ | **Mapping** | Site & Cluster picked from existing NetBox objects (dropdowns) |
47
+ | **Inventory** | Cluster type/group, hypervisors as devices, VMs, VM interfaces, virtual disks |
48
+ | **IPAM** | MAC addresses, IP assignments, optional primary IPv4, VLAN hints |
49
+ | **SNMP** | Optional SNMPv2c guest enrichment (hostname / interfaces) |
50
+ | **Safety** | Dry-run, orphan policy (`mark_offline` / `delete` / `ignore`), OpenNebula custom fields |
51
+ | **CLI** | Standalone YAML+HTTP client for remote NetBox; `manage.py opennebula_sync` for ORM |
52
+
53
+ Compatible with **NetBox 4.2+** (tested on **4.7**). License: **Apache-2.0**.
54
+
55
+ ## Screenshots
56
+
57
+ > Add screenshots of Live Status and Settings after first public release (optional).
58
+
59
+ ## Requirements
60
+
61
+ - NetBox 4.2 or newer with **netbox-rq** running
62
+ - OpenNebula XML-RPC endpoint (user with inventory read rights)
63
+ - Python 3.11+
64
+
65
+ ## Installation
66
+
67
+ ```bash
68
+ /opt/netbox/venv/bin/pip install git+https://github.com/mael-chouteau/netbox-opennebula-sync.git
69
+ ```
70
+
71
+ In `configuration.py`:
72
+
73
+ ```python
74
+ PLUGINS = [
75
+ 'netbox_opennebula_sync',
76
+ ]
77
+ ```
78
+
79
+ ```bash
80
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate netbox_opennebula_sync
81
+ sudo systemctl restart netbox netbox-rq
82
+ ```
83
+
84
+ 1. Open **Plugins → OpenNebula → Settings**
85
+ 2. Set OpenNebula endpoint, username and token
86
+ 3. Select **Site** and **Cluster** (existing NetBox objects)
87
+ 4. Save, then **Live Status → Sync now**
88
+
89
+ The plugin writes through the **Django ORM**. You do **not** configure a NetBox URL or API token in the UI.
90
+
91
+ ## Configuration reference
92
+
93
+ | Setting | Description |
94
+ |---------|-------------|
95
+ | OpenNebula endpoint / user / token | XML-RPC credentials |
96
+ | Sync interval | Minutes between automatic RQ runs |
97
+ | Orphan policy | What to do with NetBox VMs tagged `opennebula` that disappeared from ONE |
98
+ | Dry run | Log intended changes without writing |
99
+ | Site / Cluster | Target NetBox objects for synced inventory |
100
+ | DNS suffix | Appended to short guest names when needed |
101
+ | Create missing hosts | Create hypervisor devices if absent |
102
+ | SNMP | Community, ignore list, interface exclude regex |
103
+
104
+ Custom fields created on first sync: `opennebula_zone_id`, `opennebula_cluster_id`, `opennebula_host_id`, `opennebula_vm_id`, `opennebula_vm_uuid`, `opennebula_template_id`.
105
+
106
+ ## Operations
107
+
108
+ ```bash
109
+ # Same path as the RQ job (ORM)
110
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py opennebula_sync
111
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py opennebula_sync --dry-run
112
+ ```
113
+
114
+ ### Standalone CLI (remote NetBox over HTTP)
115
+
116
+ ```bash
117
+ pip install .
118
+ cp config.example.yaml config.yaml # fill NETBOX_* and ONE_*
119
+ netbox-opennebula-sync -c config.yaml bootstrap
120
+ netbox-opennebula-sync -c config.yaml sync --dry-run
121
+ ```
122
+
123
+ ## Development
124
+
125
+ ```bash
126
+ python -m venv .venv && source .venv/bin/activate
127
+ pip install -e ".[dev]"
128
+ ruff check src tests
129
+ pytest -q
130
+ ```
131
+
132
+ ## Catalog / certification
133
+
134
+ - Catalog blurb: [`docs/CATALOG_SUBMISSION.md`](docs/CATALOG_SUBMISSION.md)
135
+ - **Plugin Certification** application (email `plugincertification@netboxlabs.com`): [`docs/CERTIFICATION_SUBMISSION.md`](docs/CERTIFICATION_SUBMISSION.md)
136
+
137
+ Certification requires a published **PyPI** package plus GitHub, PyPI and NetDev Slack maintainer IDs.
138
+
139
+ ## License
140
+
141
+ Apache License 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,112 @@
1
+ # netbox-opennebula-sync
2
+
3
+ [![CI](https://github.com/mael-chouteau/netbox-opennebula-sync/actions/workflows/ci.yml/badge.svg)](https://github.com/mael-chouteau/netbox-opennebula-sync/actions/workflows/ci.yml)
4
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
5
+ [![NetBox](https://img.shields.io/badge/NetBox-4.2%2B-green.svg)](https://github.com/netbox-community/netbox)
6
+
7
+ NetBox Community plugin that discovers **OpenNebula** zones, hypervisors and VMs and reconciles them into NetBox **Virtualization**, **DCIM** and **IPAM** — using the Django ORM in-process (no NetBox API token required for the plugin path).
8
+
9
+ Ideal for operators who already run OpenNebula and want NetBox as the single source of truth for guests, interfaces, MACs and IPs.
10
+
11
+ ## Features
12
+
13
+ | Area | What you get |
14
+ |------|----------------|
15
+ | **UI** | Plugins → OpenNebula → **Live Status** (ONE probe) + **Settings** |
16
+ | **Sync** | RQ job: on-demand *Sync now* + configurable interval (minutes) |
17
+ | **Mapping** | Site & Cluster picked from existing NetBox objects (dropdowns) |
18
+ | **Inventory** | Cluster type/group, hypervisors as devices, VMs, VM interfaces, virtual disks |
19
+ | **IPAM** | MAC addresses, IP assignments, optional primary IPv4, VLAN hints |
20
+ | **SNMP** | Optional SNMPv2c guest enrichment (hostname / interfaces) |
21
+ | **Safety** | Dry-run, orphan policy (`mark_offline` / `delete` / `ignore`), OpenNebula custom fields |
22
+ | **CLI** | Standalone YAML+HTTP client for remote NetBox; `manage.py opennebula_sync` for ORM |
23
+
24
+ Compatible with **NetBox 4.2+** (tested on **4.7**). License: **Apache-2.0**.
25
+
26
+ ## Screenshots
27
+
28
+ > Add screenshots of Live Status and Settings after first public release (optional).
29
+
30
+ ## Requirements
31
+
32
+ - NetBox 4.2 or newer with **netbox-rq** running
33
+ - OpenNebula XML-RPC endpoint (user with inventory read rights)
34
+ - Python 3.11+
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ /opt/netbox/venv/bin/pip install git+https://github.com/mael-chouteau/netbox-opennebula-sync.git
40
+ ```
41
+
42
+ In `configuration.py`:
43
+
44
+ ```python
45
+ PLUGINS = [
46
+ 'netbox_opennebula_sync',
47
+ ]
48
+ ```
49
+
50
+ ```bash
51
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate netbox_opennebula_sync
52
+ sudo systemctl restart netbox netbox-rq
53
+ ```
54
+
55
+ 1. Open **Plugins → OpenNebula → Settings**
56
+ 2. Set OpenNebula endpoint, username and token
57
+ 3. Select **Site** and **Cluster** (existing NetBox objects)
58
+ 4. Save, then **Live Status → Sync now**
59
+
60
+ The plugin writes through the **Django ORM**. You do **not** configure a NetBox URL or API token in the UI.
61
+
62
+ ## Configuration reference
63
+
64
+ | Setting | Description |
65
+ |---------|-------------|
66
+ | OpenNebula endpoint / user / token | XML-RPC credentials |
67
+ | Sync interval | Minutes between automatic RQ runs |
68
+ | Orphan policy | What to do with NetBox VMs tagged `opennebula` that disappeared from ONE |
69
+ | Dry run | Log intended changes without writing |
70
+ | Site / Cluster | Target NetBox objects for synced inventory |
71
+ | DNS suffix | Appended to short guest names when needed |
72
+ | Create missing hosts | Create hypervisor devices if absent |
73
+ | SNMP | Community, ignore list, interface exclude regex |
74
+
75
+ Custom fields created on first sync: `opennebula_zone_id`, `opennebula_cluster_id`, `opennebula_host_id`, `opennebula_vm_id`, `opennebula_vm_uuid`, `opennebula_template_id`.
76
+
77
+ ## Operations
78
+
79
+ ```bash
80
+ # Same path as the RQ job (ORM)
81
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py opennebula_sync
82
+ sudo -u netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py opennebula_sync --dry-run
83
+ ```
84
+
85
+ ### Standalone CLI (remote NetBox over HTTP)
86
+
87
+ ```bash
88
+ pip install .
89
+ cp config.example.yaml config.yaml # fill NETBOX_* and ONE_*
90
+ netbox-opennebula-sync -c config.yaml bootstrap
91
+ netbox-opennebula-sync -c config.yaml sync --dry-run
92
+ ```
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ python -m venv .venv && source .venv/bin/activate
98
+ pip install -e ".[dev]"
99
+ ruff check src tests
100
+ pytest -q
101
+ ```
102
+
103
+ ## Catalog / certification
104
+
105
+ - Catalog blurb: [`docs/CATALOG_SUBMISSION.md`](docs/CATALOG_SUBMISSION.md)
106
+ - **Plugin Certification** application (email `plugincertification@netboxlabs.com`): [`docs/CERTIFICATION_SUBMISSION.md`](docs/CERTIFICATION_SUBMISSION.md)
107
+
108
+ Certification requires a published **PyPI** package plus GitHub, PyPI and NetDev Slack maintainer IDs.
109
+
110
+ ## License
111
+
112
+ Apache License 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "netbox-opennebula-sync"
7
+ version = "0.3.0"
8
+ description = "NetBox plugin to discover and synchronize OpenNebula infrastructure"
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "NetBox OpenNebula Sync contributors" }]
13
+ keywords = ["netbox", "opennebula", "ipam", "dcim", "virtualization", "plugin"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Framework :: Django",
17
+ "Intended Audience :: System Administrators",
18
+ "License :: OSI Approved :: Apache Software License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: System :: Systems Administration",
24
+ ]
25
+ dependencies = [
26
+ "httpx[socks]>=0.27",
27
+ "PyYAML>=6.0",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["pytest>=8.0", "ruff>=0.6"]
32
+
33
+ [project.scripts]
34
+ netbox-opennebula-sync = "netbox_opennebula_sync.cli:main"
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/mael-chouteau/netbox-opennebula-sync"
38
+ Issues = "https://github.com/mael-chouteau/netbox-opennebula-sync/issues"
39
+ Documentation = "https://github.com/mael-chouteau/netbox-opennebula-sync#readme"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [tool.setuptools.package-data]
45
+ netbox_opennebula_sync = [
46
+ "templates/**/*.html",
47
+ "migrations/*.py",
48
+ "management/commands/*.py",
49
+ ]
50
+
51
+ [tool.pytest.ini_options]
52
+ testpaths = ["tests"]
53
+ pythonpath = ["src"]
54
+
55
+ [tool.ruff]
56
+ line-length = 100
57
+ target-version = "py311"
58
+
59
+ [tool.ruff.lint]
60
+ select = ["E", "F", "I", "UP", "B"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,27 @@
1
+ """Synchronize OpenNebula inventory into NetBox Community (plugin + CLI)."""
2
+
3
+ __version__ = "0.3.0"
4
+
5
+ try:
6
+ from netbox.plugins import PluginConfig
7
+ except ImportError: # Standalone CLI / unit tests without NetBox
8
+ config = None
9
+ else:
10
+
11
+ class OpenNebulaSyncConfig(PluginConfig):
12
+ name = "netbox_opennebula_sync"
13
+ verbose_name = "OpenNebula Sync"
14
+ description = "Discover and synchronize OpenNebula infrastructure into NetBox"
15
+ version = __version__
16
+ author = "NetBox OpenNebula Sync contributors"
17
+ author_email = "dev@localhost"
18
+ base_url = "opennebula"
19
+ min_version = "4.2"
20
+ default_settings = {}
21
+ required_settings = []
22
+
23
+ def ready(self):
24
+ super().ready()
25
+ from . import jobs # noqa: F401
26
+
27
+ config = OpenNebulaSyncConfig
@@ -0,0 +1,49 @@
1
+ """Build standalone AppConfig from the Django plugin config model."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .config import (
6
+ DEFAULT_EXCLUDE_INTERFACES,
7
+ AppConfig,
8
+ NetBoxConfig,
9
+ OpenNebulaConfig,
10
+ SnmpConfig,
11
+ SyncConfig,
12
+ )
13
+ from .models import OpenNebulaSyncConfig
14
+
15
+
16
+ def app_config_from_db(cfg: OpenNebulaSyncConfig) -> AppConfig:
17
+ """Map plugin settings to AppConfig (no NetBox HTTP credentials)."""
18
+ one_token = cfg.get_one_token()
19
+ if not cfg.one_endpoint or not cfg.one_username or not one_token:
20
+ raise RuntimeError("OpenNebula endpoint/username/token are required")
21
+ ignore = cfg.ignore_hostnames_list()
22
+ return AppConfig(
23
+ netbox=NetBoxConfig(
24
+ site=(cfg.site.name if cfg.site_id else "default"),
25
+ site_id=cfg.site_id,
26
+ cluster_name=(cfg.cluster.name if cfg.cluster_id else None),
27
+ cluster_id=cfg.cluster_id,
28
+ create_missing_hosts=cfg.create_missing_hosts,
29
+ dns_suffix=(cfg.dns_suffix or "").lstrip("."),
30
+ timeout=float(cfg.one_timeout or 30),
31
+ ),
32
+ opennebula=OpenNebulaConfig(
33
+ endpoint=cfg.one_endpoint,
34
+ username=cfg.one_username,
35
+ token=one_token,
36
+ timeout=float(cfg.one_timeout or 30),
37
+ ),
38
+ snmp=SnmpConfig(
39
+ enabled=cfg.snmp_enabled,
40
+ community=cfg.snmp_community or "public",
41
+ ignore_hostnames=ignore,
42
+ exclude_interfaces=cfg.snmp_exclude_interfaces or DEFAULT_EXCLUDE_INTERFACES,
43
+ ),
44
+ sync=SyncConfig(
45
+ orphan_policy=cfg.orphan_policy or "mark_offline",
46
+ interval=int(cfg.sync_interval or 15) * 60,
47
+ dry_run=cfg.dry_run,
48
+ ),
49
+ )