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
b0844547
Commit
b0844547
authored
2 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
call into provisioning_proxy module
parent
2cc0f000
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!5
Device workflows
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geant_service_orchestrator/services/provisioning_proxy.py
+4
-1
4 additions, 1 deletion
geant_service_orchestrator/services/provisioning_proxy.py
geant_service_orchestrator/workflows/device/create_device.py
+57
-46
57 additions, 46 deletions
geant_service_orchestrator/workflows/device/create_device.py
with
61 additions
and
47 deletions
geant_service_orchestrator/services/provisioning_proxy.py
+
4
−
1
View file @
b0844547
...
...
@@ -6,7 +6,10 @@ import requests
def
provision_node
(
node_subscription_params
:
DeviceBlock
,
pp_params
=
settings
.
OSSParams
.
PROVISIONING_PROXY
):
dry_run
:
bool
=
False
):
oss
=
settings
.
load_oss_params
()
pp_params
=
oss
.
PROVISIONING_PROXY
assert
pp_params
r
=
requests
.
get
(
f
'
https://
{
pp_params
.
api_base
}
'
f
'
/api/version
'
,
...
...
This diff is collapsed.
Click to expand it.
geant_service_orchestrator/workflows/device/create_device.py
+
57
−
46
View file @
b0844547
...
...
@@ -12,7 +12,7 @@ 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
geant_service_orchestrator.products.product_types
import
device
from
geant_service_orchestrator.services
import
ipam
from
geant_service_orchestrator.services
import
ipam
,
provisioning_proxy
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
...
...
@@ -100,29 +100,35 @@ def provision_device_dry(
ts_address
:
str
,
ts_port
:
str
)
->
State
:
import
ansible_runner
r
=
ansible_runner
.
run
(
private_data_dir
=
"
/opt/geant-gap-ansible
"
,
playbook
=
"
base_config.yaml
"
,
inventory
=
subscription
.
device
.
fqdn
,
extravars
=
{
"
lo_ipv4_address
"
:
str
(
subscription
.
device
.
lo_ipv4_address
),
"
lo_ipv6_address
"
:
str
(
subscription
.
device
.
lo_ipv6_address
),
"
lo_iso_address
"
:
subscription
.
device
.
lo_iso_address
,
"
snmp_location
"
:
subscription
.
device
.
snmp_location
,
"
si_ipv4_network
"
:
str
(
subscription
.
device
.
si_ipv4_network
),
"
lt_ipv4_network
"
:
str
(
subscription
.
device
.
ias_lt_ipv4_network
),
"
lt_ipv6_network
"
:
str
(
subscription
.
device
.
ias_lt_ipv6_network
),
"
site_country_code
"
:
subscription
.
device
.
site_country_code
,
"
verb
"
:
"
deploy
"
,
},
)
out
=
r
.
stdout
.
read
()
out_splitted
=
out
.
splitlines
()
# if r.rc != 0:
# raise ValueError("Ansible has failed")
return
{
"
dry_run_output
"
:
out_splitted
,
"
return_code
"
:
r
.
rc
}
# import ansible_runner
#
# r = ansible_runner.run(
# private_data_dir="/opt/geant-gap-ansible",
# playbook="base_config.yaml",
# inventory=subscription.device.fqdn,
# extravars={
# "lo_ipv4_address": str(subscription.device.lo_ipv4_address),
# "lo_ipv6_address": str(subscription.device.lo_ipv6_address),
# "lo_iso_address": subscription.device.lo_iso_address,
# "snmp_location": subscription.device.snmp_location,
# "si_ipv4_network": str(subscription.device.si_ipv4_network),
# "lt_ipv4_network": str(subscription.device.ias_lt_ipv4_network),
# "lt_ipv6_network": str(subscription.device.ias_lt_ipv6_network),
# "site_country_code": subscription.device.site_country_code,
# "verb": "deploy",
# },
# )
# out = r.stdout.read()
# out_splitted = out.splitlines()
# # if r.rc != 0:
# # raise ValueError("Ansible has failed")
# return {"dry_run_output": out_splitted, "return_code": r.rc}
provisioning_proxy
.
provision_node
(
node_subscription_params
=
subscription
,
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
}
@inputstep
(
"
Confirm step
"
,
assignee
=
"
CHANGES
"
)
...
...
@@ -142,28 +148,33 @@ def provision_device_real(
ts_address
:
str
,
ts_port
:
str
)
->
State
:
import
ansible_runner
r
=
ansible_runner
.
run
(
private_data_dir
=
"
/opt/geant-gap-ansible
"
,
playbook
=
"
base_config.yaml
"
,
inventory
=
subscription
.
device
.
fqdn
,
extravars
=
{
"
lo_ipv4_address
"
:
str
(
subscription
.
device
.
lo_ipv4_address
),
"
lo_ipv6_address
"
:
str
(
subscription
.
device
.
lo_ipv6_address
),
"
lo_iso_address
"
:
subscription
.
device
.
lo_iso_address
,
"
snmp_location
"
:
subscription
.
device
.
snmp_location
,
"
si_ipv4_network
"
:
str
(
subscription
.
device
.
si_ipv4_network
),
"
lt_ipv4_network
"
:
str
(
subscription
.
device
.
ias_lt_ipv4_network
),
"
lt_ipv6_network
"
:
str
(
subscription
.
device
.
ias_lt_ipv6_network
),
"
site_country_code
"
:
subscription
.
device
.
site_country_code
,
"
verb
"
:
"
deploy
"
,
},
)
out
=
r
.
stdout
.
read
()
out_splitted
=
out
.
splitlines
()
return
{
"
real_run_output
"
:
out_splitted
,
"
return_code
"
:
r
.
rc
}
# import ansible_runner
#
# r = ansible_runner.run(
# private_data_dir="/opt/geant-gap-ansible",
# playbook="base_config.yaml",
# inventory=subscription.device.fqdn,
# extravars={
# "lo_ipv4_address": str(subscription.device.lo_ipv4_address),
# "lo_ipv6_address": str(subscription.device.lo_ipv6_address),
# "lo_iso_address": subscription.device.lo_iso_address,
# "snmp_location": subscription.device.snmp_location,
# "si_ipv4_network": str(subscription.device.si_ipv4_network),
# "lt_ipv4_network": str(subscription.device.ias_lt_ipv4_network),
# "lt_ipv6_network": str(subscription.device.ias_lt_ipv6_network),
# "site_country_code": subscription.device.site_country_code,
# "verb": "deploy",
# },
# )
# out = r.stdout.read()
# out_splitted = out.splitlines()
#
# return {"real_run_output": out_splitted, "return_code": r.rc}
provisioning_proxy
.
provision_node
(
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
}
@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