From: FrancescoFioraEst Date: Fri, 13 Jun 2025 12:30:00 +0000 (+0100) Subject: Add Fix fail handling in ACM runtime in CSIT X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F141264%2F1;p=policy%2Fdocker.git Add Fix fail handling in ACM runtime in CSIT Issue-ID: POLICY-5391 Change-Id: Iee56a17b482baa98fbda56e0f218e18f26647f1d Signed-off-by: FrancescoFioraEst --- diff --git a/csit/resources/tests/data/SettingSimPropertiesDelay.json b/csit/resources/tests/data/SettingSimPropertiesDelay.json new file mode 100644 index 00000000..1c18bb59 --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesDelay.json @@ -0,0 +1,26 @@ +{ + "deploySuccess": true, + "undeploySuccess": true, + "lockSuccess": true, + "unlockSuccess": true, + "deleteSuccess": true, + "updateSuccess": true, + "migrateSuccess": true, + "migratePrecheck": true, + "prepare": true, + "review": true, + "primeSuccess": true, + "deprimeSuccess": true, + "deployTimerMs": 10000, + "undeployTimerMs": 10000, + "lockTimerMs": 100, + "unlockTimerMs": 100, + "updateTimerMs": 100, + "migrateTimerMs": 100, + "migratePrecheckTimerMs": 100, + "prepareTimerMs": 100, + "reviewTimerMs": 100, + "deleteTimerMs": 100, + "primeTimerMs": 100, + "deprimeTimerMs": 100 +} diff --git a/csit/resources/tests/data/ac-definition-simple.yaml b/csit/resources/tests/data/ac-definition-simple.yaml new file mode 100644 index 00000000..b6c02928 --- /dev/null +++ b/csit/resources/tests/data/ac-definition-simple.yaml @@ -0,0 +1,138 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 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. +# 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========================================================= +tosca_definitions_version: tosca_simple_yaml_1_3 +name: Simple +data_types: + onap.datatypes.ToscaConceptIdentifier: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + version: + type: string + required: true + +node_types: + org.onap.policy.clamp.acm.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + required: false + org.onap.policy.clamp.acm.AutomationCompositionElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + required: false + metadata: + common: true + description: Specifies the organization that provides the automation composition element + startPhase: + type: integer + required: false + constraints: + - greater_or_equal: 0 + metadata: + common: true + description: A value indicating the start phase in which this automation composition element will be started, the + first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped + in reverse start phase order. Automation Composition Elements with the same start phase are started and + stopped simultaneously + stage: + 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. + + org.onap.policy.clamp.acm.AutomationComposition: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + required: false + metadata: + common: true + description: Specifies the organization that provides the automation composition element + elements: + type: list + required: true + metadata: + common: true + entry_schema: + type: onap.datatypes.ToscaConceptIdentifier + description: Specifies a list of automation composition element definitions that make up this automation composition definition + + org.onap.policy.clamp.acm.SimAutomationCompositionElement: + version: 1.0.0 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + baseUrl: + type: string + required: true + description: The base URL to be prepended to each path, identifies the host for the REST endpoints. + metadata: + sensitive: true + httpHeaders: + type: map + required: false + entry_schema: + type: string + description: HTTP headers to send on REST requests + configurationEntities: + type: map + required: true + entry_schema: + type: map + description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests + +topology_template: + + node_templates: + + org.onap.policy.clamp.acm.SimParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant Simulator + properties: + provider: ONAP + + onap.policy.clamp.ac.element.Sim_AutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.SimAutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element + properties: + provider: ONAP + startPhase: 0 + + onap.policy.clamp.ac.element.AutomationCompositionDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.acm.AutomationComposition + type_version: 1.0.1 + description: Automation composition for Demo + properties: + provider: ONAP + elements: + - name: onap.policy.clamp.ac.element.Sim_AutomationCompositionElement + version: 1.2.3 diff --git a/csit/resources/tests/data/ac-instance-simple.yaml b/csit/resources/tests/data/ac-instance-simple.yaml new file mode 100644 index 00000000..f4bca6b2 --- /dev/null +++ b/csit/resources/tests/data/ac-instance-simple.yaml @@ -0,0 +1,52 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 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. +# 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-Simple +version: 1.0.1 +compositionId: COMPOSITIONIDPLACEHOLDER +description: Demo automation composition instance simple +elements: + + 709c62b3-8918-41b9-a747-d21eb80c6c34: + id: 709c62b3-8918-41b9-a747-d21eb80c6c34 + definition: + name: onap.policy.clamp.ac.element.Sim_AutomationCompositionElement + version: 1.2.3 + description: Automation Composition Element for the Demo + properties: + deployTimeoutMs: 200000 + undeployTimeoutMs: 150000 + updateTimeoutMs: 200000 + migrateTimeoutMs: 200000 + deleteTimeoutMs: 100000 + baseUrl: http://address:30800 + httpHeaders: + Content-Type: application/json + Authorization: Basic YWNtVXNlcjp6YiFYenRHMzQ= + configurationEntities: + - configurationEntityId: + name: onap.policy.clamp.ac.starter + version: 1.0.0 + restSequence: + - restRequestId: + name: request1 + version: 1.0.1 + httpMethod: POST + path: /onap/policy/clamp/acelement/v2/activate + body: '{ "receiverId": { "name": "onap.policy.clamp.ac.startertobridge", "version": "1.0.0" }, "timerMs": 20000, "elementType": "STARTER", "topicParameterGroup": { "server": "message-router:3904", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' + expectedResponse: 201 + myParameterToUpdate: text diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 23a220f8..b30ef33d 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -58,6 +58,53 @@ DeleteACDefinitionTimeout Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionTimeoutId} COMMISSIONED DeleteACDefinition ${compositionTimeoutId} +CommissionAutomationCompositionSimple + [Documentation] Commission simple automation composition definition. + ${postyaml}= Get file ${CURDIR}/data/ac-definition-simple.yaml + ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} + set Suite variable ${simpleCompositionId} ${tmpCompositionId} + +PrimeACDefinitionsSimple + [Documentation] Prime simple automation composition definition + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${simpleCompositionId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${simpleCompositionId} PRIMED + +InstantiateAutomationCompositionSimple + [Documentation] Instantiate simple automation composition. + ${postyaml}= Get file ${CURDIR}/data/ac-instance-simple.yaml + ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${simpleCompositionId} ${postyaml} + set Suite variable ${simpleInstanceId} ${tmpInstanceId} + +FailDeployAutomationCompositionSimple + [Documentation] Fail Simple Deploy automation composition. + SetParticipantSimFail + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${simpleCompositionId} ${simpleInstanceId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${simpleCompositionId} ${simpleInstanceId} FAILED + +UnDeployAutomationCompositionSimple + [Documentation] UnDeploy simple automation composition. + SetParticipantSimDelay + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ChangeStatusAutomationComposition ${simpleCompositionId} ${simpleInstanceId} ${postjson} + Wait Until Keyword Succeeds 1 min 5 sec VerifyDeployStatus ${simpleCompositionId} ${simpleInstanceId} UNDEPLOYING + Wait Until Keyword Succeeds 1 min 5 sec VerifyInternalStateElementsRuntime ${simpleCompositionId} ${simpleInstanceId} UNDEPLOYING + Wait Until Keyword Succeeds 3 min 5 sec VerifyDeployStatus ${simpleCompositionId} ${simpleInstanceId} UNDEPLOYED + VerifyInternalStateElementsRuntime ${simpleCompositionId} ${simpleInstanceId} UNDEPLOYED + +UnInstantiateAutomationCompositionSimple + [Documentation] Delete simple automation composition instance. + SetParticipantSimSuccess + DeleteAutomationComposition ${simpleCompositionId} ${simpleInstanceId} + Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${simpleCompositionId} + +DePrimeACDefinitionSimple + [Documentation] DePrime simple automation composition definition + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + PrimeACDefinition ${postjson} ${simpleCompositionId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${simpleCompositionId} COMMISSIONED + CommissionAutomationComposition [Documentation] Commission automation composition definition. ${postyaml}= Get file ${CURDIR}/data/acelement-usecase.yaml @@ -466,6 +513,16 @@ VerifyPropertiesUpdated ${respstring} Convert To String ${resp.json()} Run Keyword If ${resp.status_code}==200 Should Match Regexp ${respstring} ${textToFind} +VerifyInternalStateElementsRuntime + [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} + [Documentation] Verify the Instance elements during operation + ${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 + Should Be Equal As Strings ${resp.json()['deployState']} ${deploystate} + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb80c6c34']['outProperties']['InternalState']} + Should Be Equal As Strings ${respstring} ${deploystate} + VerifyMigratedElementsRuntime [Arguments] ${theCompositionId} ${theInstanceId} [Documentation] Verify the Instance elements after Migration @@ -543,6 +600,14 @@ SetParticipantSimTimeout ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 200 +SetParticipantSimDelay + [Documentation] Set Participant Simulator Delay. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesDelay.json + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + + ClampAuth ${auth}= Create List runtimeUser zb!XztG34 RETURN ${auth}