blob: 4b2e1629c4202e16a24c17ac897fb934f8ba87f2 [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
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020023#App names to include in the test, space separated list
24INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020025
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010026
27#SUPPORTED TEST ENV FILE
BjornMagnussonXAde4d0f82020-11-29 16:04:06 +010028SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010029
BjornMagnussonXA80a92002020-03-19 14:31:06 +010030. ../common/testcase_common.sh $@
31. ../common/agent_api_functions.sh
32. ../common/ricsimulator_api_functions.sh
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010033. ../common/cr_api_functions.sh
BjornMagnussonXA80a92002020-03-19 14:31:06 +010034
35#### TEST BEGIN ####
36
BjornMagnussonXAad047782020-06-08 15:54:11 +020037generate_uuid
38
BjornMagnussonXA80a92002020-03-19 14:31:06 +010039# Tested variants of REST/DMAAP/SDNC config
40TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010041
BjornMagnussonXA72667f12020-04-24 09:20:18 +020042#Test agent and simulator protocol versions (others are http only)
43TESTED_PROTOCOLS="HTTP HTTPS"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010044
BjornMagnussonXA72667f12020-04-24 09:20:18 +020045for __httpx in $TESTED_PROTOCOLS ; do
46 for interface in $TESTED_VARIANTS ; do
BjornMagnussonXA80a92002020-03-19 14:31:06 +010047
BjornMagnussonXA72667f12020-04-24 09:20:18 +020048 echo "#####################################################################"
49 echo "#####################################################################"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020050 echo "### Testing agent: $interface using $__httpx"
BjornMagnussonXA72667f12020-04-24 09:20:18 +020051 echo "#####################################################################"
52 echo "#####################################################################"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010053
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010054 # Clean container and start all needed containers #
55 clean_containers
56
BjornMagnussonXA496156d2020-08-10 14:16:24 +020057 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010058 use_cr_https
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010059 use_agent_rest_https
60 else
61 use_agent_rest_http
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010062 use_cr_http
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010063 fi
64
65 start_policy_agent
66
67 set_agent_trace
68
69 # Create service to be able to receive events when rics becomes available
70 # Must use rest towards the agent since dmaap is not configured yet
71 api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
72
73
74 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020075 use_simulator_https
76 use_mr_https
77 if [[ $interface = *"SDNC"* ]]; then
78 use_sdnc_https
79 fi
80 if [[ $interface = *"DMAAP"* ]]; then
81 use_agent_dmaap_https
82 else
83 use_agent_rest_https
84 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +020085 else
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020086 use_simulator_http
87 use_mr_http
88 if [[ $interface = *"SDNC"* ]]; then
89 use_sdnc_http
90 fi
91 if [[ $interface = *"DMAAP"* ]]; then
92 use_agent_dmaap_http
93 else
94 use_agent_rest_http
95 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +020096 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +010097
BjornMagnussonXA72667f12020-04-24 09:20:18 +020098 start_ric_simulators ricsim_g1 1 OSC_2.1.0
99 start_ric_simulators ricsim_g2 1 STD_1.1.3
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100100 if [ "$PMS_VERSION" == "V2" ]; then
101 start_ric_simulators ricsim_g3 1 STD_2.0.0
102 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100103
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200104 start_mr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100105
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200106 start_cr
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100107
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100108 start_control_panel
109
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200110 start_consul_cbs
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100111
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200112 if [[ $interface = *"SDNC"* ]]; then
113 start_sdnc
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200114 prepare_consul_config SDNC ".consul_config.json"
115 else
116 prepare_consul_config NOSDNC ".consul_config.json"
117 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100118
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200119 consul_config_app ".consul_config.json"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200121 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
122 sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100123
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100124 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100125 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
126 sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
127
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100128 api_equal json:rics 3 60
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200129
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100130 api_equal json:policy-types 5 120
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200131
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100132 api_equal json:policies 0
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200133
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100134 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100135 else
136 api_equal json:rics 2 60
137
138 api_equal json:policy_schemas 3 120
139
140 api_equal json:policy_types 3
141
142 api_equal json:policies 0
143
144 api_equal json:policy_ids 0
145 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200146
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100147 if [ "$PMS_VERSION" == "V2" ]; then
148 cr_equal received_callbacks 3 120
149 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
150 fi
151 mr_equal requests_submitted 0
152
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200153
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200154 echo "############################################"
155 echo "############## Health check ################"
156 echo "############################################"
157
158 api_get_status 200
159
160 echo "############################################"
161 echo "##### Service registry and supervision #####"
162 echo "############################################"
163
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200164 api_get_services 404 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200165
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200166 api_put_service 201 "service1" 1000 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200167
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200168 api_put_service 200 "service1" 2000 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200169
170
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200171 api_put_service 400 "service2" -1 "$CR_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200172
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200173 api_put_service 400 "service2" "wrong" "$CR_PATH/2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200174
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200175 api_put_service 400 "service2" 100 "/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200176
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200177 api_put_service 400 "service2" 100 "test-path"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200178
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200179 api_put_service 201 "service2" 300 "ftp://localhost:80/test"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200180
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200181 api_get_services 200 "service1" "service1" 2000 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200182
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100183 api_get_service_ids 200 "service1" "service2" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200184
185
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200186 api_put_service 201 "service3" 5000 "$CR_PATH/3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200187
188
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100189 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200190
191
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200192 api_get_services 200 "service1" "service1" 2000 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200193
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100194 api_get_services 200 NOSERVICE "service1" 2000 "$CR_PATH/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_PATH/3" "ric-registration" 0 "$CR_PATH/ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200195
196 api_get_services 200
197
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200198 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
199 #The below should work, keept here until fixed or other decision made
200 #api_put_services_keepalive 201 "service1"
201 #Using the below until decision
202 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200203
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200204 deviation "TR2 - Keep alive shall return 200/201 according to doc, only 200 works - test combo $interface and $__httpx"
205 #The below should work, keept here until fixed or other decision made
206 #api_put_services_keepalive 201 "service3"
207 #Using the below until decision
208 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200209
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200210 api_put_services_keepalive 200 "service1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200211
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200212 api_put_services_keepalive 200 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200213
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200214 api_put_services_keepalive 404 "service5"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200215
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100216 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200217
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200218 api_delete_services 204 "service1"
219
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100220 api_get_service_ids 200 "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200221
222
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200223 api_put_service 201 "service1" 50 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200224
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100225 api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200226
227
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200228 api_delete_services 204 "service1"
229 api_delete_services 204 "service3"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200230
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100231 api_equal json:services 2
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200232
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200233 api_delete_services 204 "service2"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200234
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100235 api_equal json:services 1
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200236
237
238 echo "############################################"
239 echo "############## RIC Repository ##############"
240 echo "############################################"
241
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100242 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100243 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 +0100244 else
245 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"
246 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200247 api_get_rics 200 1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
248
249 api_get_rics 404 47
250
251 api_get_rics 404 "test"
252
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100253 if [ "$PMS_VERSION" == "V2" ]; then
254 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 +0200255
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100256 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 +0200257
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100258 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 +0200259
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100260 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 +0200261
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100262 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"
263
264 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"
265
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100266 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 +0200267
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100268 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 +0200269
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100270 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"
271
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100272 api_get_ric 404 NOME test1
273
274 api_get_ric 404 test NORIC
275
276 api_get_ric 400 me1_ricsim_g1_1 ricsim_g1_1
277
278 api_get_ric 400 me1_ricsim_g1_1 TESTRIC
279
280 api_get_ric 400 TESTME ricsim_g1_1
281
282 else
283 api_get_ric 200 me1_ricsim_g1_1 ricsim_g1_1
284
285 api_get_ric 200 me2_ricsim_g1_1 ricsim_g1_1
286
287 api_get_ric 200 me1_ricsim_g2_1 ricsim_g2_1
288
289 api_get_ric 200 me2_ricsim_g2_1 ricsim_g2_1
290
291 api_get_ric 404 test
292 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200293
294 echo "############################################"
295 echo "########### A1 Policy Management ###########"
296 echo "############################################"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200297
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100298 if [ "$PMS_VERSION" == "V2" ]; then
299 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
300 #Behaviour accepted for now
301 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
302 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
303 #Behaviour accepted for now
304 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100305 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
306 #Behaviour accepted for now
307 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
308 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
309 #Behaviour accepted for now
310 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200311
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100312 api_get_policy_type 404 3
313 else
314 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
315 #Behaviour accepted for now
316 api_get_policy_schema 200 1 testdata/OSC/1-agent-modified.json
317 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
318 #Behaviour accepted for now
319 api_get_policy_schema 200 2 testdata/OSC/2-agent-modified.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200320
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100321 api_get_policy_schema 404 3
322 fi
323
324 if [ "$PMS_VERSION" == "V2" ]; then
325 api_get_policy_schemas 404
326 else
327 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
328 #Behaviour accepted for now
329 api_get_policy_schemas 200 NORIC testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json NOFILE
330 deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
331 #Behaviour accepted for now
332 api_get_policy_schemas 200 ricsim_g1_1 testdata/OSC/1-agent-modified.json testdata/OSC/2-agent-modified.json
333
334 api_get_policy_schemas 200 ricsim_g2_1 NOFILE
335
336 api_get_policy_schemas 404 test
337 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200338
339
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100340 if [ "$PMS_VERSION" == "V2" ]; then
341 api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
342 else
343 api_get_policy_types 200 NORIC 1 2 EMPTY
344 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200345
346 api_get_policy_types 200 ricsim_g1_1 1 2
347
348 api_get_policy_types 200 ricsim_g2_1 EMPTY
349
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100350 if [ "$PMS_VERSION" == "V2" ]; then
351 api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
352 fi
353
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200354 api_get_policy_types 404 dummy-ric
355
356
357
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200358 api_put_service 201 "service10" 3600 "$CR_PATH/1"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200359
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100360 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100361 notificationurl=$CR_PATH"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100362 else
363 notificationurl=""
364 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200365 deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
366 #Kept until decison
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200367 #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200368 #Allow 201 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100369 api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200370
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100371 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
372 api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200373
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100374 api_put_policy 200 "service10" ricsim_g1_1 1 5000 true $notificationurl testdata/OSC/pi1_template.json
375 api_put_policy 200 "service10" ricsim_g1_1 1 5000 false $notificationurl testdata/OSC/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200376
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100377 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
378 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200379
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100380 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
381 api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200382
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100383 if [ "$PMS_VERSION" == "V2" ]; then
384 api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
385 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
386
387 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
388 api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
389 fi
390
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200391 VAL='NOT IN EFFECT'
392 api_get_policy_status 200 5000 OSC "$VAL" "false"
393 api_get_policy_status 200 5100 STD "UNDEFINED"
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100394 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100395 api_get_policy_status 200 5200 STD2 EMPTY EMPTY
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100396 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200397
398
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200399 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
400 #kept until decision
401 #api_equal json:policies 2
402 #Allow 3 for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100403 if [ "$PMS_VERSION" == "V2" ]; then
404 api_equal json:policies 4
405 else
406 api_equal json:policies 3
407 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200408
409 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
410 #kept until decision
411 #api_equal json:policy_ids 2
412 #Allow 3 for now
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100413 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100414 api_equal json:policy-instances 4
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100415 else
416 api_equal json:policy_ids 3
417 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200418
419 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
420 #kept until decision
421 #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
422 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100423 if [ "$PMS_VERSION" == "V2" ]; then
424 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
425 else
426 api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
427 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200428
429 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
430 #kept until decision
431 #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
432 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100433 if [ "$PMS_VERSION" == "V2" ]; then
434 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200435
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100436 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
437
438 api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
439
440 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
441 else
442 api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
443
444 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200445
446
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100447 api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
448 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200449
450 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
451 #kept until decision
452 #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
453 #Allow policy create with unregistered service for now
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100454
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200455 api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200456
457 api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
458
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100459 if [ "$PMS_VERSION" == "V2" ]; then
460 api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
461 fi
462
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200463 api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
464
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100465 if [ "$PMS_VERSION" == "V2" ]; then
466 api_get_policy 200 5000 testdata/OSC/pi1_template.json "service10" ricsim_g1_1 1 false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200467
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100468 api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200469
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100470 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 +0100471
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100472 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 +0100473 else
474 api_get_policy 200 5000 testdata/OSC/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200475
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100476 api_get_policy 200 5100 testdata/STD/pi1_template.json
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200477
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100478 api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 testdata/OSC/pi1_template.json
479 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200480
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200481 deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
482 #kept until decision
483 #api_delete_policy 404 2000
484 #Allow policy create with unregistered service for now
485 api_delete_policy 204 2000
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200486
487 api_delete_policy 404 1500
488
489 api_delete_policy 204 5000
490
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100491 if [ "$PMS_VERSION" == "V2" ]; then
492
493 api_delete_policy 204 5200
494 fi
495
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200496 api_equal json:policies 1
497
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100498
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100499 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100500 api_equal json:policy-instances 1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100501 else
502 api_equal json:policy_ids 1
503 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200504
505 api_delete_policy 204 5100
506
507 api_equal json:policies 0
508
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100509 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100510 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100511 else
512 api_equal json:policy_ids 0
513 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200514
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100515 if [ "$PMS_VERSION" == "V2" ]; then
516 cr_equal received_callbacks 3
517 fi
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200518
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200519 if [[ $interface = *"DMAAP"* ]]; then
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200520 mr_greater requests_submitted 0
521 VAL=$(mr_read requests_submitted)
522 mr_equal requests_fetched $VAL
523 mr_equal responses_submitted $VAL
524 mr_equal responses_fetched $VAL
525 mr_equal current_requests 0
526 mr_equal current_responses 0
527 else
528 mr_equal requests_submitted 0
529 fi
530
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200531 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200532 sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
533 sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100534 if [ "$PMS_VERSION" == "V2" ]; then
535 sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
536 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200537 else
538 sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
539 sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100540 if [ "$PMS_VERSION" == "V2" ]; then
541 sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
542 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200543 fi
544
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200545 check_policy_agent_logs
546 check_control_panel_logs
547
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100548 if [[ $interface = *"SDNC"* ]]; then
549 check_sdnc_logs
550 fi
551
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200552 store_logs "${__httpx}__${interface}"
BjornMagnussonXA72667f12020-04-24 09:20:18 +0200553
554 done
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100555
556done
557
558#### TEST COMPLETE ####
559
560
561print_result
562
563auto_clean_containers