Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LSO
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
LSO
Commits
86c18127
Verified
Commit
86c18127
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
migrate device to router, fix bug with playbook output
parent
95ba15a2
No related branches found
No related tags found
1 merge request
!41
Feature/migrate device to router
Pipeline
#83831
failed
1 year ago
Stage: tox
Stage: documentation
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lso/__init__.py
+2
-2
2 additions, 2 deletions
lso/__init__.py
lso/playbook.py
+1
-1
1 addition, 1 deletion
lso/playbook.py
lso/routes/router.py
+3
-6
3 additions, 6 deletions
lso/routes/router.py
with
6 additions
and
9 deletions
lso/__init__.py
+
2
−
2
View file @
86c18127
...
@@ -5,7 +5,7 @@ from fastapi import FastAPI
...
@@ -5,7 +5,7 @@ from fastapi import FastAPI
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.cors
import
CORSMiddleware
from
lso
import
config
,
environment
from
lso
import
config
,
environment
from
lso.routes
import
default
,
device
,
ip_trunk
from
lso.routes
import
default
,
router
,
ip_trunk
def
create_app
()
->
FastAPI
:
def
create_app
()
->
FastAPI
:
...
@@ -26,7 +26,7 @@ def create_app() -> FastAPI:
...
@@ -26,7 +26,7 @@ def create_app() -> FastAPI:
)
)
app
.
include_router
(
default
.
router
,
prefix
=
"
/api
"
)
app
.
include_router
(
default
.
router
,
prefix
=
"
/api
"
)
app
.
include_router
(
device
.
router
,
prefix
=
"
/api/
device
"
)
app
.
include_router
(
router
.
router
,
prefix
=
"
/api/
router
"
)
app
.
include_router
(
ip_trunk
.
router
,
prefix
=
"
/api/ip_trunk
"
)
app
.
include_router
(
ip_trunk
.
router
,
prefix
=
"
/api/ip_trunk
"
)
# test that config params are loaded and available
# test that config params are loaded and available
...
...
This diff is collapsed.
Click to expand it.
lso/playbook.py
+
1
−
1
View file @
86c18127
...
@@ -94,7 +94,7 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
...
@@ -94,7 +94,7 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent
try
:
try
:
task_output
=
json
.
loads
(
line
)
task_output
=
json
.
loads
(
line
)
if
"
res
"
in
task_output
[
"
event_data
"
]
and
(
if
"
res
"
in
task_output
[
"
event_data
"
]
and
(
task_output
[
"
event_data
"
][
"
res
"
][
"
changed
"
]
is
True
or
int
(
ansible_playbook_run
.
rc
)
!=
0
int
(
ansible_playbook_run
.
rc
)
!=
0
or
task_output
[
"
event_data
"
][
"
res
"
][
"
changed
"
]
is
True
):
):
# The line contains result data, and must either consist of a change, or the playbook failed, and we
# The line contains result data, and must either consist of a change, or the playbook failed, and we
# want all steps, including those that didn't make changes.
# want all steps, including those that didn't make changes.
...
...
This diff is collapsed.
Click to expand it.
lso/routes/
device
.py
→
lso/routes/
router
.py
+
3
−
6
View file @
86c18127
...
@@ -42,20 +42,17 @@ async def provision_node(params: NodeProvisioningParams) -> playbook.PlaybookLau
...
@@ -42,20 +42,17 @@ async def provision_node(params: NodeProvisioningParams) -> playbook.PlaybookLau
:rtype: :class:`lso.playbook.PlaybookLaunchResponse`
:rtype: :class:`lso.playbook.PlaybookLaunchResponse`
"""
"""
extra_vars
=
{
extra_vars
=
{
"
wfo_
device
_json
"
:
params
.
subscription
,
"
wfo_
router
_json
"
:
params
.
subscription
,
"
dry_run
"
:
str
(
params
.
dry_run
),
"
dry_run
"
:
str
(
params
.
dry_run
),
"
verb
"
:
"
deploy
"
,
"
verb
"
:
"
deploy
"
,
"
commit_comment
"
:
"
Base config deployed with WFO/LSO & Ansible
"
,
"
commit_comment
"
:
"
Base config deployed with WFO/LSO & Ansible
"
,
}
}
if
params
.
subscription
[
"
device_type
"
]
==
"
router
"
:
playbook_path
=
os
.
path
.
join
(
config_params
.
ansible_playbooks_root_dir
,
"
base_config.yaml
"
)
playbook_path
=
os
.
path
.
join
(
config_params
.
ansible_playbooks_root_dir
,
"
base_config.yaml
"
)
else
:
raise
ValueError
(
f
"
Cannot find playbook path for device type
"
f
"
{
params
.
subscription
[
'
device_type
'
]
}
!!
"
)
return
playbook
.
run_playbook
(
return
playbook
.
run_playbook
(
playbook_path
=
playbook_path
,
playbook_path
=
playbook_path
,
inventory
=
f
"
{
params
.
subscription
[
'
device
'
][
'
device
_fqdn
'
]
}
"
,
inventory
=
f
"
{
params
.
subscription
[
'
router
'
][
'
router
_fqdn
'
]
}
"
,
extra_vars
=
extra_vars
,
extra_vars
=
extra_vars
,
callback
=
params
.
callback
,
callback
=
params
.
callback
,
)
)
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