blob: 3b9dcd740cb8aedb02ae14fa71ed2366b57fa412 [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
24DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
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
27KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
28#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29KUBE_PRESTARTED_IMAGES=""
30
31#Supported test environment profiles
BjornMagnussonXA89b64ab2020-12-16 09:21:01 +010032SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010033#Supported run modes
34SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010035
BjornMagnussonXA80a92002020-03-19 14:31:06 +010036. ../common/testcase_common.sh $@
37. ../common/agent_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038. ../common/consul_cbs_functions.sh
39. ../common/control_panel_api_functions.sh
40. ../common/controller_api_functions.sh
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010041. ../common/cr_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010042. ../common/mr_api_functions.sh
43. ../common/ricsimulator_api_functions.sh
44
BjornMagnussonXA80a92002020-03-19 14:31:06 +010045
46#### TEST BEGIN ####
47
BjornMagnussonXAad047782020-06-08 15:54:11 +020048generate_uuid
49
BjornMagnussonXA80a92002020-03-19 14:31:06 +010050# Tested variants of REST/DMAAP/SDNC config
51TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010052
BjornMagnussonXA72667f12020-04-24 09:20:18 +020053#Test agent and simulator protocol versions (others are http only)
54TESTED_PROTOCOLS="HTTP HTTPS"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010055
BjornMagnussonXA72667f12020-04-24 09:20:18 +020056for __httpx in $TESTED_PROTOCOLS ; do
57 for interface in $TESTED_VARIANTS ; do
BjornMagnussonXA80a92002020-03-19 14:31:06 +010058
BjornMagnussonXA72667f12020-04-24 09:20:18 +020059 echo "#####################################################################"
60 echo "#####################################################################"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020061 echo "### Testing agent: $interface using $__httpx"
BjornMagnussonXA72667f12020-04-24 09:20:18 +020062 echo "#####################################################################"
63 echo "#####################################################################"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010064
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010065 # Clean container and start all needed containers #
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010066 clean_environment
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010067
BjornMagnussonXA496156d2020-08-10 14:16:24 +020068 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010069 use_cr_https
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010070 use_agent_rest_https
71 else
72 use_agent_rest_http
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010073 use_cr_http
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010074 fi
75
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010076 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010077
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010078 set_agent_debug
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010079
80 # Create service to be able to receive events when rics becomes available
81 # Must use rest towards the agent since dmaap is not configured yet
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010082 api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010083
84
85 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020086 use_simulator_https
87 use_mr_https
88 if [[ $interface = *"SDNC"* ]]; then
89 use_sdnc_https
90 fi
91 if [[ $interface = *"DMAAP"* ]]; then
92 use_agent_dmaap_https
93 else
94 use_agent_rest_https
95 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +020096 else
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020097 use_simulator_http
98 use_mr_http
99 if [[ $interface = *"SDNC"* ]]; then
100 use_sdnc_http
101 fi
102 if [[ $interface = *"DMAAP"* ]]; then
103 use_agent_dmaap_http
104 else
105 use_agent_rest_http
106 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200107 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100108
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200109 start_ric_simulators ricsim_g1 1 OSC_2.1.0
110 start_ric_simulators ricsim_g2 1 STD_1.1.3
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100111 if [ "$PMS_VERSION" == "V2" ]; then
112 start_ric_simulators ricsim_g3 1 STD_2.0.0
113 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100114
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200115 start_mr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100116
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200117 start_cr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100118
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100119 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100120
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100121 if [ $RUNMODE == "DOCKER" ]; then
122 start_consul_cbs
123 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100124
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200125 if [[ $interface = *"SDNC"* ]]; then
126 start_sdnc
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200127 prepare_consul_config SDNC ".consul_config.json"
128 else
129 prepare_consul_config NOSDNC ".consul_config.json"
130 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100131
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100132 if [ $RUNMODE == "KUBE" ]; then
133 agent_load_config ".consul_config.json"
134 else
135 consul_config_app ".consul_config.json"
136 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100137
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200138 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
139 sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100140
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100141 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100142 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
143 sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
144
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100145 api_equal json:rics 3 300
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200146
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100147 api_equal json:policy-types 5 120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200148
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100149 api_equal json:policies 0
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200150
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100151 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100152 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100153 api_equal json:rics 2 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100154
155 api_equal json:policy_schemas 3 120
156
157 api_equal json:policy_types 3
158
159 api_equal json:policies 0
160
161 api_equal json:policy_ids 0
162 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200163
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100164 if [ "$PMS_VERSION" == "V2" ]; then
165 cr_equal received_callbacks 3 120
166 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
167 fi
168 mr_equal requests_submitted 0
169
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200170
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200171 echo "############################################"
172 echo "############## Health check ################"
173 echo "############################################"
174
175 api_get_status 200
176
177 echo "############################################"
178 echo "##### Service registry and supervision #####"
179 echo "############################################"
180
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200181 api_get_services 404 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200182
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100183 api_put_service 201 "service1" 1000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200184
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100185 api_put_service 200 "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200186
187
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100188 api_put_service 400 "service2" -1 "$CR_SERVICE_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200189
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100190 api_put_service 400 "service2" "wrong" "$CR_SERVICE_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200191
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200192 api_put_service 400 "service2" 100 "/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200193
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200194 api_put_service 400 "service2" 100 "test-path"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200195
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200196 api_put_service 201 "service2" 300 "ftp://localhost:80/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200197
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100198 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200199
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100200 api_get_service_ids 200 "service1" "service2" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200201
202
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100203 api_put_service 201 "service3" 5000 "$CR_SERVICE_PATH/3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200204
205
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100206 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200207
208
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100209 api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200210
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100211 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 +0200212
213 api_get_services 200
214
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200215 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
216 #The below should work, keept here until fixed or other decision made
217 #api_put_services_keepalive 201 "service1"
218 #Using the below until decision
219 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200220
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200221 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
222 #The below should work, keept here until fixed or other decision made
223 #api_put_services_keepalive 201 "service3"
224 #Using the below until decision
225 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200226
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200227 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200228
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200229 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200230
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200231 api_put_services_keepalive 404 "service5"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200232
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100233 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200234
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200235 api_delete_services 204 "service1"
236
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100237 api_get_service_ids 200 "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200238
239
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100240 api_put_service 201 "service1" 50 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200241
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100242 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200243
244
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200245 api_delete_services 204 "service1"
246 api_delete_services 204 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200247
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100248 api_equal json:services 2
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200249
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200250 api_delete_services 204 "service2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200251
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100252 api_equal json:services 1
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200253
254
255 echo "############################################"
256 echo "############## RIC Repository ##############"
257 echo "############################################"
258
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100259 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100260 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 +0100261 else
262 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"
263 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200264 api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
265
266 api_get_rics 404 47
267
268 api_get_rics 404 "test"
269
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100270 if [ "$PMS_VERSION" == "V2" ]; then
271 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 +0200272
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100273 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 +0200274
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100275 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 +0200276
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100277 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 +0200278
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100279 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"
280
281 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"
282
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100283 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 +0200284
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100285 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 +0200286
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100287 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"
288
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100289 api_get_ric 404 NOME test1
290
291 api_get_ric 404 test NORIC
292
293 api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
294
295 api_get_ric 400 me1_ricsim_g1_1 TESTRIC
296
297 api_get_ric 400 TESTME ricsim_g1_1
298
299 else
300 api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
301
302 api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
303
304 api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
305
306 api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
307
308 api_get_ric 404 test
309 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200310
311 echo "############################################"
312 echo "########### A1 Policy Management ###########"
313 echo "############################################"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200314
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100315 if [ "$PMS_VERSION" == "V2" ]; then
316 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
317 #Behaviour accepted for now
318 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
319 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
320 #Behaviour accepted for now
321 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100322 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
323 #Behaviour accepted for now
324 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
325 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
326 #Behaviour accepted for now
327 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200328
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100329 api_get_policy_type 404 3
330 else
331 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
332 #Behaviour accepted for now
333 api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
334 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
335 #Behaviour accepted for now
336 api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200337
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100338 api_get_policy_schema 404 3
339 fi
340
341 if [ "$PMS_VERSION" == "V2" ]; then
342 api_get_policy_schemas 404
343 else
344 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
345 #Behaviour accepted for now
346 api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
347 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
348 #Behaviour accepted for now
349 api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
350
351 api_get_policy_schemas 200 ricsim_g2_1 NOFILE
352
353 api_get_policy_schemas 404 test
354 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200355
356
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100357 if [ "$PMS_VERSION" == "V2" ]; then
358 api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
359 else
360 api_get_policy_types 200 NORIC 1 2 EMPTY
361 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200362
363 api_get_policy_types 200 ricsim_g1_1 1 2
364
365 api_get_policy_types 200 ricsim_g2_1 EMPTY
366
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100367 if [ "$PMS_VERSION" == "V2" ]; then
368 api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
369 fi
370
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200371 api_get_policy_types 404 dummy-ric
372
373
374
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100375 api_put_service 201 "service10" 3600 "$CR_SERVICE_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200376
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100377 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100378 notificationurl=$CR_SERVICE_PATH"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100379 else
380 notificationurl=""
381 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200382 deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
383 #Kept until decison
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200384 #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200385 #Allow 201 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100386 api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200387
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100388 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
389 api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200390
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100391 api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
392 api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200393
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100394 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
395 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200396
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100397 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
398 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200399
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100400 if [ "$PMS_VERSION" == "V2" ]; then
401 api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
402 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
403
404 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
405 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
406 fi
407
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200408 VAL='NOT IN EFFECT'
409 api_get_policy_status 200 5000 OSC "$VAL" "false"
410 api_get_policy_status 200 5100 STD "UNDEFINED"
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100411 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100412 api_get_policy_status 200 5200 STD2 EMPTY EMPTY
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100413 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200414
415
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200416 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
417 #kept until decision
418 #api_equal json:policies 2
419 #Allow 3 for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100420 if [ "$PMS_VERSION" == "V2" ]; then
421 api_equal json:policies 4
422 else
423 api_equal json:policies 3
424 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200425
426 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
427 #kept until decision
428 #api_equal json:policy_ids 2
429 #Allow 3 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100430 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100431 api_equal json:policy-instances 4
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100432 else
433 api_equal json:policy_ids 3
434 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200435
436 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
437 #kept until decision
438 #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
439 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100440 if [ "$PMS_VERSION" == "V2" ]; then
441 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
442 else
443 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
444 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200445
446 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
447 #kept until decision
448 #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
449 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100450 if [ "$PMS_VERSION" == "V2" ]; then
451 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200452
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100453 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
454
455 api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
456
457 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
458 else
459 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
460
461 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200462
463
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100464 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
465 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200466
467 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
468 #kept until decision
469 #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
470 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100471
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200472 api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200473
474 api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
475
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100476 if [ "$PMS_VERSION" == "V2" ]; then
477 api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
478 fi
479
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200480 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
481
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100482 if [ "$PMS_VERSION" == "V2" ]; then
483 api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200484
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100485 api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200486
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100487 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 +0100488
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100489 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 +0100490 else
491 api_get_policy 200 5000 testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200492
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100493 api_get_policy 200 5100 testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200494
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100495 api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
496 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200497
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200498 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
499 #kept until decision
500 #api_delete_policy 404 2000
501 #Allow policy create with unregistered service for now
502 api_delete_policy 204 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200503
504 api_delete_policy 404 1500
505
506 api_delete_policy 204 5000
507
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100508 if [ "$PMS_VERSION" == "V2" ]; then
509
510 api_delete_policy 204 5200
511 fi
512
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200513 api_equal json:policies 1
514
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100515
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100516 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100517 api_equal json:policy-instances 1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100518 else
519 api_equal json:policy_ids 1
520 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200521
522 api_delete_policy 204 5100
523
524 api_equal json:policies 0
525
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100526 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100527 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100528 else
529 api_equal json:policy_ids 0
530 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200531
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100532 if [ "$PMS_VERSION" == "V2" ]; then
533 cr_equal received_callbacks 3
534 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200535
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200536 if [[ $interface = *"DMAAP"* ]]; then
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200537 mr_greater requests_submitted 0
538 VAL=$(mr_read requests_submitted)
539 mr_equal requests_fetched $VAL
540 mr_equal responses_submitted $VAL
541 mr_equal responses_fetched $VAL
542 mr_equal current_requests 0
543 mr_equal current_responses 0
544 else
545 mr_equal requests_submitted 0
546 fi
547
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200548 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100549 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
550 sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100551 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100552 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100553 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200554 else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100555 sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
556 sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100557 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100558 sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100559 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200560 fi
561
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200562 check_policy_agent_logs
563 check_control_panel_logs
564
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100565 if [[ $interface = *"SDNC"* ]]; then
566 check_sdnc_logs
567 fi
568
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200569 store_logs "${__httpx}__${interface}"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200570
571 done
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100572
573done
574
575#### TEST COMPLETE ####
576
577
578print_result
579
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100580auto_clean_environment