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
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
e8614e72
Verified
Commit
e8614e72
authored
3 months ago
by
Aleksandr Kurbatov
Committed by
Karel van Klink
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
`modify_vrf_router_list`: Added LSO steps
parent
8e080399
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!327
`modify_vrf_router_list`: Added LSO steps
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/vrf/modify_vrf_router_list.py
+56
-2
56 additions, 2 deletions
gso/workflows/vrf/modify_vrf_router_list.py
with
56 additions
and
2 deletions
gso/workflows/vrf/modify_vrf_router_list.py
+
56
−
2
View file @
e8614e72
"""
Modify VRF to add or remove routers.
"""
from
typing
import
Annotated
from
typing
import
Annotated
,
Any
from
orchestrator.forms
import
FormPage
from
orchestrator.targets
import
Target
...
...
@@ -13,7 +13,9 @@ from pydantic_forms.validators import validate_unique_list
from
gso.products.product_types.router
import
Router
from
gso.products.product_types.vrf
import
VRF
from
gso.services.lso_client
import
LSOState
,
lso_interaction
from
gso.utils.helpers
import
active_router_selector
from
gso.utils.types.tt_number
import
TTNumber
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
...
...
@@ -25,6 +27,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
class
ModifyVRFRouterListForm
(
FormPage
):
model_config
=
ConfigDict
(
title
=
f
"
Modify the
{
subscription
.
vrf
.
vrf_name
}
VRF to add or remove routers.
"
)
tt_number
:
TTNumber
router_list
:
Annotated
[
list
[
RouterSelection
],
...
...
@@ -51,6 +54,48 @@ def update_subscription_model(subscription: VRF, router_list: list[dict[str, UUI
return
{
"
subscription
"
:
subscription
}
@step
(
"
[DRY RUN] Update VRF on list of routers
"
)
def
update_vrf_on_routers_dry
(
subscription
:
dict
[
str
,
Any
],
process_id
:
UUIDstr
,
tt_number
:
str
,
router_list
)
->
LSOState
:
"""
Deploy VRF on a list of routers - Dry run.
"""
vrf_new_router_list
=
[
Router
.
from_subscription
(
router
[
"
router_id
"
])
for
router
in
router_list
]
inventory
=
{
"
all
"
:
{
"
hosts
"
:
{
router
.
router
.
router_fqdn
:
None
for
router
in
vrf_new_router_list
}}}
extra_vars
=
{
"
subscription
"
:
subscription
,
"
dry_run
"
:
True
,
"
verb
"
:
"
update
"
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Deploy config for
{
subscription
[
"
description
"
]
}
"
,
}
return
{
"
playbook_name
"
:
"
gap_ansible/playbooks/vrf_update.yaml
"
,
"
inventory
"
:
inventory
,
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Update VRF on list of routers
"
)
def
update_vrf_on_routers_real
(
subscription
:
dict
[
str
,
Any
],
process_id
:
UUIDstr
,
tt_number
:
str
,
router_list
)
->
LSOState
:
"""
Deploy VRF on a list of routers - with commit.
"""
vrf_new_router_list
=
[
Router
.
from_subscription
(
router
[
"
router_id
"
])
for
router
in
router_list
]
inventory
=
{
"
all
"
:
{
"
hosts
"
:
{
router
.
router
.
router_fqdn
:
None
for
router
in
vrf_new_router_list
}}}
extra_vars
=
{
"
subscription
"
:
subscription
,
"
dry_run
"
:
False
,
"
verb
"
:
"
update
"
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Deploy config for
{
subscription
[
"
description
"
]
}
"
,
}
return
{
"
playbook_name
"
:
"
gap_ansible/playbooks/vrf_update.yaml
"
,
"
inventory
"
:
inventory
,
"
extra_vars
"
:
extra_vars
,
}
@workflow
(
"
Modify VRF router list
"
,
initial_input_form
=
wrap_modify_initial_input_form
(
initial_input_form_generator
),
...
...
@@ -58,4 +103,13 @@ def update_subscription_model(subscription: VRF, router_list: list[dict[str, UUI
)
def
modify_vrf_router_list
()
->
StepList
:
"""
Modify the VRF router list.
"""
return
begin
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
update_subscription_model
>>
resync
>>
done
return
(
begin
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
lso_interaction
(
update_vrf_on_routers_dry
)
>>
lso_interaction
(
update_vrf_on_routers_real
)
>>
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