diff options
39 files changed, 447 insertions, 72 deletions
diff --git a/jjb/3rd_party_ci/create-apex-vms.sh b/jjb/3rd_party_ci/create-apex-vms.sh index a076dd084..3f5dbd1c4 100755 --- a/jjb/3rd_party_ci/create-apex-vms.sh +++ b/jjb/3rd_party_ci/create-apex-vms.sh @@ -1,11 +1,15 @@ #!/bin/bash set -e +if [ -z ${WORKSPACE} ]; then + echo "WORKSPACE is unset. Please do so." + exit 1 +fi # wipe the WORKSPACE /bin/rm -rf $WORKSPACE/* - # clone opnfv sdnvpn repo git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn + . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh pushd $LIB ./test_environment.sh --env-number $APEX_ENV_NUMBER --cloner-info $CLONER_INFO --snapshot-disks $SNAPSHOT_DISKS --vjump-hosts $VIRTUAL_JUMPHOSTS diff --git a/jjb/3rd_party_ci/download-netvirt-artifact.sh b/jjb/3rd_party_ci/download-netvirt-artifact.sh index 0a48e3aec..be2d4059a 100755 --- a/jjb/3rd_party_ci/download-netvirt-artifact.sh +++ b/jjb/3rd_party_ci/download-netvirt-artifact.sh @@ -1,6 +1,10 @@ #!/bin/bash set -e +if [ -z ${WORKSPACE} ]; then + echo "WORKSPACE is unset. Please do so." + exit 1 +fi # wipe the WORKSPACE /bin/rm -rf $WORKSPACE/* diff --git a/jjb/3rd_party_ci/install-netvirt.sh b/jjb/3rd_party_ci/install-netvirt.sh index 96c4b9634..f111d4847 100755 --- a/jjb/3rd_party_ci/install-netvirt.sh +++ b/jjb/3rd_party_ci/install-netvirt.sh @@ -1,5 +1,12 @@ #!/bin/bash set -e + +if [ -z ${WORKSPACE} ]; then + echo "WORKSPACE is unset. Please do so." + exit 1 +fi +# wipe the WORKSPACE +/bin/rm -rf $WORKSPACE/* # clone opnfv sdnvpn repo git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh diff --git a/jjb/3rd_party_ci/postprocess-netvirt.sh b/jjb/3rd_party_ci/postprocess-netvirt.sh index 2e99477c5..5baf378a9 100755 --- a/jjb/3rd_party_ci/postprocess-netvirt.sh +++ b/jjb/3rd_party_ci/postprocess-netvirt.sh @@ -1,14 +1,15 @@ #!/bin/bash set -e +if [ -z ${WORKSPACE} ]; then + echo "WORKSPACE is unset. Please do so." + exit 1 +fi # wipe the WORKSPACE -if [ -z ${WORKSPACE} ]; then echo "WORKSPACE is unset"; else echo "WORKSPACE is set to \"$WORKSPACE\""; fi -WORKSPACE=${WORKSPACE:-$PWD} /bin/rm -rf $WORKSPACE/* -set -e # clone opnfv sdnvpn repo git clone https://gerrit.opnfv.org/gerrit/p/sdnvpn.git $WORKSPACE/sdnvpn . $WORKSPACE/sdnvpn/odl-pipeline/odl-pipeline-common.sh pushd $LIB ./post_process.sh -popd
\ No newline at end of file +popd diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index 70731b568..5c1bded4c 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -31,11 +31,16 @@ - 'os-nosdn-nofeature-ha-ipv6' - 'os-nosdn-ovs-noha' - 'os-nosdn-fdio-noha' - - 'os-odl_l3-bgpvpn-ha' - - 'os-odl_l2-fdio-noha' + - 'os-nosdn-fdio-ha' - 'os-odl_l2-fdio-ha' + - 'os-odl_l2-netvirt_gbp_fdio-noha' - 'os-odl_l2-sfc-noha' - 'os-odl_l3-nofeature-ha' + - 'os-odl_l3-bgpvpn-ha' + - 'os-odl_l3-fdio-noha' + - 'os-odl_l3-fdio-ha' + - 'os-odl_l3-fdio_dvr-noha' + - 'os-odl_l3-fdio_dvr-ha' - 'os-onos-nofeature-ha' platform: @@ -292,7 +297,7 @@ builders: - trigger-builds: - - project: 'apex-deploy-baremetal-os-odl_l2-nofeature-ha-{stream}' + - project: 'apex-deploy-baremetal-os-odl_l3-nofeature-ha-{stream}' predefined-parameters: OPNFV_CLEAN=yes git-revision: false @@ -301,7 +306,7 @@ - trigger-builds: - project: 'cperf-apex-intel-pod2-daily-{stream}' predefined-parameters: - DEPLOY_SCENARIO=os-odl_l2-nofeature-ha + DEPLOY_SCENARIO=os-odl_l3-nofeature-ha block: true same-node: true diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml index 62f2a1afe..4e88678b4 100644 --- a/jjb/armband/armband-ci-jobs.yml +++ b/jjb/armband/armband-ci-jobs.yml @@ -260,23 +260,23 @@ - trigger: name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 1' + - timed: '0 8 * * 1,3,5,7' - trigger: name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 2' + - timed: '0 16 * * 2,7' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 3' + - timed: '0 16 * * 1,4,6' - trigger: name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 4' + - timed: '0 8 * * 2,4,6' - trigger: name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-master-trigger' triggers: - - timed: '0 0 * * 5' + - timed: '0 16 * * 3,5' - trigger: name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-master-trigger' triggers: @@ -292,23 +292,23 @@ - trigger: name: 'fuel-os-odl_l2-nofeature-ha-armband-baremetal-danube-trigger' triggers: - - timed: '0 8 * * 1,3,5,7' + - timed: '0 0 * * 1' - trigger: name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-danube-trigger' triggers: - - timed: '0 16 * * 2,7' + - timed: '0 0 * * 2' - trigger: name: 'fuel-os-odl_l2-bgpvpn-ha-armband-baremetal-danube-trigger' triggers: - - timed: '0 8 * * 2,4,6' + - timed: '0 0 * * 4' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-armband-baremetal-danube-trigger' triggers: - - timed: '0 16 * * 1,4,6' + - timed: '0 0 * * 3' - trigger: name: 'fuel-os-odl_l2-nofeature-noha-armband-baremetal-danube-trigger' triggers: - - timed: '0 16 * * 3,5' + - timed: '0 0 * * 5' - trigger: name: 'fuel-os-odl_l2-sfc-ha-armband-baremetal-danube-trigger' triggers: diff --git a/jjb/barometer/barometer.yml b/jjb/barometer/barometer.yml index 27e1f83f9..e789b7f7a 100644 --- a/jjb/barometer/barometer.yml +++ b/jjb/barometer/barometer.yml @@ -115,8 +115,8 @@ pwd cd src ./install_build_deps.sh - sudo make clobber - sudo make + make clobber + make - job-template: name: 'barometer-daily-{stream}' @@ -152,5 +152,5 @@ pwd cd src ./install_build_deps.sh - sudo make clobber - sudo make + make clobber + make diff --git a/jjb/compass4nfv/compass-deploy.sh b/jjb/compass4nfv/compass-deploy.sh index c8d6159a2..f89d04e6d 100644 --- a/jjb/compass4nfv/compass-deploy.sh +++ b/jjb/compass4nfv/compass-deploy.sh @@ -38,6 +38,10 @@ else export NETWORK_CONF_FILE=network.yml fi +if [[ "$NODE_NAME" =~ "intel-pod8" ]]; then + export OS_MGMT_NIC=em4 +fi + if [[ "$NODE_NAME" =~ "-virtual" ]]; then export NETWORK_CONF=$CONFDIR/vm_environment/$NODE_NAME/${NETWORK_CONF_FILE} export DHA_CONF=$CONFDIR/vm_environment/${DEPLOY_SCENARIO}.yml diff --git a/jjb/compass4nfv/compass-verify-jobs.yml b/jjb/compass4nfv/compass-verify-jobs.yml index c1179d799..6ef5fbb67 100644 --- a/jjb/compass4nfv/compass-verify-jobs.yml +++ b/jjb/compass4nfv/compass-verify-jobs.yml @@ -132,17 +132,24 @@ node-parameters: true kill-phase-on: FAILURE abort-all-job: true -# - multijob: -# name: smoke-test -# condition: SUCCESSFUL -# projects: -# - name: 'functest-compass-virtual-suite-{stream}' -# current-parameters: true -# predefined-parameters: -# FUNCTEST_SUITE_NAME=healthcheck -# node-parameters: true -# kill-phase-on: NEVER -# abort-all-job: true + - multijob: + name: smoke-test + condition: SUCCESSFUL + projects: + - name: 'functest-compass-virtual-suite-{stream}' + current-parameters: true + predefined-parameters: + FUNCTEST_SUITE_NAME=healthcheck + node-parameters: true + kill-phase-on: NEVER + abort-all-job: true + - name: 'functest-compass-virtual-suite-{stream}' + current-parameters: true + predefined-parameters: + FUNCTEST_SUITE_NAME=vping_ssh + node-parameters: true + kill-phase-on: NEVER + abort-all-job: true - job-template: name: 'compass-verify-{phase}-{distro}-{stream}' diff --git a/jjb/doctor/doctor.yml b/jjb/doctor/doctor.yml index 72d88c8da..ab9ef8f6c 100644 --- a/jjb/doctor/doctor.yml +++ b/jjb/doctor/doctor.yml @@ -233,3 +233,4 @@ failed: true unstable: true notbuilt: true + silent-start: true diff --git a/jjb/dovetail/dovetail-artifacts-upload.sh b/jjb/dovetail/dovetail-artifacts-upload.sh index b5d8fcfee..b23decad1 100755 --- a/jjb/dovetail/dovetail-artifacts-upload.sh +++ b/jjb/dovetail/dovetail-artifacts-upload.sh @@ -16,6 +16,7 @@ echo "dovetail: pull and save the images" cd ${CACHE_DIR} sudo docker pull ${DOCKER_REPO_NAME}:${DOCKER_TAG} sudo docker save -o ${STORE_FILE_NAME} ${DOCKER_REPO_NAME}:${DOCKER_TAG} +sudo chmod og+rw ${STORE_FILE_NAME} OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S") GS_UPLOAD_LOCATION="${STORE_URL}/${OPNFV_ARTIFACT_VERSION}" diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index 2b6ab7621..08eb5a5f1 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -227,13 +227,6 @@ - shell: !include-raw: ./dovetail-run.sh - -- builder: - name: dovetail-fetch-os-creds - builders: - - shell: - !include-raw: ../../utils/fetch_os_creds.sh - - builder: name: dovetail-cleanup builders: diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 4082c34fe..0a2f156cc 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -57,7 +57,7 @@ if [ -z ${container_id} ]; then docker ps -a exit 1 fi -echo "COntainer Start: docker start ${container_id}" +echo "Container Start: docker start ${container_id}" docker start ${container_id} sleep 5 docker ps >${redirect} @@ -66,9 +66,12 @@ if [ $(docker ps | grep "opnfv/dovetail:${DOCKER_TAG}" | wc -l) == 0 ]; then exit 1 fi -exec_cmd="python ${DOVETAIL_REPO_DIR}/dovetail/run.py --testsuite ${TESTSUITE} -d true" -echo "Container exec command: ${exec_cmd}" -docker exec ${container_id} ${exec_cmd} +list_cmd="dovetail list ${TESTSUITE}" +run_cmd="dovetail run --testsuite ${TESTSUITE} -d true" +echo "Container exec command: ${list_cmd}" +docker exec $container_id ${list_cmd} +echo "Container exec command: ${run_cmd}" +docker exec $container_id ${run_cmd} sudo cp -r ${DOVETAIL_REPO_DIR}/results ./ #To make sure the file owner is jenkins, for the copied results files in the above line diff --git a/jjb/functest/functest-suite.sh b/jjb/functest/functest-suite.sh index a30fb5973..9dc8deca0 100755 --- a/jjb/functest/functest-suite.sh +++ b/jjb/functest/functest-suite.sh @@ -12,3 +12,7 @@ else fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd + +ret_value=$? + +exit $ret_value diff --git a/jjb/global/slave-params.yml b/jjb/global/slave-params.yml index 30ebb950f..39a1b1b9c 100644 --- a/jjb/global/slave-params.yml +++ b/jjb/global/slave-params.yml @@ -703,6 +703,16 @@ name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' +- parameter: + name: 'odl-netvirt-virtual-intel-defaults' + parameters: + - label: + name: SLAVE_LABEL + default: 'odl-netvirt-virtual-intel' + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' ##################################################### # These slaves are just dummy slaves for sandbox jobs ##################################################### diff --git a/jjb/infra/bifrost-verify-jobs.yml b/jjb/infra/bifrost-verify-jobs.yml index baf33ea3a..422a42274 100644 --- a/jjb/infra/bifrost-verify-jobs.yml +++ b/jjb/infra/bifrost-verify-jobs.yml @@ -132,6 +132,10 @@ timeout: 10 wipe-workspace: true + triggers: + - '{project}-gerrit-trigger': + branch: '{branch}' + builders: - description-setter: description: "Built on $NODE_NAME" diff --git a/jjb/qtip/qtip-ci-jobs.yml b/jjb/qtip/qtip-ci-jobs.yml index b83014edb..69cb32b41 100644 --- a/jjb/qtip/qtip-ci-jobs.yml +++ b/jjb/qtip/qtip-ci-jobs.yml @@ -39,7 +39,7 @@ - job-template: name: 'qtip-{installer}-{pod}-daily-{stream}' - disabled: false + disabled: true parameters: - project-parameter: diff --git a/modules/opnfv/installer_adapters/InstallerHandler.py b/modules/opnfv/installer_adapters/InstallerHandler.py index e353ef3f4..dc5bdb9d6 100644 --- a/modules/opnfv/installer_adapters/InstallerHandler.py +++ b/modules/opnfv/installer_adapters/InstallerHandler.py @@ -11,9 +11,10 @@ from opnfv.installer_adapters.fuel.FuelAdapter import FuelAdapter from opnfv.installer_adapters.apex.ApexAdapter import ApexAdapter from opnfv.installer_adapters.compass.CompassAdapter import CompassAdapter from opnfv.installer_adapters.joid.JoidAdapter import JoidAdapter +from opnfv.installer_adapters.daisy.DaisyAdapter import DaisyAdapter -INSTALLERS = ["fuel", "apex", "compass", "joid"] +INSTALLERS = ["fuel", "apex", "compass", "joid", "daisy"] class InstallerHandler: @@ -38,6 +39,8 @@ class InstallerHandler: self.InstallerAdapter = CompassAdapter(self.installer_ip) elif self.installer == INSTALLERS[3]: self.InstallerAdapter = JoidAdapter(self.installer_ip) + elif self.installer == INSTALLERS[4]: + self.InstallerAdapter = DaisyAdapter(self.installer_ip) else: print("Installer %s is not valid. " "Please use one of the followings: %s" diff --git a/modules/opnfv/installer_adapters/daisy/DaisyAdapter.py b/modules/opnfv/installer_adapters/daisy/DaisyAdapter.py new file mode 100644 index 000000000..9b06f4c3c --- /dev/null +++ b/modules/opnfv/installer_adapters/daisy/DaisyAdapter.py @@ -0,0 +1,32 @@ +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.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 +############################################################################## + + +class DaisyAdapter: + + def __init__(self, installer_ip): + self.installer_ip = installer_ip + + def get_deployment_info(self): + pass + + def get_nodes(self): + pass + + def get_controller_ips(self): + pass + + def get_compute_ips(self): + pass + + def get_file_from_installer(self, origin, target, options=None): + pass + + def get_file_from_controller(self, origin, target, ip=None, options=None): + pass diff --git a/modules/opnfv/installer_adapters/daisy/__init__.py b/modules/opnfv/installer_adapters/daisy/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/modules/opnfv/installer_adapters/daisy/__init__.py diff --git a/modules/opnfv/utils/Credentials.py b/modules/opnfv/utils/Credentials.py index 1882692b3..6441b841c 100644 --- a/modules/opnfv/utils/Credentials.py +++ b/modules/opnfv/utils/Credentials.py @@ -47,7 +47,7 @@ class Credentials(object): password) def __check_installer_name(self, installer): - if installer not in ("apex", "compass", "fuel", "joid"): + if installer not in ("apex", "compass", "daisy", "fuel", "joid"): return os.EX_CONFIG else: return os.EX_OK @@ -69,6 +69,10 @@ class Credentials(object): # TODO pass + def __fetch_creds_daisy(self, target_path): + # TODO + pass + def __fetch_creds_fuel(self, target_path): creds_file = '/root/openrc' try: @@ -95,6 +99,8 @@ class Credentials(object): self.__fetch_creds_apex(target_path) elif self.installer == "compass": self.__fetch_creds_compass(target_path) + elif self.installer == "daisy": + self.__fetch_creds_daisy(target_path) elif self.installer == "fuel": self.__fetch_creds_fuel(target_path) elif self.installer == "joid": diff --git a/modules/opnfv/utils/constants.py b/modules/opnfv/utils/constants.py index 29f0d02c5..a69cedda3 100644 --- a/modules/opnfv/utils/constants.py +++ b/modules/opnfv/utils/constants.py @@ -7,7 +7,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 -INSTALLERS = ['apex', 'fuel', 'compass', 'joid'] +INSTALLERS = ['apex', 'fuel', 'compass', 'joid', "daisy"] VERSIONS = ['arno', 'brahmaputra', 'colorado', 'danube'] EXIT_OK = 0 diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index ecc571dba..3667dbe6c 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -104,18 +104,13 @@ if [ "$installer_type" == "fuel" ]; then #This file contains the mgmt keystone API, we need the public one for our rc file admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//') public_ip=$(sshpass -p r00tme ssh $ssh_options root@${installer_ip} \ - "ssh ${controller_ip} 'source openrc; openstack endpoint list --long'" \ - | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null + "ssh ${controller_ip} 'source openrc; openstack endpoint list'" \ + | grep keystone | grep public | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null #| grep http | head -1 | cut -d '|' -f 4 | sed 's/v1\/.*/v1\//' | sed 's/ //g') &> /dev/null #NOTE: this is super ugly sed 's/v1\/.*/v1\//'OS_AUTH_URL # but sometimes the output of endpoint-list is like this: http://172.30.9.70:8004/v1/%(tenant_id)s # Fuel virtual need a fix - if [ "$DEPLOY_TYPE" == "virt" ]; then - echo "INFO: Changing: internalURL -> publicURL in openrc" - sed -i 's/internalURL/publicURL/' $dest_path - fi - elif [ "$installer_type" == "apex" ]; then verify_connectivity $installer_ip @@ -196,13 +191,6 @@ if [ ! -f $dest_path ]; then error "There has been an error retrieving the credentials" fi -if [ "$public_ip" != "" ]; then - info "Exchanging keystone public IP in rc file to $public_ip" - sed -i "/OS_AUTH_URL/c\export OS_AUTH_URL=\'$public_ip'" $dest_path -fi - - - echo "-------- Credentials: --------" cat $dest_path diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index 9751a90de..be9fe184d 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -95,18 +95,30 @@ main () { makemonit () { echo "Writing the following as monit config:" cat << EOF | tee $monitconfdir/jenkins +check directory jenkins_piddir path /var/run/$jenkinsuser +if does not exist then exec "/usr/bin/mkdir -p /var/run/$jenkinsuser" +if failed uid $jenkinsuser then exec "/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser" +if failed gid $jenkinsuser then exec "/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser" + check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds" stop program = "/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'" +depends on jenkins_piddir EOF } if [[ -f $monitconfdir/jenkins ]]; then #test for diff if [[ "$(diff $monitconfdir/jenkins <(echo "\ +check directory jenkins_piddir path /var/run/$jenkinsuser +if does not exist then exec \"/usr/bin/mkdir -p /var/run/$jenkinsuser\" +if failed uid $jenkinsuser then exec \"/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser\" +if failed gid $jenkinsuser then exec \"/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser\" + check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds\" -stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\ +stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\" +depends on jenkins_piddir\ ") )" ]]; then echo "Updating monit config..." makemonit $@ diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html index 094bbf8a2..52046c37f 100644 --- a/utils/test/reporting/functest/template/index-status-tmpl.html +++ b/utils/test/reporting/functest/template/index-status-tmpl.html @@ -72,6 +72,7 @@ $(document).ready(function (){ <li class="active"><a href="../../index.html">Home</a></li> <li><a href="status-apex.html">Apex</a></li> <li><a href="status-compass.html">Compass</a></li> + <li><a href="status-daisy.html">Daisy</a></li> <li><a href="status-fuel.html">Fuel</a></li> <li><a href="status-joid.html">Joid</a></li> </ul> diff --git a/utils/test/reporting/functest/template/index-tempest-tmpl.html b/utils/test/reporting/functest/template/index-tempest-tmpl.html index db483070f..3a222276e 100644 --- a/utils/test/reporting/functest/template/index-tempest-tmpl.html +++ b/utils/test/reporting/functest/template/index-tempest-tmpl.html @@ -24,6 +24,7 @@ <li class="active"><a href="../../index.html">Home</a></li> <li><a href="tempest-apex.html">Apex</a></li> <li><a href="tempest-compass.html">Compass</a></li> + <li><a href="tempest-daisy.html">Daisy</a></li> <li><a href="tempest-fuel.html">Fuel</a></li> <li><a href="tempest-joid.html">Joid</a></li> </ul> diff --git a/utils/test/reporting/functest/template/index-vims-tmpl.html b/utils/test/reporting/functest/template/index-vims-tmpl.html index 033c8ab33..cd51607b7 100644 --- a/utils/test/reporting/functest/template/index-vims-tmpl.html +++ b/utils/test/reporting/functest/template/index-vims-tmpl.html @@ -24,6 +24,7 @@ <li class="active"><a href="../../index.html">Home</a></li> <li><a href="vims-fuel.html">Fuel</a></li> <li><a href="vims-compass.html">Compass</a></li> + <li><a href="vims-daisy.html">Daisy</a></li> <li><a href="vims-joid.html">JOID</a></li> <li><a href="vims-apex.html">APEX</a></li> </ul> diff --git a/utils/test/reporting/reporting.yaml b/utils/test/reporting/reporting.yaml index 447d6e161..fa9862615 100644 --- a/utils/test/reporting/reporting.yaml +++ b/utils/test/reporting/reporting.yaml @@ -4,6 +4,7 @@ general: - compass - fuel - joid + - daisy versions: - master diff --git a/utils/test/testapi/docker/Dockerfile b/utils/test/testapi/docker/Dockerfile index b0272e609..86513e05b 100644 --- a/utils/test/testapi/docker/Dockerfile +++ b/utils/test/testapi/docker/Dockerfile @@ -48,5 +48,5 @@ RUN git clone https://gerrit.opnfv.org/gerrit/releng /home/releng WORKDIR /home/releng/utils/test/testapi/ RUN pip install -r requirements.txt -RUN python setup.py install +RUN bash install.sh CMD ["bash", "docker/start-server.sh"] diff --git a/utils/test/testapi/htmlize/finish.sh b/utils/test/testapi/htmlize/finish.sh index dc3aa868b..d24ae056c 100644 --- a/utils/test/testapi/htmlize/finish.sh +++ b/utils/test/testapi/htmlize/finish.sh @@ -13,3 +13,5 @@ if [ $proc_number -gt 0 ]; then echo "Kill opnfv-testapi server $procs" ps -ef | grep opnfv-testapi | grep -v grep | awk '{print $2}' | xargs kill -kill &>/dev/null fi + +deactivate diff --git a/utils/test/testapi/htmlize/prepare.sh b/utils/test/testapi/htmlize/prepare.sh index 3c265aaa0..67158f211 100644 --- a/utils/test/testapi/htmlize/prepare.sh +++ b/utils/test/testapi/htmlize/prepare.sh @@ -26,5 +26,3 @@ cd utils/test/testapi/ pip install -r requirements.txt ./install.sh opnfv-testapi -c ../../../testapi_venv/etc/opnfv_testapi/config.ini & - -deactivate diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index f1ad15e97..9fc5d6be1 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -43,6 +43,7 @@ class GenericApiHandler(RequestHandler): self.db_pods = 'pods' self.db_testcases = 'testcases' self.db_results = 'results' + self.db_scenarios = 'scenarios' def prepare(self): if self.request.method != "GET" and self.request.method != "DELETE": diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py new file mode 100644 index 000000000..7bf3d5d53 --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -0,0 +1,75 @@ +from opnfv_testapi.common.constants import HTTP_FORBIDDEN +from opnfv_testapi.resources.handlers import GenericApiHandler +from opnfv_testapi.resources.scenario_models import Scenario +from opnfv_testapi.tornado_swagger import swagger + + +class GenericScenarioHandler(GenericApiHandler): + def __init__(self, application, request, **kwargs): + super(GenericScenarioHandler, self).__init__(application, + request, + **kwargs) + self.table = self.db_scenarios + self.table_cls = Scenario + + +class ScenariosCLHandler(GenericScenarioHandler): + @swagger.operation(nickname="List scenarios by queries") + def get(self): + """ + @description: Retrieve scenario(s). + @notes: Retrieve scenario(s) + @return 200: all scenarios consist with query, + empty list if no scenario is found + @rtype: L{Scenarios} + """ + self._list() + + @swagger.operation(nickname="Create a new scenario") + def post(self): + """ + @description: create a new scenario by name + @param body: scenario to be created + @type body: L{ScenarioCreateRequest} + @in body: body + @rtype: L{CreateResponse} + @return 200: scenario is created. + @raise 403: scenario already exists + @raise 400: body or name not provided + """ + def query(data): + return {'name': data.name} + + def error(data): + message = '{} already exists as a scenario'.format(data.name) + return HTTP_FORBIDDEN, message + + miss_checks = ['name'] + db_checks = [(self.table, False, query, error)] + self._create(miss_checks=miss_checks, db_checks=db_checks) + + +class ScenarioGURHandler(GenericScenarioHandler): + @swagger.operation(nickname='Get the scenario by name') + def get(self, name): + """ + @description: get a single scenario by name + @rtype: L{Scenario} + @return 200: scenario exist + @raise 404: scenario not exist + """ + pass + + @swagger.operation(nickname="Update the scenario by name") + def put(self, name): + """ + @description: update a single scenario by name + @param body: fields to be updated + @type body: L{string} + @in body: body + @rtype: L{Scenario} + @return 200: update success + @raise 404: scenario not exist + @raise 403: nothing to update + """ + pass diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py new file mode 100644 index 000000000..b4bb3634b --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py @@ -0,0 +1,98 @@ +import models +from opnfv_testapi.tornado_swagger import swagger + + +@swagger.model() +class ScenarioTI(models.ModelBase): + def __init__(self, date=None, status='silver'): + self.date = date + self.status = status + + +@swagger.model() +class ScenarioScore(models.ModelBase): + def __init__(self, date=None, score=''): + self.date = date + self.score = score + + +@swagger.model() +class ScenarioProject(models.ModelBase): + """ + @property customs: + @ptype customs: C{list} of L{string} + @property scores: + @ptype scores: C{list} of L{ScenarioScore} + @property trust_indicators: + @ptype trust_indicators: C{list} of L{ScenarioTI} + """ + def __init__(self, + name='', + customs=None, + scores=None, + trust_indicators=None): + self.name = name + self.customs = customs + self.scores = scores + self.trust_indicator = trust_indicators + + +@swagger.model() +class ScenarioVersion(models.ModelBase): + """ + @property projects: + @ptype projects: C{list} of L{ScenarioProject} + """ + def __init__(self, version, projects=None): + self.version = version + self.projects = projects + + +@swagger.model() +class ScenarioInstaller(models.ModelBase): + """ + @property versions: + @ptype versions: C{list} of L{ScenarioVersion} + """ + def __init__(self, installer=None, owner=None, versions=None): + self.installer = installer + self.owner = owner + self.versions = versions if versions else list() + + +@swagger.model() +class ScenarioCreateRequest(models.ModelBase): + """ + @property installers: + @ptype installers: C{list} of L{ScenarioInstaller} + """ + def __init__(self, name='', installers=None): + self.name = name + self.installers = installers if installers else list() + + +@swagger.model() +class Scenario(models.ModelBase): + """ + @property installers: + @ptype installers: C{list} of L{ScenarioInstaller} + """ + def __init__(self, name='', create_date='', _id='', installers=None): + self.name = name + self._id = _id + self.creation_date = create_date + self.installers = installers if installers else list() + + +@swagger.model() +class Scenarios(models.ModelBase): + """ + @property scenarios: + @ptype scenarios: C{list} of L{Scenario} + """ + def __init__(self): + self.scenarios = list() + + @staticmethod + def attr_parser(): + return {'scenarios': Scenario} diff --git a/utils/test/testapi/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py index eb648ecbb..0ae3c31c3 100644 --- a/utils/test/testapi/opnfv_testapi/router/url_mappings.py +++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py @@ -14,7 +14,8 @@ from opnfv_testapi.resources.project_handlers import ProjectCLHandler, \ ProjectGURHandler from opnfv_testapi.resources.result_handlers import ResultsCLHandler, \ ResultsGURHandler - +from opnfv_testapi.resources.scenario_handlers import ScenariosCLHandler +from opnfv_testapi.resources.scenario_handlers import ScenarioGURHandler mappings = [ # GET /versions => GET API version @@ -45,4 +46,8 @@ mappings = [ # (project, case, and pod) (r"/api/v1/results", ResultsCLHandler), (r"/api/v1/results/([^/]+)", ResultsGURHandler), + + # scenarios + (r"/api/v1/scenarios", ScenariosCLHandler), + (r"/api/v1/scenarios/([^/]+)", ScenarioGURHandler), ] diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py index 3dd87e603..d86d8eadf 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py @@ -189,3 +189,4 @@ pods = MemDb() projects = MemDb() testcases = MemDb() results = MemDb() +scenarios = MemDb() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json b/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json new file mode 100644 index 000000000..eba8b6c0a --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/unit/scenario-create.json @@ -0,0 +1,38 @@ +{ + "name": "nosdn-nofeature-ha", + "installers": + [ + { + "installer": "apex", + "versions": + [ + { + "owner": "Luke", + "version": "master", + "projects": + [ + { + "project": "functest", + "customs": [ "healthcheck", "vping_ssh"], + "scores": + [ + { + "date": "2017-01-08 22:46:44", + "score": "12/14" + } + + ], + "trust_indicators": [] + }, + { + "project": "yardstick", + "customs": [], + "scores": [], + "trust_indicators": [] + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py index ff1a1932c..9343ab2fb 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py @@ -47,11 +47,11 @@ class TestBase(AsyncHTTPTestCase): return self.create_help(self.basePath, req, *args) def create_help(self, uri, req, *args): - if req: - req = req.format() + if req and not isinstance(req, str): + req = json.dumps(req.format()) res = self.fetch(self._update_uri(uri, *args), method='POST', - body=json.dumps(req), + body=req if req else json.dumps(None), headers=self.headers) return self._get_return(res, self.create_res) @@ -123,9 +123,17 @@ class TestBase(AsyncHTTPTestCase): self.assertIn(self.basePath, body.href) def assert_create_body(self, body, req=None, *args): + import inspect if not req: req = self.req_d - new_args = args + tuple([req.name]) + resource_name = '' + if inspect.isclass(req): + resource_name = req.name + elif isinstance(req, dict): + resource_name = req['name'] + elif isinstance(req, str): + resource_name = json.loads(req)['name'] + new_args = args + tuple([resource_name]) self.assertIn(self._get_uri(*new_args), body.href) @staticmethod @@ -134,3 +142,4 @@ class TestBase(AsyncHTTPTestCase): fake_pymongo.projects.clear() fake_pymongo.testcases.clear() fake_pymongo.results.clear() + fake_pymongo.scenarios.clear() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py new file mode 100644 index 000000000..8e827813c --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py @@ -0,0 +1,55 @@ +import json +import os + +from opnfv_testapi.common.constants import HTTP_BAD_REQUEST +from opnfv_testapi.common.constants import HTTP_FORBIDDEN +from opnfv_testapi.common.constants import HTTP_OK +from opnfv_testapi.resources.scenario_models import ScenarioCreateRequest +from test_testcase import TestBase + + +class TestScenarioBase(TestBase): + def setUp(self): + super(TestScenarioBase, self).setUp() + self.basePath = '/api/v1/scenarios' + self.load_request('scenario-create.json') + + def tearDown(self): + pass + + def assert_body(self, project, req=None): + pass + + def load_request(self, f_req): + with open(os.path.join(os.path.dirname(__file__), f_req), 'r') as f: + self.req_d = json.dumps(json.load(f)) + f.close() + + +class TestScenarioCreate(TestScenarioBase): + def test_withoutBody(self): + (code, body) = self.create() + self.assertEqual(code, HTTP_BAD_REQUEST) + + def test_emptyName(self): + req_empty = ScenarioCreateRequest('') + (code, body) = self.create(req_empty) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('name missing', body) + + def test_noneName(self): + req_none = ScenarioCreateRequest(None) + (code, body) = self.create(req_none) + self.assertEqual(code, HTTP_BAD_REQUEST) + self.assertIn('name missing', body) + + def test_success(self): + (code, body) = self.create_d() + self.assertEqual(code, HTTP_OK) + self.assert_create_body(body) + + def test_alreadyExist(self): + self.create_d() + (code, body) = self.create_d() + self.assertEqual(code, HTTP_FORBIDDEN) + self.assertIn('already exists', body) |