Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Test Cases *** |
| 8 | Healthcheck |
| 9 | [Documentation] Runs Policy Xacml PDP Health check |
| 10 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | ed8bae5 | 2019-03-12 15:10:53 -0500 | [diff] [blame] | 11 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 12 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 13 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 14 | ${resp}= Get Request policy /policy/pdpx/v1/healthcheck headers=${headers} |
| 15 | Log Received response from policy ${resp.text} |
| 16 | Should Be Equal As Strings ${resp.status_code} 200 |
| 17 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 18 | |
| 19 | Statistics |
| 20 | [Documentation] Runs Policy Xacml PDP Statistics |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 21 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | ed8bae5 | 2019-03-12 15:10:53 -0500 | [diff] [blame] | 22 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 23 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 24 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 25 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 26 | Log Received response from policy ${resp.text} |
| 27 | Should Be Equal As Strings ${resp.status_code} 200 |
| 28 | Should Be Equal As Strings ${resp.json()['code']} 200 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 29 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 30 | ExecuteXacmlPolicy |
| 31 | Wait Until Keyword Succeeds 2 min 5 sec CreateMonitorPolicyType |
| 32 | Wait Until Keyword Succeeds 2 min 5 sec CreateNewMonitorPolicy |
| 33 | Wait Until Keyword Succeeds 2 min 5 sec DeployMonitorPolicy |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 34 | Wait Until Keyword Succeeds 2 min 10 sec GetAbbreviatedDecisionResult |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 35 | Wait Until Keyword Succeeds 2 min 10 sec GetDecision |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 36 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 37 | *** Keywords *** |
| 38 | |
| 39 | CreateMonitorPolicyType |
| 40 | [Documentation] Create Monitoring Policy Type |
| 41 | ${auth}= Create List healthcheck zb!XztG34 |
| 42 | ${postjson}= Get file ${CURDIR}/data/onap.policies.monitoring.cdap.tca.hi.lo.app.json |
| 43 | Log Creating session https://${POLICY_API_IP}:6969 |
| 44 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 45 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 46 | ${resp}= Post Request policy /policy/api/v1/policytypes data=${postjson} headers=${headers} |
| 47 | Log Received response from policy2 ${resp.text} |
| 48 | Should Be Equal As Strings ${resp.status_code} 200 |
| 49 | ${postjsonobject} To Json ${postjson} |
| 50 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 51 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 52 | |
| 53 | CreateNewMonitorPolicy |
| 54 | [Documentation] Create a new Monitoring policy |
| 55 | ${auth}= Create List healthcheck zb!XztG34 |
| 56 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json |
| 57 | Log Creating session https://${POLICY_API_IP}:6969 |
| 58 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 59 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 60 | ${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} |
| 61 | Log Received response from policy4 ${resp.text} |
| 62 | ${postjsonobject} To Json ${postjson} |
| 63 | Should Be Equal As Strings ${resp.status_code} 200 |
| 64 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 65 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 66 | |
| 67 | DeployMonitorPolicy |
| 68 | [Documentation] Runs Policy PAP to deploy a policy |
| 69 | ${auth}= Create List healthcheck zb!XztG34 |
| 70 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.deploy.json |
| 71 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 72 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 73 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 74 | ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${postjson} headers=${headers} |
| 75 | Log Received response from policy5 ${resp.text} |
| 76 | ${postjsonobject} To Json ${postjson} |
| 77 | Should Be Equal As Strings ${resp.status_code} 200 |
| 78 | |
| 79 | GetStatisticsAfterDeployed |
| 80 | [Documentation] Runs Policy Xacml PDP Statistics after policy is deployed |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 81 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 82 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 83 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 84 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 85 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 86 | Log Received response from policy ${resp.text} |
| 87 | Should Be Equal As Strings ${resp.status_code} 200 |
| 88 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 89 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 90 | |
| 91 | GetAbbreviatedDecisionResult |
| 92 | [Documentation] Get Decision with abbreviated results from Policy Xacml PDP |
| 93 | ${auth}= Create List healthcheck zb!XztG34 |
| 94 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 95 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 96 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 97 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 98 | ${params}= Create Dictionary abbrev=true |
| 99 | ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers} |
| 100 | Log Received response from policy ${resp.text} |
| 101 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
| 102 | Should Be Equal As Strings ${resp.status_code} 200 |
| 103 | Dictionary Should Contain Key ${policy} type |
| 104 | Dictionary Should Contain Key ${policy} metadata |
| 105 | Dictionary Should Not Contain Key ${policy} type_version |
| 106 | Dictionary Should Not Contain Key ${policy} properties |
| 107 | Dictionary Should Not Contain Key ${policy} name |
| 108 | Dictionary Should Not Contain Key ${policy} version |
| 109 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 110 | GetDecision |
| 111 | [Documentation] Get Decision from Policy Xacml PDP |
| 112 | ${auth}= Create List healthcheck zb!XztG34 |
| 113 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 114 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 115 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 116 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 117 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 118 | Log Received response from policy ${resp.text} |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 119 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 120 | Should Be Equal As Strings ${resp.status_code} 200 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame^] | 121 | Dictionary Should Contain Key ${policy} type |
| 122 | Dictionary Should Contain Key ${policy} metadata |
| 123 | Dictionary Should Contain Key ${policy} type_version |
| 124 | Dictionary Should Contain Key ${policy} properties |
| 125 | Dictionary Should Contain Key ${policy} name |
| 126 | Dictionary Should Contain Key ${policy} version |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 127 | |
| 128 | GetStatisticsAfterDecision |
| 129 | [Documentation] Runs Policy Xacml PDP Statistics after Decision request |
| 130 | ${auth}= Create List healthcheck zb!XztG34 |
| 131 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 132 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 133 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 134 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 135 | Log Received response from policy ${resp.text} |
| 136 | Should Be Equal As Strings ${resp.status_code} 200 |
| 137 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 138 | Should Be Equal As Strings ${resp.json()['totalDecisionsCount'] 1 |
| 139 | |
| 140 | UndeployMonitorPolicy |
| 141 | [Documentation] Runs Policy PAP to undeploy a policy |
| 142 | ${auth}= Create List healthcheck zb!XztG34 |
| 143 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 144 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 145 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 146 | ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers} |
| 147 | Log Received response from policy ${resp.text} |
| 148 | Should Be Equal As Strings ${resp.status_code} 200 |
| 149 | |
| 150 | GetStatisticsAfterUndeploy |
| 151 | [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed |
| 152 | ${auth}= Create List healthcheck zb!XztG34 |
| 153 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 154 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 155 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 156 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 157 | Log Received response from policy ${resp.text} |
| 158 | Should Be Equal As Strings ${resp.status_code} 200 |
| 159 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 160 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 0 |
| 161 | |
| 162 | |