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 |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 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 |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 31 | Wait Until Keyword Succeeds 0 min 15 sec CreateMonitorPolicy |
| 32 | Wait Until Keyword Succeeds 0 min 15 sec CreateOptimizationPolicy |
| 33 | Wait Until Keyword Succeeds 0 min 15 sec GetDefaultDecision |
| 34 | Wait Until Keyword Succeeds 0 min 15 sec DeployPolicies |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 35 | Wait Until Keyword Succeeds 0 min 15 sec GetAbbreviatedDecisionResult |
| 36 | Wait Until Keyword Succeeds 0 min 15 sec GetMonitoringDecision |
| 37 | Wait Until Keyword Succeeds 0 min 15 sec GetNamingDecision |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 38 | Wait Until Keyword Succeeds 0 min 15 sec GetOptimizationDecision |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 39 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 40 | *** Keywords *** |
| 41 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 42 | CreateMonitorPolicy |
| 43 | [Documentation] Create a Monitoring policy |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 44 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 45 | ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 46 | Log Creating session https://${POLICY_API_IP}:6969 |
| 47 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 48 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 49 | ${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} |
| 50 | Log Received response from policy4 ${resp.text} |
| 51 | ${postjsonobject} To Json ${postjson} |
| 52 | Should Be Equal As Strings ${resp.status_code} 200 |
| 53 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 54 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 55 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 56 | CreateOptimizationPolicy |
| 57 | [Documentation] Create an Optimization policy |
| 58 | ${auth}= Create List healthcheck zb!XztG34 |
| 59 | ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json |
| 60 | Log Creating session https://${POLICY_API_IP}:6969 |
| 61 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 62 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 63 | ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies data=${postjson} headers=${headers} |
| 64 | Log Received response from policy4 ${resp.text} |
| 65 | ${postjsonobject} To Json ${postjson} |
| 66 | Should Be Equal As Strings ${resp.status_code} 200 |
| 67 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 68 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 69 | |
| 70 | DeployPolicies |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 71 | [Documentation] Runs Policy PAP to deploy a policy |
| 72 | ${auth}= Create List healthcheck zb!XztG34 |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 73 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 74 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 75 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 76 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 77 | ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${postjson} headers=${headers} |
| 78 | Log Received response from policy5 ${resp.text} |
| 79 | ${postjsonobject} To Json ${postjson} |
| 80 | Should Be Equal As Strings ${resp.status_code} 200 |
| 81 | |
| 82 | GetStatisticsAfterDeployed |
| 83 | [Documentation] Runs Policy Xacml PDP Statistics after policy is deployed |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 84 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 85 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 86 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 87 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 88 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 89 | Log Received response from policy ${resp.text} |
| 90 | Should Be Equal As Strings ${resp.status_code} 200 |
| 91 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 92 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 93 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 94 | GetDefaultDecision |
| 95 | [Documentation] Get Default Decision with no policies in Xacml PDP |
| 96 | ${auth}= Create List healthcheck zb!XztG34 |
| 97 | ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json |
| 98 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 99 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 100 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 101 | ${params}= Create Dictionary abbrev=true |
| 102 | ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers} |
| 103 | Log Received response from policy ${resp.text} |
| 104 | ${status}= Get From Dictionary ${resp.json()} status |
| 105 | Should Be Equal As Strings ${resp.status_code} 200 |
| 106 | Should Be Equal As Strings ${status} Permit |
| 107 | |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 108 | GetAbbreviatedDecisionResult |
| 109 | [Documentation] Get Decision with abbreviated results from Policy Xacml PDP |
| 110 | ${auth}= Create List healthcheck zb!XztG34 |
| 111 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 112 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 113 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 114 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 115 | ${params}= Create Dictionary abbrev=true |
| 116 | ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers} |
| 117 | Log Received response from policy ${resp.text} |
| 118 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
| 119 | Should Be Equal As Strings ${resp.status_code} 200 |
| 120 | Dictionary Should Contain Key ${policy} type |
| 121 | Dictionary Should Contain Key ${policy} metadata |
| 122 | Dictionary Should Not Contain Key ${policy} type_version |
| 123 | Dictionary Should Not Contain Key ${policy} properties |
| 124 | Dictionary Should Not Contain Key ${policy} name |
| 125 | Dictionary Should Not Contain Key ${policy} version |
| 126 | |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 127 | GetMonitoringDecision |
| 128 | [Documentation] Get Decision from Monitoring Policy Xacml PDP |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 129 | ${auth}= Create List healthcheck zb!XztG34 |
| 130 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json |
| 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}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 135 | Log Received response from policy ${resp.text} |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 136 | ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 137 | Should Be Equal As Strings ${resp.status_code} 200 |
HOCKLA | 2e519f5 | 2019-10-23 13:00:00 -0500 | [diff] [blame] | 138 | Dictionary Should Contain Key ${policy} type |
| 139 | Dictionary Should Contain Key ${policy} metadata |
| 140 | Dictionary Should Contain Key ${policy} type_version |
| 141 | Dictionary Should Contain Key ${policy} properties |
| 142 | Dictionary Should Contain Key ${policy} name |
| 143 | Dictionary Should Contain Key ${policy} version |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 144 | |
| 145 | GetNamingDecision |
| 146 | [Documentation] Get Decision from Naming Policy Xacml PDP |
| 147 | ${auth}= Create List healthcheck zb!XztG34 |
| 148 | ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json |
| 149 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 150 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 151 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 152 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 153 | Log Received response from policy ${resp.text} |
Jim Hahn | ddb4043 | 2020-04-29 11:14:31 -0400 | [diff] [blame^] | 154 | ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 155 | Should Be Equal As Strings ${resp.status_code} 200 |
| 156 | Dictionary Should Contain Key ${policy} type |
| 157 | Dictionary Should Contain Key ${policy} type_version |
| 158 | Dictionary Should Contain Key ${policy} properties |
| 159 | Dictionary Should Contain Key ${policy} name |
| 160 | |
Jim Hahn | 514799f | 2020-04-20 12:05:50 -0400 | [diff] [blame] | 161 | GetOptimizationDecision |
| 162 | [Documentation] Get Decision from Optimization Policy Xacml PDP |
| 163 | ${auth}= Create List healthcheck zb!XztG34 |
| 164 | ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json |
| 165 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 166 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 167 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 168 | ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers} |
| 169 | Log Received response from policy ${resp.text} |
| 170 | ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default |
| 171 | Should Be Equal As Strings ${resp.status_code} 200 |
| 172 | Dictionary Should Contain Key ${policy} type |
| 173 | Dictionary Should Contain Key ${policy} type_version |
| 174 | Dictionary Should Contain Key ${policy} properties |
| 175 | Dictionary Should Contain Key ${policy} name |
| 176 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 177 | GetStatisticsAfterDecision |
| 178 | [Documentation] Runs Policy Xacml PDP Statistics after Decision request |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 179 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 180 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 181 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 182 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 183 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 184 | Log Received response from policy ${resp.text} |
| 185 | Should Be Equal As Strings ${resp.status_code} 200 |
| 186 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 187 | Should Be Equal As Strings ${resp.json()['totalDecisionsCount'] 1 |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 188 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 189 | UndeployMonitorPolicy |
| 190 | [Documentation] Runs Policy PAP to undeploy a policy |
| 191 | ${auth}= Create List healthcheck zb!XztG34 |
| 192 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 193 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 194 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 195 | ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers} |
| 196 | Log Received response from policy ${resp.text} |
| 197 | Should Be Equal As Strings ${resp.status_code} 200 |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 198 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 199 | GetStatisticsAfterUndeploy |
| 200 | [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed |
Jim Hahn | 5785bf8 | 2020-04-16 18:32:27 -0400 | [diff] [blame] | 201 | ${auth}= Create List healthcheck zb!XztG34 |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame] | 202 | Log Creating session https://${POLICY_PDPX_IP}:6969 |
| 203 | ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth} |
| 204 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 205 | ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers} |
| 206 | Log Received response from policy ${resp.text} |
| 207 | Should Be Equal As Strings ${resp.status_code} 200 |
| 208 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 209 | Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 0 |