diff options
author | Michael Mokry <michael.mokry@att.com> | 2019-05-13 13:09:17 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-05-24 16:38:04 -0400 |
commit | b4f69621e134b308dcbc2c90075508fda872ca43 (patch) | |
tree | acabae76e3067091c4a5b5b816b1dc759ba28654 /tests/policy/xacml-pdp/xacml-pdp-test.robot | |
parent | db4c4a5f83b674d6c04f9e6f3355171b13d67fa4 (diff) |
Xacml-PDP CSIT tests with DmaaP Simulator
1. Added test cases for creating policy, deploying policy, and getting a
decision for monitoring policies
2. Included statistics check between some tests
3. Modified to use dmaap simulator, policy-pap, and policy-api for end
to end tests
5. UPDATE: made changes per Ajith's review
6. Removed most config overrides and changed dmaap to message-router
where appropriate
Change-Id: Ia9935193f189f249e11f23b2ffe49f87090b7b54
Issue-ID: POLICY-1767
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'tests/policy/xacml-pdp/xacml-pdp-test.robot')
-rw-r--r-- | tests/policy/xacml-pdp/xacml-pdp-test.robot | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/policy/xacml-pdp/xacml-pdp-test.robot b/tests/policy/xacml-pdp/xacml-pdp-test.robot index 1a626c03..86463c35 100644 --- a/tests/policy/xacml-pdp/xacml-pdp-test.robot +++ b/tests/policy/xacml-pdp/xacml-pdp-test.robot @@ -26,3 +26,110 @@ Statistics Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['code']} 200 + +ExecuteXacmlPolicy + Wait Until Keyword Succeeds 2 min 5 sec CreateMonitorPolicyType + Wait Until Keyword Succeeds 2 min 5 sec CreateNewMonitorPolicy + Wait Until Keyword Succeeds 2 min 5 sec DeployMonitorPolicy + Wait Until Keyword Succeeds 2 min 10 sec GetDecision + +*** Keywords *** + +CreateMonitorPolicyType + [Documentation] Create Monitoring Policy Type + ${auth}= Create List healthcheck zb!XztG34 + ${postjson}= Get file ${CURDIR}/data/onap.policies.monitoring.cdap.tca.hi.lo.app.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 data=${postjson} headers=${headers} + Log Received response from policy2 ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + ${postjsonobject} To Json ${postjson} + Dictionary Should Contain Key ${resp.json()} tosca_definitions_version + Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version + +CreateNewMonitorPolicy + [Documentation] Create a new Monitoring policy + ${auth}= Create List healthcheck zb!XztG34 + ${postjson}= Get file ${CURDIR}/data/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 + ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/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 + +DeployMonitorPolicy + [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 + 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 + ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${postjson} headers=${headers} + Log Received response from policy5 ${resp.text} + ${postjsonobject} To Json ${postjson} + Should Be Equal As Strings ${resp.status_code} 200 + +GetStatisticsAfterDeployed + [Documentation] Runs Policy Xacml PDP Statistics after policy is deployed + ${auth}= Create List healthcheck zb!XztG34 + 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}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['code']} 200 + Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1 + +GetDecision + [Documentation] Get Decision from Policy Xacml PDP + ${auth}= Create List healthcheck zb!XztG34 + ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.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} + Should Be Equal As Strings ${resp.status_code} 200 + +GetStatisticsAfterDecision + [Documentation] Runs Policy Xacml PDP Statistics after Decision request + ${auth}= Create List healthcheck zb!XztG34 + 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}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['code']} 200 + Should Be Equal As Strings ${resp.json()['totalDecisionsCount'] 1 + +UndeployMonitorPolicy + [Documentation] Runs Policy PAP to undeploy a policy + ${auth}= Create List healthcheck zb!XztG34 + 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 + ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +GetStatisticsAfterUndeploy + [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed + ${auth}= Create List healthcheck zb!XztG34 + 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}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['code']} 200 + Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 0 + + |