From 2bc4942f3a3707a3a136ba671bebc82d93e8fbaa Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 26 Jun 2024 14:18:30 +0100 Subject: Add fail scenarios in csit Add fail scenarios (prime, deploy, undeploy, delete and deprime) in csit using participant simulator. Issue-ID: POLICY-5064 Change-Id: I39de4633b7465f857bb00937a0365820c3535bfe Signed-off-by: FrancescoFioraEst --- csit/resources/tests/data/RunningCommand.json | 5 - .../tests/data/SettingSimPropertiesFail.json | 20 ++++ .../tests/data/SettingSimPropertiesSuccess.json | 20 ++++ csit/resources/tests/policy-clamp-test.robot | 117 ++++++++++++++++++++- 4 files changed, 154 insertions(+), 8 deletions(-) delete mode 100644 csit/resources/tests/data/RunningCommand.json create mode 100644 csit/resources/tests/data/SettingSimPropertiesFail.json create mode 100644 csit/resources/tests/data/SettingSimPropertiesSuccess.json (limited to 'csit') diff --git a/csit/resources/tests/data/RunningCommand.json b/csit/resources/tests/data/RunningCommand.json deleted file mode 100644 index 56980e64..00000000 --- a/csit/resources/tests/data/RunningCommand.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "instantiationCommand": { - "orderedState": "RUNNING" - } -} diff --git a/csit/resources/tests/data/SettingSimPropertiesFail.json b/csit/resources/tests/data/SettingSimPropertiesFail.json new file mode 100644 index 00000000..0c6402bd --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesFail.json @@ -0,0 +1,20 @@ +{ + "deploySuccess": false, + "undeploySuccess": false, + "lockSuccess": false, + "unlockSuccess": false, + "deleteSuccess": false, + "updateSuccess": false, + "migrateSuccess": false, + "primeSuccess": false, + "deprimeSuccess": false, + "deployTimerMs": 100, + "undeployTimerMs": 100, + "lockTimerMs": 100, + "unlockTimerMs": 100, + "updateTimerMs": 100, + "migrateTimerMs": 100, + "deleteTimerMs": 100, + "primeTimerMs": 100, + "deprimeTimerMs": 100 +} diff --git a/csit/resources/tests/data/SettingSimPropertiesSuccess.json b/csit/resources/tests/data/SettingSimPropertiesSuccess.json new file mode 100644 index 00000000..e0673322 --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesSuccess.json @@ -0,0 +1,20 @@ +{ + "deploySuccess": true, + "undeploySuccess": true, + "lockSuccess": true, + "unlockSuccess": true, + "deleteSuccess": true, + "updateSuccess": true, + "migrateSuccess": true, + "primeSuccess": true, + "deprimeSuccess": true, + "deployTimerMs": 100, + "undeployTimerMs": 100, + "lockTimerMs": 100, + "unlockTimerMs": 100, + "updateTimerMs": 100, + "migrateTimerMs": 100, + "deleteTimerMs": 100, + "primeTimerMs": 100, + "deprimeTimerMs": 100 +} diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 9d69520a..3f158c60 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -95,8 +95,21 @@ PrimeACDefinitions Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} PRIMED +FailPrimeACDefinitionFrom + [Documentation] Prime automation composition definition Migration From. + SetParticipantSimFail + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/ACPriming.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} data=${postjson} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailedPriming ${compositionFromId} + PrimeACDefinitionFrom [Documentation] Prime automation composition definition Migration From. + SetParticipantSimSuccess ${auth}= Create List runtimeUser zb!XztG34 Log Creating session http://${POLICY_RUNTIME_ACM_IP} ${postjson}= Get file ${CURDIR}/data/ACPriming.json @@ -217,8 +230,22 @@ QueryPolicyTypes Should Be Equal As Strings ${resp.status_code} 200 List Should Contain Value ${resp.json()['policy_types']} onap.policies.native.Apex +FailDeployAutomationCompositionMigration + [Documentation] Fail Deploy automation composition. + SetParticipantSimFail + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailDeploy ${compositionFromId} ${instanceMigrationId} + DeployAutomationCompositionMigration [Documentation] Deploy automation composition. + SetParticipantSimSuccess ${auth}= Create List runtimeUser zb!XztG34 Log Creating session http://${POLICY_RUNTIME_ACM_IP} ${postjson}= Get file ${CURDIR}/data/DeployAC.json @@ -227,7 +254,7 @@ DeployAutomationCompositionMigration ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} Log Received response from runtime acm ${resp.text} Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED SendOutPropertiesToRuntime [Documentation] Send Out Properties To Runtime @@ -274,7 +301,7 @@ AutomationCompositionMigrationTo ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} Log Received response from runtime acm ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} DEPLOYED VerifyPropertiesUpdated ${compositionToId} ${instanceMigrationId} TextForMigration VerifyParticipantSim ${instanceMigrationId} TextForMigration @@ -290,8 +317,22 @@ UnDeployAutomationComposition Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} UNDEPLOYED +FailUnDeployAutomationCompositionMigrationTo + [Documentation] Fail UnDeploy automation composition migrated. + SetParticipantSimFail + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/UndeployAC.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailDeploy ${compositionToId} ${instanceMigrationId} + UnDeployAutomationCompositionMigrationTo [Documentation] UnDeploy automation composition migrated. + SetParticipantSimSuccess ${auth}= Create List runtimeUser zb!XztG34 Log Creating session http://${POLICY_RUNTIME_ACM_IP} ${postjson}= Get file ${CURDIR}/data/UndeployAC.json @@ -300,7 +341,7 @@ UnDeployAutomationCompositionMigrationTo ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} data=${postjson} headers=${headers} Log Received response from runtime acm ${resp.text} Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED + Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED UnInstantiateAutomationComposition [Documentation] Delete automation composition instance. @@ -313,8 +354,21 @@ UnInstantiateAutomationComposition Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 1 min 5 sec VerifyUninstantiated ${compositionId} +FailUnInstantiateAutomationCompositionMigrationTo + [Documentation] Fail Delete automation composition instance migrated. + SetParticipantSimFail + ${auth}= Create List runtimeUser zb!XztG34 + 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/${compositionToId}/instances/${instanceMigrationId} headers=${headers} + Log Received response from runtime acm ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailDeploy ${compositionToId} ${instanceMigrationId} + UnInstantiateAutomationCompositionMigrationTo [Documentation] Delete automation composition instance migrated. + SetParticipantSimSuccess ${auth}= Create List runtimeUser zb!XztG34 Log Creating session http://${POLICY_RUNTIME_ACM_IP} ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} @@ -335,8 +389,21 @@ DePrimeACDefinitions Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionId} COMMISSIONED +FailDePrimeACDefinitionsFrom + [Documentation] Fail DePrime automation composition definition migration From. + SetParticipantSimFail + ${auth}= Create List runtimeUser zb!XztG34 + Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${postjson}= Get file ${CURDIR}/data/ACDepriming.json + ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId} data=${postjson} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyFailedPriming ${compositionFromId} + DePrimeACDefinitionsFrom [Documentation] DePrime automation composition definition migration From. + SetParticipantSimSuccess ${auth}= Create List runtimeUser zb!XztG34 Log Creating session http://${POLICY_RUNTIME_ACM_IP} ${postjson}= Get file ${CURDIR}/data/ACDepriming.json @@ -419,8 +486,20 @@ VerifyPriming ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId} headers=${headers} 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} +VerifyFailedPriming + [Arguments] ${theCompositionId} + [Documentation] Verify the AC definitions are primed to the participants + ${auth}= Create List runtimeUser zb!XztG34 + 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}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} FAILED + VerifyDeployStatus [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} [Documentation] Verify the Deploy status of automation composition. @@ -430,8 +509,20 @@ VerifyDeployStatus ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} headers=${headers} 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} +VerifyFailDeploy + [Arguments] ${theCompositionId} ${theInstanceId} + [Documentation] Verify the Deploy status of automation composition. + ${auth}= Create List runtimeUser zb!XztG34 + 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}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + Run Keyword If ${resp.status_code}==200 Should Be Equal As Strings ${resp.json()['stateChangeResult']} FAILED + VerifyPropertiesUpdated [Arguments] ${theCompositionId} ${theInstanceId} ${textToFind} [Documentation] Verify the Deploy status of automation composition. @@ -468,4 +559,24 @@ VerifyUninstantiated 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}= Create List participantUser zb!XztG34 + Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json + ${session}= Create Session policy http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/simparticipant/v2/parameters data=${postjson} headers=${headers} + Log Received response from participant sim ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 +SetParticipantSimSuccess + [Documentation] Set Participant Simulator Success. + ${auth}= Create List participantUser zb!XztG34 + Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json + ${session}= Create Session policy http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/policy/simparticipant/v2/parameters data=${postjson} headers=${headers} + Log Received response from participant sim ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 -- cgit 1.2.3-korg