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