From: adheli.tavares Date: Tue, 30 Sep 2025 10:26:38 +0000 (+0100) Subject: Split Clamp CSITs in to functional flows X-Git-Tag: 4.2.1~1 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F142144%2F2;p=policy%2Fdocker.git Split Clamp CSITs in to functional flows Issue-ID: POLICY-5460 Change-Id: I6146bc492a8b1ff74e2168e887faa7101d7efeda Signed-off-by: adheli.tavares --- diff --git a/compose/compose.common.yml b/compose/compose.common.yml index 23ee9224..757bb1c2 100644 --- a/compose/compose.common.yml +++ b/compose/compose.common.yml @@ -172,3 +172,4 @@ services: environment: ROBOT_FILE: ${ROBOT_FILES:-none} TEST_ENV: ${TEST_ENV:-docker} + PROJECT: ${PROJECT:-policy} diff --git a/csit/resources/Dockerfile b/csit/resources/Dockerfile index dc9344e8..f072e50b 100644 --- a/csit/resources/Dockerfile +++ b/csit/resources/Dockerfile @@ -1,7 +1,7 @@ FROM nexus3.onap.org:10001/library/python:3.13-slim-bullseye ARG CSIT_SCRIPT=${CSIT_SCRIPT} ARG ROBOT_FILE=${ROBOT_FILE} -ENV ROBOT_WORKSPACE=/opt/robotworkspace ROBOT_FILE=$ROBOT_FILE TEST_ENV=$TEST_ENV +ENV ROBOT_WORKSPACE=/opt/robotworkspace ROBOT_FILE=$ROBOT_FILE TEST_ENV=$TEST_ENV PROJECT=$PROJECT RUN apt-get update && apt-get install -y gcc postgresql-client; \ python3 -m pip -qq install --upgrade pip; \ python3 -m pip -qq install --upgrade confluent-kafka; \ diff --git a/csit/resources/scripts/build-csit-docker-image.sh b/csit/resources/scripts/build-csit-docker-image.sh index ad5dd7e4..59b58715 100755 --- a/csit/resources/scripts/build-csit-docker-image.sh +++ b/csit/resources/scripts/build-csit-docker-image.sh @@ -1,6 +1,6 @@ #!/bin/bash -x # -# Copyright 2024-2025 Nordix Foundation. +# Copyright 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. @@ -52,7 +52,47 @@ fi clone_models echo "Building robot framework docker image" -docker build . --file Dockerfile --tag "onap/${ROBOT_DOCKER_IMAGE}" --quiet + +has_buildx() { + docker buildx version >/dev/null 2>&1 +} + +echo "Checking for Docker Buildx..." + +if has_buildx; then + echo "Docker Buildx is already installed." +else + echo "Attempting to install Docker Buildx..." + # Try enabling buildx via Docker CLI plugin + if docker buildx install >/dev/null 2>&1; then + echo "Docker Buildx enabled." + else + # Attempt installation depending on system + if command -v docker >/dev/null 2>&1; then + mkdir -p ~/.docker/cli-plugins + BUILD_VERSION="v0.11.2" # change if needed + curl -fsSL \ + "https://github.com/docker/buildx/releases/download/${BUILD_VERSION}/buildx-${BUILD_VERSION}.linux-amd64" \ + -o ~/.docker/cli-plugins/docker-buildx || true + chmod +x ~/.docker/cli-plugins/docker-buildx + fi + + if has_buildx; then + echo "Docker Buildx installed successfully." + else + echo "Failed to install Docker Buildx. Falling back to normal docker build." + fi + fi +fi + +if has_buildx; then + echo "Building with Docker Buildx..." + docker buildx build . --file Dockerfile --tag "onap/${ROBOT_DOCKER_IMAGE}" --quiet +else + echo "Building with normal Docker build..." + docker build . --file Dockerfile --tag "onap/${ROBOT_DOCKER_IMAGE}" --quiet +fi + docker save -o policy-csit-robot.tar "onap/${ROBOT_DOCKER_IMAGE}":latest rm -rf "${WORKSPACE}"/csit/resources/policy-csit-robot.tar diff --git a/csit/resources/scripts/run-test.sh b/csit/resources/scripts/run-test.sh index e12e2526..e85ea27a 100755 --- a/csit/resources/scripts/run-test.sh +++ b/csit/resources/scripts/run-test.sh @@ -78,7 +78,7 @@ echo "Run Robot test" echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" echo "Starting Robot test suites ..." mkdir -p /tmp/results/ -python3 -m robot.run -d /tmp/results/ ${ROBOT_VARIABLES} ${ROBOT_FILE} +python3 -m robot.run --name "${PROJECT}" -d /tmp/results/ ${ROBOT_VARIABLES} ${ROBOT_FILE} RESULT=$? echo "RESULT: ${RESULT}" diff --git a/csit/resources/tests/clamp-common.robot b/csit/resources/tests/clamp-common.robot new file mode 100644 index 00000000..af95930a --- /dev/null +++ b/csit/resources/tests/clamp-common.robot @@ -0,0 +1,382 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot + +*** Keywords *** + +VerifyHealthcheckApi + [Documentation] Verify Healthcheck on policy-api + ${auth}= PolicyAdminAuth + ${resp}= MakeGetRequest policy ${POLICY_API_IP} /policy/api/v1/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +VerifyHealthcheckPap + [Documentation] Verify Healthcheck on policy-pap + ${auth}= PolicyAdminAuth + ${resp}= MakeGetRequest policy ${POLICY_PAP_IP} /policy/pap/v1/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +VerifyPriming + [Arguments] ${theCompositionId} ${primestate} + [Documentation] Verify the AC definitions are primed to the participants + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['stateChangeResult']} NO_ERROR + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['state']} ${primestate} + +VerifyStateChangeResultPriming + [Arguments] ${theCompositionId} ${stateChangeResult} + [Documentation] Verify the AC definitions are primed to the participants + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} ${stateChangeResult} + +VerifyDeployStatus + [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} + [Documentation] Verify the Deploy status of automation composition. + ${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()['stateChangeResult']} NO_ERROR + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['deployState']} ${deploystate} + +VerifySubStatus + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Sub status of automation composition. + ${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()['stateChangeResult']} NO_ERROR + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['subState']} NONE + +VerifyStateChangeResult + [Arguments] ${theCompositionId} ${theInstanceId} ${stateChangeResult} + [Documentation] Verify the Deploy status of automation composition. + ${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 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} ${stateChangeResult} + +VerifyPropertiesUpdated + [Arguments] ${theCompositionId} ${theInstanceId} ${textToFind} + [Documentation] Verify the Deploy status of automation composition. + ${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()} + 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 + ${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()} + Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['stage']} + Should Be Equal As Strings ${respstring} [1, 2] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['stage']} + Should Be Equal As Strings ${respstring} [0, 1] + ${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] + +VerifyRollbackElementsRuntime + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Instance elements after Rollback + ${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()} + Should Not Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Match Regexp ${respstring} Sim_SinkAutomationCompositionElement + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['rollbackStage']} + Should Be Equal As Strings ${respstring} [1, 2] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['rollbackStage']} + Should Be Equal As Strings ${respstring} [0, 1] + ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c36']['outProperties']['rollbackStage']} + Should Be Equal As Strings ${respstring} [0, 2] + +VerifyMigratedElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator 1 + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement + +VerifyRemovedElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator 2 + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Not Match Regexp ${respstring} Sim_Sink2AutomationCompositionElement + +VerifyRollbackElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Not Match Regexp ${respstring} Sim_NewAutomationCompositionElement + Should Match Regexp ${respstring} Sim_SinkAutomationCompositionElement + +VerifyCompositionParticipantSim + [Arguments] ${textToFind} + [Documentation] Query composition on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/compositiondatas ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} ${textToFind} + +VerifyParticipantSim + [Arguments] ${theInstanceId} ${textToFind} + [Documentation] Query on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Match Regexp ${respstring} ${textToFind} + +VerifyUninstantiated + [Arguments] ${theCompositionId} + [Documentation] Verify the Uninstantiation of automation composition. + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Length Should Be ${resp.json()['automationCompositionList']} 0 + +SetParticipantSimFail + [Documentation] Set Participant Simulator Fail. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSim2Fail + [Documentation] Set Participant Simulator2 Fail. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSimSuccess + [Documentation] Set Participant Simulator Success. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSim2Success + [Documentation] Set Participant Simulator Success. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSimTimeout + [Documentation] Set Participant Simulator Timeout. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +SetParticipantSim2Timeout + [Documentation] Set Participant Simulator Timeout. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_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 ${HTTP_PARTICIPANT_SIM1_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} + +ParticipantAuth + ${auth}= Create List participantUser zb!XztG34 + RETURN ${auth} + +MakeCommissionAcDefinition + [Arguments] ${postyaml} + ${auth}= ClampAuth + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + RETURN ${respyaml["compositionId"]} + +DePrimeAndDeleteACDefinition + [Arguments] ${compositionId} + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + PrimeACDefinition ${postjson} ${compositionId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} COMMISSIONED + DeleteACDefinition ${compositionId} + +PrimeACDefinition + [Arguments] ${postjson} ${compositionId} + ${auth}= ClampAuth + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + +DeleteACDefinition + [Arguments] ${compositionId} + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +MakeJsonInstantiateAutomationComposition + [Arguments] ${compositionId} ${postjson} + ${auth}= ClampAuth + ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} + ${resp}= MakeJsonPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostjson} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + RETURN ${respyaml["instanceId"]} + +MakeYamlInstantiateAutomationComposition + [Arguments] ${compositionId} ${postyaml} + ${auth}= ClampAuth + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionId} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostyaml} ${auth} + ${respyaml}= yaml.Safe Load ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + RETURN ${respyaml["instanceId"]} + +ChangeStatusAutomationComposition + [Arguments] ${compositionId} ${instanceId} ${postjson} + ${auth}= ClampAuth + ${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 + +DeleteAutomationComposition + [Arguments] ${compositionId} ${instanceId} + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + +UndeployAndDeleteAutomationComposition + [Arguments] ${compositionId} ${instanceId} + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ChangeStatusAutomationComposition ${compositionId} ${instanceId} ${postjson} + Wait Until Keyword Succeeds 3 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED + DeleteAutomationComposition ${compositionId} ${instanceId} + Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionId} + +MakePostRequest + [Arguments] ${name} ${domain} ${url} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${resp}= POST On Session ${name} ${url} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeYamlPostRequest + [Arguments] ${name} ${domain} ${url} ${postyaml} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers} Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= POST On Session ${name} ${url} data=${postyaml} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeJsonPostRequest + [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= POST On Session ${name} ${url} data=${postjson} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeJsonPutRequest + [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session ${name} ${url} data=${postjson} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +MakeGetRequest + [Arguments] ${name} ${domain} ${url} ${auth} + Log Creating session http://${domain} + ${session}= Create Session ${name} http://${domain} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session ${name} ${url} headers=${headers} + Log Received response from ${name} ${resp.text} + RETURN ${resp} + +VerifyKafkaInTraces + [Arguments] ${domain} ${service} + Log Creating session http://${domain} + ${session}= Create Session jaeger http://${domain} + ${tags}= Create Dictionary otel.library.name=io.opentelemetry.kafka-clients-2.6 messaging.system=kafka + ${tags_json}= evaluate json.dumps(${tags}) json + ${params}= Create Dictionary service=${service} tags=${tags_json} operation=policy-acruntime-participant publish lookback=1h limit=10 + ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 + Log Received response from jaeger ${resp.text} + RETURN ${resp} + +VerifyHttpInTraces + [Arguments] ${domain} ${service} + Log Creating session http://${domain} + ${session}= Create Session jaeger http://${domain} + ${tags}= Create Dictionary uri=/v2/compositions/{compositionId} + ${tags_json}= evaluate json.dumps(${tags}) json + ${params}= Create Dictionary service=${service} tags=${tags_json} operation=http put /v2/compositions/{compositionId} lookback=1h limit=10 + ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 + Log Received response from jaeger ${resp.text} + RETURN ${resp} \ No newline at end of file diff --git a/csit/resources/tests/clamp-db-restore.robot b/csit/resources/tests/clamp-db-restore.robot new file mode 100644 index 00000000..420c54a9 --- /dev/null +++ b/csit/resources/tests/clamp-db-restore.robot @@ -0,0 +1,88 @@ +*** Settings *** +Name Database Restore Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** + +InsertDataIntoDatabase + [Documentation] Insert restored data into the Database. + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-from.sql + Should Be Equal As Strings ${result.rc} 0 + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-to.sql + Should Be Equal As Strings ${result.rc} 0 + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/instance.sql + Should Be Equal As Strings ${result.rc} 0 + +AcMigrationRestored + [Documentation] Migration of an automation composition restored. + set Suite variable ${compositionIdRestored} d30b8017-4d64-4693-84d7-de9c4226b9f8 + set Suite variable ${InstanceIdRestored} dd36aaa4-580f-4193-a52b-37c3a955b11a + set Suite variable ${compositionTargetIdRestored} 6c1cf107-a2ca-4485-8129-02f9fae64d64 + SetParticipantSimSuccess + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-restored.yaml + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionIdRestored}/instances ${postyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionTargetIdRestored} ${InstanceIdRestored} DEPLOYED + +UpdateDataDatabase + [Documentation] Update restored data into the Database. + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-update.sql + Should Be Equal As Strings ${result.rc} 0 + +ReviewAutomationCompositionRestored + [Documentation] Review automation composition restored. + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ChangeStatusAutomationComposition ${compositionTargetIdRestored} ${InstanceIdRestored} ${postjson} + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionTargetIdRestored} ${InstanceIdRestored} + VerifyCompositionParticipantSim 'MyTextUpdated' + +AcDeleteRestored + [Documentation] Undeploy and delete of an automation composition restored. + UndeployAndDeleteAutomationComposition ${compositionTargetIdRestored} ${InstanceIdRestored} + +DeleteACDefinitionsRestored + [Documentation] Deprime and delete of the compositions definition restored. + DePrimeAndDeleteACDefinition ${compositionIdRestored} + DePrimeAndDeleteACDefinition ${compositionTargetIdRestored} + +InsertDataIntoDatabase2 + [Documentation] Insert restored data into the Database. + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-from.sql + Should Be Equal As Strings ${result.rc} 0 + ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/instance.sql + Should Be Equal As Strings ${result.rc} 0 + +SyncParticipant + [Documentation] Manual sync participants. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants/sync + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 1 min 10 sec VerifyCompositionParticipantSim 'InternalState' + VerifyParticipantSim ${InstanceIdRestored} myParameterToUpdate + +GetInstances + [Documentation] Get all the instances from the database + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/instances + Log Received response from ACM-R ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Length Should Be ${resp.json()["automationCompositionList"]} 1 + +AcDeleteRestored2 + [Documentation] Undeploy and delete of an automation composition restored. + UndeployAndDeleteAutomationComposition ${compositionIdRestored} ${InstanceIdRestored} + DePrimeAndDeleteACDefinition ${compositionIdRestored} \ No newline at end of file diff --git a/csit/resources/tests/clamp-health-check.robot b/csit/resources/tests/clamp-health-check.robot new file mode 100644 index 00000000..8e579666 --- /dev/null +++ b/csit/resources/tests/clamp-health-check.robot @@ -0,0 +1,41 @@ +*** Settings *** +Name Health Check Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** +HealthcheckAcm + [Documentation] Healthcheck on Clamp Acm + ${auth}= ClampAuth + ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} onap/policy/clamp/acm/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +HealthcheckParticipantSim + [Documentation] Healthcheck on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/health ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + +HealthcheckApi + [Documentation] Healthcheck on policy-api + Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckApi + +HealthcheckPap + [Documentation] Healthcheck on policy-pap + Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckPap + +RegisterParticipants + [Documentation] Register Participants. + ${auth}= ClampAuth + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 \ No newline at end of file diff --git a/csit/resources/tests/clamp-migrate-rollback.robot b/csit/resources/tests/clamp-migrate-rollback.robot new file mode 100644 index 00000000..fc9232f1 --- /dev/null +++ b/csit/resources/tests/clamp-migrate-rollback.robot @@ -0,0 +1,367 @@ +*** Settings *** +Name Migration and Rollback Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** +CommissionAutomationComposition + [Documentation] Commission automation composition definition. + Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${compositionFile} acelement-usecase.yaml + + ... ELSE set Suite variable ${compositionFile} acelement-usecaseDocker.yaml + ${postyaml}= Get file ${CURDIR}/data/${compositionFile} + ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} + set Suite variable ${compositionId} ${tmpCompositionId} + +CommissionAcDefinitionMigrationFrom + [Documentation] Commission automation composition definition From. + ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-from.yaml + ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} + set Suite variable ${compositionFromId} ${tmpCompositionId} + +CommissionAcDefinitionMigrationTo + [Documentation] Commission automation composition definition To. + ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-to.yaml + ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} + set Suite variable ${compositionToId} ${tmpCompositionId} + +PrimeACDefinitions + [Documentation] Prime automation composition definition + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${compositionId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} PRIMED + +FailPrimeACDefinitionFrom + [Documentation] Prime automation composition definition Migration From with Fail. + SetParticipantSimFail + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${compositionFromId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionFromId} FAILED + +PrimeACDefinitionFrom + [Documentation] Prime automation composition definition Migration From. + SetParticipantSimSuccess + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${compositionFromId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} PRIMED + +PrimeACDefinitionTo + [Documentation] Prime automation composition definition Migration To. + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${compositionToId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} PRIMED + +DeleteUndeployedInstantiateAutomationComposition + [Documentation] Delete Instantiate automation composition that has never been deployed. + Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json + + ... ELSE set Suite variable ${instantiationfile} AcDocker.json + ${postjson}= Get file ${CURDIR}/data/${instantiationfile} + ${tmpInstanceId}= MakeJsonInstantiateAutomationComposition ${compositionId} ${postjson} + DeleteAutomationComposition ${compositionId} ${tmpInstanceId} + Wait Until Keyword Succeeds 3 min 5 sec VerifyUninstantiated ${compositionId} + +InstantiateAutomationComposition + [Documentation] Instantiate automation composition. + Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json + + ... ELSE set Suite variable ${instantiationfile} AcDocker.json + ${postjson}= Get file ${CURDIR}/data/${instantiationfile} + ${tmpInstanceId}= MakeJsonInstantiateAutomationComposition ${compositionId} ${postjson} + Set Suite Variable ${instanceId} ${tmpInstanceId} + +InstantiateAutomationCompositionTimeout + [Documentation] Instantiate automation composition timeout. + ${postyaml}= Get file ${CURDIR}/data/ac-instance-timeout.yaml + ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${postyaml} + set Suite variable ${instanceTimeoutId} ${tmpInstanceId} + +DeployAutomationCompositionTimeout + [Documentation] Deploy automation composition timeout. + SetParticipantSimTimeout + SetParticipantSim2Timeout + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceTimeoutId} ${postjson} + Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceTimeoutId} TIMEOUT + +DeleteAutomationCompositionTimeout + [Documentation] Delete automation composition timeout. + SetParticipantSimSuccess + SetParticipantSim2Success + UndeployAndDeleteAutomationComposition ${compositionFromId} ${instanceTimeoutId} + +InstantiateAutomationCompositionMigrationFrom + [Documentation] Instantiate automation composition migration. + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml + ${updatedpostyaml}= Replace String ${postyaml} TEXTPLACEHOLDER MyTextInit + ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${updatedpostyaml} + set Suite variable ${instanceMigrationId} ${tmpInstanceId} + +FailPrepareAutomationCompositionMigrationFrom + [Documentation] Fail Prepare automation composition migration. + SetParticipantSimFail + SetParticipantSim2Fail + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +PrepareAutomationCompositionMigrationFrom + [Documentation] Prepare automation composition migration. + SetParticipantSimSuccess + SetParticipantSim2Success + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} + VerifyPrepareElementsRuntime ${compositionFromId} ${instanceMigrationId} + +FailDeployAutomationCompositionMigration + [Documentation] Fail Deploy automation composition. + SetParticipantSimFail + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +DeployAutomationComposition + [Documentation] Deploy automation composition. + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${compositionId} ${instanceId} ${postjson} + Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED + +QueryPolicies + [Documentation] Verify the new policies deployed + ${auth}= PolicyAdminAuth + Sleep 10s + Log Creating session http://${POLICY_PAP_IP} + ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/pap/v1/policies/deployed headers=${headers} + Log Received response from policy-pap {resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Dictionary Should Contain Value ${resp.json()[0]} onap.policies.native.apex.ac.element + +QueryPolicyTypes + [Documentation] Verify the new policy types created + ${auth}= PolicyAdminAuth + Sleep 10s + Log Creating session http://${POLICY_API_IP}:6969 + ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} + Log Received response from policy-api ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex + +DeployAutomationCompositionMigration + [Documentation] Deploy automation composition. + SetParticipantSimSuccess + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + +SendOutPropertiesToRuntime + [Documentation] Send Out Properties To Runtime + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/OutProperties.json + ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER DumpTest + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER MyTextToSend + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} + 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 + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +ReviewAutomationCompositionMigrationFrom + [Documentation] Review automation composition migration. + SetParticipantSimSuccess + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} + +AutomationCompositionUpdate + [Documentation] Update of an automation composition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-update.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER MyTextUpdated + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextUpdated + VerifyParticipantSim ${instanceMigrationId} MyTextUpdated + +PrecheckAutomationCompositionMigration + [Documentation] Precheck Migration of an automation composition. + ${auth}= ClampAuth + ${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 + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} + +AutomationCompositionMigrationTo + [Documentation] Migration of an automation composition. + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED + VerifyPropertiesUpdated ${compositionToId} ${instanceMigrationId} TextForMigration + VerifyParticipantSim ${instanceMigrationId} TextForMigration + VerifyMigratedElementsRuntime ${compositionToId} ${instanceMigrationId} + VerifyMigratedElementsSim ${instanceMigrationId} + VerifyRemovedElementsSim ${instanceMigrationId} + +FailAutomationCompositionMigration + [Documentation] Fail Migration of an automation composition. + SetParticipantSimFail + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-fail.yaml + ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionToId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionFromId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} + ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED + +UnInstantiateAutomationComposition + [Documentation] UnDeploy and Delete automation composition instance. + SetParticipantSimSuccess + UndeployAndDeleteAutomationComposition ${compositionId} ${instanceId} + +FailUnDeployAutomationCompositionMigrationTo + [Documentation] Fail UnDeploy automation composition migrated. + SetParticipantSimFail + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ChangeStatusAutomationComposition ${compositionToId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED + +UnDeployAutomationCompositionMigrationTo + [Documentation] UnDeploy automation composition migrated. + SetParticipantSimSuccess + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ChangeStatusAutomationComposition ${compositionToId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED + +FailUnInstantiateAutomationCompositionMigrationTo + [Documentation] Fail Delete automation composition instance migrated. + SetParticipantSimFail + DeleteAutomationComposition ${compositionToId} ${instanceMigrationId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED + +UnInstantiateAutomationCompositionMigrationTo + [Documentation] Delete automation composition instance migrated. + SetParticipantSimSuccess + DeleteAutomationComposition ${compositionToId} ${instanceMigrationId} + Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionToId} + +InstantiateAutomationCompositionRollback + [Documentation] Instantiate automation composition for testing rollback. + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml + ${updatedpostyaml}= Replace String ${postyaml} TEXTPLACEHOLDER MyTextInit + ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${updatedpostyaml} + set Suite variable ${instanceMigrationId} ${tmpInstanceId} + +DeployAutomationCompositionRollback + [Documentation] Deploy automation for testing rollback. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + +FailAutomationCompositionMigrationRollback + [Documentation] Fail Migration of an automation composition for testing rollback. + SetParticipantSimFail + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +RollbackAutomationComposition + [Documentation] Rollback of an automation composition. + SetParticipantSimSuccess + ${auth}= ClampAuth + ${resp}= MakePostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId}/rollback ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextInit + VerifyParticipantSim ${instanceMigrationId} MyTextInit + VerifyRollbackElementsRuntime ${compositionFromId} ${instanceMigrationId} + VerifyRollbackElementsSim ${instanceMigrationId} + +FailAutomationCompositionMigrationRollback2 + [Documentation] Fail Migration of an automation composition for testing rollback. + SetParticipantSimFail + ${auth}= ClampAuth + ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +FailRollbackAutomationComposition + [Documentation] Fail Rollback of an automation composition. + ${auth}= ClampAuth + ${resp}= MakePostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId}/rollback ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +UnInstantiateAutomationCompositionRollback + [Documentation] Undeploy and Delete automation composition instance in fail rollback. + SetParticipantSimSuccess + UndeployAndDeleteAutomationComposition ${compositionFromId} ${instanceMigrationId} + +FailDePrimeACDefinitionsFrom + [Documentation] Fail DePrime automation composition definition migration From. + SetParticipantSimFail + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + PrimeACDefinition ${postjson} ${compositionFromId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionFromId} FAILED + +DeleteACDefinitionFrom + [Documentation] DePrime and Delete automation composition definition migration From. + SetParticipantSimSuccess + DePrimeAndDeleteACDefinition ${compositionFromId} + +DeleteACDefinitions + [Documentation] DePrime and Delete automation composition definition. + DePrimeAndDeleteACDefinition ${compositionId} + +DeleteACDefinitionTo + [Documentation] DePrime and Delete automation composition definition migration To. + DePrimeAndDeleteACDefinition ${compositionToId} + diff --git a/csit/resources/tests/clamp-single-element-test.robot b/csit/resources/tests/clamp-single-element-test.robot new file mode 100644 index 00000000..1b5c619b --- /dev/null +++ b/csit/resources/tests/clamp-single-element-test.robot @@ -0,0 +1,57 @@ +*** Settings *** +Name AC With Single Element Workflow +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** +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} + +DeleteACDefinitionSimple + [Documentation] DePrime and Delete simple automation composition definition. + DePrimeAndDeleteACDefinition ${simpleCompositionId} \ No newline at end of file diff --git a/csit/resources/tests/clamp-slas.robot b/csit/resources/tests/clamp-slas.robot index 18a83d7a..c54ac6cc 100644 --- a/csit/resources/tests/clamp-slas.robot +++ b/csit/resources/tests/clamp-slas.robot @@ -1,8 +1,9 @@ *** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library json +Name Service Level Agreement Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json Resource common-library.robot *** Keywords *** diff --git a/csit/resources/tests/clamp-timeout-test.robot b/csit/resources/tests/clamp-timeout-test.robot new file mode 100644 index 00000000..a38b8996 --- /dev/null +++ b/csit/resources/tests/clamp-timeout-test.robot @@ -0,0 +1,30 @@ +*** Settings *** +Name Timeout Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** +CommissionAcDefinitionTimeout + [Documentation] Commission automation composition definition Timeout. + ${postyaml}= Get file ${CURDIR}/data/ac-definition-timeout.yaml + ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} + set Suite variable ${compositionTimeoutId} ${tmpCompositionId} + +TimeoutPrimeACDefinition + [Documentation] Prime automation composition definition Timeout. + SetParticipantSimTimeout + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + PrimeACDefinition ${postjson} ${compositionTimeoutId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionTimeoutId} TIMEOUT + +DeleteACDefinitionTimeout + [Documentation] DePrime and Delete automation composition definition Timeout. + SetParticipantSimSuccess + DePrimeAndDeleteACDefinition ${compositionTimeoutId} \ No newline at end of file diff --git a/csit/resources/tests/clamp-trace-test.robot b/csit/resources/tests/clamp-trace-test.robot new file mode 100644 index 00000000..c6035d65 --- /dev/null +++ b/csit/resources/tests/clamp-trace-test.robot @@ -0,0 +1,45 @@ +*** Settings *** +Name Tracing and Logs Suite +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library String +Library json +Library yaml +Library Process +Resource common-library.robot +Resource clamp-common.robot + +*** Test Cases *** +CheckTraces + [Documentation] Verify that traces are being recorded in jaeger + Log Verifying Jaeger traces + ${acmResp}= VerifyTracingWorks ${JAEGER_IP} acm-r + ${httpSim1Resp}= VerifyTracingWorks ${JAEGER_IP} sim-ppnt-1 + ${policyResp}= VerifyTracingWorks ${JAEGER_IP} policy-ppnt + ${httpSim2Resp}= VerifyTracingWorks ${JAEGER_IP} sim-ppnt-2 + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpSim1Resp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpSim2Resp.json()["data"][0]["spans"][0]["spanID"]} + +CheckKafkaPresentInTraces + [Documentation] Verify that kafka traces are being recorded in jaeger + Log Verifying Kafka Jaeger traces + ${acmResp}= VerifyKafkaInTraces ${JAEGER_IP} acm-r + ${httpSim1Resp}= VerifyKafkaInTraces ${JAEGER_IP} sim-ppnt-1 + ${policyResp}= VerifyKafkaInTraces ${JAEGER_IP} policy-ppnt + ${httpSim2Resp}= VerifyKafkaInTraces ${JAEGER_IP} sim-ppnt-2 + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpSim1Resp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} + Should Not Be Empty ${httpSim2Resp.json()["data"][0]["spans"][0]["spanID"]} + +CheckHttpPresentInAcmTraces + [Documentation] Verify that http traces are being recorded in jaeger + Log Verifying Http Jaeger traces + ${acmResp}= VerifyHttpInTraces ${JAEGER_IP} acm-r + Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} + Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} \ No newline at end of file diff --git a/csit/resources/tests/data/query/compositiondefinition-to.sql b/csit/resources/tests/data/query/compositiondefinition-to.sql index 7a4ab763..20b85f8c 100644 --- a/csit/resources/tests/data/query/compositiondefinition-to.sql +++ b/csit/resources/tests/data/query/compositiondefinition-to.sql @@ -28,4 +28,3 @@ VALUES ('3d34ca20-1b16-4f2c-971a-6ed52a0dafff', '6c1cf107-a2ca-4485-8129-02f9fae INSERT INTO nodetemplatestate (nodetemplatestateid, compositionid, message, nodetemplate_name, nodetemplate_version, outproperties, participantid, state) VALUES ('d6a4a446-cfcb-45ad-a63e-3c6393471e42', '6c1cf107-a2ca-4485-8129-02f9fae64d64', 'Primed', 'onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement', '1.2.4', '{"InternalState":"PRIMED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', 2); - diff --git a/csit/resources/tests/data/query/instance.sql b/csit/resources/tests/data/query/instance.sql index d3334460..259a5644 100644 --- a/csit/resources/tests/data/query/instance.sql +++ b/csit/resources/tests/data/query/instance.sql @@ -17,14 +17,35 @@ * ============LICENSE_END========================================================= */ -INSERT INTO automationcomposition (instanceid, compositionid, compositiontargetid, deploystate, description, lockstate, name, statechangeresult, version, lastmsg, phase, substate, revisionId) -VALUES ('dd36aaa4-580f-4193-a52b-37c3a955b11a', 'd30b8017-4d64-4693-84d7-de9c4226b9f8', NULL, 0, 'Demo automation composition instance 0', 0, 'Test-Instance-Migration-From', 0, '2.0.1', '2025-07-16 09:53:15.512496', NULL, 0, 'e999d17c-5b80-476f-96cc-1acfb38194ee'); +INSERT INTO automationcomposition (instanceid, compositionid, compositiontargetid, deploystate, description, lockstate, + name, statechangeresult, version, lastmsg, phase, substate, revisionId) +VALUES ('dd36aaa4-580f-4193-a52b-37c3a955b11a', 'd30b8017-4d64-4693-84d7-de9c4226b9f8', NULL, 0, + 'Demo automation composition instance 0', 0, 'Test-Instance-Migration-From', 0, '2.0.1', + '2025-07-16 09:53:15.512496', NULL, 0, 'e999d17c-5b80-476f-96cc-1acfb38194ee'); -INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, instanceid, lockstate, message, operationalstate, outproperties, participantid, properties, restarting, usestate, substate, stage) -VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c36', 'onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement', '1.2.3', 0, 'Sink Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:ZuDP803svc1ThgeVcYeQvA0kL8gpz2Qzg9unk3zm+XSi8RSTlDQ2qgSzROz7QOit","httpHeaders":{"Content-Type":"application/json","Authorization":"Basic YWNtVXNlcjp6YiFYenRHMzQ="},"configurationEntities":[{"configurationEntityId":{"name":"onap.policy.clamp.ac.sink","version":"1.0.0"},"restSequence":[{"restRequestId":{"name":"request3","version":"1.0.1"},"httpMethod":"POST","path":"/onap/policy/clamp/acelement/v2/activate","body":"{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.sink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"SINK\", \"topicParameterGroup\": { \"server\": \"message-router\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }","expectedResponse":201}],"myParameterToUpdate":"text"}]}', NULL, NULL, 0, NULL); +INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, + instanceid, lockstate, message, operationalstate, outproperties, + participantid, properties, usestate, substate, stage) +VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c36', 'onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement', + '1.2.3', 0, 'Sink Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, + 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', + '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:ZuDP803svc1ThgeVcYeQvA0kL8gpz2Qzg9unk3zm+XSi8RSTlDQ2qgSzROz7QOit","httpHeaders":{"Content-Type":"application/json","Authorization":"Basic YWNtVXNlcjp6YiFYenRHMzQ="},"configurationEntities":[{"configurationEntityId":{"name":"onap.policy.clamp.ac.sink","version":"1.0.0"},"restSequence":[{"restRequestId":{"name":"request3","version":"1.0.1"},"httpMethod":"POST","path":"/onap/policy/clamp/acelement/v2/activate","body":"{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.sink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"SINK\", \"topicParameterGroup\": { \"server\": \"message-router\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }","expectedResponse":201}],"myParameterToUpdate":"text"}]}', + NULL, 0, NULL); -INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, instanceid, lockstate, message, operationalstate, outproperties, participantid, properties, restarting, usestate, substate, stage) -VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c34', 'onap.policy.clamp.ac.element.Sim_StarterAutomationCompositionElement', '1.2.3', 0, 'Starter Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:1IPD8QRnRhnFlUfrHIoRRuzPYHV0z88DhwXYa+KhZqv6iUh1JiVoN28oAIYFq1i6","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"}]}', NULL, NULL, 0, NULL); +INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, + instanceid, lockstate, message, operationalstate, outproperties, + participantid, properties, usestate, substate, stage) +VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c34', 'onap.policy.clamp.ac.element.Sim_StarterAutomationCompositionElement', + '1.2.3', 0, 'Starter Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, + 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', + '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:1IPD8QRnRhnFlUfrHIoRRuzPYHV0z88DhwXYa+KhZqv6iUh1JiVoN28oAIYFq1i6","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"}]}', + NULL, 0, NULL); -INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, instanceid, lockstate, message, operationalstate, outproperties, participantid, properties, restarting, usestate, substate, stage) -VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c35', 'onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement', '1.2.3', 0, 'Bridge Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:Q4bNY29WKbV4o/vi15DMyWnWla6lTTwbn5ZRfR1nspd5xL9vDvtl8FYBA7Sj6mHI","httpHeaders":{"Content-Type":"application/json","Authorization":"Basic YWNtVXNlcjp6YiFYenRHMzQ="},"configurationEntities":[{"configurationEntityId":{"name":"onap.policy.clamp.ac.bridge","version":"1.0.0"},"restSequence":[{"restRequestId":{"name":"request2","version":"1.0.1"},"httpMethod":"POST","path":"/onap/policy/clamp/acelement/v2/activate","body":"{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.bridgetosink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"BRIDGE\", \"topicParameterGroup\": { \"server\": \"message-router:3904\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }","expectedResponse":201}],"myParameterToUpdate":"text"}]}', NULL, NULL, 0, NULL); +INSERT INTO automationcompositionelement (elementid, definition_name, definition_version, deploystate, description, + instanceid, lockstate, message, operationalstate, outproperties, + participantid, properties, usestate, substate, stage) +VALUES ('989c62b3-8918-41b9-a747-d21eb79c6c35', 'onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement', + '1.2.3', 0, 'Bridge Automation Composition Element for the Demo', 'dd36aaa4-580f-4193-a52b-37c3a955b11a', 0, + 'Deployed', NULL, '{"InternalState":"DEPLOYED"}', '101c62b3-8918-41b9-a747-d21eb79c6c90', + '{"deployTimeoutMs":200000,"undeployTimeoutMs":150000,"updateTimeoutMs":200000,"migrateTimeoutMs":200000,"deleteTimeoutMs":100000,"baseUrl":"ENCRYPTED:Q4bNY29WKbV4o/vi15DMyWnWla6lTTwbn5ZRfR1nspd5xL9vDvtl8FYBA7Sj6mHI","httpHeaders":{"Content-Type":"application/json","Authorization":"Basic YWNtVXNlcjp6YiFYenRHMzQ="},"configurationEntities":[{"configurationEntityId":{"name":"onap.policy.clamp.ac.bridge","version":"1.0.0"},"restSequence":[{"restRequestId":{"name":"request2","version":"1.0.1"},"httpMethod":"POST","path":"/onap/policy/clamp/acelement/v2/activate","body":"{ \"receiverId\": { \"name\": \"onap.policy.clamp.ac.bridgetosink\", \"version\": \"1.0.0\" }, \"timerMs\": 20000, \"elementType\": \"BRIDGE\", \"topicParameterGroup\": { \"server\": \"message-router:3904\", \"listenerTopic\": \"POLICY_UPDATE_MSG\", \"publisherTopic\": \"AC_ELEMENT_MSG\", \"fetchTimeout\": 15000, \"topicCommInfrastructure\": \"dmaap\" } }","expectedResponse":201}],"myParameterToUpdate":"text"}]}', + NULL, 0, NULL); diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot deleted file mode 100644 index 8c58c2ed..00000000 --- a/csit/resources/tests/policy-clamp-test.robot +++ /dev/null @@ -1,938 +0,0 @@ -*** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library String -Library json -Library yaml -Library Process -Resource common-library.robot - -*** Test Cases *** -HealthcheckAcm - [Documentation] Healthcheck on Clamp Acm - ${auth}= ClampAuth - ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} onap/policy/clamp/acm/health ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -HealthcheckParticipantSim - [Documentation] Healthcheck on Participant Simulator - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/health ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -HealthcheckApi - [Documentation] Healthcheck on policy-api - Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckApi - -HealthcheckPap - [Documentation] Healthcheck on policy-pap - Wait Until Keyword Succeeds 5 min 10 sec VerifyHealthcheckPap - -RegisterParticipants - [Documentation] Register Participants. - ${auth}= ClampAuth - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - -InsertDataIntoDatabase - [Documentation] Insert restored data into the Database. - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-from.sql - Should Be Equal As Strings ${result.rc} 0 - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-to.sql - Should Be Equal As Strings ${result.rc} 0 - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/instance.sql - Should Be Equal As Strings ${result.rc} 0 - -AcMigrationRestored - [Documentation] Migration of an automation composition restored. - set Suite variable ${compositionIdRestored} d30b8017-4d64-4693-84d7-de9c4226b9f8 - set Suite variable ${InstanceIdRestored} dd36aaa4-580f-4193-a52b-37c3a955b11a - set Suite variable ${compositionTargetIdRestored} 6c1cf107-a2ca-4485-8129-02f9fae64d64 - SetParticipantSimSuccess - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-restored.yaml - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionIdRestored}/instances ${postyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionTargetIdRestored} ${InstanceIdRestored} DEPLOYED - -UpdateDataDatabase - [Documentation] Update restored data into the Database. - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-update.sql - Should Be Equal As Strings ${result.rc} 0 - -ReviewAutomationCompositionRestored - [Documentation] Review automation composition restored. - ${postjson}= Get file ${CURDIR}/data/ReviewAC.json - ChangeStatusAutomationComposition ${compositionTargetIdRestored} ${InstanceIdRestored} ${postjson} - Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionTargetIdRestored} ${InstanceIdRestored} - VerifyCompositionParticipantSim 'MyTextUpdated' - -AcDeleteRestored - [Documentation] Undeploy and delete of an automation composition restored. - UndeployAndDeleteAutomationComposition ${compositionTargetIdRestored} ${InstanceIdRestored} - -DeleteACDefinitionsRestored - [Documentation] Deprime and delete of the compositions definition restored. - DePrimeAndDeleteACDefinition ${compositionIdRestored} - DePrimeAndDeleteACDefinition ${compositionTargetIdRestored} - -InsertDataIntoDatabase2 - [Documentation] Insert restored data into the Database. - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/compositiondefinition-from.sql - Should Be Equal As Strings ${result.rc} 0 - ${result}= Run Process ${CURDIR}/data/script/execute-query.sh ${CURDIR}/data/query/instance.sql - Should Be Equal As Strings ${result.rc} 0 - -SyncParticipant - [Documentation] Manual sync participants. - ${auth}= ClampAuth - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/participants/sync - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 1 min 10 sec VerifyCompositionParticipantSim 'InternalState' - VerifyParticipantSim ${InstanceIdRestored} myParameterToUpdate - -GetInstances - [Documentation] Get all the instances from the database - ${auth}= ClampAuth - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/instances - Log Received response from ACM-R ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Length Should Be ${resp.json()["automationCompositionList"]} 1 - -AcDeleteRestored2 - [Documentation] Undeploy and delete of an automation composition restored. - UndeployAndDeleteAutomationComposition ${compositionIdRestored} ${InstanceIdRestored} - DePrimeAndDeleteACDefinition ${compositionIdRestored} - -CommissionAcDefinitionTimeout - [Documentation] Commission automation composition definition Timeout. - ${postyaml}= Get file ${CURDIR}/data/ac-definition-timeout.yaml - ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} - set Suite variable ${compositionTimeoutId} ${tmpCompositionId} - -TimeoutPrimeACDefinition - [Documentation] Prime automation composition definition Timeout. - SetParticipantSimTimeout - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - PrimeACDefinition ${postjson} ${compositionTimeoutId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionTimeoutId} TIMEOUT - -DeleteACDefinitionTimeout - [Documentation] DePrime and Delete automation composition definition Timeout. - SetParticipantSimSuccess - DePrimeAndDeleteACDefinition ${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} - -DeleteACDefinitionSimple - [Documentation] DePrime and Delete simple automation composition definition. - DePrimeAndDeleteACDefinition ${simpleCompositionId} - -CommissionAutomationComposition - [Documentation] Commission automation composition definition. - Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${compositionFile} acelement-usecase.yaml - - ... ELSE set Suite variable ${compositionFile} acelement-usecaseDocker.yaml - ${postyaml}= Get file ${CURDIR}/data/${compositionFile} - ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} - set Suite variable ${compositionId} ${tmpCompositionId} - -CommissionAcDefinitionMigrationFrom - [Documentation] Commission automation composition definition From. - ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-from.yaml - ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} - set Suite variable ${compositionFromId} ${tmpCompositionId} - -CommissionAcDefinitionMigrationTo - [Documentation] Commission automation composition definition To. - ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-to.yaml - ${tmpCompositionId}= MakeCommissionAcDefinition ${postyaml} - set Suite variable ${compositionToId} ${tmpCompositionId} - -PrimeACDefinitions - [Documentation] Prime automation composition definition - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - PrimeACDefinition ${postjson} ${compositionId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} PRIMED - -FailPrimeACDefinitionFrom - [Documentation] Prime automation composition definition Migration From with Fail. - SetParticipantSimFail - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - PrimeACDefinition ${postjson} ${compositionFromId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionFromId} FAILED - -PrimeACDefinitionFrom - [Documentation] Prime automation composition definition Migration From. - SetParticipantSimSuccess - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - PrimeACDefinition ${postjson} ${compositionFromId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} PRIMED - -PrimeACDefinitionTo - [Documentation] Prime automation composition definition Migration To. - ${postjson}= Get file ${CURDIR}/data/ACPriming.json - PrimeACDefinition ${postjson} ${compositionToId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} PRIMED - -DeleteUndeployedInstantiateAutomationComposition - [Documentation] Delete Instantiate automation composition that has never been deployed. - Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json - - ... ELSE set Suite variable ${instantiationfile} AcDocker.json - ${postjson}= Get file ${CURDIR}/data/${instantiationfile} - ${tmpInstanceId}= MakeJsonInstantiateAutomationComposition ${compositionId} ${postjson} - DeleteAutomationComposition ${compositionId} ${tmpInstanceId} - Wait Until Keyword Succeeds 3 min 5 sec VerifyUninstantiated ${compositionId} - -InstantiateAutomationComposition - [Documentation] Instantiate automation composition. - Run Keyword If '${TEST_ENV}'=='k8s' set Suite variable ${instantiationfile} AcK8s.json - - ... ELSE set Suite variable ${instantiationfile} AcDocker.json - ${postjson}= Get file ${CURDIR}/data/${instantiationfile} - ${tmpInstanceId}= MakeJsonInstantiateAutomationComposition ${compositionId} ${postjson} - Set Suite Variable ${instanceId} ${tmpInstanceId} - -InstantiateAutomationCompositionTimeout - [Documentation] Instantiate automation composition timeout. - ${postyaml}= Get file ${CURDIR}/data/ac-instance-timeout.yaml - ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${postyaml} - set Suite variable ${instanceTimeoutId} ${tmpInstanceId} - -DeployAutomationCompositionTimeout - [Documentation] Deploy automation composition timeout. - SetParticipantSimTimeout - SetParticipantSim2Timeout - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceTimeoutId} ${postjson} - Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceTimeoutId} TIMEOUT - -DeleteAutomationCompositionTimeout - [Documentation] Delete automation composition timeout. - SetParticipantSimSuccess - SetParticipantSim2Success - UndeployAndDeleteAutomationComposition ${compositionFromId} ${instanceTimeoutId} - -InstantiateAutomationCompositionMigrationFrom - [Documentation] Instantiate automation composition migration. - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml - ${updatedpostyaml}= Replace String ${postyaml} TEXTPLACEHOLDER MyTextInit - ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${updatedpostyaml} - set Suite variable ${instanceMigrationId} ${tmpInstanceId} - -FailPrepareAutomationCompositionMigrationFrom - [Documentation] Fail Prepare automation composition migration. - SetParticipantSimFail - SetParticipantSim2Fail - ${postjson}= Get file ${CURDIR}/data/PrepareAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -PrepareAutomationCompositionMigrationFrom - [Documentation] Prepare automation composition migration. - SetParticipantSimSuccess - SetParticipantSim2Success - ${postjson}= Get file ${CURDIR}/data/PrepareAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} - VerifyPrepareElementsRuntime ${compositionFromId} ${instanceMigrationId} - -FailDeployAutomationCompositionMigration - [Documentation] Fail Deploy automation composition. - SetParticipantSimFail - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -DeployAutomationComposition - [Documentation] Deploy automation composition. - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ChangeStatusAutomationComposition ${compositionId} ${instanceId} ${postjson} - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED - -CheckTraces - [Documentation] Verify that traces are being recorded in jaeger - Log Verifying Jaeger traces - ${acmResp}= VerifyTracingWorks ${JAEGER_IP} acm-r - ${httpSim1Resp}= VerifyTracingWorks ${JAEGER_IP} sim-ppnt-1 - ${policyResp}= VerifyTracingWorks ${JAEGER_IP} policy-ppnt - ${httpSim2Resp}= VerifyTracingWorks ${JAEGER_IP} sim-ppnt-2 - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpSim1Resp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpSim2Resp.json()["data"][0]["spans"][0]["spanID"]} - -CheckKafkaPresentInTraces - [Documentation] Verify that kafka traces are being recorded in jaeger - Log Verifying Kafka Jaeger traces - ${acmResp}= VerifyKafkaInTraces ${JAEGER_IP} acm-r - ${httpSim1Resp}= VerifyKafkaInTraces ${JAEGER_IP} sim-ppnt-1 - ${policyResp}= VerifyKafkaInTraces ${JAEGER_IP} policy-ppnt - ${httpSim2Resp}= VerifyKafkaInTraces ${JAEGER_IP} sim-ppnt-2 - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpSim1Resp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${policyResp.json()["data"][0]["spans"][0]["spanID"]} - Should Not Be Empty ${httpSim2Resp.json()["data"][0]["spans"][0]["spanID"]} - -CheckHttpPresentInAcmTraces - [Documentation] Verify that http traces are being recorded in jaeger - Log Verifying Http Jaeger traces - ${acmResp}= VerifyHttpInTraces ${JAEGER_IP} acm-r - Should Not Be Empty ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - Log Received spanID is ${acmResp.json()["data"][0]["spans"][0]["spanID"]} - -QueryPolicies - [Documentation] Verify the new policies deployed - ${auth}= PolicyAdminAuth - Sleep 10s - Log Creating session http://${POLICY_PAP_IP} - ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/pap/v1/policies/deployed headers=${headers} - Log Received response from policy-pap {resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Dictionary Should Contain Value ${resp.json()[0]} onap.policies.native.apex.ac.element - -QueryPolicyTypes - [Documentation] Verify the new policy types created - ${auth}= PolicyAdminAuth - Sleep 10s - Log Creating session http://${POLICY_API_IP}:6969 - ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} - Log Received response from policy-api ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex - -DeployAutomationCompositionMigration - [Documentation] Deploy automation composition. - SetParticipantSimSuccess - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED - -SendOutPropertiesToRuntime - [Documentation] Send Out Properties To Runtime - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/OutProperties.json - ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER DumpTest - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER MyTextToSend - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/datas ${updatedpostjson} ${auth} - 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 - ${postjson}= Get file ${CURDIR}/data/ReviewAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -ReviewAutomationCompositionMigrationFrom - [Documentation] Review automation composition migration. - SetParticipantSimSuccess - ${postjson}= Get file ${CURDIR}/data/ReviewAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} - -AutomationCompositionUpdate - [Documentation] Update of an automation composition. - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-update.yaml - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER MyTextUpdated - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED - VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextUpdated - VerifyParticipantSim ${instanceMigrationId} MyTextUpdated - -PrecheckAutomationCompositionMigration - [Documentation] Precheck Migration of an automation composition. - ${auth}= ClampAuth - ${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 - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} - -AutomationCompositionMigrationTo - [Documentation] Migration of an automation composition. - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED - VerifyPropertiesUpdated ${compositionToId} ${instanceMigrationId} TextForMigration - VerifyParticipantSim ${instanceMigrationId} TextForMigration - VerifyMigratedElementsRuntime ${compositionToId} ${instanceMigrationId} - VerifyMigratedElementsSim ${instanceMigrationId} - VerifyRemovedElementsSim ${instanceMigrationId} - -FailAutomationCompositionMigration - [Documentation] Fail Migration of an automation composition. - SetParticipantSimFail - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-fail.yaml - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionToId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} COMPOSITIONTARGETIDPLACEHOLDER ${compositionFromId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} INSTACEIDPLACEHOLDER ${instanceMigrationId} - ${updatedpostyaml}= Replace String ${updatedpostyaml} TEXTPLACEHOLDER TextForMigration - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED - -UnInstantiateAutomationComposition - [Documentation] UnDeploy and Delete automation composition instance. - SetParticipantSimSuccess - UndeployAndDeleteAutomationComposition ${compositionId} ${instanceId} - -FailUnDeployAutomationCompositionMigrationTo - [Documentation] Fail UnDeploy automation composition migrated. - SetParticipantSimFail - ${postjson}= Get file ${CURDIR}/data/UndeployAC.json - ChangeStatusAutomationComposition ${compositionToId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED - -UnDeployAutomationCompositionMigrationTo - [Documentation] UnDeploy automation composition migrated. - SetParticipantSimSuccess - ${postjson}= Get file ${CURDIR}/data/UndeployAC.json - ChangeStatusAutomationComposition ${compositionToId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED - -FailUnInstantiateAutomationCompositionMigrationTo - [Documentation] Fail Delete automation composition instance migrated. - SetParticipantSimFail - DeleteAutomationComposition ${compositionToId} ${instanceMigrationId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED - -UnInstantiateAutomationCompositionMigrationTo - [Documentation] Delete automation composition instance migrated. - SetParticipantSimSuccess - DeleteAutomationComposition ${compositionToId} ${instanceMigrationId} - Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionToId} - -InstantiateAutomationCompositionRollback - [Documentation] Instantiate automation composition for testing rollback. - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml - ${updatedpostyaml}= Replace String ${postyaml} TEXTPLACEHOLDER MyTextInit - ${tmpInstanceId}= MakeYamlInstantiateAutomationComposition ${compositionFromId} ${updatedpostyaml} - set Suite variable ${instanceMigrationId} ${tmpInstanceId} - -DeployAutomationCompositionRollback - [Documentation] Deploy automation for testing rollback. - ${auth}= ClampAuth - ${postjson}= Get file ${CURDIR}/data/DeployAC.json - ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED - -FailAutomationCompositionMigrationRollback - [Documentation] Fail Migration of an automation composition for testing rollback. - SetParticipantSimFail - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -RollbackAutomationComposition - [Documentation] Rollback of an automation composition. - SetParticipantSimSuccess - ${auth}= ClampAuth - ${resp}= MakePostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId}/rollback ${auth} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED - VerifyPropertiesUpdated ${compositionFromId} ${instanceMigrationId} MyTextInit - VerifyParticipantSim ${instanceMigrationId} MyTextInit - VerifyRollbackElementsRuntime ${compositionFromId} ${instanceMigrationId} - VerifyRollbackElementsSim ${instanceMigrationId} - -FailAutomationCompositionMigrationRollback2 - [Documentation] Fail Migration of an automation composition for testing rollback. - SetParticipantSimFail - ${auth}= ClampAuth - ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-to.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 - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -FailRollbackAutomationComposition - [Documentation] Fail Rollback of an automation composition. - ${auth}= ClampAuth - ${resp}= MakePostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId}/rollback ${auth} - Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED - -UnInstantiateAutomationCompositionRollback - [Documentation] Undeploy and Delete automation composition instance in fail rollback. - SetParticipantSimSuccess - UndeployAndDeleteAutomationComposition ${compositionFromId} ${instanceMigrationId} - -FailDePrimeACDefinitionsFrom - [Documentation] Fail DePrime automation composition definition migration From. - SetParticipantSimFail - ${postjson}= Get file ${CURDIR}/data/ACDepriming.json - PrimeACDefinition ${postjson} ${compositionFromId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResultPriming ${compositionFromId} FAILED - -DeleteACDefinitionFrom - [Documentation] DePrime and Delete automation composition definition migration From. - SetParticipantSimSuccess - DePrimeAndDeleteACDefinition ${compositionFromId} - -DeleteACDefinitions - [Documentation] DePrime and Delete automation composition definition. - DePrimeAndDeleteACDefinition ${compositionId} - -DeleteACDefinitionTo - [Documentation] DePrime and Delete automation composition definition migration To. - DePrimeAndDeleteACDefinition ${compositionToId} - -*** Keywords *** - -VerifyHealthcheckApi - [Documentation] Verify Healthcheck on policy-api - ${auth}= PolicyAdminAuth - ${resp}= MakeGetRequest policy ${POLICY_API_IP} /policy/api/v1/health ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -VerifyHealthcheckPap - [Documentation] Verify Healthcheck on policy-pap - ${auth}= PolicyAdminAuth - ${resp}= MakeGetRequest policy ${POLICY_PAP_IP} /policy/pap/v1/health ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -VerifyPriming - [Arguments] ${theCompositionId} ${primestate} - [Documentation] Verify the AC definitions are primed to the participants - ${auth}= ClampAuth - ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['stateChangeResult']} NO_ERROR - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['state']} ${primestate} - -VerifyStateChangeResultPriming - [Arguments] ${theCompositionId} ${stateChangeResult} - [Documentation] Verify the AC definitions are primed to the participants - ${auth}= ClampAuth - ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} ${stateChangeResult} - -VerifyDeployStatus - [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} - [Documentation] Verify the Deploy status of automation composition. - ${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()['stateChangeResult']} NO_ERROR - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['deployState']} ${deploystate} - -VerifySubStatus - [Arguments] ${theCompositionId} ${theInstanceId} - [Documentation] Verify the Sub status of automation composition. - ${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()['stateChangeResult']} NO_ERROR - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['subState']} NONE - -VerifyStateChangeResult - [Arguments] ${theCompositionId} ${theInstanceId} ${stateChangeResult} - [Documentation] Verify the Deploy status of automation composition. - ${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 - Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} ${stateChangeResult} - -VerifyPropertiesUpdated - [Arguments] ${theCompositionId} ${theInstanceId} ${textToFind} - [Documentation] Verify the Deploy status of automation composition. - ${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()} - 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 - ${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()} - Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement - Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement - ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['stage']} - Should Be Equal As Strings ${respstring} [1, 2] - ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['stage']} - Should Be Equal As Strings ${respstring} [0, 1] - ${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] - -VerifyRollbackElementsRuntime - [Arguments] ${theCompositionId} ${theInstanceId} - [Documentation] Verify the Instance elements after Rollback - ${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()} - Should Not Match Regexp ${respstring} Sim_NewAutomationCompositionElement - Should Match Regexp ${respstring} Sim_SinkAutomationCompositionElement - ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c34']['outProperties']['rollbackStage']} - Should Be Equal As Strings ${respstring} [1, 2] - ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c35']['outProperties']['rollbackStage']} - Should Be Equal As Strings ${respstring} [0, 1] - ${respstring} Convert To String ${resp.json()['elements']['709c62b3-8918-41b9-a747-d21eb79c6c36']['outProperties']['rollbackStage']} - Should Be Equal As Strings ${respstring} [0, 2] - -VerifyMigratedElementsSim - [Arguments] ${theInstanceId} - [Documentation] Query on Participant Simulator 1 - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement - Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement - -VerifyRemovedElementsSim - [Arguments] ${theInstanceId} - [Documentation] Query on Participant Simulator 2 - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Not Match Regexp ${respstring} Sim_Sink2AutomationCompositionElement - -VerifyRollbackElementsSim - [Arguments] ${theInstanceId} - [Documentation] Query on Participant Simulator - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Not Match Regexp ${respstring} Sim_NewAutomationCompositionElement - Should Match Regexp ${respstring} Sim_SinkAutomationCompositionElement - -VerifyCompositionParticipantSim - [Arguments] ${textToFind} - [Documentation] Query composition on Participant Simulator - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/compositiondatas ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Match Regexp ${respstring} ${textToFind} - -VerifyParticipantSim - [Arguments] ${theInstanceId} ${textToFind} - [Documentation] Query on Participant Simulator - ${auth}= ParticipantAuth - ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - ${respstring} Convert To String ${resp.json()} - Should Match Regexp ${respstring} ${textToFind} - -VerifyUninstantiated - [Arguments] ${theCompositionId} - [Documentation] Verify the Uninstantiation of automation composition. - ${auth}= ClampAuth - ${resp}= MakeGetRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If ${resp.status_code}==200 Length Should Be ${resp.json()['automationCompositionList']} 0 - -SetParticipantSimFail - [Documentation] Set Participant Simulator Fail. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -SetParticipantSim2Fail - [Documentation] Set Participant Simulator2 Fail. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -SetParticipantSimSuccess - [Documentation] Set Participant Simulator Success. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -SetParticipantSim2Success - [Documentation] Set Participant Simulator Success. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -SetParticipantSimTimeout - [Documentation] Set Participant Simulator Timeout. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 200 - -SetParticipantSim2Timeout - [Documentation] Set Participant Simulator Timeout. - ${auth}= ParticipantAuth - ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json - ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_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 ${HTTP_PARTICIPANT_SIM1_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} - -ParticipantAuth - ${auth}= Create List participantUser zb!XztG34 - RETURN ${auth} - -MakeCommissionAcDefinition - [Arguments] ${postyaml} - ${auth}= ClampAuth - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} - ${respyaml}= yaml.Safe Load ${resp.text} - Should Be Equal As Strings ${resp.status_code} 201 - RETURN ${respyaml["compositionId"]} - -DePrimeAndDeleteACDefinition - [Arguments] ${compositionId} - ${postjson}= Get file ${CURDIR}/data/ACDepriming.json - PrimeACDefinition ${postjson} ${compositionId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} COMMISSIONED - DeleteACDefinition ${compositionId} - -PrimeACDefinition - [Arguments] ${postjson} ${compositionId} - ${auth}= ClampAuth - ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId} ${postjson} ${auth} - Should Be Equal As Strings ${resp.status_code} 202 - -DeleteACDefinition - [Arguments] ${compositionId} - ${auth}= ClampAuth - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - -MakeJsonInstantiateAutomationComposition - [Arguments] ${compositionId} ${postjson} - ${auth}= ClampAuth - ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} - ${resp}= MakeJsonPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostjson} ${auth} - ${respyaml}= yaml.Safe Load ${resp.text} - Should Be Equal As Strings ${resp.status_code} 201 - RETURN ${respyaml["instanceId"]} - -MakeYamlInstantiateAutomationComposition - [Arguments] ${compositionId} ${postyaml} - ${auth}= ClampAuth - ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionId} - ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostyaml} ${auth} - ${respyaml}= yaml.Safe Load ${resp.text} - Should Be Equal As Strings ${resp.status_code} 201 - RETURN ${respyaml["instanceId"]} - -ChangeStatusAutomationComposition - [Arguments] ${compositionId} ${instanceId} ${postjson} - ${auth}= ClampAuth - ${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 - -DeleteAutomationComposition - [Arguments] ${compositionId} ${instanceId} - ${auth}= ClampAuth - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} headers=${headers} - Log Received response from runtime acm ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - -UndeployAndDeleteAutomationComposition - [Arguments] ${compositionId} ${instanceId} - ${postjson}= Get file ${CURDIR}/data/UndeployAC.json - ChangeStatusAutomationComposition ${compositionId} ${instanceId} ${postjson} - Wait Until Keyword Succeeds 3 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED - DeleteAutomationComposition ${compositionId} ${instanceId} - Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionId} - -MakePostRequest - [Arguments] ${name} ${domain} ${url} ${auth} - Log Creating session http://${domain} - ${session}= Create Session ${name} http://${domain} auth=${auth} - ${resp}= POST On Session ${name} ${url} - Log Received response from ${name} ${resp.text} - RETURN ${resp} - -MakeYamlPostRequest - [Arguments] ${name} ${domain} ${url} ${postyaml} ${auth} - Log Creating session http://${domain} - ${session}= Create Session ${name} http://${domain} auth=${auth} - ${headers} Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session ${name} ${url} data=${postyaml} headers=${headers} - Log Received response from ${name} ${resp.text} - RETURN ${resp} - -MakeJsonPostRequest - [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} - Log Creating session http://${domain} - ${session}= Create Session ${name} http://${domain} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session ${name} ${url} data=${postjson} headers=${headers} - Log Received response from ${name} ${resp.text} - RETURN ${resp} - -MakeJsonPutRequest - [Arguments] ${name} ${domain} ${url} ${postjson} ${auth} - Log Creating session http://${domain} - ${session}= Create Session ${name} http://${domain} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session ${name} ${url} data=${postjson} headers=${headers} - Log Received response from ${name} ${resp.text} - RETURN ${resp} - -MakeGetRequest - [Arguments] ${name} ${domain} ${url} ${auth} - Log Creating session http://${domain} - ${session}= Create Session ${name} http://${domain} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session ${name} ${url} headers=${headers} - Log Received response from ${name} {resp.text} - RETURN ${resp} - -VerifyKafkaInTraces - [Arguments] ${domain} ${service} - Log Creating session http://${domain} - ${session}= Create Session jaeger http://${domain} - ${tags}= Create Dictionary otel.library.name=io.opentelemetry.kafka-clients-2.6 messaging.system=kafka - ${tags_json}= evaluate json.dumps(${tags}) json - ${params}= Create Dictionary service=${service} tags=${tags_json} operation=policy-acruntime-participant publish lookback=1h limit=10 - ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 - Log Received response from jaeger ${resp.text} - RETURN ${resp} - -VerifyHttpInTraces - [Arguments] ${domain} ${service} - Log Creating session http://${domain} - ${session}= Create Session jaeger http://${domain} - ${tags}= Create Dictionary uri=/v2/compositions/{compositionId} - ${tags_json}= evaluate json.dumps(${tags}) json - ${params}= Create Dictionary service=${service} tags=${tags_json} operation=http put /v2/compositions/{compositionId} lookback=1h limit=10 - ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 - Log Received response from jaeger ${resp.text} - RETURN ${resp} - diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index d91695de..48904a0b 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -96,11 +96,13 @@ function check_rest_endpoint() { } function export_clamp_variables() { - export ROBOT_FILES="policy-clamp-test.robot clamp-slas.robot" + export ROBOT_FILES="clamp-health-check.robot clamp-db-restore.robot clamp-single-element-test.robot clamp-timeout-test.robot + clamp-migrate-rollback.robot clamp-trace-test.robot clamp-slas.robot" export TEST_ENV="docker" export PROJECT="clamp" - export SCHEMAS_TO_BE_CREATED="policyadmin clampacm" + export SCHEMAS_TO_BE_CREATED="policyadmin" } + function setup_clamp() { export_clamp_variables export ACM_REPLICA_TEARDOWN=true