cesnet-service-path-plugin 4.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.

Potentially problematic release.


This version of cesnet-service-path-plugin might be problematic. Click here for more details.

Files changed (97) hide show
  1. cesnet_service_path_plugin-4.0.0/CONTRIBUTING.md +121 -0
  2. cesnet_service_path_plugin-4.0.0/LICENSE +1 -0
  3. cesnet_service_path_plugin-4.0.0/MANIFEST.in +12 -0
  4. cesnet_service_path_plugin-4.0.0/PKG-INFO +10 -0
  5. cesnet_service_path_plugin-4.0.0/README.md +167 -0
  6. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/__init__.py +15 -0
  7. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/__init__.py +0 -0
  8. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/serializers/__init__.py +4 -0
  9. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/serializers/segment.py +57 -0
  10. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/serializers/segment_circuit_mapping.py +34 -0
  11. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/serializers/service_path.py +39 -0
  12. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/serializers/service_path_segment_mapping.py +40 -0
  13. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/urls.py +12 -0
  14. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/views/__init__.py +4 -0
  15. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/views/segment.py +13 -0
  16. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/views/segment_circuit_mapping.py +12 -0
  17. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/views/service_path.py +12 -0
  18. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/api/views/service_path_segment_mapping.py +12 -0
  19. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/filtersets/__init__.py +4 -0
  20. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/filtersets/segment.py +132 -0
  21. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/filtersets/segment_circuit_mapping.py +45 -0
  22. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/filtersets/service_path.py +28 -0
  23. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/filtersets/service_path_segment_mapping.py +56 -0
  24. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/forms/__init__.py +4 -0
  25. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/forms/segment.py +250 -0
  26. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/forms/segment_circuit_mapping.py +15 -0
  27. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/forms/service_path.py +43 -0
  28. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/forms/service_path_segment_mapping.py +45 -0
  29. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/graphql/__init__.py +3 -0
  30. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/graphql/filters.py +32 -0
  31. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/graphql/schema.py +28 -0
  32. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/graphql/types.py +68 -0
  33. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0001_segment.py +152 -0
  34. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0002_servicepath.py +49 -0
  35. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0003_servicepathsegmentmapping.py +71 -0
  36. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0004_add_komora_id_and_imported_data_to_models.py +38 -0
  37. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0005_segmentcircuitmapping_segment_circuits_and_more.py +127 -0
  38. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0006_remove_servicepath_circuits_and_more.py +23 -0
  39. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0007_segment_comments.py +18 -0
  40. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0008_servicepath_comments.py +18 -0
  41. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0009_rename_supplier_segment_contract_segment_provider_segment_contract_and_more.py +52 -0
  42. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0010_replace_supplier_with_provider.py +32 -0
  43. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0011_remove_segment_supplier_alter_segment_provider.py +28 -0
  44. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0012_segment_sync_status_servicepath_sync_status.py +26 -0
  45. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0013_alter_segment_table_and_more.py +41 -0
  46. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0014_remove_segment_imported_data_and_more.py +37 -0
  47. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0015_merge_notes_to_comments.py +43 -0
  48. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0016_remove_segment_note_a_remove_segment_note_b.py +21 -0
  49. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0017_remove_segment_device_a_remove_segment_device_b_and_more.py +32 -0
  50. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0018_remove_segment_sync_status_and_more.py +24 -0
  51. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0019_alter_servicepathsegmentmapping_options_and_more.py +25 -0
  52. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0020_add_field_status_to_segment_and_servicepath.py +29 -0
  53. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0021_copy_service_path_state_to_status.py +48 -0
  54. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0022_remove_field_state_from_servicepath.py +20 -0
  55. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/0023_alter_servicepath_kind.py +48 -0
  56. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/migrations/__init__.py +0 -0
  57. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/__init__.py +4 -0
  58. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/custom_choices.py +29 -0
  59. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/segment.py +168 -0
  60. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/segment_circuit_mapping.py +21 -0
  61. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/service_path.py +43 -0
  62. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/models/service_path_segment_mapping.py +28 -0
  63. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/navigation.py +29 -0
  64. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/search.py +25 -0
  65. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/tables/__init__.py +4 -0
  66. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/tables/segment.py +58 -0
  67. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/tables/segment_circuit_mapping.py +65 -0
  68. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/tables/service_path.py +23 -0
  69. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/tables/service_path_segment_mapping.py +35 -0
  70. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/template_content.py +94 -0
  71. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/circuit_segments_extension.html +15 -0
  72. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/circuit_segments_template_column.html +7 -0
  73. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/inc/date_status_badge.html +9 -0
  74. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/location_segments_extension.html +7 -0
  75. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/provider_segments_extension.html +7 -0
  76. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/segment.html +174 -0
  77. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/segmentcircuitmapping.html +33 -0
  78. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/servicepath.html +64 -0
  79. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/servicepathsegmentmapping.html +28 -0
  80. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/site_segments_extension.html +7 -0
  81. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/templates/cesnet_service_path_plugin/tenant_provider_extension.html +29 -0
  82. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/urls.py +121 -0
  83. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/version.py +5 -0
  84. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/views/__init__.py +4 -0
  85. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/views/segment.py +45 -0
  86. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/views/segment_circuit_mapping.py +28 -0
  87. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/views/service_path.py +26 -0
  88. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin/views/service_path_segment_mapping.py +33 -0
  89. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin.egg-info/PKG-INFO +10 -0
  90. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin.egg-info/SOURCES.txt +95 -0
  91. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin.egg-info/dependency_links.txt +1 -0
  92. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin.egg-info/not-zip-safe +1 -0
  93. cesnet_service_path_plugin-4.0.0/cesnet_service_path_plugin.egg-info/top_level.txt +2 -0
  94. cesnet_service_path_plugin-4.0.0/setup.cfg +4 -0
  95. cesnet_service_path_plugin-4.0.0/setup.py +46 -0
  96. cesnet_service_path_plugin-4.0.0/tests/__init__.py +1 -0
  97. cesnet_service_path_plugin-4.0.0/tests/test_komora_service_path_plugin.py +5 -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/Jan.Krupa/komora-service-path-plugin/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
+ Cesnet ServicePath Plugin could always use more documentation, whether as part of the
47
+ official Cesnet ServicePath 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/Jan.Krupa/komora-service-path-plugin/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 `komora-service-path-plugin` for local development.
64
+
65
+ 1. Fork the `komora-service-path-plugin` repo on GitHub.
66
+ 2. Clone your fork locally
67
+
68
+ ```
69
+ $ git clone git@github.com:your_name_here/komora-service-path-plugin.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.8, 3.9, 3.10 and 3.11. Check
113
+ https://github.com/Jan.Krupa/komora-service-path-plugin/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 @@
1
+
@@ -0,0 +1,12 @@
1
+ include CONTRIBUTING.md
2
+ include LICENSE
3
+ include README.md
4
+
5
+ recursive-include tests *
6
+ recursive-include cesnet_service_path_plugin/templates *
7
+ recursive-exclude * __pycache__
8
+ recursive-exclude * *.py[co]
9
+
10
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
11
+
12
+ graft templates
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.2
2
+ Name: cesnet_service_path_plugin
3
+ Version: 4.0.0
4
+ Summary: Adds ability to create service path in the CESNET network.
5
+ Author: Jan Krupa
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Dynamic: author
9
+ Dynamic: license
10
+ Dynamic: summary
@@ -0,0 +1,167 @@
1
+ # CESNET ServicePath Plugin for NetBox
2
+
3
+ A NetBox plugin for managing service paths and segments in network infrastructure.
4
+
5
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
6
+
7
+ ## Overview
8
+
9
+ The CESNET ServicePath Plugin extends NetBox's capabilities by:
10
+ - Managing service paths across your network
11
+ - Creating and tracking service segments
12
+ - Visualizing service routing
13
+
14
+ ## Compatibility Matrix
15
+
16
+ | NetBox Version | Plugin Version |
17
+ |----------------|----------------|
18
+ | 4.2 | 4.0.0 |
19
+ | 3.7 | 0.1.0 |
20
+
21
+ ## Features
22
+
23
+ - Service Path Management
24
+ - Define experimental, core, and customer service paths
25
+ - Track service path status and metadata
26
+ - Link multiple segments to create complete paths
27
+
28
+ - Segment Management
29
+ - Track network segments between locations
30
+ - Monitor installation and termination dates
31
+ - Manage provider relationships and contracts
32
+ - Link circuits to segments
33
+ - Automatic status tracking based on dates
34
+
35
+ ## Data Model
36
+
37
+ ### Service Path
38
+ - Name and status tracking
39
+ - Service type classification (experimental/core/customer)
40
+ - Multiple segment support through mappings
41
+
42
+ ### Segment
43
+ - Provider and location tracking
44
+ - Date-based lifecycle management
45
+ - Circuit associations
46
+ - Automated status monitoring
47
+
48
+ ## Quick Start
49
+
50
+ 1. Install the plugin:
51
+ ```bash
52
+ pip install cesnet_service_path_plugin
53
+ ```
54
+
55
+ 2. Enable the plugin in your NetBox configuration:
56
+ ```python
57
+ PLUGINS = [
58
+ 'cesnet_service_path_plugin'
59
+ ]
60
+
61
+ PLUGINS_CONFIG = {
62
+ "cesnet_service_path_plugin": {},
63
+ }
64
+ ```
65
+
66
+ 3. Run NetBox migrations:
67
+ ```bash
68
+ python manage.py migrate
69
+ ```
70
+
71
+ ## Installation
72
+
73
+ ### Using pip
74
+ ```bash
75
+ pip install git+https://gitlab.cesnet.cz/701/netbox/cesnet_service_path_plugin.git
76
+ ```
77
+
78
+ ### Using Docker
79
+ For NetBox Docker installations, add to your `plugin_requirements.txt`:
80
+ ```bash
81
+ cesnet_service_path_plugin
82
+ ```
83
+
84
+ For detailed Docker setup instructions, see [using netbox-docker with plugins](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins).
85
+
86
+ ## Configuration
87
+
88
+ ### Custom Status Choices
89
+
90
+ Extend or override default status choices in your `configuration.py`:
91
+
92
+ ```python
93
+ FIELD_CHOICES = {
94
+ 'cesnet_service_path_plugin.choices.status': (
95
+ ('custom_status', 'Custom Status', 'blue'),
96
+ # ('status_value', 'Display Name', 'color'),
97
+ )
98
+ }
99
+ ```
100
+
101
+ Status choice format:
102
+ - Value: Internal database value
103
+ - Name: UI display name
104
+ - Color: Badge color (blue, green, red, orange, yellow, purple, gray)
105
+
106
+ Default statuses (Active, Planned, Offline) will be merged with custom choices.
107
+
108
+ ### Custom Kind Choices
109
+
110
+ Extend or override default kind choices in your `configuration.py`:
111
+
112
+ ```python
113
+ FIELD_CHOICES = {
114
+ 'cesnet_service_path_plugin.choices.kind': (
115
+ ('custom_kind', 'Custom Kind Name', 'purple'),
116
+ # ('kind_value', 'Display Name', 'color'),
117
+ )
118
+ }
119
+ ```
120
+
121
+ Kind choice format:
122
+ - Value: Internal database value
123
+ - Name: UI display name
124
+ - Color: Badge color (blue, green, red, orange, yellow, purple, gray)
125
+
126
+ Default kinds:
127
+ - experimental: Experimentální (cyan)
128
+ - core: Páteřní (blue)
129
+ - customer: Zákaznická (green)
130
+
131
+ Custom kinds will be merged with the default choices.
132
+
133
+ ## API Usage
134
+
135
+ The plugin provides a REST API for managing service paths and segments:
136
+
137
+ ## Development
138
+
139
+ ### Setting Up Development Environment
140
+
141
+ 1. Clone the repository:
142
+ ```bash
143
+ git clone https://gitlab.cesnet.cz/701/netbox/cesnet_service_path_plugin.git
144
+ cd cesnet_service_path_plugin
145
+ ```
146
+
147
+ 2. Create a virtual environment:
148
+ ```bash
149
+ python -m venv venv
150
+ source venv/bin/activate # Linux/Mac
151
+ # or
152
+ .\venv\Scripts\activate # Windows
153
+ ```
154
+
155
+ 3. Install development dependencies:
156
+ ```bash
157
+ pip install -e ".[dev]"
158
+ ```
159
+
160
+ ## Credits
161
+
162
+ - Created using [Cookiecutter](https://github.com/audreyr/cookiecutter) and [`netbox-community/cookiecutter-netbox-plugin`](https://github.com/netbox-community/cookiecutter-netbox-plugin)
163
+ - Based on the [NetBox plugin tutorial](https://github.com/netbox-community/netbox-plugin-tutorial)
164
+
165
+ ## License
166
+
167
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,15 @@
1
+ """Top-level package for Cesnet ServicePath Plugin."""
2
+
3
+ from netbox.plugins import PluginConfig
4
+ from .version import __version__, __author__, __email__, __description__, __name__
5
+
6
+
7
+ class CesnetServicePathPluginConfig(PluginConfig):
8
+ name = __name__
9
+ verbose_name = "Cesnet ServicePath Plugin"
10
+ description = __description__
11
+ version = __version__
12
+ base_url = "cesnet-service-path-plugin"
13
+
14
+
15
+ config = CesnetServicePathPluginConfig
@@ -0,0 +1,4 @@
1
+ from .segment import *
2
+ from .segment_circuit_mapping import *
3
+ from .service_path import *
4
+ from .service_path_segment_mapping import *
@@ -0,0 +1,57 @@
1
+ from circuits.api.serializers import CircuitSerializer, ProviderSerializer
2
+ from dcim.api.serializers import (
3
+ LocationSerializer,
4
+ SiteSerializer,
5
+ )
6
+ from netbox.api.serializers import NetBoxModelSerializer
7
+ from rest_framework import serializers
8
+
9
+ from cesnet_service_path_plugin.models.segment import Segment
10
+
11
+
12
+ class SegmentSerializer(NetBoxModelSerializer):
13
+ url = serializers.HyperlinkedIdentityField(
14
+ view_name="plugins-api:cesnet_service_path_plugin-api:segment-detail"
15
+ )
16
+ provider = ProviderSerializer(required=True, nested=True)
17
+ site_a = SiteSerializer(required=True, nested=True)
18
+ location_a = LocationSerializer(required=True, nested=True)
19
+ site_b = SiteSerializer(required=True, nested=True)
20
+ location_b = LocationSerializer(required=True, nested=True)
21
+ circuits = CircuitSerializer(required=False, many=True, nested=True)
22
+
23
+ class Meta:
24
+ model = Segment
25
+ fields = (
26
+ "id",
27
+ "url",
28
+ "display",
29
+ "name",
30
+ "status",
31
+ "network_label",
32
+ "install_date",
33
+ "termination_date",
34
+ "provider",
35
+ "provider_segment_id",
36
+ "provider_segment_name",
37
+ "provider_segment_contract",
38
+ "site_a",
39
+ "location_a",
40
+ "site_b",
41
+ "location_b",
42
+ "circuits",
43
+ "tags",
44
+ )
45
+ brief_fields = (
46
+ "id",
47
+ "url",
48
+ "display",
49
+ "name",
50
+ "status",
51
+ "tags",
52
+ )
53
+
54
+ def validate(self, data):
55
+ # Enforce model validation
56
+ super().validate(data)
57
+ return data
@@ -0,0 +1,34 @@
1
+ from rest_framework import serializers
2
+ from netbox.api.serializers import NetBoxModelSerializer
3
+ from cesnet_service_path_plugin.api.serializers.segment import SegmentSerializer
4
+ from cesnet_service_path_plugin.api.serializers.service_path import ServicePathSerializer
5
+ from cesnet_service_path_plugin.models import SegmentCircuitMapping
6
+ from circuits.api.serializers import CircuitSerializer
7
+
8
+ class SegmentCircuitMappingSerializer(NetBoxModelSerializer):
9
+ url = serializers.HyperlinkedIdentityField(
10
+ view_name="plugins-api:cesnet_service_path_plugin-api:segmentcircuitmapping-detail"
11
+ )
12
+ circuit = CircuitSerializer(nested=True)
13
+ segment = SegmentSerializer(nested=True)
14
+
15
+ class Meta:
16
+ model = SegmentCircuitMapping
17
+ fields = [
18
+ "id",
19
+ "url",
20
+ "display",
21
+ "segment",
22
+ "circuit",
23
+ ]
24
+ brief_fields = [
25
+ "id",
26
+ "url",
27
+ "display",
28
+ "segment",
29
+ "circuit",
30
+ ]
31
+
32
+ def validate(self, data):
33
+ super().validate(data)
34
+ return data
@@ -0,0 +1,39 @@
1
+ from circuits.api.serializers import CircuitSerializer
2
+ from netbox.api.serializers import NetBoxModelSerializer
3
+ from rest_framework import serializers
4
+
5
+ from cesnet_service_path_plugin.api.serializers.segment import SegmentSerializer
6
+ from cesnet_service_path_plugin.models import ServicePath
7
+
8
+
9
+ class ServicePathSerializer(NetBoxModelSerializer):
10
+ url = serializers.HyperlinkedIdentityField(
11
+ view_name="plugins-api:cesnet_service_path_plugin-api:servicepath-detail"
12
+ )
13
+ segments = SegmentSerializer(many=True, read_only=True, nested=True)
14
+ circuits = CircuitSerializer(required=False, many=True, nested=True)
15
+
16
+ class Meta:
17
+ model = ServicePath
18
+ fields = [
19
+ "id",
20
+ "url",
21
+ "display",
22
+ "name",
23
+ "status",
24
+ "kind",
25
+ "segments",
26
+ "circuits",
27
+ "tags",
28
+ ]
29
+ brief_fields = [
30
+ "id",
31
+ "url",
32
+ "display",
33
+ "name",
34
+ "tags",
35
+ ]
36
+
37
+ def validate(self, data):
38
+ super().validate(data)
39
+ return data
@@ -0,0 +1,40 @@
1
+ from rest_framework import serializers
2
+ from netbox.api.serializers import NetBoxModelSerializer
3
+ from cesnet_service_path_plugin.api.serializers.segment import SegmentSerializer
4
+ from cesnet_service_path_plugin.api.serializers.service_path import (
5
+ ServicePathSerializer,
6
+ )
7
+ from cesnet_service_path_plugin.models import ServicePathSegmentMapping
8
+
9
+
10
+ class ServicePathSegmentMappingSerializer(NetBoxModelSerializer):
11
+ url = serializers.HyperlinkedIdentityField(
12
+ view_name="plugins-api:cesnet_service_path_plugin-api:servicepathsegmentmapping-detail"
13
+ )
14
+ # service_path = serializers.PrimaryKeyRelatedField(
15
+ # queryset=ServicePath.objects.all(),
16
+ # required=True
17
+ # )
18
+ service_path = ServicePathSerializer(nested=True)
19
+ segment = SegmentSerializer(nested=True)
20
+
21
+ class Meta:
22
+ model = ServicePathSegmentMapping
23
+ fields = [
24
+ "id",
25
+ "url",
26
+ "display",
27
+ "service_path",
28
+ "segment",
29
+ ]
30
+ brief_fields = [
31
+ "id",
32
+ "url",
33
+ "display",
34
+ "service_path",
35
+ "segment",
36
+ ]
37
+
38
+ def validate(self, data):
39
+ super().validate(data)
40
+ return data
@@ -0,0 +1,12 @@
1
+ from netbox.api.routers import NetBoxRouter
2
+
3
+ from . import views
4
+
5
+ app_name = "cesnet_service_path_plugin"
6
+ router = NetBoxRouter()
7
+ router.register("segments", views.SegmentViewSet)
8
+ router.register("service-paths", views.ServicePathViewSet)
9
+ router.register("service-path-segment-mappings", views.ServicePathSegmentMappingViewSet)
10
+ router.register("segment-circuit-mappings", views.SegmnetCircuitMappingViewSet)
11
+
12
+ urlpatterns = router.urls
@@ -0,0 +1,4 @@
1
+ from .segment import *
2
+ from .segment_circuit_mapping import *
3
+ from .service_path import *
4
+ from .service_path_segment_mapping import *
@@ -0,0 +1,13 @@
1
+ from netbox.api.metadata import ContentTypeMetadata
2
+ from netbox.api.viewsets import NetBoxModelViewSet
3
+
4
+ from cesnet_service_path_plugin.models import Segment
5
+ from cesnet_service_path_plugin.filtersets import SegmentFilterSet
6
+ from cesnet_service_path_plugin.api.serializers import SegmentSerializer
7
+
8
+
9
+ class SegmentViewSet(NetBoxModelViewSet):
10
+ metadata_class = ContentTypeMetadata
11
+ queryset = Segment.objects.all()
12
+ serializer_class = SegmentSerializer
13
+ filterset_class = SegmentFilterSet
@@ -0,0 +1,12 @@
1
+ from netbox.api.metadata import ContentTypeMetadata
2
+ from netbox.api.viewsets import NetBoxModelViewSet
3
+
4
+ from cesnet_service_path_plugin import filtersets, models
5
+ from cesnet_service_path_plugin.api.serializers import SegmentCircuitMappingSerializer
6
+
7
+
8
+ class SegmnetCircuitMappingViewSet(NetBoxModelViewSet):
9
+ metadata_class = ContentTypeMetadata
10
+ queryset = models.SegmentCircuitMapping.objects.all()
11
+ serializer_class = SegmentCircuitMappingSerializer
12
+ filterset_class = filtersets.SegmentCircuitMappingFilterSet
@@ -0,0 +1,12 @@
1
+ from netbox.api.metadata import ContentTypeMetadata
2
+ from netbox.api.viewsets import NetBoxModelViewSet
3
+
4
+ from ... import filtersets, models
5
+ from ..serializers import ServicePathSerializer
6
+
7
+
8
+ class ServicePathViewSet(NetBoxModelViewSet):
9
+ metadata_class = ContentTypeMetadata
10
+ queryset = models.ServicePath.objects.all()
11
+ serializer_class = ServicePathSerializer
12
+ filterset_class = filtersets.ServicePathFilterSet
@@ -0,0 +1,12 @@
1
+ from netbox.api.metadata import ContentTypeMetadata
2
+ from netbox.api.viewsets import NetBoxModelViewSet
3
+
4
+ from cesnet_service_path_plugin import filtersets, models
5
+ from cesnet_service_path_plugin.api.serializers import ServicePathSegmentMappingSerializer
6
+
7
+
8
+ class ServicePathSegmentMappingViewSet(NetBoxModelViewSet):
9
+ metadata_class = ContentTypeMetadata
10
+ queryset = models.ServicePathSegmentMapping.objects.all()
11
+ serializer_class = ServicePathSegmentMappingSerializer
12
+ filterset_class = filtersets.ServicePathSegmentMappingFilterSet
@@ -0,0 +1,4 @@
1
+ from .segment import *
2
+ from .segment_circuit_mapping import *
3
+ from .service_path import *
4
+ from .service_path_segment_mapping import *