netbox-load-balancing 1.0.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_load_balancing-1.0.0/LICENSE +21 -0
- netbox_load_balancing-1.0.0/PKG-INFO +104 -0
- netbox_load_balancing-1.0.0/README.md +88 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/__init__.py +25 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/__init__.py +0 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializers.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/__init__.py +0 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/health_monitor.py +121 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/lbservice.py +85 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/listener.py +66 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/member.py +92 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/serializsers_/pool.py +123 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/urls.py +30 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/api/views.py +97 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/apps.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/choices/__init__.py +1 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/choices/choices.py +91 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/constants/__init__.py +1 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/constants/constants.py +22 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/__init__.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/health_monitor.py +106 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/lbservice.py +69 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/listener.py +66 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/member.py +107 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/filtersets/pool.py +105 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/__init__.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/health_monitor.py +275 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/lbservice.py +141 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/listener.py +409 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/member.py +164 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/forms/pool.py +274 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/graphql/__init__.py +15 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/graphql/filters.py +49 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/graphql/schema.py +60 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/graphql/types.py +110 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/migrations/0001_initial.py +672 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/migrations/__init__.py +0 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/mixins/__init__.py +0 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/__init__.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/health_monitor.py +182 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/lbservice.py +103 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/listener.py +126 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/member.py +121 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/models/pool.py +152 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/navigation.py +137 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/__init__.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/health_monitor.py +79 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/lbservice.py +56 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/listener.py +52 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/member.py +57 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/tables/pool.py +63 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/template_content.py +154 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/assignments/member.html +25 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/assignments/monitor.html +25 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/assignments/pool.html +25 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/assignments/service.html +25 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/healthmonitor.html +79 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/lbservice.html +51 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/listener.html +84 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/member.html +44 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/templates/netbox_load_balancing/pool.html +70 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/urls.py +104 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/version.py +1 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/__init__.py +5 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/health_monitor.py +113 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/lbservice.py +113 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/listener.py +79 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/member.py +113 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing/views/pool.py +119 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing.egg-info/PKG-INFO +104 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing.egg-info/SOURCES.txt +73 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing.egg-info/dependency_links.txt +1 -0
- netbox_load_balancing-1.0.0/netbox_load_balancing.egg-info/top_level.txt +3 -0
- netbox_load_balancing-1.0.0/pyproject.toml +32 -0
- netbox_load_balancing-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Andy Wilson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-load-balancing
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: NetBox Load Balancing is a NetBox plugin that models a Load Balancing service based on the OpenStack SLB modelling
|
|
5
|
+
Author-email: Andy Wilson <andy@shady.org>
|
|
6
|
+
Project-URL: Homepage, https://github.com/andy-shady-org/netbox-load-balancing
|
|
7
|
+
Project-URL: Documentation, https://github.com/andy-shady-org/netbox-load-balancing/blob/main/README.md
|
|
8
|
+
Project-URL: Repository, https://github.com/andy-shady-org/netbox-load-balancing
|
|
9
|
+
Project-URL: Issues, https://github.com/andy-shady-org/netbox-load-balancing/issues
|
|
10
|
+
Keywords: netbox,netbox-plugin,load-balancing
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# NetBox Load Balancing Plugin
|
|
18
|
+
[Netbox](https://github.com/netbox-community/netbox) plugin for Load Balancing related objects documentation.
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
<a href="https://pypi.org/project/netbox-load-balancing/"><img src="https://img.shields.io/pypi/v/netbox-load-balancing" alt="PyPi"/></a>
|
|
22
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/stargazers"><img src="https://img.shields.io/github/stars/andy-shady-org/netbox-load-balancing?style=flat" alt="Stars Badge"/></a>
|
|
23
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/network/members"><img src="https://img.shields.io/github/forks/andy-shady-org/netbox-load-balancing?style=flat" alt="Forks Badge"/></a>
|
|
24
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/issues"><img src="https://img.shields.io/github/issues/andy-shady-org/netbox-load-balancing" alt="Issues Badge"/></a>
|
|
25
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/pulls"><img src="https://img.shields.io/github/issues-pr/andy-shady-org/netbox-load-balancing" alt="Pull Requests Badge"/></a>
|
|
26
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/andy-shady-org/netbox-load-balancing?color=2b9348"></a>
|
|
27
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/blob/master/LICENSE"><img src="https://img.shields.io/github/license/andy-shady-org/netbox-load-balancing?color=2b9348" alt="License Badge"/></a>
|
|
28
|
+
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"/></a>
|
|
29
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads" src="https://static.pepy.tech/badge/netbox-load-balancing"></a>
|
|
30
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads/Week" src="https://static.pepy.tech/badge/netbox-load-balancing/month"></a>
|
|
31
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads/Month" src="https://static.pepy.tech/badge/netbox-load-balancing/week"></a>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
This plugin is based on the OpenStack modelling of [LBaaS](https://docs.openstack.org/mitaka/networking-guide/config-lbaas.html)
|
|
38
|
+
|
|
39
|
+
This plugin provides following Models:
|
|
40
|
+
|
|
41
|
+
* Services
|
|
42
|
+
* Listeners
|
|
43
|
+
* Health Monitors
|
|
44
|
+
* Pools
|
|
45
|
+
* Members
|
|
46
|
+
|
|
47
|
+
## Compatibility
|
|
48
|
+
|
|
49
|
+
| | |
|
|
50
|
+
|------------|-----------|
|
|
51
|
+
| NetBox 4.2 | \>= 1.0.2 |
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
The plugin is available as a Python package in pypi and can be installed with pip
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
pip install netbox-load-balancing
|
|
59
|
+
```
|
|
60
|
+
Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
|
|
61
|
+
```
|
|
62
|
+
PLUGINS = ['netbox_load_balancing']
|
|
63
|
+
```
|
|
64
|
+
Restart NetBox and add `netbox-load-balancing` to your local_requirements.txt
|
|
65
|
+
|
|
66
|
+
Perform database migrations:
|
|
67
|
+
```bash
|
|
68
|
+
cd /opt/netbox
|
|
69
|
+
source venv/bin/activate
|
|
70
|
+
python ./netbox/manage.py migrate netbox_load_balancing
|
|
71
|
+
python ./netbox/manage.py reindex netbox_load_balancing
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Full documentation on using plugins with NetBox: [Using Plugins - NetBox Documentation](https://netbox.readthedocs.io/en/stable/plugins/)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Configuration
|
|
78
|
+
|
|
79
|
+
The following options are available:
|
|
80
|
+
* `service_ext_page`: String (default left) Service related objects table position. The following values are available:
|
|
81
|
+
left, right, full_width. Set empty value for disable.
|
|
82
|
+
* `pool_ext_page`: String (default left) Pool related objects table position. The following values are available:
|
|
83
|
+
left, right, full_width. Set empty value for disable.
|
|
84
|
+
* `member_ext_page`: String (default left) Member related objects table position. The following values are available:
|
|
85
|
+
left, right, full_width. Set empty value for disable.
|
|
86
|
+
* `monitor_ext_page`: String (default left) Health Monitor related objects table position. The following values are available:
|
|
87
|
+
left, right, full_width. Set empty value for disable.
|
|
88
|
+
* `top_level_menu`: Boolean (default True) Display plugin menu at the top level. The following values are available: True, False.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Contribute
|
|
92
|
+
|
|
93
|
+
Contributions are always welcome! Please see the [Contribution Guidelines](CONTRIBUTING.md)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
For further information, please refer to the full documentation: [Using NetBox Load Balancer](docs/using_netbox_load_balancing.md)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Credits
|
|
102
|
+
|
|
103
|
+
- Thanks to Peter Eckel for providing some lovely examples which I've happily borrowed, and for providing excellent guidance.
|
|
104
|
+
- Thanks to Gustavo Martinez for assisting with the high level modeling
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# NetBox Load Balancing Plugin
|
|
2
|
+
[Netbox](https://github.com/netbox-community/netbox) plugin for Load Balancing related objects documentation.
|
|
3
|
+
|
|
4
|
+
<div align="center">
|
|
5
|
+
<a href="https://pypi.org/project/netbox-load-balancing/"><img src="https://img.shields.io/pypi/v/netbox-load-balancing" alt="PyPi"/></a>
|
|
6
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/stargazers"><img src="https://img.shields.io/github/stars/andy-shady-org/netbox-load-balancing?style=flat" alt="Stars Badge"/></a>
|
|
7
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/network/members"><img src="https://img.shields.io/github/forks/andy-shady-org/netbox-load-balancing?style=flat" alt="Forks Badge"/></a>
|
|
8
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/issues"><img src="https://img.shields.io/github/issues/andy-shady-org/netbox-load-balancing" alt="Issues Badge"/></a>
|
|
9
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/pulls"><img src="https://img.shields.io/github/issues-pr/andy-shady-org/netbox-load-balancing" alt="Pull Requests Badge"/></a>
|
|
10
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/andy-shady-org/netbox-load-balancing?color=2b9348"></a>
|
|
11
|
+
<a href="https://github.com/andy-shady-org/netbox-load-balancing/blob/master/LICENSE"><img src="https://img.shields.io/github/license/andy-shady-org/netbox-load-balancing?color=2b9348" alt="License Badge"/></a>
|
|
12
|
+
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"/></a>
|
|
13
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads" src="https://static.pepy.tech/badge/netbox-load-balancing"></a>
|
|
14
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads/Week" src="https://static.pepy.tech/badge/netbox-load-balancing/month"></a>
|
|
15
|
+
<a href="https://pepy.tech/project/netbox-load-balancing"><img alt="Downloads/Month" src="https://static.pepy.tech/badge/netbox-load-balancing/week"></a>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
This plugin is based on the OpenStack modelling of [LBaaS](https://docs.openstack.org/mitaka/networking-guide/config-lbaas.html)
|
|
22
|
+
|
|
23
|
+
This plugin provides following Models:
|
|
24
|
+
|
|
25
|
+
* Services
|
|
26
|
+
* Listeners
|
|
27
|
+
* Health Monitors
|
|
28
|
+
* Pools
|
|
29
|
+
* Members
|
|
30
|
+
|
|
31
|
+
## Compatibility
|
|
32
|
+
|
|
33
|
+
| | |
|
|
34
|
+
|------------|-----------|
|
|
35
|
+
| NetBox 4.2 | \>= 1.0.2 |
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
The plugin is available as a Python package in pypi and can be installed with pip
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
pip install netbox-load-balancing
|
|
43
|
+
```
|
|
44
|
+
Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
|
|
45
|
+
```
|
|
46
|
+
PLUGINS = ['netbox_load_balancing']
|
|
47
|
+
```
|
|
48
|
+
Restart NetBox and add `netbox-load-balancing` to your local_requirements.txt
|
|
49
|
+
|
|
50
|
+
Perform database migrations:
|
|
51
|
+
```bash
|
|
52
|
+
cd /opt/netbox
|
|
53
|
+
source venv/bin/activate
|
|
54
|
+
python ./netbox/manage.py migrate netbox_load_balancing
|
|
55
|
+
python ./netbox/manage.py reindex netbox_load_balancing
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Full documentation on using plugins with NetBox: [Using Plugins - NetBox Documentation](https://netbox.readthedocs.io/en/stable/plugins/)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
The following options are available:
|
|
64
|
+
* `service_ext_page`: String (default left) Service related objects table position. The following values are available:
|
|
65
|
+
left, right, full_width. Set empty value for disable.
|
|
66
|
+
* `pool_ext_page`: String (default left) Pool related objects table position. The following values are available:
|
|
67
|
+
left, right, full_width. Set empty value for disable.
|
|
68
|
+
* `member_ext_page`: String (default left) Member related objects table position. The following values are available:
|
|
69
|
+
left, right, full_width. Set empty value for disable.
|
|
70
|
+
* `monitor_ext_page`: String (default left) Health Monitor related objects table position. The following values are available:
|
|
71
|
+
left, right, full_width. Set empty value for disable.
|
|
72
|
+
* `top_level_menu`: Boolean (default True) Display plugin menu at the top level. The following values are available: True, False.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## Contribute
|
|
76
|
+
|
|
77
|
+
Contributions are always welcome! Please see the [Contribution Guidelines](CONTRIBUTING.md)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
For further information, please refer to the full documentation: [Using NetBox Load Balancer](docs/using_netbox_load_balancing.md)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Credits
|
|
86
|
+
|
|
87
|
+
- Thanks to Peter Eckel for providing some lovely examples which I've happily borrowed, and for providing excellent guidance.
|
|
88
|
+
- Thanks to Gustavo Martinez for assisting with the high level modeling
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.utils.translation import gettext_lazy as _
|
|
2
|
+
from netbox.plugins import PluginConfig
|
|
3
|
+
from .version import __version__
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class LoadBalancingConfig(PluginConfig):
|
|
7
|
+
name = "netbox_load_balancing"
|
|
8
|
+
verbose_name = _("Netbox Load Balancing")
|
|
9
|
+
description = _("Subsystem for tracking Load Balancing Service related objects")
|
|
10
|
+
version = __version__
|
|
11
|
+
author = "Andy Wilson"
|
|
12
|
+
author_email = "andy@shady.org"
|
|
13
|
+
base_url = "netbox-load-balancing"
|
|
14
|
+
required_settings = []
|
|
15
|
+
min_version = "4.2.0"
|
|
16
|
+
default_settings = {
|
|
17
|
+
"top_level_menu": True,
|
|
18
|
+
"service_ext_page": "right",
|
|
19
|
+
"pool_ext_page": "right",
|
|
20
|
+
"member_ext_page": "right",
|
|
21
|
+
"monitor_ext_page": "right",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
config = LoadBalancingConfig # noqa
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
from django.contrib.contenttypes.models import ContentType
|
|
2
|
+
from django.core.validators import MinValueValidator, MaxValueValidator
|
|
3
|
+
from rest_framework.serializers import (
|
|
4
|
+
HyperlinkedIdentityField,
|
|
5
|
+
SerializerMethodField,
|
|
6
|
+
JSONField,
|
|
7
|
+
BooleanField,
|
|
8
|
+
IntegerField,
|
|
9
|
+
ChoiceField,
|
|
10
|
+
ListField,
|
|
11
|
+
)
|
|
12
|
+
from drf_spectacular.utils import extend_schema_field
|
|
13
|
+
from netbox.api.fields import ContentTypeField
|
|
14
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
15
|
+
from utilities.api import get_serializer_for_model
|
|
16
|
+
|
|
17
|
+
from netbox_load_balancing.models import HealthMonitor, HealthMonitorAssignment
|
|
18
|
+
from netbox_load_balancing.choices import (
|
|
19
|
+
HealthMonitorTypeChoices,
|
|
20
|
+
HealthMonitorHTTPVersionChoices,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class HealthMonitorSerializer(NetBoxModelSerializer):
|
|
25
|
+
url = HyperlinkedIdentityField(
|
|
26
|
+
view_name="plugins-api:netbox_load_balancing-api:healthmonitor-detail"
|
|
27
|
+
)
|
|
28
|
+
type = ChoiceField(choices=HealthMonitorTypeChoices, required=False)
|
|
29
|
+
monitor_port = IntegerField(
|
|
30
|
+
required=True, validators=[MinValueValidator(1), MaxValueValidator(65534)]
|
|
31
|
+
)
|
|
32
|
+
http_version = ChoiceField(choices=HealthMonitorHTTPVersionChoices, required=False)
|
|
33
|
+
http_secure = BooleanField(required=False, default=False)
|
|
34
|
+
http_response_codes = ListField(
|
|
35
|
+
child=IntegerField(),
|
|
36
|
+
required=False,
|
|
37
|
+
allow_empty=True,
|
|
38
|
+
default=[],
|
|
39
|
+
)
|
|
40
|
+
probe_interval = IntegerField(required=False)
|
|
41
|
+
response_timeout = IntegerField(required=False)
|
|
42
|
+
disabled = BooleanField(required=False, default=False)
|
|
43
|
+
|
|
44
|
+
class Meta:
|
|
45
|
+
model = HealthMonitor
|
|
46
|
+
fields = (
|
|
47
|
+
"id",
|
|
48
|
+
"url",
|
|
49
|
+
"display",
|
|
50
|
+
"name",
|
|
51
|
+
"description",
|
|
52
|
+
"template",
|
|
53
|
+
"type",
|
|
54
|
+
"monitor_url",
|
|
55
|
+
"http_response",
|
|
56
|
+
"monitor_host",
|
|
57
|
+
"monitor_port",
|
|
58
|
+
"http_version",
|
|
59
|
+
"http_secure",
|
|
60
|
+
"http_response_codes",
|
|
61
|
+
"probe_interval",
|
|
62
|
+
"response_timeout",
|
|
63
|
+
"disabled",
|
|
64
|
+
"comments",
|
|
65
|
+
"tags",
|
|
66
|
+
"custom_fields",
|
|
67
|
+
"created",
|
|
68
|
+
"last_updated",
|
|
69
|
+
)
|
|
70
|
+
brief_fields = (
|
|
71
|
+
"id",
|
|
72
|
+
"url",
|
|
73
|
+
"description",
|
|
74
|
+
"display",
|
|
75
|
+
"disabled",
|
|
76
|
+
"type",
|
|
77
|
+
"url",
|
|
78
|
+
"name",
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class HealthMonitorAssignmentSerializer(NetBoxModelSerializer):
|
|
83
|
+
monitor = HealthMonitorSerializer(nested=True, required=True, allow_null=False)
|
|
84
|
+
disabled = BooleanField(required=False, default=False)
|
|
85
|
+
weight = IntegerField(required=False, allow_null=True)
|
|
86
|
+
assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
|
|
87
|
+
assigned_object = SerializerMethodField(read_only=True)
|
|
88
|
+
|
|
89
|
+
class Meta:
|
|
90
|
+
model = HealthMonitorAssignment
|
|
91
|
+
fields = [
|
|
92
|
+
"id",
|
|
93
|
+
"url",
|
|
94
|
+
"display",
|
|
95
|
+
"monitor",
|
|
96
|
+
"weight",
|
|
97
|
+
"disabled",
|
|
98
|
+
"assigned_object_type",
|
|
99
|
+
"assigned_object_id",
|
|
100
|
+
"assigned_object",
|
|
101
|
+
"created",
|
|
102
|
+
"last_updated",
|
|
103
|
+
]
|
|
104
|
+
brief_fields = (
|
|
105
|
+
"id",
|
|
106
|
+
"url",
|
|
107
|
+
"display",
|
|
108
|
+
"monitor",
|
|
109
|
+
"weight",
|
|
110
|
+
"disabled",
|
|
111
|
+
"assigned_object_type",
|
|
112
|
+
"assigned_object_id",
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
@extend_schema_field(JSONField(allow_null=True))
|
|
116
|
+
def get_assigned_object(self, obj):
|
|
117
|
+
if obj.assigned_object is None:
|
|
118
|
+
return None
|
|
119
|
+
serializer = get_serializer_for_model(obj.assigned_object)
|
|
120
|
+
context = {"request": self.context["request"]}
|
|
121
|
+
return serializer(obj.assigned_object, nested=True, context=context).data
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from django.contrib.contenttypes.models import ContentType
|
|
2
|
+
from rest_framework.serializers import (
|
|
3
|
+
HyperlinkedIdentityField,
|
|
4
|
+
SerializerMethodField,
|
|
5
|
+
JSONField,
|
|
6
|
+
BooleanField,
|
|
7
|
+
)
|
|
8
|
+
from drf_spectacular.utils import extend_schema_field
|
|
9
|
+
from netbox.api.fields import ContentTypeField
|
|
10
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
11
|
+
from utilities.api import get_serializer_for_model
|
|
12
|
+
from tenancy.api.serializers import TenantSerializer
|
|
13
|
+
|
|
14
|
+
from netbox_load_balancing.models import LBService, LBServiceAssignment
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class LBServiceSerializer(NetBoxModelSerializer):
|
|
18
|
+
url = HyperlinkedIdentityField(
|
|
19
|
+
view_name="plugins-api:netbox_load_balancing-api:lbservice-detail"
|
|
20
|
+
)
|
|
21
|
+
tenant = TenantSerializer(nested=True, required=False, allow_null=True)
|
|
22
|
+
disabled = BooleanField(required=False, default=False)
|
|
23
|
+
|
|
24
|
+
class Meta:
|
|
25
|
+
model = LBService
|
|
26
|
+
fields = (
|
|
27
|
+
"id",
|
|
28
|
+
"url",
|
|
29
|
+
"display",
|
|
30
|
+
"name",
|
|
31
|
+
"disabled",
|
|
32
|
+
"reference",
|
|
33
|
+
"description",
|
|
34
|
+
"tenant",
|
|
35
|
+
"comments",
|
|
36
|
+
"tags",
|
|
37
|
+
"custom_fields",
|
|
38
|
+
"created",
|
|
39
|
+
"last_updated",
|
|
40
|
+
)
|
|
41
|
+
brief_fields = (
|
|
42
|
+
"id",
|
|
43
|
+
"url",
|
|
44
|
+
"description",
|
|
45
|
+
"display",
|
|
46
|
+
"disabled",
|
|
47
|
+
"name",
|
|
48
|
+
"reference",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class LBServiceAssignmentSerializer(NetBoxModelSerializer):
|
|
53
|
+
service = LBServiceSerializer(nested=True, required=True, allow_null=False)
|
|
54
|
+
assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
|
|
55
|
+
assigned_object = SerializerMethodField(read_only=True)
|
|
56
|
+
|
|
57
|
+
class Meta:
|
|
58
|
+
model = LBServiceAssignment
|
|
59
|
+
fields = [
|
|
60
|
+
"id",
|
|
61
|
+
"url",
|
|
62
|
+
"display",
|
|
63
|
+
"service",
|
|
64
|
+
"assigned_object_type",
|
|
65
|
+
"assigned_object_id",
|
|
66
|
+
"assigned_object",
|
|
67
|
+
"created",
|
|
68
|
+
"last_updated",
|
|
69
|
+
]
|
|
70
|
+
brief_fields = (
|
|
71
|
+
"id",
|
|
72
|
+
"url",
|
|
73
|
+
"display",
|
|
74
|
+
"service",
|
|
75
|
+
"assigned_object_type",
|
|
76
|
+
"assigned_object_id",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
@extend_schema_field(JSONField(allow_null=True))
|
|
80
|
+
def get_assigned_object(self, obj):
|
|
81
|
+
if obj.assigned_object is None:
|
|
82
|
+
return None
|
|
83
|
+
serializer = get_serializer_for_model(obj.assigned_object)
|
|
84
|
+
context = {"request": self.context["request"]}
|
|
85
|
+
return serializer(obj.assigned_object, nested=True, context=context).data
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from rest_framework.serializers import (
|
|
2
|
+
HyperlinkedIdentityField,
|
|
3
|
+
BooleanField,
|
|
4
|
+
IntegerField,
|
|
5
|
+
ChoiceField,
|
|
6
|
+
)
|
|
7
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
8
|
+
|
|
9
|
+
from netbox_load_balancing.api.serializers import LBServiceSerializer
|
|
10
|
+
from netbox_load_balancing.models import Listener
|
|
11
|
+
from netbox_load_balancing.choices import ListenerProtocolChoices
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ListenerSerializer(NetBoxModelSerializer):
|
|
15
|
+
url = HyperlinkedIdentityField(
|
|
16
|
+
view_name="plugins-api:netbox_load_balancing-api:listener-detail"
|
|
17
|
+
)
|
|
18
|
+
service = LBServiceSerializer(nested=True, required=True, many=False)
|
|
19
|
+
port = IntegerField(required=True)
|
|
20
|
+
max_clients = IntegerField(required=False, default=0)
|
|
21
|
+
max_requests = IntegerField(required=False, default=0)
|
|
22
|
+
client_timeout = IntegerField(required=False, default=9000)
|
|
23
|
+
server_timeout = IntegerField(required=False, default=9000)
|
|
24
|
+
source_nat = BooleanField(required=False, default=True)
|
|
25
|
+
use_proxy_port = BooleanField(required=False, default=False)
|
|
26
|
+
client_keepalive = BooleanField(required=False, default=False)
|
|
27
|
+
surge_protection = BooleanField(required=False, default=False)
|
|
28
|
+
tcp_buffering = BooleanField(required=False, default=False)
|
|
29
|
+
compression = BooleanField(required=False, default=False)
|
|
30
|
+
protocol = ChoiceField(choices=ListenerProtocolChoices, required=False)
|
|
31
|
+
|
|
32
|
+
class Meta:
|
|
33
|
+
model = Listener
|
|
34
|
+
fields = (
|
|
35
|
+
"id",
|
|
36
|
+
"url",
|
|
37
|
+
"display",
|
|
38
|
+
"name",
|
|
39
|
+
"service",
|
|
40
|
+
"description",
|
|
41
|
+
"port",
|
|
42
|
+
"protocol",
|
|
43
|
+
"source_nat",
|
|
44
|
+
"use_proxy_port",
|
|
45
|
+
"max_clients",
|
|
46
|
+
"max_requests",
|
|
47
|
+
"client_timeout",
|
|
48
|
+
"server_timeout",
|
|
49
|
+
"client_keepalive",
|
|
50
|
+
"surge_protection",
|
|
51
|
+
"tcp_buffering",
|
|
52
|
+
"compression",
|
|
53
|
+
"comments",
|
|
54
|
+
"tags",
|
|
55
|
+
"custom_fields",
|
|
56
|
+
"created",
|
|
57
|
+
"last_updated",
|
|
58
|
+
)
|
|
59
|
+
brief_fields = (
|
|
60
|
+
"id",
|
|
61
|
+
"url",
|
|
62
|
+
"description",
|
|
63
|
+
"display",
|
|
64
|
+
"name",
|
|
65
|
+
"port",
|
|
66
|
+
)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from django.contrib.contenttypes.models import ContentType
|
|
2
|
+
from rest_framework.serializers import (
|
|
3
|
+
HyperlinkedIdentityField,
|
|
4
|
+
SerializerMethodField,
|
|
5
|
+
JSONField,
|
|
6
|
+
BooleanField,
|
|
7
|
+
IntegerField,
|
|
8
|
+
)
|
|
9
|
+
from drf_spectacular.utils import extend_schema_field
|
|
10
|
+
from netbox.api.fields import ContentTypeField
|
|
11
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
12
|
+
from utilities.api import get_serializer_for_model
|
|
13
|
+
from ipam.api.serializers import IPAddressSerializer
|
|
14
|
+
|
|
15
|
+
from netbox_load_balancing.models import Member, MemberAssignment
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class MemberSerializer(NetBoxModelSerializer):
|
|
19
|
+
url = HyperlinkedIdentityField(
|
|
20
|
+
view_name="plugins-api:netbox_load_balancing-api:member-detail"
|
|
21
|
+
)
|
|
22
|
+
ip_address = IPAddressSerializer(nested=True, required=True, many=False)
|
|
23
|
+
disabled = BooleanField(required=False, default=False)
|
|
24
|
+
|
|
25
|
+
class Meta:
|
|
26
|
+
model = Member
|
|
27
|
+
fields = (
|
|
28
|
+
"id",
|
|
29
|
+
"url",
|
|
30
|
+
"display",
|
|
31
|
+
"name",
|
|
32
|
+
"ip_address",
|
|
33
|
+
"description",
|
|
34
|
+
"reference",
|
|
35
|
+
"disabled",
|
|
36
|
+
"comments",
|
|
37
|
+
"tags",
|
|
38
|
+
"custom_fields",
|
|
39
|
+
"created",
|
|
40
|
+
"last_updated",
|
|
41
|
+
)
|
|
42
|
+
brief_fields = (
|
|
43
|
+
"id",
|
|
44
|
+
"url",
|
|
45
|
+
"description",
|
|
46
|
+
"display",
|
|
47
|
+
"disabled",
|
|
48
|
+
"name",
|
|
49
|
+
"reference",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class MemberAssignmentSerializer(NetBoxModelSerializer):
|
|
54
|
+
member = MemberSerializer(nested=True, required=True, allow_null=False)
|
|
55
|
+
disabled = BooleanField(required=False, default=False)
|
|
56
|
+
weight = IntegerField(required=False, allow_null=True)
|
|
57
|
+
assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
|
|
58
|
+
assigned_object = SerializerMethodField(read_only=True)
|
|
59
|
+
|
|
60
|
+
class Meta:
|
|
61
|
+
model = MemberAssignment
|
|
62
|
+
fields = [
|
|
63
|
+
"id",
|
|
64
|
+
"url",
|
|
65
|
+
"display",
|
|
66
|
+
"member",
|
|
67
|
+
"weight",
|
|
68
|
+
"disabled",
|
|
69
|
+
"assigned_object_type",
|
|
70
|
+
"assigned_object_id",
|
|
71
|
+
"assigned_object",
|
|
72
|
+
"created",
|
|
73
|
+
"last_updated",
|
|
74
|
+
]
|
|
75
|
+
brief_fields = (
|
|
76
|
+
"id",
|
|
77
|
+
"url",
|
|
78
|
+
"display",
|
|
79
|
+
"member",
|
|
80
|
+
"weight",
|
|
81
|
+
"disabled",
|
|
82
|
+
"assigned_object_type",
|
|
83
|
+
"assigned_object_id",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
@extend_schema_field(JSONField(allow_null=True))
|
|
87
|
+
def get_assigned_object(self, obj):
|
|
88
|
+
if obj.assigned_object is None:
|
|
89
|
+
return None
|
|
90
|
+
serializer = get_serializer_for_model(obj.assigned_object)
|
|
91
|
+
context = {"request": self.context["request"]}
|
|
92
|
+
return serializer(obj.assigned_object, nested=True, context=context).data
|