blob: 670ea5e773599ca95165a5d340ac0306b42087d8 [file] [log] [blame]
BjornMagnussonXA70e878f2020-05-11 14:11:30 +02001#!/bin/bash
BjornMagnussonXA80a92002020-03-19 14:31:06 +01002
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
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010021TC_ONELINE_DESCR="Full agent API walkthrough using agent REST/DMAAP and with/without SDNC A1 Controller"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010022
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010023#App names to include in the test when running docker, space separated list
BjornMagnussonXA663566c2021-11-08 10:25:07 +010024DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW KUBEPROXY"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020025
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010026#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXA674793d2021-05-06 19:49:17 +020027KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010028#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29KUBE_PRESTARTED_IMAGES=""
30
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010031#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
34CONDITIONALLY_IGNORED_IMAGES="NGW"
35
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010036#Supported test environment profiles
BjornMagnussonXAe60d04e2021-12-27 13:38:01 +010037SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010040
BjornMagnussonXA79e37002021-11-22 13:36:04 +010041. ../common/testcase_common.sh $@
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010042
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010043setup_testenvironment
BjornMagnussonXA80a92002020-03-19 14:31:06 +010044
45#### TEST BEGIN ####
46
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010047generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020048
BjornMagnussonXA80a92002020-03-19 14:31:06 +010049# Tested variants of REST/DMAAP/SDNC config
50TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010051
BjornMagnussonXA72667f12020-04-24 09:20:18 +020052#Test agent and simulator protocol versions (others are http only)
53TESTED_PROTOCOLS="HTTP HTTPS"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010054
BjornMagnussonXA72667f12020-04-24 09:20:18 +020055for __httpx in $TESTED_PROTOCOLS ; do
56 for interface in $TESTED_VARIANTS ; do
BjornMagnussonXA80a92002020-03-19 14:31:06 +010057
BjornMagnussonXA72667f12020-04-24 09:20:18 +020058 echo "#####################################################################"
59 echo "#####################################################################"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020060 echo "### Testing agent: $interface using $__httpx"
BjornMagnussonXA72667f12020-04-24 09:20:18 +020061 echo "#####################################################################"
62 echo "#####################################################################"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010063
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010064 # Clean container and start all needed containers #
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010065 clean_environment
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010066
BjornMagnussonXA663566c2021-11-08 10:25:07 +010067 start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010068
BjornMagnussonXA496156d2020-08-10 14:16:24 +020069 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010070 use_cr_https
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010071 use_agent_rest_https
72 else
73 use_agent_rest_http
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010074 use_cr_http
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010075 fi
76
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010077 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010078
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010079 set_agent_debug
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010080
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
BjornMagnussonXA79e37002021-11-22 13:36:04 +010083 api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010084
85
86 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020087 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
BjornMagnussonXA496156d2020-08-10 14:16:24 +020097 else
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020098 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
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200108 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100109
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200110 start_ric_simulators ricsim_g1 1 OSC_2.1.0
111 start_ric_simulators ricsim_g2 1 STD_1.1.3
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100112 if [ "$PMS_VERSION" == "V2" ]; then
113 start_ric_simulators ricsim_g3 1 STD_2.0.0
114 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100115
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200116 start_mr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100117
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100118 start_cr 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100119
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +0100120 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
121
122 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
123 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
124 fi
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100125
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100126 if [ $RUNMODE == "DOCKER" ]; then
127 start_consul_cbs
128 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100129
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200130 if [[ $interface = *"SDNC"* ]]; then
131 start_sdnc
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200132 prepare_consul_config SDNC ".consul_config.json"
133 else
134 prepare_consul_config NOSDNC ".consul_config.json"
135 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100136
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100137 if [ $RUNMODE == "KUBE" ]; then
138 agent_load_config ".consul_config.json"
139 else
140 consul_config_app ".consul_config.json"
141 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100142
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200143 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
144 sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100145
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100146 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100147 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
148 sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
149
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100150 api_equal json:rics 3 300
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200151
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100152 api_equal json:policy-types 5 120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200153
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100154 api_equal json:policies 0
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200155
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100156 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100157 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100158 api_equal json:rics 2 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100159
160 api_equal json:policy_schemas 3 120
161
162 api_equal json:policy_types 3
163
164 api_equal json:policies 0
165
166 api_equal json:policy_ids 0
167 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200168
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100169 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100170 cr_equal 0 received_callbacks 3 120
171 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100172 fi
173 mr_equal requests_submitted 0
174
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200175
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200176 echo "############################################"
177 echo "############## Health check ################"
178 echo "############################################"
179
180 api_get_status 200
181
182 echo "############################################"
183 echo "##### Service registry and supervision #####"
184 echo "############################################"
185
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200186 api_get_services 404 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200187
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100188 api_put_service 201 "service1" 1000 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200189
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100190 api_put_service 200 "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200191
192
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100193 api_put_service 400 "service2" -1 "$CR_SERVICE_APP_PATH_0/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200194
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100195 api_put_service 400 "service2" "wrong" "$CR_SERVICE_APP_PATH_0/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200196
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200197 api_put_service 400 "service2" 100 "/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200198
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200199 api_put_service 400 "service2" 100 "test-path"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200200
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200201 api_put_service 201 "service2" 300 "ftp://localhost:80/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200202
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100203 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200204
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100205 api_get_service_ids 200 "service1" "service2" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200206
207
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100208 api_put_service 201 "service3" 5000 "$CR_SERVICE_APP_PATH_0/3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200209
210
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100211 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200212
213
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100214 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200215
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100216 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"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200217
218 api_get_services 200
219
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200220 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
221 #The below should work, keept here until fixed or other decision made
222 #api_put_services_keepalive 201 "service1"
223 #Using the below until decision
224 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200225
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200226 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
227 #The below should work, keept here until fixed or other decision made
228 #api_put_services_keepalive 201 "service3"
229 #Using the below until decision
230 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200231
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200232 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200233
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200234 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200235
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200236 api_put_services_keepalive 404 "service5"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200237
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100238 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200239
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200240 api_delete_services 204 "service1"
241
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100242 api_get_service_ids 200 "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200243
244
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100245 api_put_service 201 "service1" 50 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200246
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100247 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200248
249
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200250 api_delete_services 204 "service1"
251 api_delete_services 204 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200252
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100253 api_equal json:services 2
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200254
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200255 api_delete_services 204 "service2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200256
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100257 api_equal json:services 1
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200258
259
260 echo "############################################"
261 echo "############## RIC Repository ##############"
262 echo "############################################"
263
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100264 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100265 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"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100266 else
267 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"
268 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200269 api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
270
271 api_get_rics 404 47
272
273 api_get_rics 404 "test"
274
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100275 if [ "$PMS_VERSION" == "V2" ]; then
276 api_get_ric 200 me1_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200277
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100278 api_get_ric 200 me2_ricsim_g1_1 NORIC "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200279
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100280 api_get_ric 200 me1_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200281
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100282 api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200283
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100284 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"
285
286 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"
287
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100288 api_get_ric 200 NOME ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200289
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100290 api_get_ric 200 NOME ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200291
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100292 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"
293
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100294 api_get_ric 404 NOME test1
295
296 api_get_ric 404 test NORIC
297
298 api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
299
300 api_get_ric 400 me1_ricsim_g1_1 TESTRIC
301
302 api_get_ric 400 TESTME ricsim_g1_1
303
304 else
305 api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
306
307 api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
308
309 api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
310
311 api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
312
313 api_get_ric 404 test
314 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200315
316 echo "############################################"
317 echo "########### A1 Policy Management ###########"
318 echo "############################################"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200319
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100320 if [ "$PMS_VERSION" == "V2" ]; then
321 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
322 #Behaviour accepted for now
323 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
324 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
325 #Behaviour accepted for now
326 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100327 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
328 #Behaviour accepted for now
329 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
330 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
331 #Behaviour accepted for now
332 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200333
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100334 api_get_policy_type 404 3
335 else
336 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
337 #Behaviour accepted for now
338 api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
339 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
340 #Behaviour accepted for now
341 api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200342
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100343 api_get_policy_schema 404 3
344 fi
345
346 if [ "$PMS_VERSION" == "V2" ]; then
347 api_get_policy_schemas 404
348 else
349 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
350 #Behaviour accepted for now
351 api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
352 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
353 #Behaviour accepted for now
354 api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
355
356 api_get_policy_schemas 200 ricsim_g2_1 NOFILE
357
358 api_get_policy_schemas 404 test
359 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200360
361
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100362 if [ "$PMS_VERSION" == "V2" ]; then
363 api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
364 else
365 api_get_policy_types 200 NORIC 1 2 EMPTY
366 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200367
368 api_get_policy_types 200 ricsim_g1_1 1 2
369
370 api_get_policy_types 200 ricsim_g2_1 EMPTY
371
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100372 if [ "$PMS_VERSION" == "V2" ]; then
373 api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
374 fi
375
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200376 api_get_policy_types 404 dummy-ric
377
378
379
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100380 api_put_service 201 "service10" 3600 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200381
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100382 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100383 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100384 else
385 notificationurl=""
386 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200387 deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
388 #Kept until decison
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200389 #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200390 #Allow 201 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100391 api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200392
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100393 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
394 api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200395
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100396 api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
397 api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200398
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100399 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
400 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200401
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100402 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
403 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200404
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100405 if [ "$PMS_VERSION" == "V2" ]; then
406 api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
407 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
408
409 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
410 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
411 fi
412
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200413 VAL='NOT IN EFFECT'
414 api_get_policy_status 200 5000 OSC "$VAL" "false"
415 api_get_policy_status 200 5100 STD "UNDEFINED"
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100416 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100417 api_get_policy_status 200 5200 STD2 EMPTY EMPTY
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100418 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200419
420
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200421 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
422 #kept until decision
423 #api_equal json:policies 2
424 #Allow 3 for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100425 if [ "$PMS_VERSION" == "V2" ]; then
426 api_equal json:policies 4
427 else
428 api_equal json:policies 3
429 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200430
431 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
432 #kept until decision
433 #api_equal json:policy_ids 2
434 #Allow 3 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100435 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100436 api_equal json:policy-instances 4
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100437 else
438 api_equal json:policy_ids 3
439 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200440
441 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
442 #kept until decision
443 #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
444 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100445 if [ "$PMS_VERSION" == "V2" ]; then
446 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
447 else
448 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
449 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200450
451 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
452 #kept until decision
453 #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
454 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100455 if [ "$PMS_VERSION" == "V2" ]; then
456 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200457
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100458 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
459
460 api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
461
462 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
463 else
464 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
465
466 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200467
468
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100469 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
470 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200471
472 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
473 #kept until decision
474 #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
475 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100476
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200477 api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200478
479 api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
480
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100481 if [ "$PMS_VERSION" == "V2" ]; then
482 api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
483 fi
484
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200485 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
486
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100487 if [ "$PMS_VERSION" == "V2" ]; then
488 api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200489
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100490 api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200491
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100492 api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 false $notificationurl
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100493
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100494 api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100495 else
496 api_get_policy 200 5000 testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200497
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100498 api_get_policy 200 5100 testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200499
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100500 api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
501 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200502
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200503 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
504 #kept until decision
505 #api_delete_policy 404 2000
506 #Allow policy create with unregistered service for now
507 api_delete_policy 204 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200508
509 api_delete_policy 404 1500
510
511 api_delete_policy 204 5000
512
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100513 if [ "$PMS_VERSION" == "V2" ]; then
514
515 api_delete_policy 204 5200
516 fi
517
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200518 api_equal json:policies 1
519
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100520
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100521 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100522 api_equal json:policy-instances 1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100523 else
524 api_equal json:policy_ids 1
525 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200526
527 api_delete_policy 204 5100
528
529 api_equal json:policies 0
530
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100531 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100532 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100533 else
534 api_equal json:policy_ids 0
535 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200536
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100537 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100538 cr_equal 0 received_callbacks 3
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100539 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200540
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200541 if [[ $interface = *"DMAAP"* ]]; then
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200542 mr_greater requests_submitted 0
543 VAL=$(mr_read requests_submitted)
544 mr_equal requests_fetched $VAL
545 mr_equal responses_submitted $VAL
546 mr_equal responses_fetched $VAL
547 mr_equal current_requests 0
548 mr_equal current_responses 0
549 else
550 mr_equal requests_submitted 0
551 fi
552
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200553 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100554 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
555 sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100556 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100557 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100558 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200559 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100560 sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
561 sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100562 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100563 sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100564 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200565 fi
566
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200567 check_policy_agent_logs
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200568
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100569 if [[ $interface = *"SDNC"* ]]; then
570 check_sdnc_logs
571 fi
572
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200573 store_logs "${__httpx}__${interface}"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200574
575 done
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100576
577done
578
579#### TEST COMPLETE ####
580
581
582print_result
583
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100584auto_clean_environment