aboutsummaryrefslogtreecommitdiffstats
path: root/csit
diff options
context:
space:
mode:
authorputhuparambil.aditya <aditya.puthuparambil@bell.ca>2021-09-13 18:01:11 +0100
committerputhuparambil.aditya <aditya.puthuparambil@bell.ca>2021-09-22 10:44:13 +0100
commit8d443ef01e1c85773a9c82910443199de85f24ab (patch)
tree8faefeb00fafec379a77cd0d7be458f5d908e320 /csit
parent564e5e96c4ee9a4ae9715865cf6491b4266c601f (diff)
CSIT for cps-temporal
Issue-ID: CPS-482 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: I5069bdaf36ada7d2e5092669fd58404ed0a19063
Diffstat (limited to 'csit')
-rw-r--r--csit/README.md70
-rw-r--r--csit/data/test-tree.json28
-rw-r--r--csit/data/test-tree.yang24
-rw-r--r--csit/data/update-test-tree.json1
-rw-r--r--csit/install-robotframework.sh37
-rw-r--r--csit/plans/default/setup.properties31
-rwxr-xr-xcsit/plans/default/setup.sh59
-rwxr-xr-xcsit/plans/default/teardown.sh21
-rw-r--r--csit/plans/default/testplan.txt22
-rwxr-xr-xcsit/prepare-csit.sh48
-rw-r--r--csit/pylibs.txt39
-rwxr-xr-xcsit/run-csit.sh191
-rwxr-xr-xcsit/run-project-csit.sh32
-rw-r--r--csit/tests/actuator/actuator.robot40
-rwxr-xr-xcsit/tests/cps-temporal/cps-temporal.robot103
15 files changed, 746 insertions, 0 deletions
diff --git a/csit/README.md b/csit/README.md
new file mode 100644
index 0000000..b749b1e
--- /dev/null
+++ b/csit/README.md
@@ -0,0 +1,70 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2021 Bell Canada.
+ ================================================================================
+ 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.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+## Continuous System and Integration Testing (CSIT) for CPS Temporal
+
+The directory structure:
+
+- **plans/** contains testing plans, each sub-folder represents a separate test plan, contains processed subsequently:
+ _startup.sh_ (serves docker containers startup), _testplan.txt_ (lists test-suits), _teardown.sh_ (serves docker containers stopping and images removal)
+- **scripts/** contains shell scripts used on tests executions
+- **tests/** contains test suits which are processed by folder name (relative to _tests_ folder) taken from _testplan.txt_
+
+Test suits are executed using Robots framework.
+
+### Running on local environment
+
+Prerequisites:
+- docker
+- python + pip
+- virtualenv
+
+```bash
+sudo apt install python3 python3-pip virtualenv
+```
+
+Add an alias in the ```.bashrc``` file for pip3 to be pip at the end of the file. </br>
+This file will be present on the home directory of the Ubuntu system.
+```bash
+alias pip=pip3
+```
+
+Now load the ```.bashrc``` file.
+```bash
+. .bashrc
+```
+
+The Robot framework and required python packages will be installed on first execution.
+
+Navigate to cps project directory
+```bash
+cd ~/<your_git_repo>/cps-cps-temporal
+```
+
+Build a docker image (see also [docker-compose readme](../docker-compose/README.md) ) from your cps-temporal directory:
+
+```bash
+mvn clean install -Pdocker -Dmaven.test.skip=true -Ddocker.repository.push=
+```
+
+Execute test from current cps folder:
+```bash
+./csit/run-project-csit.sh
+```
diff --git a/csit/data/test-tree.json b/csit/data/test-tree.json
new file mode 100644
index 0000000..bc9cbd7
--- /dev/null
+++ b/csit/data/test-tree.json
@@ -0,0 +1,28 @@
+{
+ "test-tree": {
+ "branch": [
+ {
+ "name": "Left",
+ "nest": {
+ "name": "Small",
+ "birds": [
+ "Sparrow",
+ "Robin",
+ "Finch"
+ ]
+ }
+ },
+ {
+ "name": "Right",
+ "nest": {
+ "name": "Big",
+ "birds": [
+ "Owl",
+ "Raven",
+ "Crow"
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/csit/data/test-tree.yang b/csit/data/test-tree.yang
new file mode 100644
index 0000000..faba8a1
--- /dev/null
+++ b/csit/data/test-tree.yang
@@ -0,0 +1,24 @@
+module test-tree {
+ yang-version 1.1;
+
+ namespace "org:onap:cps:test:test-tree";
+ prefix tree;
+ revision "2020-02-02";
+
+ container test-tree {
+ list branch {
+ key "name";
+ leaf name {
+ type string;
+ }
+ container nest {
+ leaf name {
+ type string;
+ }
+ leaf-list birds {
+ type string;
+ }
+ }
+ }
+ }
+}
diff --git a/csit/data/update-test-tree.json b/csit/data/update-test-tree.json
new file mode 100644
index 0000000..d9ce41b
--- /dev/null
+++ b/csit/data/update-test-tree.json
@@ -0,0 +1 @@
+{"nest": { "name": "Left_updated", "birds": ["bird"] } }
diff --git a/csit/install-robotframework.sh b/csit/install-robotframework.sh
new file mode 100644
index 0000000..140980c
--- /dev/null
+++ b/csit/install-robotframework.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -x
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# $1 test options (passed on to run-csit.sh as such)
+
+ROBOT_VENV=$(mktemp -d --suffix=robot_venv)
+echo "ROBOT_VENV=${ROBOT_VENV}" >> "${WORKSPACE}/env.properties"
+
+echo "Python version is: $(python3 --version)"
+
+python3 -m venv "${ROBOT_VENV}"
+source "${ROBOT_VENV}/bin/activate"
+
+set -exu
+
+# Make sure pip3 itself us up-to-date.
+python3 -m pip install --upgrade pip
+
+echo "Installing Python Requirements"
+python3 -m pip install -r ${WORKSPACE}/pylibs.txt
+python3 -m pip freeze \ No newline at end of file
diff --git a/csit/plans/default/setup.properties b/csit/plans/default/setup.properties
new file mode 100644
index 0000000..a492ebd
--- /dev/null
+++ b/csit/plans/default/setup.properties
@@ -0,0 +1,31 @@
+#
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# The CPS host according to docker-compose.yml
+CPS_HOST="localhost"
+CPS_PORT="8083"
+
+# The CPS temporal host according to docker-compose.yml
+CPS_TEMPORAL_HOST="localhost"
+CPS_TEMPORAL_PORT="8082"
+MANAGEMENT_PORT="8081"
+
+TIME_OUT=300
+INTERVAL=5
+TIME=0
diff --git a/csit/plans/default/setup.sh b/csit/plans/default/setup.sh
new file mode 100755
index 0000000..7bf0340
--- /dev/null
+++ b/csit/plans/default/setup.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# Copy docker-compose.yml and application.yml to archives
+mkdir -p $WORKSPACE/archives/docker-compose
+cp $WORKSPACE/../*.yml $WORKSPACE/archives/docker-compose
+cd $WORKSPACE/archives/docker-compose
+
+# properties file with docker-compose service properties
+source $WORKSPACE/plans/default/setup.properties
+
+# download docker-compose of a required version (1.25.0 supports configuration of version 3.7)
+curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+chmod +x docker-compose
+
+# start CPS Temporal, cps-core, timescaledb, PostgresSQL and kafka containers with docker compose
+./docker-compose up -d
+python3 --version
+# Validate CPS service initialization completed via periodic log checking for line like below:
+# org.onap.cps.temporal.Application ... Started Application in X.XXX seconds
+
+while [ "$TIME" -le "$TIME_OUT" ]; do
+ LOG_FOUND_CPS_TEMPORAL=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.temporal.Application" | egrep -c "Started Application in" )
+ LOG_FOUND_CPS=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.Application" | egrep -c "Started Application in" )
+
+ if [ "$LOG_FOUND_CPS" -gt 0 ] && [ "$LOG_FOUND_CPS_TEMPORAL" -gt 0 ]; then
+ echo "CPS Service started"
+ break;
+ fi
+
+ echo "Sleep $INTERVAL seconds before next check for CPS initialization (waiting $TIME seconds; timeout is $TIME_OUT seconds)"
+ sleep $INTERVAL
+ TIME=$((TIME + INTERVAL))
+done
+
+if [ "$TIME" -gt "$TIME_OUT" ]; then
+ echo "TIME OUT: CPS services did not start in $TIME_OUT seconds, setup failed."
+ exit 1;
+fi
+
+# Pass variables required for Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v CPS_TEMPORAL_HOST:$CPS_TEMPORAL_HOST -v CPS_TEMPORAL_PORT:$CPS_TEMPORAL_PORT -v CPS_HOST:$CPS_HOST -v CPS_PORT:$CPS_PORT -v MANAGEMENT_PORT:$MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data"
diff --git a/csit/plans/default/teardown.sh b/csit/plans/default/teardown.sh
new file mode 100755
index 0000000..a7946f0
--- /dev/null
+++ b/csit/plans/default/teardown.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+cd $WORKSPACE/archives/docker-compose
+./docker-compose down -v
diff --git a/csit/plans/default/testplan.txt b/csit/plans/default/testplan.txt
new file mode 100644
index 0000000..54d13ab
--- /dev/null
+++ b/csit/plans/default/testplan.txt
@@ -0,0 +1,22 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# Test suites are relative paths under csit/tests/.
+# Place the suites in run order.
+actuator
+cps-temporal
diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh
new file mode 100755
index 0000000..2c66911
--- /dev/null
+++ b/csit/prepare-csit.sh
@@ -0,0 +1,48 @@
+#!/bin/bash -x
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+if [ -z "$WORKSPACE" ]; then
+ export WORKSPACE=`git rev-parse --show-toplevel`
+fi
+
+TESTPLANDIR=${WORKSPACE}/${TESTPLAN}
+
+# Assume that if ROBOT_VENV is set and virtualenv with system site packages can be activated,
+# ci-management/jjb/integration/include-raw-integration-install-robotframework.sh has already
+# been executed
+
+if [ -f ${WORKSPACE}/env.properties ]; then
+ source ${WORKSPACE}/env.properties
+fi
+if [ -f ${ROBOT_VENV}/bin/activate ]; then
+ source ${ROBOT_VENV}/bin/activate
+else
+ rm -rf /tmp/ci-management
+ rm -f ${WORKSPACE}/env.properties
+ cd /tmp
+ source ${WORKSPACE}/install-robotframework.sh
+fi
+
+# install eteutils
+mkdir -p ${ROBOT_VENV}/src/onap
+rm -rf ${ROBOT_VENV}/src/onap/testsuite
+python3 -m pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre
+
+pip freeze
+
diff --git a/csit/pylibs.txt b/csit/pylibs.txt
new file mode 100644
index 0000000..7742eb0
--- /dev/null
+++ b/csit/pylibs.txt
@@ -0,0 +1,39 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+docker-py
+ipaddr
+netaddr
+netifaces
+pyhocon
+requests
+robotframework-httplibrary
+robotframework-requests
+scapy
+# Module jsonpath is needed by current AAA idmlite suite.
+jsonpath-rw
+# Module for pyangbind used by lispflowmapping project
+pyangbind
+# Module for iso8601 datetime format
+isodate
+# Module for TemplatedRequests.robot library
+jmespath
+# Module for backup-restore support library
+jsonpatch
+# odltools for extra debugging
+odltools
diff --git a/csit/run-csit.sh b/csit/run-csit.sh
new file mode 100755
index 0000000..cda8f69
--- /dev/null
+++ b/csit/run-csit.sh
@@ -0,0 +1,191 @@
+#!/bin/bash -x
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+#
+# functions
+#
+
+function on_exit(){
+ rc=$?
+ if [[ ${WORKSPACE} ]]; then
+ if [[ ${WORKDIR} ]]; then
+ rsync -av "$WORKDIR/" "$WORKSPACE/archives/$TESTPLAN"
+ fi
+ # Record list of active docker containers
+ docker ps --format "{{.Image}}" > "$WORKSPACE/archives/$TESTPLAN/_docker-images.log"
+
+ # show memory consumption after all docker instances initialized
+ docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-2-after-robot.txt"
+ fi
+ # Run teardown script plan if it exists
+ cd "${TESTPLANDIR}"
+ TEARDOWN="${TESTPLANDIR}/teardown.sh"
+ if [ -f "${TEARDOWN}" ]; then
+ echo "Running teardown script ${TEARDOWN}"
+ source_safely "${TEARDOWN}"
+ fi
+ # TODO: do something with the output
+ exit $rc
+}
+# ensure that teardown and other finalizing steps are always executed
+trap on_exit EXIT
+
+function docker_stats(){
+ #General memory details
+ echo "> top -bn1 | head -3"
+ top -bn1 | head -3
+ echo
+
+ echo "> free -h"
+ free -h
+ echo
+
+ #Memory details per Docker
+ echo "> docker ps"
+ docker ps
+ echo
+
+ echo "> docker stats --no-stream"
+ docker stats --no-stream
+ echo
+}
+
+# save current set options
+function save_set() {
+ RUN_CSIT_SAVE_SET="$-"
+ RUN_CSIT_SHELLOPTS="$SHELLOPTS"
+}
+
+# load the saved set options
+function load_set() {
+ _setopts="$-"
+
+ # bash shellopts
+ for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do
+ set +o ${i}
+ done
+ for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do
+ set -o ${i}
+ done
+
+ # other options
+ for i in $(echo "$_setopts" | sed 's/./& /g') ; do
+ set +${i}
+ done
+ set -${RUN_CSIT_SAVE_SET}
+}
+
+# set options for quick bailout when error
+function harden_set() {
+ set -xeo pipefail
+ set +u # enabled it would probably fail too many often
+}
+
+# relax set options so the sourced file will not fail
+# the responsibility is shifted to the sourced file...
+function relax_set() {
+ set +e
+ set +o pipefail
+}
+
+# wrapper for sourcing a file
+function source_safely() {
+ [ -z "$1" ] && return 1
+ relax_set
+ . "$1"
+ load_set
+}
+
+#
+# main
+#
+
+# set and save options for quick failure
+harden_set && save_set
+
+if [ $# -eq 0 ]
+then
+ echo
+ echo "Usage: $0 plans/<project>/<functionality> [<robot-options>]"
+ echo
+ echo " <project>, <functionality>, <robot-options>: "
+ echo " The same values as for the '{project}-csit-{functionality}' JJB job template."
+ echo
+ exit 1
+fi
+
+if [ -z "$WORKSPACE" ]; then
+ export WORKSPACE=$(git rev-parse --show-toplevel)
+fi
+
+if [ -f "${WORKSPACE}/${1}/testplan.txt" ]; then
+ export TESTPLAN="${1}"
+else
+ echo "testplan not found: ${WORKSPACE}/${TESTPLAN}/testplan.txt"
+ exit 2
+fi
+
+export TESTOPTIONS="${2}"
+
+rm -rf "$WORKSPACE/archives/$TESTPLAN"
+mkdir -p "$WORKSPACE/archives/$TESTPLAN"
+
+TESTPLANDIR="${WORKSPACE}/${TESTPLAN}"
+
+# Run installation of prerequired libraries
+source_safely "${WORKSPACE}/prepare-csit.sh"
+
+# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh
+source_safely "${ROBOT_VENV}/bin/activate"
+
+WORKDIR=$(mktemp -d --suffix=-robot-workdir)
+cd "${WORKDIR}"
+
+# Add csit scripts to PATH
+export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin"
+export SCRIPTS="${WORKSPACE}/scripts"
+export ROBOT_VARIABLES=
+
+# Run setup script plan if it exists
+cd "${TESTPLANDIR}"
+SETUP="${TESTPLANDIR}/setup.sh"
+if [ -f "${SETUP}" ]; then
+ echo "Running setup script ${SETUP}"
+ source_safely "${SETUP}"
+fi
+
+# show memory consumption after all docker instances initialized
+docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-1-after-setup.txt"
+
+# Run test plan
+cd "$WORKDIR"
+echo "Reading the testplan:"
+cat "${TESTPLANDIR}/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${WORKSPACE}/tests/|" > testplan.txt
+cat testplan.txt
+SUITES=$( xargs -a testplan.txt )
+
+echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
+echo "Starting Robot test suites ${SUITES} ..."
+relax_set
+python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
+RESULT=$?
+load_set
+echo "RESULT: $RESULT"
+# Note that the final steps are done in on_exit function after this exit!
+exit $RESULT
diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh
new file mode 100755
index 0000000..51e375c
--- /dev/null
+++ b/csit/run-project-csit.sh
@@ -0,0 +1,32 @@
+#!/bin/bash -x
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+export TESTOPTIONS=${1}
+export WORKSPACE=$(git rev-parse --show-toplevel)/csit
+
+rm -rf ${WORKSPACE}/archives
+mkdir -p ${WORKSPACE}/archives
+cd ${WORKSPACE}
+
+# Execute all test-suites defined under plans subdirectory
+for dir in plans/*/
+do
+ dir=${dir%*/} # remove the trailing /
+ ./run-csit.sh ${dir} ${TESTOPTIONS}
+done
diff --git a/csit/tests/actuator/actuator.robot b/csit/tests/actuator/actuator.robot
new file mode 100644
index 0000000..4da25fd
--- /dev/null
+++ b/csit/tests/actuator/actuator.robot
@@ -0,0 +1,40 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+*** Settings ***
+Documentation CPS Temporal - Actuator endpoints
+
+Library Collections
+Library RequestsLibrary
+
+Suite Setup Create Session MANAGEMENT_URL http://${CPS_TEMPORAL_HOST}:${MANAGEMENT_PORT}/manage
+
+*** Test Cases ***
+Test Liveness Probe Endpoint
+ ${response}= GET On Session MANAGEMENT_URL health/liveness expected_status=200
+ Should Be Equal As Strings ${response.json()['status']} UP
+
+Test Readiness Probe Endpoint
+ ${response}= GET On Session MANAGEMENT_URL health/readiness expected_status=200
+ Should Be Equal As Strings ${response.json()['status']} UP
+
+Test Info Endpoint
+ ${response}= GET On Session MANAGEMENT_URL info expected_status=200
+
+Test prometheus Endpoint
+ ${response}= GET On Session MANAGEMENT_URL prometheus expected_status=200
diff --git a/csit/tests/cps-temporal/cps-temporal.robot b/csit/tests/cps-temporal/cps-temporal.robot
new file mode 100755
index 0000000..d7e63bd
--- /dev/null
+++ b/csit/tests/cps-temporal/cps-temporal.robot
@@ -0,0 +1,103 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 Bell Canada.
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+*** Settings ***
+Documentation CPS Temporal REST API
+
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+
+Suite Setup Create Session CPS_CORE_URL http://${CPS_HOST}:${CPS_PORT}
+
+*** Variables ***
+
+${cps_core_auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE=
+${cps_core_basePath} /cps/api
+${cps_temporal_auth} Basic Y3BzdGVtcG9yYWw6Y3BzdGVtcG9yYWw=
+${cps_temporal_basePath} /cps-temporal/api
+${dataspaceName} CSIT-Dataspace
+${schemaSetName} CSIT-SchemaSet
+${anchorName} CSIT-Anchor
+${observedTimestampCreation} 2021-03-21T00:00:00.000+0000
+${observedTimestampUpdate} 2021-05-21T00:00:00.000+0000
+
+
+*** Test Cases ***
+Create Dataspace
+ ${uri}= Set Variable ${cps_core_basePath}/v1/dataspaces
+ ${params}= Create Dictionary dataspace-name=${dataspaceName}
+ ${headers}= Create Dictionary Authorization=${cps_core_auth}
+ ${response}= POST On Session CPS_CORE_URL ${uri} params=${params} headers=${headers}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Create Schema Set from YANG file
+ ${uri}= Set Variable ${cps_core_basePath}/v1/dataspaces/${dataspaceName}/schema-sets
+ ${params}= Create Dictionary schema-set-name=${schemaSetName}
+ ${fileData}= Get Binary File ${DATADIR}${/}test-tree.yang
+ ${fileTuple}= Create List test.yang ${fileData} application/zip
+ &{files}= Create Dictionary file=${fileTuple}
+ ${headers}= Create Dictionary Authorization=${cps_core_auth}
+ ${response}= POST On Session CPS_CORE_URL ${uri} files=${files} params=${params} headers=${headers}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Create Anchor
+ ${uri}= Set Variable ${cps_core_basePath}/v1/dataspaces/${dataspaceName}/anchors
+ ${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName}
+ ${headers}= Create Dictionary Authorization=${cps_core_auth}
+ ${response}= POST On Session CPS_CORE_URL ${uri} params=${params} headers=${headers}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Create Data Node
+ ${uri}= Set Variable ${cps_core_basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes
+ ${headers} Create Dictionary Content-Type=application/json accept=text/plain Authorization=${cps_core_auth}
+ ${params}= Create Dictionary observed-timestamp=${observedTimestampCreation}
+ ${jsonData}= Get Binary File ${DATADIR}${/}test-tree.json
+ ${response}= POST On Session CPS_CORE_URL ${uri} params=${params} headers=${headers} data=${jsonData}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Get Anchor History by dataspace and anchor name when Data node is created
+ Create Session CPS_TEMPORAL_URL http://${CPS_TEMPORAL_HOST}:${CPS_TEMPORAL_PORT}
+ ${uri}= Set Variable ${cps_temporal_basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/history
+ ${headers}= Create Dictionary Authorization=${cps_temporal_auth}
+ ${response}= Get On Session CPS_TEMPORAL_URL ${uri} headers=${headers} expected_status=200
+ ${responseJson}= Set Variable ${response.json()}
+ Should Be Equal As Strings ${response.status_code} 200
+ Length Should Be ${responseJson['records']} 1
+ Should Be Equal As Strings ${responseJson['records'][0]['observedTimestamp']} ${observedTimestampCreation}
+ Should Not Be Equal As Strings ${responseJson['records'][0]['observedTimestamp']} ${observedTimestampUpdate}
+
+Update Data Node
+ ${uri}= Set Variable ${cps_core_basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes
+ ${headers} Create Dictionary Content-Type=application/json Authorization=${cps_core_auth}
+ ${params}= Create Dictionary xpath=/test-tree/branch[@name='Left'] observed-timestamp=${observedTimestampUpdate}
+ ${jsonData}= Get Binary File ${DATADIR}${/}update-test-tree.json
+ ${response}= PATCH On Session CPS_CORE_URL ${uri} params=${params} headers=${headers} data=${jsonData}
+ Should Be Equal As Strings ${response.status_code} 200
+
+Get Anchor History by dataspace and anchor name with updated data node
+ Create Session CPS_TEMPORAL_URL http://${CPS_TEMPORAL_HOST}:${CPS_TEMPORAL_PORT}
+ ${uri}= Set Variable ${cps_temporal_basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/history
+ ${headers}= Create Dictionary Authorization=${cps_temporal_auth}
+ ${params}= Create Dictionary sort=observed-timestamp:desc
+ ${response}= Get On Session CPS_TEMPORAL_URL ${uri} headers=${headers} expected_status=200
+ ${responseJson}= Set Variable ${response.json()}
+ Should Be Equal As Strings ${response.status_code} 200
+ Length Should Be ${responseJson['records']} 2
+ Should Be Equal As Strings ${responseJson['records'][1]['observedTimestamp']} ${observedTimestampCreation}
+ Should Be Equal As Strings ${responseJson['records'][0]['observedTimestamp']} ${observedTimestampUpdate}