diff options
63 files changed, 1013 insertions, 384 deletions
diff --git a/docs/jenkins-job-builder/index.rst b/docs/jenkins-job-builder/index.rst index b85b1320f..4d23ade38 100644 --- a/docs/jenkins-job-builder/index.rst +++ b/docs/jenkins-job-builder/index.rst @@ -1,9 +1,9 @@ -*************************** +=========================== Release Engineering Project -*************************** +=========================== .. toctree:: :numbered: :maxdepth: 2 - opnfv-jjb-usage.rst + opnfv-jjb-usage diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index 93eaa6c6c..bb6e234fd 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -36,6 +36,7 @@ - 'os-nosdn-nofeature-ha' - 'os-nosdn-nofeature-ha-ipv6' - 'os-nosdn-ovs-noha' + - 'os-nosdn-ovs-ha' - 'os-nosdn-fdio-noha' - 'os-nosdn-fdio-ha' - 'os-nosdn-kvm-ha' @@ -44,7 +45,10 @@ - 'os-odl_l2-fdio-ha' - 'os-odl_l2-netvirt_gbp_fdio-noha' - 'os-odl_l2-sfc-noha' + - 'os-odl_l3-nofeature-noha' - 'os-odl_l3-nofeature-ha' + - 'os-odl_l3-ovs-noha' + - 'os-odl_l3-ovs-ha' - 'os-odl-bgpvpn-ha' - 'os-odl-gluon-noha' - 'os-odl_l3-fdio-noha' @@ -52,7 +56,6 @@ - 'os-odl_l3-fdio_dvr-noha' - 'os-odl_l3-fdio_dvr-ha' - 'os-odl_l3-csit-noha' - - 'os-odl_l3-nofeature-noha' - 'os-onos-nofeature-ha' - 'gate' @@ -383,7 +386,7 @@ block: true same-node: true - trigger-builds: - - project: 'cperf-apex-intel-pod2-daily-{stream}' + - project: 'cperf-apex-intel-pod2-daily-master' predefined-parameters: DEPLOY_SCENARIO=os-odl_l3-nofeature-noha block: true @@ -862,6 +865,66 @@ build-step-failure-threshold: 'never' failure-threshold: 'never' unstable-threshold: 'FAILURE' + - trigger-builds: + - project: 'apex-deploy-baremetal-os-nosdn-ovs-ha-{stream}' + predefined-parameters: | + BUILD_DIRECTORY=apex-build-{stream}/.build + OPNFV_CLEAN=yes + git-revision: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + block: true + - trigger-builds: + - project: 'functest-apex-{daily-slave}-daily-{stream}' + predefined-parameters: + DEPLOY_SCENARIO=os-nosdn-ovs-ha + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + - trigger-builds: + - project: 'yardstick-apex-{slave}-daily-{stream}' + predefined-parameters: + DEPLOY_SCENARIO=os-nosdn-ovs-ha + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + - trigger-builds: + - project: 'apex-deploy-baremetal-os-odl_l3-ovs-ha-{stream}' + predefined-parameters: | + BUILD_DIRECTORY=apex-build-{stream}/.build + OPNFV_CLEAN=yes + git-revision: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + block: true + - trigger-builds: + - project: 'functest-apex-{daily-slave}-daily-{stream}' + predefined-parameters: + DEPLOY_SCENARIO=os-odl_l3-ovs-ha + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + - trigger-builds: + - project: 'yardstick-apex-{slave}-daily-{stream}' + predefined-parameters: + DEPLOY_SCENARIO=os-odl_l3-ovs-ha + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' # CSIT promote - job-template: diff --git a/jjb/compass4nfv/compass-project-jobs.yml b/jjb/compass4nfv/compass-project-jobs.yml index 9b13e693a..f962518e0 100644 --- a/jjb/compass4nfv/compass-project-jobs.yml +++ b/jjb/compass4nfv/compass-project-jobs.yml @@ -12,10 +12,12 @@ - master: branch: '{stream}' gs-pathname: '' + ppa-pathname: '/{stream}' disabled: false - danube: branch: 'stable/{stream}' gs-pathname: '/{stream}' + ppa-pathname: '/{stream}' disabled: false jobs: @@ -47,6 +49,7 @@ - compass-project-parameter: installer: '{installer}' gs-pathname: '{gs-pathname}' + ppa-pathname: '{ppa-pathname}' - 'opnfv-build-ubuntu-defaults' - '{installer}-defaults' @@ -90,6 +93,7 @@ - compass-project-parameter: installer: '{installer}' gs-pathname: '{gs-pathname}' + ppa-pathname: '{ppa-pathname}' - '{node}-defaults' - '{installer}-defaults' scm: @@ -121,7 +125,7 @@ description: "URL to Google Storage." - string: name: PPA_REPO - default: "http://205.177.226.237:9999{gs-pathname}" + default: "http://205.177.226.237:9999{ppa-pathname}" - string: name: PPA_CACHE default: "$WORKSPACE/work/repo/" diff --git a/jjb/compass4nfv/compass-verify-jobs.yml b/jjb/compass4nfv/compass-verify-jobs.yml index e625c686a..14279e649 100644 --- a/jjb/compass4nfv/compass-verify-jobs.yml +++ b/jjb/compass4nfv/compass-verify-jobs.yml @@ -11,10 +11,12 @@ - master: branch: '{stream}' gs-pathname: '' + ppa-pathname: '/{stream}' disabled: false - danube: branch: 'stable/{stream}' gs-pathname: '/{stream}' + ppa-pathname: '/{stream}' disabled: false distro: @@ -111,6 +113,7 @@ - 'compass-verify-defaults': installer: '{installer}' gs-pathname: '{gs-pathname}' + ppa-pathname: '{ppa-pathname}' - string: name: DEPLOY_SCENARIO default: 'os-nosdn-nofeature-ha' @@ -229,6 +232,7 @@ - 'compass-verify-defaults': installer: '{installer}' gs-pathname: '{gs-pathname}' + ppa-pathname: '{ppa-pathname}' - string: name: DEPLOY_SCENARIO default: 'k8-nosdn-nofeature-ha' @@ -335,7 +339,7 @@ description: "URL to Google Storage." - string: name: PPA_REPO - default: "http://205.177.226.237:9999{gs-pathname}" + default: "http://205.177.226.237:9999{ppa-pathname}" - string: name: PPA_CACHE default: "$WORKSPACE/work/repo/" diff --git a/jjb/daisy4nfv/daisy-daily-jobs.yml b/jjb/daisy4nfv/daisy-daily-jobs.yml index ffae70f8f..c5d8e7e8b 100644 --- a/jjb/daisy4nfv/daisy-daily-jobs.yml +++ b/jjb/daisy4nfv/daisy-daily-jobs.yml @@ -70,7 +70,8 @@ - build-blocker: use-build-blocker: true blocking-jobs: - - 'daisy.*-deploy-({pod})?-daily-.*' + - 'daisy-daily-.*' + - 'daisy4nfv-(merge|verify)-.*' block-level: 'NODE' wrappers: diff --git a/jjb/daisy4nfv/daisy-project-jobs.yml b/jjb/daisy4nfv/daisy-project-jobs.yml index 9a57e1753..52769ca88 100644 --- a/jjb/daisy4nfv/daisy-project-jobs.yml +++ b/jjb/daisy4nfv/daisy-project-jobs.yml @@ -141,7 +141,8 @@ - build-blocker: use-build-blocker: true blocking-jobs: - - '{installer}-.*deploy-.*' + - '{installer}-daily-.*' + - 'daisy4nfv-(merge|verify)-.*' block-level: 'NODE' scm: diff --git a/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml b/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml index 11531f4a4..95e72e550 100644 --- a/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml +++ b/jjb/daisy4nfv/daisy4nfv-merge-jobs.yml @@ -21,7 +21,7 @@ - danube: branch: 'stable/{stream}' gs-pathname: '/{stream}' - disabled: false + disabled: true ##################################### # patch merge phases ##################################### @@ -148,7 +148,8 @@ - build-blocker: use-build-blocker: true blocking-jobs: - - '{alias}-merge-deploy-.*' + - '{alias}-(merge|verify)-.*' + - '{project}-daily-.*' block-level: 'NODE' scm: diff --git a/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml b/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml index ee78ab59f..9f44d99fb 100644 --- a/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml +++ b/jjb/daisy4nfv/daisy4nfv-verify-jobs.yml @@ -138,7 +138,8 @@ - build-blocker: use-build-blocker: true blocking-jobs: - - '{alias}-verify-deploy-.*' + - '{alias}-(merge|verify)-.*' + - '{installer}-daily-.*' block-level: 'NODE' scm: diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh index 0a2f156cc..f9a3df626 100755 --- a/jjb/dovetail/dovetail-run.sh +++ b/jjb/dovetail/dovetail-run.sh @@ -6,9 +6,9 @@ set -e [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" -# labconfig is used only for joid -labconfig="" sshkey="" +# The path of openrc.sh is defined in fetch_os_creds.sh +OPENRC=$WORKSPACE/opnfv-openrc.sh if [[ ${INSTALLER_TYPE} == 'apex' ]]; then instack_mac=$(sudo virsh domiflist undercloud | grep default | \ grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") @@ -22,7 +22,7 @@ if [[ ${INSTALLER_TYPE} == 'apex' ]]; then elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then # If production lab then creds may be retrieved dynamically # creds are on the jumphost, always in the same folder - labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds" + sudo cp $LAB_CONFIG/admin-openrc $OPENRC # If dev lab, credentials may not be the default ones, just provide a path to put them into docker # replace the default one by the customized one provided by jenkins config fi @@ -32,21 +32,32 @@ if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FOR sudo iptables -I FORWARD -j RETURN fi +if [[ ${INSTALLER_TYPE} != 'joid' ]]; then + releng_repo=${WORKSPACE}/releng + [ -d ${releng_repo} ] && sudo rm -rf ${releng_repo} + git clone https://gerrit.opnfv.org/gerrit/releng ${releng_repo} >/dev/null + ${releng_repo}/utils/fetch_os_creds.sh -d ${OPENRC} -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} >${redirect} +fi + +if [[ -f $OPENRC ]]; then + echo "INFO: openstack credentials path is $OPENRC" + cat $OPENRC +else + echo "ERROR: file $OPENRC does not exist." + exit 1 +fi + opts="--privileged=true -id" -envs="-e CI_DEBUG=${CI_DEBUG} \ - -e INSTALLER_TYPE=${INSTALLER_TYPE} \ - -e INSTALLER_IP=${INSTALLER_IP} \ - -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \ - -e DEPLOY_TYPE=${DEPLOY_TYPE}" results_envs="-v /var/run/docker.sock:/var/run/docker.sock \ -v /home/opnfv/dovetail/results:/home/opnfv/dovetail/results" +openrc_volume="-v ${OPENRC}:${OPENRC}" # Pull the image with correct tag echo "Dovetail: Pulling image opnfv/dovetail:${DOCKER_TAG}" docker pull opnfv/dovetail:$DOCKER_TAG >$redirect -cmd="sudo docker run ${opts} ${envs} ${results_envs} ${labconfig} ${sshkey} \ - opnfv/dovetail:${DOCKER_TAG} /bin/bash" +cmd="docker run ${opts} ${results_envs} ${openrc_volume} \ + ${sshkey} opnfv/dovetail:${DOCKER_TAG} /bin/bash" echo "Dovetail: running docker run command: ${cmd}" ${cmd} >${redirect} sleep 5 @@ -67,7 +78,7 @@ if [ $(docker ps | grep "opnfv/dovetail:${DOCKER_TAG}" | wc -l) == 0 ]; then fi list_cmd="dovetail list ${TESTSUITE}" -run_cmd="dovetail run --testsuite ${TESTSUITE} -d true" +run_cmd="dovetail run --openrc ${OPENRC} --testsuite ${TESTSUITE} -d" echo "Container exec command: ${list_cmd}" docker exec $container_id ${list_cmd} echo "Container exec command: ${run_cmd}" @@ -79,3 +90,4 @@ sudo cp -r ${DOVETAIL_REPO_DIR}/results ./ sudo chown -R jenkins:jenkins ${WORKSPACE}/results echo "Dovetail: done!" + diff --git a/jjb/fuel/fuel-daily-jobs.yml b/jjb/fuel/fuel-daily-jobs.yml index 12456ddbb..32abad624 100644 --- a/jjb/fuel/fuel-daily-jobs.yml +++ b/jjb/fuel/fuel-daily-jobs.yml @@ -747,7 +747,7 @@ - trigger: name: 'fuel-os-odl_l2-nofeature-ha-zte-pod2-daily-master-trigger' triggers: - - timed: '0 18 * * *' + - timed: '' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-zte-pod2-daily-master-trigger' triggers: diff --git a/jjb/functest/functest-daily-jobs.yml b/jjb/functest/functest-daily-jobs.yml index a3268d3e5..e8d14321f 100644 --- a/jjb/functest/functest-daily-jobs.yml +++ b/jjb/functest/functest-daily-jobs.yml @@ -205,7 +205,7 @@ - 'suite': job-timeout: 60 - 'daily': - job-timeout: 180 + job-timeout: 240 jobs: - 'functest-{installer}-{pod}-{testsuite}-{stream}' diff --git a/jjb/global/releng-macros.yml b/jjb/global/releng-macros.yml index 63613f88d..6fdb4caf4 100644 --- a/jjb/global/releng-macros.yml +++ b/jjb/global/releng-macros.yml @@ -75,7 +75,6 @@ submodule: recursive: true timeout: 20 - shallow-clone: true - trigger: name: 'daily-trigger-disabled' triggers: diff --git a/jjb/joid/joid-daily-jobs.yml b/jjb/joid/joid-daily-jobs.yml index 8c69c8310..7dc718950 100644 --- a/jjb/joid/joid-daily-jobs.yml +++ b/jjb/joid/joid-daily-jobs.yml @@ -78,7 +78,7 @@ - 'k8-nosdn-nofeature-noha': auto-trigger-name: 'joid-{scenario}-{pod}-{stream}-trigger' - 'k8-nosdn-lb-noha': - auto-trigger-name: 'daily-trigger-disabled' + auto-trigger-name: 'joid-{scenario}-{pod}-{stream}-trigger' jobs: - 'joid-{scenario}-{pod}-daily-{stream}' @@ -163,17 +163,17 @@ # i.e. one tempest smoke ipv6, two vping from functest) # 4.not used for release criteria or compliance, # only to debug the dovetail tool bugs with joid - - trigger-builds: - - project: 'dovetail-joid-{pod}-debug-{stream}' - current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} - block: true - same-node: true - block-thresholds: - build-step-failure-threshold: 'never' - failure-threshold: 'never' - unstable-threshold: 'FAILURE' + #- trigger-builds: + # - project: 'dovetail-joid-{pod}-debug-{stream}' + # current-parameters: false + # predefined-parameters: + # DEPLOY_SCENARIO={scenario} + # block: true + # same-node: true + # block-thresholds: + # build-step-failure-threshold: 'never' + # failure-threshold: 'never' + # unstable-threshold: 'FAILURE' - job-template: name: 'joid-deploy-{pod}-daily-{stream}' diff --git a/jjb/kvmfornfv/kvmfornfv.yml b/jjb/kvmfornfv/kvmfornfv.yml index a782ee0fa..78ec32b85 100644 --- a/jjb/kvmfornfv/kvmfornfv.yml +++ b/jjb/kvmfornfv/kvmfornfv.yml @@ -79,6 +79,10 @@ branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' + disable-strict-forbidden-file-verification: 'true' + forbidden-file-paths: + - compare-type: ANT + pattern: 'docs/**|.gitignore' builders: - description-setter: diff --git a/jjb/opnfvdocs/opnfvdocs.yml b/jjb/opnfvdocs/opnfvdocs.yml index 0553cd436..fc825ff64 100644 --- a/jjb/opnfvdocs/opnfvdocs.yml +++ b/jjb/opnfvdocs/opnfvdocs.yml @@ -8,8 +8,8 @@ project: '{name}' jobs: - - 'opnfvdocs-verify-{stream}' - - 'opnfvdocs-merge-{stream}' + - 'opnfvdocs-verify-shellcheck-{stream}' + - 'opnfvdocs-merge-shellcheck-{stream}' - 'opnfvdocs-daily-{stream}' stream: @@ -27,7 +27,7 @@ ######################## - job-template: - name: 'opnfvdocs-verify-{stream}' + name: 'opnfvdocs-verify-shellcheck-{stream}' disabled: '{obj:disabled}' @@ -72,7 +72,7 @@ - check-bash-syntax - job-template: - name: 'opnfvdocs-merge-{stream}' + name: 'opnfvdocs-merge-shellcheck-{stream}' disabled: '{obj:disabled}' diff --git a/jjb/qtip/helpers/cleanup-deploy.sh b/jjb/qtip/helpers/cleanup-deploy.sh index 95babb318..9cb19a583 100644 --- a/jjb/qtip/helpers/cleanup-deploy.sh +++ b/jjb/qtip/helpers/cleanup-deploy.sh @@ -7,20 +7,15 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## # Remove previous running containers if exist -if [[ ! -z $(docker ps -a | grep opnfv/qtip) ]]; then +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 | awk '{print $1}') + docker rm -f $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG" | awk '{print $1}') fi # Remove existing images if exist -if [[ ! -z $(docker images | grep opnfv/qtip) ]]; then - echo "Docker images to remove:" - docker images | head -1 && docker images | grep opnfv/qtip - image_tags=($(docker images | grep opnfv/qtip | awk '{print $2}')) - for tag in "${image_tags[@]}"; do - echo "Removing docker image opnfv/qtip:$tag..." - docker rmi opnfv/qtip:$tag - done +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/jjb/qtip/helpers/validate-deploy.sh b/jjb/qtip/helpers/validate-deploy.sh index a73e33c2c..9f3dbe414 100644 --- a/jjb/qtip/helpers/validate-deploy.sh +++ b/jjb/qtip/helpers/validate-deploy.sh @@ -10,7 +10,10 @@ 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" @@ -21,7 +24,24 @@ echo "--------------------------------------------------------" echo "Qtip: Pulling docker image: opnfv/qtip:${DOCKER_TAG}" docker pull opnfv/qtip:$DOCKER_TAG -cmd=" docker run -id -e $envs opnfv/qtip:${DOCKER_TAG} /bin/bash" +# 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} @@ -32,6 +52,7 @@ if [ $(docker ps | grep 'opnfv/qtip' | wc -l) == 0 ]; then 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" diff --git a/jjb/qtip/qtip-validate-jobs.yml b/jjb/qtip/qtip-validate-jobs.yml index e1b71f516..8dd97de1d 100644 --- a/jjb/qtip/qtip-validate-jobs.yml +++ b/jjb/qtip/qtip-validate-jobs.yml @@ -95,9 +95,10 @@ name: qtip-validate-deploy builders: - shell: - !include-raw: ./helpers/validate-deploy.sh - - shell: !include-raw: ./helpers/cleanup-deploy.sh + - shell: + !include-raw: ./helpers/validate-deploy.sh + #----------- # parameter diff --git a/jjb/xci/bifrost-verify-jobs.yml b/jjb/xci/bifrost-verify-jobs.yml index 33032bc7b..2fa99b290 100644 --- a/jjb/xci/bifrost-verify-jobs.yml +++ b/jjb/xci/bifrost-verify-jobs.yml @@ -53,11 +53,14 @@ # VM defaults #-------------------------------- - defaults: - name: vm_defaults + name: verify_vm_defaults + test-vm-num-nodes: '3' + test-vm-node-names: 'xcimaster controller00 compute00' + vm-domain-type: 'kvm' + vm-cpu: '2' vm-disk: '30' + vm-memory-size: '4096' vm-disk-cache: 'unsafe' - vm-memory: '4096' - vm-cpu: '2' #-------------------------------- # job templates @@ -67,7 +70,7 @@ disabled: '{obj:disabled}' - defaults: vm_defaults + defaults: verify_vm_defaults concurrent: false @@ -105,18 +108,27 @@ name: DIB_OS_PACKAGES default: '{dib-os-packages}' - string: - name: VM_DISK - default: '{vm-disk}' + name: TEST_VM_NUM_NODES + default: '{test-vm-num-nodes}' - string: - name: VM_DISK_CACHE - default: '{vm-disk-cache}' + name: TEST_VM_NODE_NAMES + default: '{test-vm-node-names}' - string: - name: VM_MEMORY - default: '{vm-memory}' + name: VM_DOMAIN_TYPE + default: '{vm-domain-type}' - string: name: VM_CPU default: '{vm-cpu}' - string: + name: VM_DISK + default: '{vm-disk}' + - string: + name: VM_MEMORY_SIZE + default: '{vm-memory-size}' + - string: + name: VM_DISK_CACHE + default: '{vm-disk-cache}' + - string: name: CLEAN_DIB_IMAGES default: 'true' - label: @@ -125,6 +137,9 @@ - string: name: BIFROST_LOG_URL default: 'http://artifacts.opnfv.org/cross-community-ci/openstack/bifrost/$GERRIT_NAME/$GERRIT_CHANGE_NUMBER/$GERRIT_PATCHSET_NUMBER/$JOB_NAME' + - string: + name: ANSIBLE_VERBOSITY + default: '-vvvv' scm: - git: @@ -145,6 +160,9 @@ - bifrost-set-name - bifrost-build + wrappers: + - bifrost-fix-perms-workspace + publishers: - email: recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com @@ -208,6 +226,17 @@ readable-message: true #--------------------------- +# wrapper macros +#--------------------------- +- wrapper: + name: bifrost-fix-perms-workspace + wrappers: + - pre-scm-buildstep: + - shell: | + #!/bin/bash + sudo chown -R $USER $WORKSPACE || exit 1 + +#--------------------------- # builder macros #--------------------------- - builder: diff --git a/jjb/xci/bifrost-verify.sh b/jjb/xci/bifrost-verify.sh index e0c50907a..782a23445 100755 --- a/jjb/xci/bifrost-verify.sh +++ b/jjb/xci/bifrost-verify.sh @@ -115,9 +115,9 @@ sudo /bin/cp -rf /opt/releng/prototypes/bifrost/* /opt/bifrost/ cd /opt/bifrost sudo -E ./scripts/destroy-env.sh -# provision 3 VMs; jumphost, controller, and compute +# provision 3 VMs; xcimaster, controller, and compute cd /opt/bifrost -sudo -E ./scripts/test-bifrost-deployment.sh +sudo -E ./scripts/bifrost-provision.sh # list the provisioned VMs cd /opt/bifrost diff --git a/jjb/xci/xci-daily-jobs.yml b/jjb/xci/xci-daily-jobs.yml index c685aa974..dbe3b654b 100644 --- a/jjb/xci/xci-daily-jobs.yml +++ b/jjb/xci/xci-daily-jobs.yml @@ -3,15 +3,22 @@ #-------------------------------- # BRANCH ANCHORS #-------------------------------- +# the versions stated here default to branches which then later +# on used for checking out the branches, pulling in head of the branch. +# but they also allow us to state sha1 so instead of checking out the +# branches, we can check out sha1 if we want to use locked/specific +# sha1 or manually enter sha1. master: &master stream: master - openstack-branch: '{stream}' - opnfv-branch: 'master' + openstack-osa-version: '{stream}' + openstack-bifrost-version: '{stream}' + opnfv-releng-version: 'master' gs-pathname: '' ocata: &ocata stream: ocata - openstack-branch: 'stable/{stream}' - opnfv-branch: 'master' + openstack-osa-version: 'stable/{stream}' + openstack-bifrost-version: 'stable/{stream}' + opnfv-releng-version: 'master' gs-pathname: '/{stream}' #-------------------------------- # scenarios @@ -53,6 +60,7 @@ dib-os-element: 'opensuse-minimal' dib-os-packages: 'vim,less,bridge-utils,iputils,rsyslog,curl' extra-dib-elements: 'openssh-server' + #-------------------------------- # Phases #-------------------------------- @@ -68,6 +76,19 @@ - 'xci-{phase}-{pod}-{distro}-daily-{stream}' #-------------------------------- +# VM defaults +#-------------------------------- +- defaults: + name: daily_vm_defaults + test-vm-num-nodes: '6' + test-vm-node-names: 'xcimaster controller00 controller01 controller02 compute00 compute01' + vm-domain-type: 'kvm' + vm-cpu: '8' + vm-disk: '100' + vm-memory-size: '16384' + vm-disk-cache: 'unsafe' + +#-------------------------------- # job templates #-------------------------------- - job-template: @@ -78,15 +99,27 @@ concurrent: false properties: - - logrotate-default - build-blocker: use-build-blocker: true blocking-jobs: - - 'xci-os-.*?-{pod}-daily-.*' + - '^xci-os.*' block-level: 'NODE' + - logrotate-default parameters: - string: + name: OPENSTACK_OSA_VERSION + default: '{openstack-osa-version}' + - string: + name: OPENSTACK_BIFROST_VERSION + default: '{openstack-osa-version}' + - string: + name: OPNFV_RELENG_VERSION + default: '{opnfv-releng-version}' + - string: + name: USE_PROMOTED_VERSIONS + default: 'true' + - string: name: DEPLOY_SCENARIO default: '{scenario}' - label: @@ -96,28 +129,43 @@ triggers: - '{auto-trigger-name}' + wrappers: + - xci-fix-perms-workspace + builders: - description-setter: description: "Built on $NODE_NAME" - trigger-builds: - project: 'xci-provision-{pod}-{distro}-daily-{stream}' current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} + predefined-parameters: | + OPENSTACK_OSA_VERSION=$OPENSTACK_OSA_VERSION + OPENSTACK_BIFROST_VERSION=$OPENSTACK_BIFROST_VERSION + OPNFV_RELENG_VERSION=$OPNFV_RELENG_VERSION + USE_PROMOTED_VERSIONS=$USE_PROMOTED_VERSIONS + DEPLOY_SCENARIO=$DEPLOY_SCENARIO same-node: true block: true - trigger-builds: - project: 'xci-deploy-{pod}-{distro}-daily-{stream}' current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} + predefined-parameters: | + OPENSTACK_OSA_VERSION=$OPENSTACK_OSA_VERSION + OPENSTACK_BIFROST_VERSION=$OPENSTACK_BIFROST_VERSION + OPNFV_RELENG_VERSION=$OPNFV_RELENG_VERSION + USE_PROMOTED_VERSIONS=$USE_PROMOTED_VERSIONS + DEPLOY_SCENARIO=$DEPLOY_SCENARIO same-node: true block: true - trigger-builds: - project: 'xci-functest-{pod}-{distro}-daily-{stream}' current-parameters: false - predefined-parameters: - DEPLOY_SCENARIO={scenario} + predefined-parameters: | + OPENSTACK_OSA_VERSION=$OPENSTACK_OSA_VERSION + OPENSTACK_BIFROST_VERSION=$OPENSTACK_BIFROST_VERSION + OPNFV_RELENG_VERSION=$OPNFV_RELENG_VERSION + USE_PROMOTED_VERSIONS=$USE_PROMOTED_VERSIONS + DEPLOY_SCENARIO=$DEPLOY_SCENARIO same-node: true block: true block-thresholds: @@ -134,25 +182,30 @@ disabled: '{obj:disabled}' + defaults: daily_vm_defaults + concurrent: false properties: - - logrotate-default - build-blocker: use-build-blocker: true blocking-jobs: - - 'xci-provision-.*?-{pod}-daily-.*' - - 'xci-deploy-.*?-{pod}-daily-.*' - - 'xci-functest-.*?-{pod}-daily-.*' + - '^xci-provision.*' + - '^xci-deploy.*' + - '^xci-functest.*' block-level: 'NODE' + - logrotate-default parameters: - string: - name: OPENSTACK_BRANCH - default: '{openstack-branch}' + name: OPENSTACK_OSA_VERSION + default: '{openstack-osa-version}' + - string: + name: OPENSTACK_BIFROST_VERSION + default: '{openstack-osa-version}' - string: - name: OPNFV_BRANCH - default: '{opnfv-branch}' + name: OPNFV_RELENG_VERSION + default: '{opnfv-releng-version}' - string: name: USE_PROMOTED_VERSIONS default: 'true' @@ -175,13 +228,55 @@ name: DIB_OS_PACKAGES default: '{dib-os-packages}' - string: + name: TEST_VM_NUM_NODES + default: '{test-vm-num-nodes}' + - string: + name: TEST_VM_NODE_NAMES + default: '{test-vm-node-names}' + - string: + name: VM_DOMAIN_TYPE + default: '{vm-domain-type}' + - string: + name: VM_CPU + default: '{vm-cpu}' + - string: + name: VM_DISK + default: '{vm-disk}' + - string: + name: VM_MEMORY_SIZE + default: '{vm-memory-size}' + - string: + name: VM_DISK_CACHE + default: '{vm-disk-cache}' + - string: name: CLEAN_DIB_IMAGES default: 'true' + - label: + name: SLAVE_LABEL + default: '{slave-label}' + - string: + name: ANSIBLE_VERBOSITY + default: '' + + wrappers: + - xci-fix-perms-workspace builders: - description-setter: description: "Built on $NODE_NAME - Scenario: $DEPLOY_SCENARIO" - 'xci-{phase}-builder' + +#--------------------------- +# wrapper macros +#--------------------------- +- wrapper: + name: xci-fix-perms-workspace + wrappers: + - pre-scm-buildstep: + - shell: | + #!/bin/bash + sudo chown -R $USER $WORKSPACE || exit 1 + #--------------------------- # builder macros #--------------------------- diff --git a/jjb/xci/xci-deploy.sh b/jjb/xci/xci-deploy.sh index b97b24e47..87f9ec8db 100755 --- a/jjb/xci/xci-deploy.sh +++ b/jjb/xci/xci-deploy.sh @@ -1,3 +1,93 @@ #!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB 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 -o errexit +set -o nounset +set -o pipefail -echo "Deployment via openstack-ansible" +trap cleanup_and_upload EXIT + +function fix_ownership() { + if [ -z "${JOB_URL+x}" ]; then + echo "Not running as part of Jenkins. Handle the logs manually." + else + # Make sure cache exists + [[ ! -d ${HOME}/.cache ]] && mkdir ${HOME}/.cache + + sudo chown -R jenkins:jenkins $WORKSPACE + sudo chown -R jenkins:jenkins ${HOME}/.cache + fi +} + +function cleanup_and_upload() { + original_exit=$? + fix_ownership + exit $original_exit +} + +# check distro to see if we support it +if [[ ! "$DISTRO" =~ (xenial|centos7|suse) ]]; then + echo "Distro $DISTRO is not supported!" + exit 1 +fi + +# remove previously cloned repos +sudo /bin/rm -rf /opt/openstack-ansible /opt/stack /opt/releng /opt/functest + +# Fix up permissions +fix_ownership + +# openstack-ansible enables strict host key checking by default +export ANSIBLE_HOST_KEY_CHECKING=False + +# ensure the versions to checkout are set +export OPENSTACK_OSA_VERSION=${OPENSTACK_OSA_VERSION:-master} +export OPNFV_RELENG_VERSION=${OPNFV_RELENG_VERSION:-master} + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Deploy OpenStack *" +echo "* *" +echo " openstack-ansible version: $OPENSTACK_OSA_VERSION" +echo " releng version: $OPNFV_RELENG_VERSION" +echo "* *" +echo "***********************************************************************" +echo -e "\n" +# clone releng repo +sudo git clone --quiet https://gerrit.opnfv.org/gerrit/releng /opt/releng +cd /opt/releng && sudo git checkout --quiet $OPNFV_RELENG_VERSION +echo "xci: using openstack-ansible commit" +git show --oneline -s --pretty=format:'%h - %s (%cr) <%an>' + +# display the nodes +echo "xci: OpenStack nodes" +cd /opt/bifrost +source env-vars +ironic node-list + +# this script will be reused for promoting openstack-ansible versions and using +# promoted openstack-ansible versions as part of xci daily. +USE_PROMOTED_VERSIONS=${USE_PROMOTED_VERSIONS:-false} +if [ $USE_PROMOTED_VERSIONS = "true" ]; then + echo "TBD: Will use the promoted versions of openstack/opnfv projects" +fi + +cd /opt/releng/prototypes/openstack-ansible/scripts +sudo -E ./osa-deploy.sh + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* OpenStack deployment is completed! *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" diff --git a/jjb/xci/xci-provision.sh b/jjb/xci/xci-provision.sh index 4308c7ef8..ba447aa48 100755 --- a/jjb/xci/xci-provision.sh +++ b/jjb/xci/xci-provision.sh @@ -43,11 +43,32 @@ sudo /bin/rm -rf /opt/bifrost /opt/openstack-ansible /opt/stack /opt/releng /opt # Fix up permissions fix_ownership -# clone all the repos first and checkout the patch afterwards -OPENSTACK_BRANCH=${OPENSTACK_BRANCH:-master} -OPNFV_BRANCH=${OPNFV_BRANCH:-master} -sudo git clone -b $OPENSTACK_BRANCH https://git.openstack.org/openstack/bifrost /opt/bifrost -sudo git clone -b $OPNFV_BRANCH https://gerrit.opnfv.org/gerrit/releng /opt/releng +# ensure the versions to checkout are set +export OPENSTACK_BIFROST_VERSION=${OPENSTACK_BIFROST_VERSION:-master} +export OPNFV_RELENG_VERSION=${OPNFV_RELENG_VERSION:-master} + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Provision OpenStack Nodes *" +echo "* *" +echo " bifrost version: $OPENSTACK_BIFROST_VERSION" +echo " releng version: $OPNFV_RELENG_VERSION" +echo "* *" +echo "***********************************************************************" +echo -e "\n" + +# clone the repos and checkout the versions +sudo git clone --quiet https://git.openstack.org/openstack/bifrost /opt/bifrost +cd /opt/bifrost && sudo git checkout --quiet $OPENSTACK_BIFROST_VERSION +echo "xci: using bifrost commit" +git show --oneline -s --pretty=format:'%h - %s (%cr) <%an>' + +sudo git clone --quiet https://gerrit.opnfv.org/gerrit/releng /opt/releng +cd /opt/releng && sudo git checkout --quiet $OPNFV_RELENG_VERSION +echo "xci: using releng commit" +git show --oneline -s --pretty=format:'%h - %s (%cr) <%an>' # this script will be reused for promoting bifrost versions and using # promoted bifrost versions as part of xci daily. @@ -63,12 +84,21 @@ sudo /bin/cp -rf /opt/releng/prototypes/bifrost/* /opt/bifrost/ cd /opt/bifrost sudo -E ./scripts/destroy-env.sh -# provision 6 VMs; jumphost, controller00, controller01, controller02, compute00, and compute01 +# provision 6 VMs; xcimaster, controller00, controller01, controller02, compute00, and compute01 cd /opt/bifrost -sudo -E ./scripts/osa-bifrost-deployment.sh +sudo -E ./scripts/bifrost-provision.sh # list the provisioned VMs cd /opt/bifrost source env-vars ironic node-list virsh list + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* OpenStack nodes are provisioned! *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" diff --git a/modules/opnfv/utils/ssh_utils.py b/modules/opnfv/utils/ssh_utils.py index d17f5ae81..4c5ff5c1b 100644 --- a/modules/opnfv/utils/ssh_utils.py +++ b/modules/opnfv/utils/ssh_utils.py @@ -15,6 +15,27 @@ import paramiko from opnfv.utils import opnfv_logger as logger logger = logger.Logger("SSH utils").getLogger() +SSH_TIMEOUT = 60 + +''' Monkey Patch paramiko _custom_start_client ''' +# We are using paramiko 2.1.1 and in the CI in the SFC +# test we are facing this issue: +# https://github.com/robotframework/SSHLibrary/issues/158 +# The fix was merged in paramiko 2.1.3 in this PR: +# https://github.com/robotframework/SSHLibrary/pull/159/files +# Until we upgrade we can use this monkey patch to work +# around the issue + + +def _custom_start_client(self, *args, **kwargs): + self.banner_timeout = 45 + self._orig_start_client(*args, **kwargs) + + +paramiko.transport.Transport._orig_start_client = \ + paramiko.transport.Transport.start_client +paramiko.transport.Transport.start_client = _custom_start_client +''' Monkey Patch paramiko _custom_start_client ''' def get_ssh_client(hostname, @@ -40,11 +61,13 @@ def get_ssh_client(hostname, client.load_system_host_keys() client.connect(hostname, username=username, - pkey=key) + pkey=key, + timeout=SSH_TIMEOUT) else: client.connect(hostname, username=username, - password=password) + password=password, + timeout=SSH_TIMEOUT) return client except Exception as e: @@ -96,7 +119,8 @@ class ProxyHopClient(paramiko.SSHClient): self.proxy_ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.proxy_ssh.connect(jh_ip, username=jh_user, - password=jh_pass) + password=jh_pass, + timeout=SSH_TIMEOUT) self.proxy_transport = self.proxy_ssh.get_transport() def connect(self, hostname, port=22, username='root', password=None, @@ -126,7 +150,8 @@ class ProxyHopClient(paramiko.SSHClient): super(ProxyHopClient, self).connect(hostname, username=username, pkey=proxy_key, - sock=self.proxy_channel) + sock=self.proxy_channel, + timeout=timeout) os.remove(self.local_ssh_key) except Exception as e: logger.error(e) diff --git a/prototypes/bifrost/README.md b/prototypes/bifrost/README.md index 0ba49d46d..dc1417a86 100644 --- a/prototypes/bifrost/README.md +++ b/prototypes/bifrost/README.md @@ -31,7 +31,7 @@ Please follow that steps: cd /opt/bifrost sudo ./scripts/destroy-env.sh -8. Run deployment script to spin up 3 vms with bifrost: jumphost, controller and compute:: +8. Run deployment script to spin up 3 vms with bifrost: xcimaster, controller and compute:: cd /opt/bifrost sudo ./scripts/test-bifrost-deployment.sh diff --git a/prototypes/bifrost/playbooks/inventory/group_vars/baremetal b/prototypes/bifrost/playbooks/inventory/group_vars/baremetal new file mode 100644 index 000000000..008b04d11 --- /dev/null +++ b/prototypes/bifrost/playbooks/inventory/group_vars/baremetal @@ -0,0 +1,53 @@ +--- +# The ironic API URL for bifrost operations. Defaults to localhost. +# ironic_url: "http://localhost:6385/" + +# The network interface that bifrost will be operating on. Defaults +# to virbr0 in roles, can be overridden here. +# network_interface: "virbr0" + +# The path to the SSH key to be utilized for testing and burn-in +# to configuration drives. When set, it should be set in both baremetal +# and localhost groups, however this is only an override to the default. + +# workaround for opnfv ci until we can fix non-root use +ssh_public_key_path: "/root/.ssh/id_rsa.pub" + +# Normally this user should be root, however if cirros is used, +# a user may wish to define a specific user for testing VM +# connectivity during a test sequence +testing_user: root + +# The default port to download files via. Required for IPA URL generation. +# Presently the defaults are located in the roles, however if changed both +# the localhost and baremetal group files must be updated. +# file_url_port: 8080 + +# IPA Image parameters. If these are changed, they must be changed in +# Both localhost and baremetal groups. Presently the defaults +# in each role should be sufficent for proper operation. +# ipa_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz" +# ipa_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image-oem.cpio.gz" +# ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe.vmlinuz" +# ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe_image-oem.cpio.gz" + +# The http_boot_folder defines the root folder for the webserver. +# If this setting is changed, it must be applied to both the baremetal +# and localhost groups. Presently the role defaults are set to the value +# below. +# http_boot_folder: /httpboot + +# The settings for the name of the image to be deployed along with the +# on disk location are below. If changed, these settings must be applied +# to both the baremetal and localhost groups. If the file is already on +# disk, then the image generation will not take place, otherwise an image +# will be generated using diskimage-builder. +# deploy_image_filename: "deployment_image.qcow2" +# deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" + +# Under normal circumstances, the os_ironic_node module does not wait for +# the node to reach active state before continuing with the deployment +# process. This means we may have to timeout, to figure out a deployment +# failed. Change wait_for_node_deploy to true to cause bifrost to wait for +# Ironic to show the instance in Active state. +wait_for_node_deploy: false diff --git a/prototypes/bifrost/scripts/test-bifrost-deployment.sh b/prototypes/bifrost/scripts/bifrost-provision.sh index 2e33bc164..2814808f0 100755 --- a/prototypes/bifrost/scripts/test-bifrost-deployment.sh +++ b/prototypes/bifrost/scripts/bifrost-provision.sh @@ -7,43 +7,45 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## - set -eux set -o pipefail + export PYTHONUNBUFFERED=1 SCRIPT_HOME="$(cd "$(dirname "$0")" && pwd)" BIFROST_HOME=$SCRIPT_HOME/.. ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack} +ANSIBLE_VERBOSITY=${ANSIBLE_VERBOSITY-"-vvvv"} ENABLE_VENV="false" USE_DHCP="false" USE_VENV="false" BUILD_IMAGE=true -export BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} -export BIFROST_INVENTORY_SOURCE=${BIFROST_INVENTORY_SOURCE:-'/tmp/baremetal.csv'} PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} -# Set defaults for ansible command-line options to drive the different -# tests. - -# NOTE(TheJulia/cinerama): The variables defined on the command line -# for the default and DHCP tests are to drive the use of Cirros as the -# deployed operating system, and as such sets the test user to cirros, -# and writes a debian style interfaces file out to the configuration -# drive as cirros does not support the network_info.json format file -# placed in the configuration drive. The "build image" test does not -# use cirros. +# Ensure the right inventory files is used based on branch +CURRENT_BIFROST_BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [ $CURRENT_BIFROST_BRANCH = "master" ]; then + BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} + INVENTORY_FILE_FORMAT="baremetal_json_file" +else + BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.csv'} + INVENTORY_FILE_FORMAT="baremetal_csv_file" +fi +export BIFROST_INVENTORY_SOURCE=$BAREMETAL_DATA_FILE -TEST_VM_NUM_NODES=3 -export TEST_VM_NODE_NAMES="jumphost.opnfvlocal controller00.opnfvlocal compute00.opnfvlocal" -export VM_DOMAIN_TYPE="kvm" +# Default settings for VMs +export TEST_VM_NUM_NODES=${TEST_VM_NUM_NODES:-3} +export TEST_VM_NODE_NAMES=${TEST_VM_NODE_NAMES:-"xcimaster controller00 compute00"} +export VM_DOMAIN_TYPE=${VM_DOMAIN_TYPE:-kvm} export VM_CPU=${VM_CPU:-4} export VM_DISK=${VM_DISK:-100} +export VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-8192} export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe} + +# Settings for bifrost TEST_PLAYBOOK="opnfv-virtual.yaml" USE_INSPECTOR=true USE_CIRROS=false TESTING_USER=root -VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-8192} DOWNLOAD_IPA=true CREATE_IPA_IMAGE=false INSPECT_NODES=true @@ -51,27 +53,21 @@ INVENTORY_DHCP=false INVENTORY_DHCP_STATIC_IP=false WRITE_INTERFACES_FILE=true -# Set BIFROST_INVENTORY_SOURCE -export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json - -# settings for console access +# Settings for console access export DIB_DEV_USER_PWDLESS_SUDO=yes export DIB_DEV_USER_PASSWORD=devuser -# settings for distro: trusty/ubuntu-minimal, 7/centos7 +# Settings for distro: trusty/ubuntu-minimal, 7/centos7, 42.2/suse export DIB_OS_RELEASE=${DIB_OS_RELEASE:-trusty} export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal} -# for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl" +# DIB OS packages export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl"} # Additional dib elements export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} # Source Ansible -# NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep -# under the hood which -x will detect, so for this step, we need to suspend -# and then re-enable the feature. set +x +o nounset $SCRIPT_HOME/env-setup.sh source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup @@ -88,29 +84,29 @@ cd $BIFROST_HOME/playbooks # Syntax check of dynamic inventory test path for task in syntax-check list-tasks; do - ${ANSIBLE} -vvvv \ + ${ANSIBLE} ${ANSIBLE_VERBOSITY} \ -i inventory/localhost \ test-bifrost-create-vm.yaml \ --${task} - ${ANSIBLE} -vvvv \ + ${ANSIBLE} ${ANSIBLE_VERBOSITY} \ -i inventory/localhost \ ${TEST_PLAYBOOK} \ --${task} \ -e testing_user=${TESTING_USER} done -# Create the test VMS -${ANSIBLE} -vvvv \ +# Create the VMS +${ANSIBLE} ${ANSIBLE_VERBOSITY} \ -i inventory/localhost \ test-bifrost-create-vm.yaml \ -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ -e test_vm_memory_size=${VM_MEMORY_SIZE} \ -e enable_venv=${ENABLE_VENV} \ -e test_vm_domain_type=${VM_DOMAIN_TYPE} \ - -e baremetal_json_file=${BAREMETAL_DATA_FILE} + -e ${INVENTORY_FILE_FORMAT}=${BAREMETAL_DATA_FILE} -# Execute the installation and VM startup test. -${ANSIBLE} -vvvv \ +# Execute the installation and VM startup test +${ANSIBLE} ${ANSIBLE_VERBOSITY} \ -i inventory/bifrost_inventory.py \ ${TEST_PLAYBOOK} \ -e use_cirros=${USE_CIRROS} \ @@ -129,9 +125,9 @@ ${ANSIBLE} -vvvv \ EXITCODE=$? if [ $EXITCODE != 0 ]; then - echo "****************************" - echo "Test failed. See logs folder" - echo "****************************" + echo "************************************" + echo "Provisioning failed. See logs folder" + echo "************************************" fi exit $EXITCODE diff --git a/prototypes/bifrost/scripts/osa-bifrost-deployment.sh b/prototypes/bifrost/scripts/osa-bifrost-deployment.sh deleted file mode 100755 index c92bd9d4e..000000000 --- a/prototypes/bifrost/scripts/osa-bifrost-deployment.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2016 Ericsson AB 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 -eux -set -o pipefail -export PYTHONUNBUFFERED=1 -SCRIPT_HOME="$(cd "$(dirname "$0")" && pwd)" -BIFROST_HOME=$SCRIPT_HOME/.. -ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack} -ENABLE_VENV="false" -USE_DHCP="false" -USE_VENV="false" -BUILD_IMAGE=true -export BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} -export BIFROST_INVENTORY_SOURCE=${BIFROST_INVENTORY_SOURCE:-'/tmp/baremetal.csv'} -PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} - -# Set defaults for ansible command-line options to drive the different -# tests. - -# NOTE(TheJulia/cinerama): The variables defined on the command line -# for the default and DHCP tests are to drive the use of Cirros as the -# deployed operating system, and as such sets the test user to cirros, -# and writes a debian style interfaces file out to the configuration -# drive as cirros does not support the network_info.json format file -# placed in the configuration drive. The "build image" test does not -# use cirros. - -TEST_VM_NUM_NODES=6 -export TEST_VM_NODE_NAMES="jumphost controller00 controller01 controller02 compute00 compute01" -export VM_DOMAIN_TYPE="kvm" -# 8 vCPU, 60 GB HDD are minimum equipment -export VM_CPU=${VM_CPU:-8} -export VM_DISK=${VM_DISK:-100} -export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe} -TEST_PLAYBOOK="opnfv-virtual.yaml" -USE_INSPECTOR=true -USE_CIRROS=false -TESTING_USER=root -# seting the memory to 16 GB to make more easily success -# 8 GB RAM is minimum equipment, but it work with at least 12 GB. -VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-16384} -DOWNLOAD_IPA=true -CREATE_IPA_IMAGE=false -INSPECT_NODES=true -INVENTORY_DHCP=false -INVENTORY_DHCP_STATIC_IP=false -WRITE_INTERFACES_FILE=true - - -# settings for console access -export DIB_DEV_USER_PWDLESS_SUDO=yes -export DIB_DEV_USER_PASSWORD=devuser - -# settings for distro: trusty/ubuntu-minimal, 7/centos7 -export DIB_OS_RELEASE=${DIB_OS_RELEASE:-xenial} -export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal} - -# for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl" -export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,sudo,language-pack-en,iputils-ping,rsyslog,curl,python,debootstrap,ifenslave,ifenslave-2.6,lsof,lvm2,tcpdump,nfs-kernel-server,chrony"} - -# Additional dib elements -export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} - -# Source Ansible -# NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep -# under the hood which -x will detect, so for this step, we need to suspend -# and then re-enable the feature. -set +x +o nounset -$SCRIPT_HOME/env-setup.sh -source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup -ANSIBLE=$(which ansible-playbook) -set -x -o nounset - -logs_on_exit() { - $SCRIPT_HOME/collect-test-info.sh -} -trap logs_on_exit EXIT - -# Change working directory -cd $BIFROST_HOME/playbooks - -# Syntax check of dynamic inventory test path -for task in syntax-check list-tasks; do - ${ANSIBLE} \ - -i inventory/localhost \ - test-bifrost-create-vm.yaml \ - --${task} - ${ANSIBLE} \ - -i inventory/localhost \ - ${TEST_PLAYBOOK} \ - --${task} \ - -e testing_user=${TESTING_USER} -done - -# Create the test VMS -${ANSIBLE} \ - -i inventory/localhost \ - test-bifrost-create-vm.yaml \ - -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ - -e test_vm_memory_size=${VM_MEMORY_SIZE} \ - -e enable_venv=${ENABLE_VENV} \ - -e test_vm_domain_type=${VM_DOMAIN_TYPE} \ - -e baremetal_json_file=${BAREMETAL_DATA_FILE} - -# Execute the installation and VM startup test. -${ANSIBLE} \ - -i inventory/bifrost_inventory.py \ - ${TEST_PLAYBOOK} \ - -e use_cirros=${USE_CIRROS} \ - -e testing_user=${TESTING_USER} \ - -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ - -e inventory_dhcp=${INVENTORY_DHCP} \ - -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \ - -e enable_venv=${ENABLE_VENV} \ - -e enable_inspector=${USE_INSPECTOR} \ - -e inspect_nodes=${INSPECT_NODES} \ - -e download_ipa=${DOWNLOAD_IPA} \ - -e create_ipa_image=${CREATE_IPA_IMAGE} \ - -e write_interfaces_file=${WRITE_INTERFACES_FILE} \ - -e ipv4_gateway=192.168.122.1 \ - -e wait_timeout=${PROVISION_WAIT_TIMEOUT} -EXITCODE=$? - -if [ $EXITCODE != 0 ]; then - echo "****************************" - echo "Test failed. See logs folder" - echo "****************************" -fi - -exit $EXITCODE diff --git a/prototypes/openstack-ansible/file/opnfv-setup-openstack.yml b/prototypes/openstack-ansible/file/opnfv-setup-openstack.yml new file mode 100644 index 000000000..aacdeffb0 --- /dev/null +++ b/prototypes/openstack-ansible/file/opnfv-setup-openstack.yml @@ -0,0 +1,34 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# 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. + +- include: os-keystone-install.yml +- include: os-glance-install.yml +- include: os-cinder-install.yml +- include: os-nova-install.yml +- include: os-neutron-install.yml +- include: os-heat-install.yml +- include: os-horizon-install.yml +- include: os-ceilometer-install.yml +- include: os-aodh-install.yml +#NOTE(stevelle) Ensure Gnocchi identities exist before Swift +- include: os-gnocchi-install.yml + when: + - gnocchi_storage_driver is defined + - gnocchi_storage_driver == 'swift' + vars: + gnocchi_identity_only: True +- include: os-swift-install.yml +- include: os-gnocchi-install.yml +- include: os-ironic-install.yml diff --git a/prototypes/openstack-ansible/playbooks/targethost_configuration.yml b/prototypes/openstack-ansible/playbooks/configure-targethosts.yml index 1f4ad063e..1f4ad063e 100644 --- a/prototypes/openstack-ansible/playbooks/targethost_configuration.yml +++ b/prototypes/openstack-ansible/playbooks/configure-targethosts.yml diff --git a/prototypes/openstack-ansible/playbooks/jumphost_configuration.yml b/prototypes/openstack-ansible/playbooks/configure-xcimaster.yml index 74e97cdd5..fbbde640c 100644 --- a/prototypes/openstack-ansible/playbooks/jumphost_configuration.yml +++ b/prototypes/openstack-ansible/playbooks/configure-xcimaster.yml @@ -1,5 +1,5 @@ --- -- hosts: jumphost +- hosts: xcimaster remote_user: root vars_files: - ../var/ubuntu.yml @@ -10,10 +10,23 @@ creates: /root/.ssh/id_rsa - name: fetch public key fetch: src="/root/.ssh/id_rsa.pub" dest="/" - - name: remove the directory - shell: "rm -rf {{OSA_PATH}} {{OSA_ETC_PATH}}" - - name: git openstack ansible - shell: "git clone {{OSA_URL}} {{OSA_PATH}} -b {{OSA_BRANCH}}" + - name: remove openstack-ansible directories + file: + path={{ item }} + state=absent + recurse=no + with_items: + - "{{OSA_PATH}}" + - "{{OSA_ETC_PATH}}" + - name: clone openstack-ansible + git: + repo: "{{OSA_URL}}" + dest: "{{OSA_PATH}}" + version: "{{OPENSTACK_OSA_VERSION}}" + - name: copy opnfv-setup-openstack.yml to /opt/openstack-ansible/playbooks + copy: + src: ../file/opnfv-setup-openstack.yml + dest: "{{OSA_PATH}}/playbooks/opnfv-setup-openstack.yml" - name: copy /opt/openstack-ansible/etc/openstack_deploy to /etc/openstack_deploy shell: "/bin/cp -rf {{OSA_PATH}}/etc/openstack_deploy {{OSA_ETC_PATH}}" - name: bootstrap @@ -50,4 +63,4 @@ remote_user: root tasks: - name: Generate authorized_keys - shell: "/bin/cat /jumphost/root/.ssh/id_rsa.pub >> ../file/authorized_keys" + shell: "/bin/cat /xcimaster/root/.ssh/id_rsa.pub >> ../file/authorized_keys" diff --git a/prototypes/openstack-ansible/playbooks/inventory b/prototypes/openstack-ansible/playbooks/inventory index f53da5305..d3768f51c 100644 --- a/prototypes/openstack-ansible/playbooks/inventory +++ b/prototypes/openstack-ansible/playbooks/inventory @@ -1,5 +1,5 @@ -[jumphost] -jumphost ansible_ssh_host=192.168.122.2 +[xcimaster] +xcimaster ansible_ssh_host=192.168.122.2 [controller] controller00 ansible_ssh_host=192.168.122.3 diff --git a/prototypes/openstack-ansible/scripts/osa-deploy.sh b/prototypes/openstack-ansible/scripts/osa-deploy.sh new file mode 100755 index 000000000..ec607443b --- /dev/null +++ b/prototypes/openstack-ansible/scripts/osa-deploy.sh @@ -0,0 +1,136 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Huawei Technologies Co.,Ltd 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 -o errexit +set -o nounset +set -o pipefail + +export OSA_PATH=/opt/openstack-ansible +export LOG_PATH=$OSA_PATH/log +export PLAYBOOK_PATH=$OSA_PATH/playbooks +export OSA_BRANCH=${OSA_BRANCH:-"master"} +XCIMASTER_IP="192.168.122.2" + +sudo /bin/rm -rf $LOG_PATH +sudo /bin/mkdir -p $LOG_PATH +sudo /bin/cp /root/.ssh/id_rsa.pub ../file/authorized_keys +echo -e '\n' | sudo tee --append ../file/authorized_keys + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Configure XCI Master *" +echo "* *" +echo "* Bootstrap xci-master, configure network, clone openstack-ansible *" +echo "* Playbooks: configure-xcimaster.yml *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" + +cd ../playbooks/ +# this will prepare the jump host +# git clone the Openstack-Ansible, bootstrap and configure network +echo "xci: running ansible playbook configure-xcimaster.yml" +sudo -E ansible-playbook -i inventory configure-xcimaster.yml + +echo "XCI Master is configured successfully!" + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Configure Nodes *" +echo "* *" +echo "* Configure network on OpenStack Nodes, configure NFS *" +echo "* Playbooks: configure-targethosts.yml *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" + +# this will prepare the target host +# such as configure network and NFS +echo "xci: running ansible playbook configure-targethosts.yml" +sudo -E ansible-playbook -i inventory configure-targethosts.yml + +echo "Nodes are configured successfully!" + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Set Up OpenStack Nodes *" +echo "* *" +echo "* Set up OpenStack Nodes using openstack-ansible *" +echo "* Playbooks: setup-hosts.yml, setup-infrastructure.yml *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" + +# using OpenStack-Ansible deploy the OpenStack +echo "xci: running ansible playbook setup-hosts.yml" +sudo -E /bin/sh -c "ssh root@$XCIMASTER_IP openstack-ansible \ + $PLAYBOOK_PATH/setup-hosts.yml" | \ + tee $LOG_PATH/setup-hosts.log + +# check the result of openstack-ansible setup-hosts.yml +# if failed, exit with exit code 1 +if grep -q 'failed=1\|unreachable=1' $LOG_PATH/setup-hosts.log; then + echo "OpenStack node setup failed!" + exit 1 +fi + +echo "xci: running ansible playbook setup-infrastructure.yml" +sudo -E /bin/sh -c "ssh root@$XCIMASTER_IP openstack-ansible \ + $PLAYBOOK_PATH/setup-infrastructure.yml" | \ + tee $LOG_PATH/setup-infrastructure.log + +# check the result of openstack-ansible setup-infrastructure.yml +# if failed, exit with exit code 1 +if grep -q 'failed=1\|unreachable=1' $LOG_PATH/setup-infrastructure.log; then + echo "OpenStack node setup failed!" + exit 1 +fi + +echo "OpenStack nodes are setup successfully!" + +sudo -E /bin/sh -c "ssh root@$XCIMASTER_IP ansible -i $PLAYBOOK_PATH/inventory/ \ + galera_container -m shell \ + -a "mysql -h localhost -e 'show status like \"%wsrep_cluster_%\";'"" \ + | tee $LOG_PATH/galera.log + +if grep -q 'FAILED' $LOG_PATH/galera.log; then + echo "Database cluster verification failed!" + exit 1 +else + echo "Database cluster verification successful!" +fi + +# log some info +echo -e "\n" +echo "***********************************************************************" +echo "* *" +echo "* Install OpenStack *" +echo "* Playbooks: opnfv-setup-openstack.yml *" +echo "* *" +echo "***********************************************************************" +echo -e "\n" + +echo "xci: running ansible playbook opnfv-setup-openstack.yml" +sudo -E /bin/sh -c "ssh root@$XCIMASTER_IP openstack-ansible \ + $PLAYBOOK_PATH/opnfv-setup-openstack.yml" | \ + tee $LOG_PATH/opnfv-setup-openstack.log + +if grep -q 'failed=1\|unreachable=1' $LOG_PATH/opnfv-setup-openstack.log; then + echo "OpenStack installation failed!" + exit 1 +else + echo "OpenStack installation is successfully completed!" + exit 0 +fi diff --git a/prototypes/openstack-ansible/scripts/osa_deploy.sh b/prototypes/openstack-ansible/scripts/osa_deploy.sh deleted file mode 100755 index 79625d211..000000000 --- a/prototypes/openstack-ansible/scripts/osa_deploy.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -export OSA_PATH=/opt/openstack-ansible -export LOG_PATH=$OSA_PATH/log -export PLAYBOOK_PATH=$OSA_PATH/playbooks -export OSA_BRANCH=${OSA_BRANCH:-"master"} -JUMPHOST_IP="192.168.122.2" - -sudo /bin/rm -rf $LOG_PATH -sudo /bin/mkdir -p $LOG_PATH -sudo /bin/cp /root/.ssh/id_rsa.pub ../file/authorized_keys -sudo echo -e '\n'>>../file/authorized_keys - -cd ../playbooks/ -# this will prepare the jump host -# git clone the Openstack-Ansible, bootstrap and configure network -sudo ansible-playbook -i inventory jumphost_configuration.yml -vvv - -# this will prepare the target host -# such as configure network and NFS -sudo ansible-playbook -i inventory targethost_configuration.yml - -# using OpenStack-Ansible deploy the OpenStack - -echo "set UP Host !" -sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \ - $PLAYBOOK_PATH/setup-hosts.yml" | \ - tee $LOG_PATH/setup-host.log - -#check the result of openstack-ansible setup-hosts.yml -#if failed, exit with exit code 1 -grep "failed=1" $LOG_PATH/setup-host.log>/dev/null \ - || grep "unreachable=1" $LOG_PATH/setup-host.log>/dev/null -if [ $? -eq 0 ]; then - echo "failed setup host!" - exit 1 -else - echo "setup host successfully!" -fi - -echo "Set UP Infrastructure !" -sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \ - $PLAYBOOK_PATH/setup-infrastructure.yml" | \ - tee $LOG_PATH/setup-infrastructure.log - -grep "failed=1" $LOG_PATH/setup-infrastructure.log>/dev/null \ - || grep "unreachable=1" $LOG_PATH/setup-infrastructure.log>/dev/null -if [ $? -eq 0 ]; then - echo "failed setup infrastructure!" - exit 1 -else - echo "setup infrastructure successfully!" -fi - -sudo /bin/sh -c "ssh root@$JUMPHOST_IP ansible -i $PLAYBOOK_PATH/inventory/ \ - galera_container -m shell \ - -a "mysql -h localhost -e 'show status like \"%wsrep_cluster_%\";'"" \ - | tee $LOG_PATH/galera.log - -grep "FAILED" $LOG_PATH/galera.log>/dev/null -if [ $? -eq 0 ]; then - echo "failed verify the database cluster!" - exit 1 -else - echo "verify the database cluster successfully!" -fi - -echo "Set UP OpenStack !" -sudo /bin/sh -c "ssh root@$JUMPHOST_IP openstack-ansible \ - $PLAYBOOK_PATH/setup-openstack.yml" | \ - tee $LOG_PATH/setup-openstack.log - -grep "failed=1" $LOG_PATH/setup-openstack.log>/dev/null \ - || grep "unreachable=1" $LOG_PATH/setup-openstack.log>/dev/null -if [ $? -eq 0 ]; then - echo "failed setup openstack!" - exit 1 -else - echo "OpenStack successfully deployed!" - exit 0 -fi diff --git a/prototypes/openstack-ansible/var/ubuntu.yml b/prototypes/openstack-ansible/var/ubuntu.yml index 9464384b3..eb595beaa 100644 --- a/prototypes/openstack-ansible/var/ubuntu.yml +++ b/prototypes/openstack-ansible/var/ubuntu.yml @@ -2,7 +2,7 @@ OSA_URL: https://git.openstack.org/openstack/openstack-ansible OSA_PATH: /opt/openstack-ansible OSA_ETC_PATH: /etc/openstack_deploy -OSA_BRANCH: "{{ lookup('env','OSA_BRANCH') }}" +OPENSTACK_OSA_VERSION: "{{ lookup('env','OPENSTACK_OSA_VERSION') }}" -JUMPHOST_IP: 192.168.122.2 -host_info: {'jumphost':{'MGMT_IP': '172.29.236.10','VLAN_IP': '192.168.122.2', 'STORAGE_IP': '172.29.244.10'},'controller00':{'MGMT_IP': '172.29.236.11','VLAN_IP': '192.168.122.3', 'STORAGE_IP': '172.29.244.11'},'controller01':{'MGMT_IP': '172.29.236.12','VLAN_IP': '192.168.122.4', 'STORAGE_IP': '172.29.244.12'},'controller02':{'MGMT_IP': '172.29.236.13','VLAN_IP': '192.168.122.5', 'STORAGE_IP': '172.29.240.13'},'compute00':{'MGMT_IP': '172.29.236.14','VLAN_IP': '192.168.122.6','VLAN_IP_SECOND': '173.29.241.1','VXLAN_IP': '172.29.240.14', 'STORAGE_IP': '172.29.244.14'},'compute01':{'MGMT_IP': '172.29.236.15','VLAN_IP': '192.168.122.7','VLAN_IP_SECOND': '173.29.241.2','VXLAN_IP': '172.29.240.15', 'STORAGE_IP': '172.29.244.15'}} +XCIMASTER_IP: 192.168.122.2 +host_info: {'xcimaster':{'MGMT_IP': '172.29.236.10','VLAN_IP': '192.168.122.2', 'STORAGE_IP': '172.29.244.10'},'controller00':{'MGMT_IP': '172.29.236.11','VLAN_IP': '192.168.122.3', 'STORAGE_IP': '172.29.244.11'},'controller01':{'MGMT_IP': '172.29.236.12','VLAN_IP': '192.168.122.4', 'STORAGE_IP': '172.29.244.12'},'controller02':{'MGMT_IP': '172.29.236.13','VLAN_IP': '192.168.122.5', 'STORAGE_IP': '172.29.240.13'},'compute00':{'MGMT_IP': '172.29.236.14','VLAN_IP': '192.168.122.6','VLAN_IP_SECOND': '173.29.241.1','VXLAN_IP': '172.29.240.14', 'STORAGE_IP': '172.29.244.14'},'compute01':{'MGMT_IP': '172.29.236.15','VLAN_IP': '192.168.122.7','VLAN_IP_SECOND': '173.29.241.2','VXLAN_IP': '172.29.240.15', 'STORAGE_IP': '172.29.244.15'}} diff --git a/prototypes/xci/config/env-vars b/prototypes/xci/config/env-vars new file mode 100755 index 000000000..106a17930 --- /dev/null +++ b/prototypes/xci/config/env-vars @@ -0,0 +1,12 @@ +#------------------------------------------------------------------------------- +# Do not change these settings if you are not developing for XCI Sandbox! +#------------------------------------------------------------------------------- +export OPNFV_RELENG_GIT_URL=https://gerrit.opnfv.org/gerrit/releng.git +export OPENSTACK_BIFROST_GIT_URL=https://git.openstack.org/openstack/bifrost +export OPENSTACK_OSA_GIT_URL=https://git.openstack.org/openstack/openstack-ansible +export OPENSTACK_OSA_ETC_PATH=/etc/openstack_deploy +export CLEAN_DIB_IMAGES=false +export XCI_IP=192.168.122.2 +export XCI_ANSIBLE_PLAYBOOKS_PATH=$OPNFV_RELENG_PATH/prototypes/xci/file/$XCI_FLAVOR/playbooks +export XCI_ANSIBLE_VARS_PATH=$OPNFV_RELENG_PATH/prototypes/xci/file/$XCI_FLAVOR/var +export JOB_NAME=${JOB_NAME:-false} diff --git a/prototypes/xci/config/pinned-versions b/prototypes/xci/config/pinned-versions new file mode 100755 index 000000000..2fe9eee42 --- /dev/null +++ b/prototypes/xci/config/pinned-versions @@ -0,0 +1,26 @@ +#------------------------------------------------------------------------------- +# Pinned Component Versions +#------------------------------------------------------------------------------- +# You are free to override these versions in user-vars to experiment with +# different branches or with different commits but be aware that things might +# not work as expected. +# +# It is important to be consistent between branches you use for OpenStack +# projects OPNFV XCI uses. +# +# Examples: +# export OPENSTACK_BIFROST_VERSION="stable/ocata" +# export OPENSTACK_OSA_VERSION="stable/ocata" +# or +# export OPENSTACK_BIFROST_VERSION="master" +# export OPENSTACK_OSA_VERSION="master" +# or +# export OPENSTACK_BIFROST_VERSION="a87f7ce6c8725b3bbffec7b2efa1e466796848a9" +# export OPENSTACK_OSA_VERSION="4713cf45e11b4ebca9fbed25d1389854602213d8" +#------------------------------------------------------------------------------- +# use releng from master until the development work with the sandbox is complete +export OPNFV_RELENG_VERSION="master" +# HEAD of "master" as of 27.03.2017 - verified by OPNFV CI +export OPENSTACK_BIFROST_VERSION="7417ff36e4b5fc4e2a6ee7d9dddb7287be20c37d" +# HEAD of "master" as of 27.03.2017 - verified by OPNFV CI +export OPENSTACK_OSA_VERSION="baba7b317a5898cd73b4a11c4ce364c7e2d3d77f" diff --git a/prototypes/xci/config/user-vars b/prototypes/xci/config/user-vars new file mode 100755 index 000000000..f29dda66f --- /dev/null +++ b/prototypes/xci/config/user-vars @@ -0,0 +1,44 @@ +#------------------------------------------------------------------------------- +# Set Deployment Flavor +#------------------------------------------------------------------------------- +# OPNFV XCI currently supports 4 different types of flavors: +# - all in one (aio): 1 xci VM which acts as controller and compute node +# - mini: 3 VMs, 1 xci VM, 1 controller, and 1 compute nodes +# - noha: 4 VMs, 1 xci VM, 1 controller, and 2 compute nodes +# - ha: 6 VMs, 1 xci VM, 3 controllers, and 2 compute nodes +# +# Apart from having different number of nodes, CPU, RAM, and disk allocations +# also differ from each other. Please take a look at the env-vars files for +# each of these flavors. +# +# Examples: +# export XCI_FLAVOR="aio" +# or +# export XCI_FLAVOR="mini" +# or +# export XCI_FLAVOR="noha" +# or +# export XCI_FLAVOR="ha" +#------------------------------------------------------------------------------- +export XCI_FLAVOR=${XCI_FLAVOR:-aio} + +#------------------------------------------------------------------------------- +# Set Paths to where git repositories of XCI Components will be cloned +#------------------------------------------------------------------------------- +# OPNFV XCI Sandbox is not verified to be used as non-root user as of yet so +# changing these paths might break things. +#------------------------------------------------------------------------------- +export OPNFV_RELENG_PATH=/opt/releng +export OPENSTACK_BIFROST_PATH=/opt/bifrost +export OPENSTACK_OSA_PATH=/opt/openstack-ansible + +#------------------------------------------------------------------------------- +# Configure some other stuff +#------------------------------------------------------------------------------- +# Set the verbosity for ansible +# +# Examples: +# ANSIBLE_VERBOSITY="-v" +# or +# ANSIBLE_VERBOSITY="-vvvv" +export ANSIBLE_VERBOSITY=${ANSIBLE_VERBOSITY-""} diff --git a/prototypes/xci/file/aio/playbooks/configure-xcihost.yml b/prototypes/xci/file/aio/playbooks/configure-xcihost.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/aio/playbooks/configure-xcihost.yml diff --git a/prototypes/xci/file/aio/playbooks/inventory b/prototypes/xci/file/aio/playbooks/inventory new file mode 100644 index 000000000..9283e516d --- /dev/null +++ b/prototypes/xci/file/aio/playbooks/inventory @@ -0,0 +1,2 @@ +[xciaio] +xciaio ansible_ssh_host=192.168.122.2 diff --git a/prototypes/xci/file/aio/var/ubuntu.yml b/prototypes/xci/file/aio/var/ubuntu.yml new file mode 100644 index 000000000..3a041b1cb --- /dev/null +++ b/prototypes/xci/file/aio/var/ubuntu.yml @@ -0,0 +1,7 @@ +--- +OPENSTACK_OSA_GIT_URL: "{{ lookup('env','OPENSTACK_OSA_GIT_URL') }}" +OPENSTACK_OSA_PATH: "{{ lookup('env','OPENSTACK_OSA_PATH') }}" +OPENSTACK_OSA_VERSION: "{{ lookup('env','OPENSTACK_OSA_VERSION') }}" +OPENSTACK_OSA_ETC_PATH: "{{ lookup('env','OPENSTACK_OSA_ETC_PATH') }}" +XCI_IP: "{{ lookup('env','XCI_IP') }}" +multi_host: "False" diff --git a/prototypes/xci/file/ha/configure-targethosts.yml b/prototypes/xci/file/ha/configure-targethosts.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/ha/configure-targethosts.yml diff --git a/prototypes/xci/file/ha/playbooks/configure-xcihost.yml b/prototypes/xci/file/ha/playbooks/configure-xcihost.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/ha/playbooks/configure-xcihost.yml diff --git a/prototypes/xci/file/ha/playbooks/inventory b/prototypes/xci/file/ha/playbooks/inventory new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/ha/playbooks/inventory diff --git a/prototypes/xci/file/ha/var/ubuntu.yml b/prototypes/xci/file/ha/var/ubuntu.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/ha/var/ubuntu.yml diff --git a/prototypes/xci/file/mini/configure-targethosts.yml b/prototypes/xci/file/mini/configure-targethosts.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/mini/configure-targethosts.yml diff --git a/prototypes/xci/file/mini/playbooks/configure-xcihost.yml b/prototypes/xci/file/mini/playbooks/configure-xcihost.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/mini/playbooks/configure-xcihost.yml diff --git a/prototypes/xci/file/mini/playbooks/inventory b/prototypes/xci/file/mini/playbooks/inventory new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/mini/playbooks/inventory diff --git a/prototypes/xci/file/mini/var/ubuntu.yml b/prototypes/xci/file/mini/var/ubuntu.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/mini/var/ubuntu.yml diff --git a/prototypes/xci/file/noha/configure-targethosts.yml b/prototypes/xci/file/noha/configure-targethosts.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/noha/configure-targethosts.yml diff --git a/prototypes/xci/file/noha/playbooks/configure-xcihost.yml b/prototypes/xci/file/noha/playbooks/configure-xcihost.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/noha/playbooks/configure-xcihost.yml diff --git a/prototypes/xci/file/noha/playbooks/inventory b/prototypes/xci/file/noha/playbooks/inventory new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/noha/playbooks/inventory diff --git a/prototypes/xci/file/noha/var/ubuntu.yml b/prototypes/xci/file/noha/var/ubuntu.yml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/xci/file/noha/var/ubuntu.yml diff --git a/prototypes/xci/flavors/aio b/prototypes/xci/flavors/aio new file mode 100644 index 000000000..48754e507 --- /dev/null +++ b/prototypes/xci/flavors/aio @@ -0,0 +1,18 @@ +#------------------------------------------------------------------------------- +# XCI Flavor Configuration +#------------------------------------------------------------------------------- +# You are free to modify parts of the configuration to fit into your environment. +# But before doing that, please ensure you checked other flavors to see if one +# them can be used instead, saving you some time. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Configure VM Nodes +#------------------------------------------------------------------------------- +export TEST_VM_NUM_NODES=1 +export TEST_VM_NODE_NAMES=xci +export VM_DOMAIN_TYPE=kvm +export VM_CPU=8 +export VM_DISK=80 +export VM_MEMORY_SIZE=8192 +export VM_DISK_CACHE=unsafe diff --git a/prototypes/xci/flavors/ha b/prototypes/xci/flavors/ha new file mode 100644 index 000000000..8a045a3dd --- /dev/null +++ b/prototypes/xci/flavors/ha @@ -0,0 +1,18 @@ +#------------------------------------------------------------------------------- +# XCI Flavor Configuration +#------------------------------------------------------------------------------- +# You are free to modify parts of the configuration to fit into your environment. +# But before doing that, please ensure you checked other flavors to see if one +# them can be used instead, saving you some time. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Configure VM Nodes +#------------------------------------------------------------------------------- +export TEST_VM_NUM_NODES=6 +export TEST_VM_NODE_NAMES="xci controller00 controller01 controller02 compute00 compute01" +export VM_DOMAIN_TYPE=kvm +export VM_CPU=8 +export VM_DISK=80 +export VM_MEMORY_SIZE=16384 +export VM_DISK_CACHE=unsafe diff --git a/prototypes/xci/flavors/mini b/prototypes/xci/flavors/mini new file mode 100644 index 000000000..44b015d9f --- /dev/null +++ b/prototypes/xci/flavors/mini @@ -0,0 +1,18 @@ +#------------------------------------------------------------------------------- +# XCI Flavor Configuration +#------------------------------------------------------------------------------- +# You are free to modify parts of the configuration to fit into your environment. +# But before doing that, please ensure you checked other flavors to see if one +# them can be used instead, saving you some time. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Configure VM Nodes +#------------------------------------------------------------------------------- +export TEST_VM_NUM_NODES=3 +export TEST_VM_NODE_NAMES="xci controller00 compute00" +export VM_DOMAIN_TYPE=kvm +export VM_CPU=8 +export VM_DISK=80 +export VM_MEMORY_SIZE=8192 +export VM_DISK_CACHE=unsafe diff --git a/prototypes/xci/flavors/noha b/prototypes/xci/flavors/noha new file mode 100644 index 000000000..7f686e5e5 --- /dev/null +++ b/prototypes/xci/flavors/noha @@ -0,0 +1,18 @@ +#------------------------------------------------------------------------------- +# XCI Flavor Configuration +#------------------------------------------------------------------------------- +# You are free to modify parts of the configuration to fit into your environment. +# But before doing that, please ensure you checked other flavors to see if one +# them can be used instead, saving you some time. +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Configure VM Nodes +#------------------------------------------------------------------------------- +export TEST_VM_NUM_NODES=4 +export TEST_VM_NODE_NAMES="xci controller00 compute00 compute01" +export VM_DOMAIN_TYPE=kvm +export VM_CPU=8 +export VM_DISK=80 +export VM_MEMORY_SIZE=8192 +export VM_DISK_CACHE=unsafe diff --git a/prototypes/xci/xci-deploy.sh b/prototypes/xci/xci-deploy.sh new file mode 100755 index 000000000..401c098c6 --- /dev/null +++ b/prototypes/xci/xci-deploy.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +# This script must run as root +if [[ $(whoami) != "root" ]]; then + echo "Error: This script must be run as root!" + exit 1 +fi + +# find where are we +XCI_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# source pinned versions +source $XCI_PATH/config/pinned-versions + +# source user vars +source $XCI_PATH/config/user-vars + +# source flavor configuration +source $XCI_PATH/flavors/$XCI_FLAVOR + +# source xci configuration +source $XCI_PATH/config/env-vars + +# log info to console +echo "Info: Starting XCI Deployment" +echo "Info: Deployment parameters" +echo "-------------------------------------------------------------------------" +echo "xci flavor: $XCI_FLAVOR" +echo "opnfv/releng version: $OPNFV_RELENG_VERSION" +echo "openstack/bifrost version: $OPENSTACK_BIFROST_VERSION" +echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" +echo "-------------------------------------------------------------------------" + +#------------------------------------------------------------------------------- +# Cleanup the leftovers from the previous deployment +#------------------------------------------------------------------------------- +echo "Info: Cleaning up the previous deployment" +$XCI_PATH/../bifrost/scripts/destroy-env.sh > /dev/null 2>&1 +/bin/rm -rf /opt/releng /opt/bifrost /opt/openstack-ansible /opt/stack + +#------------------------------------------------------------------------------- +# Clone the repositories and checkout the versions +#------------------------------------------------------------------------------- +echo "Info: Cloning repositories and checking out versions" +git clone --quiet $OPNFV_RELENG_GIT_URL $OPNFV_RELENG_PATH && \ + cd $OPNFV_RELENG_PATH +echo "Info: Cloned opnfv/releng. HEAD currently points at" +echo " $(git show --oneline -s --pretty=format:'%h - %s (%cr) <%an>')" +git clone --quiet $OPENSTACK_BIFROST_GIT_URL $OPENSTACK_BIFROST_PATH && \ + cd $OPENSTACK_BIFROST_PATH +echo "Info: Cloned openstack/bifrost. HEAD currently points at" +echo " $(git show --oneline -s --pretty=format:'%h - %s (%cr) <%an>')" + +#------------------------------------------------------------------------------- +# Combine opnfv and upstream scripts/playbooks +#------------------------------------------------------------------------------- +echo "Info: Combining opnfv/releng and opestack/bifrost scripts/playbooks" +/bin/cp -rf $OPNFV_RELENG_PATH/prototypes/bifrost/* $OPENSTACK_BIFROST_PATH/ + +#------------------------------------------------------------------------------- +# Start provisioning VM nodes +#------------------------------------------------------------------------------- +echo "Info: Starting provisining VM nodes using openstack/bifrost" +echo " This might take between 10 to 20 minutes depending on the flavor and the host" +echo "-------------------------------------------------------------------------" +cd $OPENSTACK_BIFROST_PATH +STARTTIME=$(date +%s) +./scripts/bifrost-provision.sh +ENDTIME=$(date +%s) +echo "-----------------------------------------------------------------------" +echo "Info: VM nodes are provisioned!" +echo "Info: It took $(($ENDTIME - $STARTTIME)) seconds to provising the VM nodes" diff --git a/utils/test/testapi/install.sh b/utils/test/testapi/install.sh index c55691aed..bf828b580 100755 --- a/utils/test/testapi/install.sh +++ b/utils/test/testapi/install.sh @@ -26,3 +26,6 @@ fi cp -fr 3rd_party/static opnfv_testapi/tornado_swagger python setup.py install rm -fr opnfv_testapi/tornado_swagger/static +if [ ! -z "$VIRTUAL_ENV" ]; then + sed -i -e 's#etc/opnfv_testapi =#/etc/opnfv_testapi =#g' setup.cfg +fi
\ No newline at end of file diff --git a/utils/test/testapi/opnfv_testapi/common/config.py b/utils/test/testapi/opnfv_testapi/common/config.py index 105d4fabf..362fca640 100644 --- a/utils/test/testapi/opnfv_testapi/common/config.py +++ b/utils/test/testapi/opnfv_testapi/common/config.py @@ -30,7 +30,7 @@ class APIConfig(object): """ def __init__(self): - self._default_config_location = "/etc/opnfv_testapi/config.ini" + self._set_default_config() self.mongo_url = None self.mongo_dbname = None self.api_port = None @@ -39,6 +39,11 @@ class APIConfig(object): self._parser = None self.swagger_base_url = None + def _set_default_config(self): + venv = os.getenv('VIRTUAL_ENV') + self._default_config = os.path.join('/' if not venv else venv, + 'etc/opnfv_testapi/config.ini') + def _get_parameter(self, section, param): try: return self._parser.get(section, param) @@ -66,7 +71,7 @@ class APIConfig(object): obj = APIConfig() if config_location is None: - config_location = obj._default_config_location + config_location = obj._default_config if not os.path.exists(config_location): raise ParseError("%s not found" % config_location) diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index 8255b526a..15096468c 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -92,8 +92,6 @@ class GenericApiHandler(web.RequestHandler): raise gen.Return(ret) return wrapper - @web.asynchronous - @gen.coroutine @authenticate def _create(self, miss_checks, db_checks, **kwargs): """ @@ -158,8 +156,6 @@ class GenericApiHandler(web.RequestHandler): .format(query, self.table)) self.finish_request(self.format_data(data)) - @web.asynchronous - @gen.coroutine @authenticate def _delete(self, query): data = yield self._eval_db_find_one(query) @@ -171,8 +167,6 @@ class GenericApiHandler(web.RequestHandler): yield self._eval_db(self.table, 'remove', query) self.finish_request() - @web.asynchronous - @gen.coroutine @authenticate def _update(self, query, db_keys): if self.json_args is None: diff --git a/utils/test/testapi/run_test.sh b/utils/test/testapi/run_test.sh index 4efc7af3b..1e05dd6ba 100755 --- a/utils/test/testapi/run_test.sh +++ b/utils/test/testapi/run_test.sh @@ -8,15 +8,17 @@ SCRIPTDIR=`dirname $0` echo "Running unit tests..." # Creating virtual environment -virtualenv $SCRIPTDIR/testapi_venv -source $SCRIPTDIR/testapi_venv/bin/activate +if [ ! -z $VIRTUAL_ENV ]; then + venv=$VIRTUAL_ENV +else + venv=$SCRIPTDIR/.venv + virtualenv $venv +fi +source $venv/bin/activate # Install requirements pip install -r $SCRIPTDIR/requirements.txt -pip install coverage -pip install nose>=1.3.1 -pip install pytest -pip install mock +pip install -r $SCRIPTDIR/test-requirements.txt find . -type f -name "*.pyc" -delete diff --git a/utils/test/testapi/test-requirements.txt b/utils/test/testapi/test-requirements.txt index 4633ad637..645687b14 100644 --- a/utils/test/testapi/test-requirements.txt +++ b/utils/test/testapi/test-requirements.txt @@ -2,10 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -tox mock pytest -pytest-cov coverage -pykwalify -pip_check_reqs +nose>=1.3.1 |