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
a6968672
Commit
a6968672
authored
5 months ago
by
Aleksandr Kurbatov
Browse files
Options
Downloads
Patches
Plain Diff
Use of common BGP and SDP functions from `workflow_steps`
parent
6f166e0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!279
Feature/sdp bgp mesh update
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/router/promote_p_to_pe.py
+14
-234
14 additions, 234 deletions
gso/workflows/router/promote_p_to_pe.py
gso/workflows/router/update_ibgp_mesh.py
+39
-6
39 additions, 6 deletions
gso/workflows/router/update_ibgp_mesh.py
with
53 additions
and
240 deletions
gso/workflows/router/promote_p_to_pe.py
+
14
−
234
View file @
a6968672
...
...
@@ -23,6 +23,20 @@ from gso.services.subscriptions import get_all_active_sites
from
gso.utils.helpers
import
generate_inventory_for_active_routers
from
gso.utils.shared_enums
import
Vendor
from
gso.utils.types.tt_number
import
TTNumber
from
gso.utils.workflow_steps
import
(
add_all_p_to_pe_dry
,
add_all_p_to_pe_real
,
add_pe_mesh_to_pe_dry
,
add_pe_mesh_to_pe_real
,
add_pe_to_all_p_dry
,
add_pe_to_all_p_real
,
add_pe_to_pe_mesh_dry
,
add_pe_to_pe_mesh_real
,
check_l3_services
,
check_pe_ibgp
,
update_sdp_mesh_dry
,
update_sdp_mesh_real
,
)
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
...
...
@@ -150,54 +164,6 @@ def create_kentik_device(subscription: Router) -> State:
return
{
"
kentik_device
"
:
kentik_device
}
@step
(
"
[DRY RUN] Include new PE into SDP mesh on other Nokia PEs
"
)
def
update_sdp_mesh_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run for updating the SDP mesh with the new router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Update the SDP mesh for L2circuits(epipes) config on PE NOKIA routers
"
,
"
verb
"
:
"
update_sdp_mesh
"
,
"
pe_router_list
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
{
"
lo4
"
:
str
(
subscription
[
"
router
"
][
"
router_lo_ipv4_address
"
]),
"
lo6
"
:
str
(
subscription
[
"
router
"
][
"
router_lo_ipv6_address
"
]),
}
},
}
return
{
"
playbook_name
"
:
"
update_pe_sdp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
router_role
=
RouterRole
.
PE
,
router_vendor
=
Vendor
.
NOKIA
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Include new PE into SDP mesh on other Nokia PEs
"
)
def
update_sdp_mesh_real
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Update the SDP mesh for L2 circuits(epipes) config on PE NOKIA routers.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Update the SDP mesh for l2circuits(epipes) config on PE NOKIA routers
"
,
"
verb
"
:
"
update_sdp_mesh
"
,
"
pe_router_list
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
{
"
lo4
"
:
str
(
subscription
[
"
router
"
][
"
router_lo_ipv4_address
"
]),
"
lo6
"
:
str
(
subscription
[
"
router
"
][
"
router_lo_ipv6_address
"
]),
}
},
}
return
{
"
playbook_name
"
:
"
update_pe_sdp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
router_role
=
RouterRole
.
PE
,
router_vendor
=
Vendor
.
NOKIA
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[DRY RUN] Remove P from all PEs
"
)
def
remove_p_from_pe_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of removing the P router from all the PE routers.
"""
...
...
@@ -234,96 +200,6 @@ def remove_p_from_pe_real(subscription: dict[str, Any], tt_number: str, process_
}
@step
(
"
[DRY RUN] Add PE mesh to PE
"
)
def
add_pe_mesh_to_pe_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of adding list of PE routers into iGEANT/iGEANT6 of promoted router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add list of PE routers into iGEANT/iGEANT6 of promoted router
"
,
"
verb
"
:
"
add_pe_mesh_to_pe
"
,
"
pe_router_list
"
:
generate_inventory_for_active_routers
(
RouterRole
.
PE
)[
"
all
"
][
"
hosts
"
],
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Add PE mesh to PE
"
)
def
add_pe_mesh_to_pe_real
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a real run of adding list of PE routers into iGEANT/iGEANT6 of promoted router.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add list of PE routers into iGEANT/iGEANT6 of promoted router
"
,
"
verb
"
:
"
add_pe_mesh_to_pe
"
,
"
pe_router_list
"
:
generate_inventory_for_active_routers
(
RouterRole
.
PE
)[
"
all
"
][
"
hosts
"
],
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[DRY RUN] Add PE to PE mesh
"
)
def
add_pe_to_pe_mesh_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of adding the promoted router to all PE routers in iGEANT/iGEANT6.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add promoted router to all PE routers in iGEANT/iGEANT6.
"
,
"
verb
"
:
"
add_pe_to_pe_mesh
"
,
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
RouterRole
.
PE
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Add PE to PE mesh
"
)
def
add_pe_to_pe_mesh_real
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a real run of adding the promoted router to all PE routers in iGEANT/iGEANT6.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add promoted router to all PE routers in iGEANT/iGEANT6.
"
,
"
verb
"
:
"
add_pe_to_pe_mesh
"
,
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
RouterRole
.
PE
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
Check iBGP session
"
)
def
check_pe_ibgp
(
subscription
:
dict
[
str
,
Any
])
->
LSOState
:
"""
Check the iBGP session.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
verb
"
:
"
check_pe_ibgp
"
,
}
return
{
"
playbook_name
"
:
"
check_ibgp.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[DRY RUN] Deploy routing instances
"
)
def
deploy_routing_instances_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of deploying routing instances.
"""
...
...
@@ -358,22 +234,6 @@ def deploy_routing_instances_real(subscription: dict[str, Any], tt_number: str,
}
@step
(
"
Check L3 services
"
)
def
check_l3_services
(
subscription
:
dict
[
str
,
Any
])
->
LSOState
:
"""
Check L3 services.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
verb
"
:
"
check_base_ris
"
,
}
return
{
"
playbook_name
"
:
"
check_l3_services.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
Remove ISIS overload
"
)
def
remove_isis_overload
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Remove ISIS overload.
"""
...
...
@@ -399,86 +259,6 @@ def update_subscription_model(subscription: Router) -> State:
return
{
"
subscription
"
:
subscription
}
@step
(
"
[DRY RUN] Add all P to this new PE
"
)
def
add_all_p_to_pe_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of adding all P routers to the PE router.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
- Add all P-routers to this new PE
"
,
"
verb
"
:
"
add_all_p_to_pe
"
,
"
p_router_list
"
:
generate_inventory_for_active_routers
(
RouterRole
.
P
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
)[
"
all
"
][
"
hosts
"
],
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Add all P to this new PE
"
)
def
add_all_p_to_pe_real
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a real run of adding all P routers to the PE router.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
- Add all P-routers to this new PE
"
,
"
verb
"
:
"
add_all_p_to_pe
"
,
"
p_router_list
"
:
generate_inventory_for_active_routers
(
RouterRole
.
P
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
)[
"
all
"
][
"
hosts
"
],
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
{
"
all
"
:
{
"
hosts
"
:
{
subscription
[
"
router
"
][
"
router_fqdn
"
]:
None
}}},
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[DRY RUN] Add this new PE to all P
"
)
def
add_pe_to_all_p_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of adding promoted router to all PE routers in iGEANT/iGEANT6.
"""
extra_vars
=
{
"
dry_run
"
:
True
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add promoted router to all PE routers in iGEANT/iGEANT6
"
,
"
verb
"
:
"
add_pe_to_all_p
"
,
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
RouterRole
.
P
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[FOR REAL] Add this new PE to all P
"
)
def
add_pe_to_all_p_real
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a real run of adding promoted router to all PE routers in iGEANT/iGEANT6.
"""
extra_vars
=
{
"
dry_run
"
:
False
,
"
subscription
"
:
subscription
,
"
commit_comment
"
:
f
"
GSO_PROCESS_ID:
{
process_id
}
- TT_NUMBER:
{
tt_number
}
-
"
f
"
Add promoted router to all PE routers in iGEANT/iGEANT6
"
,
"
verb
"
:
"
add_pe_to_all_p
"
,
}
return
{
"
playbook_name
"
:
"
update_ibgp_mesh.yaml
"
,
"
inventory
"
:
generate_inventory_for_active_routers
(
RouterRole
.
P
,
exclude_routers
=
[
subscription
[
"
router
"
][
"
router_fqdn
"
]]
),
"
extra_vars
"
:
extra_vars
,
}
@step
(
"
[DRY RUN] Delete default routes
"
)
def
delete_default_routes_dry
(
subscription
:
dict
[
str
,
Any
],
tt_number
:
str
,
process_id
:
UUIDstr
)
->
LSOState
:
"""
Perform a dry run of deleting the default routes.
"""
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/router/update_ibgp_mesh.py
+
39
−
6
View file @
a6968672
...
...
@@ -7,7 +7,7 @@ from orchestrator.forms import FormPage
from
orchestrator.forms.validators
import
Label
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.workflow
import
StepList
,
begin
,
done
,
inputstep
,
step
,
workflow
from
orchestrator.workflow
import
StepList
,
begin
,
conditional
,
done
,
inputstep
,
step
,
workflow
from
orchestrator.workflows.steps
import
resync
,
store_process_subscription
,
unsync
from
orchestrator.workflows.utils
import
wrap_modify_initial_input_form
from
pydantic
import
ConfigDict
,
model_validator
...
...
@@ -20,6 +20,22 @@ from gso.services.subscriptions import get_trunks_that_terminate_on_router
from
gso.utils.helpers
import
generate_inventory_for_active_routers
from
gso.utils.types.snmp
import
SNMPVersion
from
gso.utils.types.tt_number
import
TTNumber
from
gso.utils.workflow_steps
import
(
add_all_p_to_pe_dry
,
add_all_p_to_pe_real
,
add_pe_mesh_to_pe_dry
,
add_pe_mesh_to_pe_real
,
add_pe_to_all_p_dry
,
add_pe_to_all_p_real
,
add_pe_to_pe_mesh_dry
,
add_pe_to_pe_mesh_real
,
check_l3_services
,
check_pe_ibgp
,
update_sdp_mesh_dry
,
update_sdp_mesh_real
,
update_sdp_single_pe_dry
,
update_sdp_single_pe_real
,
)
def
initial_input_form_generator
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
...
...
@@ -194,15 +210,32 @@ def update_ibgp_mesh() -> StepList:
* Add the new P-router to LibreNMS.
* Update the subscription model.
"""
router_is_pe
=
conditional
(
lambda
state
:
state
[
"
router_role
"
]
==
RouterRole
.
PE
)
router_is_p
=
conditional
(
lambda
state
:
state
[
"
router_role
"
]
==
RouterRole
.
P
)
return
(
begin
>>
store_process_subscription
(
Target
.
MODIFY
)
>>
unsync
>>
lso_interaction
(
add_p_to_mesh_dry
)
>>
lso_interaction
(
add_p_to_mesh_real
)
>>
lso_interaction
(
add_all_pe_to_p_dry
)
>>
lso_interaction
(
add_all_pe_to_p_real
)
>>
lso_interaction
(
check_ibgp_session
)
>>
router_is_p
(
lso_interaction
(
add_p_to_mesh_dry
))
>>
router_is_p
(
lso_interaction
(
add_p_to_mesh_real
))
>>
router_is_p
(
lso_interaction
(
add_all_pe_to_p_dry
))
>>
router_is_p
(
lso_interaction
(
add_all_pe_to_p_real
))
>>
router_is_p
(
lso_interaction
(
check_ibgp_session
))
>>
router_is_pe
(
lso_interaction
(
add_pe_mesh_to_pe_dry
))
>>
router_is_pe
(
lso_interaction
(
add_pe_mesh_to_pe_real
))
>>
router_is_pe
(
lso_interaction
(
add_pe_to_pe_mesh_dry
))
>>
router_is_pe
(
lso_interaction
(
add_pe_to_pe_mesh_real
))
>>
router_is_pe
(
lso_interaction
(
add_all_p_to_pe_dry
))
>>
router_is_pe
(
lso_interaction
(
add_all_p_to_pe_real
))
>>
router_is_pe
(
lso_interaction
(
add_pe_to_all_p_dry
))
>>
router_is_pe
(
lso_interaction
(
add_pe_to_all_p_real
))
>>
router_is_pe
(
lso_interaction
(
update_sdp_single_pe_dry
))
>>
router_is_pe
(
lso_interaction
(
update_sdp_single_pe_real
))
>>
router_is_pe
(
lso_interaction
(
update_sdp_mesh_dry
))
>>
router_is_pe
(
lso_interaction
(
update_sdp_mesh_real
))
>>
router_is_pe
(
lso_interaction
(
check_pe_ibgp
))
>>
router_is_pe
(
lso_interaction
(
check_l3_services
))
>>
add_device_to_librenms
>>
prompt_insert_in_radius
>>
prompt_radius_login
...
...
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