--- /dev/null
+##############################################################################
+# Copyright (c) 2019 AT&T, ENEA AB, Nokia and others #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); #
+# you maynot 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. #
+##############################################################################
+
+# ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds
+
+FROM ubuntu:xenial as build
+ENV DIRPATH /workspace
+WORKDIR $DIRPATH
+# Dependency for kafka pip package; needed for aarch64 image
+RUN apt update && apt install -y curl make build-essential
+RUN curl -L https://github.com/edenhill/librdkafka/archive/v0.11.6.tar.gz | \
+ tar xzf - \
+ && cd librdkafka-0.11.6/ \
+ && ./configure --prefix=/usr \
+ && make -j
+RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg > key.gpg
+
+FROM ubuntu:xenial
+ENV DIRPATH /workspace
+WORKDIR $DIRPATH
+
+# Preferred Kubernetes versions 1.13 for IEC Type 2
+ARG KUBE_VERSION=1.13.0-00
+ARG TEST_USER=ubuntu
+
+COPY --from=build $DIRPATH/librdkafka-0.11.6 librdkafka-0.11.6
+COPY --from=build $DIRPATH/key.gpg key.gpg
+RUN apt-key add key.gpg
+
+# Install packages required by cord-tester
+RUN echo "deb http://packages.cloud.google.com/apt kubernetes-xenial main" >\
+ /etc/apt/sources.list.d/kubernetes.list
+RUN apt update && apt install -y lsb-release openssh-server sudo \
+ python python-pip python-dev \
+ git make libffi-dev libssl-dev libpq-dev \
+ kubectl=$KUBE_VERSION
+
+RUN make -C librdkafka-0.11.6 install && rm -rf librdkafka-0.11.6
+
+RUN pip install virtualenv
+RUN apt-mark hold kubectl && apt autoremove -y \
+ && rm -rf /var/lib/apt/lists/*
+RUN useradd -m -s /bin/bash --system -G sudo \
+ -p $(openssl passwd -1 $TEST_USER) $TEST_USER
+RUN echo "ubuntu\tALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/90-docker-users
+USER $TEST_USER
--- /dev/null
+#!/usr/bin/env bash
+
+# This script builds the cord-tester multi-arch docker image.
+# The main purpose of this image is to run the cord-tester tests, i.e. SIAB.
+# The existing image in iecedge/cord-tester:arm64 also contains the amd64
+# version and specifies a manifest for proper multi-arch.
+set -o errexit
+set -o xtrace
+
+docker build -f Dockerfile.cord-tester -t iecedge/cord-tester:arm64 .
--- /dev/null
+#!/usr/bin/env bash
+
+# This script can be used to build the cord-tester xos-api-tester docker image
+set -o errexit
+set -o xtrace
+
+#cd $CORD-TESTER_PATH
+
+cd src/test/cord-api/
+docker build -f Dockerfile.k8s-api-tester \
+ -t iecedge/xos-api-tester_arm64:master .
+++ /dev/null
-#!/usr/bin/env bash
-
-# This script builds the cord-tester docker image
-set -o errexit
-set -o xtrace
-
-#cd $CORD-TESTER_PATH
-
-#building cord-tester docker image
-cd src/test/cord-api/
-docker build -f Dockerfile.k8s-api-tester -t iecedge/xos-api-tester_arm64:master .
Each folder/testing method should contain an install.sh and test.sh scripts
respectively.
+
+The testing phase consists of two steps:
+1. Installing the PON software (for now either bbsim or ponsim). This can be
+done by running the corresponding install.sh directly on the K8S master.
+
+2. Running the actual SIAB tests. In upstream opencord.org the SIAB tests are
+run on a single machine (hence the term SEBA-in-a-Box), directly on the
+machine. In contrast, the iec project aims to be able to run the SIAB tests
+from a different machine, in order to not pollute the environment with
+testing framework. To achieve this, it is also necessary to create a running
+environment and this is done using a simple Docker container which contains
+all the necessary tools for running cord-tester SIAB tests. Take a look at
+src/usecases/seba_on_arm/docker/build/cord-tester/build-cord-tester.arm
+script for details on this image.
+Note that for runing test.sh, it is necessary to obtain the Kubernetes config
+(e.g. /root/.kube/) and place it in a convenient location. This will then be
+passed to the docker container. Of course, the container must also have
+access to the Kubernetes cluster.
--- /dev/null
+#!/bin/bash
+
+set -ex
+
+CORD_REPO="${CORD_REPO:-https://github.com/opencord/cord-tester.git}"
+CORD_REV="cord-6.1"
+VOLTHA_REPO="${VOLTHA_REPO:-https://github.com/opencord/voltha.git}"
+VOLTHA_REV="master"
+K8S_MASTER_IP="${K8S_MASTER_IP:-127.0.0.1}"
+KUBE_DIR="${KUBE_DIR:-/workspace/.kube}"
+USER="${USER:-ubuntu}"
+
+# The ssh server must be running since cord-tester tries to connect
+# to localhost
+sudo /etc/init.d/ssh restart
+cd "${HOME}"
+sudo cp -r "${KUBE_DIR}" .kube
+sudo chown -R "$(id -u)":"$(id -g)" .kube
+
+git clone "${CORD_REPO}" cord-tester -b "${CORD_REV}"
+git clone "${VOLTHA_REPO}" voltha -b "${VOLTHA_REV}"
+
+cd cord-tester/src/test/cord-api
+./setup_venv.sh
+# shellcheck disable=SC1091
+source venv-cord-tester/bin/activate
+# As per documentation, we set the SERVER_IP before anything
+sed -i "s/SERVER_IP.*=.*'/SERVER_IP = '${K8S_MASTER_IP}'/g" \
+ Properties/RestApiProperties.py
+cd Tests/WorkflowValidations/
+
+export SERVER_IP="${K8S_MASTER_IP}"
+
+robot -v ONU_STATE_VAR:onu_state --removekeywords wuks -e notready \
+ -i stable -v "VOLTHA_DIR:${HOME}/voltha" SIAB.robot
--- /dev/null
+#!/bin/bash
+# shellcheck disable=SC2016
+
+set -ex
+
+basepath=$(cd "$(dirname "$0")"; pwd)
+
+CORD_IMG="${CORD_IMG:-iecedge/cord-tester:latest}"
+KUBE_DIR="${KUBE_DIR:-${PWD}/.kube}"
+K8S_MASTER_IP="${K8S_MASTER_IP:-127.0.0.1}"
+TEST_USER="${TEST_USER:-ubuntu}"
+
+cont_id=
+trap f_clean INT EXIT
+
+f_clean(){
+ echo "Cleaning up after ${cont_id}"
+ docker kill "${cont_id}"
+ docker rm "${cont_id}"
+}
+
+if ! [ -d "${KUBE_DIR}" ]
+then
+ echo ".kube dir ${KUBE_DIR} does not exist"
+ exit 1
+fi
+
+docker pull "${CORD_IMG}"
+DOCKER_CMD="docker run -id -e K8S_MASTER_IP=${K8S_MASTER_IP} \
+ -e USER=${TEST_USER} \
+ -v ${basepath}/docker_run.sh:/workspace/docker_run.sh \
+ -v ${KUBE_DIR}:/workspace/.kube \
+ ${CORD_IMG} /bin/bash"
+if cont_id=$(eval "${DOCKER_CMD}")
+then
+ echo "Starting SIAB.robot in ${cont_id}"
+ docker exec "${cont_id}" /workspace/docker_run.sh
+else
+ echo "Failed to execute docker command ${cont_id}"
+ exit 1
+fi
+