aboutsummaryrefslogtreecommitdiffstats
path: root/tests/policy/xacml-pdp/xacml-pdp-test.robot
diff options
context:
space:
mode:
Diffstat (limited to 'tests/policy/xacml-pdp/xacml-pdp-test.robot')
-rw-r--r--tests/policy/xacml-pdp/xacml-pdp-test.robot61
1 files changed, 54 insertions, 7 deletions
diff --git a/tests/policy/xacml-pdp/xacml-pdp-test.robot b/tests/policy/xacml-pdp/xacml-pdp-test.robot
index 5144f966..931c77b5 100644
--- a/tests/policy/xacml-pdp/xacml-pdp-test.robot
+++ b/tests/policy/xacml-pdp/xacml-pdp-test.robot
@@ -28,18 +28,21 @@ Statistics
Should Be Equal As Strings ${resp.json()['code']} 200
ExecuteXacmlPolicy
- Wait Until Keyword Succeeds 0 min 15 sec CreateNewMonitorPolicy
- Wait Until Keyword Succeeds 0 min 15 sec DeployMonitorPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec CreateMonitorPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec CreateOptimizationPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec GetDefaultDecision
+ Wait Until Keyword Succeeds 0 min 15 sec DeployPolicies
Wait Until Keyword Succeeds 0 min 15 sec GetAbbreviatedDecisionResult
Wait Until Keyword Succeeds 0 min 15 sec GetMonitoringDecision
Wait Until Keyword Succeeds 0 min 15 sec GetNamingDecision
+ Wait Until Keyword Succeeds 0 min 15 sec GetOptimizationDecision
*** Keywords ***
-CreateNewMonitorPolicy
- [Documentation] Create a new Monitoring policy
+CreateMonitorPolicy
+ [Documentation] Create a Monitoring policy
${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json
+ ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.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
@@ -50,10 +53,24 @@ CreateNewMonitorPolicy
Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
-DeployMonitorPolicy
+CreateOptimizationPolicy
+ [Documentation] Create an Optimization policy
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.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 Request policy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies data=${postjson} headers=${headers}
+ Log Received response from policy4 ${resp.text}
+ ${postjsonobject} To Json ${postjson}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
+ Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
+
+DeployPolicies
[Documentation] Runs Policy PAP to deploy a policy
${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.deploy.json
+ ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.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
@@ -74,6 +91,20 @@ GetStatisticsAfterDeployed
Should Be Equal As Strings ${resp.json()['code']} 200
Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1
+GetDefaultDecision
+ [Documentation] Get Default Decision with no policies in Xacml PDP
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json
+ 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
+ ${params}= Create Dictionary abbrev=true
+ ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers}
+ Log Received response from policy ${resp.text}
+ ${status}= Get From Dictionary ${resp.json()} status
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${status} Permit
+
GetAbbreviatedDecisionResult
[Documentation] Get Decision with abbreviated results from Policy Xacml PDP
${auth}= Create List healthcheck zb!XztG34
@@ -127,6 +158,22 @@ GetNamingDecision
Dictionary Should Contain Key ${policy} properties
Dictionary Should Contain Key ${policy} name
+GetOptimizationDecision
+ [Documentation] Get Decision from Optimization Policy Xacml PDP
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json
+ 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}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers}
+ Log Received response from policy ${resp.text}
+ ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default
+ Should Be Equal As Strings ${resp.status_code} 200
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} type_version
+ Dictionary Should Contain Key ${policy} properties
+ Dictionary Should Contain Key ${policy} name
+
GetStatisticsAfterDecision
[Documentation] Runs Policy Xacml PDP Statistics after Decision request
${auth}= Create List healthcheck zb!XztG34