Skip to content
Snippets Groups Projects

SDP mesh functions

Closed Aleksandr Kurbatov requested to merge feature/sdp-mesh-update into develop
All threads resolved!
1 file
+ 10
208
Compare changes
  • Side-by-side
  • Inline
@@ -25,6 +25,16 @@ from gso.utils.helpers import generate_inventory_for_active_routers
@@ -25,6 +25,16 @@ from gso.utils.helpers import generate_inventory_for_active_routers
from gso.utils.shared_enums import Vendor
from gso.utils.shared_enums import Vendor
from gso.utils.types.tt_number import TTNumber
from gso.utils.types.tt_number import TTNumber
from gso.utils.workflow_steps import (
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_dry,
update_sdp_mesh_real,
update_sdp_mesh_real,
)
)
@@ -204,109 +214,6 @@ def remove_p_from_pe_real(
@@ -204,109 +214,6 @@ def remove_p_from_pe_real(
)
)
@step("[DRY RUN] Add PE mesh to PE")
def add_pe_mesh_to_pe_dry(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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"],
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
extra_vars=extra_vars,
)
@step("[FOR REAL] Add PE mesh to PE")
def add_pe_mesh_to_pe_real(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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"],
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
extra_vars=extra_vars,
)
@step("[DRY RUN] Add PE to PE mesh")
def add_pe_to_pe_mesh_dry(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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",
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
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], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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",
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=generate_inventory_for_active_routers(RouterRole.PE),
extra_vars=extra_vars,
)
@step("Check iBGP session")
def check_pe_ibgp(subscription: dict[str, Any], callback_route: str) -> None:
"""Check the iBGP session."""
extra_vars = {
"dry_run": False,
"subscription": subscription,
"verb": "check_pe_ibgp",
}
lso_client.execute_playbook(
playbook_name="check_ibgp.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
extra_vars=extra_vars,
)
@step("[DRY RUN] Deploy routing instances")
@step("[DRY RUN] Deploy routing instances")
def deploy_routing_instances_dry(
def deploy_routing_instances_dry(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
@@ -347,23 +254,6 @@ def deploy_routing_instances_real(
@@ -347,23 +254,6 @@ def deploy_routing_instances_real(
)
)
@step("Check L3 services")
def check_l3_services(subscription: dict[str, Any], callback_route: str) -> None:
"""Check L3 services."""
extra_vars = {
"dry_run": False,
"subscription": subscription,
"verb": "check_base_ris",
}
lso_client.execute_playbook(
playbook_name="check_l3_services.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
extra_vars=extra_vars,
)
@step("Remove ISIS overload")
@step("Remove ISIS overload")
def remove_isis_overload(
def remove_isis_overload(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
@@ -392,94 +282,6 @@ def update_subscription_model(subscription: Router) -> State:
@@ -392,94 +282,6 @@ def update_subscription_model(subscription: Router) -> State:
return {"subscription": subscription}
return {"subscription": subscription}
@step("[DRY RUN] Add all P to this new PE")
def add_all_p_to_pe_dry(subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr) -> None:
"""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"],
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
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], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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"],
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=subscription["router"]["router_fqdn"],
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], callback_route: str, tt_number: str, process_id: UUIDstr) -> None:
"""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",
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
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], callback_route: str, tt_number: str, process_id: UUIDstr
) -> None:
"""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",
}
lso_client.execute_playbook(
playbook_name="update_ibgp_mesh.yaml",
callback_route=callback_route,
inventory=generate_inventory_for_active_routers(
RouterRole.P, exclude_routers=[subscription["router"]["router_fqdn"]]
),
extra_vars=extra_vars,
)
@step("[DRY RUN] Delete default routes")
@step("[DRY RUN] Delete default routes")
def delete_default_routes_dry(
def delete_default_routes_dry(
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
subscription: dict[str, Any], callback_route: str, tt_number: str, process_id: UUIDstr
Loading