netbox-idrac-inventory 0.2.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.
- netbox_idrac_inventory-0.2.0/LICENSE +202 -0
- netbox_idrac_inventory-0.2.0/PKG-INFO +360 -0
- netbox_idrac_inventory-0.2.0/README.md +335 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/__init__.py +59 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/api/__init__.py +0 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/api/serializers.py +167 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/api/urls.py +31 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/api/views.py +114 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/choices.py +73 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/filtersets.py +103 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/forms.py +321 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/graphql/__init__.py +0 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/graphql/schema.py +72 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/graphql/types.py +46 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/idrac/__init__.py +0 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/idrac/client.py +918 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/idrac/discovery.py +177 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/idrac/sync.py +597 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/jobs.py +165 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/migrations/0001_initial.py +100 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/migrations/__init__.py +0 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/models.py +213 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/navigation.py +81 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/signals.py +39 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tables.py +116 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/template_content.py +43 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/templates/netbox_idrac_inventory/dellcomponent.html +68 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/templates/netbox_idrac_inventory/dellscanrange.html +80 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/templates/netbox_idrac_inventory/dellserver.html +118 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/templates/netbox_idrac_inventory/dellserver_list.html +11 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/templates/netbox_idrac_inventory/device_extension.html +63 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/__init__.py +0 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_api.py +293 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_discovery.py +147 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_forms.py +149 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_idrac.py +552 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_models.py +163 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_utils.py +94 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/tests/test_views.py +43 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/urls.py +177 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/utils.py +180 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory/views.py +197 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory.egg-info/PKG-INFO +360 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory.egg-info/SOURCES.txt +47 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory.egg-info/dependency_links.txt +1 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory.egg-info/requires.txt +6 -0
- netbox_idrac_inventory-0.2.0/netbox_idrac_inventory.egg-info/top_level.txt +1 -0
- netbox_idrac_inventory-0.2.0/pyproject.toml +58 -0
- netbox_idrac_inventory-0.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-idrac-inventory
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: NetBox plugin to synchronize Dell servers with NetBox via iDRAC Redfish
|
|
5
|
+
Author-email: Thomas Le Gentil <thomas.legentil@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/kifeo/netbox-idrac-inventory
|
|
8
|
+
Keywords: netbox,netbox-plugin,dell,idrac,redfish
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: sushy>=5.0.0
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: pytest; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-django; extra == "test"
|
|
23
|
+
Requires-Dist: responses; extra == "test"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# NetBox iDRAC Inventory Plugin
|
|
27
|
+
|
|
28
|
+
A [NetBox](https://netbox.dev) plugin that synchronizes Dell PowerEdge server
|
|
29
|
+
hardware inventory into NetBox by querying each server's iDRAC management
|
|
30
|
+
interface via the Redfish API.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **One-to-one Dell server record** linked to a NetBox Device. Adding a Dell
|
|
37
|
+
server creates the Device for you (its name defaults to the host part of the
|
|
38
|
+
iDRAC FQDN); the record stores the iDRAC address, service tag, BIOS version
|
|
39
|
+
and iDRAC firmware. The device type is set from the iDRAC-reported model on
|
|
40
|
+
the first sync.
|
|
41
|
+
- **Hardware component inventory** — CPUs, DIMMs, disks, storage controllers
|
|
42
|
+
and power supplies are discovered and stored as `DellComponent` objects.
|
|
43
|
+
- **Health status** — the iDRAC `Status.Health` of the server (rolled up) and
|
|
44
|
+
of each component is mapped to a colored `health` badge (OK / Warning /
|
|
45
|
+
Critical), so a failed PSU or disk is visible at a glance and filterable.
|
|
46
|
+
- **iDRAC management IP** — the iDRAC's own NIC is modelled as a mgmt-only
|
|
47
|
+
`iDRAC` interface (with its MAC), the iDRAC IPv4 is created in IPAM and set
|
|
48
|
+
as the device's **out-of-band IP** (`oob_ip`).
|
|
49
|
+
- **Native network modelling** — each physical network adapter is created as a
|
|
50
|
+
NetBox `Module` (with a matching `ModuleType`) installed in a `ModuleBay` on
|
|
51
|
+
the device, and each physical port becomes an `Interface` with its MAC
|
|
52
|
+
address and link speed.
|
|
53
|
+
- **LLDP discovery** — the LLDP neighbour reported by iDRAC for each connected
|
|
54
|
+
port (remote switch + remote port) is stored in the `lldp_remote_chassis`
|
|
55
|
+
and `lldp_remote_port` custom fields on the interface. These custom fields
|
|
56
|
+
are created automatically on first migrate.
|
|
57
|
+
- **Firmware inventory** — the Redfish `UpdateService/FirmwareInventory` is
|
|
58
|
+
read on each sync and the installed version is written to matching
|
|
59
|
+
components (by FQDD), covering parts whose own resource omits a version.
|
|
60
|
+
- **Sync-on-demand** — trigger a sync from the NetBox UI (single server or a
|
|
61
|
+
bulk *Sync from iDRAC* action on the server list) or via the REST API
|
|
62
|
+
(`POST .../servers/<id>/sync/`); sync runs as a background job.
|
|
63
|
+
- **Scheduled sync** — set `sync_interval_minutes` > 0 to register a recurring
|
|
64
|
+
system job that fans out one sync job per Dell server, so the RQ workers
|
|
65
|
+
run them in parallel and one unreachable iDRAC never stalls the fleet.
|
|
66
|
+
- **Network discovery** — define a **Scan Range** (CIDR / range / hosts); a
|
|
67
|
+
discovery job probes each iDRAC and imports it, attaching to an existing
|
|
68
|
+
device with the same service tag when one exists (no duplicate) or creating
|
|
69
|
+
a new one.
|
|
70
|
+
- **Full REST API** at `/api/plugins/idrac-inventory/` (servers + components).
|
|
71
|
+
- **GraphQL** queries `dell_server` / `dell_server_list` /
|
|
72
|
+
`dell_component` / `dell_component_list` exposed through NetBox's Strawberry
|
|
73
|
+
schema.
|
|
74
|
+
- **Credentials** — a global iDRAC password comes from `PLUGINS_CONFIG` /
|
|
75
|
+
environment; an optional **per-device password** (when machines differ) is
|
|
76
|
+
stored **encrypted at rest** (Fernet, keyed on NetBox `SECRET_KEY`) and is
|
|
77
|
+
never returned by the API.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Compatibility
|
|
82
|
+
|
|
83
|
+
| Plugin version | NetBox version |
|
|
84
|
+
|----------------|---------------|
|
|
85
|
+
| 0.2.x | 4.1 – 4.6 |
|
|
86
|
+
| 0.1.x | 4.1 or later |
|
|
87
|
+
|
|
88
|
+
NetBox 4.6+ requires `API_TOKEN_PEPPERS` in your NetBox configuration (a
|
|
89
|
+
core NetBox requirement, not a plugin one).
|
|
90
|
+
|
|
91
|
+
Requires Python 3.10+.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
### 1. Install the package
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install netbox-idrac-inventory
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Add to `configuration.py`
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
PLUGINS = [
|
|
107
|
+
"netbox_idrac_inventory",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
PLUGINS_CONFIG = {
|
|
111
|
+
"netbox_idrac_inventory": {
|
|
112
|
+
# iDRAC credentials used when a DellServer has no per-device username set.
|
|
113
|
+
"idrac_default_username": "root",
|
|
114
|
+
# Prefer setting the password via an environment variable rather than
|
|
115
|
+
# committing it to the config file. The plugin checks the env var
|
|
116
|
+
# IDRAC_DEFAULT_PASSWORD before falling back to this value.
|
|
117
|
+
"idrac_default_password": "",
|
|
118
|
+
# Set to True (and provide a valid CA bundle) in production.
|
|
119
|
+
"idrac_verify_ssl": False,
|
|
120
|
+
# HTTP request timeout in seconds for iDRAC Redfish calls.
|
|
121
|
+
"idrac_timeout": 30,
|
|
122
|
+
# When True, the sync writes the iDRAC service tag to Device.serial
|
|
123
|
+
# in NetBox so the physical device record stays up to date.
|
|
124
|
+
"update_device_serial": True,
|
|
125
|
+
# When True, the sync creates a mgmt-only "iDRAC" interface with the
|
|
126
|
+
# iDRAC IP and sets it as the device's out-of-band IP.
|
|
127
|
+
"manage_idrac_interface": True,
|
|
128
|
+
# Minutes between automatic syncs of every Dell server (0 = disabled,
|
|
129
|
+
# sync stays manual). Read at worker startup — restart the RQ worker
|
|
130
|
+
# after changing it.
|
|
131
|
+
"sync_interval_minutes": 0,
|
|
132
|
+
# Optional list of prefixes that iDRAC addresses and scan targets
|
|
133
|
+
# must fall within, e.g. ["10.116.0.0/16"]. Empty = no restriction.
|
|
134
|
+
# Strongly recommended: see "Credentials and security" below.
|
|
135
|
+
"allowed_networks": [],
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 3. Apply database migrations
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python manage.py migrate
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Usage
|
|
149
|
+
|
|
150
|
+
### Add a Dell server
|
|
151
|
+
|
|
152
|
+
Two ways:
|
|
153
|
+
|
|
154
|
+
- **From scratch** — go to **Plugins → iDRAC Inventory → Dell Servers → Add**.
|
|
155
|
+
Enter the iDRAC address, a device **name** (left blank, it defaults to the
|
|
156
|
+
host part of the iDRAC FQDN, e.g. `host01.ipmi.example.com` → `host01`), a
|
|
157
|
+
**site** and a **role**. The plugin creates the Device (with a placeholder
|
|
158
|
+
device type, replaced by the real model on the first sync) and links it.
|
|
159
|
+
- **From an existing device** — on a Device page, use the **iDRAC Inventory**
|
|
160
|
+
panel's *Add* button; the new record is attached to that device instead of
|
|
161
|
+
creating a new one.
|
|
162
|
+
|
|
163
|
+
Optionally set a per-device iDRAC username; otherwise the plugin default is
|
|
164
|
+
used.
|
|
165
|
+
|
|
166
|
+
### Trigger a sync
|
|
167
|
+
|
|
168
|
+
- **UI**: open the DellServer (or its Device) page and click **Sync from
|
|
169
|
+
iDRAC**. The sync runs as a NetBox background job; refresh to see the result
|
|
170
|
+
in `sync_status` / `sync_message`.
|
|
171
|
+
- **REST API**:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
curl -X POST \
|
|
175
|
+
-H "Authorization: Token <your-token>" \
|
|
176
|
+
https://netbox.example.com/api/plugins/idrac-inventory/servers/42/sync/
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Returns `HTTP 202` with the background job ID:
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"job_id": 123,
|
|
184
|
+
"job_url": "https://netbox.example.com/api/core/jobs/123/",
|
|
185
|
+
"message": "Sync job enqueued for my-server-01 (SVC00042)."
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Triggering a sync requires the *change* permission on Dell servers (on
|
|
190
|
+
top of NetBox's standard POST-to-add API permission mapping).
|
|
191
|
+
|
|
192
|
+
### Discover servers from a range
|
|
193
|
+
|
|
194
|
+
Under **Plugins → iDRAC Inventory → Scan Ranges → Add**, define one or more
|
|
195
|
+
targets (one per line or comma-separated): a CIDR (`10.0.0.0/24`), a range
|
|
196
|
+
(`10.0.0.10-20`) or single hosts, plus the site and role for created devices.
|
|
197
|
+
Click **Run scan** (or `POST .../scan-ranges/<id>/run/`). For each reachable
|
|
198
|
+
iDRAC the discovery attaches to an existing device with the same service tag,
|
|
199
|
+
or creates one, then syncs it.
|
|
200
|
+
|
|
201
|
+
### REST API overview
|
|
202
|
+
|
|
203
|
+
Base path: `/api/plugins/idrac-inventory/`
|
|
204
|
+
|
|
205
|
+
| Method | Endpoint | Description |
|
|
206
|
+
|--------|-----------------------------------|-----------------------------|
|
|
207
|
+
| GET | `/servers/` | List all Dell servers |
|
|
208
|
+
| POST | `/servers/` | Create a Dell server record |
|
|
209
|
+
| GET | `/servers/<id>/` | Retrieve a Dell server |
|
|
210
|
+
| PATCH | `/servers/<id>/` | Update a Dell server |
|
|
211
|
+
| DELETE | `/servers/<id>/` | Delete a Dell server |
|
|
212
|
+
| POST | `/servers/<id>/sync/` | Enqueue an iDRAC sync job |
|
|
213
|
+
| GET | `/components/` | List all components |
|
|
214
|
+
| GET | `/components/<id>/` | Retrieve a component |
|
|
215
|
+
| GET/POST | `/scan-ranges/` | List / create scan ranges |
|
|
216
|
+
| POST | `/scan-ranges/<id>/run/` | Enqueue a discovery job |
|
|
217
|
+
|
|
218
|
+
The per-device / per-range `idrac_password` can be **set** via POST/PATCH; it
|
|
219
|
+
is write-only (encrypted before storage, never present in any response) and a
|
|
220
|
+
blank or absent value keeps the stored one.
|
|
221
|
+
|
|
222
|
+
Full OpenAPI schema is available at `/api/schema/` in your NetBox instance.
|
|
223
|
+
|
|
224
|
+
### GraphQL
|
|
225
|
+
|
|
226
|
+
```graphql
|
|
227
|
+
query {
|
|
228
|
+
dell_server_list {
|
|
229
|
+
id
|
|
230
|
+
service_tag
|
|
231
|
+
model
|
|
232
|
+
sync_status
|
|
233
|
+
device { name }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
query {
|
|
238
|
+
dell_server(id: 42) {
|
|
239
|
+
bios_version
|
|
240
|
+
idrac_firmware
|
|
241
|
+
last_synced
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Credentials and security
|
|
249
|
+
|
|
250
|
+
- At sync time the plugin resolves the password in this order:
|
|
251
|
+
1. The **per-device** `idrac_password` (or a scan range's), when set.
|
|
252
|
+
2. Environment variable `IDRAC_DEFAULT_PASSWORD` (recommended default for
|
|
253
|
+
production — set it in your process manager / secrets manager).
|
|
254
|
+
3. `PLUGINS_CONFIG["netbox_idrac_inventory"]["idrac_default_password"]`.
|
|
255
|
+
- **Per-device password** — when servers don't share one password, set it on
|
|
256
|
+
the DellServer (or scan range). It is **encrypted at rest** with a key
|
|
257
|
+
derived from NetBox's `SECRET_KEY` (Fernet), is write-only in the form and
|
|
258
|
+
the API, and is never returned by the REST or GraphQL API. If you only have
|
|
259
|
+
one shared password, leave these blank and use the global default above.
|
|
260
|
+
- **`SECRET_KEY` rotation** — rotate per Django's documented procedure (put
|
|
261
|
+
the old key in `SECRET_KEY_FALLBACKS`) and stored passwords keep working.
|
|
262
|
+
If a stored password can no longer be decrypted, the sync **fails with a
|
|
263
|
+
clear message** instead of silently retrying with the global default (which
|
|
264
|
+
could trip the iDRAC's account lockout); re-enter the password to recover.
|
|
265
|
+
- The per-device `idrac_username` overrides `idrac_default_username` likewise.
|
|
266
|
+
- In production, set `idrac_verify_ssl: true` and provide a trusted CA bundle
|
|
267
|
+
so TLS certificates are validated.
|
|
268
|
+
|
|
269
|
+
### Restricting where syncs may connect
|
|
270
|
+
|
|
271
|
+
Anyone with *change* permission on Dell servers or scan ranges chooses which
|
|
272
|
+
address the plugin connects to — and the sync presents the configured iDRAC
|
|
273
|
+
credentials to that address. A malicious or compromised account could point a
|
|
274
|
+
record at a host it controls and capture the global default password. To
|
|
275
|
+
contain this:
|
|
276
|
+
|
|
277
|
+
- set `allowed_networks` to the management prefixes your iDRACs live in;
|
|
278
|
+
syncs and scans to any address (or DNS name resolving) outside them are
|
|
279
|
+
refused;
|
|
280
|
+
- grant `change_dellserver` / `change_dellscanrange` sparingly, like any
|
|
281
|
+
credential-bearing automation;
|
|
282
|
+
- enable `idrac_verify_ssl` so credentials are never sent over unverified
|
|
283
|
+
TLS.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Development
|
|
288
|
+
|
|
289
|
+
### Quick start with Docker
|
|
290
|
+
|
|
291
|
+
A self-contained NetBox stack (NetBox + worker + Postgres + Redis) with the
|
|
292
|
+
plugin pre-installed lives under [`dev/`](dev/). See [`dev/README.md`](dev/README.md):
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
cd dev
|
|
296
|
+
cp .env.example .env # set IDRAC_USERNAME / IDRAC_PASSWORD
|
|
297
|
+
docker compose up --build # NetBox at http://localhost:8000 (admin / admin)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Migrations
|
|
301
|
+
|
|
302
|
+
The plugin **ships its schema migration** (`migrations/0001_initial.py`), so a
|
|
303
|
+
plain `python manage.py migrate` is all that is needed. The LLDP custom fields
|
|
304
|
+
on `dcim.Interface` are **not** a migration — they are created idempotently by
|
|
305
|
+
a `post_migrate` signal (see `signals.py`) so they stay correct across NetBox
|
|
306
|
+
versions. If you change the models, regenerate with
|
|
307
|
+
`python manage.py makemigrations netbox_idrac_inventory` and commit the result.
|
|
308
|
+
|
|
309
|
+
### Running tests
|
|
310
|
+
|
|
311
|
+
Tests must run inside the NetBox Django environment:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# From the NetBox source root with the plugin installed:
|
|
315
|
+
python manage.py test netbox_idrac_inventory
|
|
316
|
+
# or, with the dev stack running:
|
|
317
|
+
docker compose exec netbox \
|
|
318
|
+
/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test netbox_idrac_inventory
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Project layout
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
netbox_idrac_inventory/
|
|
325
|
+
api/
|
|
326
|
+
serializers.py # NetBoxModelSerializer subclasses
|
|
327
|
+
views.py # NetBoxModelViewSet subclasses + sync action
|
|
328
|
+
urls.py # NetBoxRouter registration
|
|
329
|
+
graphql/
|
|
330
|
+
types.py # Strawberry-django type definitions
|
|
331
|
+
schema.py # Root query class + schema list
|
|
332
|
+
idrac/
|
|
333
|
+
client.py # IdracClient — Redfish wrapper (sushy), plain dicts
|
|
334
|
+
sync.py # sync_server() — iDRAC -> NetBox reconcile logic
|
|
335
|
+
discovery.py # discover_range() — scan a range and import iDRACs
|
|
336
|
+
migrations/
|
|
337
|
+
0001_initial.py # DellServer / DellComponent schema
|
|
338
|
+
templates/netbox_idrac_inventory/ # detail pages + Device-page panel
|
|
339
|
+
tests/
|
|
340
|
+
test_models.py # Model unit tests
|
|
341
|
+
test_idrac.py # Sync engine + network/LLDP tests (fake client)
|
|
342
|
+
test_api.py # REST API tests (NetBox APIViewTestCases)
|
|
343
|
+
test_forms.py # Device-creating form + password handling
|
|
344
|
+
test_discovery.py # Target expansion + discovery engine
|
|
345
|
+
test_utils.py # Address helpers + encryption fail-closed
|
|
346
|
+
test_views.py # Bulk sync action
|
|
347
|
+
__init__.py # PluginConfig (settings) + post_migrate hook
|
|
348
|
+
choices.py # SyncStatusChoices, ComponentTypeChoices
|
|
349
|
+
models.py # DellServer, DellComponent, DellScanRange
|
|
350
|
+
forms.py # Forms (DellServerForm creates/links the Device)
|
|
351
|
+
tables.py # DellServerTable, DellComponentTable
|
|
352
|
+
filtersets.py # DellServerFilterSet, DellComponentFilterSet
|
|
353
|
+
views.py # CRUD views + DellServerSyncView
|
|
354
|
+
urls.py # UI URL routes
|
|
355
|
+
navigation.py # Plugin menu
|
|
356
|
+
template_content.py # Dell panel on the Device page
|
|
357
|
+
jobs.py # DellSyncJob + enqueue_sync()
|
|
358
|
+
signals.py # post_migrate: create LLDP custom fields
|
|
359
|
+
utils.py # default_device_name(), get_or_create_manufacturer()
|
|
360
|
+
```
|