BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 1 | #!/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 | |
| 20 | TC_ONELINE_DESCR="Change supported policy types and reconfigure rics" |
| 21 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 22 | #App names to include in the test when running docker, space separated list |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 23 | DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 24 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 25 | #App names to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 26 | KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 27 | #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list |
| 28 | KUBE_PRESTARTED_IMAGES="" |
| 29 | |
| 30 | #Supported test environment profiles |
BjornMagnussonXA | 674793d | 2021-05-06 19:49:17 +0200 | [diff] [blame] | 31 | SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 32 | #Supported run modes |
| 33 | SUPPORTED_RUNMODES="DOCKER KUBE" |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 34 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 35 | . ../common/testcase_common.sh $@ |
| 36 | . ../common/agent_api_functions.sh |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 37 | . ../common/consul_cbs_functions.sh |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 38 | . ../common/ricsimulator_api_functions.sh |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 39 | . ../common/cr_api_functions.sh |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 40 | . ../common/mr_api_functions.sh |
| 41 | . ../common/control_panel_api_functions.sh |
| 42 | . ../common/controller_api_functions.sh |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 43 | . ../common/kube_proxy_api_functions.sh |
BjornMagnussonXA | 674793d | 2021-05-06 19:49:17 +0200 | [diff] [blame] | 44 | . ../common/gateway_api_functions.sh |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 45 | |
| 46 | setup_testenvironment |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 47 | |
| 48 | #### TEST BEGIN #### |
| 49 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 50 | generate_policy_uuid |
BjornMagnussonXA | ad04778 | 2020-06-08 15:54:11 +0200 | [diff] [blame] | 51 | |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 52 | use_cr_http |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 53 | |
| 54 | NUM_RICS=10 |
| 55 | NUM_RICS_2=$(($NUM_RICS-2)) |
| 56 | |
| 57 | # Tested variants of REST/SDNC config |
| 58 | TESTED_VARIANTS="REST REST+SDNC" |
| 59 | |
| 60 | for interface in $TESTED_VARIANTS ; do |
| 61 | |
| 62 | echo "#####################################################################" |
| 63 | echo "#####################################################################" |
| 64 | echo "### Testing agent: "$interface |
| 65 | echo "#####################################################################" |
| 66 | echo "#####################################################################" |
| 67 | |
| 68 | |
| 69 | # Clean container and start all needed containers # |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 70 | clean_environment |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 71 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 72 | if [ $RUNMODE == "KUBE" ]; then |
| 73 | start_kube_proxy |
| 74 | fi |
| 75 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 76 | #Start simulators and prepare two configs |
| 77 | |
| 78 | start_ric_simulators ricsim_g1 $NUM_RICS_2 OSC_2.1.0 |
| 79 | |
| 80 | start_cr |
| 81 | |
| 82 | start_mr |
| 83 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 84 | if [ $RUNMODE == "DOCKER" ]; then |
| 85 | start_consul_cbs |
| 86 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 87 | |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 88 | # Create first config |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 89 | if [[ $interface = *"SDNC"* ]]; then |
| 90 | start_sdnc |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 91 | prepare_consul_config SDNC ".consul_config_initial.json" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 92 | else |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 93 | prepare_consul_config NOSDNC ".consul_config_initial.json" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 94 | fi |
| 95 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 96 | # Create 2nd config and save for later |
| 97 | start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0 |
| 98 | |
| 99 | if [[ $interface = *"SDNC"* ]]; then |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 100 | prepare_consul_config SDNC ".consul_config_all.json" |
| 101 | else |
| 102 | prepare_consul_config NOSDNC ".consul_config_all.json" |
| 103 | fi |
| 104 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 105 | start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 106 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 107 | set_agent_trace |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 108 | |
| 109 | api_get_status 200 |
| 110 | |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 111 | # Create service to be able to receive events when rics becomes available |
| 112 | # Must use rest towards the agent since dmaap is not configured yet |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 113 | api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration" |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 114 | |
| 115 | #Load first config |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 116 | if [ $RUNMODE == "KUBE" ]; then |
| 117 | agent_load_config ".consul_config_initial.json" |
| 118 | else |
| 119 | consul_config_app ".consul_config_initial.json" |
| 120 | fi |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 121 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 122 | for ((i=1; i<=${NUM_RICS}; i++)) |
| 123 | do |
| 124 | sim_print ricsim_g1_$i interface |
| 125 | done |
| 126 | |
| 127 | # All sims running but 2 are not configured in consul |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 128 | api_equal json:rics 8 300 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 129 | |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 130 | if [ "$PMS_VERSION" == "V2" ]; then |
| 131 | cr_equal received_callbacks?id=ric-registration 8 120 |
| 132 | cr_api_check_all_sync_events 200 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 |
| 133 | fi |
| 134 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 135 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:NOTYPE:???? \ |
| 136 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:NOTYPE:???? \ |
| 137 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:NOTYPE:???? \ |
| 138 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:NOTYPE:???? \ |
| 139 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:NOTYPE:???? \ |
| 140 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:NOTYPE:???? \ |
| 141 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:NOTYPE:???? \ |
| 142 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:NOTYPE:???? " |
| 143 | |
| 144 | |
| 145 | sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json |
| 146 | sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json |
| 147 | sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json |
| 148 | sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json |
| 149 | sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json |
| 150 | |
| 151 | sim_put_policy_type 201 ricsim_g1_2 2 testdata/OSC/sim_2.json |
| 152 | sim_put_policy_type 201 ricsim_g1_3 2 testdata/OSC/sim_2.json |
| 153 | sim_put_policy_type 201 ricsim_g1_4 2 testdata/OSC/sim_2.json |
| 154 | sim_put_policy_type 201 ricsim_g1_5 2 testdata/OSC/sim_2.json |
| 155 | sim_put_policy_type 201 ricsim_g1_6 2 testdata/OSC/sim_2.json |
| 156 | |
| 157 | sim_put_policy_type 201 ricsim_g1_3 3 testdata/OSC/sim_3.json |
| 158 | sim_put_policy_type 201 ricsim_g1_4 3 testdata/OSC/sim_3.json |
| 159 | sim_put_policy_type 201 ricsim_g1_5 3 testdata/OSC/sim_3.json |
| 160 | sim_put_policy_type 201 ricsim_g1_6 3 testdata/OSC/sim_3.json |
| 161 | sim_put_policy_type 201 ricsim_g1_7 3 testdata/OSC/sim_3.json |
| 162 | |
| 163 | sim_put_policy_type 201 ricsim_g1_4 4 testdata/OSC/sim_4.json |
| 164 | sim_put_policy_type 201 ricsim_g1_5 4 testdata/OSC/sim_4.json |
| 165 | sim_put_policy_type 201 ricsim_g1_6 4 testdata/OSC/sim_4.json |
| 166 | sim_put_policy_type 201 ricsim_g1_7 4 testdata/OSC/sim_4.json |
| 167 | sim_put_policy_type 201 ricsim_g1_8 4 testdata/OSC/sim_4.json |
| 168 | |
| 169 | sim_put_policy_type 201 ricsim_g1_5 5 testdata/OSC/sim_5.json |
| 170 | sim_put_policy_type 201 ricsim_g1_6 5 testdata/OSC/sim_5.json |
| 171 | sim_put_policy_type 201 ricsim_g1_7 5 testdata/OSC/sim_5.json |
| 172 | sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 173 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 174 | if [ "$PMS_VERSION" == "V2" ]; then |
| 175 | api_equal json:policy-types 5 120 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 176 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 177 | echo "Check the number of types in the agent for each ric" |
| 178 | api_equal json:policy-types?ric_id=ricsim_g1_1 1 120 |
| 179 | api_equal json:policy-types?ric_id=ricsim_g1_2 2 120 |
| 180 | api_equal json:policy-types?ric_id=ricsim_g1_3 3 120 |
| 181 | api_equal json:policy-types?ric_id=ricsim_g1_4 4 120 |
| 182 | api_equal json:policy-types?ric_id=ricsim_g1_5 5 120 |
| 183 | api_equal json:policy-types?ric_id=ricsim_g1_6 4 120 |
| 184 | api_equal json:policy-types?ric_id=ricsim_g1_7 3 120 |
| 185 | api_equal json:policy-types?ric_id=ricsim_g1_8 2 120 |
| 186 | else |
| 187 | api_equal json:policy_types 5 120 |
| 188 | |
| 189 | echo "Check the number of types in the agent for each ric" |
| 190 | api_equal json:policy_types?ric=ricsim_g1_1 1 120 |
| 191 | api_equal json:policy_types?ric=ricsim_g1_2 2 120 |
| 192 | api_equal json:policy_types?ric=ricsim_g1_3 3 120 |
| 193 | api_equal json:policy_types?ric=ricsim_g1_4 4 120 |
| 194 | api_equal json:policy_types?ric=ricsim_g1_5 5 120 |
| 195 | api_equal json:policy_types?ric=ricsim_g1_6 4 120 |
| 196 | api_equal json:policy_types?ric=ricsim_g1_7 3 120 |
| 197 | api_equal json:policy_types?ric=ricsim_g1_8 2 120 |
| 198 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 199 | |
| 200 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 201 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 202 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 203 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \ |
| 204 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \ |
| 205 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \ |
| 206 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \ |
| 207 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? " |
| 208 | |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 209 | if [ "$PMS_VERSION" == "V2" ]; then |
| 210 | cr_equal received_callbacks?id=ric-registration 16 120 |
| 211 | cr_api_check_all_sync_events 200 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 |
| 212 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 213 | |
| 214 | #Load config with all rics |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 215 | if [ $RUNMODE == "KUBE" ]; then |
| 216 | agent_load_config ".consul_config_all.json" |
| 217 | else |
| 218 | consul_config_app ".consul_config_all.json" |
| 219 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 220 | |
| 221 | api_equal json:rics 10 120 |
| 222 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 223 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 224 | cr_equal received_callbacks?id=ric-registration 18 120 |
| 225 | cr_api_check_all_sync_events 200 ric-registration ricsim_g1_9 ricsim_g1_10 |
| 226 | fi |
| 227 | |
| 228 | sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json |
| 229 | |
| 230 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 231 | |
| 232 | echo "Check the number of types in the agent for each ric" |
| 233 | api_equal json:policy-types?ric_id=ricsim_g1_1 1 120 |
| 234 | api_equal json:policy-types?ric_id=ricsim_g1_2 2 120 |
| 235 | api_equal json:policy-types?ric_id=ricsim_g1_3 3 120 |
| 236 | api_equal json:policy-types?ric_id=ricsim_g1_4 4 120 |
| 237 | api_equal json:policy-types?ric_id=ricsim_g1_5 5 120 |
| 238 | api_equal json:policy-types?ric_id=ricsim_g1_6 4 120 |
| 239 | api_equal json:policy-types?ric_id=ricsim_g1_7 3 120 |
| 240 | api_equal json:policy-types?ric_id=ricsim_g1_8 2 120 |
| 241 | api_equal json:policy-types?ric_id=ricsim_g1_9 1 120 |
| 242 | api_equal json:policy-types?ric_id=ricsim_g1_10 0 120 |
| 243 | else |
| 244 | |
| 245 | echo "Check the number of types in the agent for each ric" |
| 246 | api_equal json:policy_types?ric=ricsim_g1_1 1 120 |
| 247 | api_equal json:policy_types?ric=ricsim_g1_2 2 120 |
| 248 | api_equal json:policy_types?ric=ricsim_g1_3 3 120 |
| 249 | api_equal json:policy_types?ric=ricsim_g1_4 4 120 |
| 250 | api_equal json:policy_types?ric=ricsim_g1_5 5 120 |
| 251 | api_equal json:policy_types?ric=ricsim_g1_6 4 120 |
| 252 | api_equal json:policy_types?ric=ricsim_g1_7 3 120 |
| 253 | api_equal json:policy_types?ric=ricsim_g1_8 2 120 |
| 254 | api_equal json:policy_types?ric=ricsim_g1_9 1 120 |
| 255 | api_equal json:policy_types?ric=ricsim_g1_10 0 120 |
| 256 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 257 | |
| 258 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 259 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 260 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 261 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \ |
| 262 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \ |
| 263 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \ |
| 264 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \ |
| 265 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \ |
| 266 | ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \ |
| 267 | ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? " |
| 268 | |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 269 | if [ "$PMS_VERSION" == "V2" ]; then |
| 270 | cr_equal received_callbacks?id=ric-registration 19 120 |
| 271 | cr_api_check_all_sync_events 200 ric-registration ricsim_g1_9 |
| 272 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 273 | |
| 274 | #No policy type in sim #10 |
| 275 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 276 | if [ "$PMS_VERSION" == "V2" ]; then |
| 277 | api_equal json:policy-types 5 |
| 278 | else |
| 279 | api_equal json:policy_types 5 |
| 280 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 281 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 282 | api_put_service 201 "serv1" 3600 "$CR_SERVICE_PATH/serv1" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 283 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 284 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 285 | notificationurl=$CR_SERVICE_PATH"/test" |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 286 | else |
| 287 | notificationurl="" |
| 288 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 289 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 290 | sleep_wait 120 |
| 291 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 292 | # Load config with reduced number of rics |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 293 | if [ $RUNMODE == "KUBE" ]; then |
| 294 | agent_load_config ".consul_config_initial.json" |
| 295 | else |
| 296 | consul_config_app ".consul_config_initial.json" |
| 297 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 298 | |
| 299 | api_equal json:rics 8 120 |
| 300 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 301 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 302 | cr_equal received_callbacks?id=ric-registration 19 120 |
| 303 | cr_api_check_all_sync_events 200 ric-registration EMPTY |
| 304 | fi |
| 305 | |
| 306 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 307 | echo "Check the number of types in the agent for each ric" |
| 308 | api_equal json:policy-types?ric_id=ricsim_g1_1 1 120 |
| 309 | api_equal json:policy-types?ric_id=ricsim_g1_2 2 120 |
| 310 | api_equal json:policy-types?ric_id=ricsim_g1_3 3 120 |
| 311 | api_equal json:policy-types?ric_id=ricsim_g1_4 4 120 |
| 312 | api_equal json:policy-types?ric_id=ricsim_g1_5 5 120 |
| 313 | api_equal json:policy-types?ric_id=ricsim_g1_6 4 120 |
| 314 | api_equal json:policy-types?ric_id=ricsim_g1_7 3 120 |
| 315 | api_equal json:policy-types?ric_id=ricsim_g1_8 2 120 |
| 316 | else |
| 317 | echo "Check the number of types in the agent for each ric" |
| 318 | api_equal json:policy_types?ric=ricsim_g1_1 1 120 |
| 319 | api_equal json:policy_types?ric=ricsim_g1_2 2 120 |
| 320 | api_equal json:policy_types?ric=ricsim_g1_3 3 120 |
| 321 | api_equal json:policy_types?ric=ricsim_g1_4 4 120 |
| 322 | api_equal json:policy_types?ric=ricsim_g1_5 5 120 |
| 323 | api_equal json:policy_types?ric=ricsim_g1_6 4 120 |
| 324 | api_equal json:policy_types?ric=ricsim_g1_7 3 120 |
| 325 | api_equal json:policy_types?ric=ricsim_g1_8 2 120 |
| 326 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 327 | |
| 328 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 329 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 330 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 331 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \ |
| 332 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \ |
| 333 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \ |
| 334 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \ |
| 335 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? " |
| 336 | |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 337 | sleep_wait 120 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 338 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 339 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 340 | api_equal json:policy-instances 0 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 341 | else |
| 342 | api_equal json:policy_ids 0 |
| 343 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 344 | |
| 345 | api_get_policy_types 404 ricsim_g1_9 |
| 346 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 347 | # Load config with all rics |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 348 | if [ $RUNMODE == "KUBE" ]; then |
| 349 | agent_load_config ".consul_config_all.json" |
| 350 | else |
| 351 | consul_config_app ".consul_config_all.json" |
| 352 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 353 | |
| 354 | api_equal json:rics 10 120 |
| 355 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 356 | if [ "$PMS_VERSION" == "V2" ]; then |
| 357 | echo "Check the number of types in the agent for each ric" |
| 358 | api_equal json:policy-types?ric_id=ricsim_g1_1 1 120 |
| 359 | api_equal json:policy-types?ric_id=ricsim_g1_2 2 120 |
| 360 | api_equal json:policy-types?ric_id=ricsim_g1_3 3 120 |
| 361 | api_equal json:policy-types?ric_id=ricsim_g1_4 4 120 |
| 362 | api_equal json:policy-types?ric_id=ricsim_g1_5 5 120 |
| 363 | api_equal json:policy-types?ric_id=ricsim_g1_6 4 120 |
| 364 | api_equal json:policy-types?ric_id=ricsim_g1_7 3 120 |
| 365 | api_equal json:policy-types?ric_id=ricsim_g1_8 2 120 |
| 366 | api_equal json:policy-types?ric_id=ricsim_g1_9 1 120 |
| 367 | api_equal json:policy-types?ric_id=ricsim_g1_10 0 120 |
| 368 | else |
| 369 | echo "Check the number of types in the agent for each ric" |
| 370 | api_equal json:policy_types?ric=ricsim_g1_1 1 120 |
| 371 | api_equal json:policy_types?ric=ricsim_g1_2 2 120 |
| 372 | api_equal json:policy_types?ric=ricsim_g1_3 3 120 |
| 373 | api_equal json:policy_types?ric=ricsim_g1_4 4 120 |
| 374 | api_equal json:policy_types?ric=ricsim_g1_5 5 120 |
| 375 | api_equal json:policy_types?ric=ricsim_g1_6 4 120 |
| 376 | api_equal json:policy_types?ric=ricsim_g1_7 3 120 |
| 377 | api_equal json:policy_types?ric=ricsim_g1_8 2 120 |
| 378 | api_equal json:policy_types?ric=ricsim_g1_9 1 120 |
| 379 | api_equal json:policy_types?ric=ricsim_g1_10 0 120 |
| 380 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 381 | |
| 382 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 383 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 384 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 385 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \ |
| 386 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \ |
| 387 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \ |
| 388 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \ |
| 389 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \ |
| 390 | ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \ |
| 391 | ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? " |
| 392 | |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 393 | sleep_wait 120 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 394 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 395 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 396 | api_equal json:policy-instances 0 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 397 | else |
| 398 | api_equal json:policy_ids 0 |
| 399 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 400 | |
| 401 | sim_equal ricsim_g1_9 num_instances 0 |
| 402 | |
| 403 | |
| 404 | sim_delete_policy_type 204 ricsim_g1_4 4 |
| 405 | sim_delete_policy_type 204 ricsim_g1_5 4 |
| 406 | sim_delete_policy_type 204 ricsim_g1_6 4 |
| 407 | sim_delete_policy_type 204 ricsim_g1_7 4 |
| 408 | |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 409 | sleep_wait 120 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 410 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 411 | if [ "$PMS_VERSION" == "V2" ]; then |
| 412 | api_equal json:policy-types?ric_id=ricsim_g1_1 1 120 |
| 413 | api_equal json:policy-types?ric_id=ricsim_g1_2 2 120 |
| 414 | api_equal json:policy-types?ric_id=ricsim_g1_3 3 120 |
| 415 | api_equal json:policy-types?ric_id=ricsim_g1_4 3 120 |
| 416 | api_equal json:policy-types?ric_id=ricsim_g1_5 4 120 |
| 417 | api_equal json:policy-types?ric_id=ricsim_g1_6 3 120 |
| 418 | api_equal json:policy-types?ric_id=ricsim_g1_7 2 120 |
| 419 | api_equal json:policy-types?ric_id=ricsim_g1_8 2 120 |
| 420 | api_equal json:policy-types?ric_id=ricsim_g1_9 1 120 |
| 421 | api_equal json:policy-types?ric_id=ricsim_g1_10 0 120 |
| 422 | else |
| 423 | api_equal json:policy_types?ric=ricsim_g1_1 1 120 |
| 424 | api_equal json:policy_types?ric=ricsim_g1_2 2 120 |
| 425 | api_equal json:policy_types?ric=ricsim_g1_3 3 120 |
| 426 | api_equal json:policy_types?ric=ricsim_g1_4 3 120 |
| 427 | api_equal json:policy_types?ric=ricsim_g1_5 4 120 |
| 428 | api_equal json:policy_types?ric=ricsim_g1_6 3 120 |
| 429 | api_equal json:policy_types?ric=ricsim_g1_7 2 120 |
| 430 | api_equal json:policy_types?ric=ricsim_g1_8 2 120 |
| 431 | api_equal json:policy_types?ric=ricsim_g1_9 1 120 |
| 432 | api_equal json:policy_types?ric=ricsim_g1_10 0 120 |
| 433 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 434 | |
| 435 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 436 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 437 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 438 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \ |
| 439 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \ |
| 440 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \ |
| 441 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \ |
| 442 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \ |
| 443 | ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \ |
| 444 | ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? " |
| 445 | |
| 446 | sim_delete_policy_type 204 ricsim_g1_8 4 |
| 447 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 448 | if [ "$PMS_VERSION" == "V2" ]; then |
| 449 | api_equal json:policy-types?ric_id=ricsim_g1_8 1 120 |
| 450 | else |
| 451 | api_equal json:policy_types?ric=ricsim_g1_8 1 120 |
| 452 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 453 | |
| 454 | api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \ |
| 455 | ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \ |
| 456 | ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \ |
| 457 | ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \ |
| 458 | ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \ |
| 459 | ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \ |
| 460 | ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \ |
| 461 | ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:5:???? \ |
| 462 | ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \ |
| 463 | ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? " |
| 464 | |
| 465 | |
| 466 | |
| 467 | check_policy_agent_logs |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 468 | if [[ $interface = *"SDNC"* ]]; then |
| 469 | check_sdnc_logs |
| 470 | fi |
| 471 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 472 | store_logs ${interface} |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 473 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 474 | done |
| 475 | |
| 476 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 477 | #### TEST COMPLETE #### |
| 478 | |
| 479 | |
| 480 | print_result |
| 481 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 482 | auto_clean_environment |