Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
00e2a539
Commit
00e2a539
authored
7 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Add modification WF
parent
aa70a732
No related branches found
No related tags found
1 merge request
!314
Feature/vrf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/__init__.py
+4
-0
4 additions, 0 deletions
gso/workflows/__init__.py
gso/workflows/vrf/modify_vrf_router_list.py
+58
-0
58 additions, 0 deletions
gso/workflows/vrf/modify_vrf_router_list.py
with
62 additions
and
0 deletions
gso/workflows/__init__.py
+
4
−
0
View file @
00e2a539
...
@@ -129,3 +129,7 @@ LazyWorkflowInstance("gso.workflows.l2_circuit.modify_layer_2_circuit", "modify_
...
@@ -129,3 +129,7 @@ LazyWorkflowInstance("gso.workflows.l2_circuit.modify_layer_2_circuit", "modify_
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.terminate_layer_2_circuit
"
,
"
terminate_layer_2_circuit
"
)
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.terminate_layer_2_circuit
"
,
"
terminate_layer_2_circuit
"
)
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.create_imported_layer_2_circuit
"
,
"
create_imported_layer_2_circuit
"
)
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.create_imported_layer_2_circuit
"
,
"
create_imported_layer_2_circuit
"
)
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.import_layer_2_circuit
"
,
"
import_layer_2_circuit
"
)
LazyWorkflowInstance
(
"
gso.workflows.l2_circuit.import_layer_2_circuit
"
,
"
import_layer_2_circuit
"
)
# VRF workflows
LazyWorkflowInstance
(
"
gso.workflows.vrf.create_vrf
"
,
"
create_vrf
"
)
LazyWorkflowInstance
(
"
gso.workflows.vrf.modify_vrf_router_list
"
,
"
modify_vrf_router_list
"
)
This diff is collapsed.
Click to expand it.
gso/workflows/vrf/modify_vrf_router_list.py
0 → 100644
+
58
−
0
View file @
00e2a539
"""
Modify :term:`VRF` to add or remove routers.
"""
from
typing
import
Annotated
from
orchestrator.forms
import
FormPage
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
UUIDstr
from
orchestrator.workflow
import
StepList
,
begin
,
done
,
step
,
workflow
from
orchestrator.workflows.steps
import
resync
,
store_process_subscription
,
unsync
from
orchestrator.workflows.utils
import
wrap_modify_initial_input_form
from
pydantic
import
BaseModel
,
ConfigDict
,
Field
from
gso.products.product_types.router
import
Router
from
gso.products.product_types.vrf
import
VRF
from
gso.utils.helpers
import
active_router_selector
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
"""
Modify :term:`VRF` to add or remove routers.
"""
subscription
=
VRF
.
from_subscription
(
subscription_id
)
class
RouterSelection
(
BaseModel
):
router_id
:
active_router_selector
()
# type: ignore[valid-type]
class
ModifyVRFRouterListForm
(
FormPage
):
model_config
=
ConfigDict
(
title
=
f
"
Modify the
{
subscription
.
vrf
.
vrf_name
}
VRF to add or remove routers.
"
)
router_list
:
Annotated
[
list
[
RouterSelection
],
Field
(
description
=
"
A list of routers to add or remove from the VRF.
"
,
min_length
=
0
if
subscription
.
vrf
.
vrf_router_list
else
1
,
),
]
=
[
# noqa: RUF012
RouterSelection
(
router_id
=
str
(
router
.
owner_subscription_id
))
for
router
in
subscription
.
vrf
.
vrf_router_list
]
user_input
=
yield
ModifyVRFRouterListForm
return
user_input
.
model_dump
()
@step
(
"
Update subscription model
"
)
def
update_subscription_model
(
subscription
:
VRF
,
router_list
:
list
[
dict
[
str
,
UUIDstr
]])
->
State
:
"""
Update the database model to update the router list.
"""
subscription
.
vrf
.
vrf_router_list
=
[
Router
.
from_subscription
(
router
[
"
router_id
"
]).
router
for
router
in
router_list
]
return
{
"
subscription
"
:
subscription
}
@workflow
(
"
Modify VRF router list
"
,
initial_input_form
=
wrap_modify_initial_input_form
(
initial_input_form_generator
),
target
=
Target
.
MODIFY
,
)
def
modify_vrf_router_list
()
->
StepList
:
"""
Modify the :term:`VRF` router list.
"""
return
begin
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
update_subscription_model
>>
resync
>>
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment