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