diff --git a/gso/workflows/router/validate_router.py b/gso/workflows/router/validate_router.py index 072d2f509bc91646c1c2096dfe8651836b181744..81ceee92a665d247b3671b76e16258abbcc54ba4 100644 --- a/gso/workflows/router/validate_router.py +++ b/gso/workflows/router/validate_router.py @@ -1,6 +1,7 @@ """Router validation workflow. Used in a nightly schedule.""" import json +from typing import Any from orchestrator.targets import Target from orchestrator.utils.errors import ProcessFailureError @@ -12,11 +13,11 @@ from pydantic_forms.types import State, UUIDstr from gso.products.product_types.router import Router from gso.services import infoblox +from gso.services import infoblox, lso_client, subscriptions from gso.services.librenms_client import LibreNMSClient from gso.services.lso_client import anonymous_lso_interaction, execute_playbook from gso.services.netbox_client import NetboxClient from gso.utils.shared_enums import Vendor -from gso.utils.workflow_steps import add_all_pe_to_p_dry @step("Prepare required keys in state") @@ -51,6 +52,25 @@ def check_netbox_entry_exists(subscription: Router) -> None: client.get_device_by_name(subscription.router.router_fqdn) +@step("Verify BGP configuration on P router") +def verify_p_ibgp(subscription: dict[str, Any], callback_route: str, process_id: UUIDstr) -> None: + """Perform a dry run of adding the list of all PE routers to the new P router.""" + extra_vars = { + "dry_run": True, + "subscription": subscription, + "pe_router_list": subscriptions.get_active_pe_router_dict(), + "verb": "verify_p_ibgp", + "is_verification_workflow": "true", + } + + lso_client.execute_playbook( + playbook_name="update_ibgp_mesh.yaml", + callback_route=callback_route, + inventory=subscription["router"]["router_fqdn"], + extra_vars=extra_vars, + ) + + @step("Verify correct LibreNMS entry") def check_librenms_entry_exists(subscription: Router) -> None: """Validate the LibreNMS entry for a Router. @@ -103,7 +123,7 @@ def validate_router() -> StepList: >> check_netbox_entry_exists >> check_librenms_entry_exists >> anonymous_lso_interaction(verify_base_config) - >> anonymous_lso_interaction(add_all_pe_to_p_dry) + >> anonymous_lso_interaction(verify_p_ibgp) >> resync >> done )