blob: dcdf2d8073eb53b7e0fdfb20df28ecfd2a568260 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Test Cases ***
8
a.sreekumar7d80c382019-05-07 13:36:39 +00009Healthcheck
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
20ExecuteApexPolicy
21 Wait Until Keyword Succeeds 2 min 5 sec CreateOperationalPolicyType
22 Wait Until Keyword Succeeds 2 min 5 sec CreateNewOperationalPolicy
23 Wait Until Keyword Succeeds 2 min 5 sec DeployOperationalPolicy
24 Wait Until Keyword Succeeds 4 min 10 sec RunEventOnApexEngine
25
26*** Keywords ***
27
28CreateOperationalPolicyType
29 [Documentation] Create Operational Policy Type
30 ${auth}= Create List healthcheck zb!XztG34
31 ${postjson}= Get file ${CURDIR}/data/onap.policies.controlloop.operational.Apex.json
32 Log Creating session https://${POLICY_API_IP}:6969
33 ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth}
34 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
35 ${resp}= Post Request policy /policy/api/v1/policytypes data=${postjson} headers=${headers}
36 Log Received response from policy2 ${resp.text}
37 Should Be Equal As Strings ${resp.status_code} 200
38 ${postjsonobject} To Json ${postjson}
39 Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
40 Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
41
42CreateNewOperationalPolicy
43 [Documentation] Create a new Operational Apex policy
44 ${auth}= Create List healthcheck zb!XztG34
45 ${postjson}= Get file ${CURDIR}/data/onap.policies.controlloop.operational.Apex.tosca.json
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.controlloop.operational.Apex/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
56DeployOperationalPolicy
57 [Documentation] Make the PAP to initiate a PDP_UPDATE with policies
58 ${auth}= Create List healthcheck zb!XztG34
59 ${postjson}= Get file ${CURDIR}/data/pdp_update.json
60 Log Creating session https://${POLICY_PAP_IP}:6969
61 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
62 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
63 ${resp}= Post Request policy /policy/pap/v1/pdps data=${postjson} headers=${headers}
64 Log Received response from policy5 ${resp.text}
65 ${postjsonobject} To Json ${postjson}
66 Should Be Equal As Strings ${resp.status_code} 200
67
68RunEventOnApexEngine
69 Create Session apexSession http://${APEX_IP}:23324 max_retries=1
Gary Wu9abb61c2018-09-27 10:38:50 -070070 ${data}= Get Binary File ${CURDIR}${/}data${/}event.json
71 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
72 ${resp}= Put Request apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers}
73 Should Be Equal As Strings ${resp.status_code} 200