blob: fd6b9a4cc52bd6557a8c46a08b266e999e777aa3 [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
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010024DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW"
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
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010027KUBE_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
BjornMagnussonXA89b64ab2020-12-16 09:21:01 +010037SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010040
BjornMagnussonXA80a92002020-03-19 14:31:06 +010041. ../common/testcase_common.sh $@
42. ../common/agent_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010043. ../common/consul_cbs_functions.sh
44. ../common/control_panel_api_functions.sh
45. ../common/controller_api_functions.sh
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010046. ../common/cr_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010047. ../common/mr_api_functions.sh
48. ../common/ricsimulator_api_functions.sh
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010049. ../common/kube_proxy_api_functions.sh
50. ../common/gateway_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010051
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010052setup_testenvironment
BjornMagnussonXA80a92002020-03-19 14:31:06 +010053
54#### TEST BEGIN ####
55
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010056generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020057
BjornMagnussonXA80a92002020-03-19 14:31:06 +010058# Tested variants of REST/DMAAP/SDNC config
59TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010060
BjornMagnussonXA72667f12020-04-24 09:20:18 +020061#Test agent and simulator protocol versions (others are http only)
62TESTED_PROTOCOLS="HTTP HTTPS"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010063
BjornMagnussonXA72667f12020-04-24 09:20:18 +020064for __httpx in $TESTED_PROTOCOLS ; do
65 for interface in $TESTED_VARIANTS ; do
BjornMagnussonXA80a92002020-03-19 14:31:06 +010066
BjornMagnussonXA72667f12020-04-24 09:20:18 +020067 echo "#####################################################################"
68 echo "#####################################################################"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020069 echo "### Testing agent: $interface using $__httpx"
BjornMagnussonXA72667f12020-04-24 09:20:18 +020070 echo "#####################################################################"
71 echo "#####################################################################"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010072
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010073 # Clean container and start all needed containers #
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010074 clean_environment
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010075
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010076 if [ $RUNMODE == "KUBE" ]; then
77 start_kube_proxy
78 fi
79
BjornMagnussonXA496156d2020-08-10 14:16:24 +020080 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010081 use_cr_https
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010082 use_agent_rest_https
83 else
84 use_agent_rest_http
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010085 use_cr_http
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010086 fi
87
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010088 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010089
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010090 set_agent_debug
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010091
92 # Create service to be able to receive events when rics becomes available
93 # Must use rest towards the agent since dmaap is not configured yet
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010094 api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010095
96
97 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020098 use_simulator_https
99 use_mr_https
100 if [[ $interface = *"SDNC"* ]]; then
101 use_sdnc_https
102 fi
103 if [[ $interface = *"DMAAP"* ]]; then
104 use_agent_dmaap_https
105 else
106 use_agent_rest_https
107 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200108 else
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200109 use_simulator_http
110 use_mr_http
111 if [[ $interface = *"SDNC"* ]]; then
112 use_sdnc_http
113 fi
114 if [[ $interface = *"DMAAP"* ]]; then
115 use_agent_dmaap_http
116 else
117 use_agent_rest_http
118 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200119 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200121 start_ric_simulators ricsim_g1 1 OSC_2.1.0
122 start_ric_simulators ricsim_g2 1 STD_1.1.3
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100123 if [ "$PMS_VERSION" == "V2" ]; then
124 start_ric_simulators ricsim_g3 1 STD_2.0.0
125 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100126
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200127 start_mr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100128
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200129 start_cr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100130
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +0100131 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
132
133 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
134 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
135 fi
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100136
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100137 if [ $RUNMODE == "DOCKER" ]; then
138 start_consul_cbs
139 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100140
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200141 if [[ $interface = *"SDNC"* ]]; then
142 start_sdnc
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200143 prepare_consul_config SDNC ".consul_config.json"
144 else
145 prepare_consul_config NOSDNC ".consul_config.json"
146 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100147
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100148 if [ $RUNMODE == "KUBE" ]; then
149 agent_load_config ".consul_config.json"
150 else
151 consul_config_app ".consul_config.json"
152 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100153
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200154 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
155 sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100156
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100157 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100158 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
159 sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
160
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100161 api_equal json:rics 3 300
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200162
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100163 api_equal json:policy-types 5 120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200164
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100165 api_equal json:policies 0
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200166
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100167 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100168 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100169 api_equal json:rics 2 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100170
171 api_equal json:policy_schemas 3 120
172
173 api_equal json:policy_types 3
174
175 api_equal json:policies 0
176
177 api_equal json:policy_ids 0
178 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200179
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100180 if [ "$PMS_VERSION" == "V2" ]; then
181 cr_equal received_callbacks 3 120
182 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
183 fi
184 mr_equal requests_submitted 0
185
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200186
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200187 echo "############################################"
188 echo "############## Health check ################"
189 echo "############################################"
190
191 api_get_status 200
192
193 echo "############################################"
194 echo "##### Service registry and supervision #####"
195 echo "############################################"
196
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200197 api_get_services 404 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200198
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100199 api_put_service 201 "service1" 1000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200200
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100201 api_put_service 200 "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200202
203
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100204 api_put_service 400 "service2" -1 "$CR_SERVICE_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200205
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100206 api_put_service 400 "service2" "wrong" "$CR_SERVICE_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200207
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200208 api_put_service 400 "service2" 100 "/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200209
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200210 api_put_service 400 "service2" 100 "test-path"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200211
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200212 api_put_service 201 "service2" 300 "ftp://localhost:80/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200213
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100214 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200215
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100216 api_get_service_ids 200 "service1" "service2" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200217
218
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100219 api_put_service 201 "service3" 5000 "$CR_SERVICE_PATH/3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200220
221
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100222 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200223
224
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100225 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200226
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100227 api_get_services 200 NOSERVICE "service1" 2000 "$CR_SERVICE_PATH/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_SERVICE_PATH/3" "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200228
229 api_get_services 200
230
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200231 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
232 #The below should work, keept here until fixed or other decision made
233 #api_put_services_keepalive 201 "service1"
234 #Using the below until decision
235 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200236
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200237 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
238 #The below should work, keept here until fixed or other decision made
239 #api_put_services_keepalive 201 "service3"
240 #Using the below until decision
241 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200242
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200243 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200244
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200245 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200246
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200247 api_put_services_keepalive 404 "service5"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200248
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100249 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200250
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200251 api_delete_services 204 "service1"
252
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100253 api_get_service_ids 200 "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200254
255
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100256 api_put_service 201 "service1" 50 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200257
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100258 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200259
260
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200261 api_delete_services 204 "service1"
262 api_delete_services 204 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200263
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100264 api_equal json:services 2
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200265
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200266 api_delete_services 204 "service2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200267
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100268 api_equal json:services 1
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200269
270
271 echo "############################################"
272 echo "############## RIC Repository ##############"
273 echo "############################################"
274
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100275 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100276 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 +0100277 else
278 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"
279 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200280 api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
281
282 api_get_rics 404 47
283
284 api_get_rics 404 "test"
285
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100286 if [ "$PMS_VERSION" == "V2" ]; then
287 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 +0200288
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100289 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 +0200290
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100291 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 +0200292
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100293 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 +0200294
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100295 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"
296
297 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"
298
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100299 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 +0200300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100301 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 +0200302
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100303 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"
304
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100305 api_get_ric 404 NOME test1
306
307 api_get_ric 404 test NORIC
308
309 api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
310
311 api_get_ric 400 me1_ricsim_g1_1 TESTRIC
312
313 api_get_ric 400 TESTME ricsim_g1_1
314
315 else
316 api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
317
318 api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
319
320 api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
321
322 api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
323
324 api_get_ric 404 test
325 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200326
327 echo "############################################"
328 echo "########### A1 Policy Management ###########"
329 echo "############################################"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200330
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100331 if [ "$PMS_VERSION" == "V2" ]; then
332 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
333 #Behaviour accepted for now
334 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
335 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
336 #Behaviour accepted for now
337 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100338 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
339 #Behaviour accepted for now
340 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
341 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
342 #Behaviour accepted for now
343 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200344
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100345 api_get_policy_type 404 3
346 else
347 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
348 #Behaviour accepted for now
349 api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
350 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
351 #Behaviour accepted for now
352 api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200353
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100354 api_get_policy_schema 404 3
355 fi
356
357 if [ "$PMS_VERSION" == "V2" ]; then
358 api_get_policy_schemas 404
359 else
360 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
361 #Behaviour accepted for now
362 api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
363 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
364 #Behaviour accepted for now
365 api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
366
367 api_get_policy_schemas 200 ricsim_g2_1 NOFILE
368
369 api_get_policy_schemas 404 test
370 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200371
372
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100373 if [ "$PMS_VERSION" == "V2" ]; then
374 api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
375 else
376 api_get_policy_types 200 NORIC 1 2 EMPTY
377 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200378
379 api_get_policy_types 200 ricsim_g1_1 1 2
380
381 api_get_policy_types 200 ricsim_g2_1 EMPTY
382
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100383 if [ "$PMS_VERSION" == "V2" ]; then
384 api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
385 fi
386
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200387 api_get_policy_types 404 dummy-ric
388
389
390
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100391 api_put_service 201 "service10" 3600 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200392
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100393 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100394 notificationurl=$CR_SERVICE_PATH"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100395 else
396 notificationurl=""
397 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200398 deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
399 #Kept until decison
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200400 #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200401 #Allow 201 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100402 api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200403
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100404 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
405 api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200406
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100407 api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
408 api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200409
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100410 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
411 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200412
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100413 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
414 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200415
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100416 if [ "$PMS_VERSION" == "V2" ]; then
417 api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
418 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
419
420 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
421 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
422 fi
423
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200424 VAL='NOT IN EFFECT'
425 api_get_policy_status 200 5000 OSC "$VAL" "false"
426 api_get_policy_status 200 5100 STD "UNDEFINED"
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100427 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100428 api_get_policy_status 200 5200 STD2 EMPTY EMPTY
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100429 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200430
431
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200432 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
433 #kept until decision
434 #api_equal json:policies 2
435 #Allow 3 for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100436 if [ "$PMS_VERSION" == "V2" ]; then
437 api_equal json:policies 4
438 else
439 api_equal json:policies 3
440 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200441
442 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
443 #kept until decision
444 #api_equal json:policy_ids 2
445 #Allow 3 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100446 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100447 api_equal json:policy-instances 4
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100448 else
449 api_equal json:policy_ids 3
450 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200451
452 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
453 #kept until decision
454 #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
455 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100456 if [ "$PMS_VERSION" == "V2" ]; then
457 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
458 else
459 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
460 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200461
462 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
463 #kept until decision
464 #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
465 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100466 if [ "$PMS_VERSION" == "V2" ]; then
467 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200468
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100469 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
470
471 api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
472
473 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
474 else
475 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
476
477 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200478
479
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100480 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
481 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200482
483 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
484 #kept until decision
485 #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
486 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100487
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200488 api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200489
490 api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
491
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100492 if [ "$PMS_VERSION" == "V2" ]; then
493 api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
494 fi
495
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200496 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
497
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100498 if [ "$PMS_VERSION" == "V2" ]; then
499 api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200500
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100501 api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200502
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100503 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 +0100504
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100505 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 +0100506 else
507 api_get_policy 200 5000 testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200508
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100509 api_get_policy 200 5100 testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200510
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100511 api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
512 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200513
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200514 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
515 #kept until decision
516 #api_delete_policy 404 2000
517 #Allow policy create with unregistered service for now
518 api_delete_policy 204 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200519
520 api_delete_policy 404 1500
521
522 api_delete_policy 204 5000
523
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100524 if [ "$PMS_VERSION" == "V2" ]; then
525
526 api_delete_policy 204 5200
527 fi
528
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200529 api_equal json:policies 1
530
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100531
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100532 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100533 api_equal json:policy-instances 1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100534 else
535 api_equal json:policy_ids 1
536 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200537
538 api_delete_policy 204 5100
539
540 api_equal json:policies 0
541
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100542 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100543 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100544 else
545 api_equal json:policy_ids 0
546 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200547
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100548 if [ "$PMS_VERSION" == "V2" ]; then
549 cr_equal received_callbacks 3
550 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200551
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200552 if [[ $interface = *"DMAAP"* ]]; then
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200553 mr_greater requests_submitted 0
554 VAL=$(mr_read requests_submitted)
555 mr_equal requests_fetched $VAL
556 mr_equal responses_submitted $VAL
557 mr_equal responses_fetched $VAL
558 mr_equal current_requests 0
559 mr_equal current_responses 0
560 else
561 mr_equal requests_submitted 0
562 fi
563
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200564 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100565 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
566 sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100567 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100568 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100569 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200570 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100571 sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
572 sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100573 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100574 sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100575 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200576 fi
577
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200578 check_policy_agent_logs
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200579
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100580 if [[ $interface = *"SDNC"* ]]; then
581 check_sdnc_logs
582 fi
583
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200584 store_logs "${__httpx}__${interface}"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200585
586 done
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100587
588done
589
590#### TEST COMPLETE ####
591
592
593print_result
594
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100595auto_clean_environment