From b981428a6f874bdd4f5f6fdddfb71e5ad4642bd7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342.local> Date: Fri, 7 Jun 2024 21:51:57 +0100 Subject: [PATCH] validate_router - `verify_p_ibgp` function - the same as `add_all_pe_to_p_dry` but with specific extra vars needed for verification. --- gso/workflows/router/validate_router.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/gso/workflows/router/validate_router.py b/gso/workflows/router/validate_router.py index 072d2f50..81ceee92 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 ) -- GitLab