-# Copyright 2020 ETSI
-#
# 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
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM ubuntu:18.04
-
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git software-properties-common \
- make python3 debhelper python3-setuptools python3-pip apt-utils ssh iputils-ping libcurl4-openssl-dev libssl-dev \
- python3-openstackclient
-RUN add-apt-repository -y ppa:rmescandon/yq && apt update && apt install yq -y
-RUN python3 -m pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary \
- robotframework-sshlibrary charm-tools git+https://osm.etsi.org/gerrit/osm/IM.git git+https://osm.etsi.org/gerrit/osm/osmclient.git
-WORKDIR /robot-systest
-RUN git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git --recurse-submodules /robot-systest/osm-packages
-COPY robot-systest /robot-systest
-COPY charm.sh /usr/sbin/charm
-
-# Folder where Robot tests are stored
-ENV ROBOT_DEVOPS_FOLDER=/robot-systest
-
-# Folder to save alternative DUT environments (optional)
-ENV ENVIRONMENTS_FOLDER=environments
-
-# Folder where all required packages are stored
-ENV PACKAGES_FOLDER=/robot-systest/osm-packages
-
-# Folder where test results should be exported
-ENV ROBOT_REPORT_FOLDER=/robot-systest/results
+# This Dockerfile is intented for devops and deb package generation
+#
+# Use Dockerfile.local for running osm/NBI in a docker container from source
+# Use Dockerfile.fromdeb for running osm/NBI in a docker container from last stable package
-# Kubeconfig file
-ENV K8S_CREDENTIALS=/root/.kube/config
-ENV LC_ALL=C.UTF-8
-ENV LANG=C.UTF-8
+FROM ubuntu:16.04
-ENTRYPOINT [ "/robot-systest/run_test.sh"]
+RUN apt-get update && apt-get -y install git make libcurl4-gnutls-dev \
+ libgnutls-dev debhelper apt-utils dh-make
1. Docker container creation:
```bash
-docker build -t osmtests .
+docker build -f docker/Dockerfile -t osmtests .
```
Options:
--- /dev/null
+#!/bin/bash
+# Copyright 2020 ETSI
+# 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.
+
+
+PKG_DIRECTORIES="robot-systest"
+PKG_FILES="CONTRIBUTING.md LICENSE README.md charm.sh"
+MDG_NAME=tests
+DEB_INSTALL=debian/osm-${MDG_NAME}.install
+export DEBEMAIL="gerardo.garciadeblas@telefonica.com"
+export DEBFULLNAME="Gerardo Garcia"
+
+PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
+PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
+PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
+PKG_VERSION_HASH=$(git describe --match "v*" --tags | awk '{print $3}' FS=-)
+if [ "$PKG_VERSION_POST" -eq 0 ]; then
+ PKG_DIR="deb_dist/osm-${MDG_NAME}-${PKG_VERSION_PREFIX}"
+else
+ PKG_DIR="deb_dist/osm-${MDG_NAME}-$PKG_VERSION_PREFIX.post${PKG_VERSION_POST}+${PKG_VERSION_HASH}"
+fi
+
+rm -rf $PKG_DIR
+rm -f *.orig.tar.xz
+rm -f *.deb
+rm -f $DEB_INSTALL
+mkdir -p $PKG_DIR
+
+for dir in $PKG_DIRECTORIES; do
+ ln -s $PWD/$dir $PKG_DIR/.
+ echo "$dir/* usr/share/osm-$MDG_NAME/$dir" >> $DEB_INSTALL
+done
+for f in $PKG_FILES; do
+ cp $f $PKG_DIR/.
+ echo "$f usr/share/osm-$MDG_NAME" >> $DEB_INSTALL
+done
+cp -R debian $PKG_DIR/.
+
+pushd $PKG_DIR
+dh_make -y --indep --createorig --a -c apache
+dpkg-buildpackage -uc -us -tc -rfakeroot
+popd
--- /dev/null
+##
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: OSM_TECH@list.etsi.org
+##
+Source: osm-tests
+Section: devel
+Priority: optional
+Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
+Build-Depends: debhelper (>=9)
+Standards-Version: 3.9.6
+Homepage: http://osm.etsi.org
+
+Package: osm-tests
+Architecture: all
+Depends: ${misc:Depends}
+Description: Open Source MANO Next Generation UI based on Angular
+
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+MDG=tests
+
+rm -rf pool
+rm -rf dists
+mkdir -p pool/$MDG
+mv deb_dist/*.deb pool/$MDG/
+
+mkdir -p dists/unstable/$MDG/binary-amd64/
+apt-ftparchive packages pool/$MDG > dists/unstable/$MDG/binary-amd64/Packages
+gzip -9fk dists/unstable/$MDG/binary-amd64/Packages
+
echo "ARCHIVE"
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+./build-debpkg.sh
echo "BUILD"
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+# python3 -m rflint testsuites
echo "TEST"
--- /dev/null
+# Copyright 2020 ETSI
+#
+# 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.
+
+# Author: Felipe Vicens (felipe.vicens@atos.net) ATOS
+
+FROM ubuntu:18.04
+
+# Installing robot dependencies
+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install git software-properties-common \
+ make python3 debhelper python3-setuptools python3-pip apt-utils ssh iputils-ping libcurl4-openssl-dev libssl-dev \
+ python3-openstackclient
+
+RUN add-apt-repository -y ppa:rmescandon/yq && apt update && apt install yq -y
+
+RUN python3 -m pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary \
+ robotframework-sshlibrary charm-tools git+https://osm.etsi.org/gerrit/osm/IM.git git+https://osm.etsi.org/gerrit/osm/osmclient.git
+
+# Preparing working environment
+WORKDIR /robot-systest
+RUN git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git --recurse-submodules /robot-systest/osm-packages
+
+# Copy robot folder and charm.sh
+COPY robot-systest /robot-systest
+COPY charm.sh /usr/sbin/charm
+
+# Folder where Robot tests are stored
+ENV ROBOT_DEVOPS_FOLDER=/robot-systest
+
+# Folder to save alternative DUT environments (optional)
+ENV ENVIRONMENTS_FOLDER=environments
+
+# Folder where all required packages are stored
+ENV PACKAGES_FOLDER=/robot-systest/osm-packages
+
+# Folder where test results should be exported
+ENV ROBOT_REPORT_FOLDER=/robot-systest/reports
+
+# Kubeconfig file
+ENV K8S_CREDENTIALS=/root/.kube/config
+
+ENV LC_ALL=C.UTF-8
+ENV LANG=C.UTF-8
+
+ENTRYPOINT [ "/robot-systest/run_test.sh"]
from pathlib import Path
# Prometheus host and port
-prometheus_host = os.environ.get("OSM_HOSTNAME")
-prometheus_port = "9091"
+if os.environ.get("PROMETHEUS_HOSTNAME", False):
+ prometheus_host = os.environ.get("PROMETHEUS_HOSTNAME")
+ prometheus_port = "9090"
+else:
+ prometheus_host = os.environ.get("OSM_HOSTNAME")
+ prometheus_port = "9091"
# VIM Configuration
vim_account_type = "openstack"
git checkout ${PACKAGES})
}
+create_vim(){
+ echo -e "\nCreating VIM ${VIM_TARGET}"
+ osm vim-create --name ${VIM_TARGET} --user ${OS_USERNAME} --password ${OS_PASSWORD} --tenant ${OS_PROJECT_NAME} \
+ --auth_url ${OS_AUTH_URL} --account_type openstack --description vim \
+ --config "{management_network_name: ${VIM_MGMT_NET}}" || true
+}
+
PARAMS=""
while (( "$#" )); do
shift 2
;;
-o|--osmclientversion)
- OSMCLIENT=$2 install_osmclient
+ OSMCLIENT=$2 && install_osmclient
shift 2
;;
+ -c|--createvim)
+ create_vim
+ shift 1
+ ;;
-h|--help)
echo "OSM TESTS TOOL
-o <osmclient_version> \\
-p <package_branch> \\
-t <testing_tags>
-
+
Options:
--env-file: It is the environmental file where is described the OSM target and VIM
-o <osmclient_version> [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest
-p <package_branch> [OPTIONAL]: OSM packages repository branch. Default: master
-t <testing_tags> [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity
+ -c To create a VIM for the tests
Volumes:
<path_to_reports> [OPTIONAL]: It is the absolute path to reports location in the host
eval set -- "$PARAMS"
-if [[ -z $TEST ]]; then
+if [[ -n "$BRANCH_NAME" ]]; then
+ PACKAGES=$BRANCH_NAME && download_packages
+ OSMCLIENT=$BRANCH_NAME && install_osmclient
+fi
+
+if [[ -z "${TEST}" ]]; then
printf "Test not provided. \nRunning default test: sanity\n"
TEST="sanity"
fi
-
-if [[ -n "$TEST" ]]; then
+if [[ -n "${TEST}" ]]; then
robot -d ${ROBOT_DEVOPS_FOLDER}/reports -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/
exit 0
else