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
d4a2edc2
Commit
d4a2edc2
authored
11 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Made tox happy.
parent
a9630172
No related branches found
No related tags found
1 merge request
!183
Enhancement/nat 484 modify connection strategy
Pipeline
#86000
canceled
11 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/router/modify_connection_strategy.py
+10
-14
10 additions, 14 deletions
gso/workflows/router/modify_connection_strategy.py
test/workflows/router/test_modify_connection_stratey.py
+1
-4
1 addition, 4 deletions
test/workflows/router/test_modify_connection_stratey.py
with
11 additions
and
18 deletions
gso/workflows/router/modify_connection_strategy.py
+
10
−
14
View file @
d4a2edc2
"""
Modify connection strategy workflow. Flipping the connection between in-band to out-of-band.
"""
from
orchestrator.forms
import
FormPage
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
UUIDstr
...
...
@@ -11,13 +12,11 @@ from gso.utils.shared_enums import ConnectionStrategy
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
"""
Initial form with a choice field to m
odify the connection strategy.
"""
"""
M
odify the connection strategy
initial formruff format
.
"""
subscription
=
Router
.
from_subscription
(
subscription_id
)
current_connection_strategy
=
(
ConnectionStrategy
.
OUT_OF_BAND
if
subscription
.
router
.
router_access_via_ts
else
ConnectionStrategy
.
IN_BAND
ConnectionStrategy
.
OUT_OF_BAND
if
subscription
.
router
.
router_access_via_ts
else
ConnectionStrategy
.
IN_BAND
)
class
ModifyConnectionStrategyForm
(
FormPage
):
...
...
@@ -33,8 +32,12 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
@step
(
"
Update subscription model
"
)
def
update_subscription_model
(
subscription
:
Router
,
connection_strategy
:
str
)
->
State
:
"""
Update the database model to update connection strategy.
"""
subscription
.
router
.
router_access_via_ts
=
False
if
connection_strategy
==
ConnectionStrategy
.
IN_BAND
else
True
"""
Update the database model to reflect the new connection strategy.
If the connection strategy is set to IN-BAND, then access_via_ts should be set to False.
Conversely, if the connection strategy is set to OUT-OF-BAND, access_via_ts should be set to True.
"""
subscription
.
router
.
router_access_via_ts
=
connection_strategy
==
ConnectionStrategy
.
OUT_OF_BAND
return
{
"
subscription
"
:
subscription
}
...
...
@@ -46,11 +49,4 @@ def update_subscription_model(subscription: Router, connection_strategy: str) ->
)
def
modify_connection_strategy
()
->
StepList
:
"""
Modify the connection strategy.
"""
return
(
init
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
update_subscription_model
>>
resync
>>
done
)
return
init
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
update_subscription_model
>>
resync
>>
done
This diff is collapsed.
Click to expand it.
test/workflows/router/test_modify_connection_stratey.py
+
1
−
4
View file @
d4a2edc2
...
...
@@ -12,9 +12,7 @@ def test_modify_connection_strategy(responses, nokia_router_subscription_factory
assert
subscription
.
router
.
router_access_via_ts
is
True
form_data
=
[
{
"
subscription_id
"
:
subscription_id
},
{
"
connection_strategy
"
:
ConnectionStrategy
.
IN_BAND
},
{
"
connection_strategy
"
:
ConnectionStrategy
.
IN_BAND
},
]
result
,
_
,
_
=
run_workflow
(
"
modify_connection_strategy
"
,
form_data
)
assert_complete
(
result
)
...
...
@@ -23,4 +21,3 @@ def test_modify_connection_strategy(responses, nokia_router_subscription_factory
updated_subscription
=
Router
.
from_subscription
(
subscription_id
)
assert
updated_subscription
.
status
==
"
active
"
assert
updated_subscription
.
router
.
router_access_via_ts
is
False
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