Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Test Cases *** |
| 8 | |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 9 | Healthcheck |
| 10 | [Documentation] Runs Apex PDP Health check |
| 11 | ${auth}= Create List healthcheck zb!XztG34 |
| 12 | Log Creating session https://${APEX_IP}:6969 |
| 13 | ${session}= Create Session policy https://${APEX_IP}:6969 auth=${auth} |
| 14 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 15 | ${resp}= Get Request policy /policy/apex-pdp/v1/healthcheck headers=${headers} |
| 16 | Log Received response from policy1 ${resp.text} |
| 17 | Should Be Equal As Strings ${resp.status_code} 200 |
| 18 | Should Be Equal As Strings ${resp.json()['code']} 200 |
| 19 | |
| 20 | ExecuteApexPolicy |
Ram Krishna Verma | 6bddbf3 | 2020-05-04 15:40:59 -0400 | [diff] [blame] | 21 | Wait Until Keyword Succeeds 2 min 5 sec CreatePolicy |
| 22 | Wait Until Keyword Succeeds 2 min 5 sec DeployPolicy |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 23 | Wait Until Keyword Succeeds 4 min 10 sec RunEventOnApexEngine |
| 24 | |
| 25 | *** Keywords *** |
| 26 | |
Ram Krishna Verma | 6bddbf3 | 2020-05-04 15:40:59 -0400 | [diff] [blame] | 27 | CreatePolicy |
| 28 | [Documentation] Create a new Apex policy |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 29 | ${auth}= Create List healthcheck zb!XztG34 |
Ram Krishna Verma | 6bddbf3 | 2020-05-04 15:40:59 -0400 | [diff] [blame] | 30 | ${postjson}= Get file ${CURDIR}/data/onap.policies.native.Apex.tosca.json |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 31 | Log Creating session https://${POLICY_API_IP}:6969 |
| 32 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 33 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Ram Krishna Verma | 6bddbf3 | 2020-05-04 15:40:59 -0400 | [diff] [blame] | 34 | ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies data=${postjson} headers=${headers} |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 35 | Log Received response from policy4 ${resp.text} |
| 36 | ${postjsonobject} To Json ${postjson} |
| 37 | Should Be Equal As Strings ${resp.status_code} 200 |
| 38 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 39 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 40 | |
Ram Krishna Verma | 6bddbf3 | 2020-05-04 15:40:59 -0400 | [diff] [blame] | 41 | DeployPolicy |
| 42 | [Documentation] Deploy the policy in apex-pdp engine |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 43 | ${auth}= Create List healthcheck zb!XztG34 |
| 44 | ${postjson}= Get file ${CURDIR}/data/pdp_update.json |
| 45 | Log Creating session https://${POLICY_PAP_IP}:6969 |
| 46 | ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} |
| 47 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Jim Hahn | 25721ec | 2019-12-09 09:56:39 -0500 | [diff] [blame] | 48 | ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers} |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 49 | Log Received response from policy5 ${resp.text} |
| 50 | ${postjsonobject} To Json ${postjson} |
| 51 | Should Be Equal As Strings ${resp.status_code} 200 |
| 52 | |
| 53 | RunEventOnApexEngine |
| 54 | Create Session apexSession http://${APEX_IP}:23324 max_retries=1 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 55 | ${data}= Get Binary File ${CURDIR}${/}data${/}event.json |
| 56 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json |
| 57 | ${resp}= Put Request apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} |
| 58 | Should Be Equal As Strings ${resp.status_code} 200 |