DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 3 | Library RequestsLibrary |
| 4 | Library String |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 5 | Library Collections |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 6 | Library SSHLibrary |
| 7 | Library OperatingSystem |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 8 | Library ONAPLibrary.Templating |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 9 | Resource global_properties.robot |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 10 | Resource ssh/files.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 11 | |
| 12 | *** Variables *** |
| 13 | ${POLICY_HEALTH_CHECK_PATH} /healthcheck |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 14 | ${POLICY_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_POLICY_SERVER_PORT} |
Gary Wu | 251aa68 | 2018-07-30 15:22:20 -0700 | [diff] [blame] | 15 | ${POLICY_HEALTHCHECK_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_HEALTHCHECK_IP_ADDR}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 16 | ${POLICY_TEMPLATES} policy |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 17 | ${DROOLS_ENDPOINT} ${GLOBAL_POLICY_SERVER_PROTOCOL}://${GLOBAL_INJECTED_POLICY_IP_ADDR}:${GLOBAL_DROOLS_SERVER_PORT} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 18 | ${POLICY_API_IP} ${GLOBAL_INJECTED_POLICY_API_IP_ADDR} |
| 19 | ${POLICY_PAP_IP} ${GLOBAL_INJECTED_POLICY_PAP_IP_ADDR} |
| 20 | ${POLICY_DISTRIBUTION_IP} ${GLOBAL_INJECTED_POLICY_DISTRIBUTION_IP_ADDR} |
| 21 | ${POLICY_PDPX_IP} ${GLOBAL_INJECTED_POLICY_PDPX_IP_ADDR} |
| 22 | ${POLICY_APEX_PDP_IP} ${GLOBAL_INJECTED_POLICY_APEX_PDP_IP_ADDR} |
| 23 | ${POLICY_HEALTHCHECK_USERNAME} ${GLOBAL_POLICY_HEALTHCHECK_USERNAME} |
| 24 | ${POLICY_HEALTHCHECK_PASSWORD} ${GLOBAL_POLICY_HEALTHCHECK_PASSWORD} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 25 | |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame] | 26 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 27 | *** Keywords *** |
| 28 | |
| 29 | Run Policy Health Check |
| 30 | [Documentation] Runs Policy Health check |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 31 | ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 32 | Log Creating session ${POLICY_ENDPOINT} |
| 33 | ${session}= Create Session policy ${POLICY_HEALTHCHECK_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 34 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 35 | ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} |
| 36 | Log Received response from policy ${resp.text} |
| 37 | Should Be Equal As Strings ${resp.status_code} 200 |
| 38 | Should Be True ${resp.json()['healthy']} |
| 39 | @{ITEMS}= Copy List ${resp.json()['details']} |
| 40 | :FOR ${ELEMENT} IN @{ITEMS} |
| 41 | \ Should Be Equal As Strings ${ELEMENT['code']} 200 |
| 42 | \ Should Be True ${ELEMENT['healthy']} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 43 | |
Brian Freeman | d65e2aa | 2018-07-26 11:13:46 -0500 | [diff] [blame] | 44 | Run Drools Get Request |
| 45 | [Documentation] Runs Drools Get Request |
| 46 | [Arguments] ${data_path} |
| 47 | ${auth}= Create List ${GLOBAL_DROOLS_USERNAME} ${GLOBAL_DROOLS_PASSWORD} |
| 48 | Log Creating session ${POLICY_ENDPOINT} |
| 49 | ${session}= Create Session policy ${DROOLS_ENDPOINT} auth=${auth} |
| 50 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 51 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 52 | Log Received response from policy ${resp.text} |
| 53 | Should Be Equal As Strings ${resp.status_code} 200 |
| 54 | [Return] ${resp} |
| 55 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 56 | Run Policy Put Request |
| 57 | [Documentation] Runs Policy Put request |
| 58 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 59 | Log Creating session ${POLICY_ENDPOINT} |
| 60 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 61 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 62 | ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} |
| 63 | Log Received response from policy ${resp.text} |
| 64 | [Return] ${resp} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 65 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 66 | Run Policy Get Request |
| 67 | [Documentation] Runs Policy Get request |
| 68 | [Arguments] ${data_path} |
| 69 | Log Creating session ${POLICY_ENDPOINT} |
| 70 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
| 71 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 72 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 73 | Log Received response from policy ${resp.text} |
| 74 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 75 | Run Policy Pap Get Request |
| 76 | [Documentation] Runs Policy Pap Get request |
| 77 | [Arguments] ${data_path} |
| 78 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 79 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 80 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 81 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 82 | ${resp}= Get Request policy ${data_path} headers=${headers} |
| 83 | Log Received response from Policy Pap ${resp.text} |
| 84 | [Return] ${resp} |
| 85 | |
| 86 | |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 87 | Run Policy Post Request |
| 88 | [Documentation] Runs Policy Post request |
| 89 | [Arguments] ${data_path} ${data} |
| 90 | Log Creating session ${POLICY_ENDPOINT} |
| 91 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
| 92 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 93 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 94 | Log Received response from policy ${resp.text} |
| 95 | [Return] ${resp} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 96 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 97 | Run Policy Api Post Request |
| 98 | [Documentation] Runs Policy Api Post request |
| 99 | [Arguments] ${data_path} ${data} |
| 100 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 101 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 102 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 103 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 104 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 105 | Log Received response from policy ${resp.text} |
| 106 | [Return] ${resp} |
| 107 | |
| 108 | |
| 109 | Run Policy Pap Post Request |
| 110 | [Documentation] Runs Policy Pap Post request |
| 111 | [Arguments] ${data_path} ${data} |
| 112 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 113 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 114 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 115 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 116 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 117 | Log Received response from policy ${resp.text} |
| 118 | [Return] ${resp} |
| 119 | |
| 120 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 121 | Run Policy Delete Request |
| 122 | [Documentation] Runs Policy Delete request |
| 123 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 124 | Log Creating session ${POLICY_ENDPOINT} |
| 125 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 126 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST |
| 127 | ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} |
| 128 | Log Received response from policy ${resp.text} |
| 129 | [Return] ${resp} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 130 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 131 | Run Policy Get Configs Request |
| 132 | [Documentation] Runs Policy Get Configs request |
| 133 | [Arguments] ${data_path} ${data} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 134 | Log Creating session ${POLICY_ENDPOINT} |
| 135 | ${session}= Create Session policy ${POLICY_ENDPOINT} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 136 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 137 | ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} |
| 138 | Log Received response from policy ${resp.text} |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 139 | [Return] ${resp} |
| 140 | |
| 141 | |
| 142 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 143 | Update vVFWCL Policy Old |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 144 | [Arguments] ${resource_id} |
Brian Freeman | ca5e32e | 2018-07-23 12:47:21 -0500 | [diff] [blame] | 145 | Run Keyword and Ignore Error Delete vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 146 | Sleep 20s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 147 | Log Create vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 148 | Create vFWCL Policy ${resource_id} |
| 149 | Sleep 5s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 150 | Log Push vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 151 | Push vFWCL Policy |
| 152 | Sleep 20s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 153 | Log Reboot Drools |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 154 | Reboot Drools |
| 155 | Sleep 20s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 156 | Log Validate vFWCL Policy |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 157 | Validate the vFWCL Policy Old |
| 158 | |
| 159 | Update vVFWCL Policy |
Brian Freeman | 0d866b5 | 2019-05-08 20:30:14 -0500 | [diff] [blame] | 160 | [Arguments] ${resource_id} |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 161 | Log Create vFWCL Monitoring Policy |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 162 | Create vFirewall Monitoring Policy |
| 163 | Sleep 5s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 164 | Log Create vFWCL Operational Policy |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 165 | ${op_policy_version}= Create vFirewall Operational Policy ${resource_id} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 166 | Sleep 5s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 167 | Log Push vFWCL To PDP Group |
Brian Freeman | 7594828 | 2019-05-14 20:44:46 -0500 | [diff] [blame] | 168 | Push vFirewall Policies To PDP Group ${op_policy_version} |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 169 | Sleep 20s |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 170 | Log Validate vFWCL Policy |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 171 | Validate the vFWCL Policy |
| 172 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 173 | |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 174 | Delete vFWCL Policy |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 175 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 176 | ${dict}= Create Dictionary policyName=com.BRMSParamvFirewall |
| 177 | ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_delete.jinja ${dict} |
| 178 | ${resp}= Run Policy Delete Request /pdp/api/deletePolicy ${data} |
| 179 | Should Be Equal As Strings ${resp.status_code} 200 |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 180 | |
| 181 | Create vFWCL Policy |
| 182 | [Arguments] ${resource_id} |
| 183 | ${dict}= Create Dictionary RESOURCE_ID=${resource_id} |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 184 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 185 | ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_update.jinja ${dict} |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 186 | ${resp}= Run Policy Put Request /pdp/api/updatePolicy ${data} |
| 187 | Should Be Equal As Strings ${resp.status_code} 200 |
| 188 | |
| 189 | Push vFWCL Policy |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 190 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 191 | ${dict}= Create Dictionary |
| 192 | ${data}= Apply Template policy ${POLICY_TEMPLATES}/FirewallPolicy_push.jinja ${dict} |
| 193 | ${resp}= Run Policy Put Request /pdp/api/pushPolicy ${data} |
| 194 | Should Be Equal As Strings ${resp.status_code} 200 |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 195 | |
| 196 | Reboot Drools |
| 197 | ${stop}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy stop" |
| 198 | ${start}= Catenate docker exec -t -u policy drools bash -c "source /opt/app/policy/etc/profile.d/env.sh; policy start" |
| 199 | Wait Until Keyword Succeeds 120 5 sec Open Connection And Log In ${GLOBAL_INJECTED_POLICY_IP_ADDR} root ${GLOBAL_VM_PRIVATE_KEY} |
| 200 | Write ${stop} |
| 201 | ${status} ${stdout}= Run Keyword And Ignore Error SSHLibrary.Read Until Regexp has stopped |
| 202 | Log ${status}: stdout=${stdout} |
| 203 | ${ctrlc}= Evaluate '\x03' |
| 204 | Run Keyword If '${status}' == 'FAIL' Write ${ctrlc} |
| 205 | Sleep 5s |
| 206 | Write ${start} |
| 207 | ${stdout}= SSHLibrary.Read Until Regexp is running |
| 208 | Log stdout=${stdout} |
| 209 | Should Contain ${stdout} is running |
| 210 | |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 211 | Validate the vFWCL Policy Old |
Gary Wu | 76bc74f | 2018-03-22 13:25:49 -0700 | [diff] [blame] | 212 | ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools |
| 213 | Should Be Equal As Strings ${resp.status_code} 200 |
| 214 | ${resp}= Run Drools Get Request /policy/pdp/engine/controllers/amsterdam/drools/facts/closedloop-amsterdam/org.onap.policy.controlloop.Params |
| 215 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 216 | |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 217 | Validate the vFWCL Policy |
| 218 | ${resp}= Run Policy Pap Get Request /policy/pap/v1/pdps |
Brian Freeman | c967dd6 | 2019-04-30 09:47:44 -0500 | [diff] [blame] | 219 | Log Received response from policy ${resp.text} |
| 220 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 221 | |
| 222 | Create vFirewall Monitoring Policy |
| 223 | ${dict}= Create Dictionary |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 224 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 225 | ${data}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_policy_monitoring_input_tosca.jinja ${dict} |
Brian Freeman | 55b96e2 | 2019-05-08 20:49:45 -0500 | [diff] [blame] | 226 | ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies ${data} |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 227 | Should Be Equal As Strings ${resp.status_code} 200 |
| 228 | |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame] | 229 | Create vFirewall Operational Policy |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 230 | [Arguments] ${resource_id} |
| 231 | ${dict}= Create Dictionary RESOURCE_ID=${resource_id} |
| 232 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 233 | ${content_data} OperatingSystem.Get File ${POLICY_TEMPLATES}/vFirewall_policy_operational_content.yaml |
| 234 | ${content_data}= Replace String Using Regexp ${content_data} __RESOURCE_ID__ ${resource_id} |
| 235 | ${encoded_content_data}= Evaluate urllib.quote_plus('''${content_data}''') urllib |
| 236 | ${content_dictionary}= Create Dictionary URL_ENCODED_CONTENT ${encoded_content_data} |
| 237 | ${data_2}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_policy_operational_url_enc_content_input.jinja ${content_dictionary} |
DR695H | 8e7028b | 2019-07-10 10:13:58 -0400 | [diff] [blame^] | 238 | Log ${data_2} |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 239 | ${resp}= Run Policy Api Post Request /policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies ${data_2} |
| 240 | Should Be Equal As Strings ${resp.status_code} 200 |
| 241 | [Return] ${resp.json()['policy-version']} |
Brian Freeman | 88fbb99 | 2019-05-17 17:46:56 -0500 | [diff] [blame] | 242 | |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 243 | Push vFirewall Policies To PDP Group |
DR695H | 3440942 | 2019-06-20 10:56:46 -0400 | [diff] [blame] | 244 | [Arguments] ${op_policy_version} |
| 245 | ${dict}= Create Dictionary OP_POLICY_VERSION=${op_policy_version} |
| 246 | Create Environment policy ${GLOBAL_TEMPLATE_FOLDER} |
| 247 | ${data}= Apply Template policy ${POLICY_TEMPLATES}/vFirewall_push.jinja ${dict} |
| 248 | ${resp}= Run Policy Pap Post Request /policy/pap/v1/pdps/policies ${data} |
| 249 | Should Be Equal As Strings ${resp.status_code} 200 |
Brian Freeman | e14d257 | 2019-04-29 16:20:21 -0500 | [diff] [blame] | 250 | |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 251 | Run Policy API Healthcheck |
| 252 | [Documentation] Runs Policy Api Health check |
| 253 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 254 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 255 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 256 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 257 | ${resp}= Get Request policy /policy/api/v1/healthcheck headers=${headers} |
| 258 | Log Received response from policy ${resp.text} |
| 259 | Should Be Equal As Strings ${resp.status_code} 200 |
| 260 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 261 | |
| 262 | Run Policy PAP Healthcheck |
| 263 | [Documentation] Runs Policy PAP Health check |
| 264 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 265 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 266 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 267 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 268 | ${resp}= Get Request policy /policy/pap/v1/healthcheck headers=${headers} |
| 269 | Log Received response from policy ${resp.text} |
| 270 | Should Be Equal As Strings ${resp.status_code} 200 |
| 271 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 272 | |
| 273 | Run Policy Distribution Healthcheck |
| 274 | [Documentation] Runs Policy Distribution Health check |
| 275 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 276 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_DISTRIBUTION_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 277 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_DISTRIBUTION_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 278 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 279 | ${resp}= Get Request policy /healthcheck headers=${headers} |
| 280 | Log Received response from policy ${resp.text} |
| 281 | Should Be Equal As Strings ${resp.status_code} 200 |
| 282 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 283 | |
| 284 | Run Policy XACML PDP Healthcheck |
| 285 | [Documentation] Runs Policy Xacml PDP Health check |
| 286 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 287 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PDPX_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
| 288 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PDPX_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
| 289 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 290 | ${resp}= Get Request policy /policy/pdpx/v1/healthcheck headers=${headers} |
| 291 | Log Received response from policy ${resp.text} |
| 292 | Should Be Equal As Strings ${resp.status_code} 200 |
| 293 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 294 | |
| 295 | Run Policy APEX PDP Healthcheck |
| 296 | [Documentation] Runs Policy Apex PDP Health check |
| 297 | ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} |
| 298 | Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_APEX_PDP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} |
Sylvain Desbureaux | 2e33ff6 | 2019-05-15 14:41:18 +0200 | [diff] [blame] | 299 | ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_APEX_PDP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} |
Bilal A | 461aa5b | 2019-05-06 14:00:57 -0400 | [diff] [blame] | 300 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 301 | ${resp}= Get Request policy /policy/apex-pdp/v1/healthcheck headers=${headers} |
| 302 | Log Received response from policy ${resp.text} |
| 303 | Should Be Equal As Strings ${resp.status_code} 200 |
| 304 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 305 | |