Skip to content
Snippets Groups Projects
Verified Commit 9ea08606 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Reflect workflow changes in unit test for SDP update

parent 4bdc2aad
No related branches found
No related tags found
1 merge request!267SDP mesh functions
Pipeline #89207 failed
This commit is part of merge request !267. Comments created here will be created in the context of that merge request.
...@@ -18,6 +18,7 @@ from test.workflows import ( ...@@ -18,6 +18,7 @@ from test.workflows import (
@pytest.mark.parametrize("trunk_status", [SubscriptionLifecycle.PROVISIONING, SubscriptionLifecycle.ACTIVE]) @pytest.mark.parametrize("trunk_status", [SubscriptionLifecycle.PROVISIONING, SubscriptionLifecycle.ACTIVE])
@pytest.mark.parametrize("router_role", [RouterRole.P, RouterRole.PE])
@pytest.mark.workflow() @pytest.mark.workflow()
@patch("gso.workflows.router.update_ibgp_mesh.lso_client.execute_playbook") @patch("gso.workflows.router.update_ibgp_mesh.lso_client.execute_playbook")
@patch("gso.workflows.router.update_ibgp_mesh.librenms_client.LibreNMSClient.add_device") @patch("gso.workflows.router.update_ibgp_mesh.librenms_client.LibreNMSClient.add_device")
...@@ -26,13 +27,22 @@ def test_update_ibgp_mesh_success( ...@@ -26,13 +27,22 @@ def test_update_ibgp_mesh_success(
mock_librenms_device_exists, mock_librenms_device_exists,
mock_librenms_add_device, mock_librenms_add_device,
mock_execute_playbook, mock_execute_playbook,
router_role,
trunk_status, trunk_status,
iptrunk_subscription_factory, iptrunk_subscription_factory,
iptrunk_side_subscription_factory,
nokia_router_subscription_factory,
data_config_filename, data_config_filename,
faker, faker,
): ):
mock_librenms_device_exists.return_value = False 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 = { ibgp_mesh_input_form_data = {
"subscription_id": ip_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.owner_subscription_id "subscription_id": ip_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.owner_subscription_id
} }
...@@ -40,7 +50,8 @@ def test_update_ibgp_mesh_success( ...@@ -40,7 +50,8 @@ def test_update_ibgp_mesh_success(
"update_ibgp_mesh", [ibgp_mesh_input_form_data, {"tt_number": faker.tt_number()}] "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) result, step_log = assert_lso_interaction_success(result, process_stat, step_log)
# Handle two consecutive user input steps # Handle two consecutive user input steps
...@@ -50,7 +61,7 @@ def test_update_ibgp_mesh_success( ...@@ -50,7 +61,7 @@ def test_update_ibgp_mesh_success(
state = extract_state(result) 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 mock_librenms_add_device.call_count == 1
assert result.status == StepStatus.COMPLETE assert result.status == StepStatus.COMPLETE
assert state["subscription"]["router"]["router_access_via_ts"] is False assert state["subscription"]["router"]["router_access_via_ts"] is False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment