Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [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 Api Health check |
| 10 | ${auth}= Create List healthcheck zb!XztG34 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 11 | Log Creating session https://${POLICY_API_IP}:6969 |
| 12 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 13 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 14 | ${resp}= Get Request policy /policy/api/v1/healthcheck headers=${headers} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 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 Api Statistics |
| 21 | ${auth}= Create List healthcheck zb!XztG34 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 22 | Log Creating session https://${POLICY_API_IP}:6969 |
| 23 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 24 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 25 | ${resp}= Get Request policy /policy/api/v1/statistics headers=${headers} |
Chenfei Gao | d4c5185 | 2019-02-06 20:45:10 -0500 | [diff] [blame] | 26 | Log Received response from policy ${resp.text} |
| 27 | Should Be Equal As Strings ${resp.status_code} 200 |
Chenfei Gao | fd96738 | 2019-02-12 15:52:37 -0500 | [diff] [blame] | 28 | Should Be Equal As Strings ${resp.json()['code']} 200 |
Bilal A | 95097c2 | 2019-04-12 22:38:32 +0000 | [diff] [blame] | 29 | |
| 30 | RetrievePolicyTypes |
| 31 | [Documentation] Gets Policy Types |
| 32 | ${auth}= Create List healthcheck zb!XztG34 |
| 33 | Log Creating session https://${POLICY_API_IP}:6969 |
| 34 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 35 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 36 | ${resp}= Get Request policy /policy/api/v1/policytypes headers=${headers} |
| 37 | Log Received response from policy ${resp.text} |
| 38 | Should Be Equal As Strings ${resp.status_code} 200 |
| 39 | Should Be Equal As Strings ${resp.json()['version']} 1.0.0 |
| 40 | |
Bilal A | 4174bbb | 2019-04-15 21:15:50 +0000 | [diff] [blame] | 41 | CreateTCAPolicyType |
| 42 | [Documentation] Create TCA Policy Type |
| 43 | ${auth}= Create List healthcheck zb!XztG34 |
| 44 | ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.cdap.tca.hi.lo.app.json |
| 45 | Log Creating session https://${POLICY_API_IP}:6969 |
| 46 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 47 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 48 | ${resp}= Post Request policy /policy/api/v1/policytypes data=${postjson} headers=${headers} |
| 49 | Log Received response from policy ${resp.text} |
| 50 | Should Be Equal As Strings ${resp.status_code} 200 |
| 51 | ${postjsonobject} To Json ${postjson} |
| 52 | Dictionary Should Contain Key ${resp.json()} tosca_definitions_version |
| 53 | Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version |
| 54 | |
| 55 | RetrieveMonitoringPolicyTypes |
| 56 | [Documentation] Retrieve Monitoring related Policy Types |
| 57 | ${auth}= Create List healthcheck zb!XztG34 |
| 58 | Log Creating session https://${POLICY_API_IP}:6969 |
| 59 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 60 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 61 | ${resp}= Get Request policy /policy/api/v1/policytypes/onap.policies.Monitoring headers=${headers} |
| 62 | Log Received response from policy ${resp.text} |
| 63 | Should Be Equal As Strings ${resp.status_code} 200 |
| 64 | Dictionary Should Contain Key ${resp.json()['policy_types'][0]} onap.policies.Monitoring |
| 65 | |
| 66 | |
| 67 | CreateNewMonitoringPolicy |
| 68 | [Documentation] Create a new Monitoring TCA policy |
| 69 | ${auth}= Create List healthcheck zb!XztG34 |
| 70 | ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json |
| 71 | Log Creating session https://${POLICY_API_IP}:6969 |
| 72 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 73 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 74 | ${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} |
| 75 | Log Received response from policy ${resp.text} |
| 76 | ${postjsonobject} To Json ${postjson} |
| 77 | Should Be Equal As Strings ${resp.status_code} 200 |
| 78 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 79 | Dictionary Should Contain Key ${postjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 80 | |
| 81 | RetrievePoliciesOfType |
| 82 | [Documentation] Retrieve all Policies Created for a specific Policy Type |
| 83 | ${auth}= Create List healthcheck zb!XztG34 |
| 84 | ${expjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json |
| 85 | Log Creating session https://${POLICY_API_IP}:6969 |
| 86 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 87 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 88 | ${resp}= Get Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies headers=${headers} |
| 89 | Log Received response from policy ${resp.text} |
| 90 | ${expjsonobject} To Json ${expjson} |
| 91 | Should Be Equal As Strings ${resp.status_code} 200 |
| 92 | Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} onap.restart.tca |
| 93 | Dictionary Should Contain Key ${expjsonobject['topology_template']['policies'][0]} onap.restart.tca |
| 94 | |
| 95 | DeleteSpecificPolicy |
| 96 | [Documentation] Delete Policy of a Type |
| 97 | ${auth}= Create List healthcheck zb!XztG34 |
| 98 | Log Creating session https://${POLICY_API_IP}:6969 |
| 99 | ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} |
| 100 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 101 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0 headers=${headers} |
| 102 | Log Received response from policy ${resp.text} |
| 103 | Should Be Equal As Strings ${resp.status_code} 200 |
| 104 | ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0 headers=${headers} |
| 105 | Should Be Equal As Strings ${resp.status_code} 404 |