# 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
+FROM ubuntu:bionic
ENV DIRPATH /workspace
WORKDIR $DIRPATH
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 apt update && apt install -y lsb-release openssh-server sudo curl \
+ python-pip virtualenv python3-dev \
+ git libffi-dev libssl-dev libpq-dev
+
+# For now still using old Kubernetes from Xenial to map with IEC version
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 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg > key.gpg
+RUN apt-key add key.gpg
+RUN apt update && apt install kubectl=$KUBE_VERSION
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
+RUN groupadd -r $TEST_USER && useradd -m -s /bin/bash -g $TEST_USER \
+ --system -G sudo -p $(openssl passwd -1 $TEST_USER) $TEST_USER
+RUN echo "$TEST_USER\tALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/90-docker-users
USER $TEST_USER
#!/usr/bin/env bash
+##############################################################################
+# Copyright (c) 2020 ENEA and others.
+# valentin.radulescu@enea.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
# 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.
set -o errexit
set -o xtrace
-docker build -f Dockerfile.cord-tester -t iecedge/cord-tester:arm64 .
+docker build -f Dockerfile.cord-tester -t iecedge/cord-tester:cord-7.0-arm64 .
--- /dev/null
+#!/usr/bin/env bash
+##############################################################################
+# Copyright (c) 2020 ENEA and others.
+# valentin.radulescu@enea.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+# 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:cord-7.0-amd64 .
#!/bin/bash
+##############################################################################
+# Copyright (c) 2020 Akraino IEC Team.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
set -ex
-CORD_REPO="${CORD_REPO:-https://github.com/opencord/cord-tester.git}"
-CORD_REV="cord-6.1"
+CORD_REPO="${CORD_REPO:-https://github.com/iecedge/cord-tester.git}"
+CORD_REV="cord-7.0-arm64"
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
+# The ssh server must be running since cord-tester does ssh to localhost
+sudo apt-get update
+sudo apt-get install httpie -y
+sudo apt-get install jq -y
sudo /etc/init.d/ssh restart
+ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa 2>/dev/null <<< y >/dev/null
+cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
+# Make sure ssh localhost works with no interruption
+ssh-keyscan -H localhost >> ~/.ssh/known_hosts
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
+cd cord-tester/
+make venv_cord
+pwd
# shellcheck disable=SC1091
-source venv-cord-tester/bin/activate
+source venv_cord/bin/activate
+cd src/test/cord-api
# As per documentation, we set the SERVER_IP before anything
sed -i "s/SERVER_IP.*=.*'/SERVER_IP = '${K8S_MASTER_IP}'/g" \
Properties/RestApiProperties.py
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
+TESTTAGS="stable"
+PYBOT_ARGS="-v SUBSCRIBER_FILENAME:SIABSubscriberLatest -v WHITELIST_FILENAME:SIABWhitelistLatest -v OLT_DEVICE_FILENAME:SIABOLT0Device"
+robot ${PYBOT_ARGS} --removekeywords wuks -e notready -i ${TESTTAGS} -v VOLTHA_DIR:${HOME}/voltha SIAB.robot
#!/bin/bash
-# shellcheck disable=SC2016
+##############################################################################
+# Copyright (c) 2020 Akraino IEC Team.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
set -ex
basepath=$(cd "$(dirname "$0")"; pwd)
-CORD_IMG="${CORD_IMG:-iecedge/cord-tester:latest}"
+CORD_IMG="${CORD_IMG:-iecedge/cord-tester:cord-7.0}"
KUBE_DIR="${KUBE_DIR:-${PWD}/.kube}"
K8S_MASTER_IP="${K8S_MASTER_IP:-127.0.0.1}"
TEST_USER="${TEST_USER:-ubuntu}"
if cont_id=$(eval "${DOCKER_CMD}")
then
echo "Starting SIAB.robot in ${cont_id}"
- docker exec "${cont_id}" /workspace/docker_run.sh
+ docker exec "${cont_id}" sudo cp /workspace/docker_run.sh \
+ "/home/${TEST_USER}/docker_run.sh"
+ docker exec "${cont_id}" sudo chown "${TEST_USER}:${TEST_USER}" \
+ "/home/${TEST_USER}/docker_run.sh"
+ docker exec "${cont_id}" "/home/${TEST_USER}/docker_run.sh"
else
echo "Failed to execute docker command ${cont_id}"
exit 1