Skip to content
Snippets Groups Projects
Commit 02b7a5cb authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

`promote_p_to_pe`: PE static routes as a separate step

parent 13016dbb
No related branches found
No related tags found
1 merge request!339`promote_p_to_pe`: PE static routes as a separate step
Pipeline #91220 passed
......@@ -246,6 +246,42 @@ def delete_default_routes_real(subscription: dict[str, Any], tt_number: str, pro
}
@step("[DRY RUN] Add PE static routes")
def add_pe_static_routes_dry(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr) -> LSOState:
"""Perform a dry run of adding the PE static routes."""
extra_vars = {
"dry_run": True,
"subscription": subscription,
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - "
f"Delete static default routes (part of P base-config)",
"verb": "add_pe_static_routes",
}
return {
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
@step("[FOR REAL] Add PE static routes")
def add_pe_static_routes_real(subscription: dict[str, Any], tt_number: str, process_id: UUIDstr) -> LSOState:
"""Perform a real run of adding the PE static routes."""
extra_vars = {
"dry_run": False,
"subscription": subscription,
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - "
f"Delete static default routes (part of P base-config)",
"verb": "add_pe_static_routes",
}
return {
"playbook_name": "gap_ansible/playbooks/promote_p_to_pe.yaml",
"inventory": {"all": {"hosts": {subscription["router"]["router_fqdn"]: None}}},
"extra_vars": extra_vars,
}
@workflow(
"Promote P router to PE router",
initial_input_form=wrap_modify_initial_input_form(initial_input_form_generator),
......@@ -280,6 +316,8 @@ def promote_p_to_pe() -> StepList:
>> lso_interaction(add_pe_to_all_p_real)
>> lso_interaction(delete_default_routes_dry)
>> lso_interaction(delete_default_routes_real)
>> lso_interaction(add_pe_static_routes_dry)
>> lso_interaction(add_pe_static_routes_real)
>> lso_interaction(run_post_checks)
>> update_subscription_model
>> resync
......
......@@ -40,11 +40,11 @@ def test_promote_p_to_pe_success(
for _ in range(3):
result, step_log = assert_lso_interaction_success(result, process_stat, step_log)
result, step_log = resume_workflow(process_stat, step_log, input_data=USER_CONFIRM_EMPTY_FORM)
for _ in range(19):
for _ in range(21):
result, step_log = assert_lso_interaction_success(result, process_stat, step_log)
state = extract_state(result)
assert_complete(result)
assert mock_execute_playbook.call_count == 22
assert mock_execute_playbook.call_count == 24
assert state["subscription"]["router"]["router_role"] == RouterRole.PE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment