Merge "Update gate logic"
This commit is contained in:
commit
e64909eac9
25
.pylintrc
25
.pylintrc
@ -19,19 +19,11 @@ disable=
|
||||
locally-disabled,
|
||||
# "E" Error for important programming issues (likely bugs)
|
||||
access-member-before-definition,
|
||||
bad-super-call,
|
||||
maybe-no-member,
|
||||
no-member,
|
||||
no-method-argument,
|
||||
no-self-argument,
|
||||
not-callable,
|
||||
no-value-for-parameter,
|
||||
super-on-old-class,
|
||||
too-few-format-args,
|
||||
# "W" Warnings for stylistic problems or minor programming issues
|
||||
abstract-method,
|
||||
anomalous-backslash-in-string,
|
||||
anomalous-unicode-escape-in-string,
|
||||
arguments-differ,
|
||||
attribute-defined-outside-init,
|
||||
bad-builtin,
|
||||
@ -39,33 +31,29 @@ disable=
|
||||
broad-except,
|
||||
dangerous-default-value,
|
||||
deprecated-lambda,
|
||||
duplicate-key,
|
||||
expression-not-assigned,
|
||||
fixme,
|
||||
global-statement,
|
||||
global-variable-not-assigned,
|
||||
logging-not-lazy,
|
||||
no-init,
|
||||
non-parent-init-called,
|
||||
not-callable,
|
||||
protected-access,
|
||||
redefined-builtin,
|
||||
redefined-outer-name,
|
||||
redefine-in-handler,
|
||||
signature-differs,
|
||||
star-args,
|
||||
super-init-not-called,
|
||||
unnecessary-lambda,
|
||||
unnecessary-pass,
|
||||
super-on-old-class,
|
||||
unpacking-non-sequence,
|
||||
unreachable,
|
||||
unused-argument,
|
||||
unused-import,
|
||||
unused-variable,
|
||||
# TODO(dougwig) - disable nonstandard-exception while we have neutron_lib shims
|
||||
nonstandard-exception,
|
||||
# "C" Coding convention violations
|
||||
bad-continuation,
|
||||
invalid-name,
|
||||
missing-docstring,
|
||||
old-style-class,
|
||||
superfluous-parens,
|
||||
# "R" Refactor recommendations
|
||||
abstract-class-little-used,
|
||||
@ -82,7 +70,10 @@ disable=
|
||||
too-many-locals,
|
||||
too-many-public-methods,
|
||||
too-many-return-statements,
|
||||
too-many-statements
|
||||
too-many-statements,
|
||||
cyclic-import,
|
||||
no-name-in-module,
|
||||
bad-super-call
|
||||
|
||||
[BASIC]
|
||||
# Variable names can be 1 to 31 characters long, with lowercase and underscores
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
|
@ -21,3 +21,5 @@ WebTest>=2.0 # MIT
|
||||
tempest-lib>=0.14.0 # Apache-2.0
|
||||
reno>=1.8.0 # Apache2
|
||||
bandit>=1.0.1 # Apache-2.0
|
||||
tempest>=12.1.0 # Apache-2.0
|
||||
pylint==1.4.5 # GPLv2
|
||||
|
@ -1,31 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2014 VA Linux Systems Japan K.K.
|
||||
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# The purpose of this script is to avoid casual introduction of more
|
||||
# bash dependency. Please consider alternatives before committing code
|
||||
# which uses bash specific features.
|
||||
|
||||
# Ignore comments, but include shebangs
|
||||
OBSERVED=$(grep -E '^([^#]|#!).*bash' tox.ini tools/* | wc -l)
|
||||
EXPECTED=5
|
||||
if [ ${EXPECTED} -ne ${OBSERVED} ]; then
|
||||
echo Unexpected number of bash usages are detected.
|
||||
echo Please read the comment in $0
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
58
tools/coding-checks.sh
Executable file
58
tools/coding-checks.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
usage () {
|
||||
echo "Usage: $0 [OPTION]..."
|
||||
echo "Run vmware-nsx's coding check(s)"
|
||||
echo ""
|
||||
echo " -Y, --pylint [<basecommit>] Run pylint check on the entire vmware-nsx module or just files changed in basecommit (e.g. HEAD~1)"
|
||||
echo " -h, --help Print this usage message"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
process_options () {
|
||||
i=1
|
||||
while [ $i -le $# ]; do
|
||||
eval opt=\$$i
|
||||
case $opt in
|
||||
-h|--help) usage;;
|
||||
-Y|--pylint) pylint=1;;
|
||||
*) scriptargs="$scriptargs $opt"
|
||||
esac
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
run_pylint () {
|
||||
local target="${scriptargs:-all}"
|
||||
|
||||
if [ "$target" = "all" ]; then
|
||||
files="vmware_nsx"
|
||||
else
|
||||
case "$target" in
|
||||
*HEAD~[0-9]*) files=$(git diff --diff-filter=AM --name-only $target -- "*.py");;
|
||||
*) echo "$target is an unrecognized basecommit"; exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "Running pylint..."
|
||||
echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)..."
|
||||
if [ -n "${files}" ]; then
|
||||
pylint --rcfile=.pylintrc --output-format=colorized ${files}
|
||||
else
|
||||
echo "No python changes in this commit, pylint check not required."
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
scriptargs=
|
||||
pylint=1
|
||||
|
||||
process_options $@
|
||||
|
||||
if [ $pylint -eq 1 ]; then
|
||||
run_pylint
|
||||
exit 0
|
||||
fi
|
@ -52,8 +52,15 @@ def print_help():
|
||||
|
||||
|
||||
def main(argv):
|
||||
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
venv = os.path.join(root, '.venv')
|
||||
if 'tools_path' in os.environ:
|
||||
root = os.environ['tools_path']
|
||||
else:
|
||||
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
if 'venv' in os.environ:
|
||||
venv = os.environ['venv']
|
||||
else:
|
||||
venv = os.path.join(root, '.venv')
|
||||
|
||||
pip_requires = os.path.join(root, 'requirements.txt')
|
||||
test_requires = os.path.join(root, 'test-requirements.txt')
|
||||
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
|
||||
|
83
tools/misc-sanity-checks.sh
Executable file
83
tools/misc-sanity-checks.sh
Executable file
@ -0,0 +1,83 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright (C) 2014 VA Linux Systems Japan K.K.
|
||||
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
TMPDIR=`mktemp -d /tmp/${0##*/}.XXXXXX` || exit 1
|
||||
export TMPDIR
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
FAILURES=$TMPDIR/failures
|
||||
|
||||
|
||||
check_no_symlinks_allowed () {
|
||||
# Symlinks break the package build process, so ensure that they
|
||||
# do not slip in, except hidden symlinks.
|
||||
if [ $(find . -type l ! -path '*/.*' | wc -l) -ge 1 ]; then
|
||||
echo "Symlinks are not allowed!" >>$FAILURES
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
check_pot_files_errors () {
|
||||
# The job vmware-nsx-propose-translation-update does not update from
|
||||
# transifex since our po files contain duplicate entries where
|
||||
# obsolete entries duplicate normal entries. Prevent obsolete
|
||||
# entries to slip in
|
||||
if [ $(find vmware_nsx -type f -regex '.*\.pot?' | wc -l) -ge 1 ]; then
|
||||
find vmware_nsx -type f -regex '.*\.pot?' \
|
||||
-print0|xargs -0 -n 1 msgfmt --check-format \
|
||||
-o /dev/null
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "PO files syntax is not correct!" >>$FAILURES
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
check_identical_policy_files () {
|
||||
# For unit tests, we maintain their own policy.json file to make test suite
|
||||
# independent of whether it's executed from the vmware-nsx source tree or from
|
||||
# site-packages installation path. We don't want two copies of the same
|
||||
# file to diverge, so checking that they are identical
|
||||
diff etc/policy.json vmware-nsx/tests/etc/policy.json 2>&1 > /dev/null
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "policy.json files must be identical!" >>$FAILURES
|
||||
fi
|
||||
}
|
||||
|
||||
check_no_duplicate_api_test_idempotent_ids() {
|
||||
# For API tests, an idempotent ID is assigned to each single API test,
|
||||
# those IDs should be unique
|
||||
output=$(check-uuid --package vmware_nsx_tempest)
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "There are duplicate idempotent ids in the API tests" >>$FAILURES
|
||||
echo "please, assign unique uuids to each API test:" >>$FAILURES
|
||||
echo "$output" >>$FAILURES
|
||||
fi
|
||||
}
|
||||
|
||||
# Add your checks here...
|
||||
check_no_symlinks_allowed
|
||||
check_pot_files_errors
|
||||
#check_identical_policy_files
|
||||
check_no_duplicate_api_test_idempotent_ids
|
||||
|
||||
# Fail, if there are emitted failures
|
||||
if [ -f $FAILURES ]; then
|
||||
cat $FAILURES
|
||||
exit 1
|
||||
fi
|
8
tools/ostestr_compat_shim.sh
Executable file
8
tools/ostestr_compat_shim.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# preserve old behavior of using an arg as a regex when '--' is not present
|
||||
case $@ in
|
||||
(*--*) ostestr $@;;
|
||||
('') ostestr;;
|
||||
(*) ostestr --regex "$@"
|
||||
esac
|
@ -1,6 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
TESTRARGS=$1
|
||||
|
||||
exec 3>&1
|
||||
status=$(exec 4>&1 >&3; ( python setup.py testr --slowest --testr-args="--subunit $TESTRARGS"; echo $? >&4 ) | subunit-trace -f) && exit $status
|
@ -1,72 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Many of neutron's repos suffer from the problem of depending on neutron,
|
||||
# but it not existing on pypi.
|
||||
|
||||
# This wrapper for tox's package installer will use the existing package
|
||||
# if it exists, else use zuul-cloner if that program exists, else grab it
|
||||
# from neutron master via a hard-coded URL. That last case should only
|
||||
# happen with devs running unit tests locally.
|
||||
|
||||
# From the tox.ini config page:
|
||||
# install_command=ARGV
|
||||
# default:
|
||||
# pip install {opts} {packages}
|
||||
|
||||
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||
BRANCH_NAME=master
|
||||
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
||||
networking_l2gw_installed=$(echo "import networking_l2gw" | python 2>/dev/null ; echo $?)
|
||||
neutron_lbaas_installed=$(echo "import neutron_lbaas" | python 2>/dev/null ; echo $?)
|
||||
|
||||
set -ex
|
||||
|
||||
cwd=$(/bin/pwd)
|
||||
> /tmp/tox_install.txt
|
||||
|
||||
zuul_cloner () {
|
||||
echo "ZUUL CLONER" >> /tmp/tox_install.txt
|
||||
cd /tmp
|
||||
$ZUUL_CLONER --cache-dir \
|
||||
/opt/git \
|
||||
--branch $BRANCH_NAME \
|
||||
git://git.openstack.org $1
|
||||
cd $1
|
||||
pip install -e .
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
pip_hardcode () {
|
||||
echo "PIP HARDCODE: $1" >> /tmp/tox_install.txt
|
||||
pip install -U -egit+https://git.openstack.org/openstack/$1@$BRANCH_NAME#egg=$1
|
||||
}
|
||||
|
||||
if [ $neutron_installed -eq 0 ]; then
|
||||
echo "NEUTRON ALREADY INSTALLED" >> /tmp/tox_install.txt
|
||||
echo "Neutron already installed; using existing package"
|
||||
elif [ -x "$ZUUL_CLONER" ]; then
|
||||
zuul_cloner openstack/neutron
|
||||
else
|
||||
pip_hardcode neutron
|
||||
fi
|
||||
|
||||
if [ $networking_l2gw_installed -eq 0 ]; then
|
||||
echo "NETWORKING_L2GW ALREADY INSTALLED" >> /tmp/tox_install.txt
|
||||
echo "Networking-l2gw already installed; using existing package"
|
||||
elif [ -x "$ZUUL_CLONER" ]; then
|
||||
zuul_cloner openstack/networking-l2gw
|
||||
else
|
||||
pip_hardcode networking-l2gw
|
||||
fi
|
||||
|
||||
if [ $neutron_lbaas_installed -eq 0 ]; then
|
||||
echo "NEUTRON_LBAAS ALREADY INSTALLED" >> /tmp/tox_install.txt
|
||||
echo "Neutron_lbaas already installed; using existing package"
|
||||
elif [ -x "$ZUUL_CLONER" ]; then
|
||||
zuul_cloner openstack/neutron-lbaas
|
||||
else
|
||||
pip_hardcode neutron-lbaas
|
||||
fi
|
||||
|
||||
pip install -U $*
|
||||
exit $?
|
@ -14,6 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
TOOLS=`dirname $0`
|
||||
VENV=$TOOLS/../.venv
|
||||
tools_path=${tools_path:-$(dirname $0)}
|
||||
venv_path=${venv_path:-${tools_path}}
|
||||
venv_dir=${venv_name:-/../.venv}
|
||||
TOOLS=${tools_path}
|
||||
VENV=${venv:-${venv_path}/${venv_dir}}
|
||||
source $VENV/bin/activate && "$@"
|
||||
|
69
tox.ini
69
tox.ini
@ -1,73 +1,97 @@
|
||||
[tox]
|
||||
envlist = py35,py34,py27,pep8
|
||||
envlist = py35,py34,py27,pep8,docs
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
# Note the hash seed is set to 0 until neutron can be tested with a
|
||||
# random hash seed successfully.
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
PYTHONHASHSEED=0
|
||||
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
|
||||
usedevelop = True
|
||||
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
|
||||
install_command =
|
||||
pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
# TODO(boden): pulling the egg from git is fine for master, but
|
||||
# should be replaced with a package version in requirements for
|
||||
# release (branch) tags
|
||||
git+https://git.openstack.org/openstack/neutron.git@master#egg=neutron
|
||||
git+https://git.openstack.org/openstack/networking-l2gw.git@master#egg=networking-l2gw
|
||||
git+https://git.openstack.org/openstack/neutron-lbaas.git@master#egg=neutron-lbaas
|
||||
whitelist_externals = sh
|
||||
commands =
|
||||
sh tools/pretty_tox.sh '{posargs}'
|
||||
# there is also secret magic in pretty_tox.sh which lets you run in a fail only
|
||||
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
|
||||
# there is also secret magic in ostestr which lets you run in a fail only
|
||||
# mode. To do this define the TRACE_FAILONLY environmental variable.
|
||||
|
||||
[testenv:hashtest]
|
||||
# This is the same as default environment, but with a random PYTHONHASHSEED.
|
||||
# You can also specify a specific hashseed (for test repeatability) as follows:
|
||||
# tox --hashseed 1235130571 -e hashtest
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
[testenv:common]
|
||||
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
|
||||
setenv = OS_TEST_TIMEOUT=180
|
||||
commands = false
|
||||
|
||||
[testenv:functional]
|
||||
setenv = OS_TEST_TIMEOUT=90
|
||||
basepython = python2.7
|
||||
setenv = {[testenv]setenv}
|
||||
{[testenv:common]setenv}
|
||||
OS_TEST_PATH=./vmware_nsx/tests/functional
|
||||
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
-r{toxinidir}/vmware_nsx/tests/functional/requirements.txt
|
||||
|
||||
[testenv:dsvm-functional]
|
||||
basepython = python2.7
|
||||
setenv = OS_SUDO_TESTING=1
|
||||
OS_FAIL_ON_MISSING_DEPS=1
|
||||
OS_TEST_TIMEOUT=90
|
||||
OS_TEST_TIMEOUT=180
|
||||
sitepackages=True
|
||||
deps =
|
||||
{[testenv:functional]deps}
|
||||
commands =
|
||||
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
|
||||
|
||||
[tox:jenkins]
|
||||
sitepackages = True
|
||||
|
||||
[testenv:releasenotes]
|
||||
# TODO(ihrachys): remove once infra supports constraints for this target
|
||||
install_command = pip install -U {opts} {packages}
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python2.7
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
sh ./tools/check_bash.sh
|
||||
# If it is easier to add a check via a shell script, consider adding it in this file
|
||||
sh ./tools/misc-sanity-checks.sh
|
||||
# Checks for coding and style guidelines
|
||||
flake8
|
||||
sh ./tools/coding-checks.sh --pylint '{posargs}'
|
||||
neutron-db-manage --subproject vmware-nsx check_migration
|
||||
{[testenv:genconfig]commands}
|
||||
whitelist_externals = sh
|
||||
whitelist_externals =
|
||||
sh
|
||||
bash
|
||||
|
||||
[testenv:bandit]
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = bandit -r vmware_nsx -n 5 -ll
|
||||
|
||||
[testenv:cover]
|
||||
# TODO(boden): remove once infra supports constraints for this target
|
||||
install_command = pip install -U {opts} {packages}
|
||||
basepython = python2.7
|
||||
commands =
|
||||
python setup.py testr --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
|
||||
[testenv:venv]
|
||||
# TODO(boden): remove once infra supports constraints for this target
|
||||
install_command = pip install -U {opts} {packages}
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
commands = sphinx-build -W -b html doc/source doc/build/html
|
||||
|
||||
[flake8]
|
||||
# E125 continuation line does not distinguish itself from next logical line
|
||||
@ -88,13 +112,6 @@ show-source = true
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,.ropeproject
|
||||
|
||||
[testenv:pylint]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
pylint
|
||||
commands =
|
||||
pylint --rcfile=.pylintrc --output-format=colorized {posargs:vmware_nsx/neutron}
|
||||
|
||||
[hacking]
|
||||
import_exceptions = vmware_nsx._i18n,
|
||||
vmware_nsx_tempest._i18n
|
||||
@ -102,3 +119,7 @@ local-check-factory = neutron_lib.hacking.checks.factory
|
||||
|
||||
[testenv:genconfig]
|
||||
commands = {toxinidir}/tools/generate_config_file_samples.sh
|
||||
|
||||
[testenv:uuidgen]
|
||||
commands =
|
||||
check-uuid --fix
|
||||
|
@ -118,6 +118,5 @@ ERROR_MAPPINGS = {
|
||||
301: zero,
|
||||
307: zero,
|
||||
500: zero,
|
||||
501: zero,
|
||||
503: zero
|
||||
501: zero
|
||||
}
|
||||
|
@ -229,7 +229,6 @@ class ApiReplayClient(object):
|
||||
# multiple times as we don't currently
|
||||
# perserve the subnet_id. Also, 409 would be a better
|
||||
# response code for this in neutron :(
|
||||
pass
|
||||
|
||||
# create the ports on the network
|
||||
ports = self.get_ports_on_network(network['id'], source_ports)
|
||||
|
@ -24,18 +24,18 @@ from vmware_nsx.extensions import routersize
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AgentModes:
|
||||
class AgentModes(object):
|
||||
AGENT = 'agent'
|
||||
AGENTLESS = 'agentless'
|
||||
COMBINED = 'combined'
|
||||
|
||||
|
||||
class MetadataModes:
|
||||
class MetadataModes(object):
|
||||
DIRECT = 'access_network'
|
||||
INDIRECT = 'dhcp_host_route'
|
||||
|
||||
|
||||
class ReplicationModes:
|
||||
class ReplicationModes(object):
|
||||
SERVICE = 'service'
|
||||
SOURCE = 'source'
|
||||
|
||||
|
@ -23,7 +23,7 @@ from tooz import coordination
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class LockManager:
|
||||
class LockManager(object):
|
||||
_coordinator = None
|
||||
_coordinator_pid = None
|
||||
_connect_string = cfg.CONF.locking_coordinator_url
|
||||
|
@ -171,7 +171,7 @@ class NsxCache(object):
|
||||
self._get_resource_ids(self._lswitchports, changed_only=True))
|
||||
|
||||
|
||||
class SyncParameters():
|
||||
class SyncParameters(object):
|
||||
"""Defines attributes used by the synchronization procedure.
|
||||
|
||||
chunk_size: Actual chunk size
|
||||
@ -211,7 +211,7 @@ def _start_loopingcall(min_chunk_size, state_sync_interval, func,
|
||||
return state_synchronizer
|
||||
|
||||
|
||||
class NsxSynchronizer():
|
||||
class NsxSynchronizer(object):
|
||||
|
||||
LS_URI = nsxlib._build_uri_path(
|
||||
switchlib.LSWITCH_RESOURCE, fields='uuid,tags,fabric_status',
|
||||
|
@ -41,7 +41,7 @@ NSXV3_VERSION_1_1_0 = '1.1.0'
|
||||
|
||||
|
||||
# Allowed network types for the NSX Plugin
|
||||
class NetworkTypes:
|
||||
class NetworkTypes(object):
|
||||
"""Allowed provider network types for the NSX Plugin."""
|
||||
L3_EXT = 'l3_ext'
|
||||
STT = 'stt'
|
||||
@ -53,7 +53,7 @@ class NetworkTypes:
|
||||
|
||||
|
||||
# Allowed network types for the NSX-v Plugin
|
||||
class NsxVNetworkTypes:
|
||||
class NsxVNetworkTypes(object):
|
||||
"""Allowed provider network types for the NSX-v Plugin."""
|
||||
FLAT = 'flat'
|
||||
VLAN = 'vlan'
|
||||
@ -62,7 +62,7 @@ class NsxVNetworkTypes:
|
||||
|
||||
|
||||
# Allowed network types for the NSXv3 Plugin
|
||||
class NsxV3NetworkTypes:
|
||||
class NsxV3NetworkTypes(object):
|
||||
"""Allowed provider network types for the NSXv3 Plugin."""
|
||||
FLAT = 'flat'
|
||||
VLAN = 'vlan'
|
||||
|
@ -74,7 +74,7 @@ def warn_on_binding_status_error(f, *args, **kwargs):
|
||||
if result is None:
|
||||
return
|
||||
# we support functions that return a single entry or a list
|
||||
if type(result) == list:
|
||||
if isinstance(result, list):
|
||||
bindings = result
|
||||
else:
|
||||
bindings = [result]
|
||||
|
@ -94,7 +94,7 @@ class RESTClient(object):
|
||||
|
||||
manager_error = ERRORS.get(
|
||||
result.status_code, nsx_exc.ManagerError)
|
||||
if type(result_msg) is dict:
|
||||
if isinstance(result_msg, dict):
|
||||
result_msg = result_msg.get('error_message', result_msg)
|
||||
raise manager_error(
|
||||
manager=_get_nsx_managers_from_conf(),
|
||||
|
@ -170,7 +170,7 @@ class SwitchingProfile(AbstractRESTResource):
|
||||
def build_switch_profile_ids(cls, client, *profiles):
|
||||
ids = []
|
||||
for profile in profiles:
|
||||
if type(profile) is str:
|
||||
if isinstance(profile, str):
|
||||
profile = client.get(profile)
|
||||
if not isinstance(profile, SwitchingProfileTypeId):
|
||||
profile = SwitchingProfileTypeId(
|
||||
|
@ -101,7 +101,7 @@ def get_db_internal_edge_ips(context):
|
||||
return ip_list
|
||||
|
||||
|
||||
class NsxVMetadataProxyHandler:
|
||||
class NsxVMetadataProxyHandler(object):
|
||||
|
||||
def __init__(self, nsxv_plugin):
|
||||
self.nsxv_plugin = nsxv_plugin
|
||||
|
@ -2332,7 +2332,6 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
is_routes_update=is_routes_update)
|
||||
except n_exc.IpAddressGenerationFailure:
|
||||
del info['external_fixed_ips']
|
||||
pass
|
||||
LOG.warning(_LW("Cannot get one subnet with gateway "
|
||||
"to allocate one available gw ip"))
|
||||
router_driver._update_router_gw_info(
|
||||
|
@ -36,7 +36,7 @@ TRANSFORM_PROTOCOL_ALLOWED = ('esp',)
|
||||
ENCAPSULATION_MODE_ALLOWED = ('tunnel',)
|
||||
|
||||
|
||||
class EdgeIPsecVpnDriver():
|
||||
class EdgeIPsecVpnDriver(object):
|
||||
|
||||
"""Driver APIs for Edge IPsec VPN bulk configuration."""
|
||||
|
||||
|
@ -53,7 +53,7 @@ class TaskStateSkipped(TaskException):
|
||||
message = _("State %(state)d skipped. Current state %(current)d")
|
||||
|
||||
|
||||
class Task():
|
||||
class Task(object):
|
||||
def __init__(self, name, resource_id, execute_callback,
|
||||
status_callback=nop, result_callback=nop, userdata=None):
|
||||
self.name = name
|
||||
@ -151,7 +151,7 @@ class Task():
|
||||
self.id)
|
||||
|
||||
|
||||
class TaskManager():
|
||||
class TaskManager(object):
|
||||
|
||||
_instance = None
|
||||
_default_interval = DEFAULT_INTERVAL
|
||||
|
@ -2604,7 +2604,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||
# NOTE(arosen): if in replay mode we need stub out this validator to
|
||||
# all default security groups to be created via the api
|
||||
if cfg.CONF.api_replay_mode:
|
||||
def _pass(data, foo=None):
|
||||
def _pass(data, _dummy=None):
|
||||
pass
|
||||
ext_sg.validators.validators['type:name_not_default'] = _pass
|
||||
|
||||
|
@ -183,7 +183,7 @@ class EdgeListenerManager(base_mgr.EdgeLoadbalancerBaseManager):
|
||||
default_pool = None
|
||||
if new_listener.default_pool and new_listener.default_pool.id:
|
||||
pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(
|
||||
context.session, new_listener.default_pool.id)
|
||||
context.session, new_listener.default_pool.id, None, None)
|
||||
if pool_binding:
|
||||
default_pool = pool_binding['edge_pool_id']
|
||||
|
||||
|
@ -75,8 +75,8 @@ def nsx_clean_backup_edge(resource, event, trigger, **kwargs):
|
||||
return
|
||||
try:
|
||||
edge = nsxv.get_edge(edge_id)
|
||||
except exceptions.NeutronException as e:
|
||||
LOG.error(_LE("%s"), str(e))
|
||||
except exceptions.NeutronException as x:
|
||||
LOG.error(_LE("%s"), str(x))
|
||||
else:
|
||||
# edge[0] is response status code
|
||||
# edge[1] is response body
|
||||
@ -102,8 +102,8 @@ def nsx_clean_backup_edge(resource, event, trigger, **kwargs):
|
||||
edgeapi.context.session, edge[1]['name'])
|
||||
nsxv_db.clean_edge_vnic_binding(edgeapi.context.session,
|
||||
edge_id)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("%s"), str(e))
|
||||
except Exception as expt:
|
||||
LOG.error(_LE("%s"), str(expt))
|
||||
|
||||
|
||||
@admin_utils.output_header
|
||||
|
@ -619,8 +619,8 @@ class TestLogicalRouters(base.NsxlibTestCase):
|
||||
self.fake_cluster, lrouter['uuid'])
|
||||
self.assertEqual(len(ports), 1)
|
||||
res_port = ports[0]
|
||||
self.assertEqual(['10.10.10.254', '192.168.0.1'],
|
||||
res_port['ip_addresses'])
|
||||
self.assertEqual(sorted(['10.10.10.254', '192.168.0.1']),
|
||||
sorted(res_port['ip_addresses']))
|
||||
|
||||
def test_update_lrouter_port_ips_remove_only(self):
|
||||
lrouter = routerlib.create_lrouter(self.fake_cluster,
|
||||
|
@ -627,7 +627,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
VALID_DSCP_MARK1 = 56
|
||||
VALID_DSCP_MARK2 = 48
|
||||
|
||||
@test.idempotent_id('8a59b00b-3e9c-4787-92f8-93a5cdf5e378')
|
||||
@test.idempotent_id('8a59b40b-3e9c-4787-92f8-93a5cdf5e378')
|
||||
def test_rule_create(self):
|
||||
"""qos-dscp-marking-rule-create POLICY_ID."""
|
||||
qos_client = self.adm_qos_client
|
||||
@ -657,7 +657,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
policy_rules[0]['type'])
|
||||
|
||||
@test.attr(type='negative')
|
||||
@test.idempotent_id('8a59b00b-ab01-4787-92f8-93a5cdf5e378')
|
||||
@test.idempotent_id('8b59b10b-ab01-4787-92f8-93a5cdf5e378')
|
||||
def test_rule_create_fail_for_the_same_type(self):
|
||||
"""One dscp marking rule per policy."""
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
@ -671,7 +671,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
policy_id=policy['id'],
|
||||
dscp_mark=self.VALID_DSCP_MARK2)
|
||||
|
||||
@test.idempotent_id('149a6988-2568-47d2-931e-2dbc858943b3')
|
||||
@test.idempotent_id('249a6988-2568-47d2-931e-2dbc858943b3')
|
||||
def test_rule_update(self):
|
||||
"""qos-dscp-marking-rule-create POLICY_ID."""
|
||||
qos_client = self.adm_qos_client
|
||||
@ -688,7 +688,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
rule['id'], policy['id'])
|
||||
self.assertEqual(self.VALID_DSCP_MARK2, retrieved_rule['dscp_mark'])
|
||||
|
||||
@test.idempotent_id('67ee6efd-7b33-4a68-927d-275b4f8ba958')
|
||||
@test.idempotent_id('67ed6efd-7b33-4a68-927d-275b4f8ba958')
|
||||
def test_rule_delete(self):
|
||||
"""qos-dscp-marking-rule-delete POLICY_ID."""
|
||||
qos_client = self.adm_qos_client
|
||||
@ -708,7 +708,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
rule['id'], policy['id'])
|
||||
|
||||
@test.attr(type='negative')
|
||||
@test.idempotent_id('f211222c-5808-46cb-a961-983bbab6b852')
|
||||
@test.idempotent_id('f215222c-5808-46cb-a961-983bbab6b852')
|
||||
def test_rule_create_rule_nonexistent_policy(self):
|
||||
"""can not create dscp marking rule with nonexist policy."""
|
||||
self.assertRaises(
|
||||
@ -717,7 +717,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
'policy', self.VALID_DSCP_MARK1)
|
||||
|
||||
@test.attr(type='negative')
|
||||
@test.idempotent_id('a4a2e7ad-786f-4927-a85a-e545a93bd274')
|
||||
@test.idempotent_id('a4a2e3ad-786f-4927-a85a-e545a93bd274')
|
||||
def test_rule_create_forbidden_for_regular_tenants(self):
|
||||
"""project/tenant can not create dscp marking rule."""
|
||||
self.assertRaises(
|
||||
@ -727,7 +727,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
qos_client=self.pri_qos_client)
|
||||
|
||||
@test.attr(type='negative')
|
||||
@test.idempotent_id('33646b08-4f05-4493-a48a-bde768a18533')
|
||||
@test.idempotent_id('32646b08-4f05-4493-a48a-bde768a18533')
|
||||
def test_invalid_rule_create(self):
|
||||
"""Can not create rule with invalid dscp_mark value."""
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
@ -738,7 +738,7 @@ class QosDscpMarkingRuleTest(BaseQosTest):
|
||||
self.create_qos_dscp_marking_rule,
|
||||
policy['id'], 58)
|
||||
|
||||
@test.idempotent_id('ce0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
|
||||
@test.idempotent_id('cf0bd0c2-54d9-4e29-85f1-cfb36ac3ebe2')
|
||||
def test_get_rules_by_policy(self):
|
||||
"""qos-dscp-marking-rule-list POLICY_ID."""
|
||||
policy1 = self.create_qos_policy(name='test-policy1',
|
||||
|
@ -371,6 +371,7 @@ class SubnetTestJSON(base.BaseAdminNetworkTest):
|
||||
['gateway', 'allocation_pools']))
|
||||
|
||||
@decorators.skip_because(bug="1501827")
|
||||
@test.idempotent_id('3c4c36a1-684b-4e89-8e71-d528f19322a0')
|
||||
def test_create_delete_subnet_with_host_routes_and_dns_nameservers(self):
|
||||
self._create_verify_delete_subnet(
|
||||
**self.subnet_dict(['host_routes', 'dns_nameservers']))
|
||||
@ -385,6 +386,7 @@ class SubnetTestJSON(base.BaseAdminNetworkTest):
|
||||
self._create_verify_delete_subnet(enable_dhcp=True)
|
||||
|
||||
@decorators.skip_because(bug="1501827")
|
||||
@test.idempotent_id('3c4c36a1-684a-4e89-8e71-d528f19324a0')
|
||||
def test_update_subnet_gw_dns_host_routes_dhcp(self):
|
||||
network = self._create_network(_auto_clean_up=True)
|
||||
subnet_attrs = ['gateway', 'host_routes',
|
||||
@ -443,6 +445,7 @@ class SubnetTestJSON(base.BaseAdminNetworkTest):
|
||||
self._delete_network(network['id'])
|
||||
|
||||
@decorators.skip_because(bug="1501827")
|
||||
@test.idempotent_id('a5caa7d5-ab71-4278-a57c-d6631b7474f8')
|
||||
def test_create_delete_subnet_all_attributes(self):
|
||||
self._create_verify_delete_subnet(
|
||||
enable_dhcp=True,
|
||||
@ -451,13 +454,14 @@ class SubnetTestJSON(base.BaseAdminNetworkTest):
|
||||
'dns_nameservers']))
|
||||
|
||||
@test.idempotent_id('969f20b2-7eb5-44f5-98cd-381545b7c7e7')
|
||||
@test.idempotent_id('a5caa7d9-ab71-4278-a57c-d6631b7474c8')
|
||||
def test_create_delete_subnet_with_gw_dns(self):
|
||||
self._create_verify_delete_subnet(
|
||||
enable_dhcp=True,
|
||||
**self.subnet_dict(['gateway',
|
||||
'dns_nameservers']))
|
||||
|
||||
@test.idempotent_id('3c4c36a1-684b-4e89-8e71-d528f19324a0')
|
||||
@test.idempotent_id('3c4c36a1-684b-4e89-8e71-d518f19324a0')
|
||||
def test_add_upd_del_multiple_overlapping_networks_subnet(self):
|
||||
r0, R1 = 0, 3 # (todo) get from CONF
|
||||
return self._add_upd_del_multiple_networks_subnet(
|
||||
|
@ -26,8 +26,8 @@ from vmware_nsx_tempest.services.lbaas import members_client
|
||||
from vmware_nsx_tempest.services.lbaas import pools_client
|
||||
from vmware_nsx_tempest.tests.nsxv.scenario import (
|
||||
manager_topo_deployment as dmgr)
|
||||
from vmware_nsx_tempest.tests.nsxv.scenario.test_v1_lbaas_basic_ops import (
|
||||
copy_file_to_host as copy_file_to_host)
|
||||
from vmware_nsx_tempest.tests.nsxv.scenario import test_v1_lbaas_basic_ops
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = dmgr.manager.log.getLogger(__name__)
|
||||
@ -248,9 +248,10 @@ class TestLBaasRoundRobinOps(dmgr.TopoDeployScenarioManager):
|
||||
with tempfile.NamedTemporaryFile() as key:
|
||||
key.write(private_key)
|
||||
key.flush()
|
||||
copy_file_to_host(script.name,
|
||||
"/tmp/script",
|
||||
server_fip, username, key.name)
|
||||
test_v1_lbaas_basic_ops.copy_file_to_host(
|
||||
script.name,
|
||||
"/tmp/script",
|
||||
server_fip, username, key.name)
|
||||
|
||||
# Start netcat
|
||||
start_server = ('while true; do '
|
||||
|
@ -133,7 +133,7 @@ class L2GatewayTest(base_l2gw.BaseL2GatewayTest):
|
||||
self.resource_cleanup()
|
||||
|
||||
@test.attr(type="nsxv3")
|
||||
@test.idempotent_id("670cacb5-134e-467d-ba41-0d7cdbcf3903")
|
||||
@test.idempotent_id("670cbcb5-134e-467d-ba41-0d7cdbcf3903")
|
||||
def test_l2_gateway_delete(self):
|
||||
"""
|
||||
Delete l2gw will create l2gw and delete recently created l2gw. To
|
||||
|
@ -348,7 +348,7 @@ class L2GatewayConnectionTest(base_l2gw.BaseL2GatewayTest):
|
||||
self.addCleanup(self.l2gw_cleanup)
|
||||
|
||||
@test.attr(type="nsxv3")
|
||||
@test.idempotent_id("670cacb5-134e-467d-ba41-0d7cdbcf3903")
|
||||
@test.idempotent_id("671cacb5-134e-467d-ba41-0d7cdbcf3903")
|
||||
def test_l2_gateway_connection_delete(self):
|
||||
"""
|
||||
Delete l2gw will create l2gw and delete recently created l2gw. To
|
||||
|
@ -19,10 +19,12 @@ test_vmware_nsx_tempest
|
||||
Tests for `vmware_nsx_tempest` module.
|
||||
"""
|
||||
|
||||
from tempest import test
|
||||
from vmware_nsx_tempest.tests import base
|
||||
|
||||
|
||||
class TestVmware_nsx_tempest(base.TestCase):
|
||||
|
||||
@test.idempotent_id('3c4c36a1-684b-4e89-8e71-a328f19324a0')
|
||||
def test_something(self):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user