blob: 13a9af06feb4033ea03ffca7e314885634a5c218 [file] [log] [blame]
BjornMagnussonXA70e878f2020-05-11 14:11:30 +02001#!/usr/bin/env 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="Testing of the health check app"
21
22. ../common/testcase_common.sh $@
23. ../common/agent_api_functions.sh
24. ../common/ricsimulator_api_functions.sh
25
26#### TEST BEGIN ####
27
28#Local vars in test script
29##########################
30# Path to callback receiver
31CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
32
33clean_containers
34
35start_ric_simulators ricsim_g1 6 OSC_2.1.0
36
37start_ric_simulators ricsim_g2 5 STD_1.1.3
38
39
40
41start_consul_cbs
42
43prepare_consul_config NOSDNC ".consul_config.json"
44consul_config_app ".consul_config.json"
45
46
47start_policy_agent
48
49
50use_agent_rest_http
51
52api_get_status 200
53
54sim_print ricsim_g1_1 interface
55sim_print ricsim_g1_2 interface
56sim_print ricsim_g1_3 interface
57sim_print ricsim_g1_4 interface
58sim_print ricsim_g1_5 interface
59sim_print ricsim_g1_6 interface
60
61sim_print ricsim_g2_1 interface
62sim_print ricsim_g2_2 interface
63sim_print ricsim_g2_3 interface
64sim_print ricsim_g2_4 interface
65sim_print ricsim_g2_5 interface
66
67sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
68sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
69sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
70sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
71sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
72sim_put_policy_type 201 ricsim_g1_6 1 testdata/OSC/sim_1.json
73
74api_equal json:policy_types 2 120
75
76sleep_wait 30 "Give the agent some extra time...."
77
78# Create policies
79use_agent_rest_http
80
81api_put_service 201 "rapp1" 3600 "$CR_PATH/1"
82
83api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 testdata/OSC/pi1_template.json 1
84api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 testdata/OSC/pi1_template.json 1
85api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 testdata/OSC/pi1_template.json 1
86api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 testdata/OSC/pi1_template.json 1
87api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 testdata/OSC/pi1_template.json 1
88api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 testdata/OSC/pi1_template.json 1
89
90sim_equal ricsim_g1_1 num_instances 1
91sim_equal ricsim_g1_2 num_instances 1
92sim_equal ricsim_g1_3 num_instances 1
93sim_equal ricsim_g1_4 num_instances 1
94sim_equal ricsim_g1_5 num_instances 1
95sim_equal ricsim_g1_6 num_instances 1
96
97api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 testdata/STD/pi1_template.json 1
98api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 testdata/STD/pi1_template.json 1
99api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 testdata/STD/pi1_template.json 1
100api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 testdata/STD/pi1_template.json 1
101api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 testdata/STD/pi1_template.json 1
102
103sim_equal ricsim_g2_1 num_instances 1
104sim_equal ricsim_g2_2 num_instances 1
105sim_equal ricsim_g2_3 num_instances 1
106sim_equal ricsim_g2_4 num_instances 1
107sim_equal ricsim_g2_5 num_instances 1
108
109
110check_policy_agent_logs
111
112#### TEST COMPLETE ####
113
114store_logs END
115
116print_result