aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/policy_interface.robot
diff options
context:
space:
mode:
authorNagendra90287 <nagendrakumar.pal@amdocs.com>2020-09-04 15:44:45 +0530
committermrichomme <morgan.richomme@orange.com>2020-09-07 17:30:41 +0200
commit0488953f3d34332e1611025581abf971d18895bf (patch)
treef0e632093135c9c2f88decae44bfe111a4759796 /robot/resources/policy_interface.robot
parent8e871a6a34329b893128cb994d44def27abe0b6e (diff)
Improved Policy Health Check
Issue-ID: POLICY-2817 Change-Id: I699ca39e9a739a2da64401493ad2c0a724620e60 Signed-off-by: Nagendra90287 <nagendrakumar.pal@amdocs.com> Change-Id: I2972ea2711f621cd1d9d12ace1e83178b0ea3270 Signed-off-by: Nagendra90287 <nagendrakumar.pal@amdocs.com> Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'robot/resources/policy_interface.robot')
-rw-r--r--robot/resources/policy_interface.robot65
1 files changed, 65 insertions, 0 deletions
diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot
index 3e6048b1..11ff7c5a 100644
--- a/robot/resources/policy_interface.robot
+++ b/robot/resources/policy_interface.robot
@@ -18,6 +18,9 @@ ${POLICY_PAP_IP} ${GLOBAL_INJECTED_POLICY_PAP_IP_ADDR}
${POLICY_PDPX_IP} ${GLOBAL_INJECTED_POLICY_PDPX_IP_ADDR}
${POLICY_HEALTHCHECK_USERNAME} ${GLOBAL_POLICY_HEALTHCHECK_USERNAME}
${POLICY_HEALTHCHECK_PASSWORD} ${GLOBAL_POLICY_HEALTHCHECK_PASSWORD}
+${json_path_policy} /var/opt/ONAP/robot/assets/policy/
+${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
*** Keywords ***
@@ -121,3 +124,65 @@ Push vFirewall Policies To PDP Group
${data}= Templating.Apply Template policy ${POLICY_TEMPLATES}/vFirewall_push.jinja ${dict}
${resp}= Run Policy Pap Post Request /policy/pap/v1/pdps/policies ${data}
Should Be Equal As Strings ${resp.status_code} 200
+
+Run Create Policy Post Request
+ [Documentation] Runs Create Policy Post request
+ #[Arguments] ${data}
+ ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD}
+ ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth}
+ Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${json_policy} Get Binary File ${json_path_policy}create_policy.json
+ ${resp}= Post Request policy ${POLICY_CREATE_POLICY_URI} data=${json_policy} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Run Get Policy Get Request
+ [Documentation] Runs Get Policy request
+ #[Arguments] ${data}
+ ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD}
+ ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth}
+ Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy ${POLICY_GET_POLICY_URI} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Run Deploy Policy Pap Post Request
+ [Documentation] Runs Deploy Policy Pap Post request
+ #[Arguments] ${data_path} ${data}
+ ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_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
+ ${json_deploy} Get Binary File ${json_path_policy}deploy_policy.json
+ ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${json_deploy} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Run Undeploy Policy
+ [Documentation] Runs Policy PAP Undeploy a Policy from PDP Groups
+ #[Arguments] ${policy_name}
+ ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_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}= Delete Request policy /policy/pap/v1/pdps/policies/operational.modifyconfig headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+
+Run Delete Policy Request
+ [Documentation] Runs Policy Delete request
+ #[Arguments] ${data_path} ${data}
+ Log Creating session ${POLICY_ENDPOINT}
+ ${session}= Create Session policy ${POLICY_ENDPOINT}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY
+_CLIENTAUTH}
+ ${resp}= Delete Request policy ${POLICY_GET_POLICY_URI} headers=${headers}
+ Log Received response from policy ${resp.text}
+ [Return] ${resp}
+ Should Be Equal As Strings ${resp.status_code} 200