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
5d124928
Commit
5d124928
authored
4 months ago
by
Aleksandr Kurbatov
Browse files
Options
Downloads
Patches
Plain Diff
`validate_router` - check BGP depending on the router role.
parent
250467a8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#90543
failed
4 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/router/validate_router.py
+60
-3
60 additions, 3 deletions
gso/workflows/router/validate_router.py
with
60 additions
and
3 deletions
gso/workflows/router/validate_router.py
+
60
−
3
View file @
5d124928
...
...
@@ -52,9 +52,9 @@ def check_netbox_entry_exists(subscription: Router) -> None:
client
.
get_device_by_name
(
subscription
.
router
.
router_fqdn
)
@step
(
"
Verify BGP
configuration on P router
"
)
@step
(
"
Verify
P
BGP
P-ONLY neighbors
"
)
def
verify_p_ibgp
(
subscription
:
dict
[
str
,
Any
])
->
LSOState
:
"""
P
er
form a dry run of adding the list of all PE routers to the new
P router.
"""
"""
V
er
ify PE neighbors in P-ONLY group on a
P router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
...
...
@@ -70,6 +70,60 @@ def verify_p_ibgp(subscription: dict[str, Any]) -> LSOState:
}
@step
(
"
Verify PE BGP internal mesh neighbors
"
)
def
verify_pe_mesh_in_pe
(
subscription
:
dict
[
str
,
Any
])
->
LSOState
:
"""
Verify PE internal mesh neighbors on a PE router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
verb
"
:
"
add_pe_mesh_to_pe
"
,
"
pe_router_list
"
:
generate_inventory_for_active_routers
(
router_role
=
RouterRole
.
PE
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
)[
"
all
"
][
"
hosts
"
],
"
is_verification_workflow
"
:
"
true
"
,
}
if
not
extra_vars
[
"
pe_router_list
"
]:
return
{
"
playbook_name
"
:
""
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{}}},
"
extra_vars
"
:
{},
}
return
{
"
playbook_name
"
:
"
gap_ansible/playbooks/update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
Verify PE BGP P-ONLY neighbors
"
)
def
verify_all_p_in_pe
(
subscription
:
dict
[
str
,
Any
])
->
LSOState
:
"""
Verify P neighbors in P-ONLY group on a PE router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
verb
"
:
"
add_all_p_to_pe
"
,
"
p_router_list
"
:
generate_inventory_for_active_routers
(
router_role
=
RouterRole
.
P
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
)[
"
all
"
][
"
hosts
"
],
"
is_verification_workflow
"
:
"
true
"
,
}
if
not
extra_vars
[
"
p_router_list
"
]:
return
{
"
playbook_name
"
:
""
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{}}},
"
extra_vars
"
:
{},
}
return
{
"
playbook_name
"
:
"
gap_ansible/playbooks/update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
Verify correct LibreNMS entry
"
)
def
check_librenms_entry_exists
(
subscription
:
Router
)
->
None
:
"""
Validate the LibreNMS entry for a Router.
...
...
@@ -125,6 +179,7 @@ def validate_router() -> StepList:
"""
is_juniper_router
=
conditional
(
lambda
state
:
state
[
"
subscription
"
][
"
router
"
][
"
vendor
"
]
==
Vendor
.
JUNIPER
)
is_pe_router
=
conditional
(
lambda
state
:
state
[
"
subscription
"
][
"
router
"
][
"
router_role
"
]
==
RouterRole
.
PE
)
is_p_router
=
conditional
(
lambda
state
:
state
[
"
subscription
"
][
"
router
"
][
"
router_role
"
]
==
RouterRole
.
P
)
return
(
begin
...
...
@@ -137,7 +192,9 @@ def validate_router() -> StepList:
>>
check_librenms_entry_exists
>>
is_pe_router
(
check_kentik_entry_exists
)
>>
anonymous_lso_interaction
(
verify_base_config
)
>>
anonymous_lso_interaction
(
verify_p_ibgp
)
>>
is_p_router
(
anonymous_lso_interaction
(
verify_p_ibgp
))
>>
is_pe_router
(
anonymous_lso_interaction
(
verify_pe_mesh_in_pe
))
>>
is_pe_router
(
anonymous_lso_interaction
(
verify_all_p_in_pe
))
>>
resync
>>
done
)
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