summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jjb/bottlenecks/bottlenecks-cleanup.sh12
-rw-r--r--jjb/bottlenecks/docker_cleanup.sh106
-rw-r--r--jjb/releng/testapi-automate.yml3
-rw-r--r--prototypes/xci/file/ansible-role-requirements.yml205
-rw-r--r--prototypes/xci/file/cinder.yml13
-rw-r--r--prototypes/xci/file/exports14
-rw-r--r--prototypes/xci/file/modules8
-rw-r--r--prototypes/xci/file/setup-openstack.yml26
-rw-r--r--prototypes/xci/playbooks/configure-localhost.yml39
-rw-r--r--prototypes/xci/playbooks/configure-opnfvhost.yml69
-rw-r--r--prototypes/xci/playbooks/inventory10
-rw-r--r--prototypes/xci/playbooks/roles/clone-repository/tasks/main.yml (renamed from utils/test/testapi/opnfv_testapi/common/constants.py)18
-rw-r--r--prototypes/xci/playbooks/roles/remove-folders/tasks/main.yml19
-rw-r--r--prototypes/xci/template/compute.interface.j286
-rw-r--r--prototypes/xci/template/controller.interface.j271
-rw-r--r--prototypes/xci/template/opnfv.interface.j271
-rw-r--r--prototypes/xci/var/Debian.yml10
-rw-r--r--prototypes/xci/var/RedHat.yml10
-rw-r--r--prototypes/xci/var/Suse.yml10
-rw-r--r--prototypes/xci/var/opnfv.yml20
-rw-r--r--prototypes/xci/var/ubuntu.yml0
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/handlers.py30
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/pod_handlers.py5
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/project_handlers.py5
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/result_handlers.py10
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py6
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py7
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py14
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_project.py32
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_result.py30
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py30
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py36
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/test_token.py20
33 files changed, 811 insertions, 234 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/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/xci/file/ansible-role-requirements.yml b/prototypes/xci/file/ansible-role-requirements.yml
new file mode 100644
index 000000000..4faab1950
--- /dev/null
+++ b/prototypes/xci/file/ansible-role-requirements.yml
@@ -0,0 +1,205 @@
+---
+# 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
+##############################################################################
+- name: apt_package_pinning
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-apt_package_pinning
+ version: master
+- name: pip_install
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-pip_install
+ version: master
+- name: galera_client
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-galera_client
+ version: master
+- name: galera_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-galera_server
+ version: master
+- name: ceph_client
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-ceph_client
+ version: master
+- name: haproxy_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-haproxy_server
+ version: master
+- name: keepalived
+ scm: git
+ src: https://github.com/evrardjp/ansible-keepalived
+ version: master
+- name: lxc_container_create
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-lxc_container_create
+ version: master
+- name: lxc_hosts
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
+ version: master
+- name: memcached_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-memcached_server
+ version: master
+- name: openstack-ansible-security
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-security
+ version: master
+- name: openstack_hosts
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
+ version: master
+- name: os_keystone
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_keystone
+ version: master
+- name: openstack_openrc
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-openstack_openrc
+ version: master
+- name: os_aodh
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_aodh
+ version: master
+- name: os_barbican
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_barbican
+ version: master
+- name: os_ceilometer
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_ceilometer
+ version: master
+- name: os_cinder
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_cinder
+ version: master
+- name: os_glance
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_glance
+ version: master
+- name: os_gnocchi
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_gnocchi
+ version: master
+- name: os_heat
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_heat
+ version: master
+- name: os_horizon
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_horizon
+ version: master
+- name: os_ironic
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_ironic
+ version: master
+- name: os_magnum
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_magnum
+ version: master
+- name: os_trove
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_trove
+ version: master
+- name: os_neutron
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_neutron
+ version: master
+- name: os_nova
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_nova
+ version: master
+- name: os_rally
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_rally
+ version: master
+- name: os_sahara
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_sahara
+ version: master
+- name: os_swift
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_swift
+ version: master
+- name: os_tempest
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_tempest
+ version: master
+- name: plugins
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-plugins
+ version: master
+- name: rabbitmq_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server
+ version: master
+- name: repo_build
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-repo_build
+ version: master
+- name: repo_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-repo_server
+ version: master
+- name: rsyslog_client
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-rsyslog_client
+ version: master
+- name: rsyslog_server
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-rsyslog_server
+ version: master
+- name: sshd
+ scm: git
+ src: https://github.com/willshersystems/ansible-sshd
+ version: master
+- name: bird
+ scm: git
+ src: https://github.com/logan2211/ansible-bird
+ version: master
+- name: etcd
+ scm: git
+ src: https://github.com/logan2211/ansible-etcd
+ version: master
+- name: unbound
+ scm: git
+ src: https://github.com/logan2211/ansible-unbound
+ version: master
+- name: resolvconf
+ scm: git
+ src: https://github.com/logan2211/ansible-resolvconf
+ version: master
+- name: os_designate
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_designate
+ version: master
+- name: ceph.ceph-common
+ scm: git
+ src: https://github.com/ceph/ansible-ceph-common
+ version: master
+- name: ceph.ceph-docker-common
+ scm: git
+ src: https://github.com/ceph/ansible-ceph-docker-common
+ version: master
+- name: ceph-mon
+ scm: git
+ src: https://github.com/ceph/ansible-ceph-mon
+ version: master
+- name: ceph-osd
+ scm: git
+ src: https://github.com/ceph/ansible-ceph-osd
+ version: master
+- name: os_octavia
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_octavia
+ version: master
+- name: os_molteniron
+ scm: git
+ src: https://git.openstack.org/openstack/openstack-ansible-os_molteniron
+ version: master
diff --git a/prototypes/xci/file/cinder.yml b/prototypes/xci/file/cinder.yml
index e69de29bb..e40b39256 100644
--- a/prototypes/xci/file/cinder.yml
+++ b/prototypes/xci/file/cinder.yml
@@ -0,0 +1,13 @@
+---
+# This file contains an example to show how to set
+# the cinder-volume service to run in a container.
+#
+# Important note:
+# When using LVM or any iSCSI-based cinder backends, such as NetApp with
+# iSCSI protocol, the cinder-volume service *must* run on metal.
+# Reference: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1226855
+
+container_skel:
+ cinder_volumes_container:
+ properties:
+ is_metal: false
diff --git a/prototypes/xci/file/exports b/prototypes/xci/file/exports
index e69de29bb..af64d618d 100644
--- a/prototypes/xci/file/exports
+++ b/prototypes/xci/file/exports
@@ -0,0 +1,14 @@
+# /etc/exports: the access control list for filesystems which may be exported
+# to NFS clients. See exports(5).
+#
+# Example for NFSv2 and NFSv3:
+# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
+#
+# Example for NFSv4:
+# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
+# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
+#
+# glance images are stored on compute host and made available to image hosts via nfs
+# see image_hosts section in openstack_user_config.yml for details
+/images *(rw,sync,no_subtree_check,no_root_squash)
+
diff --git a/prototypes/xci/file/modules b/prototypes/xci/file/modules
index e69de29bb..60a517f18 100644
--- a/prototypes/xci/file/modules
+++ b/prototypes/xci/file/modules
@@ -0,0 +1,8 @@
+# /etc/modules: kernel modules to load at boot time.
+#
+# This file contains the names of kernel modules that should be loaded
+# at boot time, one per line. Lines beginning with "#" are ignored.
+# Parameters can be specified after the module name.
+
+bonding
+8021q
diff --git a/prototypes/xci/file/setup-openstack.yml b/prototypes/xci/file/setup-openstack.yml
index e69de29bb..48f156ad7 100644
--- a/prototypes/xci/file/setup-openstack.yml
+++ b/prototypes/xci/file/setup-openstack.yml
@@ -0,0 +1,26 @@
+---
+# Copyright 2017, Rackspace US, Inc. and others
+#
+# 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
+- include: os-swift-install.yml
+- include: os-ironic-install.yml
diff --git a/prototypes/xci/playbooks/configure-localhost.yml b/prototypes/xci/playbooks/configure-localhost.yml
index e69de29bb..6a298e012 100644
--- a/prototypes/xci/playbooks/configure-localhost.yml
+++ b/prototypes/xci/playbooks/configure-localhost.yml
@@ -0,0 +1,39 @@
+---
+# 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
+##############################################################################
+- hosts: localhost
+ 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 }}" }
+ tasks:
+ - name: create log directory {{LOG_PATH}}
+ file:
+ path: "{{LOG_PATH}}"
+ state: directory
+ recurse: no
+ # when the deployment is not aio, we use playbook, configure-targethosts.yml, to configure all the hosts
+ - name: copy multihost playbook
+ copy:
+ src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/configure-targethosts.yml"
+ dest: "{{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks"
+ when: XCI_FLAVOR != "aio"
+ # when the deployment is aio, we overwrite and use playbook, configure-opnfvhost.yml, since everything gets installed on opnfv host
+ - name: copy aio playbook
+ copy:
+ src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/configure-opnfvhost.yml"
+ dest: "{{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks"
+ when: XCI_FLAVOR == "aio"
+ - name: copy flavor vars
+ copy:
+ src: "{{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/flavor-vars.yml"
+ dest: "{{OPNFV_RELENG_PATH}}/prototypes/xci/var"
diff --git a/prototypes/xci/playbooks/configure-opnfvhost.yml b/prototypes/xci/playbooks/configure-opnfvhost.yml
new file mode 100644
index 000000000..868052d40
--- /dev/null
+++ b/prototypes/xci/playbooks/configure-opnfvhost.yml
@@ -0,0 +1,69 @@
+---
+# 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
+##############################################################################
+- hosts: opnfv
+ remote_user: root
+ 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 }}" }
+ tasks:
+ - name: generate SSH keys
+ shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
+ args:
+ creates: /root/.ssh/id_rsa
+ - name: fetch public key
+ fetch: src="/root/.ssh/id_rsa.pub" dest="/"
+ - name: copy flavor inventory
+ shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/inventory {{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks"
+ - name: copy flavor vars
+ shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/flavor-vars.yml {{OPNFV_RELENG_PATH}}/prototypes/xci/var"
+ - name: copy openstack_deploy
+ shell: "/bin/cp -rf {{OPENSTACK_OSA_PATH}}/etc/openstack_deploy {{OPENSTACK_OSA_ETC_PATH}}"
+ - name: copy openstack_user_config.yml
+ shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/openstack_user_config.yml {{OPENSTACK_OSA_ETC_PATH}}"
+ - name: copy user_variables.yml
+ shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/user_variables.yml {{OPENSTACK_OSA_ETC_PATH}}"
+ - name: copy cinder.yml
+ shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/prototypes/xci/file/cinder.yml {{OPENSTACK_OSA_ETC_PATH}}/env.d"
+ - name: bootstrap ansible on opnfv host
+ command: "/bin/bash ./scripts/bootstrap-ansible.sh"
+ args:
+ chdir: "{{OPENSTACK_OSA_PATH}}"
+ - name: generate password token
+ command: "python pw-token-gen.py --file {{OPENSTACK_OSA_ETC_PATH}}/user_secrets.yml"
+ args:
+ chdir: "{{OPENSTACK_OSA_PATH}}/scripts"
+ - name: copy OPNFV OpenStack playbook
+ 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:
+ - name: Generate authorized_keys
+ shell: "/bin/cat /opnfv/root/.ssh/id_rsa.pub >> ../file/authorized_keys"
+ - name: Append public keys to authorized_keys
+ shell: "/bin/cat /root/.ssh/id_rsa.pub >> ../file/authorized_keys"
diff --git a/prototypes/xci/playbooks/inventory b/prototypes/xci/playbooks/inventory
index e69de29bb..fd9af9016 100644
--- a/prototypes/xci/playbooks/inventory
+++ b/prototypes/xci/playbooks/inventory
@@ -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
+##############################################################################
+[opnfv]
+opnfv ansible_ssh_host=192.168.122.2
diff --git a/utils/test/testapi/opnfv_testapi/common/constants.py b/prototypes/xci/playbooks/roles/clone-repository/tasks/main.yml
index 71bd95216..3f7e09103 100644
--- a/utils/test/testapi/opnfv_testapi/common/constants.py
+++ b/prototypes/xci/playbooks/roles/clone-repository/tasks/main.yml
@@ -1,16 +1,14 @@
+---
+# SPDX-license-identifier: Apache-2.0
##############################################################################
-# Copyright (c) 2015 Orange
-# guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
+# 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
##############################################################################
-
-
-DEFAULT_REPRESENTATION = "application/json"
-HTTP_BAD_REQUEST = 400
-HTTP_UNAUTHORIZED = 401
-HTTP_FORBIDDEN = 403
-HTTP_NOT_FOUND = 404
-HTTP_OK = 200
+- name: clone "{{ project }}" and checkout "{{ version }}"
+ git:
+ repo: "{{ repo }}"
+ dest: "{{ dest }}"
+ version: "{{ version }}"
diff --git a/prototypes/xci/playbooks/roles/remove-folders/tasks/main.yml b/prototypes/xci/playbooks/roles/remove-folders/tasks/main.yml
new file mode 100644
index 000000000..fb321dfde
--- /dev/null
+++ b/prototypes/xci/playbooks/roles/remove-folders/tasks/main.yml
@@ -0,0 +1,19 @@
+---
+# 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
+##############################################################################
+- name: cleanup leftovers of previous deployment
+ file:
+ path: "{{ item }}"
+ state: absent
+ recurse: no
+ with_items:
+ - "{{ OPNFV_RELENG_PATH }}"
+ - "{{ OPENSTACK_OSA_PATH }}"
+ - "{{ OPENSTACK_OSA_ETC_PATH }}"
+ - "{{ LOG_PATH }} "
diff --git a/prototypes/xci/template/compute.interface.j2 b/prototypes/xci/template/compute.interface.j2
index e69de29bb..1719f6a08 100644
--- a/prototypes/xci/template/compute.interface.j2
+++ b/prototypes/xci/template/compute.interface.j2
@@ -0,0 +1,86 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+
+# Physical interface
+auto ens3
+iface ens3 inet manual
+
+# Container/Host management VLAN interface
+auto ens3.10
+iface ens3.10 inet manual
+ vlan-raw-device ens3
+
+# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
+auto ens3.30
+iface ens3.30 inet manual
+ vlan-raw-device ens3
+
+# Storage network VLAN interface (optional)
+auto ens3.20
+iface ens3.20 inet manual
+ vlan-raw-device ens3
+
+# Container/Host management bridge
+auto br-mgmt
+iface br-mgmt inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.10
+ address {{host_info[inventory_hostname].MGMT_IP}}
+ netmask 255.255.252.0
+
+# compute1 VXLAN (tunnel/overlay) bridge config
+auto br-vxlan
+iface br-vxlan inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.30
+ address {{host_info[inventory_hostname].VXLAN_IP}}
+ netmask 255.255.252.0
+
+# OpenStack Networking VLAN bridge
+auto br-vlan
+iface br-vlan inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3
+ address {{host_info[inventory_hostname].VLAN_IP}}
+ netmask 255.255.255.0
+ gateway 192.168.122.1
+ offload-sg off
+ # Create veth pair, don't bomb if already exists
+ pre-up ip link add br-vlan-veth type veth peer name eth12 || true
+ # Set both ends UP
+ pre-up ip link set br-vlan-veth up
+ pre-up ip link set eth12 up
+ # Delete veth pair on DOWN
+ post-down ip link del br-vlan-veth || true
+ bridge_ports br-vlan-veth
+
+# Add an additional address to br-vlan
+iface br-vlan inet static
+ # Flat network default gateway
+ # -- This needs to exist somewhere for network reachability
+ # -- from the router namespace for floating IP paths.
+ # -- Putting this here is primarily for tempest to work.
+ address {{host_info[inventory_hostname].VLAN_IP_SECOND}}
+ netmask 255.255.252.0
+ dns-nameserver 8.8.8.8 8.8.4.4
+
+# compute1 Storage bridge
+auto br-storage
+iface br-storage inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.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 e69de29bb..74aeea99d 100644
--- a/prototypes/xci/template/controller.interface.j2
+++ b/prototypes/xci/template/controller.interface.j2
@@ -0,0 +1,71 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# Physical interface
+auto ens3
+iface ens3 inet manual
+
+# Container/Host management VLAN interface
+auto ens3.10
+iface ens3.10 inet manual
+ vlan-raw-device ens3
+
+# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
+auto ens3.30
+iface ens3.30 inet manual
+ vlan-raw-device ens3
+
+# Storage network VLAN interface (optional)
+auto ens3.20
+iface ens3.20 inet manual
+ vlan-raw-device ens3
+
+# Container/Host management bridge
+auto br-mgmt
+iface br-mgmt inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.10
+ address {{host_info[inventory_hostname].MGMT_IP}}
+ netmask 255.255.252.0
+
+# OpenStack Networking VXLAN (tunnel/overlay) bridge
+#
+# Only the COMPUTE and NETWORK nodes must have an IP address
+# on this bridge. When used by infrastructure nodes, the
+# IP addresses are assigned to containers which use this
+# bridge.
+#
+auto br-vxlan
+iface br-vxlan inet manual
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.30
+
+# OpenStack Networking VLAN bridge
+auto br-vlan
+iface br-vlan inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3
+ address {{host_info[inventory_hostname].VLAN_IP}}
+ netmask 255.255.255.0
+ gateway 192.168.122.1
+ dns-nameserver 8.8.8.8 8.8.4.4
+
+# compute1 Storage bridge
+auto br-storage
+iface br-storage inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.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 e69de29bb..74aeea99d 100644
--- a/prototypes/xci/template/opnfv.interface.j2
+++ b/prototypes/xci/template/opnfv.interface.j2
@@ -0,0 +1,71 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# Physical interface
+auto ens3
+iface ens3 inet manual
+
+# Container/Host management VLAN interface
+auto ens3.10
+iface ens3.10 inet manual
+ vlan-raw-device ens3
+
+# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface
+auto ens3.30
+iface ens3.30 inet manual
+ vlan-raw-device ens3
+
+# Storage network VLAN interface (optional)
+auto ens3.20
+iface ens3.20 inet manual
+ vlan-raw-device ens3
+
+# Container/Host management bridge
+auto br-mgmt
+iface br-mgmt inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.10
+ address {{host_info[inventory_hostname].MGMT_IP}}
+ netmask 255.255.252.0
+
+# OpenStack Networking VXLAN (tunnel/overlay) bridge
+#
+# Only the COMPUTE and NETWORK nodes must have an IP address
+# on this bridge. When used by infrastructure nodes, the
+# IP addresses are assigned to containers which use this
+# bridge.
+#
+auto br-vxlan
+iface br-vxlan inet manual
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.30
+
+# OpenStack Networking VLAN bridge
+auto br-vlan
+iface br-vlan inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3
+ address {{host_info[inventory_hostname].VLAN_IP}}
+ netmask 255.255.255.0
+ gateway 192.168.122.1
+ dns-nameserver 8.8.8.8 8.8.4.4
+
+# compute1 Storage bridge
+auto br-storage
+iface br-storage inet static
+ bridge_stp off
+ bridge_waitport 0
+ bridge_fd 0
+ bridge_ports ens3.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
new file mode 100644
index 000000000..6d03e0f32
--- /dev/null
+++ b/prototypes/xci/var/Debian.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/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/prototypes/xci/var/ubuntu.yml b/prototypes/xci/var/ubuntu.yml
deleted file mode 100644
index e69de29bb..000000000
--- a/prototypes/xci/var/ubuntu.yml
+++ /dev/null
diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py
index 15096468c..bf8a92b54 100644
--- a/utils/test/testapi/opnfv_testapi/resources/handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py
@@ -22,15 +22,17 @@
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 constants
from opnfv_testapi.tornado_swagger import swagger
+DEFAULT_REPRESENTATION = "application/json"
+
class GenericApiHandler(web.RequestHandler):
def __init__(self, application, request, **kwargs):
@@ -50,18 +52,18 @@ class GenericApiHandler(web.RequestHandler):
if self.request.method != "GET" and self.request.method != "DELETE":
if self.request.headers.get("Content-Type") is not None:
if self.request.headers["Content-Type"].startswith(
- constants.DEFAULT_REPRESENTATION):
+ DEFAULT_REPRESENTATION):
try:
self.json_args = json.loads(self.request.body)
except (ValueError, KeyError, TypeError) as error:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST,
+ raise web.HTTPError(httplib.BAD_REQUEST,
"Bad Json format [{}]".
format(error))
def finish_request(self, json_object=None):
if json_object:
self.write(json.dumps(json_object))
- self.set_header("Content-Type", constants.DEFAULT_REPRESENTATION)
+ self.set_header("Content-Type", DEFAULT_REPRESENTATION)
self.finish()
def _create_response(self, resource):
@@ -81,12 +83,12 @@ class GenericApiHandler(web.RequestHandler):
try:
token = self.request.headers['X-Auth-Token']
except KeyError:
- raise web.HTTPError(constants.HTTP_UNAUTHORIZED,
+ raise web.HTTPError(httplib.UNAUTHORIZED,
"No Authentication Header.")
query = {'access_token': token}
check = yield self._eval_db_find_one(query, 'tokens')
if not check:
- raise web.HTTPError(constants.HTTP_FORBIDDEN,
+ raise web.HTTPError(httplib.FORBIDDEN,
"Invalid Token.")
ret = yield gen.coroutine(method)(self, *args, **kwargs)
raise gen.Return(ret)
@@ -99,13 +101,13 @@ class GenericApiHandler(web.RequestHandler):
:param db_checks: [(table, exist, query, error)]
"""
if self.json_args is None:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST, "no body")
+ raise web.HTTPError(httplib.BAD_REQUEST, "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(constants.HTTP_BAD_REQUEST,
+ raise web.HTTPError(httplib.BAD_REQUEST,
'{} missing'.format(miss))
for k, v in kwargs.iteritems():
@@ -151,7 +153,7 @@ class GenericApiHandler(web.RequestHandler):
def _get_one(self, query):
data = yield self._eval_db_find_one(query)
if data is None:
- raise web.HTTPError(constants.HTTP_NOT_FOUND,
+ raise web.HTTPError(httplib.NOT_FOUND,
"[{}] not exist in table [{}]"
.format(query, self.table))
self.finish_request(self.format_data(data))
@@ -160,7 +162,7 @@ class GenericApiHandler(web.RequestHandler):
def _delete(self, query):
data = yield self._eval_db_find_one(query)
if data is None:
- raise web.HTTPError(constants.HTTP_NOT_FOUND,
+ raise web.HTTPError(httplib.NOT_FOUND,
"[{}] not exit in table [{}]"
.format(query, self.table))
@@ -170,12 +172,12 @@ class GenericApiHandler(web.RequestHandler):
@authenticate
def _update(self, query, db_keys):
if self.json_args is None:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST, "No payload")
+ raise web.HTTPError(httplib.BAD_REQUEST, "No payload")
# check old data exist
from_data = yield self._eval_db_find_one(query)
if from_data is None:
- raise web.HTTPError(constants.HTTP_NOT_FOUND,
+ raise web.HTTPError(httplib.NOT_FOUND,
"{} could not be found in table [{}]"
.format(query, self.table))
@@ -185,7 +187,7 @@ 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(constants.HTTP_FORBIDDEN,
+ raise web.HTTPError(httplib.FORBIDDEN,
"{} already exists in table [{}]"
.format(new_query, self.table))
@@ -204,7 +206,7 @@ class GenericApiHandler(web.RequestHandler):
request = self._update_request(request, k, v,
data.__getattribute__(k))
if not request:
- raise web.HTTPError(constants.HTTP_FORBIDDEN, "Nothing to update")
+ raise web.HTTPError(httplib.FORBIDDEN, "Nothing to update")
edit_request = data.format()
edit_request.update(request)
diff --git a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py
index 65c27f60a..fd9ce3eb5 100644
--- a/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py
@@ -6,8 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
+
import handlers
-from opnfv_testapi.common import constants
from opnfv_testapi.tornado_swagger import swagger
import pod_models
@@ -46,7 +47,7 @@ class PodCLHandler(GenericPodHandler):
def error(data):
message = '{} already exists as a pod'.format(data.name)
- return constants.HTTP_FORBIDDEN, message
+ return httplib.FORBIDDEN, message
miss_checks = ['name']
db_checks = [(self.table, False, query, error)]
diff --git a/utils/test/testapi/opnfv_testapi/resources/project_handlers.py b/utils/test/testapi/opnfv_testapi/resources/project_handlers.py
index f3521961d..087bb8af2 100644
--- a/utils/test/testapi/opnfv_testapi/resources/project_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/project_handlers.py
@@ -6,8 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
+
import handlers
-from opnfv_testapi.common import constants
from opnfv_testapi.tornado_swagger import swagger
import project_models
@@ -48,7 +49,7 @@ class ProjectCLHandler(GenericProjectHandler):
def error(data):
message = '{} already exists as a project'.format(data.name)
- return constants.HTTP_FORBIDDEN, message
+ return httplib.FORBIDDEN, message
miss_checks = ['name']
db_checks = [(self.table, False, query, error)]
diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
index d41ba4820..44b9f8c07 100644
--- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
@@ -8,11 +8,11 @@
##############################################################################
from datetime import datetime
from datetime import timedelta
+import httplib
from bson import objectid
from tornado import web
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import handlers
from opnfv_testapi.resources import result_models
from opnfv_testapi.tornado_swagger import swagger
@@ -30,7 +30,7 @@ class GenericResultHandler(handlers.GenericApiHandler):
try:
value = int(value)
except:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST,
+ raise web.HTTPError(httplib.BAD_REQUEST,
'{} must be int'.format(key))
return value
@@ -146,14 +146,14 @@ class ResultsCLHandler(GenericResultHandler):
def pod_error(data):
message = 'Could not find pod [{}]'.format(data.pod_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
def project_query(data):
return {'name': data.project_name}
def project_error(data):
message = 'Could not find project [{}]'.format(data.project_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
def testcase_query(data):
return {'project_name': data.project_name, 'name': data.case_name}
@@ -161,7 +161,7 @@ class ResultsCLHandler(GenericResultHandler):
def testcase_error(data):
message = 'Could not find testcase [{}] in project [{}]'\
.format(data.case_name, data.project_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
miss_checks = ['pod_name', 'project_name', 'case_name']
db_checks = [('pods', True, pod_query, pod_error),
diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
index 80eb1aabe..a2856dbd7 100644
--- a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
@@ -1,8 +1,8 @@
import functools
+import httplib
from tornado import web
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import handlers
import opnfv_testapi.resources.scenario_models as models
from opnfv_testapi.tornado_swagger import swagger
@@ -84,7 +84,7 @@ class ScenariosCLHandler(GenericScenarioHandler):
def error(data):
message = '{} already exists as a scenario'.format(data.name)
- return constants.HTTP_FORBIDDEN, message
+ return httplib.FORBIDDEN, message
miss_checks = ['name']
db_checks = [(self.table, False, query, error)]
@@ -185,7 +185,7 @@ class ScenarioGURHandler(GenericScenarioHandler):
def _update_requests_rename(self, data):
data.name = self._term.get('name')
if not data.name:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST,
+ raise web.HTTPError(httplib.BAD_REQUEST,
"new scenario name is not provided")
def _update_requests_add_installer(self, data):
diff --git a/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py b/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py
index 3debd6918..1211a0573 100644
--- a/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py
@@ -6,7 +6,8 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from opnfv_testapi.common import constants
+import httplib
+
from opnfv_testapi.resources import handlers
from opnfv_testapi.resources import testcase_models
from opnfv_testapi.tornado_swagger import swagger
@@ -58,12 +59,12 @@ class TestcaseCLHandler(GenericTestcaseHandler):
def p_error(data):
message = 'Could not find project [{}]'.format(data.project_name)
- return constants.HTTP_FORBIDDEN, message
+ return httplib.FORBIDDEN, message
def tc_error(data):
message = '{} already exists as a testcase in project {}'\
.format(data.name, data.project_name)
- return constants.HTTP_FORBIDDEN, message
+ return httplib.FORBIDDEN, message
miss_checks = ['name']
db_checks = [(self.db_projects, True, p_query, p_error),
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
index 922bd46e2..cec90d8a5 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py
@@ -6,9 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import pod_models
import test_base as base
@@ -37,36 +37,36 @@ class TestPodBase(base.TestBase):
class TestPodCreate(TestPodBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = pod_models.PodCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = pod_models.PodCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestPodGet(TestPodBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
index afd4a6601..75b2d5260 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py
@@ -6,9 +6,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
import test_base as base
@@ -37,41 +37,41 @@ class TestProjectBase(base.TestBase):
class TestProjectCreate(TestProjectBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = project_models.ProjectCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = project_models.ProjectCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestProjectGet(TestProjectBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_body(body)
def test_list(self):
@@ -88,23 +88,23 @@ class TestProjectGet(TestProjectBase):
class TestProjectUpdate(TestProjectBase):
def test_withoutBody(self):
code, _ = self.update(None, 'noBody')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_notFound(self):
code, _ = self.update(self.req_e, 'notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_newNameExist(self):
self.create_d()
self.create_e()
code, body = self.update(self.req_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("already exists", body)
def test_noUpdate(self):
self.create_d()
code, body = self.update(self.req_d, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("Nothing to update", body)
def test_success(self):
@@ -114,7 +114,7 @@ class TestProjectUpdate(TestProjectBase):
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(_id, body._id)
self.assert_body(body, req)
@@ -126,16 +126,16 @@ class TestProjectUpdate(TestProjectBase):
class TestProjectDelete(TestProjectBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(body, '')
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
if __name__ == '__main__':
unittest.main()
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
index 2c7268eb6..05220f1d2 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py
@@ -8,9 +8,9 @@
##############################################################################
import copy
from datetime import datetime, timedelta
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import pod_models
from opnfv_testapi.resources import project_models
from opnfv_testapi.resources import result_models
@@ -99,7 +99,7 @@ class TestResultBase(base.TestBase):
self.project)
def assert_res(self, code, result, req=None):
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if req is None:
req = self.req_d
self.assertEqual(result.pod_name, req.pod_name)
@@ -134,61 +134,61 @@ class TestResultBase(base.TestBase):
class TestResultCreate(TestResultBase):
def test_nobody(self):
(code, body) = self.create(None)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('no body', body)
def test_podNotProvided(self):
req = self.req_d
req.pod_name = None
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('pod_name missing', body)
def test_projectNotProvided(self):
req = self.req_d
req.project_name = None
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('project_name missing', body)
def test_testcaseNotProvided(self):
req = self.req_d
req.case_name = None
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('case_name missing', body)
def test_noPod(self):
req = self.req_d
req.pod_name = 'notExistPod'
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find pod', body)
def test_noProject(self):
req = self.req_d
req.project_name = 'notExistProject'
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find project', body)
def test_noTestcase(self):
req = self.req_d
req.case_name = 'notExistTestcase'
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
self.assertIn('Could not find testcase', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_href(body)
def test_key_with_doc(self):
req = copy.deepcopy(self.req_d)
req.details = {'1.name': 'dot_name'}
(code, body) = self.create(req)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_href(body)
def test_no_ti(self):
@@ -205,7 +205,7 @@ class TestResultCreate(TestResultBase):
criteria=self.criteria)
(code, res) = self.create(req)
_id = res.href.split('/')[-1]
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
code, body = self.get(_id)
self.assert_res(code, body, req)
@@ -245,7 +245,7 @@ class TestResultGet(TestResultBase):
def test_queryPeriodNotInt(self):
code, body = self.query(self._set_query('period=a'))
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('period must be int', body)
def test_queryPeriodFail(self):
@@ -258,7 +258,7 @@ class TestResultGet(TestResultBase):
def test_queryLastNotInt(self):
code, body = self.query(self._set_query('last=a'))
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('last must be int', body)
def test_queryLast(self):
@@ -297,7 +297,7 @@ class TestResultGet(TestResultBase):
req = self._create_changed_date(**kwargs)
code, body = self.query(query)
if not found:
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(0, len(body.results))
else:
self.assertEqual(1, len(body.results))
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
index b62c1d294..ab2c34b31 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_scenario.py
@@ -1,10 +1,10 @@
from copy import deepcopy
from datetime import datetime
import functools
+import httplib
import json
import os
-from opnfv_testapi.common import constants
import opnfv_testapi.resources.scenario_models as models
import test_base as base
@@ -37,7 +37,7 @@ class TestScenarioBase(base.TestBase):
return res.href.split('/')[-1]
def assert_res(self, code, scenario, req=None):
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if req is None:
req = self.req_d
self.assertIsNotNone(scenario._id)
@@ -60,29 +60,29 @@ class TestScenarioBase(base.TestBase):
class TestScenarioCreate(TestScenarioBase):
def test_withoutBody(self):
(code, body) = self.create()
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_emptyName(self):
req_empty = models.ScenarioCreateRequest('')
(code, body) = self.create(req_empty)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = models.ScenarioCreateRequest(None)
(code, body) = self.create(req_none)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body)
def test_alreadyExist(self):
self.create_d()
(code, body) = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
@@ -125,7 +125,7 @@ class TestScenarioGet(TestScenarioBase):
def _query_and_assert(self, query, found=True, reqs=None):
code, body = self.query(query)
if not found:
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(0, len(body.scenarios))
else:
self.assertEqual(len(reqs), len(body.scenarios))
@@ -327,32 +327,32 @@ class TestScenarioUpdate(TestScenarioBase):
def _update_and_assert(self, update_req, new_scenario, name=None):
code, _ = self.update(update_req, self.scenario)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self._get_and_assert(_none_default(name, self.scenario),
new_scenario)
def _success(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_OK)
+ self.assertEqual(status, httplib.OK)
self._get_and_assert(new_scenario.get('name'), new_scenario)
def _forbidden(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_FORBIDDEN)
+ self.assertEqual(status, httplib.FORBIDDEN)
def _bad_request(self, status, new_scenario):
- self.assertEqual(status, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(status, httplib.BAD_REQUEST)
class TestScenarioDelete(TestScenarioBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
scenario = self.create_return_name(self.req_d)
code, _ = self.delete(scenario)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
code, _ = self.get(scenario)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def _none_default(check, default):
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
index c0494db5d..ec44fcae5 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py
@@ -7,9 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import copy
+import httplib
import unittest
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
from opnfv_testapi.resources import testcase_models
import test_base as base
@@ -79,46 +79,46 @@ class TestCaseBase(base.TestBase):
class TestCaseCreate(TestCaseBase):
def test_noBody(self):
(code, body) = self.create(None, 'vping')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_noProject(self):
code, body = self.create(self.req_d, 'noProject')
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Could not find project', body)
def test_emptyName(self):
req_empty = testcase_models.TestcaseCreateRequest('')
(code, body) = self.create(req_empty, self.project)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_noneName(self):
req_none = testcase_models.TestcaseCreateRequest(None)
(code, body) = self.create(req_none, self.project)
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
self.assertIn('name missing', body)
def test_success(self):
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_create_body(body, None, self.project)
def test_alreadyExist(self):
self.create_d()
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('already exists', body)
class TestCaseGet(TestCaseBase):
def test_notExist(self):
code, body = self.get('notExist')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_getOne(self):
self.create_d()
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assert_body(body)
def test_list(self):
@@ -135,23 +135,23 @@ class TestCaseGet(TestCaseBase):
class TestCaseUpdate(TestCaseBase):
def test_noBody(self):
code, _ = self.update(case='noBody')
- self.assertEqual(code, constants.HTTP_BAD_REQUEST)
+ self.assertEqual(code, httplib.BAD_REQUEST)
def test_notFound(self):
code, _ = self.update(self.update_e, 'notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_newNameExist(self):
self.create_d()
self.create_e()
code, body = self.update(self.update_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("already exists", body)
def test_noUpdate(self):
self.create_d()
code, body = self.update(self.update_d, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn("Nothing to update", body)
def test_success(self):
@@ -160,7 +160,7 @@ class TestCaseUpdate(TestCaseBase):
_id = body._id
code, body = self.update(self.update_e, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(_id, body._id)
self.assert_update_body(self.req_d, body, self.update_e)
@@ -173,22 +173,22 @@ class TestCaseUpdate(TestCaseBase):
update = copy.deepcopy(self.update_d)
update.description = {'2. change': 'dollar change'}
code, body = self.update(update, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestCaseDelete(TestCaseBase):
def test_notFound(self):
code, body = self.delete('notFound')
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
def test_success(self):
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
self.assertEqual(body, '')
code, body = self.get(self.req_d.name)
- self.assertEqual(code, constants.HTTP_NOT_FOUND)
+ self.assertEqual(code, httplib.NOT_FOUND)
if __name__ == '__main__':
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
index 19b9e3e07..9cc52a2f0 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_token.py
@@ -3,12 +3,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import httplib
import unittest
from tornado import web
import fake_pymongo
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import project_models
from opnfv_testapi.router import url_mappings
import test_base as base
@@ -34,19 +34,19 @@ class TestTokenCreateProject(TestToken):
def test_projectCreateTokenInvalid(self):
self.headers['X-Auth-Token'] = '1234'
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectCreateTokenUnauthorized(self):
self.headers.pop('X-Auth-Token')
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectCreateTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
code, body = self.create_d()
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestTokenDeleteProject(TestToken):
@@ -61,7 +61,7 @@ class TestTokenDeleteProject(TestToken):
self.create_d()
self.headers['X-Auth-Token'] = '1234'
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectDeleteTokenUnauthorized(self):
@@ -69,14 +69,14 @@ class TestTokenDeleteProject(TestToken):
self.create_d()
self.headers.pop('X-Auth-Token')
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectDeleteTokenSuccess(self):
self.headers['X-Auth-Token'] = '12345'
self.create_d()
code, body = self.delete(self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
class TestTokenUpdateProject(TestToken):
@@ -93,7 +93,7 @@ class TestTokenUpdateProject(TestToken):
self.headers['X-Auth-Token'] = '1234'
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_FORBIDDEN)
+ self.assertEqual(code, httplib.FORBIDDEN)
self.assertIn('Invalid Token.', body)
def test_projectUpdateTokenUnauthorized(self):
@@ -103,7 +103,7 @@ class TestTokenUpdateProject(TestToken):
self.headers.pop('X-Auth-Token')
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_UNAUTHORIZED)
+ self.assertEqual(code, httplib.UNAUTHORIZED)
self.assertIn('No Authentication Header.', body)
def test_projectUpdateTokenSuccess(self):
@@ -112,7 +112,7 @@ class TestTokenUpdateProject(TestToken):
code, body = self.get(self.req_d.name)
req = project_models.ProjectUpdateRequest('newName', 'new description')
code, body = self.update(req, self.req_d.name)
- self.assertEqual(code, constants.HTTP_OK)
+ self.assertEqual(code, httplib.OK)
if __name__ == '__main__':
unittest.main()