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
Merge requests
!10
Make create_device use provisioning proxy
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Make create_device use provisioning proxy
feature/test-provisioning-proxy
into
develop
Overview
0
Commits
7
Pipelines
0
Changes
6
Merged
Karel van Klink
requested to merge
feature/test-provisioning-proxy
into
develop
2 years ago
Overview
0
Commits
7
Pipelines
0
Changes
6
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
9875c289
7 commits,
2 years ago
6 files
+
165
−
141
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
gso/services/provisioning_proxy.py
+
79
−
10
Options
import
logging
from
gso.products.product_types.device
\
import
DeviceBlock
import
requests
from
orchestrator
import
inputstep
from
orchestrator.config.assignee
import
Assignee
from
orchestrator.forms
import
FormPage
,
ReadOnlyField
from
orchestrator.forms.validators
import
Accept
,
Label
,
LongText
from
orchestrator.types
import
UUIDstr
,
State
from
gso
import
settings
# import requests
from
gso.products.product_types.device
import
DeviceProvisioning
logger
=
logging
.
getLogger
(
__name__
)
def
provision_node
(
node_subscription_params
:
DeviceBlock
,
node_subscription_params
:
DeviceProvisioning
,
process_id
:
UUIDstr
,
dry_run
:
bool
=
True
):
oss
=
settings
.
load_oss_params
()
pp_params
=
oss
.
PROVISIONING_PROXY
assert
pp_params
logger
.
debug
(
f
'
[disabled] provisioning node
{
node_subscription_params
}
'
)
device_params
=
node_subscription_params
.
device
callback_url
=
f
'
{
settings
.
load_oss_params
().
GENERAL
.
public_hostname
}
'
\
f
'
/api/processes/
{
process_id
}
/resume
'
logger
.
debug
(
f
'
[disabled] provisioning node
{
device_params
}
'
)
parameters
=
{
'
callback
'
:
callback_url
,
'
dry_run
'
:
dry_run
,
'
device
'
:
{
'
fqdn
'
:
device_params
.
fqdn
,
'
lo_address
'
:
{
'
v4
'
:
str
(
device_params
.
lo_ipv4_address
),
'
v6
'
:
str
(
device_params
.
lo_ipv6_address
)
},
'
lo_iso_address
'
:
device_params
.
lo_iso_address
,
'
si_ipv4_network
'
:
str
(
device_params
.
si_ipv4_network
),
'
ias_lt_network
'
:
{
'
v4
'
:
str
(
device_params
.
ias_lt_ipv4_network
),
'
v6
'
:
str
(
device_params
.
ias_lt_ipv6_network
)
},
'
site_country_code
'
:
device_params
.
site_country_code
,
'
site_city
'
:
device_params
.
site_city
,
'
site_latitude
'
:
device_params
.
site_latitude
,
'
site_longitude
'
:
device_params
.
site_longitude
,
'
snmp_location
'
:
device_params
.
snmp_location
,
'
device_type
'
:
node_subscription_params
.
device_type
,
'
device_vendor
'
:
node_subscription_params
.
device_vendor
,
'
ts_address
'
:
device_params
.
ts_address
,
'
ts_port
'
:
device_params
.
ts_port
}
}
post_request
=
requests
.
post
(
f
'
{
pp_params
.
scheme
}
://
{
pp_params
.
api_base
}
'
f
'
/api/device
'
,
json
=
parameters
)
post_request
.
raise_for_status
()
@inputstep
(
'
Await provisioning proxy results
'
,
assignee
=
Assignee
(
'
SYSTEM
'
))
def
await_pp_results
()
->
State
:
class
ProvisioningResultPage
(
FormPage
):
class
Config
:
title
=
'
Do NOT click on confirm in this step!
'
warning_label
:
Label
=
'
This step relies on an external service to
'
\
'
send an update to the orchestrator, do not
'
\
'
interfere with this process please.
'
pp_run_results
:
dict
=
{
'
state
'
:
'
not_ready
'
}
confirm
:
Accept
=
Accept
(
'
INCOMPLETE
'
)
result_page
=
yield
ProvisioningResultPage
return
result_page
.
dict
()
@inputstep
(
'
Confirm provisioning proxy results
'
,
assignee
=
Assignee
(
'
SYSTEM
'
))
def
confirm_pp_results
(
state
:
State
)
->
State
:
class
ConfirmRunPage
(
FormPage
):
class
Config
:
title
=
'
Execution completed, please confirm the results.
'
run_status
:
str
=
ReadOnlyField
(
state
[
'
pp_run_results
'
][
'
status
'
])
run_results
:
LongText
=
ReadOnlyField
(
f
"
{
state
[
'
pp_run_results
'
][
'
output
'
]
}
"
)
confirm
:
Accept
=
Accept
(
'
INCOMPLETE
'
)
yield
ConfirmRunPage
# r = requests.get(
# f'https://{pp_params.api_base}'
# f'/api/version',
# params=node_subscription_params.dict())
# r.raise_for_status()
return
state
Loading