From c30d47838b11087b3153910ad432712e94ddd02a Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Thu, 3 Apr 2025 13:24:29 +0100 Subject: [PATCH] Add test in CSIT for stage in prepare Issue-ID: POLICY-5332 Change-Id: I22ce5482b2bf3f073c69236a993c8d977727c9c1 Signed-off-by: FrancescoFioraEst --- .../tests/data/ac-definition-migration-from.yaml | 18 ++++-- .../tests/data/ac-definition-migration-to.yaml | 18 ++++-- csit/resources/tests/policy-clamp-test.robot | 66 ++++++++++++++++------ 3 files changed, 74 insertions(+), 28 deletions(-) diff --git a/csit/resources/tests/data/ac-definition-migration-from.yaml b/csit/resources/tests/data/ac-definition-migration-from.yaml index 707e692c..2ed23d25 100644 --- a/csit/resources/tests/data/ac-definition-migration-from.yaml +++ b/csit/resources/tests/data/ac-definition-migration-from.yaml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2024 Nordix Foundation. +# Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,8 +58,8 @@ node_types: in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously stage: - type: list - description: A list indicating the stages in which this automation composition element will be started, the + type: map + description: A map of list indicating for each operation the stages in which this automation composition element will be started, the first stage is zero. Automation Composition Elements are started in their stage order. Automation Composition Elements with the same stage are started simultaneously. @@ -125,7 +125,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [1,2] + stage: + prepare: [1,2] + migrate: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.3 @@ -135,7 +137,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [0,1] + stage: + prepare: [0,1] + migrate: [0,1] onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement: version: 1.2.3 @@ -145,7 +149,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [0,2] + stage: + prepare: [0,2] + migrate: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.3 diff --git a/csit/resources/tests/data/ac-definition-migration-to.yaml b/csit/resources/tests/data/ac-definition-migration-to.yaml index 45d76eb1..905227d0 100644 --- a/csit/resources/tests/data/ac-definition-migration-to.yaml +++ b/csit/resources/tests/data/ac-definition-migration-to.yaml @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (C) 2024 Nordix Foundation. +# Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,8 +58,8 @@ node_types: in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously stage: - type: list - description: A list indicating the stages in which this automation composition element will be started, the + type: map + description: A map of list indicating for each operation the stages in which this automation composition element will be started, the first stage is zero. Automation Composition Elements are started in their stage order. Automation Composition Elements with the same stage are started simultaneously. @@ -125,7 +125,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [1,2] + stage: + prepare: [1,2] + migrate: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.4 @@ -135,7 +137,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [0,1] + stage: + prepare: [0,1] + migrate: [0,1] onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement: version: 1.2.4 @@ -145,7 +149,9 @@ topology_template: properties: provider: ONAP startPhase: 0 - stage: [0,2] + stage: + prepare: [0,2] + migrate: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.4 diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index b2e30fc8..806c1364 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -121,6 +121,25 @@ InstantiateAutomationCompositionMigrationFrom set Suite variable ${instanceMigrationId} ${respyaml["instanceId"]} Should Be Equal As Strings ${resp.status_code} 201 +FailPrepareAutomationCompositionMigrationFrom + [Documentation] Fail Prepare automation composition migration. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +PrepareAutomationCompositionMigrationFrom + [Documentation] Prepare automation composition migration. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} + VerifyPrepareElementsRuntime ${compositionFromId} ${instanceMigrationId} + FailDeployAutomationCompositionMigration [Documentation] Fail Deploy automation composition. SetParticipantSimFail @@ -138,14 +157,6 @@ TimeoutDeployAutomationCompositionMigration ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 -PrepareAutomationComposition - [Documentation] Prepare automation composition. - ${auth}= ClampAuth - ${postjson}= Get file ${CURDIR}/data/PrepareAC.json - ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} - DeployAutomationComposition [Documentation] Deploy automation composition. ${auth}= ClampAuth @@ -211,14 +222,6 @@ QueryPolicyTypes Should Be Equal As Strings ${resp.status_code} 200 List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex -ReviewAutomationComposition - [Documentation] Review automation composition. - ${auth}= ClampAuth - ${postjson}= Get file ${CURDIR}/data/ReviewAC.json - ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} - CheckTimeoutAutomationComposition [Documentation] Timeout Deploy automation composition. Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} TIMEOUT @@ -242,6 +245,24 @@ SendOutPropertiesToRuntime Should Be Equal As Strings ${resp.status_code} 200 Wait Until Keyword Succeeds 2 min 5 sec VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextToSend +FailReviewAutomationCompositionMigrationFrom + [Documentation] Fail Review automation composition migration. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +ReviewAutomationCompositionMigrationFrom + [Documentation] Review automation composition migration. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} + AutomationCompositionUpdate [Documentation] Update of an automation composition. ${auth}= ClampAuth @@ -504,6 +525,19 @@ VerifyMigratedElementsRuntime ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c37']['outProperties']['stage']} Should Be Equal As Strings ${respstring} [0, 2] +VerifyPrepareElementsRuntime + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Instance elements after Prepare + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['prepareStage']} + Should Be Equal As Strings ${respstring} [1, 2] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['prepareStage']} + Should Be Equal As Strings ${respstring} [0, 1] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c36']['outProperties']['prepareStage']} + Should Be Equal As Strings ${respstring} [0, 2] + VerifyMigratedElementsSim [Arguments] ${theInstanceId} [Documentation] Query on Participant Simulator -- 2.16.6