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