diff options
Diffstat (limited to 'csit/resources/tests')
34 files changed, 825 insertions, 527 deletions
diff --git a/csit/resources/tests/apex-pdp-common.robot b/csit/resources/tests/apex-pdp-common.robot index e6458318..81924604 100644 --- a/csit/resources/tests/apex-pdp-common.robot +++ b/csit/resources/tests/apex-pdp-common.robot @@ -4,7 +4,7 @@ Library RequestsLibrary Library OperatingSystem Library json Library Process -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** @@ -31,14 +31,6 @@ CheckLogMessage ${result}= CheckKafkaTopic ${topic} ${status} Should Contain ${result} ${expectedMsg} -ValidatePolicyExecution - [Arguments] ${url} ${executionTime} - [Documentation] Check that policy execution under X milliseconds - ${resp}= QueryPrometheus ${url} - ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} - ${actualTime}= Set Variable ${rawNumber * ${1000}} - Should Be True ${actualTime} <= ${executionTime} - ValidateEventExecution [Arguments] ${eventStartTime} ${eventEndTime} ${eventsNo} [Documentation] Check that X amount of events were exeuted per second diff --git a/csit/resources/tests/apex-pdp-test.robot b/csit/resources/tests/apex-pdp-test.robot index 42be4415..3989ec46 100644 --- a/csit/resources/tests/apex-pdp-test.robot +++ b/csit/resources/tests/apex-pdp-test.robot @@ -4,8 +4,8 @@ Library RequestsLibrary Library OperatingSystem Library json Library Process -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** @@ -20,7 +20,7 @@ ExecuteApexSampleDomainPolicy # [Tags] docker Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -28,7 +28,7 @@ ExecuteApexSampleDomainPolicy ExecuteApexTestPnfPolicy Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -37,7 +37,7 @@ ExecuteApexTestPnfPolicy #ExecuteApexTestVnfPolicy # Set Test Variable ${policyName} onap.policies.apex.vnf.Test # ${postjson}= Get File ${CURDIR}/data/${policyName}.json -# CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 +# CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 # DeployPolicy # Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex # GetTopic apex-cl-mgt @@ -46,9 +46,9 @@ ExecuteApexTestPnfPolicy ExecuteApexTestPnfPolicyWithMetadataSet Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 diff --git a/csit/resources/tests/apex-slas-10.robot b/csit/resources/tests/apex-slas-10.robot index 53779774..2a56a665 100644 --- a/csit/resources/tests/apex-slas-10.robot +++ b/csit/resources/tests/apex-slas-10.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -20,9 +20,9 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 100 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 @@ -36,7 +36,7 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 2 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 ${data}= Get Binary File ${CURDIR}/data/event.json @@ -52,7 +52,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt diff --git a/csit/resources/tests/apex-slas-3.robot b/csit/resources/tests/apex-slas-3.robot index 048e2e76..1ceb9b77 100644 --- a/csit/resources/tests/apex-slas-3.robot +++ b/csit/resources/tests/apex-slas-3.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -20,7 +20,7 @@ ValidatePolicyExecutionAndEventRateLowComplexity [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 30 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -34,9 +34,9 @@ ValidatePolicyExecutionAndEventRateHighComplexity [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.6 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 @@ -50,7 +50,7 @@ ValidatePolicyExecutionAndEventRateModerateComplexity [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 3 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy #Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine Create Session apexSession http://${APEX_EVENTS_IP} max_retries=1 diff --git a/csit/resources/tests/apex-slas.robot b/csit/resources/tests/apex-slas.robot index 69b24521..760bc348 100644 --- a/csit/resources/tests/apex-slas.robot +++ b/csit/resources/tests/apex-slas.robot @@ -5,8 +5,8 @@ Library OperatingSystem Library DateTime Library Process Library json -Resource ${CURDIR}/common-library.robot -Resource ${CURDIR}/apex-pdp-common.robot +Resource common-library.robot +Resource apex-pdp-common.robot *** Test Cases *** Healthcheck @@ -17,10 +17,10 @@ Healthcheck Set Suite Variable ${pdpName} ${resp.json()['name']} ValidatePolicyExecutionAndEventRateLowComplexity - [Documentation] Validate that a moderate complexity policity can be executed in less than 100ms and minimum 10 events triggered per second + [Documentation] Validate that a moderate complexity policy can be executed in less than 100ms and minimum 10 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt @@ -31,10 +31,10 @@ ValidatePolicyExecutionAndEventRateLowComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 10 ValidatePolicyExecutionAndEventRateModerateComplexity - [Documentation] Validate that a low complexity policity can be executed in less than 1000ms and minimum 1 events triggered per second + [Documentation] Validate that a low complexity policy can be executed in less than 1000ms and minimum 1 events triggered per second Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 DeployPolicy ${eventStartTime}= Get Current Date Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine @@ -42,12 +42,12 @@ ValidatePolicyExecutionAndEventRateModerateComplexity ValidateEventExecution ${eventStartTime} ${eventEndTime} 1 ValidatePolicyExecutionAndEventRateHighComplexity - [Documentation] Validate that a high complexity policity can be executed in less than 5000ms and minimum 0.2 events triggered per second + [Documentation] Validate that a high complexity policy can be executed in less than 5000ms and minimum 0.2 events triggered per second Set Test Variable ${policyName} onap.policies.apex.pnf.metadataSet.Test ${postjson}= Get File ${CURDIR}/data/${policyName}.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} ${policyName} 1.0.0 ${postjson}= Get File ${CURDIR}/data/onap.pnf.metadataSet.Test.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 1 DeployPolicy Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex GetKafkaTopic apex-cl-mgt2 diff --git a/csit/resources/tests/api-slas.robot b/csit/resources/tests/api-slas.robot index 1c549aa9..165f14a3 100644 --- a/csit/resources/tests/api-slas.robot +++ b/csit/resources/tests/api-slas.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** ValidateResponseTimeForApi diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot index bce58231..29c2fba4 100644 --- a/csit/resources/tests/api-test.robot +++ b/csit/resources/tests/api-test.robot @@ -3,121 +3,121 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** Healthcheck - [Documentation] Verify policy api health check - ${resp}= GetReq /policy/api/v1/healthcheck - Should Be Equal As Strings ${resp.json()['code']} 200 - Should Be Equal As Strings ${resp.json()['healthy']} True - Should Be Equal As Strings ${resp.json()['message']} alive + [Documentation] Verify policy api health check + ${resp}= GetReq /policy/api/v1/healthcheck + Should Be Equal As Strings ${resp.json()['code']} 200 + Should Be Equal As Strings ${resp.json()['healthy']} True + Should Be Equal As Strings ${resp.json()['message']} alive RetrievePolicyTypes - [Documentation] Retrieve all policy types - FetchPolicyTypes /policy/api/v1/policytypes 37 + [Documentation] Retrieve all policy types + FetchPolicyTypes /policy/api/v1/policytypes 37 CreateTCAPolicyTypeV1 - [Documentation] Create an existing policy type with modification and keeping the same version should result in error. - CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null + [Documentation] Create an existing policy type with modification and keeping the same version should result in error. + CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null CreateTCAPolicyTypeV2 - [Documentation] Create an existing policy type with modification and keeping the same version should result in error. - CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null + [Documentation] Create an existing policy type with modification and keeping the same version should result in error. + CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null CreateTCAPolicyTypeV3 - [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' - CreatePolicyType /policy/api/v1/policytypes 200 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 + [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' + CreatePolicyType /policy/api/v1/policytypes 201 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0 RetrieveMonitoringPolicyTypes - [Documentation] Retrieve all monitoring related policy types - FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2 + [Documentation] Retrieve all monitoring related policy types + FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2 CreateNewMonitoringPolicyV1 - [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies ${postjson} onap.restart.tca 1.0.0 CreateNewMonitoringPolicyV1Again - [Documentation] Create an existing policy with modification and keeping the same version should result in error. - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json - CreatePolicy /policy/api/v1/policies 406 ${postjson} null null + [Documentation] Create an existing policy with modification and keeping the same version should result in error. + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json + CreatePolicy /policy/api/v1/policies 406 ${postjson} null null CreateNewMonitoringPolicyV2 - [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api - ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json - CreatePolicy /policy/api/v1/policies 200 ${postjson} onap.restart.tca 2.0.0 + [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json + CreatePolicySuccessfully /policy/api/v1/policies ${postjson} onap.restart.tca 2.0.0 CreateNodeTemplates - [Documentation] Create node templates in database using specific api - ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + [Documentation] Create node templates in database using specific api + ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 RetrievePoliciesOfType - [Documentation] Retrieve all policies belonging to a specific Policy Type - FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2 + [Documentation] Retrieve all policies belonging to a specific Policy Type + FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2 RetrieveAllPolicies - [Documentation] Retrieve all policies - FetchPolicies /policy/api/v1/policies 3 + [Documentation] Retrieve all policies + FetchPolicies /policy/api/v1/policies 3 RetrieveSpecificPolicy - [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api - FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca + [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api + FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca RetrieveAllNodeTemplates - [Documentation] Retrieve all node templates - FetchNodeTemplates /policy/api/v1/nodetemplates 3 + [Documentation] Retrieve all node templates + FetchNodeTemplates /policy/api/v1/nodetemplates 3 RetrieveSpecificNodeTemplate - [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api - FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc + [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api + FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc DeleteSpecificNodeTemplate - [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api - DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200 - DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404 + [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api + DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200 + DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404 DeleteSpecificPolicy - [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api - DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200 - DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404 + [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api + DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200 + DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404 DeleteSpecificPolicyV2 - [Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404 + [Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404 DeleteSpecificPolicyTypeV1 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404 DeleteSpecificPolicyTypeV2 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404 DeleteSpecificPolicyTypeV3 - [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200 - DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404 + [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0' + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200 + DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404 Metrics [Documentation] Verify policy-api is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_API_IP} ${auth} /policy/api/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}",} 1.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}",} 3.0 - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}",} 1.0 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="POST",outcome="SUCCESS",status="201",uri="/policytypes"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policies/{policyId}/versions/{policyVersion}"} 1 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{versionId}"} 3 + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="DELETE",outcome="SUCCESS",status="200",uri="/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}"} 1 Should Contain ${resp.text} http_server_requests_seconds_sum Should Contain ${resp.text} http_server_requests_seconds_max Should Contain ${resp.text} spring_data_repository_invocations_seconds_count @@ -128,53 +128,52 @@ Metrics *** Keywords *** GetReq - [Arguments] ${url} - ${auth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} - RETURN ${resp} + [Arguments] ${url} + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} + RETURN ${resp} DeleteReq - [Arguments] ${url} ${expectedstatus} - ${auth}= PolicyAdminAuth - ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth} - RETURN ${resp} + [Arguments] ${url} ${expectedstatus} + ${auth}= PolicyAdminAuth + ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth} + RETURN ${resp} CreatePolicyType - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion} - [Documentation] Create the specific policy type - ${postjson}= Get file ${CURDIR}/data/${jsonfile} - ${auth}= PolicyAdminAuth - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth} - Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename} - Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion} + [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion} + [Documentation] Create the specific policy type + ${postjson}= Get file ${CURDIR}/data/${jsonfile} + ${auth}= PolicyAdminAuth + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth} + Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename} + Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion} FetchPolicyTypes - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all policy types - ${resp}= GetReq ${url} - Length Should Be ${resp.json()['policy_types']} ${expectedLength} + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all policy types + ${resp}= GetReq ${url} + Length Should Be ${resp.json()['policy_types']} ${expectedLength} FetchPolicy - [Arguments] ${url} ${keyword} - [Documentation] Fetch the specific policy - ${resp}= GetReq ${url} - Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword} + [Arguments] ${url} ${keyword} + [Documentation] Fetch the specific policy + ${resp}= GetReq ${url} + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword} FetchPolicies - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all policies - ${resp}= GetReq ${url} - Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength} - + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all policies + ${resp}= GetReq ${url} + Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength} FetchNodeTemplates - [Arguments] ${url} ${expectedLength} - [Documentation] Fetch all node templates - ${resp}= GetReq ${url} - Length Should Be ${resp.json()} ${expectedLength} + [Arguments] ${url} ${expectedLength} + [Documentation] Fetch all node templates + ${resp}= GetReq ${url} + Length Should Be ${resp.json()} ${expectedLength} FetchNodeTemplate - [Arguments] ${url} ${keyword} - [Documentation] Fetch the specific node template - ${resp}= GetReq ${url} - Dictionary Should Contain Value ${resp.json()[0]} ${keyword} + [Arguments] ${url} ${keyword} + [Documentation] Fetch the specific node template + ${resp}= GetReq ${url} + Dictionary Should Contain Value ${resp.json()[0]} ${keyword} diff --git a/csit/resources/tests/clamp-slas.robot b/csit/resources/tests/clamp-slas.robot new file mode 100644 index 00000000..18a83d7a --- /dev/null +++ b/csit/resources/tests/clamp-slas.robot @@ -0,0 +1,57 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Resource common-library.robot + +*** Keywords *** +ValidateResponseTimeForClamp + [Arguments] ${uri} ${method} + [Documentation] Check if uri response is under the 1500ms required time for clamp metrics + ValidateResponseTime acm-metrics ${uri} ${method} 1500 + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidateResponseTimeForHealthcheck + [Documentation] Validate component healthcheck response time + ValidateResponseTimeForClamp /health GET + +ValidateResponseTimeQueryAcDefinition + [Documentation] Validate query AC Definitions response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId} GET + +ValidateResponseTimeQueryAcInstance + [Documentation] Validate query AC instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} GET + +ValidateResponseTimeQueryAcInstances + [Documentation] Validate query all AC instances response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances GET + +ValidateResponseTimeStateChange + [Documentation] Validate AC instance StateChange response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} PUT + +ValidateResponseTimeCallParticipants + [Documentation] Validate call AC participants response time + ValidateResponseTimeForClamp /v2/participants PUT + +ValidateResponseTimeCommissioning + [Documentation] Validate commission AC Definitions response time + ValidateResponseTimeForClamp /v2/compositions POST + +ValidateResponseTimeInstantiation + [Documentation] Validate create AC Instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances POST + +ValidateResponseTimeDeleteInstance + [Documentation] Validate delete AC Instance response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId}/instances/{instanceId} DELETE + +ValidateResponseTimeDeleteDefinition + [Documentation] Validate delete AC Definition response time + ValidateResponseTimeForClamp /v2/compositions/{compositionId} DELETE
\ No newline at end of file diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot index a585bc97..e0b1c0f1 100644 --- a/csit/resources/tests/common-library.robot +++ b/csit/resources/tests/common-library.robot @@ -3,6 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json +Library Process *** Keywords *** @@ -50,15 +51,21 @@ CreatePolicy [Documentation] Create the specific policy ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin} - Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} - Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} + +CreatePolicySuccessfully + [Arguments] ${url} ${postjson} ${policyname} ${policyversion} + [Documentation] Create the specific policy + ${policyadmin}= PolicyAdminAuth + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} 201 ${postjson} null ${policyadmin} + Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} + Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} CreateNodeTemplate [Arguments] ${url} ${expectedstatus} ${postjson} ${nodeTemplateListLength} [Documentation] Create the node templates ${policyadmin}= PolicyAdminAuth ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} - Run Keyword If ${expectedstatus}==200 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} + Run Keyword If ${expectedstatus}==201 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} QueryPdpGroups @@ -123,28 +130,6 @@ VerifyTracingWorks Log Received response from jaeger ${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 send 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} - QueryPrometheus [Arguments] ${query} ${params}= Create Dictionary query=${query} @@ -164,9 +149,19 @@ ValidateResponseTime CheckKafkaTopic [Arguments] ${topic} ${expected_status} ${resp}= Run Process ${CURDIR}/kafka_consumer.py ${topic} 60 ${expected_status} ${KAFKA_IP} + Log ${resp.stdout} Should Contain ${resp.stdout} ${expected_status} RETURN ${resp.stdout} GetKafkaTopic [Arguments] ${topic} - ${resp}= Run Process ${CURDIR}/make_topics.py ${topic} ${KAFKA_IP}
\ No newline at end of file + ${resp}= Run Process ${CURDIR}/make_topics.py ${topic} ${KAFKA_IP} + Log ${resp.stdout} + +ValidatePolicyExecution + [Arguments] ${url} ${executionTime} + [Documentation] Check that policy execution under X milliseconds + ${resp}= QueryPrometheus ${url} + ${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]} + ${actualTime}= Set Variable ${rawNumber * ${1000}} + Should Be True ${actualTime} <= ${executionTime}
\ No newline at end of file diff --git a/csit/resources/tests/data/PrepareAC.json b/csit/resources/tests/data/PrepareAC.json new file mode 100644 index 00000000..bc3a3c0a --- /dev/null +++ b/csit/resources/tests/data/PrepareAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "PREPARE" +} diff --git a/csit/resources/tests/data/ReviewAC.json b/csit/resources/tests/data/ReviewAC.json new file mode 100644 index 00000000..e4d74348 --- /dev/null +++ b/csit/resources/tests/data/ReviewAC.json @@ -0,0 +1,3 @@ +{ + "subOrder": "REVIEW" +} diff --git a/csit/resources/tests/data/SettingSimPropertiesFail.json b/csit/resources/tests/data/SettingSimPropertiesFail.json index 0c6402bd..0e0de30e 100644 --- a/csit/resources/tests/data/SettingSimPropertiesFail.json +++ b/csit/resources/tests/data/SettingSimPropertiesFail.json @@ -6,6 +6,9 @@ "deleteSuccess": false, "updateSuccess": false, "migrateSuccess": false, + "migratePrecheck": false, + "prepare": false, + "review": false, "primeSuccess": false, "deprimeSuccess": false, "deployTimerMs": 100, @@ -14,6 +17,9 @@ "unlockTimerMs": 100, "updateTimerMs": 100, "migrateTimerMs": 100, + "migratePrecheckTimerMs": 100, + "prepareTimerMs": 100, + "reviewTimerMs": 100, "deleteTimerMs": 100, "primeTimerMs": 100, "deprimeTimerMs": 100 diff --git a/csit/resources/tests/data/SettingSimPropertiesSuccess.json b/csit/resources/tests/data/SettingSimPropertiesSuccess.json index e0673322..14fbe01a 100644 --- a/csit/resources/tests/data/SettingSimPropertiesSuccess.json +++ b/csit/resources/tests/data/SettingSimPropertiesSuccess.json @@ -6,6 +6,9 @@ "deleteSuccess": true, "updateSuccess": true, "migrateSuccess": true, + "migratePrecheck": true, + "prepare": true, + "review": true, "primeSuccess": true, "deprimeSuccess": true, "deployTimerMs": 100, @@ -14,6 +17,9 @@ "unlockTimerMs": 100, "updateTimerMs": 100, "migrateTimerMs": 100, + "migratePrecheckTimerMs": 100, + "prepareTimerMs": 100, + "reviewTimerMs": 100, "deleteTimerMs": 100, "primeTimerMs": 100, "deprimeTimerMs": 100 diff --git a/csit/resources/tests/data/SettingSimPropertiesTimeout.json b/csit/resources/tests/data/SettingSimPropertiesTimeout.json new file mode 100644 index 00000000..a63c3044 --- /dev/null +++ b/csit/resources/tests/data/SettingSimPropertiesTimeout.json @@ -0,0 +1,26 @@ +{ + "deploySuccess": true, + "undeploySuccess": true, + "lockSuccess": true, + "unlockSuccess": true, + "deleteSuccess": true, + "updateSuccess": true, + "migrateSuccess": true, + "migratePrecheck": true, + "prepare": true, + "review": true, + "primeSuccess": true, + "deprimeSuccess": true, + "deployTimerMs": 260000, + "undeployTimerMs": 260000, + "lockTimerMs": 260000, + "unlockTimerMs": 260000, + "updateTimerMs": 260000, + "migrateTimerMs": 260000, + "migratePrecheckTimerMs": 260000, + "prepareTimerMs": 260000, + "reviewTimerMs": 260000, + "deleteTimerMs": 260000, + "primeTimerMs": 260000, + "deprimeTimerMs": 260000 +} diff --git a/csit/resources/tests/data/ac-definition-migration-from.yaml b/csit/resources/tests/data/ac-definition-migration-from.yaml index 273cfec3..f11b174c 100644 --- a/csit/resources/tests/data/ac-definition-migration-from.yaml +++ b/csit/resources/tests/data/ac-definition-migration-from.yaml @@ -57,6 +57,11 @@ node_types: first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously + stage: + type: list + description: A list indicating the stages in which this automation composition element will be started, the + first stage is zero. Automation Composition Elements are started in their stage order. + Automation Composition Elements with the same stage are started simultaneously. org.onap.policy.clamp.acm.AutomationComposition: version: 1.0.1 @@ -118,6 +123,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.3 @@ -127,6 +133,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,1] onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement: version: 1.2.3 @@ -136,6 +143,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.3 diff --git a/csit/resources/tests/data/ac-definition-migration-to.yaml b/csit/resources/tests/data/ac-definition-migration-to.yaml index efc550b0..179fe11c 100644 --- a/csit/resources/tests/data/ac-definition-migration-to.yaml +++ b/csit/resources/tests/data/ac-definition-migration-to.yaml @@ -57,6 +57,11 @@ node_types: first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are started and stopped simultaneously + stage: + type: list + description: A list indicating the stages in which this automation composition element will be started, the + first stage is zero. Automation Composition Elements are started in their stage order. + Automation Composition Elements with the same stage are started simultaneously. org.onap.policy.clamp.acm.AutomationComposition: version: 1.0.1 @@ -118,6 +123,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [1,2] onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement: version: 1.2.4 @@ -127,8 +133,9 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,1] - onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement: + onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement: version: 1.2.4 type: org.onap.policy.clamp.acm.SimAutomationCompositionElement type_version: 1.0.0 @@ -136,6 +143,7 @@ topology_template: properties: provider: ONAP startPhase: 0 + stage: [0,2] onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.4 @@ -149,5 +157,5 @@ topology_template: version: 1.2.4 - name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement version: 1.2.4 - - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement + - name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement version: 1.2.4 diff --git a/csit/resources/tests/data/ac-instance-migration-to.yaml b/csit/resources/tests/data/ac-instance-migration-to.yaml index 65b684a3..68a31a59 100644 --- a/csit/resources/tests/data/ac-instance-migration-to.yaml +++ b/csit/resources/tests/data/ac-instance-migration-to.yaml @@ -47,10 +47,10 @@ elements: - configurationEntityId: myParameterToUpdate: TEXTPLACEHOLDER - 709c62b3-8918-41b9-a747-d21eb79c6c36: - id: 709c62b3-8918-41b9-a747-d21eb79c6c36 + 709c62b3-8918-41b9-a747-d21eb79c6c37: + id: 709c62b3-8918-41b9-a747-d21eb79c6c37 definition: - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement + name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement version: 1.2.4 description: Sink Automation Composition Element for the Demo properties: diff --git a/csit/resources/tests/data/ac-instance-precheck-migration.yaml b/csit/resources/tests/data/ac-instance-precheck-migration.yaml new file mode 100644 index 00000000..3380c157 --- /dev/null +++ b/csit/resources/tests/data/ac-instance-precheck-migration.yaml @@ -0,0 +1,60 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2024 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the License); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +name: Instance-Migration-To +version: 1.0.1 +compositionId: COMPOSITIONIDPLACEHOLDER +instanceId: INSTACEIDPLACEHOLDER +compositionTargetId: COMPOSITIONTARGETIDPLACEHOLDER +precheck: true +description: Demo automation composition instance 0 +elements: + + 709c62b3-8918-41b9-a747-d21eb79c6c34: + id: 709c62b3-8918-41b9-a747-d21eb79c6c34 + definition: + name: onap.policy.clamp.ac.element.Sim_StarterAutomationCompositionElement + version: 1.2.4 + description: Starter Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30800 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration + + 709c62b3-8918-41b9-a747-d21eb79c6c35: + id: 709c62b3-8918-41b9-a747-d21eb79c6c35 + definition: + name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement + version: 1.2.4 + description: Bridge Automation Composition Element for the Demo + properties: + baseUrl: http://10.101.0.249:30801 + configurationEntities: + - configurationEntityId: + myParameterToUpdate: TEXTPLACEHOLDER + + 709c62b3-8918-41b9-a747-d21eb79c6c37: + id: 709c62b3-8918-41b9-a747-d21eb79c6c37 + definition: + name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement + version: 1.2.4 + description: Sink Automation Composition Element for the Demo + properties: + configurationEntities: + - configurationEntityId: + myParameterToUpdate: text updated for migration diff --git a/csit/resources/tests/data/deploy.drools.policies.json b/csit/resources/tests/data/drools/deploy.drools.policies.json index 24c90d0d..24c90d0d 100644 --- a/csit/resources/tests/data/deploy.drools.policies.json +++ b/csit/resources/tests/data/drools/deploy.drools.policies.json diff --git a/csit/resources/tests/data/deploy.xacml.policies.json b/csit/resources/tests/data/drools/deploy.xacml.policies.json index 46da9021..46da9021 100644 --- a/csit/resources/tests/data/deploy.xacml.policies.json +++ b/csit/resources/tests/data/drools/deploy.xacml.policies.json diff --git a/csit/resources/tests/data/vcpeOnset.json b/csit/resources/tests/data/drools/vcpeOnset.json index 7dd9d5a0..7dd9d5a0 100644 --- a/csit/resources/tests/data/vcpeOnset.json +++ b/csit/resources/tests/data/drools/vcpeOnset.json diff --git a/csit/resources/tests/data/vdnsOnset.json b/csit/resources/tests/data/drools/vdnsOnset.json index 13f69095..13f69095 100644 --- a/csit/resources/tests/data/vdnsOnset.json +++ b/csit/resources/tests/data/drools/vdnsOnset.json diff --git a/csit/resources/tests/data/vfwOnset.json b/csit/resources/tests/data/drools/vfwOnset.json index 7782867a..7782867a 100644 --- a/csit/resources/tests/data/vfwOnset.json +++ b/csit/resources/tests/data/drools/vfwOnset.json diff --git a/csit/resources/tests/distribution-test.robot b/csit/resources/tests/distribution-test.robot index b8b49248..d5fc10e1 100644 --- a/csit/resources/tests/distribution-test.robot +++ b/csit/resources/tests/distribution-test.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** diff --git a/csit/resources/tests/drools-applications-slas.robot b/csit/resources/tests/drools-applications-slas.robot new file mode 100644 index 00000000..a153925d --- /dev/null +++ b/csit/resources/tests/drools-applications-slas.robot @@ -0,0 +1,14 @@ +*** Settings *** +Library OperatingSystem +Resource common-library.robot + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidatePolicyExecutionTimes + [Documentation] Validate policy execution times using prometheus metrics + ValidatePolicyExecution pdpd_policy_executions_latency_seconds_count{controller="usecases",controlloop="ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",policy="operational.scaleout:1.0.0",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 1000 + ValidatePolicyExecution pdpd_policy_deployments_total{state="ACTIVE",operation="deploy",status="SUCCESS", instance="policy-drools-apps:9696", job="drools-apps-metrics"} 3000 + diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot index edbc1df6..4ceb288b 100644 --- a/csit/resources/tests/drools-applications-test.robot +++ b/csit/resources/tests/drools-applications-test.robot @@ -10,144 +10,188 @@ Resource common-library.robot *** Test Cases *** Alive [Documentation] Runs Policy PDP Alive Check - ${resp}= PeformGetRequest /policy/pdp/engine ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine ${DROOLS_IP_2} 200 Should Be Equal As Strings ${resp.json()['alive']} True Metrics [Documentation] Verify drools-apps is exporting metrics - ${resp}= PeformGetRequest /metrics ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /metrics ${DROOLS_IP_2} 200 Should Contain ${resp.text} jvm_threads_current Healthcheck [Documentation] Runs Policy PDP-D Health check - ${resp}= PeformGetRequest /healthcheck ${DROOLS_IP} 200 + ${resp}= PerformGetRequestOnDrools /healthcheck ${DROOLS_IP} 200 Should Be Equal As Strings ${resp.json()['healthy']} True -#Controller -# [Documentation] Checks controller is up -# Wait Until Keyword Succeeds 2 min 15 sec VerifyController +Controller + [Documentation] Checks controller is up + Wait Until Keyword Succeeds 2 min 15 sec VerifyController -MakeTopics - [Documentation] Creates the Policy topics +AssertTopicsOnKafkaClient + [Documentation] Verify that the Policy topics policy-pdp-pap and policy-cl-mgt are available on kafka GetKafkaTopic policy-pdp-pap GetKafkaTopic policy-cl-mgt +CheckTopics + [Documentation] List the topics registered with TopicManager + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/topics ${DROOLS_IP_2} 200 + Should Contain ${resp.text} policy-cl-mgt + Should Contain ${resp.text} policy-pdp-pap + Should Contain ${resp.text} dcae_topic + +CheckEngineFeatures + [Documentation] List the features available in the drools engine + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/features ${DROOLS_IP_2} 200 + Should Contain ${resp.text} "org.onap.policy.drools.lifecycle.LifecycleFeature" + Should Contain ${resp.text} "org.onap.policy.drools.apps.controlloop.feature.usecases.UsecasesFeature" + Should Contain ${resp.text} "org.onap.policy.drools.healthcheck.HealthCheckFeature" + +CheckPolicyTypes + [Documentation] Check if the needed Policy types are available + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/policytypes 200 null ${auth} + Should Contain ${resp.text} onap.policies.monitoring.tcagen2 + Should Contain ${resp.text} onap.policies.controlloop.operational.common.Drools + CreateVcpeXacmlPolicy [Documentation] Create VCPE Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.monitoring.input.tosca.yaml yaml CreateVcpeDroolsPolicy [Documentation] Create VCPE Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vCPE.policy.operational.input.tosca.yaml yaml CreateVdnsXacmlPolicy [Documentation] Create VDNS Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vDNS.policy.monitoring.input.tosca.yaml yaml CreateVdnsDroolsPolicy [Documentation] Create VDNS Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vDNS.policy.operational.input.tosca.json json CreateVfwXacmlPolicy [Documentation] Create VFW Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + CreatePolicy vFirewall.policy.monitoring.input.tosca.yaml yaml CreateVfwDroolsPolicy [Documentation] Create VFW Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.operational.input.tosca.json ${DATA} json 200 + CreatePolicy vFirewall.policy.operational.input.tosca.json json + +CheckCreatedPolicies + [Documentation] Verify that all created policies are available for deployment + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/policies 200 null ${auth} + #vcpe xacml + Should Contain ${resp.text} onap.restart.tca + #vcpe drools + Should Contain ${resp.text} operational.restart + #vnds xacml + Should Contain ${resp.text} onap.scaleout.tca + #vnds drools + Should Contain ${resp.text} operational.scaleout + #vfirewall xacml + Should Contain ${resp.text} onap.vfirewall.tca + #vfirewall drools + Should Contain ${resp.text} operational.modifyconfig DeployXacmlPolicies [Documentation] Deploys the Policies to Xacml - PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.xacml.policies.json ${CURDIR}/data json 202 + DeployPolicy deploy.xacml.policies.json Sleep 5s - ${result}= CheckKafkaTopic policy-notification onap.vfirewall.tca - Should Contain ${result} deployed-policies - Should Contain ${result} onap.scaleout.tca - Should Contain ${result} onap.restart.tca - -# Uncomment the drools policy deployment once the drools pdp code is fixed -#DeployDroolsPolicies -# [Documentation] Deploys the Policies to Drools -# PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.drools.policies.json ${CURDIR}/data json 202 -# Sleep 5s -# ${result}= CheckKafkaTopic policy-notification operational.modifyconfig -# Should Contain ${result} deployed-policies -# Should Contain ${result} operational.scaleout -# Should Contain ${result} operational.restart -# -#VcpeExecute -# [Documentation] Executes VCPE Policy -# OnSet ${CURDIR}/data/vcpeOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} Sending guard query for APPC Restart -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} Guard result for APPC Restart is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} actor=APPC,operation=Restart -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} actor=APPC,operation=Restart -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e -# Should Contain ${result} APPC -# Should Contain ${result} Restart + @{otherMessages}= Create List deployed-policies onap.scaleout.tca onap.restart.tca + AssertMessageFromTopic policy-notification onap.vfirewall.tca ${otherMessages} + +VerifyDeployedXacmlPolicies + [Documentation] Verify if xacml policies were deployed correctly + ${resp}= GetDeployedPolicies + @{policies}= Create List onap.vfirewall.tca onap.scaleout.tca onap.restart.tca + FOR ${policy} IN @{policies} + Should Contain ${resp.text} ${policy} + END + +DeployDroolsPolicies + [Documentation] Deploys the Policies to Drools + DeployPolicy deploy.drools.policies.json + Sleep 5s + @{otherMessages}= Create List deployed-policies operational.scaleout operational.restart + AssertMessageFromTopic policy-notification operational.modifyconfig ${otherMessages} + +VerifyDeployedDroolsPolicies + [Documentation] Verify if drools policies were deployed correctly + ${resp}= GetDeployedPolicies + @{policies}= Create List operational.modifyconfig operational.scaleout operational.restart + FOR ${policy} IN @{policies} + Should Contain ${resp.text} ${policy} + END + +VcpeExecute + [Documentation] Executes VCPE Policy + OnSet ${CURDIR}/data/drools/vcpeOnset.json + ${policyExecuted}= Set Variable ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for APPC Restart ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for APPC Restart is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=APPC,operation=Restart ${otherMessages} + +# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=Restart +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} # -#VdnsExecute -# [Documentation] Executes VDNS Policy -# OnSet ${CURDIR}/data/vdnsOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} Sending guard query for SO VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} Guard result for SO VF Module Create is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} actor=SO,operation=VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} actor=SO,operation=VF Module Create -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 -# Should Contain ${result} SO -# Should Contain ${result} VF Module Create +# @{otherMessages}= Create List FINAL: SUCCESS APPC Restart +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + +VdnsExecute + [Documentation] Executes VDNS Policy + OnSet ${CURDIR}/data/drools/vdnsOnset.json + ${policyExecuted}= Set Variable ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for SO VF Module Create ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for SO VF Module Create is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=SO,operation=VF Module Create ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION: SUCCESS + AssertMessageFromTopic policy-cl-mgt actor=SO,operation=VF Module Create ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} FINAL: SUCCESS SO + AssertMessageFromTopic policy-cl-mgt VF Module Create ${otherMessages} + +VfwExecute + [Documentation] Executes VFW Policy + OnSet ${CURDIR}/data/drools/vfwOnset.json + ${policyExecuted}= Set Variable ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a + @{otherMessages}= Create List ACTIVE + AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + + @{otherMessages}= Create List ${policyExecuted} OPERATION + AssertMessageFromTopic policy-cl-mgt Sending guard query for APPC ModifyConfig ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt Guard result for APPC ModifyConfig is Permit ${otherMessages} + + AssertMessageFromTopic policy-cl-mgt actor=APPC,operation=ModifyConfig ${otherMessages} + +# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=ModifyConfig +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} # -#VfwExecute -# [Documentation] Executes VFW Policy -# OnSet ${CURDIR}/data/vfwOnset.json -# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} Sending guard query for APPC ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} Guard result for APPC ModifyConfig is Permit -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} actor=APPC,operation=ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} actor=APPC,operation=ModifyConfig -# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS -# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a -# Should Contain ${result} APPC -# Should Contain ${result} ModifyConfig +# @{otherMessages}= Create List FINAL: SUCCESS APPC ModifyConfig +# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages} + *** Keywords *** VerifyController - ${resp}= PeformGetRequest /policy/pdp/engine/controllers/usecases/drools/facts ${DROOLS_IP_2} 200 + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/controllers/usecases/drools/facts ${DROOLS_IP_2} 200 Should Be Equal As Strings ${resp.json()['usecases']} 1 -PeformGetRequest +PerformGetRequestOnDrools [Arguments] ${url} ${domain} ${expectedstatus} ${auth}= Create List demo@people.osaaf.org demo123456! Log Creating session http://${domain} @@ -158,19 +202,45 @@ PeformGetRequest RETURN ${resp} PerformPostRequest - [Arguments] ${url} ${params} ${domain} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus} + [Arguments] ${url} ${domain} ${file} ${folder} ${contenttype} ${expectedstatus} ${auth}= Create List policyadmin zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} + ${body}= Get file ${folder}/${file} Log Creating session http://${domain} ${session}= Create Session policy http://${domain} auth=${auth} ${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype} - ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus} + ${resp}= POST On Session policy ${url} data=${body} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} RETURN ${resp} OnSet [Arguments] ${file} ${data}= Get File ${file} - ${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP} + ${resp}= Run Process ${CURDIR}/kafka_producer.py dcae_topic ${data} ${KAFKA_IP} Log Response from kafka ${resp.stdout} RETURN ${resp.stdout} + +CreatePolicy + [Arguments] ${policyFile} ${contenttype} + PerformPostRequest /policy/api/v1/policies ${POLICY_API_IP} ${policyFile} ${DATA} ${contenttype} 201 + +DeployPolicy + [Arguments] ${policyName} + PerformPostRequest /policy/pap/v1/pdps/deployments/batch ${POLICY_PAP_IP} ${policyName} ${CURDIR}/data/drools json 202 + +AssertMessageFromTopic + [Arguments] ${topic} ${topicMessage} ${otherMessages} + ${response}= Wait Until Keyword Succeeds 4 x 10 sec CheckKafkaTopic ${topic} ${topicMessage} + FOR ${msg} IN @{otherMessages} + Should Contain ${response} ${msg} + END + +GetDeployedPolicies + ${auth}= PolicyAdminAuth + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/deployed 200 null ${auth} + RETURN ${resp} + +VerifyEventsOnTopic + [Arguments] ${topic} ${type} + ${resp}= PerformGetRequestOnDrools /policy/pdp/engine/topics/${type}/kafka/${topic}/events ${DROOLS_IP_2} 200 + Log Events: ${resp.json()} + RETURN ${resp} diff --git a/csit/resources/tests/kafka_consumer.py b/csit/resources/tests/kafka_consumer.py index fa173f47..53a2e39f 100755 --- a/csit/resources/tests/kafka_consumer.py +++ b/csit/resources/tests/kafka_consumer.py @@ -27,34 +27,28 @@ import sys import time -def consume_kafka_topic(topic, expected_values, timeout, bootstrap_server): +def consume_kafka_topic(topic, expected_msg, sec_timeout, bootstrap_server): config = { - 'bootstrap.servers': bootstrap_server, - 'group.id': 'testgrp', - 'auto.offset.reset': 'earliest' + 'bootstrap.servers': bootstrap_server, + 'group.id': 'testgrp', + 'auto.offset.reset': 'earliest' } consumer = Consumer(config) consumer.subscribe([topic]) try: start_time = time.time() - while time.time() - start_time < timeout: - msg = consumer.poll(1.0) - if msg is None: - continue - if msg.error(): - if msg.error().code() == KafkaException._PARTITION_EOF: - sys.stderr.write(f"Reached end of topic {msg.topic()} / partition {msg.partition()}\n") - print('ERROR') - sys.exit(404) - else: - # Error - raise KafkaException(msg.error()) - else: - # Message received - message = msg.value().decode('utf-8') - if expected_values in message: - print(message) - sys.exit(200) + while time.time() - start_time < sec_timeout: + msg = consumer.poll(1.0) + if msg is None: + continue + if msg.error(): + raise KafkaException(msg.error()) + else: + # Message received + message = msg.value().decode('utf-8') + if expected_msg in message: + print(message) + sys.exit(200) finally: consumer.close() @@ -63,5 +57,5 @@ if __name__ == '__main__': topic_name = sys.argv[1] timeout = int(sys.argv[2]) # timeout in seconds for verifying the kafka topic expected_values = sys.argv[3] - bootstrap_server = sys.argv[4] - consume_kafka_topic(topic_name, expected_values, timeout, bootstrap_server) + server = sys.argv[4] + consume_kafka_topic(topic_name, expected_values, timeout, server) diff --git a/csit/resources/tests/kafka_producer.py b/csit/resources/tests/kafka_producer.py index a7d45647..e960b934 100755 --- a/csit/resources/tests/kafka_producer.py +++ b/csit/resources/tests/kafka_producer.py @@ -24,6 +24,7 @@ from confluent_kafka import Producer import sys + def post_to_kafka(topic, message, bootstrap_server): conf = {'bootstrap.servers': bootstrap_server} @@ -37,5 +38,6 @@ def post_to_kafka(topic, message, bootstrap_server): finally: producer.flush() + if __name__ == '__main__': post_to_kafka(sys.argv[1], sys.argv[2], sys.argv[3]) diff --git a/csit/resources/tests/make_topics.py b/csit/resources/tests/make_topics.py index 82b1dc39..bf6d6e34 100755 --- a/csit/resources/tests/make_topics.py +++ b/csit/resources/tests/make_topics.py @@ -24,18 +24,19 @@ from confluent_kafka.admin import AdminClient, NewTopic import sys + def create_topic(bootstrap_servers, topic_name, num_partitions=2, replication_factor=2): admin_client = AdminClient({'bootstrap.servers': bootstrap_servers}) # Define the topic configuration - topic = NewTopic(topic_name, num_partitions=num_partitions, replication_factor=replication_factor) + new_topic = NewTopic(topic_name, num_partitions=num_partitions, replication_factor=replication_factor) # Create the topic - admin_client.create_topics([topic]) + admin_client.create_topics([new_topic]) if __name__ == '__main__': - topic_name = sys.argv[1] - bootstrap_servers = sys.argv[2] + topic = sys.argv[1] + servers = sys.argv[2] - create_topic(bootstrap_servers, topic_name) + create_topic(servers, topic) diff --git a/csit/resources/tests/pap-slas.robot b/csit/resources/tests/pap-slas.robot index 4a044675..e241ee9f 100644 --- a/csit/resources/tests/pap-slas.robot +++ b/csit/resources/tests/pap-slas.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** ValidateResponseTimeForPap diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot index 13bf16ed..e66820c7 100644 --- a/csit/resources/tests/pap-test.robot +++ b/csit/resources/tests/pap-test.robot @@ -3,7 +3,7 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Keywords *** GetReq @@ -19,17 +19,17 @@ CheckUndeploymentStatus LoadPolicy [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 LoadPolicyWithMetadataSet [Documentation] Create a policy named 'operational.apex.decisionMaker' and version '1.0.0' using specific api ${postjson}= Get file ${CURDIR}/data/apex.policy.decisionmaker.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} operational.apex.decisionMaker 1.0.0 + CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies ${postjson} operational.apex.decisionMaker 1.0.0 LoadNodeTemplates [Documentation] Create node templates in database using specific api ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json - CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3 Healthcheck [Documentation] Verify policy pap health check @@ -46,11 +46,11 @@ Metrics [Documentation] Verify policy pap is exporting prometheus metrics ${auth}= PolicyAdminAuth ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} - Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS",} 1.0 - Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",} + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck"} + Should Contain ${resp.text} http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS"} 1 + Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS"} AddPdpGroup [Documentation] Add a new PdpGroup named 'testGroup' in the policy database diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 3f158c60..e765dd4f 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -10,22 +10,14 @@ Resource common-library.robot *** Test Cases *** HealthcheckAcm [Documentation] Healthcheck on Clamp Acm - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} - ${session}= Create Session ACM http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session ACM /onap/policy/clamp/acm/health headers=${headers} - Log Received response from ACM healthcheck {resp.text} + ${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}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} - ${session}= Create Session participant http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session participant /onap/policy/simparticipant/health headers=${headers} - Log Received response from participant healthcheck {resp.text} + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/health ${auth} Should Be Equal As Strings ${resp.status_code} 200 HealthcheckApi @@ -38,7 +30,7 @@ HealthcheckPap RegisterParticipants [Documentation] Register Participants. - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -47,129 +39,118 @@ RegisterParticipants CommissionAutomationComposition [Documentation] Commission automation composition definition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${postyaml}= Get file ${CURDIR}/data/acelement-usecase.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} ${respyaml}= yaml.Safe Load ${resp.text} set Suite variable ${compositionId} ${respyaml["compositionId"]} Should Be Equal As Strings ${resp.status_code} 201 CommissionAcDefinitionMigrationFrom [Documentation] Commission automation composition definition From. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-from.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} ${respyaml}= yaml.Safe Load ${resp.text} set Suite variable ${compositionFromId} ${respyaml["compositionId"]} Should Be Equal As Strings ${resp.status_code} 201 CommissionAcDefinitionMigrationTo [Documentation] Commission automation composition definition To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${postyaml}= Get file ${CURDIR}/data/ac-definition-migration-to.yaml - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions ${postyaml} ${auth} ${respyaml}= yaml.Safe Load ${resp.text} set Suite variable ${compositionToId} ${respyaml["compositionId"]} Should Be Equal As Strings ${resp.status_code} 201 PrimeACDefinitions [Documentation] Prime automation composition definition - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionId} data=${postjson} headers=${headers} + ${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 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} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} 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} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} PRIMED PrimeACDefinitionTo [Documentation] Prime automation composition definition Migration To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionToId} data=${postjson} headers=${headers} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} PRIMED InstantiateAutomationComposition [Documentation] Instantiate automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth 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} ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances data=${updatedpostjson} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeJsonPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances ${updatedpostjson} ${auth} ${respyaml}= yaml.Safe Load ${resp.text} set Suite variable ${instanceId} ${respyaml["instanceId"]} Should Be Equal As Strings ${resp.status_code} 201 InstantiateAutomationCompositionMigrationFrom [Documentation] Instantiate automation composition migration. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${postyaml}= Get file ${CURDIR}/data/ac-instance-migration-from.yaml ${updatedpostyaml}= Replace String ${postyaml} COMPOSITIONIDPLACEHOLDER ${compositionFromId} - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeYamlPostRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances ${updatedpostyaml} ${auth} ${respyaml}= yaml.Safe Load ${resp.text} set Suite variable ${instanceMigrationId} ${respyaml["instanceId"]} Should Be Equal As Strings ${resp.status_code} 201 +FailDeployAutomationCompositionMigration + [Documentation] Fail Deploy automation composition. + SetParticipantSimFail + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED + +TimeoutDeployAutomationCompositionMigration + [Documentation] Timeout Deploy automation composition. + SetParticipantSimTimeout + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/DeployAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + +PrepareAutomationComposition + [Documentation] Prepare automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/PrepareAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 202 + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} + DeployAutomationComposition [Documentation] Deploy automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 10 min 5 sec VerifyDeployStatus ${compositionId} ${instanceId} DEPLOYED @@ -208,7 +189,7 @@ CheckHttpPresentInAcmTraces QueryPolicies [Documentation] Verify the new policies deployed - ${auth}= Create List policyadmin zb!XztG34 + ${auth}= PolicyAdminAuth Sleep 10s Log Creating session http://${POLICY_PAP_IP} ${session}= Create Session policy http://${POLICY_PAP_IP} auth=${auth} @@ -220,7 +201,7 @@ QueryPolicies QueryPolicyTypes [Documentation] Verify the new policy types created - ${auth}= Create List policyadmin zb!XztG34 + ${auth}= PolicyAdminAuth Sleep 10s Log Creating session http://${POLICY_API_IP}:6969 ${session}= Create Session policy http://${POLICY_API_IP} auth=${auth} @@ -230,122 +211,107 @@ 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} +ReviewAutomationComposition + [Documentation] Review automation composition. + ${auth}= ClampAuth + ${postjson}= Get file ${CURDIR}/data/ReviewAC.json + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyFailDeploy ${compositionFromId} ${instanceMigrationId} + Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionId} ${instanceId} + +CheckTimeoutAutomationComposition + [Documentation] Timeout Deploy automation composition. + Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} TIMEOUT DeployAutomationCompositionMigration [Documentation] Deploy automation composition. SetParticipantSimSuccess - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionFromId} ${instanceMigrationId} DEPLOYED SendOutPropertiesToRuntime [Documentation] Send Out Properties To Runtime - ${auth}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} + ${auth}= ParticipantAuth ${postjson}= Get file ${CURDIR}/data/OutProperties.json ${updatedpostjson}= Replace String ${postjson} INSTACEIDPLACEHOLDER ${instanceMigrationId} ${updatedpostjson}= Replace String ${updatedpostjson} TEXTPLACEHOLDER MyTextToSend - ${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/datas data=${updatedpostjson} headers=${headers} - Log Received response from participant sim ${resp.text} + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_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 AutomationCompositionUpdate [Documentation] Update of an automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${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 - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${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}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${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 - ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml - ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances data=${updatedpostyaml} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${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} UnDeployAutomationComposition [Documentation] UnDeploy automation composition. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} - Log Received response from runtime acm ${resp.text} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 10 min 5 sec 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} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 - Wait Until Keyword Succeeds 2 min 5 sec VerifyFailDeploy ${compositionToId} ${instanceMigrationId} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED UnDeployAutomationCompositionMigrationTo [Documentation] UnDeploy automation composition migrated. SetParticipantSimSuccess - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyDeployStatus ${compositionToId} ${instanceMigrationId} UNDEPLOYED UnInstantiateAutomationComposition [Documentation] Delete automation composition instance. - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -357,19 +323,19 @@ UnInstantiateAutomationComposition FailUnInstantiateAutomationCompositionMigrationTo [Documentation] Fail Delete automation composition instance migrated. SetParticipantSimFail - ${auth}= Create List runtimeUser zb!XztG34 + ${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/${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} + Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionToId} ${instanceMigrationId} FAILED UnInstantiateAutomationCompositionMigrationTo [Documentation] Delete automation composition instance migrated. SetParticipantSimSuccess - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -380,53 +346,41 @@ UnInstantiateAutomationCompositionMigrationTo DePrimeACDefinitions [Documentation] DePrime automation composition definition - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionId} data=${postjson} headers=${headers} + ${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 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} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} 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} + ${auth}= ClampAuth ${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} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionFromId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionFromId} COMMISSIONED DePrimeACDefinitionsTo [Documentation] DePrime automation composition definition migration To. - ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP} + ${auth}= ClampAuth ${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/${compositionToId} data=${postjson} headers=${headers} + ${resp}= MakeJsonPutRequest ACM ${POLICY_RUNTIME_ACM_IP} /onap/policy/clamp/acm/v2/compositions/${compositionToId} ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 202 Wait Until Keyword Succeeds 2 min 5 sec VerifyPriming ${compositionToId} COMMISSIONED DeleteACDefinition [Documentation] Delete automation composition definition. - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -436,7 +390,7 @@ DeleteACDefinition DeleteACDefinitionFrom [Documentation] Delete automation composition definition migration From. - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -446,7 +400,7 @@ DeleteACDefinitionFrom DeleteACDefinitionTo [Documentation] Delete automation composition definition migration To. - ${auth}= Create List runtimeUser zb!XztG34 + ${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 @@ -459,32 +413,21 @@ DeleteACDefinitionTo VerifyHealthcheckApi [Documentation] Verify Healthcheck on policy-api - ${auth}= Create List policyadmin zb!XztG34 - Log Creating session http://${POLICY_API_IP} - ${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/health headers=${headers} - Log Received response from policy-api healthcheck ${resp.text} + ${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}= Create List policyadmin zb!XztG34 - 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/health headers=${headers} - Log Received response from policy-pap healthcheck ${resp.text} + ${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}= 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} + ${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} @@ -492,58 +435,77 @@ VerifyPriming 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} + ${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']} FAILED VerifyDeployStatus [Arguments] ${theCompositionId} ${theInstanceId} ${deploystate} [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} + ${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} -VerifyFailDeploy +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}= 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} + ${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']} FAILED + 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}= 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} + ${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} +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] + +VerifyMigratedElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_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 + VerifyParticipantSim [Arguments] ${theInstanceId} ${textToFind} [Documentation] Query on Participant Simulator - ${auth}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} - ${session}= Create Session ACM http://${POLICY_PARTICIPANT_SIM_IP} auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session ACM /onap/policy/simparticipant/v2/instances/${theInstanceId} headers=${headers} - Log Received response from participant {resp.text} + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${POLICY_PARTICIPANT_SIM_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} @@ -551,32 +513,94 @@ VerifyParticipantSim VerifyUninstantiated [Arguments] ${theCompositionId} [Documentation] Verify the Uninstantiation 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 headers=${headers} + ${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}= Create List participantUser zb!XztG34 - Log Creating session http://${POLICY_PARTICIPANT_SIM_IP} + ${auth}= ParticipantAuth ${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} + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} 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} + ${auth}= ParticipantAuth ${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} + ${resp}= MakeJsonPutRequest participant ${POLICY_PARTICIPANT_SIM_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 ${POLICY_PARTICIPANT_SIM_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 200 + +ClampAuth + ${auth}= Create List runtimeUser zb!XztG34 + RETURN ${auth} + +ParticipantAuth + ${auth}= Create List participantUser zb!XztG34 + RETURN ${auth} + +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/resources/tests/xacml-pdp-slas.robot b/csit/resources/tests/xacml-pdp-slas.robot new file mode 100644 index 00000000..e3d2d910 --- /dev/null +++ b/csit/resources/tests/xacml-pdp-slas.robot @@ -0,0 +1,30 @@ +*** Settings *** +Library OperatingSystem +Resource common-library.robot + +*** Test Cases *** +WaitForPrometheusServer + [Documentation] Sleep time to wait for Prometheus server to gather all metrics + Sleep 1 minute + +ValidatePolicyDecisionsGauge + [Documentation] Validate policy execution gauge using prometheus metrics + ValidatePrometheusMetric pdpx_policy_decisions_created{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + ValidatePrometheusMetric pdpx_policy_decisions_created{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1.8E9 + +ValidatePolicyDecisionsTotalCounter + [Documentation] Validate policy decision counters using prometheus metrics + ValidatePrometheusMetric pdpx_policy_decisions_total{application="optimization",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="guard",status="not_applicable", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="monitoring",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 2 + ValidatePrometheusMetric pdpx_policy_decisions_total{application="naming",status="permit", instance="policy-xacml-pdp:6969", job="xacml-pdp-metrics"} 1 + +*** Keywords *** +ValidatePrometheusMetric + [Arguments] ${url} ${expectedLimit} + [Documentation] Check that the policy execution is under X limit + ${resp}= QueryPrometheus ${url} + ${actualValue}= Evaluate ${resp['data']['result'][0]['value'][1]} + Should Be True ${actualValue} <= ${expectedLimit} diff --git a/csit/resources/tests/xacml-pdp-test.robot b/csit/resources/tests/xacml-pdp-test.robot index cddecab9..4eaca607 100644 --- a/csit/resources/tests/xacml-pdp-test.robot +++ b/csit/resources/tests/xacml-pdp-test.robot @@ -4,7 +4,7 @@ Library RequestsLibrary Library OperatingSystem Library Process Library json -Resource ${CURDIR}/common-library.robot +Resource common-library.robot *** Test Cases *** Healthcheck @@ -37,12 +37,12 @@ ExecuteXacmlPolicy CreateMonitorPolicy [Documentation] Create a Monitoring policy ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 201 ${postjson} onap.restart.tca 1.0.0 CreateOptimizationPolicy [Documentation] Create an Optimization policy ${postjson}= Get file ${DATA}/vCPE.policies.optimization.input.tosca.json - CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 + CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 201 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0 GetDefaultDecision [Documentation] Get Default Decision with no policies in Xacml PDP |