Skip to content

Deploy twamp

Workflow for adding TWAMP to an existing IP trunk.

Takes a trunk that is either PROVISIONING or ACTIVE and deploy configuration for TWAMP. The trunk will not change state after running this workflow.

deploy_twamp_dry(subscription, process_id, tt_number)

Perform a dry run of deploying the TWAMP session.

Source code in gso/workflows/iptrunk/deploy_twamp.py
@step("[DRY RUN] Deploy TWAMP on both sides")
def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState:
    """Perform a dry run of deploying the TWAMP session."""
    extra_vars = {
        "subscription": json.loads(json_dumps(subscription)),
        "process_id": process_id,
        "dry_run": True,
        "verb": "deploy",
        "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy TWAMP",
    }

    return {
        "playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
        "inventory": {
            "all": {
                "hosts": {
                    subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn: None,
                    subscription.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn: None,
                }
            }
        },
        "extra_vars": extra_vars,
    }

deploy_twamp_real(subscription, process_id, tt_number)

Deploy the TWAMP session.

Source code in gso/workflows/iptrunk/deploy_twamp.py
@step("[FOR REAL] Deploy TWAMP on both sides")
def deploy_twamp_real(subscription: Iptrunk, process_id: UUIDstr, tt_number: str) -> LSOState:
    """Deploy the TWAMP session."""
    extra_vars = {
        "subscription": json.loads(json_dumps(subscription)),
        "process_id": process_id,
        "dry_run": False,
        "verb": "deploy",
        "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy TWAMP",
    }

    return {
        "playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
        "inventory": {
            "all": {
                "hosts": {
                    subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn: None,
                    subscription.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn: None,
                }
            }
        },
        "extra_vars": extra_vars,
    }

check_twamp_status(subscription)

Check TWAMP session.

Source code in gso/workflows/iptrunk/deploy_twamp.py
@step("Check TWAMP status on both sides")
def check_twamp_status(subscription: Iptrunk) -> LSOState:
    """Check TWAMP session."""
    extra_vars = {
        "subscription": json.loads(json_dumps(subscription)),
        "verb": "check_twamp",
    }

    return {
        "playbook_name": "gap_ansible/playbooks/deploy_twamp.yaml",
        "inventory": {
            "all": {
                "hosts": {
                    subscription.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn: None,
                    subscription.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn: None,
                }
            }
        },
        "extra_vars": extra_vars,
    }

deploy_twamp()

Deploy a TWAMP session on an IP trunk.

  • Run the TWAMP playbook, including an initial dry run
Source code in gso/workflows/iptrunk/deploy_twamp.py
@workflow(
    "Deploy TWAMP",
    initial_input_form=wrap_modify_initial_input_form(_initial_input_form_generator),
    target=Target.MODIFY,
)
def deploy_twamp() -> StepList:
    """Deploy a TWAMP session on an IP trunk.

    * Run the TWAMP playbook, including an initial dry run
    """
    return (
        begin
        >> store_process_subscription(Target.MODIFY)
        >> unsync
        >> lso_interaction(deploy_twamp_dry)
        >> lso_interaction(deploy_twamp_real)
        >> lso_interaction(check_twamp_status)
        >> resync
        >> done
    )