diff options
author | Rommel Pawar <rommel.pawar@bell.ca> | 2022-01-19 08:51:16 -0800 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2022-02-16 15:36:15 +0000 |
commit | b6b943d4ef604e7e8430335928b499812a288788 (patch) | |
tree | 7157167dffd8a9211e650e33b1a330a6efb2aa52 /robot/resources | |
parent | 24bb6aeeb8b5758a9e30c0ea9a04952fc682090c (diff) |
Add cleanup of policy if existing in the beginning of the health check
Add policy cleanup in first if existing before policy health check execution
Issue-ID: POLICY-3887
Signed-off-by: Rommel Pawar <rommel.pawar@bell.ca>
Change-Id: I53443414ee71a79ac88c89fe2259f7ce8435780a
Diffstat (limited to 'robot/resources')
-rw-r--r-- | robot/resources/policy_interface.robot | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot index bfbd74e8..5a613abb 100644 --- a/robot/resources/policy_interface.robot +++ b/robot/resources/policy_interface.robot @@ -19,9 +19,15 @@ ${POLICY_PDPX_IP} ${GLOBAL_INJECTED_POLICY_PDPX_IP_ADDR} ${POLICY_ADMIN_USERNAME} ${GLOBAL_POLICY_ADMIN_USERNAME} ${POLICY_ADMIN_PASSWORD} ${GLOBAL_POLICY_ADMIN_PASSWORD} ${json_path_policy} /var/opt/ONAP/robot/assets/policy/ +${POLICY_STATE_FIELD} SUCCESS +${PDP_GROUP_NAME} defaultGroup +${POLICY_NAME} operational.modifyconfig +${POLICY_VERSION} 1.0.0 +${POLICY_TYPE} onap.policies.controlloop.operational.common.Drools +${POLICY_TYPE_VERSION} 1.0.0 ${POLICY_GET_POLICY_URI} /policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.modifyconfig/versions/1.0.0 ${POLICY_CREATE_POLICY_URI} /policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies - +${POLICY_PAP_STATUS_QUERY} /policy/pap/v1/policies/status/${PDP_GROUP_NAME}/${POLICY_NAME}/${POLICY_VERSION} *** Keywords *** @@ -244,3 +250,26 @@ Run Delete Policy Request Log Received response from policy ${resp.text} [Return] ${resp} Should Be Equal As Strings ${resp.status_code} 200 + +Run Policy Deployment Verification + [Documentation] Runs Get Request to validate if the policy is deployed. Also, it verify the policy name, version, pdp group name and policy state field. + ${auth}= Create List ${POLICY_ADMIN_USERNAME} ${POLICY_ADMIN_PASSWORD} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} + Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp_deployed_policy}= Get Request policy ${POLICY_PAP_STATUS_QUERY} headers=${headers} + Log Received response from policy status ${resp_deployed_policy.text} + Return From Keyword If ${resp_deployed_policy.status_code}==404 + Should Be Equal As Strings ${resp_deployed_policy.status_code} 200 + ${resp_deployed_policy_string}= Convert to string ${resp_deployed_policy.content} + ${resp_deployed_policy_flag}= Run Keyword And Return Status Should Contain ${resp_deployed_policy_string} ${POLICY_NAME} ${POLICY_VERSION} ${PDP_GROUP_NAME} ${POLICY_STATE_FIELD} + [Return] ${resp_deployed_policy_flag} + +Check for Existing Policy and Clean up + [Documentation] Policy not created then exit this method. If policy is created only then run Delete request with policy name. If policy created and deployed then run undeploy and then delete policy. + ${resp_policy_created}= Run Get Policy Get Request + Return From Keyword If ${resp_policy_created.status_code}==404 + Should Be Equal As Strings ${resp_policy_created.status_code} 200 + ${resp_policy_deployed}= Run Policy Deployment Verification + Run Keyword If ${resp_policy_deployed}==True Run Undeploy Policy + Run Delete Policy Request
\ No newline at end of file |