summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--robot/assets/policy/create_policy.json53
-rw-r--r--robot/assets/policy/deploy_policy.json8
-rw-r--r--robot/resources/policy_interface.robot65
-rw-r--r--robot/testsuites/health-check.robot8
4 files changed, 134 insertions, 0 deletions
diff --git a/robot/assets/policy/create_policy.json b/robot/assets/policy/create_policy.json
new file mode 100644
index 00000000..3198acac
--- /dev/null
+++ b/robot/assets/policy/create_policy.json
@@ -0,0 +1,53 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
+ "topology_template": {
+ "policies": [
+ {
+ "operational.modifyconfig": {
+ "type": "onap.policies.controlloop.operational.common.Drools",
+ "type_version": "1.0.0",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "operational.modifyconfig"
+ },
+ "properties": {
+ "id": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
+ "timeout": 1200,
+ "abatement": false,
+ "trigger": "unique-policy-id-1-modifyConfig",
+ "operations": [
+ {
+ "id": "unique-policy-id-1-modifyConfig",
+ "description": "Modify the packet generator",
+ "operation": {
+ "actor": "CDS",
+ "operation": "modify-config",
+ "target": {
+ "targetType": "VNF",
+ "entityIds": {
+ "resourceID": "37b008b9-b367-4359-93fd-74d3ce0ee1a0"
+ }
+ },
+ "payload": {
+ "artifact_name": "vFW-CDS",
+ "artifact_version": "1.0.0",
+ "data": "{\"active-streams\": \"7\"}"
+ }
+ },
+ "timeout": 300,
+ "retries": 0,
+ "success": "final_success",
+ "failure": "final_failure",
+ "failure_timeout": "final_failure_timeout",
+ "failure_retries": "final_failure_retries",
+ "failure_exception": "final_failure_exception",
+ "failure_guard": "final_failure_guard"
+ }
+ ],
+ "controllerName": "frankfurt"
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/robot/assets/policy/deploy_policy.json b/robot/assets/policy/deploy_policy.json
new file mode 100644
index 00000000..d81fc07b
--- /dev/null
+++ b/robot/assets/policy/deploy_policy.json
@@ -0,0 +1,8 @@
+{
+ "policies": [
+ {
+ "policy-id": "operational.modifyconfig",
+ "policy-version": "1.0.0"
+ }
+ ]
+}
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
diff --git a/robot/testsuites/health-check.robot b/robot/testsuites/health-check.robot
index 7e07b5c6..3aed94bb 100644
--- a/robot/testsuites/health-check.robot
+++ b/robot/testsuites/health-check.robot
@@ -136,6 +136,14 @@ Basic Policy Health Check
[Tags] health medium health-policy
Run Policy Health Check
+Enhanced Policy New Healthcheck
+ [Tags] health medium health-policy
+ Run Create Policy Post Request
+ Run Get Policy Get Request
+ Run Deploy Policy Pap Post Request
+ Run Undeploy Policy
+ Run Delete Policy Request
+
Basic Pomba AAI-context-builder Health Check
[Tags] oom health-pomba
Run Pomba Aai Context Builder Health Check