Merge "Step version for release"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Thu, 4 Jun 2020 11:37:49 +0000 (11:37 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Thu, 4 Jun 2020 11:37:49 +0000 (11:37 +0000)
23 files changed:
LICENSE.txt
policy-agent/pom.xml
policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java
pom.xml
test/auto-test/.gitignore
test/auto-test/FTC900.sh
test/auto-test/Suite-all.sh [new file with mode: 0755]
test/auto-test/Suite-interfaces.sh
test/auto-test/testdata/OSC/hw-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/hw.json [new file with mode: 0644]
test/auto-test/testdata/OSC/pihw_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/pitsa_template.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_hw.json [new file with mode: 0644]
test/auto-test/testdata/OSC/sim_tsa.json [new file with mode: 0644]
test/auto-test/testdata/OSC/tsa-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/OSC/tsa.json [new file with mode: 0644]
test/common/README.md
test/common/agent_api_functions.sh
test/common/controller_api_functions.sh
test/common/create_policies_process.py
test/common/delete_policies_process.py
test/common/ricsimulator_api_functions.sh
test/common/testcase_common.sh

index f49a4e1..96589bf 100644 (file)
    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.
\ No newline at end of file
+   limitations under the License. 
index ed1cbf1..2943ef8 100644 (file)
@@ -31,7 +31,7 @@
     </parent>
     <groupId>org.o-ran-sc.nonrtric</groupId>
     <artifactId>policy-agent</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <licenses>
         <license>
             <name>The Apache Software License, Version 2.0</name>
@@ -53,7 +53,6 @@
         <swagger.version>2.0.0</swagger.version>
         <json.version>20190722</json.version>
         <commons-net.version>3.6</commons-net.version>
-        <awaitility.version>4.0.2</awaitility.version>
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <formatter-maven-plugin.version>2.8.1</formatter-maven-plugin.version>
         <spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
             <artifactId>commons-net</artifactId>
             <version>${commons-net.version}</version>
         </dependency>
-        <!-- Actuator dependencies -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <!--TEST -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-configuration-processor</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>com.squareup.okhttp3</groupId>
-            <artifactId>mockwebserver</artifactId>
-            <scope>test</scope>
+            <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+            <artifactId>dmaapClient</artifactId>
+            <version>${version.dmaap}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${javax.ws.rs-api.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.inject</groupId>
+            <artifactId>jersey-hk2</artifactId>
         </dependency>
+
+        <!-- Actuator dependencies -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
         <!--REQUIRED TO GENERATE DOCUMENTATION -->
         <dependency>
             <groupId>io.springfox</groupId>
             <artifactId>springfox-swagger-ui</artifactId>
             <version>${springfox.version}</version>
         </dependency>
+
         <!-- TEST -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.awaitility</groupId>
             <artifactId>awaitility</artifactId>
-            <version>${awaitility.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
-            <artifactId>dmaapClient</artifactId>
-            <version>${version.dmaap}</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>${javax.ws.rs-api.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.inject</groupId>
-            <artifactId>jersey-hk2</artifactId>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>mockwebserver</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
     <build>
index a19870b..716148f 100644 (file)
@@ -44,48 +44,6 @@ public class Lock {
     private final List<LockRequest> lockRequestQueue = new LinkedList<>();
     private static AsynchCallbackExecutor callbackProcessor = new AsynchCallbackExecutor();
 
-    private static class AsynchCallbackExecutor implements Runnable {
-        private List<LockRequest> lockRequestQueue = new LinkedList<>();
-
-        public AsynchCallbackExecutor() {
-            Thread thread = new Thread(this);
-            thread.start();
-        }
-
-        public synchronized void addAll(List<LockRequest> requests) {
-            this.lockRequestQueue.addAll(requests);
-            this.notifyAll();
-        }
-
-        @Override
-        public void run() {
-            try {
-                while (true) {
-                    for (LockRequest request : consume()) {
-                        request.callback.success(request.lock);
-                    }
-                    waitForNewEntries();
-                }
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                logger.error("Interrupted {}", e.getMessage());
-            }
-        }
-
-        private synchronized List<LockRequest> consume() {
-            List<LockRequest> q = this.lockRequestQueue;
-            this.lockRequestQueue = new LinkedList<>();
-            return q;
-        }
-
-        @SuppressWarnings("java:S2274")
-        private synchronized void waitForNewEntries() throws InterruptedException {
-            if (this.lockRequestQueue.isEmpty()) {
-                this.wait();
-            }
-        }
-    }
-
     public enum LockType {
         EXCLUSIVE, SHARED
     }
@@ -113,23 +71,21 @@ public class Lock {
         });
     }
 
-    public void unlockBlocking() {
-        synchronized (this) {
-            if (lockCounter <= 0) {
-                lockCounter = -1; // Might as well stop, to make it easier to find the problem
-                logger.error("Number of unlocks must match the number of locks");
-            }
-            this.lockCounter--;
-            if (lockCounter == 0) {
-                isExclusive = false;
-            }
-            this.notifyAll();
+    public synchronized void unlockBlocking() {
+        if (lockCounter <= 0) {
+            lockCounter = -1; // Might as well stop, to make it easier to find the problem
+            logger.error("Number of unlocks must match the number of locks");
+        }
+        this.lockCounter--;
+        if (lockCounter == 0) {
+            isExclusive = false;
         }
+        this.notifyAll();
         this.processQueuedEntries();
     }
 
     @Override
-    public String toString() {
+    public synchronized String toString() {
         return "Lock cnt: " + this.lockCounter + " exclusive: " + this.isExclusive + " queued: "
             + this.lockRequestQueue.size();
     }
@@ -141,30 +97,16 @@ public class Lock {
 
     private void processQueuedEntries() {
         List<LockRequest> granted = new ArrayList<>();
-        synchronized (this) {
-            for (Iterator<LockRequest> i = lockRequestQueue.iterator(); i.hasNext();) {
-                LockRequest request = i.next();
-                if (tryLock(request.lockType)) {
-                    i.remove();
-                    granted.add(request);
-                }
+        for (Iterator<LockRequest> i = lockRequestQueue.iterator(); i.hasNext();) {
+            LockRequest request = i.next();
+            if (tryLock(request.lockType)) {
+                i.remove();
+                granted.add(request);
             }
         }
         callbackProcessor.addAll(granted);
     }
 
-    private static class LockRequest {
-        final MonoSink<Lock> callback;
-        final LockType lockType;
-        final Lock lock;
-
-        LockRequest(MonoSink<Lock> callback, LockType lockType, Lock lock) {
-            this.callback = callback;
-            this.lockType = lockType;
-            this.lock = lock;
-        }
-    }
-
     private synchronized void addToQueue(MonoSink<Lock> callback, LockType lockType) {
         lockRequestQueue.add(new LockRequest(callback, lockType, this));
         processQueuedEntries();
@@ -192,4 +134,64 @@ public class Lock {
         return true;
     }
 
+    /**
+     * Represents a queued lock request
+     */
+    private static class LockRequest {
+        final MonoSink<Lock> callback;
+        final LockType lockType;
+        final Lock lock;
+
+        LockRequest(MonoSink<Lock> callback, LockType lockType, Lock lock) {
+            this.callback = callback;
+            this.lockType = lockType;
+            this.lock = lock;
+        }
+    }
+
+    /**
+     * A separate thread that calls a MonoSink to continue. This is done after a
+     * queued lock is granted.
+     */
+    private static class AsynchCallbackExecutor implements Runnable {
+        private List<LockRequest> lockRequestQueue = new LinkedList<>();
+
+        public AsynchCallbackExecutor() {
+            Thread thread = new Thread(this);
+            thread.start();
+        }
+
+        public synchronized void addAll(List<LockRequest> requests) {
+            this.lockRequestQueue.addAll(requests);
+            this.notifyAll();
+        }
+
+        @Override
+        public void run() {
+            try {
+                while (true) {
+                    for (LockRequest request : consume()) {
+                        request.callback.success(request.lock);
+                    }
+                    waitForNewEntries();
+                }
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.error("Interrupted {}", e.getMessage());
+            }
+        }
+
+        private synchronized List<LockRequest> consume() {
+            List<LockRequest> q = this.lockRequestQueue;
+            this.lockRequestQueue = new LinkedList<>();
+            return q;
+        }
+
+        @SuppressWarnings("java:S2274")
+        private synchronized void waitForNewEntries() throws InterruptedException {
+            if (this.lockRequestQueue.isEmpty()) {
+                this.wait();
+            }
+        }
+    }
 }
diff --git a/pom.xml b/pom.xml
index facc920..4cb5edf 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
     <groupId>org.o-ran-sc</groupId>
     <artifactId>nonrtric</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>nonrtric</name>
index c5c4261..89e22de 100644 (file)
@@ -13,3 +13,4 @@ logs
 .sdnc*
 .timer*
 .pid*
+.result*
index 5515a77..5a71916 100755 (executable)
 #  ============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 @@ CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
 
 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
+
+
+# Print the A1 version for STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_print ricsim_g2_$i interface
+done
+
+
+# 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
 
-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
+#Check the number of schemas and the individual schemas in OSC
+api_equal json:policy_types 3 120
 
-api_equal json:policy_types 2 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
 
-sleep_wait 30 "Give the agent some extra time...."
 
 # Create policies
 use_agent_rest_http
 
-api_put_service 201 "rapp1" 3600 "$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
-
-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
-
-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
+api_put_service 201 "rapp1" 0 "$CR_PATH/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
+
+
+# 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
+
+
+# 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 (executable)
index 0000000..342596d
--- /dev/null
@@ -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
index 1723555..7a21646 100755 (executable)
@@ -25,9 +25,17 @@ suite_setup
 
 ############# 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 (file)
index 0000000..c48736e
--- /dev/null
@@ -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 (file)
index 0000000..684f80d
--- /dev/null
@@ -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 (file)
index 0000000..7574995
--- /dev/null
@@ -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 (file)
index 0000000..7574995
--- /dev/null
@@ -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 (file)
index 0000000..65085c5
--- /dev/null
@@ -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 (file)
index 0000000..4520cfa
--- /dev/null
@@ -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 (file)
index 0000000..7d48ff9
--- /dev/null
@@ -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 (file)
index 0000000..b1d443b
--- /dev/null
@@ -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
index dd1ddf3..62ee842 100644 (file)
-## Description for common test scripts
+## Introduction ##
+This dir contains most scripts needed for the auto-test environment. There are scripts with functions to adapt to the apis of the components of the Non-RT RIC; Policy Agent, A1 Controller and Ric (A1) simulator.
+Some of the scripts can also be used for other kinds of tests, for example basic tests.
+
+## Overview for common test scripts and files ##
 
 `test_env.sh` \
-Common env variables for test in the auto-test dir.
-Used by the auto test cases/suites but could be used for other test script as well.
+Common env variables for test in the auto-test dir. All configuration of port numbers, image names and version etc shall be made in this file.
+Used by the auto test scripts/suites but could be used for other test script as well.
 
 `testcase_common.sh` \
-Common functions for auto test cases in the auto-test dir.
-A subset of the functions could be used in other test scripts as well.
+Common functions for auto test cases in the auto-test dir. This script is the foundation of test auto environment which sets up images and enviroment variables needed by this script as well as the script adapting to the APIs.
+The included functions are described in detail further below.
+
+`testsuite_common.sh` \
+Common functions for running two or more auto test scripts as a suite.
+
+`agent_api_functions.sh` \
+Contains functions for adapting towards the Policy Agent API, also via dmaap (using a message-router stub interface)
+
+`controller_api_functions.sh` \
+Contains functions for adaping towards the A1-controller API.
+
+`ricsimulator_api_functions.sh` \
+Contains functions for adapting towards the RIC (A1) simulator admin API.
+
+`compare_json.py` \
+A python script to compare two json obects for equality. Note that the comparsion always sort json-arrays before comparing (that is, it does not care about the order of items within the array). In addition, the target json object may specify individual parameter values where equality is 'dont care'.
+
+`count_json_elements.py` \
+A python script returning the number of items in a json array.
+
+`create_policies_process.py` \
+A python script to create a batch of policies. The script is intended to run in a number of processes to create policies in parallel.
+
+`create_rics_json.py` \
+A python script to create a json file from a formatted string of ric info. Helper for the test enviroment.
+
+`delete_policies_process.py` \
+A python script to delete a batch of policies. The script is intended to run in a number of processes to delete policies in parallel.
+
+`extract_sdnc_reply.py` \
+A python script to extract the information from an sdnc (A1 Controller) reply json. Helper for the test environment.
+
+`do_curl_function.sh`
+A script for executing a curl call with a specific url and optional payload. It also compare the response with an expected result in terms of response code and optional returned payload. Intended to be used by test script (for example basic test scripts of other components)
+
+
+
+### Descriptions of functions in testcase_common.sh ###
+
+#### Script args ####
+The script can be started with these arguments
+
+| arg list |
+|--|
+| `local|remote|remote-remove [auto-clean] [--stop-at-error] [--use-local-image <app-nam> [<app-name>]*]` |
+
+| parameter | description |
+|-|-|
+| `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
+| `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
+| `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
+| `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
+| `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
+| `--use-local-image` | Only applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC for Policy Agent, Control Panel, A1-controller and the Ric simulator |
+
+#### Function: print_result ####
+Print a test report of an auto-test script.
+| arg list |
+|--|
+| None |
+
+#### Function: start_timer ####
+Start a timer for time measurement. Only one timer can be running.
+| arg list |
+|--|
+| None - but any args will be printed (It is good practice to use same args for this function as for the `print_timer`) |
+
+#### Function: print_timer ####
+Print the value of the timer (in seconds) previously started by 'start_timer'. (Note that timer is still running after this function). The result of the timer as well as the args to the function will also be printed in the test report.
+| arg list |
+|--|
+| `<timer-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
+
+#### Function: print_and_reset_timer ####
+Print the value of the timer (in seconds) previously started by 'start_timer'. Also reset the timer to 0. The result of the timer as well as the args to the function will also be printed in the test report.
+| arg list |
+|--|
+| `<timer-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<timer-message-to-print>` | Any text message to be printed along with the timer result.(It is good practice to use same args for this function as for the `start_timer`) |
+
+#### Function: deviation ####
+Mark a test as a deviation from the requirements. The list of deviations will be printed in the test report.
+| arg list |
+|--|
+| `<deviation-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<deviation-message-to-print>` | Any text message describing the deviation. The text will also be printed in the test report. The intention is to mark known deviations, compared to required functionality |
+
+#### Function: clean_containers ####
+Stop and remove all containers. Containers not part of the test are not affected.
+| arg list |
+|--|
+| None |
+
+#### Function: auto_clean_containers ####
+Stop and remove all containers. Containers not part of the test are not affected. This function has effect only if the test script is started with arg `auto-clean`. This intention is to use this function as the last step in an auto-test script.
+| arg list |
+|--|
+| None |
+
+#### Function: sleep_wait ####
+Make the script sleep for a number of seconds.
+| arg list |
+|--|
+| `<sleep-time-in-sec> [<any-text-in-quotes-to-be-printed>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<sleep-time-in-sec> ` | Number of seconds to sleep |
+| `<any-text-in-quotes-to-be-printed>` | Optional. The text will be printed, if present |
+
+
+
+#### Function: consul_config_app ####
+Function to load a json config from a file into consul for the Policy Agent
+
+| arg list |
+|--|
+| `<json-config-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<json-config-file>` | The path to the json file to be loaded to Consul/CBS |
+
+#### Function: prepare_consul_config ####
+Function to prepare a Consul config based on the previously configured (and started simulators). Note that all simulator must be running and the test script has to configure if http or https shall be used for the components (this is done by the functions 'use_simulator_http', 'use_simulator_https', 'use_sdnc_http', 'use_sdnc_https', 'use_mr_http', 'use_mr_https')
+| arg list |
+|--|
+| `<deviation-message-to-print>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `SDNC|SDNC_ONAP|NOSDNC` | Configure based on a1-controller (SNDC), a1-adapter (SDNC_ONAP) or without a controller/adapter (NOSDNC) |
+| `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app'  |
+
+#### Function: start_consul_cbs ####
+Start the Consul and CBS containers
+| arg list |
+|--|
+| None |
+
+#### Function: use_simulator_http ####
+Use http for all API calls (A1) toward the simulator. This is the default. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_simulator_https ####
+Use https for all API calls (A1) toward the simulator. Admin API calls to the simulator are not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_ric_simulators ####
+Start a group of simulator where a group may contain 1 more simulators.
+| arg list |
+|--|
+| `ricsim_g1|ricsim_g2|ricsim_g3 <count> <interface-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `ricsim_g1|ricsim_g2|ricsim_g3` | Base name of the simulator. Each instance will have an postfix instance id added, starting on '1'. For examplle 'ricsim_g1_1', 'ricsim_g1_2' etc  |
+|`<count>`| And integer, 1 or greater. Specifies the number of simulators to start|
+|`<interface-id>`| Shall be the interface id of the simulator. See the repo 'a1-interface' for the available ids. |
+
+#### Function: start_control_panel ####
+Start the Control Panel container
+| arg list |
+|--|
+| None |
+
+#### Function: start_sdnc ####
+Start the SDNC A1 Controller container and its database container
+| arg list |
+|--|
+| None |
+
+#### Function: use_sdnc_http ####
+Use http for all API calls towards the SDNC A1 Controller. This is the default. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_sdnc_http ####
+Use https for all API calls towards the SDNC A1 Controller. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_sdnc_onap ####
+Start the SDNC A1 Adapter container and its database container
+| arg list |
+|--|
+| None |
+
+#### Function: config_sdnc_onap ####
+Configure the SDNC A1 adapter - Not implemented
+| arg list |
+|--|
+| None |
+
+#### Function: start_mr ####
+Start the Message Router stub interface container
+| arg list |
+|--|
+| None |
+
+#### Function: use_mr_http ####
+Use http for all Dmaap calls to the MR. This is the default. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: use_mr_https ####
+Use https for all Dmaap call to the MR. The admin API is not affected. Note that this function shall be called before preparing the config for Consul.
+| arg list |
+|--|
+| None |
+
+#### Function: start_cr ####
+Start the Callback Receiver container
+| arg list |
+|--|
+| None |
+
+#### Function: start_policy_agent ####
+Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_stand_alone ####
+Configure to run the Policy Agent as a stand alone container or app. See also 'start_policy_agent'
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_rest_http ####
+Use http for all API calls to the Policy Agent. This is the default.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_rest_https ####
+Use https for all API calls to the Policy Agent.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_dmaap ####
+Send and recieve all API calls to the Policy Agent over Dmaap via the MR.
+| arg list |
+|--|
+| None |
+
+#### Function: set_agent_debug ####
+Configure the Policy Agent log on debug level. The Policy Agent must be running.
+| arg list |
+|--|
+| None |
+
+#### Function: set_agent_trace ####
+Configure the Policy Agent log on trace level. The Policy Agent must be running.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_retries ####
+Configure the Policy Agent to make upto 5 retries if an API calls return any of the specified http return codes.
+| arg list |
+|--|
+| `[<response-code>]*` |
+
+| parameter | description |
+| --------- | ----------- |
+| `[<response-code>]*` | A space separated list of http response codes, may be empty to reset to 'no codes'.  |
+
+#### Function: check_policy_agent_logs ####
+Check the Policy Agent log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+#### Function: check_control_panel_logs ####
+Check the Control Panel log for any warnings and errors and print the count of each.
+| arg list |
+|--|
+| None |
+
+#### Function: store_logs ####
+Take a snap-shot of all logs for all running containers and stores them in `./logs/<ATC-id>`. All logs will get the specified prefix in the file name. In general, one of the last steps in an auto-test script shall be to call this function. If logs shall be taken several times during a test script, different prefixes shall be used each time.
+| arg list |
+|--|
+| `<logfile-prefix>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<logfile-prefix>` | Log file prefix  |
+
 
-###Descriptions of functions in testcase_common.sh
+#### Function: cr_equal ####
+TBD
 
-`clean_containers` \
-Stop and remove all containers including Policy Agent apps and simulators
+#### Function: mr_equal ####
+TBD
 
-`start_simulators` \
-Start all simulators in the simulator group
+#### Function: mr_greater ####
+TBD
 
-`consul_config_app  ` \
-Configure consul with json file with app config for a Policy Agent instance using the Policy Agent
-instance id and the json file.
+#### Function: mr_read ####
+TBD
 
-`start_policy_agent` \
-Start the Policy Agent application.
+#### Function: mr_print ####
+TBD
 
-`check_policy_agent_logs`
-Check the Policy Agent application log for WARN and ERR messages and print the count.
-`store_logs`
-Store all Policy Agent app and simulators log to the test case log dir. All logs get a prefix to
-separate logs stored at different steps in the test script.
-If logs need to be stored in several locations, use different prefix to easily identify the location
-when the logs where taken.
+### Descriptions of functions in testsuite_common.sh ###
+TBD
+### Descriptions of functions in agent_api_function.sh ###
+TBD
+### Descriptions of functions in ricsimulator_api_functions.sh ###
+TBD
+### Descriptions of functions in controller_api_functions.sh ###
+TBD
 
 ## License
 
index 958f914..b2d6a24 100644 (file)
@@ -280,6 +280,7 @@ api_get_policies() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -316,6 +317,7 @@ api_get_policies() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -346,6 +348,7 @@ api_get_policy() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -360,6 +363,7 @@ api_get_policy() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -414,6 +418,7 @@ api_put_policy() {
                        echo " Created "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -474,6 +479,7 @@ api_put_policy_batch() {
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -496,6 +502,7 @@ api_put_policy_batch() {
                        echo " Created(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -591,6 +598,7 @@ api_put_policy_parallel() {
 
        echo -e $RED" FAIL. One of more processes failed to execute" $ERED
        ((RES_FAIL++))
+       __check_stop_at_error
        return 1
 }
 
@@ -626,6 +634,7 @@ api_delete_policy() {
                        echo " Deleted "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                let pid=$pid+1
@@ -672,6 +681,7 @@ api_delete_policy_batch() {
                        echo " Requested(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -695,6 +705,7 @@ api_delete_policy_batch() {
                        echo " Deleted(batch) "$count"?("$max")"
                        echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -772,6 +783,7 @@ api_delete_policy_parallel() {
 
        echo -e $RED" FAIL. One of more processes failed to execute" $ERED
        ((RES_FAIL++))
+       __check_stop_at_error
        return 1
 }
 
@@ -816,6 +828,7 @@ api_get_policy_ids() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -839,6 +852,7 @@ api_get_policy_ids() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -868,6 +882,7 @@ api_get_policy_schema() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -882,6 +897,7 @@ api_get_policy_schema() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -915,6 +931,7 @@ api_get_policy_schemas() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -940,6 +957,7 @@ api_get_policy_schemas() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -988,6 +1006,7 @@ api_get_policy_status() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -998,6 +1017,7 @@ api_get_policy_status() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1033,6 +1053,7 @@ api_get_policy_types() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1057,6 +1078,7 @@ api_get_policy_types() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1088,6 +1110,7 @@ api_get_status() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1120,6 +1143,7 @@ api_get_ric() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1128,6 +1152,7 @@ api_get_ric() {
                if [ "$body" != "$3" ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1163,6 +1188,7 @@ api_get_rics() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1172,6 +1198,7 @@ api_get_rics() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, could not create target ric info json"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
 
@@ -1181,6 +1208,7 @@ api_get_rics() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1217,6 +1245,7 @@ api_put_service() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1264,6 +1293,7 @@ api_get_services() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1290,6 +1320,7 @@ api_get_services() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -1319,6 +1350,7 @@ api_get_service_ids() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1338,6 +1370,7 @@ api_get_service_ids() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1366,6 +1399,7 @@ api_delete_services() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -1394,6 +1428,7 @@ api_put_services_keepalive() {
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
index c4ba71c..daab47c 100644 (file)
@@ -98,12 +98,14 @@ controller_api_get_A1_policy_ids() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -128,6 +130,7 @@ controller_api_get_A1_policy_ids() {
        if [ $res -ne 0 ]; then
                echo -e $RED" FAIL, returned body not correct"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -163,12 +166,14 @@ controller_api_get_A1_policy_type() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -184,6 +189,7 @@ controller_api_get_A1_policy_type() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
@@ -222,12 +228,14 @@ controller_api_delete_A1_policy() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -268,12 +276,14 @@ controller_api_put_A1_policy() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -325,12 +335,14 @@ controller_api_get_A1_policy_status() {
     if [ $? -ne 0 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
                ((RES_FAIL++))
+               __check_stop_at_error
                return 1
        fi
 
@@ -343,6 +355,7 @@ controller_api_get_A1_policy_status() {
                if [ $res -ne 0 ]; then
                        echo -e $RED" FAIL, returned body not correct"$ERED
                        ((RES_FAIL++))
+                       __check_stop_at_error
                        return 1
                fi
        fi
index b242db0..19a77ba 100644 (file)
@@ -23,6 +23,7 @@ import os
 import json
 import sys
 import requests
+import traceback
 
 # disable warning about unverified https requests
 from requests.packages import urllib3
@@ -61,7 +62,10 @@ try:
                     headers = {'Content-type': 'application/json'}
                     resp=requests.put(url, json.dumps(json.loads(payload)), headers=headers, verify=False, timeout=90)
                 except Exception as e1:
-                    print("1Put failed for id:"+str(i)+ ", "+str(e1))
+                    print("1Put failed for id:"+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                    sys.exit()
+                if (resp.status_code == None):
+                    print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: None")
                     sys.exit()
                 if (resp.status_code != responsecode):
                     print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
index be15e92..fe87919 100644 (file)
@@ -23,6 +23,7 @@ import os
 import json
 import sys
 import requests
+import traceback
 
 # disable warning about unverified https requests
 from requests.packages import urllib3
@@ -51,7 +52,10 @@ try:
             try:
                 resp=requests.delete(url, verify=False, timeout=90)
             except Exception as e1:
-                print("1Delete failed for id:"+str(i)+ ", "+str(e1))
+                print("1Delete failed for id:"+str(i)+ ", "+str(e1) + " "+traceback.format_exc())
+                sys.exit()
+            if (resp.status_code == None):
+                print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: None")
                 sys.exit()
             if (resp.status_code != responsecode):
                 print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
index c30af1a..f003559 100644 (file)
@@ -214,7 +214,7 @@ sim_post_forcedelay() {
        app=$2
        res=$(__find_sim_port $app)
 
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/delay"
+    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/forcedelay"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?delay="$3
        fi
index 4818bc0..4d89d0c 100755 (executable)
@@ -94,6 +94,9 @@ AUTO_CLEAN=""
 # Var to hold the app names to use local image for when running 'remote' or 'remote-remove'
 USE_LOCAL_IMAGES=""
 
+# Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
+STOP_AT_ERROR=0
+
 # Set a description string for the test case
 if [ -z "$TC_ONELINE_DESCR" ]; then
        TC_ONELINE_DESCR="<no-description>"
@@ -121,6 +124,11 @@ TESTLOGS=$PWD/logs
 HTTPLOG=$PWD"/.httplog_"$ATC".txt"
 echo "" > $HTTPLOG
 
+#Create result file (containing '1' for error) for this test case
+#Will be replaced with a file containing '0' if script is ok
+
+echo "1" > "$PWD/.result$ATC.txt"
+
 # Create a log dir for the test case
 mkdir -p $TESTLOGS/$ATC
 
@@ -179,7 +187,13 @@ if [ $paramerror -eq 0 ]; then
        fi
 fi
 if [ $paramerror -eq 0 ]; then
-       if [ "$1" == "-use-local-image" ]; then
+       if [ "$1" == "--stop-at-error" ]; then
+               STOP_AT_ERROR=1
+               shift;
+       fi
+fi
+if [ $paramerror -eq 0 ]; then
+       if [ "$1" == "--use-local-image" ]; then
                USE_LOCAL_IMAGES=${@:2}
                while [ $# -gt 0 ]; do
                        shift;
@@ -192,7 +206,7 @@ if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then
 fi
 
 if [ $paramerror -eq 1 ]; then
-       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [-use-local-image <app-nam> [<app-name>]]"$ERED
+       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--use-local-image <app-nam> [<app-name>]*]"$ERED
        exit 1
 fi
 
@@ -242,7 +256,7 @@ __check_image_var() {
 
 
 #Check if app local image shall override remote image
-check_image_local_override() {
+__check_image_local_override() {
        for im in $USE_LOCAL_IMAGES; do
                if [ "$1" == "$im" ]; then
                        return 1
@@ -252,7 +266,7 @@ check_image_local_override() {
 }
 
 #Check if app uses image excluded from this test run
-check_excluded_image() {
+__check_excluded_image() {
        for im in $EXCLUDED_IMAGES; do
                if [ "$1" == "$im" ]; then
                        return 1
@@ -280,7 +294,7 @@ if [ $START_ARG == "local" ]; then
 
 elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
 
-       check_image_local_override 'PA'
+       __check_image_local_override 'PA'
        if [ $? -eq 0 ]; then
                #Remote agent image
                __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG"
@@ -289,7 +303,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'CP'
+       __check_image_local_override 'CP'
        if [ $? -eq 0 ]; then
                #Remote Control Panel image
                __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG"
@@ -298,7 +312,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'SDNC'
+       __check_image_local_override 'SDNC'
        if [ $? -eq 0 ]; then
                #Remote SDNC image
                __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG"
@@ -307,7 +321,7 @@ elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
                __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
        fi
 
-       check_image_local_override 'RICSIM'
+       __check_image_local_override 'RICSIM'
        if [ $? -eq 0 ]; then
                #Remote ric sim image
                __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG"
@@ -329,7 +343,7 @@ __check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "C
 __check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG"
 __check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG"
 __check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG"
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        __check_image_var " SDNC ONAP A1 Adapter" $START_ARG "SDNC_ONAP_A1_ADAPTER_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG"
        __check_image_var " SDNC ONAP DB" $START_ARG "SDNC_ONAP_DB_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE_TAG"
@@ -453,21 +467,21 @@ __check_and_pull_image() {
 echo -e $BOLD"Pulling configured images, if needed"$EBOLD
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'PA'
+__check_image_local_override 'PA'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
 app="Policy Agent";             __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'CP'
+__check_image_local_override 'CP'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
 app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
 
 START_ARG_MOD=$START_ARG
-check_image_local_override 'RICSIM'
+__check_image_local_override 'RICSIM'
 if [ $? -eq 1 ]; then
        START_ARG_MOD="local"
 fi
@@ -475,10 +489,10 @@ app="Near-RT RIC Simulator";    __check_and_pull_image $START_ARG_MOD "$app" $RI
 
 app="Consul";                   __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
 app="CBS";                      __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
-check_excluded_image 'SDNC'
+__check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        START_ARG_MOD=$START_ARG
-       check_image_local_override 'SDNC'
+       __check_image_local_override 'SDNC'
        if [ $? -eq 1 ]; then
                START_ARG_MOD="local"
        fi
@@ -487,7 +501,7 @@ if [ $? -eq 0 ]; then
 else
        echo -e $YELLOW" Excluding SDNC image and related DB image from image check/pull"$EYELLOW
 fi
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        app="SDNC ONAP A1 Adapter";     __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_A1_ADAPTER_IMAGE
        app="SDNC ONAP DB";             __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_DB_IMAGE
@@ -554,12 +568,12 @@ echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)
 echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >>   $docker_tmp_file
 echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >>   $docker_tmp_file
 echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >>   $docker_tmp_file
-check_excluded_image 'SDNC'
+__check_excluded_image 'SDNC'
 if [ $? -eq 0 ]; then
        echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >>   $docker_tmp_file
 fi
-check_excluded_image 'SDNC_ONAP'
+__check_excluded_image 'SDNC_ONAP'
 if [ $? -eq 0 ]; then
        echo -e " SDNC ONAP A1 Adapter\t$(docker images --format $format_string $SDNC_ONAP_A1_ADAPTER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC ONAP DB\t$(docker images --format $format_string $SDNC_ONAP_DB_IMAGE)" >>   $docker_tmp_file
@@ -640,6 +654,8 @@ print_result() {
                if [ -f .tmp_tcsuite_pass ]; then
                        echo " - "$ATC " -- "$TC_ONELINE_DESCR"  Execution time: "$duration" seconds" >> .tmp_tcsuite_pass
                fi
+               #Create file with OK exit code
+               echo "0" > "$PWD/.result$ATC.txt"
        else
                echo -e "One or more tests with status  \033[31m\033[1mFAIL\033[0m "
                echo -e "\033[31m\033[1m  ___ _   ___ _    \033[0m"
@@ -743,6 +759,16 @@ deviation() {
        echo ""
 }
 
+# Stop at first FAIL test case and take all logs - only for debugging/trouble shooting
+__check_stop_at_error() {
+       if [ $STOP_AT_ERROR -eq 1 ]; then
+               echo -e $RED"Test script configured to stop at first FAIL, taking all logs and stops"$ERED
+               store_logs "STOP_AT_ERROR"
+               exit 1
+       fi
+       return 0
+}
+
 # Stop and remove all containers
 # args: -
 # (Function for test scripts)
@@ -817,7 +843,7 @@ auto_clean_containers() {
 }
 
 # Function to sleep a test case for a numner of seconds. Prints the optional text args as info
-# args: <sleep-time-in-sec> [any-text-in-quoteds-to-printed]
+# args: <sleep-time-in-sec> [any-text-in-quotes-to-be-printed]
 # (Function for test scripts)
 sleep_wait() {
 
@@ -1305,7 +1331,7 @@ start_sdnc() {
 
        echo -e $BOLD"Starting SDNC A1 Controller"$EBOLD
 
-       check_excluded_image 'SDNC'
+       __check_excluded_image 'SDNC'
        if [ $? -eq 1 ]; then
                echo -e $RED"The image for SDNC and the related DB has not been checked for this test run due to arg to the test script"$ERED
                echo -e $RED"SDNC will not be started"$ERED
@@ -1343,7 +1369,7 @@ start_sdnc_onap() {
 
        echo -e $BOLD"Starting SDNC ONAP A1 Adapter"$EBOLD
 
-       check_excluded_image 'SDNC_ONAP'
+       __check_excluded_image 'SDNC_ONAP'
        if [ $? -eq 1 ]; then
                echo -e $RED"The image for SDNC ONAP and the related DB has not been checked for this test run due to arg to the test script"$ERED
                echo -e $RED"SDNC ONAP will not be started"$ERED
@@ -1509,6 +1535,20 @@ set_agent_debug() {
        return 0
 }
 
+# Turn on trace level tracing in the agent
+# args: -
+# (Function for test scripts)
+set_agent_trace() {
+       echo -e $BOLD"Setting agent trace"$EBOLD
+       curl $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST  -H 'Content-Type: application/json' -d '{"configuredLevel":"trace"}' &> /dev/null
+       if [ $? -ne 0 ]; then
+               __print_err "could not set trace mode" $@
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
 # Perform curl retries when making direct call to the agent for the specified http response codes
 # Speace separated list of http response codes
 # args: [<response-code>]*
@@ -1656,7 +1696,6 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
-               #echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} within ${6} seconds ----"
                echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
                ((RES_TEST++))
                start=$SECONDS
@@ -1679,39 +1718,35 @@ __var_test() {
                        if [ $retcode -ne 0 ]; then
                                if [ $duration -gt $6 ]; then
                                        ((RES_FAIL++))
-                                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5}  not reached in ${6} seconds, result = ${result} ----"
                                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached in ${6} seconds, result = ${result}"
+                                       __check_stop_at_error
                                        return
                                fi
                        elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds ----"
                                return
                        elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
                                ((RES_PASS++))
                                echo -e " Result=${result} after ${duration} seconds${SAMELINE}"
                                echo -e $GREEN" PASS${EGREEN} - Result=${result} after ${duration} seconds"
-                               #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result}  ----"
                                return
                        else
                                if [ $duration -gt $6 ]; then
                                        ((RES_FAIL++))
                                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached in ${6} seconds, result = ${result}"
-                                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5}  not reached in ${6} seconds, result = ${result} ----"
+                                       __check_stop_at_error
                                        return
                                fi
                        fi
@@ -1722,7 +1757,6 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
-               #echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} ----"
                echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD
                ((RES_TEST++))
                if [ $checkjsonarraycount -eq 0 ]; then
@@ -1738,28 +1772,24 @@ __var_test() {
                fi
                if [ $retcode -ne 0 ]; then
                        ((RES_FAIL++))
-                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
                        echo -e $RED" FAIL ${ERED}- ${3} ${4} ${5} not reached, result = ${result}"
+                       __check_stop_at_error
                elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met"
                elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
                        ((RES_PASS++))
                        echo -e $GREEN" PASS${EGREEN} - Result=${result}"
-                       #echo -e "----  \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
                else
                        ((RES_FAIL++))
                        echo -e $RED" FAIL${ERED} - ${3} ${4} ${5} not reached, result = ${result}"
-                       #echo -e "----  \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
+                       __check_stop_at_error
                fi
        else
                echo "Wrong args to __var_test, needs five or six args: <simulator-name> <host> <variable-name> <condition-operator> <target-value> [ <timeout> ]"