netbox-pdu-control 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.
Files changed (61) hide show
  1. netbox_pdu_control-0.2.0/CONTRIBUTING.md +121 -0
  2. netbox_pdu_control-0.2.0/LICENSE +200 -0
  3. netbox_pdu_control-0.2.0/MANIFEST.in +11 -0
  4. netbox_pdu_control-0.2.0/PKG-INFO +524 -0
  5. netbox_pdu_control-0.2.0/README.md +488 -0
  6. netbox_pdu_control-0.2.0/netbox_pdu_control/__init__.py +56 -0
  7. netbox_pdu_control-0.2.0/netbox_pdu_control/api/__init__.py +6 -0
  8. netbox_pdu_control-0.2.0/netbox_pdu_control/api/serializers.py +101 -0
  9. netbox_pdu_control-0.2.0/netbox_pdu_control/api/urls.py +12 -0
  10. netbox_pdu_control-0.2.0/netbox_pdu_control/api/views.py +23 -0
  11. netbox_pdu_control-0.2.0/netbox_pdu_control/backends/__init__.py +25 -0
  12. netbox_pdu_control-0.2.0/netbox_pdu_control/backends/base.py +139 -0
  13. netbox_pdu_control-0.2.0/netbox_pdu_control/backends/raritan.py +709 -0
  14. netbox_pdu_control-0.2.0/netbox_pdu_control/backends/unifi.py +351 -0
  15. netbox_pdu_control-0.2.0/netbox_pdu_control/choices.py +55 -0
  16. netbox_pdu_control-0.2.0/netbox_pdu_control/filtersets.py +58 -0
  17. netbox_pdu_control-0.2.0/netbox_pdu_control/forms.py +142 -0
  18. netbox_pdu_control-0.2.0/netbox_pdu_control/graphql/__init__.py +3 -0
  19. netbox_pdu_control-0.2.0/netbox_pdu_control/graphql/enums.py +6 -0
  20. netbox_pdu_control-0.2.0/netbox_pdu_control/graphql/filters.py +37 -0
  21. netbox_pdu_control-0.2.0/netbox_pdu_control/graphql/schema.py +14 -0
  22. netbox_pdu_control-0.2.0/netbox_pdu_control/graphql/types.py +28 -0
  23. netbox_pdu_control-0.2.0/netbox_pdu_control/jobs.py +370 -0
  24. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0001_initial.py +179 -0
  25. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0002_managedpdu_last_metrics_fetched.py +17 -0
  26. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0003_pduinlet_poleline_l1_current_a_and_more.py +100 -0
  27. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0004_pduoutlet_apparent_power_va.py +20 -0
  28. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0005_managedpdu_metrics_status.py +24 -0
  29. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0006_managedpdu_pdu_name_alter_managedpdu_verify_ssl.py +31 -0
  30. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/0007_managedpdu_sync_metrics_enabled.py +28 -0
  31. netbox_pdu_control-0.2.0/netbox_pdu_control/migrations/__init__.py +7 -0
  32. netbox_pdu_control-0.2.0/netbox_pdu_control/models.py +619 -0
  33. netbox_pdu_control-0.2.0/netbox_pdu_control/navigation.py +60 -0
  34. netbox_pdu_control-0.2.0/netbox_pdu_control/search.py +23 -0
  35. netbox_pdu_control-0.2.0/netbox_pdu_control/tables.py +254 -0
  36. netbox_pdu_control-0.2.0/netbox_pdu_control/template_content.py +29 -0
  37. netbox_pdu_control-0.2.0/netbox_pdu_control/templates/netbox_pdu_control/inc/device_pdu_button.html +3 -0
  38. netbox_pdu_control-0.2.0/netbox_pdu_control/templates/netbox_pdu_control/inc/device_pdu_outlets.html +11 -0
  39. netbox_pdu_control-0.2.0/netbox_pdu_control/templates/netbox_pdu_control/managedpdu.html +307 -0
  40. netbox_pdu_control-0.2.0/netbox_pdu_control/templates/netbox_pdu_control/pduinlet.html +228 -0
  41. netbox_pdu_control-0.2.0/netbox_pdu_control/templates/netbox_pdu_control/pduoutlet.html +166 -0
  42. netbox_pdu_control-0.2.0/netbox_pdu_control/testing/__init__.py +421 -0
  43. netbox_pdu_control-0.2.0/netbox_pdu_control/testing/utils.py +339 -0
  44. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/__init__.py +6 -0
  45. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_api.py +117 -0
  46. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_backends_raritan.py +1121 -0
  47. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_backends_unifi.py +793 -0
  48. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_factory.py +96 -0
  49. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_graphql.py +94 -0
  50. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_models.py +184 -0
  51. netbox_pdu_control-0.2.0/netbox_pdu_control/tests/test_views.py +470 -0
  52. netbox_pdu_control-0.2.0/netbox_pdu_control/urls.py +84 -0
  53. netbox_pdu_control-0.2.0/netbox_pdu_control/views.py +518 -0
  54. netbox_pdu_control-0.2.0/netbox_pdu_control.egg-info/PKG-INFO +524 -0
  55. netbox_pdu_control-0.2.0/netbox_pdu_control.egg-info/SOURCES.txt +59 -0
  56. netbox_pdu_control-0.2.0/netbox_pdu_control.egg-info/dependency_links.txt +1 -0
  57. netbox_pdu_control-0.2.0/netbox_pdu_control.egg-info/requires.txt +11 -0
  58. netbox_pdu_control-0.2.0/netbox_pdu_control.egg-info/top_level.txt +1 -0
  59. netbox_pdu_control-0.2.0/pyproject.toml +92 -0
  60. netbox_pdu_control-0.2.0/setup.cfg +4 -0
  61. netbox_pdu_control-0.2.0/tests/__init__.py +1 -0
@@ -0,0 +1,121 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome, and they are greatly appreciated! Every little bit
4
+ helps, and credit will always be given.
5
+
6
+ We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
7
+
8
+ - Reporting a bug
9
+ - Discussing the current state of the code
10
+ - Submitting a fix
11
+ - Proposing new features
12
+ - Becoming a maintainer
13
+
14
+ ## General Tips for Working on GitHub
15
+
16
+ * Register for a free [GitHub account](https://github.com/signup) if you haven't already.
17
+ * You can use [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for formatting text and adding images.
18
+ * To help mitigate notification spam, please avoid "bumping" issues with no activity. (To vote an issue up or down, use a :thumbsup: or :thumbsdown: reaction.)
19
+ * Please avoid pinging members with `@` unless they've previously expressed interest or involvement with that particular issue.
20
+ * Familiarize yourself with [this list of discussion anti-patterns](https://github.com/bradfitz/issue-tracker-behaviors) and make every effort to avoid them.
21
+
22
+ ## Types of Contributions
23
+
24
+ ### Report Bugs
25
+
26
+ Report bugs at https://github.com/tak-labo/netbox-pdu-control/issues.
27
+
28
+ If you are reporting a bug, please include:
29
+
30
+ * Your operating system name and version.
31
+ * Any details about your local setup that might be helpful in troubleshooting.
32
+ * Detailed steps to reproduce the bug.
33
+
34
+ ### Fix Bugs
35
+
36
+ Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
37
+ wanted" is open to whoever wants to implement it.
38
+
39
+ ### Implement Features
40
+
41
+ Look through the GitHub issues for features. Anything tagged with "enhancement"
42
+ and "help wanted" is open to whoever wants to implement it.
43
+
44
+ ### Write Documentation
45
+
46
+ NetBox PDU Plugin could always use more documentation, whether as part of the
47
+ official NetBox PDU Plugin docs, in docstrings, or even on the web in blog posts,
48
+ articles, and such.
49
+
50
+ ### Submit Feedback
51
+
52
+ The best way to send feedback is to file an issue at https://github.com/tak-labo/netbox-pdu-control/issues.
53
+
54
+ If you are proposing a feature:
55
+
56
+ * Explain in detail how it would work.
57
+ * Keep the scope as narrow as possible, to make it easier to implement.
58
+ * Remember that this is a volunteer-driven project, and that contributions
59
+ are welcome :)
60
+
61
+ ## Get Started!
62
+
63
+ Ready to contribute? Here's how to set up `netbox-pdu-control` for local development.
64
+
65
+ 1. Fork the `netbox-pdu-control` repo on GitHub.
66
+ 2. Clone your fork locally
67
+
68
+ ```
69
+ $ git clone git@github.com:your_name_here/netbox-pdu-control.git
70
+ ```
71
+
72
+ 3. Activate the NetBox virtual environment (see the NetBox documentation under [Setting up a Development Environment](https://docs.netbox.dev/en/stable/development/getting-started/)):
73
+
74
+ ```
75
+ $ source ~/.venv/netbox/bin/activate
76
+ ```
77
+
78
+ 4. Add the plugin to NetBox virtual environment in Develop mode (see [Plugins Development](https://docs.netbox.dev/en/stable/plugins/development/)):
79
+
80
+ To ease development, it is recommended to go ahead and install the plugin at this point using setuptools' develop mode. This will create symbolic links within your Python environment to the plugin development directory. Call setup.py from the plugin's root directory with the develop argument (instead of install):
81
+
82
+ ```
83
+ $ python setup.py develop
84
+ ```
85
+
86
+ 5. Create a branch for local development:
87
+
88
+ ```
89
+ $ git checkout -b name-of-your-bugfix-or-feature
90
+ ```
91
+
92
+ Now you can make your changes locally.
93
+
94
+ 6. Commit your changes and push your branch to GitHub:
95
+
96
+ ```
97
+ $ git add .
98
+ $ git commit -m "Your detailed description of your changes."
99
+ $ git push origin name-of-your-bugfix-or-feature
100
+ ```
101
+
102
+ 7. Submit a pull request through the GitHub website.
103
+
104
+ ## Pull Request Guidelines
105
+
106
+ Before you submit a pull request, check that it meets these guidelines:
107
+
108
+ 1. The pull request should include tests.
109
+ 2. If the pull request adds functionality, the docs should be updated. Put
110
+ your new functionality into a function with a docstring, and add the
111
+ feature to the list in README.md.
112
+ 3. The pull request should work for Python 3.12, 3.13, and 3.14. Check
113
+ https://github.com/tak-labo/netbox-pdu-control/actions
114
+ and make sure that the tests pass for all supported Python versions.
115
+
116
+
117
+ ## Deploying
118
+
119
+ A reminder for the maintainers on how to deploy.
120
+ Make sure all your changes are committed (including an entry in CHANGELOG.md) and that all tests pass.
121
+ Then in the github project go to `Releases` and create a new release with a new tag. This will automatically upload the release to pypi:
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://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 by
79
+ such Contributor that are necessarily infringed by their Contribution(s)
80
+ alone or by combination of their Contribution(s) with the Work to which
81
+ such Contribution(s) was submitted. If You institute patent litigation
82
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
83
+ alleging that the Work or a Contribution incorporated within the Work
84
+ constitutes direct or contributory patent infringement, then any patent
85
+ licenses granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the Work
89
+ or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You meet
91
+ the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+
188
+ Copyright [yyyy] [name of copyright owner]
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,11 @@
1
+ include CONTRIBUTING.md
2
+ include LICENSE
3
+ include README.md
4
+
5
+ recursive-include tests *
6
+ recursive-exclude * __pycache__
7
+ recursive-exclude * *.py[co]
8
+
9
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
10
+
11
+ graft templates