aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile1
-rw-r--r--qtip/ansible_library/plugins/action/calculate.py7
-rw-r--r--resources/ansible_roles/qtip/tasks/calculate.yml11
-rw-r--r--tests/ci/run_ci.sh91
-rw-r--r--tests/integration/cleanup-deploy.sh21
-rw-r--r--tests/integration/validate-deploy.sh62
-rw-r--r--tests/integration/validate-setup.sh24
7 files changed, 103 insertions, 114 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 16e552f1..027fd74a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && apt-get install -y \
python-pip \
python-setuptools \
rsync \
+ iputils-ping \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
diff --git a/qtip/ansible_library/plugins/action/calculate.py b/qtip/ansible_library/plugins/action/calculate.py
index ee3b8e3a..8d5fa1f7 100644
--- a/qtip/ansible_library/plugins/action/calculate.py
+++ b/qtip/ansible_library/plugins/action/calculate.py
@@ -10,6 +10,7 @@
##############################################################################
import humanfriendly
+import json
import numbers
from numpy import mean
import yaml
@@ -37,7 +38,11 @@ class ActionModule(ActionBase):
with open(self._task.args.get('spec')) as stream:
spec = yaml.safe_load(stream)
- metrics = self._task.args.get('metrics')
+ metrics_files = self._task.args.get('metrics')
+ metrics = {}
+ for metric, filename in metrics_files.items():
+ with open(filename) as f:
+ metrics[metric] = json.load(f)
dest = self._task.args.get('dest')
return calc_qpi(spec, metrics, dest=dest)
diff --git a/resources/ansible_roles/qtip/tasks/calculate.yml b/resources/ansible_roles/qtip/tasks/calculate.yml
index e4107e4d..62779c73 100644
--- a/resources/ansible_roles/qtip/tasks/calculate.yml
+++ b/resources/ansible_roles/qtip/tasks/calculate.yml
@@ -12,12 +12,11 @@
- name: calculate compute score
calculate:
metrics:
- ssl_rsa: "{{ ssl_rsa_metrics }}"
- ssl_aes: "{{ ssl_aes_metrics }}"
- dpi_throughput: "{{ dpi_metrics }}"
- intmem: "{{ intmem_metrics }}"
- floatmem: "{{ floatmem_metrics }}"
+ ssl_rsa: "{{ qtip_results }}/ssl/rsa-metrics.json"
+ ssl_aes: "{{ qtip_results }}/ssl/aes-metrics.json"
+ dpi_throughput: "{{ qtip_results }}/dpi/metrics.json"
+ intmem: "{{ qtip_results }}/memory/integer-metrics.json"
+ floatmem: "{{ qtip_results }}/memory/float-metrics.json"
spec: "{{ qtip_resources }}/QPI/compute.yaml"
dest: "{{ qtip_results }}/compute.json"
- register: qpi_result
delegate_to: localhost
diff --git a/tests/ci/run_ci.sh b/tests/ci/run_ci.sh
new file mode 100644
index 00000000..c26ff58c
--- /dev/null
+++ b/tests/ci/run_ci.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 ZTE and others.
+# 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 -e
+
+usage(){
+ echo "usage: $0 -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario>" >&2
+}
+
+verify_connectivity(){
+ local ip=$1
+ echo "Verifying connectivity to $ip..."
+ for i in $(seq 0 10); do
+ if ping -c 1 -W 1 $ip > /dev/null; then
+ echo "$ip is reachable!"
+ return 0
+ fi
+ sleep 1
+ done
+ error "Can not talk to $ip."
+}
+
+#Getoptions
+while getopts ":t:i:p:s:he" optchar; do
+ case "${optchar}" in
+ t) installer_type=${OPTARG} ;;
+ i) installer_ip=${OPTARG} ;;
+ p) pod_name=${OPTARG} ;;
+ s) scenario=${OPTARG} ;;
+ h) usage
+ exit 0
+ ;;
+ *) echo "Non-option argument: '-${OPTARG}'" >&2
+ usage
+ exit 2
+ ;;
+ esac
+done
+
+#set vars from env if not provided by user as options
+installer_type=${installer_type:-$INSTALLER_TYPE}
+installer_ip=${installer_ip:-$INSTALLER_IP}
+
+sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+
+verify_connectivity ${installer_ip}
+
+ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa -q
+
+# ssh-copy-id publickey to installer
+case "$installer_type" in
+ fuel)
+ sshpass -p r00tme ssh-copy-id $sshoptions ${installer_ip}
+ ;;
+ *)
+ echo "Unkown installer $installer_type specified"
+ exit 1
+ ;;
+esac
+
+cd /home/opnfv
+
+qtip workspace create --pod ${pod_name} --installer ${installer_type} \
+--master-host ${installer_ip} --scenario ${scenario} workspace
+
+cd /home/opnfv/workspace/
+
+ansible-playbook setup.yml
+eval `ssh-agent`
+ansible-playbook run.yml
+ansible-playbook teardown.yml
+
+# Remove ssh public key from installer
+case "$installer_type" in
+ fuel)
+ publickey=$(sed -r 's/\//\\\//g' /root/.ssh/id_rsa.pub)
+ ssh $sshoptions root@${installer_ip} "sed -i '/$publickey/d' /root/.ssh/authorized_keys"
+ ;;
+ *)
+ echo "Not support $installer_type."
+ exit 1
+ ;;
+esac
+
+echo "Qtip done!"
+exit 0 \ No newline at end of file
diff --git a/tests/integration/cleanup-deploy.sh b/tests/integration/cleanup-deploy.sh
deleted file mode 100644
index 9cb19a58..00000000
--- a/tests/integration/cleanup-deploy.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 ZTE and others.
-# 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
-##############################################################################
-# Remove previous running containers if exist
-if [[ ! -z $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG") ]]; then
- echo "Removing existing opnfv/qtip containers..."
- # workaround: sometimes it throws an error when stopping qtip container.
- # To make sure ci job unblocked, remove qtip container by force without stopping it.
- docker rm -f $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG" | awk '{print $1}')
-fi
-
-# Remove existing images if exist
-if [[ $(docker images opnfv/qtip:${DOCKER_TAG} | wc -l) -gt 1 ]]; then
- echo "Removing docker image opnfv/qtip:$DOCKER_TAG..."
- docker rmi opnfv/qtip:$DOCKER_TAG
-fi
diff --git a/tests/integration/validate-deploy.sh b/tests/integration/validate-deploy.sh
deleted file mode 100644
index 9f3dbe41..00000000
--- a/tests/integration/validate-deploy.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 ZTE and others.
-# 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 -e
-
-envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP}
--e NODE_NAME=${NODE_NAME} -e CI_DEBUG=${CI_DEBUG}"
-ramfs=/tmp/qtip/ramfs
-cfg_dir=$(dirname $ramfs)
-dir_imgstore="${HOME}/imgstore"
-ramfs_volume="$ramfs:/mnt/ramfs"
-
-echo "--------------------------------------------------------"
-echo "POD: $NODE_NAME"
-echo "INSTALLER: $INSTALLER_TYPE"
-echo "Scenario: $DEPLOY_SCENARIO"
-echo "--------------------------------------------------------"
-
-echo "Qtip: Pulling docker image: opnfv/qtip:${DOCKER_TAG}"
-docker pull opnfv/qtip:$DOCKER_TAG
-
-# use ramfs to fix docker socket connection issue with overlay mode in centos
-if [ ! -d $ramfs ]; then
- mkdir -p $ramfs
-fi
-
-if [ ! -z "$(df $ramfs | tail -n -1 | grep $ramfs)" ]; then
- sudo mount -t tmpfs -o size=32M tmpfs $ramfs
-fi
-
-# enable contro path in docker
-cat <<EOF > ${cfg_dir}/ansible.cfg
-[defaults]
-callback_whitelist = profile_tasks
-[ssh_connection]
-control_path=/mnt/ramfs/ansible-ssh-%%h-%%p-%%r
-EOF
-
-cmd=" docker run -id -e $envs -v ${ramfs_volume} opnfv/qtip:${DOCKER_TAG} /bin/bash"
-echo "Qtip: Running docker command: ${cmd}"
-${cmd}
-
-container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1)
-if [ $(docker ps | grep 'opnfv/qtip' | wc -l) == 0 ]; then
- echo "The container opnfv/qtip with ID=${container_id} has not been properly started. Exiting..."
- exit 1
-else
- echo "The container ID is: ${container_id}"
- QTIP_REPO=/home/opnfv/repos/qtip
- docker cp ${cfg_dir}/ansible.cfg ${container_id}:/home/opnfv/.ansible.cfg
-# TODO(zhihui_wu): use qtip cli to execute benchmark test in the future
- docker exec -t ${container_id} bash -c "cd ${QTIP_REPO}/qtip/runner/ &&
- python runner.py -d /home/opnfv/qtip/results/ -b all"
-
-fi
-
-echo "Qtip done!"
diff --git a/tests/integration/validate-setup.sh b/tests/integration/validate-setup.sh
deleted file mode 100644
index 8d84e120..00000000
--- a/tests/integration/validate-setup.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-##############################################################################
-# Copyright (c) 2017 ZTE and others.
-# 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 -e
-
-# setup virtualenv
-sudo pip install -u virtualenv virtualenvwrapper
-export WORKON_HOME=$HOME/.virtualenvs
-source /usr/local/bin/virtualenvwrapper.sh
-mkvirtualenv qtip
-workon qtip
-
-# setup qtip
-sudo pip install $HOME/repos/qtip
-
-# testing
-qtip --version
-qtip --help