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
c784fd8f
Verified
Commit
c784fd8f
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
make use of partials for sending requests in provisioning proxy
parent
1449d7fa
No related branches found
No related tags found
1 merge request
!96
Make use of new callback step for external provisioning
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/services/provisioning_proxy.py
+14
-8
14 additions, 8 deletions
gso/services/provisioning_proxy.py
with
14 additions
and
8 deletions
gso/services/provisioning_proxy.py
+
14
−
8
View file @
c784fd8f
...
...
@@ -6,6 +6,7 @@ import json
import
logging
import
requests
from
functools
import
partial
from
orchestrator
import
step
from
orchestrator.config.assignee
import
Assignee
from
orchestrator.types
import
State
,
UUIDstr
,
strEnum
...
...
@@ -34,9 +35,11 @@ class CUDOperation(strEnum):
DELETE
=
"
DELETE
"
def
_send_request
(
endpoint
:
str
,
parameters
:
dict
,
callback_route
:
str
,
operation
:
CUDOperation
)
->
None
:
def
_send_request
(
operation
:
CUDOperation
,
endpoint
:
str
,
parameters
:
dict
,
callback_route
:
str
)
->
None
:
"""
Send a request to :term:`LSO`. The callback address is derived using the process ID provided.
:param operation: The specific operation that
'
s performed with the request.
:type operation: :class:`CUDOperation`
:param endpoint: The :term:`LSO`-specific endpoint to call, depending on the type of service object that
'
s acted
upon.
:type endpoint: str
...
...
@@ -45,8 +48,6 @@ def _send_request(endpoint: str, parameters: dict, callback_route: str, operatio
:type parameters: dict
:param callback_route: The callback route that should be used to resume the workflow.
:type callback_route: str
:param operation: The specific operation that
'
s performed with the request.
:type operation: :class:`CUDOperation`
:rtype: None
"""
oss
=
settings
.
load_oss_params
()
...
...
@@ -75,6 +76,11 @@ def _send_request(endpoint: str, parameters: dict, callback_route: str, operatio
raise
AssertionError
(
request
.
content
)
_send_post
=
partial
(
_send_request
,
CUDOperation
.
POST
)
_send_put
=
partial
(
_send_request
,
CUDOperation
.
PUT
)
_send_delete
=
partial
(
_send_request
,
CUDOperation
.
DELETE
)
def
provision_router
(
subscription
:
RouterProvisioning
,
process_id
:
UUIDstr
,
callback_route
:
str
,
tt_number
:
str
,
dry_run
:
bool
=
True
)
->
None
:
...
...
@@ -99,7 +105,7 @@ def provision_router(
"
subscription
"
:
json
.
loads
(
json_dumps
(
subscription
)),
}
_send_
reque
st
(
"
router
"
,
parameters
,
callback_route
,
CUDOperation
.
POST
)
_send_
po
st
(
"
router
"
,
parameters
,
callback_route
)
def
provision_ip_trunk
(
...
...
@@ -139,7 +145,7 @@ def provision_ip_trunk(
"
removed_ae_members
"
:
removed_ae_members
,
}
_send_
reque
st
(
"
ip_trunk
"
,
parameters
,
callback_route
,
CUDOperation
.
POST
)
_send_
po
st
(
"
ip_trunk
"
,
parameters
,
callback_route
)
def
check_ip_trunk
(
...
...
@@ -165,7 +171,7 @@ def check_ip_trunk(
"
check_name
"
:
check_name
,
}
_send_
reque
st
(
"
ip_trunk/perform_check
"
,
parameters
,
callback_route
,
CUDOperation
.
POST
)
_send_
po
st
(
"
ip_trunk/perform_check
"
,
parameters
,
callback_route
)
def
deprovision_ip_trunk
(
...
...
@@ -193,7 +199,7 @@ def deprovision_ip_trunk(
"
verb
"
:
"
terminate
"
,
}
_send_
request
(
"
ip_trunk
"
,
parameters
,
callback_route
,
CUDOperation
.
DELETE
)
_send_
delete
(
"
ip_trunk
"
,
parameters
,
callback_route
)
def
migrate_ip_trunk
(
...
...
@@ -251,7 +257,7 @@ def migrate_ip_trunk(
"
dry_run
"
:
dry_run
,
}
_send_
reque
st
(
"
ip_trunk/migrate
"
,
parameters
,
callback_route
,
CUDOperation
.
POST
)
_send_
po
st
(
"
ip_trunk/migrate
"
,
parameters
,
callback_route
)
@step
(
"
Evaluate provisioning proxy result
"
)
...
...
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