Clean autotest folder
[nonrtric.git] / test / auto-test / FTC_SDNC.sh
1 #!/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
20 TC_ONELINE_DESCR="Create 1 policy with SDNC and 1 policy without SDNC over agent REST"
21
22 . ../common/testcase_common.sh  $@
23 . ../common/agent_api_functions.sh
24
25 #### TEST BEGIN ####
26
27 VARIANTS="NOSDNC SDNC"
28
29 for TEST in $VARIANTS ; do
30
31
32     clean_containers
33
34     start_ric_simulators ricsim_g1 1 OSC_2.1.0
35     start_ric_simulators ricsim_g2 1 STD_1.1.3
36
37     start_mr
38
39     start_cr
40
41     start_consul_cbs
42
43     prepare_consul_config      $TEST  ".consul_config.json"
44     consul_config_app                  ".consul_config.json"
45
46     start_control_panel
47
48     if [ $TEST == "SDNC" ]; then
49         start_sdnc
50     fi
51
52     start_policy_agent
53
54
55     set_agent_debug
56
57     use_agent_rest
58
59     echo "Using: "$TEST
60
61     api_get_status 200
62
63     sim_print ricsim_g1_1 interface
64     sim_print ricsim_g2_1 interface
65
66     sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
67
68     api_equal json:policy_types 2 120  #Wait for the agent to refresh types from the simulator
69
70     api_put_service 201 "rapp1" 3600 "http://callback-receiver:8090/callbacks/1"
71
72     api_put_policy 201 "rapp1" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json 10
73
74     api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 3000 testdata/STD/pi1_template.json 10
75
76     sim_equal ricsim_g1_1 num_instances 10
77     sim_equal ricsim_g2_1 num_instances 10
78
79
80     check_policy_agent_logs
81     check_control_panel_logs
82
83     store_logs          $TEST
84
85     echo ""
86     echo -e $BOLD"Test complete for variant: "$TEST $EBOLD
87     echo ""
88
89 done
90
91 #### TEST COMPLETE ####
92
93 print_result
94