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
d3ce0f47
Verified
Commit
d3ce0f47
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
update workflow and provisioning proxy
parent
c3c750d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!11
Feature/test provisioning proxy
,
!10
Make create_device use provisioning proxy
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/services/provisioning_proxy.py
+7
-4
7 additions, 4 deletions
gso/services/provisioning_proxy.py
gso/workflows/device/create_device.py
+25
-9
25 additions, 9 deletions
gso/workflows/device/create_device.py
with
32 additions
and
13 deletions
gso/services/provisioning_proxy.py
+
7
−
4
View file @
d3ce0f47
import
logging
from
gso.products.product_
type
s.device
import
DeviceBlock
from
gso.products.product_
block
s.device
import
DeviceBlock
Provisioning
from
gso
import
settings
import
requests
...
...
@@ -8,7 +8,8 @@ logger = logging.getLogger(__name__)
def
provision_node
(
node_subscription_params
:
DeviceBlock
,
node_subscription_params
:
DeviceBlockProvisioning
,
callback_url
:
str
,
dry_run
:
bool
=
True
):
oss
=
settings
.
load_oss_params
()
pp_params
=
oss
.
PROVISIONING_PROXY
...
...
@@ -17,12 +18,14 @@ def provision_node(
logger
.
debug
(
f
'
[disabled] provisioning node
{
node_subscription_params
}
'
)
parameters
=
{
'
callback
'
:
oss
.
GENERAL
.
public_hostname
,
# TODO: implement
'
callback
'
:
callback_url
,
'
dry_run
'
:
dry_run
,
'
device
'
:
node_subscription_params
.
dict
()
}
r
=
requests
.
post
(
f
'
https://
{
pp_params
.
api_base
}
'
f
'
/api/device
'
,
params
=
parameters
)
json
=
parameters
)
r
.
raise_for_status
()
requests
.
post
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
gso/workflows/device/create_device.py
+
25
−
9
View file @
d3ce0f47
...
...
@@ -11,8 +11,10 @@ from orchestrator.workflow import done, init, step, workflow
from
orchestrator.workflows.steps
import
resync
,
set_status
from
orchestrator.workflows.steps
import
store_process_subscription
from
orchestrator.workflows.utils
import
wrap_create_initial_input_form
from
gso
import
settings
from
gso.services
import
provisioning_proxy
from
gso.products.product_types
import
device
# from gso.services import ipam, provisioning_proxy
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
...
...
@@ -96,12 +98,16 @@ def initialize_subscription(
@step
(
"
Provision device [DRY RUN]
"
)
def
provision_device_dry
(
subscription
:
device
.
DeviceProvisioning
,
fqdn
:
str
,
ts_address
:
str
,
ts_port
:
str
)
->
State
:
def
provision_device_dry
(
subscription
:
device
.
DeviceProvisioning
)
->
State
:
# TODO: verify this URL
callback_url
=
f
'
{
settings
.
load_oss_params
().
GENERAL
.
public_hostname
}
'
\
f
'
/api/process/
{
subscription
.
product
.
product_id
}
/resume
'
proxy_result
=
provisioning_proxy
.
provision_node
(
subscription
.
device
,
callback_url
)
# import ansible_runner
#
# r = ansible_runner.run(
...
...
@@ -130,7 +136,7 @@ def provision_device_dry(
# dry_run=True)
# TODO: figure out what to return when we are suspending & waiting
# for the provisioning-proxy to call back
return
{
"
return_code
"
:
0
}
return
{
"
subscription
"
:
proxy_result
}
@inputstep
(
"
Confirm step
"
,
assignee
=
"
CHANGES
"
)
...
...
@@ -150,6 +156,16 @@ def provision_device_real(
ts_address
:
str
,
ts_port
:
str
)
->
State
:
# TODO: generate actual callback URL
callback_url
=
settings
.
load_oss_params
().
GENERAL
.
public_hostname
provisioning_proxy
.
provision_node
(
subscription
.
device
,
callback_url
,
False
)
# import ansible_runner
#
# r = ansible_runner.run(
...
...
@@ -176,7 +192,7 @@ def provision_device_real(
# node_subscription_params=subscription)
# TODO: figure out what to return when we are suspending & waiting
# for the provisioning-proxy to call back
return
{
"
return_code
"
:
0
}
return
{
"
subscription
"
:
subscription
}
@workflow
(
...
...
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