blob: 3e8bc2115527cbd746f5f6930171e009b16ab63e [file] [log] [blame]
ramverma9e9f7222019-02-11 16:25:44 +00001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Test Cases ***
Jim Hahn1ebe7ec2020-04-02 13:32:01 -04008LoadPolicy
9 [Documentation] Loads prerequisite Policy via API
10 ${auth}= Create List healthcheck zb!XztG34
11 Log Creating session https://${POLICY_API_IP}:6969
12 ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth}
13 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Jim Hahn09148c82020-09-02 11:16:16 -040014 ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json
Pamela Dragoshbd5f1dc2020-08-19 16:18:52 -040015 ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies data=${postjson} headers=${headers}
Jim Hahn1ebe7ec2020-04-02 13:32:01 -040016 Log Received response from API ${resp.text}
17 Should Be Equal As Strings ${resp.status_code} 200
18
ramverma9e9f7222019-02-11 16:25:44 +000019Healthcheck
20 [Documentation] Runs Policy PAP Health check
21 ${auth}= Create List healthcheck zb!XztG34
22 Log Creating session https://${POLICY_PAP_IP}:6969
23 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
24 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
ramverma55c1fcf2019-02-22 14:08:15 +000025 ${resp}= Get Request policy /policy/pap/v1/healthcheck headers=${headers}
ramverma9e9f7222019-02-11 16:25:44 +000026 Log Received response from policy ${resp.text}
27 Should Be Equal As Strings ${resp.status_code} 200
28 Should Be Equal As Strings ${resp.json()['code']} 200
29
30Statistics
31 [Documentation] Runs Policy PAP Statistics
32 ${auth}= Create List healthcheck zb!XztG34
33 Log Creating session https://${POLICY_PAP_IP}:6969
34 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
35 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
ramverma55c1fcf2019-02-22 14:08:15 +000036 ${resp}= Get Request policy /policy/pap/v1/statistics headers=${headers}
ramverma9e9f7222019-02-11 16:25:44 +000037 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()['code']} 200
Jim Hahn0a594cf2019-04-19 12:47:01 -040040
41CreatePdpGroups
42 [Documentation] Runs Policy PAP Create PDP Groups
43 ${auth}= Create List healthcheck zb!XztG34
44 Log Creating session https://${POLICY_PAP_IP}:6969
45 ${postjson}= Get file ${CURDIR}/data/create.group.request.json
46 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
47 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Jim Hahn25721ec2019-12-09 09:56:39 -050048 ${resp}= Post Request policy /policy/pap/v1/pdps/groups/batch data=${postjson} headers=${headers}
Jim Hahn0a594cf2019-04-19 12:47:01 -040049 Log Received response from policy ${resp.text}
50 Should Be Equal As Strings ${resp.status_code} 200
51
52ActivatePdpGroup
53 [Documentation] Runs Policy PAP Change PDP Group State to ACTIVE
54 ${auth}= Create List healthcheck zb!XztG34
55 Log Creating session https://${POLICY_PAP_IP}:6969
56 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
57 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
58 ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=ACTIVE headers=${headers}
59 Log Received response from policy ${resp.text}
60 Should Be Equal As Strings ${resp.status_code} 200
61
62QueryPdpGroups
63 [Documentation] Runs Policy PAP Query PDP Groups
64 ${auth}= Create List healthcheck zb!XztG34
65 Log Creating session https://${POLICY_PAP_IP}:6969
66 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
67 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
68 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
69 Log Received response from policy ${resp.text}
70 Should Be Equal As Strings ${resp.status_code} 200
ramvermabf884ba2019-05-02 17:02:22 +000071 Should Be Equal As Strings ${resp.json()['groups'][0]['name']} create.group.request
72 Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ACTIVE
73 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} defaultGroup
Jim Hahn0a594cf2019-04-19 12:47:01 -040074
Jim Hahn25721ec2019-12-09 09:56:39 -050075DeployPdpGroups
76 [Documentation] Runs Policy PAP Deploy Policies to PDP Groups
77 ${auth}= Create List healthcheck zb!XztG34
78 Log Creating session https://${POLICY_PAP_IP}:6969
79 ${postjson}= Get file ${CURDIR}/data/deploy.group.request.json
80 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
81 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
82 ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers}
83 Log Received response from policy ${resp.text}
84 Should Be Equal As Strings ${resp.status_code} 200
85
Jim Hahn0a594cf2019-04-19 12:47:01 -040086UndeployPolicy
87 [Documentation] Runs Policy PAP Undeploy a Policy from PDP Groups
88 ${auth}= Create List healthcheck zb!XztG34
89 Log Creating session https://${POLICY_PAP_IP}:6969
90 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
91 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
92 ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers}
93 Log Received response from policy ${resp.text}
94 Should Be Equal As Strings ${resp.status_code} 200
95
96QueryPdpGroupsAfterUndeploy
97 [Documentation] Runs Policy PAP Query PDP Groups after Undeploy
98 ${auth}= Create List healthcheck zb!XztG34
99 Log Creating session https://${POLICY_PAP_IP}:6969
100 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
101 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
102 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
103 Log Received response from policy ${resp.text}
104 Should Be Equal As Strings ${resp.status_code} 200
ramvermabf884ba2019-05-02 17:02:22 +0000105 Should Be Equal As Strings ${resp.json()['groups'][0]['name']} create.group.request
106 Should Be Equal As Strings ${resp.json()['groups'][0]['pdpSubgroups'][0]['policies']} []
Jim Hahn0a594cf2019-04-19 12:47:01 -0400107
108DeactivatePdpGroup
109 [Documentation] Runs Policy PAP Change PDP Group State to PASSIVE
110 ${auth}= Create List healthcheck zb!XztG34
111 Log Creating session https://${POLICY_PAP_IP}:6969
112 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
113 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
114 ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=PASSIVE headers=${headers}
115 Log Received response from policy ${resp.text}
116 Should Be Equal As Strings ${resp.status_code} 200
117
118DeletePdpGroups
119 [Documentation] Runs Policy PAP Delete PDP Groups
120 ${auth}= Create List healthcheck zb!XztG34
121 Log Creating session https://${POLICY_PAP_IP}:6969
122 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
123 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
124 ${resp}= Delete Request policy /policy/pap/v1/pdps/groups/create.group.request headers=${headers}
125 Log Received response from policy ${resp.text}
126 Should Be Equal As Strings ${resp.status_code} 200
127
128QueryPdpGroupsAfterDelete
129 [Documentation] Runs Policy PAP Query PDP Groups after Delete
130 ${auth}= Create List healthcheck zb!XztG34
131 Log Creating session https://${POLICY_PAP_IP}:6969
132 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
133 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
134 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
135 Log Received response from policy ${resp.text}
136 Should Be Equal As Strings ${resp.status_code} 200
ramvermabf884ba2019-05-02 17:02:22 +0000137 Should Be Equal As Strings ${resp.json()['groups'][0]['name']} defaultGroup