From e3cc3644a1585dea5000f67c2daa3e888a936306 Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Thu, 4 Jan 2024 16:17:05 +0100 Subject: [PATCH] add TT number and commit comment to TWAMP workflow --- gso/workflows/iptrunk/deploy_twamp.py | 13 ++++++++----- test/workflows/iptrunk/test_deploy_twamp.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gso/workflows/iptrunk/deploy_twamp.py b/gso/workflows/iptrunk/deploy_twamp.py index 073aa35e..c5b74be3 100644 --- a/gso/workflows/iptrunk/deploy_twamp.py +++ b/gso/workflows/iptrunk/deploy_twamp.py @@ -1,4 +1,4 @@ -""""Workflow for adding TWAMP to an existing IP trunk.""" +"""Workflow for adding TWAMP to an existing IP trunk.""" from orchestrator.forms import FormPage from orchestrator.forms.validators import Label @@ -21,19 +21,21 @@ def _initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator: f"{trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn} to " f"{trunk.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn}" # type: ignore[assignment] ) + tt_number: str - yield DeployTWAMPForm + user_input = yield DeployTWAMPForm - return {"subscription": trunk} + return user_input.dict() @step("[DRY RUN] Deploy TWAMP on both sides") -def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, callback_route: str) -> State: +def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, callback_route: str, tt_number: str) -> State: """Perform a dry run of deploying the TWAMP session.""" extra_vars = { "subscription": subscription, "process_id": process_id, "dry_run": True, + "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy TWAMP", } inventory = ( @@ -47,12 +49,13 @@ def deploy_twamp_dry(subscription: Iptrunk, process_id: UUIDstr, callback_route: @step("[FOR REAL] Deploy TWAMP on both sides") -def deploy_twamp_real(subscription: Iptrunk, process_id: UUIDstr, callback_route: str) -> State: +def deploy_twamp_real(subscription: Iptrunk, process_id: UUIDstr, callback_route: str, tt_number: str) -> State: """Deploy the TWAMP session.""" extra_vars = { "subscription": subscription, "process_id": process_id, "dry_run": False, + "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - Deploy TWAMP", } inventory = ( diff --git a/test/workflows/iptrunk/test_deploy_twamp.py b/test/workflows/iptrunk/test_deploy_twamp.py index 4644af98..019c6794 100644 --- a/test/workflows/iptrunk/test_deploy_twamp.py +++ b/test/workflows/iptrunk/test_deploy_twamp.py @@ -22,7 +22,7 @@ def test_iptrunk_deploy_twamp_success( product_id = iptrunk_subscription_factory() # Run workflow - initial_input_data = [{"subscription_id": product_id}, {}] + initial_input_data = [{"subscription_id": product_id}, {"tt_number": faker.tt_number()}] result, process_stat, step_log = run_workflow("deploy_twamp", initial_input_data) for _ in range(2): -- GitLab