Updating FTC 2001, 10, 1 series tests to support a1pms V3 image
[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 VERSIONS_TO_RUN=2
85
86 if [ -n "$A1PMS_V3_FLAG" ] && [ "${A1PMS_V3_FLAG,,}" == "true" ]; then
87   VERSIONS_TO_RUN=3
88 fi
89
90 for version in $(seq 2 $VERSIONS_TO_RUN); do
91   if [ "$version" == "3" ]; then
92     if [ -n "$A1PMS_V3" ] && [ -n "$A1PMS_API_PREFIX_V3" ] && [ -n "$A1PMS_ALIVE_URL_V3" ]; then
93       export A1PMS_VERSION="$A1PMS_V3"
94       export A1PMS_API_PREFIX="$A1PMS_API_PREFIX_V3"
95       export A1PMS_ALIVE_URL="$A1PMS_API_PREFIX$A1PMS_ALIVE_URL_V3"
96     else
97       echo "One/All parameters not set in env file (<A1PMS_V3>, <A1PMS_API_PREFIX_V3>, <A1PMS_ALIVE_URL_V3>)"
98       break
99     fi
100   fi
101   for __httpx in $TESTED_PROTOCOLS ; do
102       for interface in $TESTED_VARIANTS ; do
103
104           echo "#####################################################################"
105           echo "#####################################################################"
106           echo "### Testing a1pms: ${interface} and ${__httpx} with a1pms V${version} "
107           echo "#####################################################################"
108           echo "#####################################################################"
109
110           # Clean container and start all needed containers #
111           clean_environment
112
113           if [ $RUNMODE != "KUBE" ]; then
114               USE_ISTIO=0
115               echo "ISTIO not supported by docker - setting USE-ISTIO=0"
116           fi
117
118           if [ $USE_ISTIO -eq 1 ]; then
119               echo -e $RED"#########################################"$ERED
120               echo -e $RED"# Work around istio jwks cache"$ERED
121               echo -e $RED"# Cycle istiod down and up to clear cache"$ERED
122               echo ""
123               __kube_scale deployment istiod istio-system 0
124               __kube_scale deployment istiod istio-system 1
125               echo -e $RED"# Cycle istiod done"
126               echo -e $RED"#########################################"$ERED
127
128               istio_enable_istio_namespace $KUBE_SIM_NAMESPACE
129               istio_enable_istio_namespace $KUBE_NONRTRIC_NAMESPACE
130               istio_enable_istio_namespace $KUBE_A1SIM_NAMESPACE
131           fi
132
133
134           start_kube_proxy
135
136           if [ $USE_ISTIO -eq 1 ]; then
137               start_keycloak
138
139               keycloak_api_obtain_admin_token
140
141               keycloak_api_create_realm                   nrtrealm   true   60
142               keycloak_api_create_confidential_client     nrtrealm   a1pmsc
143               keycloak_api_generate_client_secret         nrtrealm   a1pmsc
144               keycloak_api_get_client_secret              nrtrealm   a1pmsc
145               keycloak_api_create_client_roles            nrtrealm   a1pmsc nrtrole
146               keycloak_api_map_client_roles               nrtrealm   a1pmsc nrtrole
147
148               keycloak_api_get_client_token               nrtrealm   a1pmsc
149
150               CLIENT_TOKEN=$(keycloak_api_read_client_token nrtrealm   a1pmsc)
151               echo "CLIENT_TOKEN: "$CLIENT_TOKEN
152
153               A1PMS_SEC=$(keycloak_api_read_client_secret nrtrealm   a1pmsc)
154               echo "A1PMS_SEC: "$A1PMS_SEC
155
156               # Protect ricsim-g3
157               istio_req_auth_by_jwks              ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS"
158               istio_auth_policy_by_issuer         ricsim-g1 $KUBE_A1SIM_NAMESPACE KUBEPROXY
159
160               istio_req_auth_by_jwksuri           ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm
161               istio_auth_policy_by_realm          ricsim-g1 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole
162
163               # Protect ricsim-g2
164               istio_req_auth_by_jwks              ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS"
165               istio_auth_policy_by_issuer         ricsim-g2 $KUBE_A1SIM_NAMESPACE KUBEPROXY
166
167               istio_req_auth_by_jwksuri           ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm
168               istio_auth_policy_by_realm          ricsim-g2 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole
169
170               # Protect ricsim-g3
171               istio_req_auth_by_jwks              ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS"
172               istio_auth_policy_by_issuer         ricsim-g3 $KUBE_A1SIM_NAMESPACE KUBEPROXY
173
174               istio_req_auth_by_jwksuri           ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm
175               istio_auth_policy_by_realm          ricsim-g3 $KUBE_A1SIM_NAMESPACE nrtrealm a1pmsc nrtrole
176
177               # Protect CR
178               istio_req_auth_by_jwks              $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY "$KUBE_PROXY_ISTIO_JWKS_KEYS"
179               istio_auth_policy_by_issuer         $CR_APP_NAME $KUBE_SIM_NAMESPACE KUBEPROXY
180
181               istio_req_auth_by_jwksuri           $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm
182               istio_auth_policy_by_realm          $CR_APP_NAME $KUBE_SIM_NAMESPACE nrtrealm a1pmsc nrtrole
183
184               a1pms_configure_sec nrtrealm a1pmsc $A1PMS_SEC
185           fi
186
187           if [ $__httpx == "HTTPS" ]; then
188               use_cr_https
189               use_a1pms_rest_https
190           else
191               use_a1pms_rest_http
192               use_cr_http
193           fi
194
195           start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
196
197           set_a1pms_debug
198
199           # Create service to be able to receive events when rics becomes available
200           # Must use rest towards the a1pms since dmaap is not configured yet
201           a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
202
203
204           if [ $__httpx == "HTTPS" ]; then
205               use_simulator_https
206               use_mr_https
207               if [[ $interface = *"SDNC"* ]]; then
208                   if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
209                       deviation "SDNC does not support NB https"
210                       use_sdnc_http
211                   else
212                       use_sdnc_https
213                   fi
214               fi
215               if [[ $interface = *"DMAAP"* ]]; then
216                   use_a1pms_dmaap_https
217               else
218                   use_a1pms_rest_https
219               fi
220           else
221               use_simulator_http
222               use_mr_http
223               if [[ $interface = *"SDNC"* ]]; then
224                   use_sdnc_http
225               fi
226               if [[ $interface = *"DMAAP"* ]]; then
227                   use_a1pms_dmaap_http
228               else
229                   use_a1pms_rest_http
230               fi
231           fi
232
233           start_ric_simulators ricsim_g1 1  OSC_2.1.0
234           start_ric_simulators ricsim_g2 1  STD_1.1.3
235
236           sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
237           sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
238
239           start_ric_simulators ricsim_g3 1  STD_2.0.0
240           sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
241           sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
242
243           if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
244               :
245           else
246               start_mr
247           fi
248
249           start_cr 1
250
251           start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
252
253           if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
254               start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
255           fi
256
257
258           if [[ $interface = *"SDNC"* ]]; then
259               start_sdnc
260               controller_api_wait_for_status_ok 200 ricsim_g1_1
261               prepare_a1pms_config      SDNC    ".a1pms_config.json"
262           else
263               prepare_a1pms_config      NOSDNC  ".a1pms_config.json"
264           fi
265
266           if [ $RUNMODE == "KUBE" ]; then
267               a1pms_load_config                       ".a1pms_config.json"
268           else
269               #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config
270               if [ $__httpx == "HTTPS" ]; then
271                   use_a1pms_rest_https
272               else
273                   use_a1pms_rest_http
274               fi
275
276               if [[ $interface != *"DMAAP"* ]]; then
277                   echo "{}" > ".a1pms_config_incorrect.json"
278                   a1pms_api_put_configuration 400 ".a1pms_config_incorrect.json"
279               fi
280
281               a1pms_api_put_configuration 200 ".a1pms_config.json"
282               a1pms_api_get_configuration 200 ".a1pms_config.json"
283               if [ $__httpx == "HTTPS" ]; then
284                   if [[ $interface = *"DMAAP"* ]]; then
285                       use_a1pms_dmaap_https
286                   else
287                       use_a1pms_rest_https
288                   fi
289               else
290                   if [[ $interface = *"DMAAP"* ]]; then
291                       use_a1pms_dmaap_http
292                   else
293                       use_a1pms_rest_http
294                   fi
295               fi
296           fi
297
298           a1pms_equal json:rics 3 300
299
300           if [ "$A1PMS_VERSION" == "V2" ]; then
301             a1pms_equal json:policy-types 5 120  #Wait for the a1pms to refresh types from the simulator
302           elif [ "$A1PMS_VERSION" == "V3" ]; then
303             a1pms_equal json:policytypes 5 120  #Wait for the a1pms to refresh types from the simulator
304           fi
305
306           a1pms_equal json:policies 0
307
308           if [ "$A1PMS_VERSION" == "V2" ]; then
309             a1pms_equal json:policy-instances 0
310           fi
311
312           cr_equal 0 received_callbacks 3 120
313           cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
314
315           if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
316               :
317           else
318               mr_equal requests_submitted 0
319           fi
320
321
322           echo "############################################"
323           echo "############## Health check ################"
324           echo "############################################"
325
326           sleep_wait 120 "Let A1PMS configuration take effect"
327
328           a1pms_api_get_status 200
329
330           a1pms_api_get_status_root 200
331
332           echo "############################################"
333           echo "##### Service registry and supervision #####"
334           echo "############################################"
335
336           a1pms_api_get_services 404 "service1"
337
338           a1pms_api_put_service 201 "service1" 1000 "$CR_SERVICE_APP_PATH_0/1"
339
340           a1pms_api_put_service 200 "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
341
342
343           a1pms_api_put_service 400 "service2" -1 "$CR_SERVICE_APP_PATH_0/2"
344
345           a1pms_api_put_service 400 "service2" "wrong" "$CR_SERVICE_APP_PATH_0/2"
346
347           a1pms_api_put_service 400 "service2" 100 "/test"
348
349           a1pms_api_put_service 400 "service2" 100 "test-path"
350
351           a1pms_api_put_service 201 "service2" 300 "ftp://localhost:80/test"
352
353           a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
354
355           a1pms_api_get_service_ids 200 "service1" "service2" "ric-registration"
356
357           a1pms_api_put_service 201 "service3" 5000 "$CR_SERVICE_APP_PATH_0/3"
358
359
360           a1pms_api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
361
362
363           a1pms_api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
364
365           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"
366
367           a1pms_api_get_services 200
368
369           if [ "$A1PMS_VERSION" == "V2" ]; then
370             deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
371             #The below should work, kept here until fixed or other decision made
372             #a1pms_api_put_services_keepalive 201 "service1"
373             #Using the below until decision
374             a1pms_api_put_services_keepalive 200 "service1"
375
376             deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
377             #The below should work, keept here until fixed or other decision made
378             #a1pms_api_put_services_keepalive 201 "service3"
379             #Using the below until decision
380             a1pms_api_put_services_keepalive 200 "service3"
381
382             a1pms_api_put_services_keepalive 200 "service1"
383
384             a1pms_api_put_services_keepalive 200 "service3"
385
386             a1pms_api_put_services_keepalive 404 "service5"
387           fi
388
389           a1pms_api_get_service_ids 200 "service1" "service2" "service3"  "ric-registration"
390
391           a1pms_api_delete_services 204 "service1"
392
393           a1pms_api_get_service_ids 200 "service2" "service3" "ric-registration"
394
395
396           a1pms_api_put_service 201 "service1" 50 "$CR_SERVICE_APP_PATH_0/1"
397
398           a1pms_api_get_service_ids 200 "service1" "service2" "service3"  "ric-registration"
399
400
401           a1pms_api_delete_services 204 "service1"
402           a1pms_api_delete_services 204 "service3"
403
404           a1pms_equal json:services 2
405
406           a1pms_api_delete_services 204 "service2"
407
408           a1pms_equal json:services 1
409
410           echo "############################################"
411           echo "############## RIC Repository ##############"
412           echo "############################################"
413
414           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"
415
416           a1pms_api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
417
418           a1pms_api_get_rics 404 47
419
420           a1pms_api_get_rics 404 "test"
421
422           a1pms_api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
423
424           a1pms_api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
425
426           a1pms_api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
427
428           a1pms_api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
429
430           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"
431
432           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"
433
434           a1pms_api_get_ric 200 NOME      ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
435
436           a1pms_api_get_ric 200 NOME      ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
437
438           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"
439
440           a1pms_api_get_ric 404 NOME test1
441
442           a1pms_api_get_ric 404 test NORIC
443
444           a1pms_api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
445
446           a1pms_api_get_ric 400 me1_ricsim_g1_1 TESTRIC
447
448           a1pms_api_get_ric 400 TESTME ricsim_g1_1
449
450           echo "############################################"
451           echo "########### A1 Policy Management ###########"
452           echo "############################################"
453
454           deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx"
455           #Behaviour accepted for now
456           a1pms_api_get_policy_type 200 1 testdata/OSC/1-a1pms-modified.json
457           deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx"
458           #Behaviour accepted for now
459           a1pms_api_get_policy_type 200 2 testdata/OSC/2-a1pms-modified.json
460           deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx"
461           #Behaviour accepted for now
462           a1pms_api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-a1pms-modified.json
463           deviation "TR9 - a1pms modify the type with type id - test combo $interface and $__httpx"
464           #Behaviour accepted for now
465           a1pms_api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-a1pms-modified.json
466
467           a1pms_api_get_policy_type 404 3
468           if [ "$A1PMS_VERSION" != "V3" ]; then
469             a1pms_api_get_policy_schemas 404
470
471             a1pms_api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
472
473             a1pms_api_get_policy_types 200 ricsim_g1_1 1 2
474
475             a1pms_api_get_policy_types 200 ricsim_g2_1 EMPTY
476
477             a1pms_api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
478
479             a1pms_api_get_policy_types 404 dummy-ric
480           fi
481
482           if [ "$A1PMS_VERSION" == "V3" ]; then
483
484             a1pms_api_get_policy_types_v3 200 NORIC 1:ricsim_g1_1 2:ricsim_g1_1 EMPTY:ricsim_g2_1 STD_QOS_0_2_0:ricsim_g3_1 STD_QOS2_0.1.0:ricsim_g3_1
485
486             a1pms_api_get_policy_types_v3 200 ricsim_g1_1 1:ricsim_g1_1 2:ricsim_g1_1
487
488             a1pms_api_get_policy_types_v3 200 ricsim_g2_1 EMPTY:ricsim_g2_1
489
490             a1pms_api_get_policy_types_v3 200 ricsim_g3_1 STD_QOS_0_2_0:ricsim_g3_1 STD_QOS2_0.1.0:ricsim_g3_1
491
492             a1pms_api_get_policy_types_v3 404 dummy-ric
493
494             a1pms_api_post_policy_v3 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT NONOTIFYURL testdata/OSC/pi1_template.json
495
496             a1pms_api_post_policy_v3 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT NONOTIFYURL testdata/OSC/pi1_template.json
497
498             a1pms_api_post_policy_v3 201 NOSERVICE ricsim_g2_1 NOTYPE 5100 NOTRANSIENT NONOTIFYURL testdata/STD/pi1_template.json
499
500             a1pms_api_post_policy_v3 201 NOSERVICE ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT NONOTIFYURL testdata/STD2/pi_qos2_template.json
501           fi
502
503           a1pms_api_put_service 201 "service10" 3600 "$CR_SERVICE_APP_PATH_0/1"
504
505           notificationurl=$CR_SERVICE_APP_PATH_0"/test"
506           deviation "TR10 - a1pms allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
507
508           if [ "$A1PMS_VERSION" != "V3" ]; then
509
510             if [[ $interface != *"DMAAP"* ]]; then
511                 # Badly formatted json is not possible to send via dmaap
512                 a1pms_api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi_bad_template.json
513             fi
514             a1pms_api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
515
516             a1pms_api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
517             a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
518
519             a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
520             a1pms_api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
521
522             a1pms_api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
523             a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
524
525             a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
526             a1pms_api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
527
528             a1pms_api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
529             a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
530
531             a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
532             a1pms_api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
533
534             a1pms_api_get_policy_status 404 1
535             a1pms_api_get_policy_status 404 2
536             if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then
537               VAL='NOT IN EFFECT'
538               VAL2="false"
539               VAL3=EMPTY
540               VAL4=EMPTY
541             else
542               VAL="NOT_ENFORCED"
543               VAL2="OTHER_REASON"
544               VAL3="NOT_ENFORCED"
545               VAL4="OTHER_REASON"
546             fi
547             a1pms_api_get_policy_status 200 5000 OSC "$VAL" "$VAL2"
548             a1pms_api_get_policy_status 200 5100 STD "UNDEFINED"
549             a1pms_api_get_policy_status 200 5200 STD2 $VAL3 $VAL4
550
551             deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
552             #kept until decision
553             #a1pms_equal json:policy_ids 2
554             #Allow 3 for now
555             a1pms_equal json:policy-instances 4
556           fi
557
558           deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
559           #kept until decision
560           #a1pms_equal json:policies 2
561           #Allow 3 for now
562           a1pms_equal json:policies 4
563
564           deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
565           #kept until decision
566           #a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
567           #Allow policy create with unregistered service for now
568
569           if [ "$A1PMS_VERSION" != "V3" ]; then
570             a1pms_api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
571
572             deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
573             #kept until decision
574             #a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
575             #Allow policy create with unregistered service for now
576             a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
577
578             a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
579
580             a1pms_api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
581
582             a1pms_api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
583
584             deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
585             #kept until decision
586             #a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000
587             #Allow policy create with unregistered service for now
588
589             a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
590
591             a1pms_api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
592
593             a1pms_api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
594
595             a1pms_api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
596           fi
597
598           if [ "$A1PMS_VERSION" == "V3" ]; then
599             a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE NOTYPE 5000:ricsim_g1_1 5100:ricsim_g2_1 2000:ricsim_g1_1 5200:ricsim_g3_1
600
601             deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
602             #kept until decision
603             #a1pms_api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
604             #Allow policy create with unregistered service for now
605             a1pms_api_get_all_policies_v3 200 ricsim_g1_1 NOSERVICE NOTYPE 5000:ricsim_g1_1 2000:ricsim_g1_1
606
607             a1pms_api_get_all_policies_v3 200 ricsim_g2_1 NOSERVICE NOTYPE 5100:ricsim_g2_1
608
609             a1pms_api_get_all_policies_v3 200 ricsim_g3_1 NOSERVICE NOTYPE 5200:ricsim_g3_1
610
611             a1pms_api_get_all_policies_v3 200 NORIC "service10" NOTYPE 5000:ricsim_g1_1
612
613             deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
614             #kept until decision
615             #a1pms_api_get_policy_ids 200 NORIC NOSERVICE 1 5000
616             #Allow policy create with unregistered service for now
617
618             a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE 1 5000:ricsim_g1_1 2000:ricsim_g1_1
619
620             a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE 2 NOID
621
622             a1pms_api_get_all_policies_v3 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200:ricsim_g3_1
623
624             a1pms_api_get_all_policies_v3 200 ricsim_g2_1 NOSERVICE 1 NOID
625           fi
626
627           a1pms_api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
628
629           a1pms_api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
630
631           a1pms_api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 false $notificationurl
632
633           if [ "$A1PMS_VERSION" != "V3" ]; then
634             a1pms_api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
635           fi
636
637           if [ "$A1PMS_VERSION" == "V3" ]; then
638             a1pms_api_put_policy_v3 200 5100 testdata/STD/pi1_template.json
639
640             a1pms_api_put_policy_v3 200 5200 testdata/STD2/pi_qos2_template.json
641
642             if [[ $interface != *"DMAAP"* ]]; then
643                 a1pms_api_put_policy_v3 400 2000 testdata/OSC/pi_bad_template.json
644             fi
645           fi
646           deviation "TR10 - a1pms allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
647           #kept until decision
648           #a1pms_api_delete_policy 404 2000
649           #Allow policy create with unregistered service for now
650           a1pms_api_delete_policy 204 2000
651
652           a1pms_api_delete_policy 404 1500
653
654           a1pms_api_delete_policy 204 5000
655
656           a1pms_api_delete_policy 204 5200
657
658           a1pms_equal json:policies 1
659
660           if [ "$A1PMS_VERSION" != "V3" ]; then
661             a1pms_equal json:policy-instances 1
662           fi
663
664           a1pms_api_delete_policy 204 5100
665
666           a1pms_equal json:policies 0
667
668           if [ "$A1PMS_VERSION" != "V3" ]; then
669             a1pms_equal json:policy-instances 0
670           fi
671
672           cr_equal 0 received_callbacks 3
673
674           if [[ $interface = *"DMAAP"* ]]; then
675               mr_greater requests_submitted 0
676               VAL=$(mr_read requests_submitted)
677               mr_equal requests_fetched $VAL
678               mr_equal responses_submitted $VAL
679               mr_equal responses_fetched $VAL
680               mr_equal current_requests 0
681               mr_equal current_responses 0
682           else
683               if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
684                   :
685               else
686                   mr_equal requests_submitted 0
687               fi
688           fi
689           if [ $USE_ISTIO -eq 0 ]; then
690               if [[ $interface = *"SDNC"* ]]; then
691                   sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
692                   sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
693                   sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
694               else
695                   sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
696                   sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
697                   sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
698               fi
699           fi
700
701           check_a1pms_logs
702
703           if [[ $interface = *"SDNC"* ]]; then
704               check_sdnc_logs
705           fi
706
707           store_logs          "${__httpx}__${interface}"
708
709       done
710
711   done
712
713 done
714 #### TEST COMPLETE ####
715
716
717 print_result
718
719 auto_clean_environment