diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2024-07-26 15:55:11 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2024-08-06 16:46:06 +0100 |
commit | 3e6f925ec89d771164a1d7ca694523f6da8e212c (patch) | |
tree | b648ce37b2eb3604d966bd40e6619a53499b8d38 /csit | |
parent | ed78bda8e9f46b3f8d86e5beaf810903781fa9d5 (diff) |
Add tests for Prepare, Review and Migrate pre-check in CSIT
Issue-ID: POLICY-5081
Change-Id: I4293a3adf698f62dcc6f310d11e66838a1ece832
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'csit')
-rw-r--r-- | csit/resources/tests/data/PrepareAC.json | 3 | ||||
-rw-r--r-- | csit/resources/tests/data/ReviewAC.json | 3 | ||||
-rw-r--r-- | csit/resources/tests/data/ac-instance-precheck-migration.yaml | 60 | ||||
-rw-r--r-- | csit/resources/tests/policy-clamp-test.robot | 40 |
4 files changed, 106 insertions, 0 deletions
diff --git a/csit/resources/tests/data/PrepareAC.json b/csit/resources/tests/data/PrepareAC.json new file mode 100644 index 00000000..bc3a3c0a --- /dev/null +++ b/csit/resources/tests/data/PrepareAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "PREPARE" +} diff --git a/csit/resources/tests/data/ReviewAC.json b/csit/resources/tests/data/ReviewAC.json new file mode 100644 index 00000000..e4d74348 --- /dev/null +++ b/csit/resources/tests/data/ReviewAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "REVIEW" +} diff --git a/csit/resources/tests/data/ac-instance-precheck-migration.yaml b/csit/resources/tests/data/ac-instance-precheck-migration.yaml new file mode 100644 index 00000000..3380c157 --- /dev/null +++ b/csit/resources/tests/data/ac-instance-precheck-migration.yaml @@ -0,0 +1,60 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2024 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the License); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +name: Instance-Migration-To +version: 1.0.1 +compositionId: COMPOSITIONIDPLACEHOLDER +instanceId: INSTACEIDPLACEHOLDER +compositionTargetId: COMPOSITIONTARGETIDPLACEHOLDER +precheck: true +description: Demo automation composition instance 0 +elements: + + 709c62b3-8918-41b9-a747-d21eb79c6c34: + id: 709c62b3-8918-41b9-a747-d21eb79c6c34 + definition: + name: onap.policy.clamp.ac.element.Sim_StarterAutomationCompositionElement + version: 1.2.4 + description: Starter Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30800 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration + + 709c62b3-8918-41b9-a747-d21eb79c6c35: + id: 709c62b3-8918-41b9-a747-d21eb79c6c35 + definition: + name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement + version: 1.2.4 + description: Bridge Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30801 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: TEXTPLACEHOLDER + + 709c62b3-8918-41b9-a747-d21eb79c6c37: + id: 709c62b3-8918-41b9-a747-d21eb79c6c37 + definition: + name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement + version: 1.2.4 + description: Sink Automation Composition Element for the Demo + properties: + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 72c5672e..3afcf12e 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -161,6 +161,18 @@ InstantiateAutomationCompositionMigrationFrom set Suite variable ${instanceMigrationId} ${respyaml["instanceId"]} Should Be Equal As Strings ${resp.status_code} 201 +PrepareAutomationComposition + [Documentation] Prepare automation composition. + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED + DeployAutomationComposition [Documentation] Deploy automation composition. ${auth}= Create List runtimeUser zb!XztG34 @@ -230,6 +242,18 @@ 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}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED + FailDeployAutomationCompositionMigration [Documentation] Fail Deploy automation composition. SetParticipantSimFail @@ -287,6 +311,22 @@ AutomationCompositionUpdate VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextUpdated VerifyParticipantSim ${instanceMigrationId} MyTextUpdated +PrecheckAutomationCompositionMigration + [Documentation] Precheck Migration of an automation composition. + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postyaml}= Get file ${CURDIR}/data/ac-instance-precheck-migration.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionToId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + AutomationCompositionMigrationTo [Documentation] Migration of an automation composition. ${auth}= Create List runtimeUser zb!XztG34 |