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
8d6f0d9d
Commit
8d6f0d9d
authored
1 year ago
by
Karel van Klink
Committed by
Neda Moeini
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add nightly schedule for router validation
parent
513f4541
No related branches found
Branches containing commit
Tags
2.0
Tags containing commit
1 merge request
!139
Feature/add validation workflows
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/schedules/__init__.py
+8
-0
8 additions, 0 deletions
gso/schedules/__init__.py
gso/schedules/validate_routers_nightly.py
+21
-0
21 additions, 0 deletions
gso/schedules/validate_routers_nightly.py
gso/workflows/tasks/validate_router.py
+14
-7
14 additions, 7 deletions
gso/workflows/tasks/validate_router.py
with
43 additions
and
7 deletions
gso/schedules/__init__.py
+
8
−
0
View file @
8d6f0d9d
"""
Tasks that are scheduled to run periodically in :term:`GSO`.
"""
from
orchestrator.schedules
import
SchedulingFunction
# type:ignore[attr-defined]
from
gso.schedules.validate_routers_nightly
import
run_validate_routers
# TODO: This list overwrites the default, and therefore leaves all default schedules unused.
# TODO: Consider using the default schedules.
ALL_SCHEDULERS
:
list
[
SchedulingFunction
]
=
[
run_validate_routers
]
This diff is collapsed.
Click to expand it.
gso/schedules/validate_routers_nightly.py
0 → 100644
+
21
−
0
View file @
8d6f0d9d
"""
Nightly schedule for validating all active Routers
'
configuration.
"""
import
logging
from
orchestrator.schedules.scheduling
import
scheduler
from
orchestrator.services.processes
import
start_process
from
gso.services.subscriptions
import
get_active_router_subscriptions
logger
=
logging
.
getLogger
(
__name__
)
@scheduler
(
name
=
"
Validate routers
"
,
time_unit
=
"
day
"
,
at
=
"
03:00
"
)
def
run_validate_routers
()
->
None
:
"""
Validate configuration on all active Routers, every night at 3AM.
"""
routers
=
get_active_router_subscriptions
(
includes
=
[
"
subscription_id
"
])
for
router
in
routers
:
msg
=
f
"
Validating configuration of router subscription
{
router
[
'
subscription_id
'
]
}
"
logger
.
info
(
msg
)
start_process
(
"
validate_router
"
,
[{
"
subscription_id
"
:
router
[
"
subscription_id
"
]}])
This diff is collapsed.
Click to expand it.
gso/workflows/tasks/validate_router.py
+
14
−
7
View file @
8d6f0d9d
"""
Router validation workflow. Used in a nightly schedule.
"""
import
json
from
orchestrator.targets
import
Target
from
orchestrator.types
import
State
from
orchestrator.utils.json
import
json_dumps
from
orchestrator.workflow
import
StepList
,
init
,
workflow
,
done
,
step
from
orchestrator.workflows.steps
import
store_process_subscription
,
unsync
,
resync
from
orchestrator.workflow
import
StepList
,
done
,
init
,
step
,
workflow
from
orchestrator.workflows.steps
import
resync
,
store_process_subscription
,
unsync
from
orchestrator.workflows.utils
import
wrap_modify_initial_input_form
from
products
import
Router
from
gso.services.provisioning_proxy
import
pp_interaction
,
execute_playbook
from
gso.services.provisioning_proxy
import
execute_playbook
,
pp_interaction
from
gso.workflows.router.create_router
import
verify_ipam_loopback
from
products
import
Router
@step
(
"
Validate router configuration
"
)
def
validate_router_config
(
subscription
:
Router
,
callback_route
:
str
)
->
None
:
"""
Run an Ansible playbook that validates the configuration that is present on an active Router.
"""
extra_vars
=
{
"
wfo_router_json
"
:
json
.
loads
(
json_dumps
(
subscription
)),
"
verb
"
:
"
validate
"
}
execute_playbook
(
playbook_name
=
"
base_config.yaml
"
,
callback_route
=
callback_route
,
inventory
=
subscription
.
router
.
router_fqdn
,
extra_vars
=
extra_vars
extra_vars
=
extra_vars
,
)
@workflow
(
"
Validate router configuration
"
,
target
=
Target
.
SYSTEM
)
@workflow
(
"
Validate router configuration
"
,
target
=
Target
.
SYSTEM
,
initial_input_form
=
wrap_modify_initial_input_form
(
None
),
)
def
validate_router
()
->
StepList
:
"""
Validate an existing, active Router subscription.
...
...
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