diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-08-20 17:39:53 +0100 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-08-25 10:37:51 +0100 |
commit | 60d6a08c8376f66d4cd655de48949d50e8ec1d7a (patch) | |
tree | 251704ccdf9417906d1568d4f5c7d4103fbca7bf | |
parent | e43792b9a7c27a5157fe70179b79db09e3d94098 (diff) |
Update CSITs for metrics + refactoring
Change-Id: I5d090765ff29143f689c6754a7a1ad55dae1c1b4
Issue-ID: POLICY-3524
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
-rw-r--r-- | csit/apex-pdp/tests/apex-pdp-test.robot | 81 | ||||
-rw-r--r-- | csit/api/tests/api-test.robot | 78 | ||||
-rw-r--r-- | csit/common-library.robot | 94 | ||||
-rw-r--r-- | csit/config/apex-pdp/OnapPfConfig.json | 3 | ||||
-rw-r--r-- | csit/config/distribution/defaultConfig.json | 3 | ||||
-rw-r--r-- | csit/config/drools-apps/custom/engine.properties | 5 | ||||
-rw-r--r-- | csit/config/drools-apps/env/base.conf | 9 | ||||
-rw-r--r-- | csit/config/drools/custom/engine.properties | 4 | ||||
-rw-r--r-- | csit/config/drools/env/base.conf | 9 | ||||
-rw-r--r-- | csit/config/pap/defaultConfig.json | 3 | ||||
-rw-r--r-- | csit/config/xacml-pdp/defaultConfig.json | 3 | ||||
-rw-r--r-- | csit/distribution/tests/distribution-test.robot | 20 | ||||
-rw-r--r-- | csit/drools-applications/tests/drools-applications-test.robot | 5 | ||||
-rw-r--r-- | csit/drools-pdp/tests/drools-pdp-test.robot | 10 | ||||
-rw-r--r-- | csit/pap/tests/pap-test.robot | 112 | ||||
-rw-r--r-- | csit/xacml-pdp/tests/xacml-pdp-test.robot | 97 |
16 files changed, 253 insertions, 283 deletions
diff --git a/csit/apex-pdp/tests/apex-pdp-test.robot b/csit/apex-pdp/tests/apex-pdp-test.robot index f2f82e9c..60497229 100644 --- a/csit/apex-pdp/tests/apex-pdp-test.robot +++ b/csit/apex-pdp/tests/apex-pdp-test.robot @@ -4,89 +4,53 @@ Library RequestsLibrary Library OperatingSystem Library json Library Process +Resource ${CURDIR}/../../common-library.robot + *** Test Cases *** Healthcheck [Documentation] Runs Apex PDP Health check - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${APEX_IP}:6969 - ${session}= Create Session policy https://${APEX_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/apex-pdp/v1/healthcheck headers=${headers} - Log Received response from policy ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['code']} 200 + ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null + Should Be Equal As Strings ${resp.json()['code']} 200 Set Suite Variable ${pdpName} ${resp.json()['name']} -ExecuteApexPolicy +Metrics + [Documentation] Verify policy-apex-pdp is exporting prometheus metrics + ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null + Should Contain ${resp.text} jvm_threads_current + +ExecuteApexSampleDomainPolicy Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain - Wait Until Keyword Succeeds 2 min 5 sec CreatePolicy + ${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 Wait Until Keyword Succeeds 3 min 5 sec VerifyPdpStatistics 0 0 0 0 - Wait Until Keyword Succeeds 2 min 5 sec DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec VerifyPolicyStatus + DeployPolicy + Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex Wait Until Keyword Succeeds 3 min 5 sec VerifyPdpStatistics 1 1 0 0 Wait Until Keyword Succeeds 4 min 5 sec RunEventOnApexEngine Wait Until Keyword Succeeds 3 min 5 sec VerifyPdpStatistics 1 1 1 1 ExecuteApexControlLoopPolicy Set Test Variable ${policyName} onap.policies.apex.Simplecontrolloop - Wait Until Keyword Succeeds 2 min 5 sec CreatePolicy - Wait Until Keyword Succeeds 2 min 5 sec DeployPolicy - Wait Until Keyword Succeeds 2 min 5 sec VerifyPolicyStatus + ${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 + DeployPolicy + Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex ${result}= Run Process ${SCRIPTS}/make_topic.sh APEX-CL-MGT Should Be Equal As Integers ${result.rc} 0 Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyControlLoopPolicy *** Keywords *** -CreatePolicy - [Documentation] Create a new Apex policy - ${auth}= Create List healthcheck zb!XztG34 - ${postjson}= Get file ${CURDIR}/data/${policyName}.json - Log Creating session https://${POLICY_API_IP}:6969 - ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies data=${postjson} headers=${headers} - Log Received response from policy ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - Dictionary Should Contain Key ${resp.json()} tosca_definitions_version DeployPolicy [Documentation] Deploy the policy in apex-pdp engine - ${auth}= Create List healthcheck zb!XztG34 ${postjson}= Get file ${CURDIR}/data/policy_deploy.json ${postjson}= evaluate json.loads('''${postjson}''') json set to dictionary ${postjson['groups'][0]['deploymentSubgroups'][0]['policies'][0]} name=${policyName} ${postjson}= evaluate json.dumps(${postjson}) json - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers} - Log Received response from policy ${resp.text} - Should Be Equal As Strings ${resp.status_code} 202 - -VerifyPolicyStatus - [Documentation] Verify policy deployment status - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/pap/v1/policies/status headers=${headers} - Log Received response from policy ${resp.text} - FOR ${responseEntry} IN @{resp.json()} - Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' - END - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${responseEntry['pdpGroup']} defaultGroup - Should Be Equal As Strings ${responseEntry['pdpType']} apex - Should Be Equal As Strings ${responseEntry['pdpId']} ${pdpName} - Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName} - Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0 - Should Be Equal As Strings ${responseEntry['policyType']['name']} onap.policies.native.Apex - Should Be Equal As Strings ${responseEntry['policyType']['version']} 1.0.0 - Should Be Equal As Strings ${responseEntry['deploy']} True - Should Be Equal As Strings ${responseEntry['state']} SUCCESS + PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null RunEventOnApexEngine [Documentation] Send event to verify policy execution @@ -118,12 +82,7 @@ CheckLogMessage VerifyPdpStatistics [Documentation] Verify pdp statistics after policy execution [Arguments] ${deployCount} ${deploySuccessCount} ${executedCount} ${executedSuccessCount} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} params=recordCount=1 headers=${headers} - Log Received response from policy ${resp.text} + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} 200 null Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpInstanceId']} ${pdpName} Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpGroupName']} defaultGroup diff --git a/csit/api/tests/api-test.robot b/csit/api/tests/api-test.robot index 2123b1e5..1f94c9ce 100644 --- a/csit/api/tests/api-test.robot +++ b/csit/api/tests/api-test.robot @@ -3,17 +3,23 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json +Resource ${CURDIR}/../../common-library.robot *** Test Cases *** Healthcheck [Documentation] Verify policy api health check - ${resp}= PeformGetRequest /policy/api/v1/healthcheck 200 + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/healthcheck 200 null Should Be Equal As Strings ${resp.json()['code']} 200 +Metrics + [Documentation] Verify policy-api is exporting prometheus metrics + ${resp}= PerformGetRequest ${POLICY_API_IP} /metrics 200 null + Should Contain ${resp.text} jvm_threads_current + Statistics [Documentation] Verify policy api statistics - ${resp}= PeformGetRequest /policy/api/v1/statistics 200 + ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 RetrievePolicyTypes @@ -34,15 +40,18 @@ RetrieveMonitoringPolicyTypes CreateNewMonitoringPolicyV1 [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 vCPE.policy.monitoring.input.tosca.json onap.restart.tca 1.0.0 + ${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 CreateNewMonitoringPolicyV1Again [Documentation] Create an existing policy with modification and keeping the same version should result in error. - CreatePolicy /policy/api/v1/policies 406 vCPE.policy.monitoring.input.tosca.v1_2.json null null + ${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 - CreatePolicy /policy/api/v1/policies 200 vCPE.policy.monitoring.input.tosca.v2.json onap.restart.tca 2.0.0 + ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json + CreatePolicy /policy/api/v1/policies 200 ${postjson} onap.restart.tca 2.0.0 RetrievePoliciesOfType [Documentation] Retrieve all policies belonging to a specific Policy Type @@ -58,81 +67,48 @@ RetrieveSpecificPolicy DeleteSpecificPolicy [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api - PeformDeleteRequest /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 + PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200 + PerformDeleteRequest ${POLICY_API_IP} /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 - PeformDeleteRequest /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 + PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200 + PerformDeleteRequest ${POLICY_API_IP} /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' - PeformDeleteRequest /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 + PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200 + PerformDeleteRequest ${POLICY_API_IP} /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' - PeformDeleteRequest /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 + PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200 + PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404 *** Keywords *** CreatePolicyType [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion} [Documentation] Create the specific policy type - ${resp}= PerformCreateRequest ${url} ${expectedstatus} ${jsonfile} ${CURDIR}/data + ${postjson}= Get file ${CURDIR}/data/${jsonfile} + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null 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}= PeformGetRequest ${url} 200 + ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null Length Should Be ${resp.json()['policy_types']} ${expectedLength} -CreatePolicy - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policyname} ${policyversion} - [Documentation] Create the specific policy - ${resp}= PerformCreateRequest ${url} ${expectedstatus} ${jsonfile} ${DATA} - 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} - FetchPolicy [Arguments] ${url} ${keyword} [Documentation] Fetch the specific policy - ${resp}= PeformGetRequest ${url} 200 + ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword} FetchPolicies [Arguments] ${url} ${expectedLength} [Documentation] Fetch all policies - ${resp}= PeformGetRequest ${url} 200 + ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength} - -PerformCreateRequest - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${filepath} - ${auth}= Create List healthcheck zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} - Log Creating session https://${POLICY_API_IP}:6969 - ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy ${url} data=${postjson} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformGetRequest - [Arguments] ${url} ${expectedstatus} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_API_IP}:6969 - ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy ${url} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformDeleteRequest - [Arguments] ${url} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_API_IP}:6969 - ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=200 - Log Received response from policy ${resp.text} - ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=404 diff --git a/csit/common-library.robot b/csit/common-library.robot new file mode 100644 index 00000000..639d32a8 --- /dev/null +++ b/csit/common-library.robot @@ -0,0 +1,94 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + + +*** Keywords *** + +CreatePolicy + [Arguments] ${url} ${expectedstatus} ${postjson} ${policyname} ${policyversion} + [Documentation] Create the specific policy + ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null + 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} + +QueryPdpGroups + [Documentation] Verify pdp group query - supports upto 2 groups + [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2} + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null + Length Should Be ${resp.json()['groups']} ${groupsLength} + Should Be Equal As Strings ${resp.json()['groups'][0]['name']} ${group1Name} + Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ${group1State} + Length Should Be ${resp.json()['groups'][0]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup1} + Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} ${group2Name} + Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ${group2State} + Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup2} + +QueryPolicyAudit + [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction} + ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} ${expectedstatus} recordCount=1 + Should Be Equal As Strings ${resp.json()[0]['pdpGroup']} ${pdpGroup} + Should Be Equal As Strings ${resp.json()[0]['pdpType']} ${pdpType} + Should Be Equal As Strings ${resp.json()[0]['policy']['name']} ${policyName} + Should Be Equal As Strings ${resp.json()[0]['policy']['version']} 1.0.0 + Should Be Equal As Strings ${resp.json()[0]['action']} ${expectedAction} + Should Be Equal As Strings ${resp.json()[0]['user']} healthcheck + +QueryPolicyStatus + [Documentation] Verify policy deployment status + [Arguments] ${policyName} ${pdpGroup} ${pdpType} ${pdpName} ${policyTypeName} + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/status 200 null + FOR ${responseEntry} IN @{resp.json()} + Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' + END + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${responseEntry['pdpGroup']} ${pdpGroup} + Should Be Equal As Strings ${responseEntry['pdpType']} ${pdpType} + Should Be Equal As Strings ${responseEntry['pdpId']} ${pdpName} + Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName} + Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0 + Should Be Equal As Strings ${responseEntry['policyType']['name']} ${policyTypeName} + Should Be Equal As Strings ${responseEntry['policyType']['version']} 1.0.0 + Should Be Equal As Strings ${responseEntry['deploy']} True + Should Be Equal As Strings ${responseEntry['state']} SUCCESS + +PerformPostRequest + [Arguments] ${hostname} ${url} ${expectedstatus} ${postjson} ${params} + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${hostname}:6969 + ${session}= Create Session policy https://${hostname}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= POST On Session policy ${url} data=${postjson} params=${params} headers=${headers} expected_status=${expectedstatus} + Log Received response from policy ${resp.text} + [return] ${resp} + +PerformPutRequest + [Arguments] ${hostname} ${url} ${expectedstatus} ${params} + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${hostname}:6969 + ${session}= Create Session policy https://${hostname}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} + Log Received response from policy ${resp.text} + [return] ${resp} + +PerformGetRequest + [Arguments] ${hostname} ${url} ${expectedstatus} ${params} + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${hostname}:6969 + ${session}= Create Session policy https://${hostname}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} + Log Received response from policy ${resp.text} + [return] ${resp} + +PerformDeleteRequest + [Arguments] ${hostname} ${url} ${expectedstatus} + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${hostname}:6969 + ${session}= Create Session policy https://${hostname}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus} + Log Received response from policy ${resp.text} diff --git a/csit/config/apex-pdp/OnapPfConfig.json b/csit/config/apex-pdp/OnapPfConfig.json index 7d4f7409..d46a8b20 100644 --- a/csit/config/apex-pdp/OnapPfConfig.json +++ b/csit/config/apex-pdp/OnapPfConfig.json @@ -5,7 +5,8 @@ "port": 6969, "userName": "healthcheck", "password": "zb!XztG34", - "https": true + "https": true, + "prometheus": true }, "pdpStatusParameters":{ "pdpGroup": "defaultGroup", diff --git a/csit/config/distribution/defaultConfig.json b/csit/config/distribution/defaultConfig.json index b4cc1ea5..ba1a682c 100644 --- a/csit/config/distribution/defaultConfig.json +++ b/csit/config/distribution/defaultConfig.json @@ -5,7 +5,8 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34", - "https": true + "https": true, + "prometheus": true }, "receptionHandlerParameters":{ "FileReceptionHandler":{ diff --git a/csit/config/drools-apps/custom/engine.properties b/csit/config/drools-apps/custom/engine.properties index 8915385d..ee55f28a 100644 --- a/csit/config/drools-apps/custom/engine.properties +++ b/csit/config/drools-apps/custom/engine.properties @@ -3,6 +3,7 @@ # ONAP # ================================================================================ # Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,10 +41,10 @@ http.server.services.SECURED-CONFIG.password=${envd:TELEMETRY_PASSWORD} http.server.services.SECURED-CONFIG.restPackages=org.onap.policy.drools.server.restful http.server.services.SECURED-CONFIG.managed=false http.server.services.SECURED-CONFIG.swagger=true -http.server.services.SECURED-CONFIG.https=true +http.server.services.SECURED-CONFIG.https=${envd:HTTP_SERVER_HTTPS:false} +http.server.services.SECURED-CONFIG.prometheus=${envd:PROMETHEUS:true} http.server.services.SECURED-CONFIG.aaf=${envd:AAF:false} http.server.services.SECURED-CONFIG.serialization.provider=org.onap.policy.common.gson.JacksonHandler,org.onap.policy.common.endpoints.http.server.YamlJacksonHandler aaf.namespace=${envd:AAF_NAMESPACE:false} aaf.root.permission=${envd:AAF_NAMESPACE:org.onap.policy}.pdpd - diff --git a/csit/config/drools-apps/env/base.conf b/csit/config/drools-apps/env/base.conf index d6abeb9b..86749619 100644 --- a/csit/config/drools-apps/env/base.conf +++ b/csit/config/drools-apps/env/base.conf @@ -1,5 +1,6 @@ # ============LICENSE_START================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # =========================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -55,14 +56,14 @@ AAF=false AAF_NAMESPACE=org.onap.policy AAF_HOST=aaf.api.simpledemo.onap.org -# Prometheus - -PROMETHEUS=false - # HTTP Servers https enabled HTTP_SERVER_HTTPS=true +# Prometheus + +PROMETHEUS=true + # PDP-D DMaaP configuration channel PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION diff --git a/csit/config/drools/custom/engine.properties b/csit/config/drools/custom/engine.properties index dfc6a7db..4d00d647 100644 --- a/csit/config/drools/custom/engine.properties +++ b/csit/config/drools/custom/engine.properties @@ -3,6 +3,7 @@ # ONAP # ================================================================================ # Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,7 +30,8 @@ http.server.services.SECURED-CONFIG.password=${envd:TELEMETRY_PASSWORD} http.server.services.SECURED-CONFIG.restPackages=org.onap.policy.drools.server.restful http.server.services.SECURED-CONFIG.managed=false http.server.services.SECURED-CONFIG.swagger=true -http.server.services.SECURED-CONFIG.https=true +http.server.services.SECURED-CONFIG.https=${envd:HTTP_SERVER_HTTPS:false} +http.server.services.SECURED-CONFIG.prometheus=${envd:PROMETHEUS:true} http.server.services.SECURED-CONFIG.aaf=${envd:AAF:false} http.server.services.SECURED-CONFIG.serialization.provider=org.onap.policy.common.gson.JacksonHandler,org.onap.policy.common.endpoints.http.server.YamlJacksonHandler diff --git a/csit/config/drools/env/base.conf b/csit/config/drools/env/base.conf index cbb7186a..769f8fb9 100644 --- a/csit/config/drools/env/base.conf +++ b/csit/config/drools/env/base.conf @@ -1,5 +1,6 @@ # ============LICENSE_START======================================================= # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. +# Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -55,14 +56,14 @@ AAF=false AAF_NAMESPACE=org.onap.policy AAF_HOST=aaf.api.simpledemo.onap.org -# # Prometheus - -PROMETHEUS=false - # HTTP Servers https enabled HTTP_SERVER_HTTPS=true +# Prometheus + +PROMETHEUS=true + # PDP-D DMaaP configuration channel PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION diff --git a/csit/config/pap/defaultConfig.json b/csit/config/pap/defaultConfig.json index 06eb7813..b7c5b310 100644 --- a/csit/config/pap/defaultConfig.json +++ b/csit/config/pap/defaultConfig.json @@ -6,7 +6,8 @@ "userName": "healthcheck", "password": "zb!XztG34", "https": true, - "aaf": false + "aaf": false, + "prometheus": true }, "pdpParameters": { "heartBeatMs": 20000, diff --git a/csit/config/xacml-pdp/defaultConfig.json b/csit/config/xacml-pdp/defaultConfig.json index a6c502d4..f6ee81a4 100644 --- a/csit/config/xacml-pdp/defaultConfig.json +++ b/csit/config/xacml-pdp/defaultConfig.json @@ -8,7 +8,8 @@ "userName": "healthcheck", "password": "zb!XztG34", "https": true, - "aaf": false + "aaf": false, + "prometheus": true }, "policyApiParameters": { "hostname": "policy-api", diff --git a/csit/distribution/tests/distribution-test.robot b/csit/distribution/tests/distribution-test.robot index 64a77e06..2513a6ca 100644 --- a/csit/distribution/tests/distribution-test.robot +++ b/csit/distribution/tests/distribution-test.robot @@ -3,19 +3,25 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json +Resource ${CURDIR}/../../common-library.robot *** Test Cases *** Healthcheck [Documentation] Verify policy distribution health check - ${resp}= PeformGetRequest /healthcheck 200 + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /healthcheck 200 null Should Be Equal As Strings ${resp.json()['code']} 200 Statistics [Documentation] Verify policy distribution statistics - ${resp}= PeformGetRequest /statistics 200 + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 +Metrics + [Documentation] Verify policy-distribution is exporting prometheus metrics + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /metrics 200 null + Should Contain ${resp.text} jvm_threads_current + InvokeDistributionAndRunEventOnEngine Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine @@ -30,13 +36,3 @@ InvokeDistributionUsingFile And RunEventOnApexEngine &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} expected_status=200 Remove Files ${SCRIPT_DIR}/temp/sample_csar_with_apex_policy.csar - -PeformGetRequest - [Arguments] ${url} ${expectedstatus} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969 - ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy ${url} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} diff --git a/csit/drools-applications/tests/drools-applications-test.robot b/csit/drools-applications/tests/drools-applications-test.robot index 627ae1b0..60bccfed 100644 --- a/csit/drools-applications/tests/drools-applications-test.robot +++ b/csit/drools-applications/tests/drools-applications-test.robot @@ -12,6 +12,11 @@ Alive ${resp}= PeformGetRequest /policy/pdp/engine ${DROOLS_IP} 9696 200 Should Be Equal As Strings ${resp.json()['alive']} True +Metrics + [Documentation] Verify drools-apps is exporting metrics + ${resp}= PeformGetRequest /metrics ${DROOLS_IP} 9696 200 + Should Contain ${resp.text} jvm_threads_current + Healthcheck [Documentation] Runs Policy PDP-D Health check ${resp}= PeformGetRequest /healthcheck ${DROOLS_IP} 6969 200 diff --git a/csit/drools-pdp/tests/drools-pdp-test.robot b/csit/drools-pdp/tests/drools-pdp-test.robot index d819a808..68dc4ead 100644 --- a/csit/drools-pdp/tests/drools-pdp-test.robot +++ b/csit/drools-pdp/tests/drools-pdp-test.robot @@ -14,3 +14,13 @@ Alive ${resp}= GET On Session policy /policy/pdp/engine headers=${headers} expected_status=200 Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.json()['alive']} True + +Metrics + [Documentation] Verify drools-pdp is exporting metrics + ${auth}= Create List demo@people.osaaf.org demo123456! + Log Creating session https://${POLICY_DROOLS_IP}:9696 + ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /metrics headers=${headers} expected_status=200 + Log Received response from policy ${resp.text} + Should Contain ${resp.text} jvm_threads_current diff --git a/csit/pap/tests/pap-test.robot b/csit/pap/tests/pap-test.robot index 9b44fe77..a5959141 100644 --- a/csit/pap/tests/pap-test.robot +++ b/csit/pap/tests/pap-test.robot @@ -3,135 +3,79 @@ Library Collections Library RequestsLibrary Library OperatingSystem Library json +Resource ${CURDIR}/../../common-library.robot *** Test Cases *** LoadPolicy [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 vCPE.policy.monitoring.input.tosca.json onap.restart.tca 1.0.0 + ${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 Healthcheck [Documentation] Verify policy pap health check - ${resp}= PeformGetRequest /policy/pap/v1/healthcheck 200 null + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/healthcheck 200 null Should Be Equal As Strings ${resp.json()['code']} 200 +Metrics + [Documentation] Verify policy pap is exporting prometheus metrics + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /metrics 200 null + Should Contain ${resp.text} jvm_threads_current + Statistics [Documentation] Verify policy pap statistics - ${resp}= PeformGetRequest /policy/pap/v1/statistics 200 null + ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 AddPdpGroup [Documentation] Add a new PdpGroup named 'testGroup' in the policy database - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 create.group.request.json ${CURDIR}/data + ${postjson}= Get file ${CURDIR}/data/create.group.request.json + PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null + +QueryPdpGroupsBeforeActivation + [Documentation] Verify PdpGroups before activation + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup PASSIVE 0 ActivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE - PerformPutRequest /policy/pap/v1/pdps/groups/testGroup 200 ACTIVE + PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE QueryPdpGroupsAfterActivation [Documentation] Verify PdpGroups after activation - QueryPdpGroups 2 0 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 DeployPdpGroups [Documentation] Deploy policies in PdpGroups - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 deploy.group.request.json ${CURDIR}/data + ${postjson}= Get file ${CURDIR}/data/deploy.group.request.json + PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null QueryPdpGroupsAfterDeploy [Documentation] Verify PdpGroups after undeploy - QueryPdpGroups 2 1 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 1 QueryPolicyAuditAfterDeploy [Documentation] Verify policy audit record after deploy - QueryPolicyAudit /policy/pap/v1/policies/audit 200 DEPLOYMENT + QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca DEPLOYMENT UndeployPolicy [Documentation] Undeploy a policy named 'onap.restart.tca' from PdpGroups - PeformDeleteRequest /policy/pap/v1/pdps/policies/onap.restart.tca 202 + PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 QueryPdpGroupsAfterUndeploy [Documentation] Verify PdpGroups after undeploy - QueryPdpGroups 2 0 + QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 QueryPolicyAuditAfterUnDeploy [Documentation] Verify policy audit record after undeploy - QueryPolicyAudit /policy/pap/v1/policies/audit 200 UNDEPLOYMENT + QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca UNDEPLOYMENT DeactivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE - PerformPutRequest /policy/pap/v1/pdps/groups/testGroup 200 PASSIVE + PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE DeletePdpGroups [Documentation] Delete the PdpGroup named 'testGroup' from policy database - PeformDeleteRequest /policy/pap/v1/pdps/groups/testGroup 200 + PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 QueryPdpGroupsAfterDelete [Documentation] Verify PdpGroups after delete - QueryPdpGroups 1 0 - -*** Keywords *** - -CreatePolicy - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policyname} ${policyversion} - [Documentation] Create the specific policy - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${jsonfile} ${DATA} - 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} - -QueryPdpGroups - [Arguments] ${groupsLength} ${policiesLength} - ${resp}= PeformGetRequest /policy/pap/v1/pdps 200 null - Length Should Be ${resp.json()['groups']} ${groupsLength} - Should Be Equal As Strings ${resp.json()['groups'][0]['name']} defaultGroup - Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ACTIVE - Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} testGroup - Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ACTIVE - Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLength} - -QueryPolicyAudit - [Arguments] ${url} ${expectedstatus} ${expectedAction} - ${resp}= PeformGetRequest ${url} ${expectedstatus} recordCount=1 - Should Be Equal As Strings ${resp.json()[0]['pdpGroup']} testGroup - Should Be Equal As Strings ${resp.json()[0]['pdpType']} pdpTypeA - Should Be Equal As Strings ${resp.json()[0]['policy']['name']} onap.restart.tca - Should Be Equal As Strings ${resp.json()[0]['policy']['version']} 1.0.0 - Should Be Equal As Strings ${resp.json()[0]['action']} ${expectedAction} - Should Be Equal As Strings ${resp.json()[0]['user']} healthcheck - -PerformPostRequest - [Arguments] ${hostname} ${url} ${expectedstatus} ${jsonfile} ${filepath} - ${auth}= Create List healthcheck zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} - Log Creating session https://${hostname}:6969 - ${session}= Create Session policy https://${hostname}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy ${url} data=${postjson} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PerformPutRequest - [Arguments] ${url} ${expectedstatus} ${state} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= PUT On Session policy ${url} params=state=${state} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformGetRequest - [Arguments] ${url} ${expectedstatus} ${params} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformDeleteRequest - [Arguments] ${url} ${expectedstatus} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} + QueryPdpGroups 1 defaultGroup ACTIVE 0 null null null diff --git a/csit/xacml-pdp/tests/xacml-pdp-test.robot b/csit/xacml-pdp/tests/xacml-pdp-test.robot index c88959d0..c1bba0af 100644 --- a/csit/xacml-pdp/tests/xacml-pdp-test.robot +++ b/csit/xacml-pdp/tests/xacml-pdp-test.robot @@ -4,69 +4,80 @@ Library RequestsLibrary Library OperatingSystem Library Process Library json +Resource ${CURDIR}/../../common-library.robot *** Test Cases *** Healthcheck [Documentation] Verify policy xacml-pdp health check - ${resp}= PeformGetRequest /policy/pdpx/v1/healthcheck 200 + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/healthcheck 200 null Should Be Equal As Strings ${resp.json()['code']} 200 Statistics [Documentation] Verify policy xacml-pdp statistics - ${resp}= PeformGetRequest /policy/pdpx/v1/statistics 200 + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 +Metrics + [Documentation] Verify policy-xacml-pdp is exporting prometheus metrics + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /metrics 200 null + Should Contain ${resp.text} jvm_threads_current + MakeTopics [Documentation] Creates the Policy topics ${result}= Run Process ${SCR_DMAAP}/make_topic.sh POLICY-PDP-PAP Should Be Equal As Integers ${result.rc} 0 ExecuteXacmlPolicy - Wait Until Keyword Succeeds 1 min 15 sec CreateMonitorPolicy - Wait Until Keyword Succeeds 1 min 15 sec CreateOptimizationPolicy + CreateMonitorPolicy + CreateOptimizationPolicy Wait Until Keyword Succeeds 1 min 15 sec GetDefaultDecision - Wait Until Keyword Succeeds 1 min 15 sec DeployPolicies + DeployPolicies Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDeployed Wait Until Keyword Succeeds 1 min 15 sec GetAbbreviatedDecisionResult Wait Until Keyword Succeeds 1 min 15 sec GetMonitoringDecision Wait Until Keyword Succeeds 1 min 15 sec GetNamingDecision Wait Until Keyword Succeeds 1 min 15 sec GetOptimizationDecision Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDecision - Wait Until Keyword Succeeds 1 min 15 sec UndeployMonitorPolicy + UndeployMonitorPolicy Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterUndeploy *** Keywords *** CreateMonitorPolicy [Documentation] Create a Monitoring policy - CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 vCPE.policy.monitoring.input.tosca.json onap.restart.tca 1.0.0 + ${postjson}= Get file ${DATA2}/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 CreateOptimizationPolicy [Documentation] Create an Optimization policy - CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 vCPE.policies.optimization.input.tosca.json OSDF_CASABLANCA.Affinity_Default 1.0.0 + ${postjson}= Get file ${DATA2}/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 GetDefaultDecision - [Documentation] Get Default Decision with no policies in Xacml PDP - ${resp}= PerformPostRequest /policy/pdpx/v1/decision abbrev=true ${POLICY_PDPX_IP} 200 onap.policy.guard.decision.request.json ${CURDIR}/data + [Documentation] Get Default Decision with no policies in Xacml PDP + ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json + ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} abbrev=true ${status}= Get From Dictionary ${resp.json()} status Should Be Equal As Strings ${status} Permit DeployPolicies [Documentation] Runs Policy PAP to deploy a policy - ${resp}= PerformPostRequest /policy/pap/v1/pdps/policies null ${POLICY_PAP_IP} 202 vCPE.policy.input.tosca.deploy.json ${CURDIR}/data + ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json + PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP ... responseTo xacml ACTIVE onap.restart.tca Should Be Equal As Integers ${result.rc} 0 GetStatisticsAfterDeployed [Documentation] Verify policy xacml-pdp statistics after policy is deployed - ${resp}= PeformGetRequest /policy/pdpx/v1/statistics 200 + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 3 GetAbbreviatedDecisionResult - [Documentation] Get Decision with abbreviated results from Policy Xacml PDP - ${resp}= PerformPostRequest /policy/pdpx/v1/decision abbrev=true ${POLICY_PDPX_IP} 200 onap.policy.monitoring.decision.request.json ${CURDIR}/data + [Documentation] Get Decision with abbreviated results from Policy Xacml PDP + ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json + ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} abbrev=true ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca Dictionary Should Contain Key ${policy} type Dictionary Should Contain Key ${policy} metadata @@ -76,8 +87,9 @@ GetAbbreviatedDecisionResult Dictionary Should Not Contain Key ${policy} version GetMonitoringDecision - [Documentation] Get Decision from Monitoring Policy Xacml PDP - ${resp}= PerformPostRequest /policy/pdpx/v1/decision null ${POLICY_PDPX_IP} 200 onap.policy.monitoring.decision.request.json ${CURDIR}/data + [Documentation] Get Decision from Monitoring Policy Xacml PDP + ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json + ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca Dictionary Should Contain Key ${policy} type Dictionary Should Contain Key ${policy} metadata @@ -87,8 +99,9 @@ GetMonitoringDecision Dictionary Should Contain Key ${policy} version GetNamingDecision - [Documentation] Get Decision from Naming Policy Xacml PDP - ${resp}= PerformPostRequest /policy/pdpx/v1/decision null ${POLICY_PDPX_IP} 200 onap.policy.naming.decision.request.json ${CURDIR}/data + [Documentation] Get Decision from Naming Policy Xacml PDP + ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json + ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP Dictionary Should Contain Key ${policy} type Dictionary Should Contain Key ${policy} type_version @@ -96,8 +109,9 @@ GetNamingDecision Dictionary Should Contain Key ${policy} name GetOptimizationDecision - [Documentation] Get Decision from Optimization Policy Xacml PDP - ${resp}= PerformPostRequest /policy/pdpx/v1/decision null ${POLICY_PDPX_IP} 200 onap.policy.optimization.decision.request.json ${CURDIR}/data + [Documentation] Get Decision from Optimization Policy Xacml PDP + ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json + ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default Dictionary Should Contain Key ${policy} type Dictionary Should Contain Key ${policy} type_version @@ -106,54 +120,17 @@ GetOptimizationDecision GetStatisticsAfterDecision [Documentation] Runs Policy Xacml PDP Statistics after Decision request - ${resp}= PeformGetRequest /policy/pdpx/v1/statistics 200 + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 Should Be Equal As Strings ${resp.json()['permitDecisionsCount']} 4 Should Be Equal As Strings ${resp.json()['notApplicableDecisionsCount']} 1 UndeployMonitorPolicy [Documentation] Runs Policy PAP to undeploy a policy - PeformDeleteRequest /policy/pap/v1/pdps/policies/onap.restart.tca 202 + PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 GetStatisticsAfterUndeploy [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed - ${resp}= PeformGetRequest /policy/pdpx/v1/statistics 200 + ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null Should Be Equal As Strings ${resp.json()['code']} 200 Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 2 - -CreatePolicy - [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policyname} ${policyversion} - [Documentation] Create the specific policy - ${resp}= PerformPostRequest ${url} null ${POLICY_API_IP} ${expectedstatus} ${jsonfile} ${DATA2} - 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} - -PerformPostRequest - [Arguments] ${url} ${params} ${hostname} ${expectedstatus} ${jsonfile} ${filepath} - ${auth}= Create List healthcheck zb!XztG34 - ${postjson}= Get file ${filepath}/${jsonfile} - Log Creating session https://${hostname}:6969 - ${session}= Create Session policy https://${hostname}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformGetRequest - [Arguments] ${url} ${expectedstatus} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PDPX_IP}:6969 - ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= GET On Session policy ${url} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} - [return] ${resp} - -PeformDeleteRequest - [Arguments] ${url} ${expectedstatus} - ${auth}= Create List healthcheck zb!XztG34 - Log Creating session https://${POLICY_PAP_IP}:6969 - ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus} - Log Received response from policy ${resp.text} |