diff options
26 files changed, 216 insertions, 372 deletions
diff --git a/jjb/bottlenecks/bottlenecks-cleanup.sh b/jjb/bottlenecks/bottlenecks-cleanup.sh index 052f72eef..04e620c7f 100644 --- a/jjb/bottlenecks/bottlenecks-cleanup.sh +++ b/jjb/bottlenecks/bottlenecks-cleanup.sh @@ -8,11 +8,9 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -BASEDIR=`dirname $0` - #clean up correlated dockers and their images -bash ${BASEDIR}/docker_cleanup.sh -d bottlenecks --debug -bash ${BASEDIR}/docker_cleanup.sh -d yardstick --debug -bash ${BASEDIR}/docker_cleanup.sh -d kibana --debug -bash ${BASEDIR}/docker_cleanup.sh -d elasticsearch --debug -bash ${BASEDIR}/docker_cleanup.sh -d influxdb --debug
\ No newline at end of file +bash $WORKSPACE/docker/docker_cleanup.sh -d bottlenecks --debug +bash $WORKSPACE/docker/docker_cleanup.sh -d yardstick --debug +bash $WORKSPACE/docker/docker_cleanup.sh -d kibana --debug +bash $WORKSPACE/docker/docker_cleanup.sh -d elasticsearch --debug +bash $WORKSPACE/docker/docker_cleanup.sh -d influxdb --debug diff --git a/jjb/bottlenecks/docker_cleanup.sh b/jjb/bottlenecks/docker_cleanup.sh deleted file mode 100644 index cfc8e8b0e..000000000 --- a/jjb/bottlenecks/docker_cleanup.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2017 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 -############################################################################## - -usage="Script to clear up dockers and their images. - -usage: - bash $(basename "$0") [-h|--help] [-d|--docker <docker name>] [--debug] - -where: - -h|--help show the help text - -d|--docker specify dockers' name - <docker name> keyword of dockers' name used to find dockers - e.g. keyword "bottlenecks" to find "opnfv/bottlenecks:*" - --debug print debug information with default false - -examples: - $(basename "$0") - $(basename "$0") -d bottlenecks --debug" - -clnup_debug=false - -while [[ $#>0 ]]; do - clnup_docr="$1" - case $clnup_docr in - -h|--help) - echo "$usage" - exit 0 - shift - ;; - -d|--docker) - docker_name="$2" - shift - - if [[ $2 == "--debug" ]]; then - clnup_debug=true - shift - fi - ;; - --debug) - clnup_debug=true - shift - if [[ "$1" == "-d" || "$1" == "--docker" ]]; then - docker_name="$2" - shift - fi - ;; - *) - echo "unknow options $1 $2 $3" - exit 1 - ;; - esac - shift -done - - -# check if docker name is empty -if [[ $docker_name == "" ]]; then - echo empty docker name - exit 1 -fi - -# clean up dockers and their images with keyword in their names -[[ $clnup_debug == true ]] && redirect="/dev/stdout" || redirect="/dev/null" - -echo "$docker_name: docker containers/images cleaning up" - -dangling_images=($(docker images -f "dangling=true" | grep $docker_name | awk '{print $3}')) -if [[ -n $dangling_images ]]; then - echo "Removing $docker_name:<none> dangling images and their containers" - docker images | head -1 && docker images | grep $dangling_images - for image_id in "${dangling_images[@]}"; do - echo "$docker_name: Removing dangling image $image_id" - docker rmi -f $image_id >${redirect} - done -fi - -for image_id in "${dangling_images[@]}"; do - if [[ -n $(docker ps -a | grep $image_id) ]]; then - echo "$docker_name: Removing containers associated with dangling image: $image_id" - docker ps -a | head -1 && docker ps -a | grep $image_id - docker ps -a | grep $image_id | awk '{print $1}'| xargs docker rm -f >${redirect} - fi -done - -if [[ -n $(docker ps -a | grep $docker_name) ]]; then - echo "Removing existing $docker_name containers" - docker ps -a | head -1 && docker ps -a | grep $docker_name - docker ps -a | grep $docker_name | awk '{print $1}' | xargs docker rm -f >$redirect -fi - -if [[ -n $(docker images | grep $docker_name) ]]; then - echo "$docker_name: docker images to remove:" - docker images | head -1 && docker images | grep $docker_name - image_ids=($(docker images | grep $docker_name | awk '{print $3}')) - for image_id in "${image_ids[@]}"; do - echo "Removing docker image $docker_name:$tag..." - docker rmi $image_id >$redirect - done -fi diff --git a/jjb/cperf/cperf-ci-jobs.yml b/jjb/cperf/cperf-ci-jobs.yml index 2742f08f7..6cd4e22dc 100644 --- a/jjb/cperf/cperf-ci-jobs.yml +++ b/jjb/cperf/cperf-ci-jobs.yml @@ -126,14 +126,18 @@ undercloud_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]+") INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'}) - sudo scp $INSTALLER_IP:/home/stack/stackrc /tmp/stackrc - source /tmp/stackrc + sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/overcloudrc /tmp/overcloudrc + sudo chmod 755 /tmp/overcloudrc + source /tmp/overcloudrc # robot suites need the ssh key to log in to controller nodes, so throwing it # in tmp, and mounting /tmp as $HOME as far as robot is concerned sudo mkdir -p /tmp/.ssh - sudo scp $INSTALLER_IP:/home/stack/.ssh/id_rsa /tmp/.ssh/ - sudo chmod -R 0600 /tmp/.ssh + sudo scp -o StrictHostKeyChecking=no root@$INSTALLER_IP:/home/stack/.ssh/id_rsa /tmp/.ssh/ + sudo chown -R jenkins-ci:jenkins-ci /tmp/.ssh + # done with sudo. jenkins-ci is the user from this point + sudo mv /tmp/.ssh/id_rsa ~jenkins-ci/.ssh/ + chmod -R 0600 ~jenkins-ci/.ssh # cbench requires the openflow drop test feature to be installed. sshpass -p karaf ssh -o StrictHostKeyChecking=no \ diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index b65e6d5ef..5651fc3f2 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -169,6 +169,7 @@ - timeout: timeout: 180 abort: true + - fix-workspace-permissions triggers: - '{auto-trigger-name}' @@ -208,9 +209,6 @@ - 'dovetail-cleanup' - 'dovetail-run' - wrappers: - - fix-workspace-permissions - publishers: - archive: artifacts: 'results/**/*' diff --git a/jjb/dovetail/dovetail-weekly-jobs.yml b/jjb/dovetail/dovetail-weekly-jobs.yml index 7b3ede902..eaa11b54a 100644 --- a/jjb/dovetail/dovetail-weekly-jobs.yml +++ b/jjb/dovetail/dovetail-weekly-jobs.yml @@ -78,6 +78,7 @@ - timeout: timeout: '{job-timeout}' abort: true + - fix-workspace-permissions parameters: - project-parameter: @@ -114,9 +115,6 @@ - 'dovetail-cleanup' - 'dovetail-run' - wrappers: - - fix-workspace-permissions - publishers: - archive: artifacts: 'results/**/*' diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/testapi-automate.yml index dd76538a3..8f3ae0c23 100644 --- a/jjb/releng/testapi-automate.yml +++ b/jjb/releng/testapi-automate.yml @@ -258,7 +258,8 @@ name: 'testapi-automate-docker-deploy-macro' builders: - shell: | - bash ./jjb/releng/testapi-docker-deploy.sh + echo 'disable TestAPI update temporarily due to frequent change' +# bash ./jjb/releng/testapi-docker-deploy.sh ################################ # job publishers diff --git a/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 b/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 deleted file mode 100644 index dc4e3ffad..000000000 --- a/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 +++ /dev/null @@ -1,66 +0,0 @@ -{# -# Note(TheJulia): This file is based upon the file format provided by the git -# committed example located at: -# http://git.openstack.org/cgit/openstack/ironic-inspector/tree/example.conf -#} -[DEFAULT] -{% if enable_keystone is defined and enable_keystone | bool == true %} -auth_strategy = keystone -{% else %} -auth_strategy = {{ inspector_auth | default('noauth') }} -{% endif %} -debug = {{ inspector_debug | bool }} - -[database] -connection=mysql+pymysql://inspector:{{ ironic_db_password }}@localhost/inspector?charset=utf8 -min_pool_size = 1 -max_pool_size = 5 - -[firewall] -manage_firewall = {{ inspector_manage_firewall | bool | default('false') }} - -[ironic] -{% if enable_keystone is defined and enable_keystone | bool == true %} -os_region = {{ keystone.bootstrap.region_name | default('RegionOne') }} -project_name = baremetal -username = {{ ironic_inspector.keystone.default_username }} -password = {{ ironic_inspector.keystone.default_password }} -auth_url = {{ ironic_inspector.service_catalog.auth_url }} -auth_type = password -auth_strategy = keystone -user_domain_id = default -project_domain_id = default - -{% else %} -auth_strategy = {{ ironic_auth_strategy | default('noauth') }} -{% endif %} - -{% if enable_keystone is defined and enable_keystone | bool == true %} -[keystone_authtoken] -auth_plugin = password -auth_url = {{ ironic_inspector.service_catalog.auth_url }} -username = {{ ironic_inspector.service_catalog.username }} -password = {{ ironic_inspector.service_catalog.password }} -user_domain_id = default -project_name = service -project_domain_id = default - -{% endif %} -{# -# Note(TheJulia) preserving ironic_url in the configuration -# in case future changes allow breaking of the deployment across -# multiple nodes. -#ironic_url = http://localhost:6385/ -#} - -[processing] -add_ports = {{ inspector_port_addition | default('pxe') }} -keep_ports = {{ inspector_keep_ports | default('present') }} -ramdisk_logs_dir = {{ inspector_data_dir }}/log -always_store_ramdisk_logs = {{ inspector_store_ramdisk_logs | default('true') | bool }} -{% if inspector.discovery.enabled == true %} -node_not_found_hook = enroll - -[discovery] -enroll_node_driver = {{ inspector.discovery.default_node_driver }} -{% endif %} diff --git a/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 b/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 deleted file mode 100644 index d8896fa9e..000000000 --- a/prototypes/bifrost/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 +++ /dev/null @@ -1,92 +0,0 @@ -# {{ ansible_managed }} -# For additional details on configuring ironic, you may wish to reference -# the sample configuration file which can be located at -# http://git.openstack.org/cgit/openstack/ironic/tree/etc/ironic/ironic.conf.sample - - -[DEFAULT] -# NOTE(TheJulia): Until Bifrost supports neutron or some other network -# configuration besides a flat network where bifrost orchustrates the -# control instead of ironic, noop is the only available network driver. -enabled_network_interfaces = noop -{% if testing | bool == true %} -enabled_drivers = agent_ipmitool,pxe_ipmitool -debug = true -{% else %} -enabled_drivers = {{ enabled_drivers }} -debug = false -{% endif %} - -rabbit_userid = ironic -rabbit_password = {{ ironic_db_password }} - -{% if enable_keystone is defined and enable_keystone | bool == true %} -auth_strategy = keystone -{% else %} -auth_strategy = noauth -{% endif %} - -[pxe] -pxe_append_params = systemd.journald.forward_to_console=yes {{ extra_kernel_options | default('') }} -pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template -tftp_server = {{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }} -tftp_root = /tftpboot -pxe_bootfile_name = undionly.kpxe -ipxe_enabled = true -ipxe_boot_script = /etc/ironic/boot.ipxe - -[deploy] -http_url = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/ -http_root = {{ http_boot_folder }} - -[conductor] -api_url = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385/ -clean_nodes = {{ cleaning | lower }} -automated_clean = {{ cleaning | lower }} - -[database] -connection = mysql+pymysql://ironic:{{ ironic_db_password }}@localhost/ironic?charset=utf8 -min_pool_size = 1 -max_pool_size = 5 - -[dhcp] -dhcp_provider = none - -{% if testing | bool == true %} -[ssh] -libvirt_uri = qemu:///system -{% endif %} - -{% if enable_cors | bool == true %} -[cors] -allowed_origin = {{ cors_allowed_origin | default('allowed_origin=http://localhost:8000') }} -allow_credentials = {{ enable_cors_credential_support | default('true') }} -{% endif %} - -[ilo] -use_web_server_for_images = true - -{% if enable_inspector | bool == true %} -[inspector] -enabled = true -{% endif %} - -{% if enable_keystone is defined and enable_keystone | bool == true %} -[keystone] -region_name = {{ keystone.bootstrap.region_name | default('RegionOne')}} -[keystone_authtoken] -auth_plugin = password -auth_url = {{ ironic.service_catalog.auth_url }} -username = {{ ironic.service_catalog.username }} -password = {{ ironic.service_catalog.password }} -user_domain_id = default -project_name = {{ ironic.service_catalog.project_name }} -project_domain_id = default - -[service_catalog] -auth_url = {{ ironic.service_catalog.auth_url }} -auth_type = password -tenant_name = {{ ironic.service_catalog.project_name }} -username = {{ ironic.service_catalog.username }} -password = {{ ironic.service_catalog.password }} -{% endif %} diff --git a/prototypes/xci/file/aio/configure-opnfvhost.yml b/prototypes/xci/file/aio/configure-opnfvhost.yml new file mode 100644 index 000000000..5c66d40c7 --- /dev/null +++ b/prototypes/xci/file/aio/configure-opnfvhost.yml @@ -0,0 +1,22 @@ +--- +- hosts: opnfv + remote_user: root + vars_files: + vars_files: + - ../var/opnfv.yml + roles: + - role: remove-folders + - { role: clone-repository, project: "openstack/openstack-ansible", repo: "{{ OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } + tasks: + - name: bootstrap ansible on opnfv host + command: "/bin/bash ./scripts/bootstrap-ansible.sh" + args: + chdir: "{{OPENSTACK_OSA_PATH}}" + - name: bootstrap opnfv host as aio + command: "/bin/bash ./scripts/bootstrap-aio.sh" + args: + chdir: "{{OPENSTACK_OSA_PATH}}" + - name: install OpenStack on opnfv host - this command doesn't log anything to console + command: "/bin/bash ./scripts/run-playbooks.sh" + args: + chdir: "{{OPENSTACK_OSA_PATH}}" diff --git a/prototypes/xci/file/aio/flavor-vars.yml b/prototypes/xci/file/aio/flavor-vars.yml index e69de29bb..6ac1e0fe9 100644 --- a/prototypes/xci/file/aio/flavor-vars.yml +++ b/prototypes/xci/file/aio/flavor-vars.yml @@ -0,0 +1,3 @@ +--- +# this file is added intentionally in order to simplify putting files in place +# in future, it might contain vars specific to this flavor diff --git a/prototypes/xci/file/aio/inventory b/prototypes/xci/file/aio/inventory index e69de29bb..9a3dd9ee3 100644 --- a/prototypes/xci/file/aio/inventory +++ b/prototypes/xci/file/aio/inventory @@ -0,0 +1,2 @@ +[opnfv] +opnfv ansible_ssh_host=192.168.122.2 diff --git a/prototypes/xci/file/aio/openstack_user_config.yml b/prototypes/xci/file/aio/openstack_user_config.yml deleted file mode 100644 index e69de29bb..000000000 --- a/prototypes/xci/file/aio/openstack_user_config.yml +++ /dev/null diff --git a/prototypes/xci/playbooks/configure-localhost.yml b/prototypes/xci/playbooks/configure-localhost.yml index c1a0134d9..2a559645e 100644 --- a/prototypes/xci/playbooks/configure-localhost.yml +++ b/prototypes/xci/playbooks/configure-localhost.yml @@ -11,6 +11,7 @@ remote_user: root vars_files: - ../var/{{ ansible_os_family }}.yml + - ../var/opnfv.yml roles: - role: remove-folders - { role: clone-repository, project: "opnfv/releng", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } @@ -32,6 +33,10 @@ src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/configure-opnfvhost.yml" dest: "{{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks" when: XCI_FLAVOR == "aio" + - name: copy flavor inventory + copy: + src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/inventory" + dest: "{{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks" - name: copy flavor vars copy: src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/flavor-vars.yml" diff --git a/prototypes/xci/playbooks/configure-opnfvhost.yml b/prototypes/xci/playbooks/configure-opnfvhost.yml index 44a3d6a78..6689c8dc7 100644 --- a/prototypes/xci/playbooks/configure-opnfvhost.yml +++ b/prototypes/xci/playbooks/configure-opnfvhost.yml @@ -12,10 +12,13 @@ vars_files: - ../var/{{ ansible_os_family }}.yml - ../var/flavor-vars.yml + - ../var/opnfv.yml roles: - role: remove-folders - { role: clone-repository, project: "opnfv/releng", repo: "{{ OPNFV_RELENG_GIT_URL }}", dest: "{{ OPNFV_RELENG_PATH }}", version: "{{ OPNFV_RELENG_VERSION }}" } - { role: clone-repository, project: "openstack/openstack-ansible", repo: "{{ OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } + # TODO: this only works for ubuntu/xenial and need to be adjusted for other distros + - { role: configure-network, when: ansible_distribution_release == "xenial", src: "../template/opnfv.interface.j2", dest: "/etc/network/interfaces" } tasks: - name: generate SSH keys shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N "" @@ -47,18 +50,6 @@ shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/prototypes/xci/file/setup-openstack.yml {{OPENSTACK_OSA_PATH}}/playbooks" - name: copy OPNFV role requirements shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/prototypes/xci/file/ansible-role-requirements.yml {{OPENSTACK_OSA_PATH}}" - # TODO: this only works for ubuntu/xenial and need to be adjusted for other distros - # TODO: convert this into a role - - name: configure network for ubuntu xenial - template: - src: ../template/opnfv.interface.j2 - dest: /etc/network/interfaces - notify: - - restart ubuntu xenial network service - when: ansible_distribution_release == "xenial" - handlers: - - name: restart ubuntu xenial network service - shell: "/sbin/ifconfig ens3 0 &&/sbin/ifdown -a && /sbin/ifup -a" - hosts: localhost remote_user: root tasks: diff --git a/prototypes/xci/playbooks/roles/configure-network/tasks/main.yml b/prototypes/xci/playbooks/roles/configure-network/tasks/main.yml new file mode 100644 index 000000000..8bc84822c --- /dev/null +++ b/prototypes/xci/playbooks/roles/configure-network/tasks/main.yml @@ -0,0 +1,16 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 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 +############################################################################## +# TODO: this role needs to be adjusted for different distros +- name: configure network for {{ ansible_os_family }} on interface {{ interface }} + template: + src: "{{ src }}" + dest: "{{ dest }}" +- name: restart ubuntu xenial network service + shell: "/sbin/ifconfig {{ interface }} 0 &&/sbin/ifdown -a && /sbin/ifup -a" diff --git a/prototypes/xci/template/compute.interface.j2 b/prototypes/xci/template/compute.interface.j2 index 1719f6a08..0c5147c45 100644 --- a/prototypes/xci/template/compute.interface.j2 +++ b/prototypes/xci/template/compute.interface.j2 @@ -7,23 +7,23 @@ iface lo inet loopback # Physical interface -auto ens3 -iface ens3 inet manual +auto {{ interface }} +iface {{ interface }} inet manual # Container/Host management VLAN interface -auto ens3.10 -iface ens3.10 inet manual - vlan-raw-device ens3 +auto {{ interface }}.10 +iface {{ interface }}.10 inet manual + vlan-raw-device {{ interface }} # OpenStack Networking VXLAN (tunnel/overlay) VLAN interface -auto ens3.30 -iface ens3.30 inet manual - vlan-raw-device ens3 +auto {{ interface }}.30 +iface {{ interface }}.30 inet manual + vlan-raw-device {{ interface }} # Storage network VLAN interface (optional) -auto ens3.20 -iface ens3.20 inet manual - vlan-raw-device ens3 +auto {{ interface }}.20 +iface {{ interface }}.20 inet manual + vlan-raw-device {{ interface }} # Container/Host management bridge auto br-mgmt @@ -31,7 +31,7 @@ iface br-mgmt inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.10 + bridge_ports {{ interface }}.10 address {{host_info[inventory_hostname].MGMT_IP}} netmask 255.255.252.0 @@ -41,7 +41,7 @@ iface br-vxlan inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.30 + bridge_ports {{ interface }}.30 address {{host_info[inventory_hostname].VXLAN_IP}} netmask 255.255.252.0 @@ -51,7 +51,7 @@ iface br-vlan inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3 + bridge_ports {{ interface }} address {{host_info[inventory_hostname].VLAN_IP}} netmask 255.255.255.0 gateway 192.168.122.1 @@ -81,6 +81,6 @@ iface br-storage inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.20 + bridge_ports {{ interface }}.20 address {{host_info[inventory_hostname].STORAGE_IP}} netmask 255.255.252.0 diff --git a/prototypes/xci/template/controller.interface.j2 b/prototypes/xci/template/controller.interface.j2 index 74aeea99d..fbaa8b8dd 100644 --- a/prototypes/xci/template/controller.interface.j2 +++ b/prototypes/xci/template/controller.interface.j2 @@ -6,23 +6,23 @@ auto lo iface lo inet loopback # Physical interface -auto ens3 -iface ens3 inet manual +auto {{ interface }} +iface {{ interface }} inet manual # Container/Host management VLAN interface -auto ens3.10 -iface ens3.10 inet manual - vlan-raw-device ens3 +auto {{ interface }}.10 +iface {{ interface }}.10 inet manual + vlan-raw-device {{ interface }} # OpenStack Networking VXLAN (tunnel/overlay) VLAN interface -auto ens3.30 -iface ens3.30 inet manual - vlan-raw-device ens3 +auto {{ interface }}.30 +iface {{ interface }}.30 inet manual + vlan-raw-device {{ interface }} # Storage network VLAN interface (optional) -auto ens3.20 -iface ens3.20 inet manual - vlan-raw-device ens3 +auto {{ interface }}.20 +iface {{ interface }}.20 inet manual + vlan-raw-device {{ interface }} # Container/Host management bridge auto br-mgmt @@ -30,7 +30,7 @@ iface br-mgmt inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.10 + bridge_ports {{ interface }}.10 address {{host_info[inventory_hostname].MGMT_IP}} netmask 255.255.252.0 @@ -46,7 +46,7 @@ iface br-vxlan inet manual bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.30 + bridge_ports {{ interface }}.30 # OpenStack Networking VLAN bridge auto br-vlan @@ -54,7 +54,7 @@ iface br-vlan inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3 + bridge_ports {{ interface }} address {{host_info[inventory_hostname].VLAN_IP}} netmask 255.255.255.0 gateway 192.168.122.1 @@ -66,6 +66,6 @@ iface br-storage inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.20 + bridge_ports {{ interface }}.20 address {{host_info[inventory_hostname].STORAGE_IP}} netmask 255.255.252.0 diff --git a/prototypes/xci/template/opnfv.interface.j2 b/prototypes/xci/template/opnfv.interface.j2 index 74aeea99d..fbaa8b8dd 100644 --- a/prototypes/xci/template/opnfv.interface.j2 +++ b/prototypes/xci/template/opnfv.interface.j2 @@ -6,23 +6,23 @@ auto lo iface lo inet loopback # Physical interface -auto ens3 -iface ens3 inet manual +auto {{ interface }} +iface {{ interface }} inet manual # Container/Host management VLAN interface -auto ens3.10 -iface ens3.10 inet manual - vlan-raw-device ens3 +auto {{ interface }}.10 +iface {{ interface }}.10 inet manual + vlan-raw-device {{ interface }} # OpenStack Networking VXLAN (tunnel/overlay) VLAN interface -auto ens3.30 -iface ens3.30 inet manual - vlan-raw-device ens3 +auto {{ interface }}.30 +iface {{ interface }}.30 inet manual + vlan-raw-device {{ interface }} # Storage network VLAN interface (optional) -auto ens3.20 -iface ens3.20 inet manual - vlan-raw-device ens3 +auto {{ interface }}.20 +iface {{ interface }}.20 inet manual + vlan-raw-device {{ interface }} # Container/Host management bridge auto br-mgmt @@ -30,7 +30,7 @@ iface br-mgmt inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.10 + bridge_ports {{ interface }}.10 address {{host_info[inventory_hostname].MGMT_IP}} netmask 255.255.252.0 @@ -46,7 +46,7 @@ iface br-vxlan inet manual bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.30 + bridge_ports {{ interface }}.30 # OpenStack Networking VLAN bridge auto br-vlan @@ -54,7 +54,7 @@ iface br-vlan inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3 + bridge_ports {{ interface }} address {{host_info[inventory_hostname].VLAN_IP}} netmask 255.255.255.0 gateway 192.168.122.1 @@ -66,6 +66,6 @@ iface br-storage inet static bridge_stp off bridge_waitport 0 bridge_fd 0 - bridge_ports ens3.20 + bridge_ports {{ interface }}.20 address {{host_info[inventory_hostname].STORAGE_IP}} netmask 255.255.252.0 diff --git a/prototypes/xci/var/Debian.yml b/prototypes/xci/var/Debian.yml index e69de29bb..d13d08097 100644 --- a/prototypes/xci/var/Debian.yml +++ b/prototypes/xci/var/Debian.yml @@ -0,0 +1,11 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 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 +############################################################################## +# this is the interface the VM nodes are connected to libvirt network "default" +interface: "ens3" diff --git a/prototypes/xci/var/RedHat.yml b/prototypes/xci/var/RedHat.yml new file mode 100644 index 000000000..6d03e0f32 --- /dev/null +++ b/prototypes/xci/var/RedHat.yml @@ -0,0 +1,10 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 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 +############################################################################## +# this is placeholder and left blank intentionally to complete later on diff --git a/prototypes/xci/var/Suse.yml b/prototypes/xci/var/Suse.yml new file mode 100644 index 000000000..6d03e0f32 --- /dev/null +++ b/prototypes/xci/var/Suse.yml @@ -0,0 +1,10 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 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 +############################################################################## +# this is placeholder and left blank intentionally to complete later on diff --git a/prototypes/xci/var/opnfv.yml b/prototypes/xci/var/opnfv.yml new file mode 100644 index 000000000..174d9b3bf --- /dev/null +++ b/prototypes/xci/var/opnfv.yml @@ -0,0 +1,20 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 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 +############################################################################## +OPNFV_RELENG_GIT_URL: "{{ lookup('env','OPNFV_RELENG_GIT_URL') }}" +OPNFV_RELENG_PATH: "{{ lookup('env','OPNFV_RELENG_PATH') }}" +OPNFV_RELENG_VERSION: "{{ lookup('env','OPNFV_RELENG_VERSION') }}" +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_FLAVOR: "{{ lookup('env','XCI_FLAVOR') }}" +XCI_FLAVOR_ANSIBLE_FILE_PATH: "{{ lookup('env','XCI_FLAVOR_ANSIBLE_FILE_PATH') }}" +LOG_PATH: "{{ lookup('env','LOG_PATH') }}" +OPNFV_HOST_IP: "{{ lookup('env','OPNFV_HOST_IP') }}" diff --git a/utils/test/testapi/opnfv_testapi/common/raises.py b/utils/test/testapi/opnfv_testapi/common/raises.py new file mode 100644 index 000000000..ed3a84ee0 --- /dev/null +++ b/utils/test/testapi/opnfv_testapi/common/raises.py @@ -0,0 +1,31 @@ +import httplib + +from tornado import web + + +class Raiser(object): + code = httplib.OK + + def __init__(self, reason): + raise web.HTTPError(self.code, reason) + + +class BadRequest(Raiser): + code = httplib.BAD_REQUEST + + +class Forbidden(Raiser): + code = httplib.FORBIDDEN + + +class NotFound(Raiser): + code = httplib.NOT_FOUND + + +class Unauthorized(Raiser): + code = httplib.UNAUTHORIZED + + +class CodeTBD(object): + def __init__(self, code, reason): + raise web.HTTPError(code, reason) diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index bf8a92b54..c2b1a6476 100644 --- a/utils/test/testapi/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py @@ -22,13 +22,13 @@ from datetime import datetime import functools -import httplib import json from tornado import gen from tornado import web import models +from opnfv_testapi.common import raises from opnfv_testapi.tornado_swagger import swagger DEFAULT_REPRESENTATION = "application/json" @@ -56,9 +56,7 @@ class GenericApiHandler(web.RequestHandler): try: self.json_args = json.loads(self.request.body) except (ValueError, KeyError, TypeError) as error: - raise web.HTTPError(httplib.BAD_REQUEST, - "Bad Json format [{}]". - format(error)) + raises.BadRequest("Bad Json format [{}]".format(error)) def finish_request(self, json_object=None): if json_object: @@ -83,13 +81,11 @@ class GenericApiHandler(web.RequestHandler): try: token = self.request.headers['X-Auth-Token'] except KeyError: - raise web.HTTPError(httplib.UNAUTHORIZED, - "No Authentication Header.") + raises.Unauthorized("No Authentication Header.") query = {'access_token': token} check = yield self._eval_db_find_one(query, 'tokens') if not check: - raise web.HTTPError(httplib.FORBIDDEN, - "Invalid Token.") + raises.Forbidden("Invalid Token.") ret = yield gen.coroutine(method)(self, *args, **kwargs) raise gen.Return(ret) return wrapper @@ -101,14 +97,13 @@ class GenericApiHandler(web.RequestHandler): :param db_checks: [(table, exist, query, error)] """ if self.json_args is None: - raise web.HTTPError(httplib.BAD_REQUEST, "no body") + raises.BadRequest('no body') data = self.table_cls.from_dict(self.json_args) for miss in miss_checks: miss_data = data.__getattribute__(miss) if miss_data is None or miss_data == '': - raise web.HTTPError(httplib.BAD_REQUEST, - '{} missing'.format(miss)) + raises.BadRequest('{} missing'.format(miss)) for k, v in kwargs.iteritems(): data.__setattr__(k, v) @@ -117,7 +112,7 @@ class GenericApiHandler(web.RequestHandler): check = yield self._eval_db_find_one(query(data), table) if (exist and not check) or (not exist and check): code, message = error(data) - raise web.HTTPError(code, message) + raises.CodeTBD(code, message) if self.table != 'results': data.creation_date = datetime.now() @@ -153,18 +148,16 @@ class GenericApiHandler(web.RequestHandler): def _get_one(self, query): data = yield self._eval_db_find_one(query) if data is None: - raise web.HTTPError(httplib.NOT_FOUND, - "[{}] not exist in table [{}]" - .format(query, self.table)) + raises.NotFound("[{}] not exist in table [{}]" + .format(query, self.table)) self.finish_request(self.format_data(data)) @authenticate def _delete(self, query): data = yield self._eval_db_find_one(query) if data is None: - raise web.HTTPError(httplib.NOT_FOUND, - "[{}] not exit in table [{}]" - .format(query, self.table)) + raises.NotFound("[{}] not exit in table [{}]" + .format(query, self.table)) yield self._eval_db(self.table, 'remove', query) self.finish_request() @@ -172,14 +165,13 @@ class GenericApiHandler(web.RequestHandler): @authenticate def _update(self, query, db_keys): if self.json_args is None: - raise web.HTTPError(httplib.BAD_REQUEST, "No payload") + raises.BadRequest("No payload") # check old data exist from_data = yield self._eval_db_find_one(query) if from_data is None: - raise web.HTTPError(httplib.NOT_FOUND, - "{} could not be found in table [{}]" - .format(query, self.table)) + raises.NotFound("{} could not be found in table [{}]" + .format(query, self.table)) data = self.table_cls.from_dict(from_data) # check new data exist @@ -187,9 +179,8 @@ class GenericApiHandler(web.RequestHandler): if not equal: to_data = yield self._eval_db_find_one(new_query) if to_data is not None: - raise web.HTTPError(httplib.FORBIDDEN, - "{} already exists in table [{}]" - .format(new_query, self.table)) + raises.Forbidden("{} already exists in table [{}]" + .format(new_query, self.table)) # we merge the whole document """ edit_request = self._update_requests(data) @@ -206,7 +197,7 @@ class GenericApiHandler(web.RequestHandler): request = self._update_request(request, k, v, data.__getattribute__(k)) if not request: - raise web.HTTPError(httplib.FORBIDDEN, "Nothing to update") + raises.Forbidden("Nothing to update") edit_request = data.format() edit_request.update(request) diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 44b9f8c07..3e78057ce 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -11,8 +11,8 @@ from datetime import timedelta import httplib from bson import objectid -from tornado import web +from opnfv_testapi.common import raises from opnfv_testapi.resources import handlers from opnfv_testapi.resources import result_models from opnfv_testapi.tornado_swagger import swagger @@ -30,8 +30,7 @@ class GenericResultHandler(handlers.GenericApiHandler): try: value = int(value) except: - raise web.HTTPError(httplib.BAD_REQUEST, - '{} must be int'.format(key)) + raises.BadRequest('{} must be int'.format(key)) return value def set_query(self): diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py index a2856dbd7..9d0233c77 100644 --- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py @@ -1,8 +1,7 @@ import functools import httplib -from tornado import web - +from opnfv_testapi.common import raises from opnfv_testapi.resources import handlers import opnfv_testapi.resources.scenario_models as models from opnfv_testapi.tornado_swagger import swagger @@ -185,8 +184,7 @@ class ScenarioGURHandler(GenericScenarioHandler): def _update_requests_rename(self, data): data.name = self._term.get('name') if not data.name: - raise web.HTTPError(httplib.BAD_REQUEST, - "new scenario name is not provided") + raises.BadRequest("new scenario name is not provided") def _update_requests_add_installer(self, data): data.installers.append(models.ScenarioInstaller.from_dict(self._term)) |