-
Couldn't load subscription status.
- Fork 9
[Feature]: add NSISTP product and workflows to example orchestrator #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tvdven
wants to merge
23
commits into
master
Choose a base branch
from
41-feat/add-nsistp-products-and-workflows-with-yaml
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4f177e3
Created product type, blocks, workflows and migration files
0d58be8
Initial working version of NSI
1d62263
Restructered with working create_form
780b5b5
Selecting of vlans works
ff2a9b5
Using CustomRanges
923543d
Nsistp products types and workflow now works
48f2a37
Removed unused / unnecessary code
597efa7
Added single dispatch for subscription description and some minor adj…
109431d
Added documentation
94c6604
Remove forms volume from docker-compose
tvdven a3c4cf7
Netbox Docker image back to v4.4.1
tvdven 0a9c1cc
Removed unused exceptions
1367bfe
reformat with line lengt 120 again
hanstrompert 548f080
Revert "Removed unused exceptions"
hanstrompert 7b28c3f
move flake8 options from pyproject.toml to .flake8 where they are rec…
hanstrompert c72c45a
make nsistp description uniform with other descriptions + add node name
hanstrompert 4963ef6
refactor input form field used to get port
hanstrompert 2bccc6a
add form input field validation to modify nsistp + fix subscription d…
hanstrompert 35290f3
remove unneeded AllowedNumberOfNsistpPorts
hanstrompert 846c106
reformat with line length set to 120
hanstrompert a2cdc7a
improve resource type descriptions + fix nsistp generator yaml
hanstrompert a1ec70e
address review done by @Mark90
hanstrompert 443f40c
Processed comment Mark
tvdven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [flake8] | ||
| max-line-length = 120 | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
migrations/versions/schema/2025-09-30_a87d11eb8dd1_add_nsistp.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| """Add nsistp product. | ||
|
|
||
| Revision ID: a87d11eb8dd1 | ||
| Revises: 0e8d17ce0f06 | ||
| Create Date: 2025-09-30 15:50:36.882313 | ||
|
|
||
| """ | ||
|
|
||
| from uuid import uuid4 | ||
|
|
||
| from alembic import op | ||
| from orchestrator.migrations.helpers import create, create_workflow, delete, delete_workflow, ensure_default_workflows | ||
| from orchestrator.targets import Target | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "a87d11eb8dd1" | ||
| down_revision = "0e8d17ce0f06" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
| new_products = { | ||
| "products": { | ||
| "nsistp": { | ||
| "product_id": uuid4(), | ||
| "product_type": "Nsistp", | ||
| "description": "NSISTP", | ||
| "tag": "NSISTP", | ||
| "status": "active", | ||
| "root_product_block": "Nsistp", | ||
| "fixed_inputs": {}, | ||
| }, | ||
| }, | ||
| "product_blocks": { | ||
| "Nsistp": { | ||
| "product_block_id": uuid4(), | ||
| "description": "nsistp product block", | ||
| "tag": "NSISTP", | ||
| "status": "active", | ||
| "resources": { | ||
| "topology": "Name of the topology this Service Termination Point is exposed in", | ||
| "stp_id": "Unique identifier for the Service Termination Point", | ||
| "stp_description": "Description of the Service Termination Point", | ||
| "is_alias_in": "Inbound port from the other topology in case this STP is part of a SDP", | ||
| "is_alias_out": "Outbound port from the other topology in case this STP is part of a SDP", | ||
| "expose_in_topology": "Whether to actively expose this STP in the topology", | ||
| "bandwidth": "Maximum bandwidth for the combined set of STP (in Mbps)", | ||
| }, | ||
| "depends_on_block_relations": [ | ||
| "SAP", | ||
| ], | ||
| }, | ||
| }, | ||
| "workflows": {}, | ||
| } | ||
|
|
||
| new_workflows = [ | ||
| { | ||
| "name": "create_nsistp", | ||
| "target": Target.CREATE, | ||
| "is_task": False, | ||
| "description": "Create nsistp", | ||
| "product_type": "Nsistp", | ||
| }, | ||
| { | ||
| "name": "modify_nsistp", | ||
| "target": Target.MODIFY, | ||
| "is_task": False, | ||
| "description": "Modify nsistp", | ||
| "product_type": "Nsistp", | ||
| }, | ||
| { | ||
| "name": "terminate_nsistp", | ||
| "target": Target.TERMINATE, | ||
| "is_task": False, | ||
| "description": "Terminate nsistp", | ||
| "product_type": "Nsistp", | ||
| }, | ||
| { | ||
| "name": "validate_nsistp", | ||
| "target": Target.VALIDATE, | ||
| "is_task": True, | ||
| "description": "Validate nsistp", | ||
| "product_type": "Nsistp", | ||
| }, | ||
| ] | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| conn = op.get_bind() | ||
| create(conn, new_products) | ||
| for workflow in new_workflows: | ||
| create_workflow(conn, workflow) | ||
| ensure_default_workflows(conn) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| conn = op.get_bind() | ||
| for workflow in new_workflows: | ||
| delete_workflow(conn, workflow["name"]) | ||
|
|
||
| delete(conn, new_products) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright 2019-2023 SURF. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| from orchestrator.domain.base import ProductBlockModel | ||
| from orchestrator.types import SubscriptionLifecycle | ||
| from pydantic import computed_field | ||
|
|
||
| from products.product_blocks.sap import SAPBlock, SAPBlockInactive, SAPBlockProvisioning | ||
|
|
||
|
|
||
| class NsistpBlockInactive(ProductBlockModel, product_block_name="Nsistp"): | ||
| sap: SAPBlockInactive | ||
| topology: str | None = None | ||
| stp_id: str | None = None | ||
| stp_description: str | None = None | ||
| is_alias_in: str | None = None | ||
| is_alias_out: str | None = None | ||
| expose_in_topology: bool | None = None | ||
| bandwidth: int | None = None | ||
|
|
||
|
|
||
| class NsistpBlockProvisioning(NsistpBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): | ||
| sap: SAPBlockProvisioning | ||
| topology: str | ||
| stp_id: str | ||
| stp_description: str | None = None | ||
| is_alias_in: str | None = None | ||
| is_alias_out: str | None = None | ||
| expose_in_topology: bool | None = None | ||
| bandwidth: int | None = None | ||
|
|
||
| @computed_field | ||
| @property | ||
| def title(self) -> str: | ||
| return f"NSISTP {self.stp_id} on {self.sap.title}" | ||
|
|
||
|
|
||
| class NsistpBlock(NsistpBlockProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): | ||
| sap: SAPBlock | ||
| topology: str | ||
| stp_id: str | ||
| stp_description: str | None = None | ||
| is_alias_in: str | None = None | ||
| is_alias_out: str | None = None | ||
| expose_in_topology: bool | None = None | ||
| bandwidth: int | None = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright 2019-2023 SURF. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| from orchestrator.domain.base import SubscriptionModel | ||
| from orchestrator.types import SubscriptionLifecycle | ||
|
|
||
| from products.product_blocks.nsistp import NsistpBlock, NsistpBlockInactive, NsistpBlockProvisioning | ||
| from workflows.nsistp.shared.shared import CustomVlanRanges | ||
|
|
||
|
|
||
| class NsistpInactive(SubscriptionModel, is_base=True): | ||
| nsistp: NsistpBlockInactive | ||
|
|
||
|
|
||
| class NsistpProvisioning(NsistpInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING]): | ||
| nsistp: NsistpBlockProvisioning | ||
|
|
||
|
|
||
| class Nsistp(NsistpProvisioning, lifecycle=[SubscriptionLifecycle.ACTIVE]): | ||
| nsistp: NsistpBlock | ||
|
|
||
| @property | ||
| def vlan_range(self) -> CustomVlanRanges: | ||
| return self.nsistp.sap.vlan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Copyright 2019-2023 SURF. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # | ||
| # This file describes the "L2VPN" product | ||
| # | ||
| config: | ||
| summary_forms: true | ||
| name: nsistp | ||
| type: Nsistp | ||
| tag: NSISTP | ||
| description: "NSISTP" | ||
| product_blocks: | ||
| - name: nsistp | ||
| type: Nsistp | ||
| tag: NSISTP | ||
| description: "nsistp product block" | ||
| fields: | ||
| - name: sap | ||
| type: SAP | ||
| description: "NSI STP service access points" | ||
| required: provisioning | ||
| - name: topology | ||
| description: "Name of the topology this Service Termination Point is exposed in" | ||
| type: str | ||
| required: provisioning | ||
| modifiable: | ||
| - name: stp_id | ||
| description: "Unique identifier for the Service Termination Point" | ||
| type: str | ||
| required: provisioning | ||
| - name: stp_description | ||
| description: "Description of the Service Termination Point" | ||
| type: str | ||
| modifiable: | ||
| - name: is_alias_in | ||
| description: "Unique identifier for the Service Termination Point" | ||
| type: str | ||
| modifiable: | ||
| - name: is_alias_out | ||
| description: "Outbound port from the other topology in case this STP is part of a SDP" | ||
| type: str | ||
| modifiable: | ||
| - name: expose_in_topology | ||
| description: "Whether to actively expose this STP in the topology" | ||
| type: bool | ||
| modifiable: | ||
| - name: bandwidth | ||
| description: "Maximum bandwidth for the combined set of STP (in Mbps)" | ||
| type: int | ||
| modifiable: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.