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
eafaf7b2
Commit
eafaf7b2
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
add checkboxes to iptrunk termination workflow that allow for skipping IPAM and/or config steps
parent
b8b6762c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!50
update intake form of device termination workflow
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/iptrunk/terminate_iptrunk.py
+24
-13
24 additions, 13 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
with
24 additions
and
13 deletions
gso/workflows/iptrunk/terminate_iptrunk.py
+
24
−
13
View file @
eafaf7b2
# noinspection PyProtectedMember
import
ipaddress
from
orchestrator.forms
import
FormPage
from
orchestrator.forms.validators
import
Label
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.workflow
import
StepList
,
done
,
init
,
step
,
workflow
from
orchestrator.workflow
import
StepList
,
conditional
,
done
,
init
,
step
,
workflow
from
orchestrator.workflows.steps
import
resync
,
set_status
,
store_process_subscription
,
unsync
from
orchestrator.workflows.utils
import
wrap_modify_initial_input_form
...
...
@@ -15,17 +14,21 @@ from gso.services.ipam import V4ServiceNetwork, V6ServiceNetwork
from
gso.services.provisioning_proxy
import
pp_interaction
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
subscription
=
Iptrunk
.
from_subscription
(
subscription_id
)
def
initial_input_form_generator
()
->
FormGenerator
:
class
TerminateForm
(
FormPage
):
are_you_sure
:
Label
=
f
"
Are you sure you want to remove
{
subscription
.
description
}
?
"
# type: ignore
termination_label
:
Label
=
(
"
Please confirm whether configuration should get removed from the A and B sides of the trunk, and whether
"
"
IPAM resources should be released.
"
# type: ignore
)
remove_configuration
:
bool
=
True
clean_up_ipam
:
bool
=
True
return
TerminateForm
# type: ignore
user_input
=
yield
TerminateForm
return
user_input
.
dict
()
@step
(
"
Set iptrunk ISIS metric to 9000
"
)
def
modify_iptrunk_subscription
(
subscription
:
Iptrunk
)
->
State
:
def
update_isis_metric
(
subscription
:
Iptrunk
)
->
State
:
subscription
.
iptrunk
.
iptrunk_isis_metric
=
9000
return
{
"
subscription
"
:
subscription
}
...
...
@@ -87,15 +90,23 @@ def deprovision_ip_trunk_ipv6(subscription: Iptrunk) -> dict[str, V4ServiceNetwo
target
=
Target
.
TERMINATE
,
)
def
terminate_iptrunk
()
->
StepList
:
run_config_steps
=
conditional
(
lambda
state
:
state
.
get
(
"
remove_configuration
"
,
True
))
run_ipam_steps
=
conditional
(
lambda
state
:
state
.
get
(
"
clean_up_ipam
"
,
True
))
config_steps
=
(
StepList
([
update_isis_metric
])
>>
pp_interaction
(
drain_traffic_from_ip_trunk
,
3
)
>>
pp_interaction
(
deprovision_ip_trunk_dry
,
3
)
>>
pp_interaction
(
deprovision_ip_trunk_real
,
3
)
)
ipam_steps
=
StepList
([
deprovision_ip_trunk_ipv4
,
deprovision_ip_trunk_ipv6
])
return
(
init
>>
store_process_subscription
(
Target
.
TERMINATE
)
>>
unsync
>>
modify_iptrunk_subscription
>>
pp_interaction
(
drain_traffic_from_ip_trunk
,
3
)
>>
pp_interaction
(
deprovision_ip_trunk_dry
,
3
)
>>
deprovision_ip_trunk_ipv4
>>
deprovision_ip_trunk_ipv6
>>
run_config_steps
(
config_steps
)
>>
run_ipam_steps
(
ipam_steps
)
>>
set_status
(
SubscriptionLifecycle
.
TERMINATED
)
>>
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