Test env documentation and new features
First part of README updated
Added panic stop of test case with retrieving logs
Added test result file of scripting support
Change-Id: I283dbf2013eaba2006391cde3c9cb2acd0a0239f
Issue-ID: NONRTRIC-154
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
diff --git a/test/auto-test/.gitignore b/test/auto-test/.gitignore
index c5c4261..89e22de 100644
--- a/test/auto-test/.gitignore
+++ b/test/auto-test/.gitignore
@@ -13,3 +13,4 @@
.sdnc*
.timer*
.pid*
+.result*
diff --git a/test/auto-test/FTC900.sh b/test/auto-test/FTC900.sh
index 5515a77..5a71916 100755
--- a/test/auto-test/FTC900.sh
+++ b/test/auto-test/FTC900.sh
@@ -17,10 +17,10 @@
# ============LICENSE_END=================================================
#
-TC_ONELINE_DESCR="Testing of the health check app"
+TC_ONELINE_DESCR="Testing of the Control Panel and the Health Check app - populating with types and instances"
#App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC SDNC_ONAP"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
@@ -35,80 +35,98 @@
clean_containers
-start_ric_simulators ricsim_g1 6 OSC_2.1.0
+OSC_NUM_RICS=6
+STD_NUM_RICS=5
-start_ric_simulators ricsim_g2 5 STD_1.1.3
+start_ric_simulators ricsim_g1 $OSC_NUM_RICS OSC_2.1.0
+start_ric_simulators ricsim_g2 $STD_NUM_RICS STD_1.1.3
+start_mr #Just to prevent errors in the agent log...
+
+start_control_panel
start_consul_cbs
prepare_consul_config NOSDNC ".consul_config.json"
consul_config_app ".consul_config.json"
-
start_policy_agent
-
use_agent_rest_http
api_get_status 200
-sim_print ricsim_g1_1 interface
-sim_print ricsim_g1_2 interface
-sim_print ricsim_g1_3 interface
-sim_print ricsim_g1_4 interface
-sim_print ricsim_g1_5 interface
-sim_print ricsim_g1_6 interface
+# Print the A1 version for OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_print ricsim_g1_$i interface
+done
-sim_print ricsim_g2_1 interface
-sim_print ricsim_g2_2 interface
-sim_print ricsim_g2_3 interface
-sim_print ricsim_g2_4 interface
-sim_print ricsim_g2_5 interface
-sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
-sim_put_policy_type 201 ricsim_g1_6 1 testdata/OSC/sim_1.json
+# Print the A1 version for STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ sim_print ricsim_g2_$i interface
+done
-api_equal json:policy_types 2 120
-sleep_wait 30 "Give the agent some extra time...."
+# Load the polictypes in osc
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_put_policy_type 201 ricsim_g1_$i 2 testdata/OSC/sim_hw.json
+ sim_put_policy_type 201 ricsim_g1_$i 20008 testdata/OSC/sim_tsa.json
+done
+
+
+#Check the number of schemas and the individual schemas in OSC
+api_equal json:policy_types 3 120
+
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ api_equal json:policy_types?ric=ricsim_g1_$i 2 120
+done
+
+# Check the schemas in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ api_get_policy_schema 200 2 testdata/OSC/hw-agent-modified.json
+ api_get_policy_schema 200 20008 testdata/OSC/tsa-agent-modified.json
+done
+
# Create policies
use_agent_rest_http
-api_put_service 201 "rapp1" 3600 "$CR_PATH/1"
+api_put_service 201 "rapp1" 0 "$CR_PATH/1"
-api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 NOTRANSIENT testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 NOTRANSIENT testdata/OSC/pi1_template.json 1
+# Create policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ api_put_policy 201 "rapp1" ricsim_g1_$i 2 $((2000+$i)) NOTRANSIENT testdata/OSC/pihw_template.json 1
+ api_put_policy 201 "rapp1" ricsim_g1_$i 20008 $((2050+$i*10)) NOTRANSIENT testdata/OSC/pitsa_template.json 1
+done
-sim_equal ricsim_g1_1 num_instances 1
-sim_equal ricsim_g1_2 num_instances 1
-sim_equal ricsim_g1_3 num_instances 1
-sim_equal ricsim_g1_4 num_instances 1
-sim_equal ricsim_g1_5 num_instances 1
-sim_equal ricsim_g1_6 num_instances 1
-api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 NOTRANSIENT testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 NOTRANSIENT testdata/STD/pi1_template.json 1
+# Check the number of policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_equal ricsim_g1_$i num_instances 2
+done
-sim_equal ricsim_g2_1 num_instances 1
-sim_equal ricsim_g2_2 num_instances 1
-sim_equal ricsim_g2_3 num_instances 1
-sim_equal ricsim_g2_4 num_instances 1
-sim_equal ricsim_g2_5 num_instances 1
+# Create policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ api_put_policy 201 "rapp1" ricsim_g2_$i NOTYPE $((2100+$i)) NOTRANSIENT testdata/STD/pi1_template.json 1
+done
+
+
+# Check the number of policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ sim_equal ricsim_g2_$i num_instances 1
+done
check_policy_agent_logs
diff --git a/test/auto-test/Suite-all.sh b/test/auto-test/Suite-all.sh
new file mode 100755
index 0000000..342596d
--- /dev/null
+++ b/test/auto-test/Suite-all.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+TS_ONELINE_DESCR="Test suite - all test cases except the stab test(s)"
+
+. ../common/testsuite_common.sh
+
+suite_setup
+
+############# TEST CASES #################
+ARG1=$1
+
+./FTC1.sh $1
+
+if [ $ARG1 == "remote-remove" ]; then
+ #Prevent image removal for every test case
+ ARG1="remote"
+fi
+
+./FTC10.sh $1
+./FTC100.sh $1
+./FTC110.sh $1
+./FTC150.sh $1
+./FTC300.sh $1
+./FTC310.sh $1
+./FTC350.sh $1
+./FTC800.sh $1
+./FTC850.sh $1
+
+##########################################
+
+suite_complete
\ No newline at end of file
diff --git a/test/auto-test/Suite-interfaces.sh b/test/auto-test/Suite-interfaces.sh
index 1723555..7a21646 100755
--- a/test/auto-test/Suite-interfaces.sh
+++ b/test/auto-test/Suite-interfaces.sh
@@ -25,9 +25,17 @@
############# TEST CASES #################
-./FTC100.sh $1
-./FTC110.sh $1
-./FTC150.sh $1
+ARG1=$1
+
+./FTC100.sh $ARG1
+
+if [ $ARG1 == "remote-remove" ]; then
+ #Prevent image removal for every test case
+ ARG1="remote"
+fi
+
+./FTC110.sh $ARG1
+./FTC150.sh $ARG1
##########################################
diff --git a/test/auto-test/testdata/OSC/hw-agent-modified.json b/test/auto-test/testdata/OSC/hw-agent-modified.json
new file mode 100644
index 0000000..c48736e
--- /dev/null
+++ b/test/auto-test/testdata/OSC/hw-agent-modified.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "2",
+ "description": "HW policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/hw.json b/test/auto-test/testdata/OSC/hw.json
new file mode 100644
index 0000000..684f80d
--- /dev/null
+++ b/test/auto-test/testdata/OSC/hw.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "HW Policy",
+ "description": "HW policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/pihw_template.json b/test/auto-test/testdata/OSC/pihw_template.json
new file mode 100644
index 0000000..7574995
--- /dev/null
+++ b/test/auto-test/testdata/OSC/pihw_template.json
@@ -0,0 +1,3 @@
+{
+ "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/pitsa_template.json b/test/auto-test/testdata/OSC/pitsa_template.json
new file mode 100644
index 0000000..7574995
--- /dev/null
+++ b/test/auto-test/testdata/OSC/pitsa_template.json
@@ -0,0 +1,3 @@
+{
+ "threshold": XXX
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/sim_hw.json b/test/auto-test/testdata/OSC/sim_hw.json
new file mode 100644
index 0000000..65085c5
--- /dev/null
+++ b/test/auto-test/testdata/OSC/sim_hw.json
@@ -0,0 +1,18 @@
+{
+ "name": "hwpolicy",
+ "description": "Hellow World policy type",
+ "policy_type_id": 2,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "HW Policy",
+ "description": "HW policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
+ }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/sim_tsa.json b/test/auto-test/testdata/OSC/sim_tsa.json
new file mode 100644
index 0000000..4520cfa
--- /dev/null
+++ b/test/auto-test/testdata/OSC/sim_tsa.json
@@ -0,0 +1,18 @@
+{
+ "name": "tsapolicy",
+ "description": "tsa parameters",
+ "policy_type_id": 20008,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "TS Policy",
+ "description": "TS policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/tsa-agent-modified.json b/test/auto-test/testdata/OSC/tsa-agent-modified.json
new file mode 100644
index 0000000..7d48ff9
--- /dev/null
+++ b/test/auto-test/testdata/OSC/tsa-agent-modified.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "20008",
+ "description": "TS policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file
diff --git a/test/auto-test/testdata/OSC/tsa.json b/test/auto-test/testdata/OSC/tsa.json
new file mode 100644
index 0000000..b1d443b
--- /dev/null
+++ b/test/auto-test/testdata/OSC/tsa.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "TS Policy",
+ "description": "TS policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file