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
d53b9ef8
Verified
Commit
d53b9ef8
authored
3 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Put repeated strings in reusable constants
parent
c4cb5fc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!330
Feature/sonarqube improvements
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/cli/imports.py
+6
-5
6 additions, 5 deletions
gso/cli/imports.py
gso/services/lso_client.py
+7
-4
7 additions, 4 deletions
gso/services/lso_client.py
with
13 additions
and
9 deletions
gso/cli/imports.py
+
6
−
5
View file @
d53b9ef8
...
...
@@ -53,6 +53,7 @@ from gso.utils.types.ip_address import (
from
gso.utils.types.virtual_identifiers
import
VC_ID
,
VLAN_ID
app
:
typer
.
Typer
=
typer
.
Typer
()
IMPORT_WAIT_MESSAGE
=
"
Waiting for the dust to settle before importing new products...
"
class
CreatePartner
(
BaseModel
):
...
...
@@ -451,7 +452,7 @@ def _generic_import_product(
except
ValidationError
as
e
:
typer
.
echo
(
f
"
Validation error:
{
e
}
"
)
typer
.
echo
(
"
Waiting for the dust to settle before moving on the importing new products...
"
)
typer
.
echo
(
IMPORT_WAIT_MESSAGE
)
time
.
sleep
(
1
)
# Migrate new products from imported to "full" counterpart.
...
...
@@ -539,7 +540,7 @@ def import_edge_port(filepath: str = common_filepath_option) -> None:
except
ValidationError
as
e
:
typer
.
echo
(
f
"
Validation error:
{
e
}
"
)
typer
.
echo
(
"
Waiting for the dust to settle before moving on the importing new products...
"
)
typer
.
echo
(
IMPORT_WAIT_MESSAGE
)
time
.
sleep
(
1
)
edge_port_ids
=
get_subscriptions
(
...
...
@@ -610,7 +611,7 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None:
except
ValidationError
as
e
:
typer
.
echo
(
f
"
Validation error:
{
e
}
"
)
typer
.
echo
(
"
Waiting for the dust to settle before moving on the importing new products...
"
)
typer
.
echo
(
IMPORT_WAIT_MESSAGE
)
time
.
sleep
(
1
)
trunk_ids
=
get_subscriptions
(
...
...
@@ -670,7 +671,7 @@ def import_l3_core_service(filepath: str = common_filepath_option) -> None:
except
ValidationError
as
e
:
typer
.
echo
(
f
"
Validation error:
{
e
}
"
)
typer
.
echo
(
"
Waiting for the dust to settle before importing new products...
"
)
typer
.
echo
(
IMPORT_WAIT_MESSAGE
)
time
.
sleep
(
1
)
# Migrate new products from imported to "full" counterpart.
...
...
@@ -728,7 +729,7 @@ def import_layer_2_circuit_service(filepath: str = common_filepath_option) -> No
)
except
ValidationError
as
e
:
typer
.
echo
(
f
"
Validation error:
{
e
}
"
)
typer
.
echo
(
"
Waiting for the dust to settle before importing new products...
"
)
typer
.
echo
(
IMPORT_WAIT_MESSAGE
)
time
.
sleep
(
1
)
# Migrate new products from imported to "full" counterpart.
...
...
This diff is collapsed.
Click to expand it.
gso/services/lso_client.py
+
7
−
4
View file @
d53b9ef8
...
...
@@ -22,6 +22,7 @@ from unidecode import unidecode
from
gso
import
settings
logger
=
logging
.
getLogger
(
__name__
)
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME
=
"
Running Ansible playbook
"
class
_LSOState
(
TypedDict
):
# noqa: PYI049
...
...
@@ -211,7 +212,7 @@ def lso_interaction(provisioning_step: Step) -> StepList:
>>
_inventory_is_not_empty
(
begin
>>
callback_step
(
name
=
"
Running Ansible playbook
"
,
action_step
=
_execute_playbook
,
validate_step
=
_evaluate_results
name
=
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME
,
action_step
=
_execute_playbook
,
validate_step
=
_evaluate_results
)
>>
step
(
"
Inject result title
"
)(
lambda
:
{
"
lso_result_title
"
:
provisioning_step
.
name
})
>>
_show_results
...
...
@@ -243,7 +244,7 @@ def indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>>
_inventory_is_not_empty
(
begin
>>
callback_step
(
name
=
"
Running Ansible playbook
"
,
action_step
=
_execute_playbook
,
validate_step
=
_ignore_results
name
=
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME
,
action_step
=
_execute_playbook
,
validate_step
=
_ignore_results
)
>>
step
(
"
Inject result title
"
)(
lambda
:
{
"
lso_result_title
"
:
provisioning_step
.
name
})
>>
_show_results
...
...
@@ -268,7 +269,9 @@ def anonymous_lso_interaction(provisioning_step: Step, validation_step: Step = _
begin
>>
provisioning_step
>>
_inventory_is_not_empty
(
callback_step
(
name
=
"
Running Ansible playbook
"
,
action_step
=
_execute_playbook
,
validate_step
=
validation_step
)
callback_step
(
name
=
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME
,
action_step
=
_execute_playbook
,
validate_step
=
validation_step
)
)
>>
_clean_state
)
...
...
@@ -287,7 +290,7 @@ def anonymous_indifferent_lso_interaction(provisioning_step: Step) -> StepList:
>>
provisioning_step
>>
_inventory_is_not_empty
(
callback_step
(
name
=
"
Running Ansible playbook
"
,
name
=
RUNNING_ANSIBLE_PLAYBOOK_STEP_NAME
,
action_step
=
_execute_playbook
,
validate_step
=
_ignore_results
,
)
...
...
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