aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources
diff options
context:
space:
mode:
Diffstat (limited to 'robot/resources')
-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