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