From c21df0e37e32bb079c629c8e84d50a7d8f748f7f Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Tue, 12 Mar 2024 14:47:58 +0100
Subject: [PATCH] add input step for radius insertion in create_router workflow

---
 gso/workflows/router/create_router.py       | 20 ++++++++++++++++++++
 test/workflows/router/test_create_router.py |  4 ++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py
index f33dcec5..30e7175e 100644
--- a/gso/workflows/router/create_router.py
+++ b/gso/workflows/router/create_router.py
@@ -203,6 +203,25 @@ def prompt_insert_in_ims() -> FormGenerator:
     return {}
 
 
+@inputstep("Prompt RADIUS insertion", assignee=Assignee.SYSTEM)
+def prompt_insert_in_radius(subscription: RouterInactive) -> FormGenerator:
+    """Wait for confirmation from an operator that the router has been inserted in RADIUS."""
+
+    class RadiusPrompt(FormPage):
+        class Config:
+            title = "Update RADIUS clients"
+
+        info_label_1: Label = (
+            f"Please go to https://kratos.geant.org/add_radius_client and add the {subscription.router.router_fqdn}"  # type: ignore[assignment]
+            f" - {subscription.router.router_lo_ipv4_address} to radius authentication"
+        )
+        info_label_2: Label = "This will be functionally checked later during verification work."  # type: ignore[assignment]
+
+    yield RadiusPrompt
+
+    return {}
+
+
 @workflow(
     "Create router",
     initial_input_form=wrap_create_initial_input_form(initial_input_form_generator),
@@ -231,6 +250,7 @@ def create_router() -> StepList:
         >> prompt_reboot_router
         >> prompt_console_login
         >> prompt_insert_in_ims
+        >> prompt_insert_in_radius
         >> router_is_nokia(create_netbox_device)
         >> pp_interaction(run_checks_after_base_config)
         >> set_status(SubscriptionLifecycle.PROVISIONING)
diff --git a/test/workflows/router/test_create_router.py b/test/workflows/router/test_create_router.py
index efa7e673..fbfd09e4 100644
--- a/test/workflows/router/test_create_router.py
+++ b/test/workflows/router/test_create_router.py
@@ -87,8 +87,8 @@ def test_create_nokia_router_success(
     for _ in range(2):
         result, step_log = assert_pp_interaction_success(result, process_stat, step_log)
 
-    # Handle three consecutive user input steps
-    for _ in range(3):
+    # Handle four consecutive user input steps
+    for _ in range(4):
         assert_suspended(result)
         result, step_log = resume_workflow(process_stat, step_log, input_data=USER_CONFIRM_EMPTY_FORM)
 
-- 
GitLab