Skip to content

Shared

Shared steps for DDos Mitigation workflows.

check_prefix_list_ownership(subscription, partner_name, ias_subscription_endpoints)

Check if the provided prefix lists belong to the selected partner.

Parameters:

Name Type Description Default
subscription dict

DDoS mitigation subscription dict

required
partner_name str

Name of the partner

required
ias_subscription_endpoints list[str]

List of router FQDNs

required

Returns:

Type Description
State

LSO state with playbook name, inventory, and extra vars

Source code in gso/workflows/ddos_mitigation/shared.py
@step("Check if prefix belongs to the selected partner")
def check_prefix_list_ownership(subscription: dict, partner_name: str, ias_subscription_endpoints: list[str]) -> State:
    """Check if the provided prefix lists belong to the selected partner.

    Args:
        subscription: DDoS mitigation subscription dict
        partner_name: Name of the partner
        ias_subscription_endpoints: List of router FQDNs

    Returns:
        LSO state with playbook name, inventory, and extra vars
    """
    extra_vars = {
        "subscription": subscription,
        "partner_name": partner_name,
    }

    return {
        "playbook_name": "gap_ansible/playbooks/check_prefix_ownership.yaml",
        "inventory": {"all": {"hosts": dict.fromkeys(ias_subscription_endpoints)}},
        "extra_vars": extra_vars,
    }