Updates for F release
[nonrtric.git] / test / auto-test / FTC100.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 #  ========================================================================
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #  ============LICENSE_END=================================================
18 #
19
20
21 TC_ONELINE_DESCR="Full agent API walkthrough using agent REST/DMAAP and with/without SDNC A1 Controller"
22
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW KUBEPROXY"
25
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW"
28 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
30
31 #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
32 #the image is not configured in the supplied env_file
33 #Used for images not applicable to all supported profile
34 CONDITIONALLY_IGNORED_IMAGES="CBS CONSUL NGW"
35
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE"
38 #Supported run modes
39 SUPPORTED_RUNMODES="DOCKER KUBE"
40
41 . ../common/testcase_common.sh $@
42
43 setup_testenvironment
44
45 #### TEST BEGIN ####
46
47 generate_policy_uuid
48
49 # Tested variants of REST/DMAAP/SDNC config
50 TESTED_VARIANTS="REST   DMAAP   REST+SDNC   DMAAP+SDNC"
51
52 #Test agent and simulator protocol versions (others are http only)
53 TESTED_PROTOCOLS="HTTP HTTPS"
54
55 for __httpx in $TESTED_PROTOCOLS ; do
56     for interface in $TESTED_VARIANTS ; do
57
58         echo "#####################################################################"
59         echo "#####################################################################"
60         echo "### Testing agent: $interface using $__httpx"
61         echo "#####################################################################"
62         echo "#####################################################################"
63
64         # Clean container and start all needed containers #
65         clean_environment
66
67         start_kube_proxy
68
69         if [ $__httpx == "HTTPS" ]; then
70             use_cr_https
71             use_agent_rest_https
72         else
73             use_agent_rest_http
74             use_cr_http
75         fi
76
77         start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
78
79         set_agent_debug
80
81         # Create service to be able to receive events when rics becomes available
82         # Must use rest towards the agent since dmaap is not configured yet
83         api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
84
85
86         if [ $__httpx == "HTTPS" ]; then
87             use_simulator_https
88             use_mr_https
89             if [[ $interface = *"SDNC"* ]]; then
90                 use_sdnc_https
91             fi
92             if [[ $interface = *"DMAAP"* ]]; then
93                 use_agent_dmaap_https
94             else
95                 use_agent_rest_https
96             fi
97         else
98             use_simulator_http
99             use_mr_http
100             if [[ $interface = *"SDNC"* ]]; then
101                 use_sdnc_http
102             fi
103             if [[ $interface = *"DMAAP"* ]]; then
104                 use_agent_dmaap_http
105             else
106                 use_agent_rest_http
107             fi
108         fi
109
110         start_ric_simulators ricsim_g1 1  OSC_2.1.0
111         start_ric_simulators ricsim_g2 1  STD_1.1.3
112
113         sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
114         sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
115
116         if [ "$PMS_VERSION" == "V2" ]; then
117             start_ric_simulators ricsim_g3 1  STD_2.0.0
118             sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
119             sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
120         fi
121
122         start_mr
123
124         start_cr 1
125
126         start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
127
128         if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
129             start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
130         fi
131
132         if [[ $interface = *"SDNC"* ]]; then
133             start_sdnc
134             prepare_consul_config      SDNC    ".consul_config.json"
135         else
136             prepare_consul_config      NOSDNC  ".consul_config.json"
137         fi
138
139         if [ $RUNMODE == "KUBE" ]; then
140             agent_load_config                       ".consul_config.json"
141         else
142             if [[ "$PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
143                 #Temporary switch to http/https if dmaap use. Otherwise it is not possibble to push config
144                 if [ $__httpx == "HTTPS" ]; then
145                     use_agent_rest_https
146                 else
147                     use_agent_rest_http
148                 fi
149
150                 if [[ $interface != *"DMAAP"* ]]; then
151                     echo "{}" > ".consul_config_incorrect.json"
152                     api_put_configuration 400 ".consul_config_incorrect.json"
153                 fi
154
155                 api_put_configuration 200 ".consul_config.json"
156                 api_get_configuration 200 ".consul_config.json"
157                 if [ $__httpx == "HTTPS" ]; then
158                     if [[ $interface = *"DMAAP"* ]]; then
159                         use_agent_dmaap_https
160                     else
161                         use_agent_rest_https
162                     fi
163                 else
164                     if [[ $interface = *"DMAAP"* ]]; then
165                         use_agent_dmaap_http
166                     else
167                         use_agent_rest_http
168                     fi
169                 fi
170
171             else
172                 start_consul_cbs
173                 consul_config_app                   ".consul_config.json"
174             fi
175         fi
176
177         if [ "$PMS_VERSION" == "V2" ]; then
178             api_equal json:rics 3 300
179
180             api_equal json:policy-types 5 120
181
182             api_equal json:policies 0
183
184             api_equal json:policy-instances 0
185         else
186             api_equal json:rics 2 300
187
188             api_equal json:policy_schemas 3 120
189
190             api_equal json:policy_types 3
191
192             api_equal json:policies 0
193
194             api_equal json:policy_ids 0
195         fi
196
197         if [ "$PMS_VERSION" == "V2" ]; then
198             cr_equal 0 received_callbacks 3 120
199             cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
200         fi
201         mr_equal requests_submitted 0
202
203
204         echo "############################################"
205         echo "############## Health check ################"
206         echo "############################################"
207
208         api_get_status 200
209
210         api_get_status_root 200
211
212         echo "############################################"
213         echo "##### Service registry and supervision #####"
214         echo "############################################"
215
216         api_get_services 404 "service1"
217
218         api_put_service 201 "service1" 1000 "$CR_SERVICE_APP_PATH_0/1"
219
220         api_put_service 200 "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
221
222
223         api_put_service 400 "service2" -1 "$CR_SERVICE_APP_PATH_0/2"
224
225         api_put_service 400 "service2" "wrong" "$CR_SERVICE_APP_PATH_0/2"
226
227         api_put_service 400 "service2" 100 "/test"
228
229         api_put_service 400 "service2" 100 "test-path"
230
231         api_put_service 201 "service2" 300 "ftp://localhost:80/test"
232
233         api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
234
235         api_get_service_ids 200 "service1" "service2" "ric-registration"
236
237
238         api_put_service 201 "service3" 5000 "$CR_SERVICE_APP_PATH_0/3"
239
240
241         api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
242
243
244         api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
245
246         api_get_services 200 NOSERVICE "service1" 2000 "$CR_SERVICE_APP_PATH_0/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_SERVICE_APP_PATH_0/3"  "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
247
248         api_get_services 200
249
250         deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
251         #The below should work, keept here until fixed or other decision made
252         #api_put_services_keepalive 201 "service1"
253         #Using the below until decision
254         api_put_services_keepalive 200 "service1"
255
256         deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
257         #The below should work, keept here until fixed or other decision made
258         #api_put_services_keepalive 201 "service3"
259         #Using the below until decision
260         api_put_services_keepalive 200 "service3"
261
262         api_put_services_keepalive 200 "service1"
263
264         api_put_services_keepalive 200 "service3"
265
266         api_put_services_keepalive 404 "service5"
267
268         api_get_service_ids 200 "service1" "service2" "service3"  "ric-registration"
269
270         api_delete_services 204 "service1"
271
272         api_get_service_ids 200 "service2" "service3" "ric-registration"
273
274
275         api_put_service 201 "service1" 50 "$CR_SERVICE_APP_PATH_0/1"
276
277         api_get_service_ids 200 "service1" "service2" "service3"  "ric-registration"
278
279
280         api_delete_services 204 "service1"
281         api_delete_services 204 "service3"
282
283         api_equal json:services 2
284
285         api_delete_services 204 "service2"
286
287         api_equal json:services 1
288
289
290         echo "############################################"
291         echo "############## RIC Repository ##############"
292         echo "############################################"
293
294         if [ "$PMS_VERSION" == "V2" ]; then
295             api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
296         else
297             api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
298         fi
299         api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
300
301         api_get_rics 404 47
302
303         api_get_rics 404 "test"
304
305         if [ "$PMS_VERSION" == "V2" ]; then
306             api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
307
308             api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
309
310             api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
311
312             api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
313
314             api_get_ric 200 me1_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
315
316             api_get_ric 200 me2_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
317
318             api_get_ric 200 NOME      ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
319
320             api_get_ric 200 NOME      ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
321
322             api_get_ric 200 NOME      ricsim_g3_1 "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
323
324             api_get_ric 404 NOME test1
325
326             api_get_ric 404 test NORIC
327
328             api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
329
330             api_get_ric 400 me1_ricsim_g1_1 TESTRIC
331
332             api_get_ric 400 TESTME ricsim_g1_1
333
334         else
335             api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
336
337             api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
338
339             api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
340
341             api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
342
343             api_get_ric 404 test
344         fi
345
346         echo "############################################"
347         echo "########### A1 Policy Management ###########"
348         echo "############################################"
349
350         if [ "$PMS_VERSION" == "V2" ]; then
351             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
352             #Behaviour accepted for now
353             api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
354             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
355             #Behaviour accepted for now
356             api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
357             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
358             #Behaviour accepted for now
359             api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
360             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
361             #Behaviour accepted for now
362             api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
363
364             api_get_policy_type 404 3
365         else
366             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
367             #Behaviour accepted for now
368             api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
369             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
370             #Behaviour accepted for now
371             api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
372
373             api_get_policy_schema 404 3
374         fi
375
376         if [ "$PMS_VERSION" == "V2" ]; then
377             api_get_policy_schemas 404
378         else
379             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
380             #Behaviour accepted for now
381             api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
382             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
383             #Behaviour accepted for now
384             api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
385
386             api_get_policy_schemas 200 ricsim_g2_1 NOFILE
387
388             api_get_policy_schemas 404 test
389         fi
390
391
392         if [ "$PMS_VERSION" == "V2" ]; then
393             api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
394         else
395             api_get_policy_types 200 NORIC 1 2 EMPTY
396         fi
397
398         api_get_policy_types 200 ricsim_g1_1 1 2
399
400         api_get_policy_types 200 ricsim_g2_1 EMPTY
401
402         if [ "$PMS_VERSION" == "V2" ]; then
403             api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
404         fi
405
406         api_get_policy_types 404 dummy-ric
407
408
409
410         api_put_service 201 "service10" 3600 "$CR_SERVICE_APP_PATH_0/1"
411
412         if [ "$PMS_VERSION" == "V2" ]; then
413             notificationurl=$CR_SERVICE_APP_PATH_0"/test"
414         else
415             notificationurl=""
416         fi
417         if [[ $interface != *"DMAAP"* ]]; then
418             # Badly formatted json is not possible to send via dmaap
419             api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi_bad_template.json
420         fi
421         deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
422         #Kept until decison
423         #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
424         #Allow 201 for now
425         api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
426
427         api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
428         api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
429
430         api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
431         api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
432
433         api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
434         api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
435
436         api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
437         api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
438
439         if [ "$PMS_VERSION" == "V2" ]; then
440             api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
441             api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
442
443             api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
444             api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
445         fi
446
447         api_get_policy_status 404 1
448         api_get_policy_status 404 2
449         VAL='NOT IN EFFECT'
450         api_get_policy_status 200 5000 OSC "$VAL" "false"
451         api_get_policy_status 200 5100 STD "UNDEFINED"
452         if [ "$PMS_VERSION" == "V2" ]; then
453             api_get_policy_status 200 5200 STD2 EMPTY EMPTY
454         fi
455
456
457         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
458         #kept until decision
459         #api_equal json:policies 2
460         #Allow 3 for now
461         if [ "$PMS_VERSION" == "V2" ]; then
462             api_equal json:policies 4
463         else
464             api_equal json:policies 3
465         fi
466
467         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
468         #kept until decision
469         #api_equal json:policy_ids 2
470         #Allow 3 for now
471         if [ "$PMS_VERSION" == "V2" ]; then
472             api_equal json:policy-instances 4
473         else
474             api_equal json:policy_ids 3
475         fi
476
477         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
478         #kept until decision
479         #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
480         #Allow policy create with unregistered service for now
481         if [ "$PMS_VERSION" == "V2" ]; then
482             api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
483         else
484             api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
485         fi
486
487         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
488         #kept until decision
489         #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
490         #Allow policy create with unregistered service for now
491         if [ "$PMS_VERSION" == "V2" ]; then
492             api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
493
494             api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
495
496             api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
497
498             api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
499         else
500             api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
501
502             api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
503
504
505             api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
506         fi
507
508         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
509         #kept until decision
510         #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
511         #Allow policy create with unregistered service for now
512
513         api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
514
515         api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
516
517         if [ "$PMS_VERSION" == "V2" ]; then
518             api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
519         fi
520
521         api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
522
523         if [ "$PMS_VERSION" == "V2" ]; then
524             api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
525
526             api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
527
528             api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 false $notificationurl
529
530             api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
531         else
532             api_get_policy 200 5000 testdata/OSC/pi1_template.json
533
534             api_get_policy 200 5100 testdata/STD/pi1_template.json
535
536             api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
537         fi
538
539         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
540         #kept until decision
541         #api_delete_policy 404 2000
542         #Allow policy create with unregistered service for now
543         api_delete_policy 204 2000
544
545         api_delete_policy 404 1500
546
547         api_delete_policy 204 5000
548
549         if [ "$PMS_VERSION" == "V2" ]; then
550
551             api_delete_policy 204 5200
552         fi
553
554         api_equal json:policies 1
555
556
557         if [ "$PMS_VERSION" == "V2" ]; then
558             api_equal json:policy-instances 1
559         else
560             api_equal json:policy_ids 1
561         fi
562
563         api_delete_policy 204 5100
564
565         api_equal json:policies 0
566
567         if [ "$PMS_VERSION" == "V2" ]; then
568             api_equal json:policy-instances 0
569         else
570             api_equal json:policy_ids 0
571         fi
572
573         if [ "$PMS_VERSION" == "V2" ]; then
574             cr_equal 0 received_callbacks 3
575         fi
576
577         if [[ $interface = *"DMAAP"* ]]; then
578             mr_greater requests_submitted 0
579             VAL=$(mr_read requests_submitted)
580             mr_equal requests_fetched $VAL
581             mr_equal responses_submitted $VAL
582             mr_equal responses_fetched $VAL
583             mr_equal current_requests 0
584             mr_equal current_responses 0
585         else
586             mr_equal requests_submitted 0
587         fi
588
589         if [[ $interface = *"SDNC"* ]]; then
590             sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
591             sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
592             if [ "$PMS_VERSION" == "V2" ]; then
593                 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
594             fi
595         else
596             sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
597             sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
598             if [ "$PMS_VERSION" == "V2" ]; then
599                 sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
600             fi
601         fi
602
603         check_policy_agent_logs
604
605         if [[ $interface = *"SDNC"* ]]; then
606             check_sdnc_logs
607         fi
608
609         store_logs          "${__httpx}__${interface}"
610
611     done
612
613 done
614
615 #### TEST COMPLETE ####
616
617
618 print_result
619
620 auto_clean_environment