blob: 5ce1f9f738b800fb8a223629f2f9cc0df0c840e6 [file] [log] [blame]
ma987de38164b2017-09-28 16:33:03 -05001*** Settings ***
2Documentation Policy ONAP CSIT Test cases
3Library String
4Library HttpLibrary.HTTP
5LIbrary Process
RAJU3f5fd662017-10-11 15:50:00 -05006Library BuiltIn
ma987de38164b2017-09-28 16:33:03 -05007Resource policy_interface.robot
8Resource json_templater.robot
9
10*** Variables ***
RAJU39e27742017-10-05 10:03:36 -050011${RESOURCE_PATH_CREATE} /pdp/api/createPolicy
12${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy
13${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy
14${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig
ma987de38164b2017-09-28 16:33:03 -050015${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW.template
16${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS.template
17${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE.template
RAJU39e27742017-10-05 10:03:36 -050018${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template
ma987de38164b2017-09-28 16:33:03 -050019${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template
RAJU39e27742017-10-05 10:03:36 -050020${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template
ma987de38164b2017-09-28 16:33:03 -050021${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template
22${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template
23${CONFIG_POLICY_VFW_NAME} vFirewall
24${CONFIG_POLICY_VFW_TYPE} MicroService
25${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
26${CONFIG_POLICY_VDNS_TYPE} MicroService
27${OPS_POLICY_VFW_NAME} vFirewall
28${OPS_POLICY_VFW_TYPE} BRMS_PARAM
29${OPS_POLICY_VDNS_NAME} vLoadBalancer
30${OPS_POLICY_VDNS_TYPE} BRMS_PARAM
31${CONFIG_POLICY_VCPE_NAME} vCPE
32${CONFIG_POLICY_VCPE_TYPE} MicroService
33${OPS_POLICY_VCPE_NAME} vCPE
34${OPS_POLICY_VCPE_TYPE} BRMS_PARAM
35${OPS_POLICY_VOLTE_NAME} VoLTE
36${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM
37${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl
38${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D
39${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE.template
40${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE.template
41
42
43*** Test Cases ***
44Policy Health check
45 Run Policy Health Check
46
47VFW Config Policy
48 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
RAJU3f5fd662017-10-11 15:50:00 -050049 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
ma987de38164b2017-09-28 16:33:03 -050050 #VFW Policy Tests
51
52VDNS Config Policy
53 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
54 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
RAJU3f5fd662017-10-11 15:50:00 -050055 #VDNS Policy Tests
56
ma987de38164b2017-09-28 16:33:03 -050057VCPE Config Policy
58 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
59 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
60 #VCPE Policy Tests
RAJU3f5fd662017-10-11 15:50:00 -050061
RAJU39e27742017-10-05 10:03:36 -050062VFW Ops Policy
63 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
64 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
65
66VDNS Ops Policy
67 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
68 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
69
70VCPE Ops Policy
71 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
72 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
73
74VOLTE Ops Policy
75 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
76 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
ma987de38164b2017-09-28 16:33:03 -050077 #VOLTE Policy Tests
RAJU3f5fd662017-10-11 15:50:00 -050078VFW Get Configs Policy
79 Sleep 5s
80 Get Configs VFW Policy
81
82VDNS Get Configs Policy
83 Sleep 5s
84 Get Configs VDNS Policy
85
86VCPE Get Configs Policy
87 Sleep 5s
88 Get Configs VCPE Policy
ma987de38164b2017-09-28 16:33:03 -050089
90*** Keywords ***
91
92VFW Policy Tests
93 ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy
94 Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE}
95 Get Configs VFW Policy
96 ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy
97 Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE}
98
99VDNS Policy Tests
100 ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy
101 Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE}
102 Get Configs VDNS Policy
103 ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy
104 Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE}
105
106VCPE Policy Tests
107 ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy
108 Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE}
109 Get Configs VCPE Policy
110 ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy
111 Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE}
112
113VOLTE Policy Tests
114 ${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
115 Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
116
117Get Configs VFW Policy
118 [Documentation] Get Config Policy for VFW
119 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}*
120 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
121 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
122 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
123 Should Be Equal As Strings ${get_resp.status_code} 200
124
125Create Config VFW Policy
126 [Documentation] Create Config Policy
127 ${randompolicyname} = Create Policy Name
128 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
129 ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
130 ${configpolicy}= Create Dictionary policy_name=${policyname1}
131 ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy}
132 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
133 Should Be Equal As Strings ${put_resp.status_code} 200
134 [Return] ${policyname1}
135
136 Create Policy Name
137 [Documentation] Generate Policy Name
138 [Arguments] ${prefix}=CSIT_
139 ${random}= Generate Random String 15 [LOWER][NUMBERS]
140 ${policyname}= Catenate ${prefix}${random}
141 [Return] ${policyname}
142
143Create Ops VFW Policy
144 [Documentation] Create Opertional Policy
145 ${randompolicyname} = Create Policy Name
146 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
147 ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1}
148 ${dict}= Create Dictionary policy_name=${policyname1}
149 ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict}
150 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
151 Log ${put_resp}
152 Should Be Equal As Strings ${put_resp.status_code} 200
153 [Return] ${policyname1}
154
155Push Ops Policy
156 [Documentation] Push Ops Policy
157 [Arguments] ${policyname} ${policytype}
158 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
159 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
160 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
161 Should Be Equal As Strings ${put_resp.status_code} 200
162
163Push Config Policy
164 [Documentation] Push Config Policy
165 [Arguments] ${policyname} ${policytype}
166 ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype}
167 ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict}
168 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output}
169 Should Be Equal As Strings ${put_resp.status_code} 200
170
171Delete Ops Policy
172 [Documentation] Delete Config Policy
173 [Arguments] ${policy_name}
174 ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml
175 ${dict}= Create Dictionary policy_name=${policyname3}
176 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
177 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
178 Should Be Equal As Strings ${put_resp.status_code} 200
179
180Delete Config Policy
181 [Documentation] Delete Ops Policy
182 [Arguments] ${policy_name}
183 ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml
184 ${dict}= Create Dictionary policy_name=${policyname3}
185 ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
186 ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
187 Should Be Equal As Strings ${put_resp.status_code} 200
188
189Get Configs VDNS Policy
190 [Documentation] Get Config Policy for VDNS
191 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}*
192 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
193 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
194 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
195 Should Be Equal As Strings ${get_resp.status_code} 200
196
197Create Config VDNS Policy
198 [Documentation] Create Config Policy
199 ${randompolicyname} = Create Policy Name
200 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
201 ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
202 ${configpolicy}= Create Dictionary policy_name=${policyname1}
203 ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy}
204 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
205 Should Be Equal As Strings ${put_resp.status_code} 200
206 [Return] ${policyname1}
207
208Create Ops VDNS Policy
209 [Documentation] Create Opertional Policy
210 ${randompolicyname} = Create Policy Name
211 ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer
212 ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
213 ${dict}= Create Dictionary policy_name=${policyname1}
214 ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict}
215 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
216 Log ${put_resp}
217 Should Be Equal As Strings ${put_resp.status_code} 200
218 [Return] ${policyname1}
219
220Create Config VCPE Policy
221 [Documentation] Create Config Policy
222 ${randompolicyname} = Create Policy Name
223 ${policyname1}= Catenate com.${randompolicyname}_vFirewall
224 ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
225 ${configpolicy}= Create Dictionary policy_name=${policyname1}
226 ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy}
227 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
228 Should Be Equal As Strings ${put_resp.status_code} 200
229 [Return] ${policyname1}
230
231Get Configs VCPE Policy
232 [Documentation] Get Config Policy for VCPE
233 ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}*
234 ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy}
235 ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name}
236 ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
237 Should Be Equal As Strings ${get_resp.status_code} 200
238
239Create Ops vCPE Policy
240 [Documentation] Create Opertional Policy
241 ${randompolicyname} = Create Policy Name
242 ${policyname1}= Catenate com.${randompolicyname}
RAJU39e27742017-10-05 10:03:36 -0500243 ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1}
244 ${dict}= Create Dictionary policy_name=${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500245 ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict}
246 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
247 Log ${put_resp}
248 Should Be Equal As Strings ${put_resp.status_code} 200
RAJU39e27742017-10-05 10:03:36 -0500249 [Return] ${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500250
251Create Ops VolTE Policy
252 [Documentation] Create Opertional Policy
253 ${randompolicyname} = Create Policy Name
RAJU39e27742017-10-05 10:03:36 -0500254 ${policyname1}= Catenate com.${randompolicyname}
255 ${dict}= Create Dictionary policy_name=${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500256 ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict}
257 ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
258 Log ${put_resp}
259 Should Be Equal As Strings ${put_resp.status_code} 200
RAJU39e27742017-10-05 10:03:36 -0500260 [Return] ${policyname1}
ma987de38164b2017-09-28 16:33:03 -0500261
262Upload DRL file
263 [Documentation] Upload DRL file1
264 ${file_data}= Get Binary File ${file_path}
265 ${files}= Create Dictionary file=${file_data}
266 #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1}
267 # ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')}
268 # ${files}= Create Dictionary file ${file_data}
269 ${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
270 Should Be Equal As Strings ${put_resp.status_code} 200