Skip to content
Snippets Groups Projects

Feature/add validation workflows

Merged Karel van Klink requested to merge feature/add-validation-workflows into develop
All threads resolved!
Compare and Show latest version
1 file
+ 22
2
Compare changes
  • Side-by-side
  • Inline
"""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
)
Loading