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
78261fdb
Commit
78261fdb
authored
1 year ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Replace GEANT as a customer in importing site.
parent
12a9336a
No related branches found
No related tags found
1 merge request
!60
Feature/nat 217 import sites
Pipeline
#83855
failed
1 year ago
Stage: tox
Stage: documentation
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/api/api_v1/endpoints/imports.py
+2
-1
2 additions, 1 deletion
gso/api/api_v1/endpoints/imports.py
gso/workflows/tasks/import_site.py
+5
-2
5 additions, 2 deletions
gso/workflows/tasks/import_site.py
with
7 additions
and
3 deletions
gso/api/api_v1/endpoints/imports.py
+
2
−
1
View file @
78261fdb
...
@@ -42,6 +42,7 @@ class SiteImport(BaseModel):
...
@@ -42,6 +42,7 @@ class SiteImport(BaseModel):
site_internal_id
:
int
site_internal_id
:
int
site_tier
:
SiteTier
site_tier
:
SiteTier
site_ts_address
:
str
site_ts_address
:
str
customer
:
str
@router.post
(
"
/sites
"
,
status_code
=
status
.
HTTP_201_CREATED
,
tags
=
[
"
Import
"
])
@router.post
(
"
/sites
"
,
status_code
=
status
.
HTTP_201_CREATED
,
tags
=
[
"
Import
"
])
...
@@ -70,7 +71,7 @@ def import_site(site: SiteImport) -> Dict[str, Any]:
...
@@ -70,7 +71,7 @@ def import_site(site: SiteImport) -> Dict[str, Any]:
raise
HTTPException
(
status_code
=
status
.
HTTP_409_CONFLICT
,
detail
=
"
Multiple subscriptions found.
"
)
raise
HTTPException
(
status_code
=
status
.
HTTP_409_CONFLICT
,
detail
=
"
Multiple subscriptions found.
"
)
pid
=
start_process
(
"
import_site
"
,
site
.
dict
())
pid
=
start_process
(
"
import_site
"
,
site
.
dict
())
return
{
"
detail
"
:
"
Site
import process started
.
"
,
"
pid
"
:
pid
}
return
{
"
detail
"
:
"
Site
added successfully
.
"
,
"
pid
"
:
pid
}
class
RouterImportModel
(
BaseModel
):
class
RouterImportModel
(
BaseModel
):
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/tasks/import_site.py
+
5
−
2
View file @
78261fdb
...
@@ -9,13 +9,15 @@ from orchestrator.workflows.steps import resync, set_status, store_process_subsc
...
@@ -9,13 +9,15 @@ from orchestrator.workflows.steps import resync, set_status, store_process_subsc
from
gso.products.product_blocks.site
import
SiteTier
from
gso.products.product_blocks.site
import
SiteTier
from
gso.products.product_types
import
site
from
gso.products.product_types
import
site
from
gso.services.crm
import
get_customer_by_name
from
gso.workflows.site.create_site
import
initialize_subscription
from
gso.workflows.site.create_site
import
initialize_subscription
@step
(
"
Create subscription
"
)
@step
(
"
Create subscription
"
)
def
create_subscription
()
->
State
:
def
create_subscription
(
customer
:
str
)
->
State
:
customer_id
:
UUID
=
get_customer_by_name
(
customer
)[
"
id
"
]
product_id
:
UUID
=
ProductTable
.
query
.
filter_by
(
product_type
=
"
Site
"
).
first
().
product_id
product_id
:
UUID
=
ProductTable
.
query
.
filter_by
(
product_type
=
"
Site
"
).
first
().
product_id
subscription
=
site
.
SiteInactive
.
from_product_id
(
product_id
,
uuid4
()
)
subscription
=
site
.
SiteInactive
.
from_product_id
(
product_id
,
customer_id
)
return
{
return
{
"
subscription
"
:
subscription
,
"
subscription
"
:
subscription
,
...
@@ -38,6 +40,7 @@ def generate_initial_input_form() -> FormGenerator:
...
@@ -38,6 +40,7 @@ def generate_initial_input_form() -> FormGenerator:
site_internal_id
:
int
site_internal_id
:
int
site_tier
:
SiteTier
site_tier
:
SiteTier
site_ts_address
:
str
site_ts_address
:
str
customer
:
str
user_input
=
yield
ImportSite
user_input
=
yield
ImportSite
return
user_input
.
dict
()
return
user_input
.
dict
()
...
...
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