Skip to content
Snippets Groups Projects
Commit a2e86313 authored by Mohammad Torkashvand's avatar Mohammad Torkashvand Committed by Karel van Klink
Browse files

rebase with develop and add missing logic

parent 1da44ed0
No related branches found
No related tags found
1 merge request!383Feature/refacture l3 core services
...@@ -21,6 +21,7 @@ from gso.workflows.l3_core_service.base_validate_prefix_list import ( ...@@ -21,6 +21,7 @@ from gso.workflows.l3_core_service.base_validate_prefix_list import (
) )
def validate_geant_ip_prefix_list() -> StepList: def validate_geant_ip_prefix_list() -> StepList:
"""Validate prefix-lists for an existing GÉANT IP subscription.""" """Validate prefix-lists for an existing GÉANT IP subscription."""
fqdn_list_is_empty = conditional(lambda state: state["ap_fqdn_list"] == [])
prefix_list_has_drifted = conditional(lambda state: bool(state["prefix_list_drift"])) prefix_list_has_drifted = conditional(lambda state: bool(state["prefix_list_drift"]))
redeploy_prefix_list_steps = ( redeploy_prefix_list_steps = (
...@@ -37,4 +38,11 @@ def validate_geant_ip_prefix_list() -> StepList: ...@@ -37,4 +38,11 @@ def validate_geant_ip_prefix_list() -> StepList:
>> prefix_list_has_drifted(redeploy_prefix_list_steps) >> prefix_list_has_drifted(redeploy_prefix_list_steps)
) )
return begin >> store_process_subscription(Target.SYSTEM) >> build_fqdn_list >> prefix_list_validation_steps >> done return (
begin
>> store_process_subscription(Target.SYSTEM)
>> build_fqdn_list
>> fqdn_list_is_empty(done)
>> prefix_list_validation_steps
>> done
)
"""Prefix Validation workflow for L3 Core Service subscription objects.""" """Prefix Validation workflow for L3 Core Service subscription objects."""
from typing import Any from typing import Any
...@@ -139,4 +138,4 @@ def validate_prefix_list() -> StepList: ...@@ -139,4 +138,4 @@ def validate_prefix_list() -> StepList:
>> fqdn_list_is_empty(done) >> fqdn_list_is_empty(done)
>> prefix_list_should_be_validated(prefix_list_validation_steps) >> prefix_list_should_be_validated(prefix_list_validation_steps)
>> done >> done
) )
\ No newline at end of file
...@@ -3,7 +3,7 @@ from unittest.mock import patch ...@@ -3,7 +3,7 @@ from unittest.mock import patch
import pytest import pytest
from gso.products.product_types.geant_ip import GeantIP from gso.products.product_types.geant_ip import GeantIP
from gso.utils.shared_enums import Vendor from gso.utils.shared_enums import APType, Vendor
from test import USER_CONFIRM_EMPTY_FORM from test import USER_CONFIRM_EMPTY_FORM
from test.workflows import ( from test.workflows import (
assert_complete, assert_complete,
...@@ -95,7 +95,7 @@ def test_validate_prefix_list_without_diff(mock_lso_interaction, geant_ip_subscr ...@@ -95,7 +95,7 @@ def test_validate_prefix_list_without_diff(mock_lso_interaction, geant_ip_subscr
@pytest.mark.workflow() @pytest.mark.workflow()
def test_validate_prefix_skip_on_juniper( def test_validate_prefix_skip_on_juniper(
l3_core_service_subscription_factory, geant_ip_subscription_factory,
access_port_factory, access_port_factory,
service_binding_port_factory, service_binding_port_factory,
edge_port_subscription_factory, edge_port_subscription_factory,
...@@ -129,19 +129,15 @@ def test_validate_prefix_skip_on_juniper( ...@@ -129,19 +129,15 @@ def test_validate_prefix_skip_on_juniper(
), ),
), ),
] ]
subscription_id = str( subscription_id = str(geant_ip_subscription_factory(ap_list=ap_list).subscription_id)
l3_core_service_subscription_factory(
l3_core_service_type=L3CoreServiceType.GEANT_IP, ap_list=ap_list
).subscription_id
)
initial_l3_core_service_data = [{"subscription_id": subscription_id}] initial_l3_core_service_data = [{"subscription_id": subscription_id}]
# Run the workflow and extract results # Run the workflow and extract results
# Assert workflow completion since it is skipped if it is on a Juniper # Assert workflow completion since it is skipped if it is on a Juniper
result, _, _ = run_workflow("validate_prefix_list", initial_l3_core_service_data) result, _, _ = run_workflow("validate_geant_ip_prefix_list", initial_l3_core_service_data)
assert_complete(result) assert_complete(result)
# Extract the state and validate subscription attributes # Extract the state and validate subscription attributes
state = extract_state(result) state = extract_state(result)
subscription_id = state["subscription_id"] subscription_id = state["subscription_id"]
subscription = L3CoreService.from_subscription(subscription_id) subscription = GeantIP.from_subscription(subscription_id)
assert subscription.status == "active" assert subscription.status == "active"
assert subscription.insync is True assert subscription.insync is True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment