diff --git a/test/workflows/router/test_update_ibgp_mesh.py b/test/workflows/router/test_update_ibgp_mesh.py index 2aa0a7b78cc952d97bafac6956b40961bbe8e62a..e0cf8209f876730dc15d2add15f7c3cae111d438 100644 --- a/test/workflows/router/test_update_ibgp_mesh.py +++ b/test/workflows/router/test_update_ibgp_mesh.py @@ -18,6 +18,7 @@ from test.workflows import ( @pytest.mark.parametrize("trunk_status", [SubscriptionLifecycle.PROVISIONING, SubscriptionLifecycle.ACTIVE]) +@pytest.mark.parametrize("router_role", [RouterRole.P, RouterRole.PE]) @pytest.mark.workflow() @patch("gso.workflows.router.update_ibgp_mesh.lso_client.execute_playbook") @patch("gso.workflows.router.update_ibgp_mesh.librenms_client.LibreNMSClient.add_device") @@ -26,13 +27,22 @@ def test_update_ibgp_mesh_success( mock_librenms_device_exists, mock_librenms_add_device, mock_execute_playbook, + router_role, trunk_status, iptrunk_subscription_factory, + iptrunk_side_subscription_factory, + nokia_router_subscription_factory, data_config_filename, faker, ): mock_librenms_device_exists.return_value = False - ip_trunk = Iptrunk.from_subscription(iptrunk_subscription_factory(status=trunk_status)) + router_a = nokia_router_subscription_factory(router_role=router_role) + router_b = nokia_router_subscription_factory(router_role=router_role) + side_a = iptrunk_side_subscription_factory(iptrunk_side_node=router_a) + side_b = iptrunk_side_subscription_factory(iptrunk_side_node=router_b) + ip_trunk = Iptrunk.from_subscription( + iptrunk_subscription_factory(status=trunk_status, iptrunk_sides=[side_a, side_b]) + ) ibgp_mesh_input_form_data = { "subscription_id": ip_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.owner_subscription_id } @@ -40,7 +50,8 @@ def test_update_ibgp_mesh_success( "update_ibgp_mesh", [ibgp_mesh_input_form_data, {"tt_number": faker.tt_number()}] ) - for _ in range(5): + lso_step_count = 5 if router_role == RouterRole.P else 14 + for _ in range(lso_step_count): result, step_log = assert_lso_interaction_success(result, process_stat, step_log) # Handle two consecutive user input steps @@ -50,7 +61,7 @@ def test_update_ibgp_mesh_success( state = extract_state(result) - assert mock_execute_playbook.call_count == 5 + assert mock_execute_playbook.call_count == lso_step_count assert mock_librenms_add_device.call_count == 1 assert result.status == StepStatus.COMPLETE assert state["subscription"]["router"]["router_access_via_ts"] is False