blob: a30b22826707f2c07ac2ff99512be50362b9d7a8 [file] [log] [blame]
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +02001#!/bin/bash
2
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
20TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
21
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010022#App names to include in the test when running docker, space separated list
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010023DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR A1PMS RICSIM SDNC KUBEPROXY"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020024
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010025#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010026KUBE_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC KUBEPROXY"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010027#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28KUBE_PRESTARTED_IMAGES=""
29
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010030#Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
31#the image is not configured in the supplied env_file
32#Used for images not applicable to all supported profile
33CONDITIONALLY_IGNORED_IMAGES="CBS CONSUL"
34
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010035#Supported test environment profiles
BjornMagnussonXAa27463f2022-11-21 15:34:30 +010036SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ONAP-KOHN ONAP-LONDON ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE ORAN-G-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010037#Supported run modes
38SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010039
BjornMagnussonXA79e37002021-11-22 13:36:04 +010040. ../common/testcase_common.sh $@
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010041
42setup_testenvironment
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020043
44#### TEST BEGIN ####
45
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010046generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020047
BjornMagnussonXA496156d2020-08-10 14:16:24 +020048use_cr_http
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020049
50NUM_RICS=10
51NUM_RICS_2=$(($NUM_RICS-2))
52
53# Tested variants of REST/SDNC config
54TESTED_VARIANTS="REST REST+SDNC"
55
56for interface in $TESTED_VARIANTS ; do
57
58 echo "#####################################################################"
59 echo "#####################################################################"
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010060 echo "### Testing a1pms: "$interface
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020061 echo "#####################################################################"
62 echo "#####################################################################"
63
64
65 # Clean container and start all needed containers #
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010066 clean_environment
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020067
BjornMagnussonXA663566c2021-11-08 10:25:07 +010068 start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010069
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020070 #Start simulators and prepare two configs
71
72 start_ric_simulators ricsim_g1 $NUM_RICS_2 OSC_2.1.0
73
BjornMagnussonXA79e37002021-11-22 13:36:04 +010074 start_cr 1
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020075
76 start_mr
77
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010078 if [ $RUNMODE == "DOCKER" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010079 if [[ "$A1PMS_FEATURE_LEVEL" != *"NOCONSUL"* ]]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010080 start_consul_cbs
81 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010082 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020083
BjornMagnussonXAf81090f2022-08-24 09:17:44 +020084 __CONFIG_HEADER="NOHEADER"
85 if [ $RUNMODE == "KUBE" ]; then
86 __CONFIG_HEADER="HEADER"
87 else
88 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
89 __CONFIG_HEADER="HEADER"
90 fi
91 fi
92
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010093 # Create first config
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020094 if [[ $interface = *"SDNC"* ]]; then
95 start_sdnc
BjornMagnussonXAf81090f2022-08-24 09:17:44 +020096 prepare_consul_config SDNC ".consul_config_initial.json" $__CONFIG_HEADER
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020097 else
BjornMagnussonXAf81090f2022-08-24 09:17:44 +020098 prepare_consul_config NOSDNC ".consul_config_initial.json" $__CONFIG_HEADER
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020099 fi
100
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200101 # Create 2nd config and save for later
102 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
103
104 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXAf81090f2022-08-24 09:17:44 +0200105 prepare_consul_config SDNC ".consul_config_all.json" $__CONFIG_HEADER
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200106 else
BjornMagnussonXAf81090f2022-08-24 09:17:44 +0200107 prepare_consul_config NOSDNC ".consul_config_all.json" $__CONFIG_HEADER
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200108 fi
109
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100110 if [ $RUNMODE == "KUBE" ] && [[ "$A1PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
111 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/application2.yaml
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100112 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100113 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100114 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200115
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100116 set_a1pms_trace
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200117
BjornMagnussonXAf4a7e422022-09-01 16:35:17 +0200118 sleep_wait 120 "Let A1PMS cofiguration take effect"
119
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100120 a1pms_api_get_status 200
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200121
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100122 # Create service to be able to receive events when rics becomes available
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100123 # Must use rest towards the a1pms since dmaap is not configured yet
124 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100125
126 #Load first config
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100127 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100128 if [[ "$A1PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
129 a1pms_api_put_configuration 200 ".consul_config_initial.json"
130 a1pms_api_get_configuration 200 ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100131 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100132 a1pms_load_config ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100133 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100134 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100135 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
136 a1pms_api_put_configuration 200 ".consul_config_initial.json"
137 a1pms_api_get_configuration 200 ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100138 else
139 consul_config_app ".consul_config_initial.json"
140 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100141 fi
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100142
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200143 for ((i=1; i<=${NUM_RICS}; i++))
144 do
145 sim_print ricsim_g1_$i interface
146 done
147
148 # All sims running but 2 are not configured in consul
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100149 a1pms_equal json:rics 8 300
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200150
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100151 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100152 cr_equal 0 received_callbacks?id=ric-registration 8 120
153 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100154 fi
155
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100156 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:NOTYPE:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200157 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:NOTYPE:???? \
158 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:NOTYPE:???? \
159 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:NOTYPE:???? \
160 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:NOTYPE:???? \
161 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:NOTYPE:???? \
162 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:NOTYPE:???? \
163 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:NOTYPE:???? "
164
165
166 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
167 sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
168 sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
169 sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
170 sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
171
172 sim_put_policy_type 201 ricsim_g1_2 2 testdata/OSC/sim_2.json
173 sim_put_policy_type 201 ricsim_g1_3 2 testdata/OSC/sim_2.json
174 sim_put_policy_type 201 ricsim_g1_4 2 testdata/OSC/sim_2.json
175 sim_put_policy_type 201 ricsim_g1_5 2 testdata/OSC/sim_2.json
176 sim_put_policy_type 201 ricsim_g1_6 2 testdata/OSC/sim_2.json
177
178 sim_put_policy_type 201 ricsim_g1_3 3 testdata/OSC/sim_3.json
179 sim_put_policy_type 201 ricsim_g1_4 3 testdata/OSC/sim_3.json
180 sim_put_policy_type 201 ricsim_g1_5 3 testdata/OSC/sim_3.json
181 sim_put_policy_type 201 ricsim_g1_6 3 testdata/OSC/sim_3.json
182 sim_put_policy_type 201 ricsim_g1_7 3 testdata/OSC/sim_3.json
183
184 sim_put_policy_type 201 ricsim_g1_4 4 testdata/OSC/sim_4.json
185 sim_put_policy_type 201 ricsim_g1_5 4 testdata/OSC/sim_4.json
186 sim_put_policy_type 201 ricsim_g1_6 4 testdata/OSC/sim_4.json
187 sim_put_policy_type 201 ricsim_g1_7 4 testdata/OSC/sim_4.json
188 sim_put_policy_type 201 ricsim_g1_8 4 testdata/OSC/sim_4.json
189
190 sim_put_policy_type 201 ricsim_g1_5 5 testdata/OSC/sim_5.json
191 sim_put_policy_type 201 ricsim_g1_6 5 testdata/OSC/sim_5.json
192 sim_put_policy_type 201 ricsim_g1_7 5 testdata/OSC/sim_5.json
193 sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200194
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100195 if [ "$A1PMS_VERSION" == "V2" ]; then
196 a1pms_equal json:policy-types 5 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200197
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100198 echo "Check the number of types in the a1pms for each ric"
199 a1pms_equal json:policy-types?ric_id=ricsim_g1_1 1 120
200 a1pms_equal json:policy-types?ric_id=ricsim_g1_2 2 120
201 a1pms_equal json:policy-types?ric_id=ricsim_g1_3 3 120
202 a1pms_equal json:policy-types?ric_id=ricsim_g1_4 4 120
203 a1pms_equal json:policy-types?ric_id=ricsim_g1_5 5 120
204 a1pms_equal json:policy-types?ric_id=ricsim_g1_6 4 120
205 a1pms_equal json:policy-types?ric_id=ricsim_g1_7 3 120
206 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 2 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100207 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100208 a1pms_equal json:policy_types 5 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100209
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100210 echo "Check the number of types in the a1pms for each ric"
211 a1pms_equal json:policy_types?ric=ricsim_g1_1 1 120
212 a1pms_equal json:policy_types?ric=ricsim_g1_2 2 120
213 a1pms_equal json:policy_types?ric=ricsim_g1_3 3 120
214 a1pms_equal json:policy_types?ric=ricsim_g1_4 4 120
215 a1pms_equal json:policy_types?ric=ricsim_g1_5 5 120
216 a1pms_equal json:policy_types?ric=ricsim_g1_6 4 120
217 a1pms_equal json:policy_types?ric=ricsim_g1_7 3 120
218 a1pms_equal json:policy_types?ric=ricsim_g1_8 2 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100219 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200220
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100221 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200222 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
223 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
224 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
225 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
226 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
227 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
228 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
229
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100230 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100231 cr_equal 0 received_callbacks?id=ric-registration 16 120
232 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100233 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200234
235 #Load config with all rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100236 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100237 if [[ "$A1PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
238 a1pms_api_put_configuration 200 ".consul_config_all.json"
239 a1pms_api_get_configuration 200 ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100240 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100241 a1pms_load_config ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100242 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100243 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100244 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
245 a1pms_api_put_configuration 200 ".consul_config_all.json"
246 a1pms_api_get_configuration 200 ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100247 else
248 consul_config_app ".consul_config_all.json"
249 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100250 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200251
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100252 a1pms_equal json:rics 10 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200253
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100254 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100255 cr_equal 0 received_callbacks?id=ric-registration 18 120
256 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_9 ricsim_g1_10
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100257 fi
258
259 sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json
260
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100261 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100262
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100263 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200264
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100265 echo "Check the number of types in the a1pms for each ric"
266 a1pms_equal json:policy-types?ric_id=ricsim_g1_1 1 120
267 a1pms_equal json:policy-types?ric_id=ricsim_g1_2 2 120
268 a1pms_equal json:policy-types?ric_id=ricsim_g1_3 3 120
269 a1pms_equal json:policy-types?ric_id=ricsim_g1_4 4 120
270 a1pms_equal json:policy-types?ric_id=ricsim_g1_5 5 120
271 a1pms_equal json:policy-types?ric_id=ricsim_g1_6 4 120
272 a1pms_equal json:policy-types?ric_id=ricsim_g1_7 3 120
273 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 2 120
274 a1pms_equal json:policy-types?ric_id=ricsim_g1_9 1 120
275 a1pms_equal json:policy-types?ric_id=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100276 else
277
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100278 a1pms_equal json:policy_types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200279
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100280 echo "Check the number of types in the a1pms for each ric"
281 a1pms_equal json:policy_types?ric=ricsim_g1_1 1 120
282 a1pms_equal json:policy_types?ric=ricsim_g1_2 2 120
283 a1pms_equal json:policy_types?ric=ricsim_g1_3 3 120
284 a1pms_equal json:policy_types?ric=ricsim_g1_4 4 120
285 a1pms_equal json:policy_types?ric=ricsim_g1_5 5 120
286 a1pms_equal json:policy_types?ric=ricsim_g1_6 4 120
287 a1pms_equal json:policy_types?ric=ricsim_g1_7 3 120
288 a1pms_equal json:policy_types?ric=ricsim_g1_8 2 120
289 a1pms_equal json:policy_types?ric=ricsim_g1_9 1 120
290 a1pms_equal json:policy_types?ric=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100291 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200292
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100293 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200294 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
295 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
296 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
297 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
298 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
299 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
300 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
301 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
302 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
303
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100304 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100305 cr_equal 0 received_callbacks?id=ric-registration 19 120
306 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_9
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100307 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200308
309 #No policy type in sim #10
310
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100311 if [ "$A1PMS_VERSION" == "V2" ]; then
312 a1pms_equal json:policy-types 5
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100313 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100314 a1pms_equal json:policy_types 5
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100315 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200316
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100317 a1pms_api_put_service 201 "serv1" 3600 "$CR_SERVICE_APP_PATH_0/serv1"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200318
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100319 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100320 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100321 else
322 notificationurl=""
323 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200324
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100325 sleep_wait 120
326
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200327 # Load config with reduced number of rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100328 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100329 if [[ "$A1PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
330 a1pms_api_put_configuration 200 ".consul_config_initial.json"
331 a1pms_api_get_configuration 200 ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100332 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100333 a1pms_load_config ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100334 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100335 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100336 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
337 a1pms_api_put_configuration 200 ".consul_config_initial.json"
338 a1pms_api_get_configuration 200 ".consul_config_initial.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100339 else
340 consul_config_app ".consul_config_initial.json"
341 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100342 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200343
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100344 a1pms_equal json:rics 8 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200345
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100346 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100347 cr_equal 0 received_callbacks?id=ric-registration 19 120
348 cr_api_check_all_sync_events 200 0 ric-registration EMPTY
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100349 fi
350
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100351 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200352
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100353 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200354
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100355 echo "Check the number of types in the a1pms for each ric"
356 a1pms_equal json:policy-types?ric_id=ricsim_g1_1 1 120
357 a1pms_equal json:policy-types?ric_id=ricsim_g1_2 2 120
358 a1pms_equal json:policy-types?ric_id=ricsim_g1_3 3 120
359 a1pms_equal json:policy-types?ric_id=ricsim_g1_4 4 120
360 a1pms_equal json:policy-types?ric_id=ricsim_g1_5 5 120
361 a1pms_equal json:policy-types?ric_id=ricsim_g1_6 4 120
362 a1pms_equal json:policy-types?ric_id=ricsim_g1_7 3 120
363 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 2 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100364 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200365
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100366 a1pms_equal json:policy_types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200367
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100368 echo "Check the number of types in the a1pms for each ric"
369 a1pms_equal json:policy_types?ric=ricsim_g1_1 1 120
370 a1pms_equal json:policy_types?ric=ricsim_g1_2 2 120
371 a1pms_equal json:policy_types?ric=ricsim_g1_3 3 120
372 a1pms_equal json:policy_types?ric=ricsim_g1_4 4 120
373 a1pms_equal json:policy_types?ric=ricsim_g1_5 5 120
374 a1pms_equal json:policy_types?ric=ricsim_g1_6 4 120
375 a1pms_equal json:policy_types?ric=ricsim_g1_7 3 120
376 a1pms_equal json:policy_types?ric=ricsim_g1_8 2 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100377 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200378
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100379 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200380 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
381 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
382 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
383 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
384 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
385 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
386 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
387
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200388 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200389
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100390 if [ "$A1PMS_VERSION" == "V2" ]; then
391 a1pms_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100392 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100393 a1pms_equal json:policy_ids 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100394 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200395
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100396 a1pms_api_get_policy_types 404 ricsim_g1_9
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200397
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200398 # Load config with all rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100399 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100400 if [[ "$A1PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
401 a1pms_api_put_configuration 200 ".consul_config_all.json"
402 a1pms_api_get_configuration 200 ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100403 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100404 a1pms_load_config ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100405 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100406 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100407 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
408 a1pms_api_put_configuration 200 ".consul_config_all.json"
409 a1pms_api_get_configuration 200 ".consul_config_all.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100410 else
411 consul_config_app ".consul_config_all.json"
412 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100413 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200414
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100415 a1pms_equal json:rics 10 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200416
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100417 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200418
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100419 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200420
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100421 echo "Check the number of types in the a1pms for each ric"
422 a1pms_equal json:policy-types?ric_id=ricsim_g1_1 1 120
423 a1pms_equal json:policy-types?ric_id=ricsim_g1_2 2 120
424 a1pms_equal json:policy-types?ric_id=ricsim_g1_3 3 120
425 a1pms_equal json:policy-types?ric_id=ricsim_g1_4 4 120
426 a1pms_equal json:policy-types?ric_id=ricsim_g1_5 5 120
427 a1pms_equal json:policy-types?ric_id=ricsim_g1_6 4 120
428 a1pms_equal json:policy-types?ric_id=ricsim_g1_7 3 120
429 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 2 120
430 a1pms_equal json:policy-types?ric_id=ricsim_g1_9 1 120
431 a1pms_equal json:policy-types?ric_id=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100432 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200433
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100434 a1pms_equal json:policy_types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200435
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100436 echo "Check the number of types in the a1pms for each ric"
437 a1pms_equal json:policy_types?ric=ricsim_g1_1 1 120
438 a1pms_equal json:policy_types?ric=ricsim_g1_2 2 120
439 a1pms_equal json:policy_types?ric=ricsim_g1_3 3 120
440 a1pms_equal json:policy_types?ric=ricsim_g1_4 4 120
441 a1pms_equal json:policy_types?ric=ricsim_g1_5 5 120
442 a1pms_equal json:policy_types?ric=ricsim_g1_6 4 120
443 a1pms_equal json:policy_types?ric=ricsim_g1_7 3 120
444 a1pms_equal json:policy_types?ric=ricsim_g1_8 2 120
445 a1pms_equal json:policy_types?ric=ricsim_g1_9 1 120
446 a1pms_equal json:policy_types?ric=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100447 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200448
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100449 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200450 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
451 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
452 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
453 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
454 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
455 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
456 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
457 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
458 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
459
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200460 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200461
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100462 if [ "$A1PMS_VERSION" == "V2" ]; then
463 a1pms_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100464 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100465 a1pms_equal json:policy_ids 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100466 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200467
468 sim_equal ricsim_g1_9 num_instances 0
469
470
471 sim_delete_policy_type 204 ricsim_g1_4 4
472 sim_delete_policy_type 204 ricsim_g1_5 4
473 sim_delete_policy_type 204 ricsim_g1_6 4
474 sim_delete_policy_type 204 ricsim_g1_7 4
475
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200476 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200477
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100478 if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200479
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100480 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200481
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100482 a1pms_equal json:policy-types?ric_id=ricsim_g1_1 1 120
483 a1pms_equal json:policy-types?ric_id=ricsim_g1_2 2 120
484 a1pms_equal json:policy-types?ric_id=ricsim_g1_3 3 120
485 a1pms_equal json:policy-types?ric_id=ricsim_g1_4 3 120
486 a1pms_equal json:policy-types?ric_id=ricsim_g1_5 4 120
487 a1pms_equal json:policy-types?ric_id=ricsim_g1_6 3 120
488 a1pms_equal json:policy-types?ric_id=ricsim_g1_7 2 120
489 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 2 120
490 a1pms_equal json:policy-types?ric_id=ricsim_g1_9 1 120
491 a1pms_equal json:policy-types?ric_id=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100492 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200493
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100494 a1pms_equal json:policy_types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200495
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100496 a1pms_equal json:policy_types?ric=ricsim_g1_1 1 120
497 a1pms_equal json:policy_types?ric=ricsim_g1_2 2 120
498 a1pms_equal json:policy_types?ric=ricsim_g1_3 3 120
499 a1pms_equal json:policy_types?ric=ricsim_g1_4 3 120
500 a1pms_equal json:policy_types?ric=ricsim_g1_5 4 120
501 a1pms_equal json:policy_types?ric=ricsim_g1_6 3 120
502 a1pms_equal json:policy_types?ric=ricsim_g1_7 2 120
503 a1pms_equal json:policy_types?ric=ricsim_g1_8 2 120
504 a1pms_equal json:policy_types?ric=ricsim_g1_9 1 120
505 a1pms_equal json:policy_types?ric=ricsim_g1_10 0 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100506 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200507
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100508 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200509 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
510 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
511 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
512 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
513 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
514 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
515 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
516 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
517 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
518
519 sim_delete_policy_type 204 ricsim_g1_8 4
520
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100521 if [ "$A1PMS_VERSION" == "V2" ]; then
522 a1pms_equal json:policy-types 5 120
523 a1pms_equal json:policy-types?ric_id=ricsim_g1_8 1 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100524 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100525 a1pms_equal json:policy_types 5 120
526 a1pms_equal json:policy_types?ric=ricsim_g1_8 1 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100527 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200528
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100529 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200530 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
531 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
532 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
533 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
534 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
535 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
536 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:5:???? \
537 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
538 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
539
540
541
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100542 check_a1pms_logs
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100543 if [[ $interface = *"SDNC"* ]]; then
544 check_sdnc_logs
545 fi
546
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200547 store_logs ${interface}
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200548
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200549done
550
551
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200552#### TEST COMPLETE ####
553
554
555print_result
556
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100557auto_clean_environment