Tempest: Renamed folder based on the need.

Change-Id: I804c3fd1e0c9cbeb454677e7951072ad74391fec
This commit is contained in:
Devang Doshi 2017-07-27 14:21:36 -07:00
parent 710325cee5
commit 90ccb18762
148 changed files with 224 additions and 175 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/vmware-nsx-tempest-plugin.git

12
.testr.conf Normal file
View File

@ -0,0 +1,12 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \
OS_DEBUG=${OS_DEBUG:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-500} \
OS_TEST_LOCK_PATH=${OS_TEST_LOCK_PATH:-${TMPDIR:-'/tmp'}} \
${PYTHON:-python} -m subunit.run discover -t ${OS_TOP_LEVEL:-./} ${OS_TEST_PATH:-./vmware_nsx_tempest} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
group_regex=([^\.]*\.)*

View File

@ -1,19 +1,93 @@
Welcome!
========
===============================
vmware-nsx-tempest-plugin
===============================
Tempest plugin vmware-nsx-tempest-plugin
Please fill here a long description which must be at least 3 lines wrapped on
80 cols, so that distribution package maintainers can use it in their packages.
Note that this is a hard requirement.
This repo hosts vmware-nsx's functional api and scenario tests.
vmware-nsx is Vmware plugin for neutron. This repo is tempest plugin to
test vmware-nsx at function level. All vmware-nsx-tempest-plugin tests
are in "master" branch. Some of the tests are designed based on N-S traffic.
Intstall thsi repo on external VM to run entire test suite.
* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/vmware-nsx-tempest-plugin
* Launchpad: https://launchpad.net/vmware-nsx-tempest-plugin
* Source: http://git.openstack.org/cgit/openstack/vmware-nsx-tempest-plugin
* Bugs: http://bugs.launchpad.net/vmware-nsx-tempest-plugin
Features
--------
Features:
=========
* TODO
* API tests
* Scenario tests
Overview:
=========
Installation:
=============
#. On your own development folder, for example /opt/stack/,
install your own tempest development env at /opt/stack/tempest/::
$ cd /opt/stack
$ git clone https://github.com/openstack/tempest
#. Install virtualenv with the following command::
$ cd /opt/stack/tempest
$ ./run_tempest.sh -u not_exist_tests
#. Install vmware-nsx-tempest-plugin master branch at /opt/stack::
$ cd /opt/stack
$ git clone https://github.com/openstack/vmware-nsx-tempest-plugin.git
#. Install vmware-nsx-tempest-plugin in your tempest development environment::
$ cd /opt/stack
$ sudo pip install -e vmware-nsx-tempest-plugin
Run command::
$ pip show vmware-nsx-tempest-plugin
You should observe the following statements::
Location: /opt/stack/vmware-nsx-tempest-plugin
#. Validate installed vmware_nsx_tempest successfully do::
$ cd /opt/stack/vmware-nsx-tempest-plugin
$ ostestr -l vmware_nsx_tempest
$ ostestr vmware_nsx_tempest.tests.nsxv3.scenario.test_mdproxy.TestMDProxy.test_mdproxy_ping
$ python -m testtools.run vmware_nsx_tempest.tests.nsxv3.scenario.test_mdproxy.TestMDProxy.test_mdproxy_ping
Your installation failed, if no tests are shown.
Execution:
==========
vmware-nsx-tempest tests are tempest tests, you need to
run from tempest directory. For example, to run only l2-gateway tests::
$ cd /opt/stack/tempest
$ ostestr vmware_nsx_tempest.*test_l2_gateway
$ ostestr vmware_nsx_tempest.tests.nsxv.api.test_l2_gateway_connection.L2GatewayConnectionTest.test_csuld_single_device_interface_vlan
TechNote on vmware-nsx-tempest-plugin:
=========================================
vmware-nsx-tempest-plugin is a plugin to tempest, not neutron, nor vmware-nsx.
It is defined by tempest.test_plugins.
Modules within vmware-nsx-tempest can not see resources defined
by vmware-nsx. Commands like following will not work, unless
vmware-nsx is installed in your tempest environment::
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils

View File

@ -3,3 +3,4 @@
# process, which may cause wedges in the gate later.
pbr>=2.0 # Apache-2.0
neutron-lib>=1.9.0 # Apache-2.0

View File

@ -21,7 +21,7 @@ classifier =
[files]
packages =
vmware-nsx-tempest-plugin
vmware_nsx_tempest
[build_sphinx]
all-files = 1
@ -33,19 +33,19 @@ build-dir = doc/build
upload-dir = doc/build/html
[compile_catalog]
directory = vmware-nsx-tempest-plugin/locale
domain = vmware-nsx-tempest-plugin
directory = vmware_nsx_tempest/locale
domain = vmware_nsx_tempest
[update_catalog]
domain = vmware-nsx-tempest-plugin
output_dir = vmware-nsx-tempest-plugin/locale
input_file = vmware-nsx-tempest-plugin/locale/vmware-nsx-tempest-plugin.pot
domain = vmware_nsx_tempest
output_dir = vmware_nsx_tempest/locale
input_file = vmware_nsx_tempest/locale/vmware_nsx_tempest.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = vmware-nsx-tempest-plugin/locale/vmware-nsx-tempest-plugin.pot
output_file = vmware_nsx_tempest/locale/vmware_nsx_tempest.pot
[entry_points]
tempest.test_plugins =
vmware-nsx-tempest-plugin = vmware-nsx-tempest-plugin.plugin:VMwareNsxTempestPlugin
vmware-nsx-tempest-plugin = vmware_nsx_tempest.plugin:VmwareNsxTempestPlugin

View File

@ -13,3 +13,4 @@ testtools>=1.4.0 # MIT
openstackdocstheme>=1.11.0 # Apache-2.0
# releasenotes
reno>=1.8.0 # Apache-2.0
tempest>=16.1.0 # Apache-2.0

7
tools/pretty_tox.sh Normal file
View File

@ -0,0 +1,7 @@
#! /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

28
tox.ini
View File

@ -1,6 +1,6 @@
[tox]
minversion = 2.0
envlist = py34,py27,pypy,pep8
envlist = py35,py27,pep8,docs
skipsdist = True
[testenv]
@ -10,11 +10,30 @@ setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
-r{toxinidir}/requirements.txt
whitelist_externals = sh
rm
find
commands =
find . -type f -name "*.pyc" -delete
sh tools/pretty_tox.sh '{posargs}'
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
OS_DEBUG
OS_LOG_CAPTURE
OS_STDERR_CAPTURE
OS_STDOUT_CAPTURE
[testenv:pep8]
commands = flake8 {posargs}
[testenv:py27]
setenv = OS_FAIL_ON_MISSING_DEPS=1
[testenv:venv]
commands = {posargs}
@ -35,6 +54,7 @@ commands = oslo_debug_helper {posargs}
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125
ignore = E125,E126,E128,E129,E265,H305,H307,H404,H405,H904,N530,N531
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject
import-order-style = pep8

View File

@ -1,92 +0,0 @@
Welcome!
========
vmware_nsx_tempest is a plugin module to openstack tempest project.
If you are not familiar with tempest, please refer to::
https://docs.openstack.org/developer/tempest
It is implemented with tempest external plugin.
The official design sepcification is at::
https://review.openstack.org/#/c/184992/
Overview
========
vmware_nsx_tempest hosts vmware_nsx's functional api and scenario tests.
All vmware_nsx_tempest tests are in "master" branch. For this reason,
it is recommended to have your own developer version of vmware-nsx repo
installed outside the devstack folder, /opt/stack/.
For example at /opt/devtest folder. In doing so, you can install
editable vmware-nsx repo under tempest VENV environemnt.
Installation:
-------------
#. On your own development folder, for example /opt/devtest/,
install your own tempest development env at /opt/devtest/os-tempest/::
$ cd /opt/devtest
$ git clone https://github.com/openstack/tempest os-tempest
#. Install virtualenv with the following command::
$ cd /opt/devtest/os-tempest
$ ./run_tempest.sh -u not_exist_tests
#. Install vmware-nsx master branch at /opt/devtest/vmware-nsx::
$ cd /opt/devtest
$ git clone https://github.com/openstack/vmware-nsx
#. Install vmware_nsx_tempest in your tempest development environment::
$ cd /opt/devtest/os-tempest
$ source .venv/bin/activate
$ pip install -e /opt/devtest/vmware-nsx/
Run command::
$ pip show vmware-nsx
You should observe the following statements::
Location: /opt/devtest/vmware-nsx
and under section of Entry-points::
[tempest.test_plugins]
vmware-nsx-tempest-plugin = vmware_nsx_tempest.plugin:VMwareNsxTempestPlugin
#. Validate installed vmware_nsx_tempest successfully do::
$ cd /opt/devtest/os-tempest
$ tools/with_venv.sh testr list-tests vmware_nsx_tempest.*l2_gateway
Your installation failed, if no tests are shown.
Execution:
----------
vmware_nsx_tempest tests are tempest tests, you need to
run from tempest directory. For example, to run only l2-gateway tests::
$ cd /opt/devtest/os-tempest
$ ./run_tempest.sh -t vmware_nsx_tempest.*test_l2_gateway
$ ./run_tempest.sh -d vmware_nsx_tempest.tests.nsxv.api.test_l2_gateway_connection.L2GatewayConnectionTest.test_csuld_single_device_interface_vlan
TechNote on vmware_nsx_tempest:
-------------------------------
vmware_nsx_tempest is a plugin to tempest, not neutron, nor vmware_nsx.
It is defined by tempest.test_plugins.
Modules within vmware_nsx_tempest can not see resources defined
by vmware_nsx. Commands like following are not acceptable, unless
vmware_nsx is installed in your tempest environment::
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils

View File

@ -14,7 +14,7 @@
import oslo_i18n
DOMAIN = "vmware-nsx-tempest"
DOMAIN = "vmware_nsx_tempest"
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)

View File

@ -110,10 +110,10 @@ NSXvGroup = [
help="Specific for router_size tests. This value defines"
" how long http.request should retry."),
cfg.BoolOpt('no_router_type',
default=False,
help="router_type is NSXv extension."
"Set it to True allow tests to remove this attribute"
" when creating router."),
default=False,
help="router_type is NSXv extension."
"Set it to True allow tests to remove this attribute"
" when creating router."),
cfg.ListOpt('bugs_to_resolve',
default=[],
help="Bugs to be resolved. Define this at tempest.conf and"
@ -129,10 +129,10 @@ NSXvGroup = [
help="NSX security-policy ID used to create the 2nd"
" security-group-policy, and != default_policy_id."),
cfg.BoolOpt('allow_tenant_rules_with_policy',
default=False,
help="Default=False; a tenant cannot create security-group."
" If True, tenant can create non-policy security-group."
" Sync this value with nsx.ini file."),
default=False,
help="Default=False; a tenant cannot create security-group."
" If True, tenant can create non-policy security-group."
" Sync this value with nsx.ini file."),
]

View File

@ -83,7 +83,7 @@ class ApplianceManager(manager.NetworkScenarioTest):
return self.topology_keypairs[server['key_name']]['private_key']
def create_topology_router(self, router_name, routers_client=None,
**kwargs):
**kwargs):
if not routers_client:
routers_client = self.routers_client
router_name_ = constants.APPLIANCE_NAME_STARTS_WITH + router_name
@ -94,8 +94,9 @@ class ApplianceManager(manager.NetworkScenarioTest):
self.topology_routers[router_name] = router
return router
def create_topology_network(self, network_name, networks_client=None,
tenant_id=None, port_security_enabled=True, **kwargs):
def create_topology_network(
self, network_name, networks_client=None,
tenant_id=None, port_security_enabled=True, **kwargs):
if not networks_client:
networks_client = self.networks_client
if not tenant_id:
@ -128,12 +129,14 @@ class ApplianceManager(manager.NetworkScenarioTest):
def cidr_in_use(cidr, tenant_id):
"""Check cidr existence
:returns: True if subnet with cidr already exist in tenant
False else
"""
cidr_in_use = \
self.os_admin.subnets_client.list_subnets(tenant_id=tenant_id,
cidr=cidr)['subnets']
self.os_admin.subnets_client.list_subnets(
tenant_id=tenant_id, cidr=cidr)['subnets']
return len(cidr_in_use) != 0
if ip_version == 6:

View File

@ -31,8 +31,8 @@ CONF = config.CONF
class FeatureManager(traffic_manager.TrafficManager):
@classmethod
def setup_clients(cls):
"""
Create various client connections. Such as NSXv3 and L2 Gateway.
"""Create various client connections. Such as NSXv3 and L2 Gateway.
"""
super(FeatureManager, cls).setup_clients()
try:
@ -66,13 +66,13 @@ class FeatureManager(traffic_manager.TrafficManager):
# L2Gateway base class. To get basics of L2GW.
#
def create_l2gw(self, l2gw_name, l2gw_param):
"""
Creates L2GW and returns the response.
"""Creates L2GW and returns the response.
:param l2gw_name: name of the L2GW
:param l2gw_param: L2GW parameters
:return: response of L2GW create API
"""
LOG.info("l2gw name: %(name)s, l2gw_param: %(devices)s ",
{"name": l2gw_name, "devices": l2gw_param})
@ -96,12 +96,12 @@ class FeatureManager(traffic_manager.TrafficManager):
return rsp, devices
def delete_l2gw(self, l2gw_id):
"""
Delete L2gw.
"""Delete L2gw.
:param l2gw_id: L2GW id to delete l2gw.
:return: response of the l2gw delete API.
"""
LOG.info("L2GW id: %(id)s to be deleted.", {"id": l2gw_id})
rsp = self.l2gw_client.delete_l2_gateway(l2gw_id)
@ -109,24 +109,24 @@ class FeatureManager(traffic_manager.TrafficManager):
return rsp
def update_l2gw(self, l2gw_id, l2gw_new_name, devices):
"""
Update existing L2GW.
"""Update existing L2GW.
:param l2gw_id: L2GW id to update its parameters.
:param l2gw_new_name: name of the L2GW.
:param devices: L2GW parameters.
:return: Response of the L2GW update API.
"""
rsp = self.l2gw_client.update_l2_gateway(l2gw_id,
name=l2gw_new_name, **devices)
return rsp
def nsx_bridge_cluster_info(self):
"""
Collect the device and interface name of the nsx brdige cluster.
"""Collect the device and interface name of the nsx brdige cluster.
:return: nsx bridge id and display name.
"""
response = self.nsx_client.get_bridge_cluster_info()
if len(response) == 0:
@ -134,12 +134,12 @@ class FeatureManager(traffic_manager.TrafficManager):
return [(x.get("id"), x.get("display_name")) for x in response]
def create_l2gw_connection(self, l2gwc_param):
"""
Creates L2GWC and return the response.
"""Creates L2GWC and return the response.
:param l2gwc_param: L2GWC parameters.
:return: response of L2GWC create API.
"""
LOG.info("l2gwc param: %(param)s ", {"param": l2gwc_param})
l2gwc_request_body = {"l2_gateway_id": l2gwc_param["l2_gateway_id"],
@ -158,12 +158,12 @@ class FeatureManager(traffic_manager.TrafficManager):
return rsp
def delete_l2gw_connection(self, l2gwc_id):
"""
Delete L2GWC and returns the response.
"""Delete L2GWC and returns the response.
:param l2gwc_id: L2GWC id to delete L2GWC.
:return: response of the l2gwc delete API.
"""
LOG.info("L2GW connection id: %(id)s to be deleted",
{"id": l2gwc_id})

View File

@ -17,37 +17,39 @@ from vmware_nsx_tempest.lib import appliance_manager
class TrafficManager(appliance_manager.ApplianceManager):
def check_server_internal_ips_using_floating_ip(self, floating_ip, server,
address_list, should_connect=True):
def check_server_internal_ips_using_floating_ip(
self, floating_ip, server, address_list, should_connect=True):
ip_address = floating_ip['floating_ip_address']
private_key = self.get_server_key(server)
ssh_source = self.get_remote_client(ip_address,
private_key=private_key)
ssh_source = self.get_remote_client(
ip_address, private_key=private_key)
for remote_ip in address_list:
self.check_remote_connectivity(ssh_source, remote_ip,
should_succeed=should_connect)
def check_network_internal_connectivity(self, network, floating_ip, server,
should_connect=True):
def check_network_internal_connectivity(
self, network, floating_ip, server, should_connect=True):
"""via ssh check VM internal connectivity:
- ping internal gateway and DHCP port, implying in-tenant connectivity
pinging both, because L3 and DHCP agents might be on different nodes
"""
# get internal ports' ips:
# get all network ports in the new network
internal_ips = self.get_internal_ips(server, network, device="network")
self.check_server_internal_ips_using_floating_ip(floating_ip, server,
internal_ips, should_connect)
self.check_server_internal_ips_using_floating_ip(
floating_ip, server, internal_ips, should_connect)
def check_vm_internal_connectivity(self, network, floating_ip, server,
should_connect=True):
def check_vm_internal_connectivity(
self, network, floating_ip, server, should_connect=True):
# test internal connectivity to the other VM on the same network
compute_ips = self.get_internal_ips(server, network, device="compute")
self.check_server_internal_ips_using_floating_ip(floating_ip, server,
compute_ips, should_connect)
self.check_server_internal_ips_using_floating_ip(
floating_ip, server, compute_ips, should_connect)
def using_floating_ip_check_server_and_project_network_connectivity(self,
server_details, network=None):
def using_floating_ip_check_server_and_project_network_connectivity(
self, server_details, network=None):
if not network:
network = server_details.networks[0]
floating_ip = server_details.floating_ip
@ -55,8 +57,9 @@ class TrafficManager(appliance_manager.ApplianceManager):
self.check_network_internal_connectivity(network, floating_ip, server)
self.check_vm_internal_connectivity(network, floating_ip, server)
def check_cross_network_connectivity(self, network1,
floating_ip_on_network2, server_on_network2, should_connect=False):
def check_cross_network_connectivity(
self, network1, floating_ip_on_network2, server_on_network2,
should_connect=False):
# test internal connectivity to the other VM on the same network
remote_ips = self.get_internal_ips(server_on_network2, network1,
device="compute")

View File

@ -1,4 +1,4 @@
# Copyright 2015 VMware, Inc.
# Copyright 2017 VMware, Inc.
#
# All Rights Reserved
#
@ -31,7 +31,7 @@ _opts = [
]
class VMwareNsxTempestPlugin(plugins.TempestPlugin):
class VmwareNsxTempestPlugin(plugins.TempestPlugin):
"""Our addon configuration is defined at vmware_nsx_tempest/config.py

View File

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import base_dvs as base
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from vmware_nsx_tempest.tests.dvs.api import base_dvs as base
class AdminNetworksTestJSON(base.BaseDvsAdminNetworkTest):
_interface = 'json'

View File

@ -13,10 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import base_dvs as base
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from vmware_nsx_tempest.tests.dvs.api import base_dvs as base
class AdminPortsTestJSON(base.BaseDvsAdminNetworkTest):
_interface = 'json'

View File

@ -17,7 +17,7 @@ from oslo_log import log as logging
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
import test_subnets as SNET
from vmware_nsx_tempest.tests.nsxv.api import test_subnets as SNET
LOG = logging.getLogger(__name__)

View File

@ -15,7 +15,6 @@
import re
import base_provider as base
import six
from tempest import config
from tempest.lib.common.utils import data_utils
@ -24,6 +23,7 @@ from tempest.lib import decorators
from tempest import test
from vmware_nsx_tempest.services import nsxv_client
from vmware_nsx_tempest.tests.nsxv.api import base_provider as base
CONF = config.CONF

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base_provider as base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
@ -22,6 +21,8 @@ from tempest.lib import exceptions as ex
from oslo_log import log as logging
from vmware_nsx_tempest.tests.nsxv.api import base_provider as base
CONF = config.CONF
LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base_provider as base
from tempest.common import custom_matchers
from tempest import config
@ -24,6 +23,8 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from vmware_nsx_tempest.tests.nsxv.api import base_provider as base
CONF = config.CONF
LOG = logging.getLogger(__name__)

View File

@ -16,7 +16,6 @@
import os
import subprocess
import base_provider as base
from oslo_log import log as logging
import six
from tempest import config
@ -24,6 +23,8 @@ from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from vmware_nsx_tempest.tests.nsxv.api import base_provider as base
CONF = config.CONF
LOG = logging.getLogger(__name__)

Some files were not shown because too many files have changed in this diff Show More