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