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
65b9fe55
Commit
65b9fe55
authored
5 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Add create_vrf WF.
parent
b689a62d
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/vrf/__init__.py
+1
-0
1 addition, 0 deletions
gso/workflows/vrf/__init__.py
gso/workflows/vrf/create_vrf.py
+80
-0
80 additions, 0 deletions
gso/workflows/vrf/create_vrf.py
with
81 additions
and
0 deletions
gso/workflows/vrf/__init__.py
0 → 100644
+
1
−
0
View file @
65b9fe55
"""
:term:`VRF` Virtual Routing and Forwarding.
"""
This diff is collapsed.
Click to expand it.
gso/workflows/vrf/create_vrf.py
0 → 100644
+
80
−
0
View file @
65b9fe55
"""
A creation workflow for adding a new virtual routing and forwarding (:term:`VRF`) service.
"""
from
orchestrator.forms
import
FormPage
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.workflow
import
StepList
,
begin
,
done
,
step
,
workflow
from
orchestrator.workflows.steps
import
resync
,
set_status
,
store_process_subscription
from
orchestrator.workflows.utils
import
wrap_create_initial_input_form
from
pydantic
import
ConfigDict
from
pydantic_forms.validators
import
ReadOnlyField
from
gso.products.product_types.vrf
import
VRFInactive
from
gso.services.partners
import
get_partner_by_name
from
gso.utils.types.tt_number
import
TTNumber
from
gso.workflows.shared
import
create_summary_form
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
"""
Gather information about the new router from the operator.
"""
class
CreateVRFForm
(
FormPage
):
model_config
=
ConfigDict
(
title
=
product_name
)
tt_number
:
TTNumber
partner
:
ReadOnlyField
(
"
GEANT
"
,
default_type
=
str
)
# type: ignore[valid-type]
vrf_name
:
str
route_distinguisher
:
str
route_target
:
str
user_input
=
yield
CreateVRFForm
user_input
=
user_input
.
model_dump
()
summary_fields
=
[
"
vrf_name
"
,
"
route_distinguisher
"
,
"
route_target
"
]
yield
from
create_summary_form
(
user_input
,
product_name
,
summary_fields
)
return
user_input
@step
(
"
Create subscription
"
)
def
create_subscription
(
product
:
UUIDstr
,
partner
:
str
)
->
State
:
"""
Create a new :term:`VRF` subscription.
"""
subscription
=
VRFInactive
.
from_product_id
(
product
,
get_partner_by_name
(
partner
)[
"
partner_id
"
])
return
{
"
subscription
"
:
subscription
,
"
subscription_id
"
:
subscription
.
subscription_id
,
}
@step
(
"
Initialize subscription
"
)
def
initialize_subscription
(
subscription
:
VRFInactive
,
vrf_name
:
str
,
route_distinguisher
:
str
,
route_target
:
str
,
)
->
State
:
"""
Initialise the subscription object in the service database.
"""
subscription
.
vrf
.
vrf_name
=
vrf_name
subscription
.
vrf
.
route_distinguisher
=
route_distinguisher
subscription
.
vrf
.
route_target
=
route_target
subscription
.
description
=
f
"
VRF
{
vrf_name
}
"
return
{
"
subscription
"
:
subscription
}
@workflow
(
"
Create VRF
"
,
initial_input_form
=
wrap_create_initial_input_form
(
initial_input_form_generator
),
target
=
Target
.
CREATE
,
)
def
create_vrf
()
->
StepList
:
"""
Create a virtual routing and forwarding (:term:`VRF`) service.
"""
return
(
begin
>>
create_subscription
>>
store_process_subscription
(
Target
.
CREATE
)
>>
initialize_subscription
>>
set_status
(
SubscriptionLifecycle
.
ACTIVE
)
>>
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