From 4483fe50066abd9503e6a9f851a90e85abceccd3 Mon Sep 17 00:00:00 2001 From: Shih-Hao Li Date: Tue, 22 Sep 2015 19:14:27 -0700 Subject: [PATCH] Reorganize vmware_nsx/tests structure This patch is based on https://review.openstack.org/161194 It renames vmware_nsx/tests/unit/vmware/ to vmware_nsx/tests/unit/ and creates subdirectories vmware_nsx/tests/unit/dvs/ vmware_nsx/tests/unit/nsx_mh/ vmware_nsx/tests/unit/nsx_v/ vmware_nsx/tests/unit/nsx_v3/ vmware_nsx/tests/unit/nsxlib/mh/ vmware_nsx/tests/unit/nsxlib/v3/ This is part of new vmware_nsx directory structure proposed in https://goo.gl/GdWXyH. Change-Id: I16aa2455bce55f6455bb5e504ee9684c675b4257 --- TESTING.rst | 8 +-- vmware_nsx/tests/unit/__init__.py | 45 +++++++++++++- .../{vmware/apiclient => dvs}/__init__.py | 0 .../test_dvs.py => dvs/test_plugin.py} | 0 .../test_dvs_utils.py => dvs/test_utils.py} | 0 .../{vmware => }/etc/fake_get_gwservice.json | 0 .../{vmware => }/etc/fake_get_lqueue.json | 0 .../{vmware => }/etc/fake_get_lrouter.json | 0 .../etc/fake_get_lrouter_lport.json | 0 .../etc/fake_get_lrouter_lport_att.json | 0 .../etc/fake_get_lrouter_nat.json | 0 .../{vmware => }/etc/fake_get_lswitch.json | 0 .../etc/fake_get_lswitch_lport.json | 0 .../etc/fake_get_lswitch_lport_att.json | 0 .../etc/fake_get_lswitch_lport_status.json | 0 .../etc/fake_get_security_profile.json | 0 .../{vmware => }/etc/fake_post_gwservice.json | 0 .../{vmware => }/etc/fake_post_lqueue.json | 0 .../{vmware => }/etc/fake_post_lrouter.json | 0 .../etc/fake_post_lrouter_lport.json | 0 .../etc/fake_post_lrouter_nat.json | 0 .../{vmware => }/etc/fake_post_lswitch.json | 0 .../etc/fake_post_lswitch_lport.json | 0 .../etc/fake_post_security_profile.json | 0 .../etc/fake_put_lrouter_lport_att.json | 0 .../etc/fake_put_lswitch_lport_att.json | 0 .../unit/{vmware => }/etc/neutron.conf.test | 0 .../{vmware => }/etc/nsx.ini.agentless.test | 0 .../unit/{vmware => }/etc/nsx.ini.basic.test | 0 .../{vmware => }/etc/nsx.ini.combined.test | 0 .../unit/{vmware => }/etc/nsx.ini.full.test | 0 .../tests/unit/{vmware => }/etc/nsx.ini.test | 0 .../unit/{vmware => }/etc/nvp.ini.full.test | 0 .../tests/unit/{vmware => }/etc/vcns.ini.test | 0 .../{vmware/db => extensions}/__init__.py | 0 .../extensions/test_addresspairs.py | 2 +- .../extensions/test_maclearning.py | 6 +- .../{vmware => }/extensions/test_networkgw.py | 4 +- .../extensions/test_portsecurity.py | 6 +- .../extensions/test_providernet.py | 4 +- .../{vmware => }/extensions/test_qosqueues.py | 4 +- .../extensions/test_vnic_index.py | 4 +- .../{vmware/extensions => nsx_mh}/__init__.py | 0 .../nsx_v => nsx_mh/apiclient}/__init__.py | 0 .../unit/{vmware => nsx_mh}/apiclient/fake.py | 0 .../apiclient/test_api_common.py | 0 .../apiclient/test_api_eventlet_request.py | 2 +- .../{vmware/nsxlib => nsx_mh/db}/__init__.py | 0 .../unit/{vmware => nsx_mh}/db/test_lsn_db.py | 0 .../unit/{vmware => nsx_mh}/db/test_nsx_db.py | 0 .../test_agent_scheduler.py | 6 +- .../unit/{vmware => nsx_mh}/test_dhcpmeta.py | 0 .../test_nsx_opts.py => nsx_mh/test_opts.py} | 2 +- .../test_plugin.py} | 6 +- .../test_nsx_sync.py => nsx_mh/test_sync.py} | 4 +- .../test_utils.py} | 4 +- .../{vmware/nsxlib/v3 => nsx_v}/__init__.py | 0 .../nsx_v/test_edge_loadbalancer_driver.py | 0 .../test_nsx_misc.py => nsx_v/test_misc.py} | 0 .../nsx_v/test_nsxv_loadbalancer.py | 0 .../test_plugin.py} | 8 +-- .../services => nsx_v/vshield}/__init__.py | 0 .../{vmware => nsx_v}/vshield/fake_vcns.py | 0 .../vshield/test_edge_utils.py | 2 +- .../vshield/test_vcns_driver.py | 4 +- .../services/l2gateway => nsx_v3}/__init__.py | 0 .../nsx_v3_mocks.py => nsx_v3/mocks.py} | 0 .../test_constants.py} | 0 .../test_parent_tag.py} | 2 +- .../test_plugin.py} | 4 +- .../{vmware/vshield => nsxlib}/__init__.py | 0 vmware_nsx/tests/unit/nsxlib/mh/__init__.py | 0 .../unit/{vmware/nsxlib => nsxlib/mh}/base.py | 4 +- .../nsxlib => nsxlib/mh}/test_l2gateway.py | 2 +- .../{vmware/nsxlib => nsxlib/mh}/test_lsn.py | 0 .../nsxlib => nsxlib/mh}/test_queue.py | 2 +- .../nsxlib => nsxlib/mh}/test_router.py | 2 +- .../nsxlib => nsxlib/mh}/test_secgroup.py | 2 +- .../nsxlib => nsxlib/mh}/test_switch.py | 2 +- .../nsxlib => nsxlib/mh}/test_versioning.py | 0 vmware_nsx/tests/unit/nsxlib/v3/__init__.py | 0 .../{vmware => }/nsxlib/v3/nsxlib_testcase.py | 0 .../{vmware => }/nsxlib/v3/test_client.py | 20 +++++-- .../nsxlib/v3/test_qos_switching_profile.py | 4 +- .../{vmware => }/nsxlib/v3/test_resources.py | 18 +++++- .../{vmware => }/nsxlib/v3/test_switch.py | 18 ++++-- vmware_nsx/tests/unit/services/__init__.py | 0 .../tests/unit/services/l2gateway/__init__.py | 0 .../services/l2gateway/test_nsxv3_driver.py | 4 +- .../services/l2gateway/test_nsxv_driver.py | 0 .../tests/unit/{vmware => }/test_utils.py | 0 vmware_nsx/tests/unit/vmware/__init__.py | 58 ------------------- 92 files changed, 135 insertions(+), 128 deletions(-) rename vmware_nsx/tests/unit/{vmware/apiclient => dvs}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware/test_dvs.py => dvs/test_plugin.py} (100%) rename vmware_nsx/tests/unit/{vmware/test_dvs_utils.py => dvs/test_utils.py} (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_gwservice.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lqueue.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lrouter.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lrouter_lport.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lrouter_lport_att.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lrouter_nat.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lswitch.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lswitch_lport.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lswitch_lport_att.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_lswitch_lport_status.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_get_security_profile.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_gwservice.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lqueue.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lrouter.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lrouter_lport.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lrouter_nat.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lswitch.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_lswitch_lport.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_post_security_profile.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_put_lrouter_lport_att.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/fake_put_lswitch_lport_att.json (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/neutron.conf.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nsx.ini.agentless.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nsx.ini.basic.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nsx.ini.combined.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nsx.ini.full.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nsx.ini.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/nvp.ini.full.test (100%) rename vmware_nsx/tests/unit/{vmware => }/etc/vcns.ini.test (100%) rename vmware_nsx/tests/unit/{vmware/db => extensions}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_addresspairs.py (95%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_maclearning.py (97%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_networkgw.py (99%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_portsecurity.py (91%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_providernet.py (98%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_qosqueues.py (99%) rename vmware_nsx/tests/unit/{vmware => }/extensions/test_vnic_index.py (97%) rename vmware_nsx/tests/unit/{vmware/extensions => nsx_mh}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware/nsx_v => nsx_mh/apiclient}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/apiclient/fake.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/apiclient/test_api_common.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/apiclient/test_api_eventlet_request.py (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsx_mh/db}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/db/test_lsn_db.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/db/test_nsx_db.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/test_agent_scheduler.py (94%) rename vmware_nsx/tests/unit/{vmware => nsx_mh}/test_dhcpmeta.py (100%) rename vmware_nsx/tests/unit/{vmware/test_nsx_opts.py => nsx_mh/test_opts.py} (99%) rename vmware_nsx/tests/unit/{vmware/test_nsx_plugin.py => nsx_mh/test_plugin.py} (99%) rename vmware_nsx/tests/unit/{vmware/test_nsx_sync.py => nsx_mh/test_sync.py} (99%) rename vmware_nsx/tests/unit/{vmware/test_nsx_utils.py => nsx_mh/test_utils.py} (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib/v3 => nsx_v}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware => }/nsx_v/test_edge_loadbalancer_driver.py (100%) rename vmware_nsx/tests/unit/{vmware/test_nsx_misc.py => nsx_v/test_misc.py} (100%) rename vmware_nsx/tests/unit/{vmware => }/nsx_v/test_nsxv_loadbalancer.py (100%) rename vmware_nsx/tests/unit/{vmware/test_nsx_v_plugin.py => nsx_v/test_plugin.py} (99%) rename vmware_nsx/tests/unit/{vmware/services => nsx_v/vshield}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_v}/vshield/fake_vcns.py (100%) rename vmware_nsx/tests/unit/{vmware => nsx_v}/vshield/test_edge_utils.py (99%) rename vmware_nsx/tests/unit/{vmware => nsx_v}/vshield/test_vcns_driver.py (99%) rename vmware_nsx/tests/unit/{vmware/services/l2gateway => nsx_v3}/__init__.py (100%) rename vmware_nsx/tests/unit/{vmware/nsx_v3_mocks.py => nsx_v3/mocks.py} (100%) rename vmware_nsx/tests/unit/{vmware/test_constants_v3.py => nsx_v3/test_constants.py} (100%) rename vmware_nsx/tests/unit/{vmware/test_nsx_parent_tag.py => nsx_v3/test_parent_tag.py} (97%) rename vmware_nsx/tests/unit/{vmware/test_nsx_v3_plugin.py => nsx_v3/test_plugin.py} (99%) rename vmware_nsx/tests/unit/{vmware/vshield => nsxlib}/__init__.py (100%) create mode 100644 vmware_nsx/tests/unit/nsxlib/mh/__init__.py rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/base.py (97%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_l2gateway.py (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_lsn.py (100%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_queue.py (97%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_router.py (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_secgroup.py (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_switch.py (99%) rename vmware_nsx/tests/unit/{vmware/nsxlib => nsxlib/mh}/test_versioning.py (100%) create mode 100644 vmware_nsx/tests/unit/nsxlib/v3/__init__.py rename vmware_nsx/tests/unit/{vmware => }/nsxlib/v3/nsxlib_testcase.py (100%) rename vmware_nsx/tests/unit/{vmware => }/nsxlib/v3/test_client.py (95%) rename vmware_nsx/tests/unit/{vmware => }/nsxlib/v3/test_qos_switching_profile.py (95%) rename vmware_nsx/tests/unit/{vmware => }/nsxlib/v3/test_resources.py (91%) rename vmware_nsx/tests/unit/{vmware => }/nsxlib/v3/test_switch.py (81%) create mode 100644 vmware_nsx/tests/unit/services/__init__.py create mode 100644 vmware_nsx/tests/unit/services/l2gateway/__init__.py rename vmware_nsx/tests/unit/{vmware => }/services/l2gateway/test_nsxv3_driver.py (98%) rename vmware_nsx/tests/unit/{vmware => }/services/l2gateway/test_nsxv_driver.py (100%) rename vmware_nsx/tests/unit/{vmware => }/test_utils.py (100%) delete mode 100644 vmware_nsx/tests/unit/vmware/__init__.py diff --git a/TESTING.rst b/TESTING.rst index 9b3ca84f3c..836e7f06d7 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -4,7 +4,7 @@ Testing VMware-NSX Overview -------- -The unit tests (vmware_nsx/neutron/test/unit/) are meant to cover as much +The unit tests (vmware_nsx/tests/unit/) are meant to cover as much code as possible and should be executed without the service running. They are designed to test the various pieces of the neutron and VMware NSX tree to make sure any new changes don't break existing functionality. @@ -125,13 +125,13 @@ For executing a specific test case, specify the name of the test case class separating it from the module path with a colon. For example, the following would run only the TestSubnetsV2 tests from -vmware_nsx/tests/unit/vmware/test_nsx_v_plugin.py:: +vmware_nsx/tests/unit/nsx_v/test_plugin.py:: - $ ./run_tests.sh vmware_nsx.tests.unit.vmware.test_nsx_v_plugin.TestSubnetsV2 + $ ./run_tests.sh vmware_nsx.tests.unit.nsx_v.test_plugin.TestSubnetsV2 or:: - $ tox -e py27 vmware_nsx.tests.unit.vmware.test_nsx_v_plugin.TestSubnetsV2 + $ tox -e py27 vmware_nsx.tests.unit.nsx_v.test_plugin.TestSubnetsV2 Adding more tests ~~~~~~~~~~~~~~~~~ diff --git a/vmware_nsx/tests/unit/__init__.py b/vmware_nsx/tests/unit/__init__.py index faed26a532..cd4e83d217 100644 --- a/vmware_nsx/tests/unit/__init__.py +++ b/vmware_nsx/tests/unit/__init__.py @@ -1,4 +1,5 @@ -# Copyright 2011 OpenStack Foundation. +# Copyright 2013 OpenStack Foundation. +# # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -13,7 +14,45 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +import os + +from networking_l2gw.db.l2gateway import l2gateway_models # noqa + +from vmware_nsx.api_client import client as nsx_client +from vmware_nsx.api_client import eventlet_client +from vmware_nsx import extensions +import vmware_nsx.plugin as neutron_plugin +from vmware_nsx.plugins.nsx_v.vshield.common import ( + VcnsApiClient as vcnsapi) +from vmware_nsx.plugins.nsx_v.vshield import edge_utils +from vmware_nsx.plugins.nsx_v.vshield import vcns +import vmware_nsx.plugins.nsx_v.vshield.vcns_driver as vcnsdriver -cfg.CONF.use_stderr = False +plugin = neutron_plugin.NsxPlugin +api_client = nsx_client.NsxApiClient +evt_client = eventlet_client.EventletApiClient +vcns_class = vcns.Vcns +vcns_driver = vcnsdriver.VcnsDriver +vcns_api_helper = vcnsapi.VcnsApiHelper +edge_manage_class = edge_utils.EdgeManager + +STUBS_PATH = os.path.join(os.path.dirname(__file__), 'etc') +NSXEXT_PATH = os.path.dirname(extensions.__file__) +NSXAPI_NAME = '%s.%s' % (api_client.__module__, api_client.__name__) +PLUGIN_NAME = '%s.%s' % (plugin.__module__, plugin.__name__) +CLIENT_NAME = '%s.%s' % (evt_client.__module__, evt_client.__name__) +VCNS_NAME = '%s.%s' % (vcns_class.__module__, vcns_class.__name__) +VCNS_DRIVER_NAME = '%s.%s' % (vcns_driver.__module__, vcns_driver.__name__) +VCNSAPI_NAME = '%s.%s' % (vcns_api_helper.__module__, vcns_api_helper.__name__) +EDGE_MANAGE_NAME = '%s.%s' % (edge_manage_class.__module__, + edge_manage_class.__name__) + + +def get_fake_conf(filename): + return os.path.join(STUBS_PATH, filename) + + +def nsx_method(method_name, module_name='nsxlib'): + return '%s.%s.%s' % ('vmware_nsx', module_name, + method_name) diff --git a/vmware_nsx/tests/unit/vmware/apiclient/__init__.py b/vmware_nsx/tests/unit/dvs/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/apiclient/__init__.py rename to vmware_nsx/tests/unit/dvs/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/test_dvs.py b/vmware_nsx/tests/unit/dvs/test_plugin.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_dvs.py rename to vmware_nsx/tests/unit/dvs/test_plugin.py diff --git a/vmware_nsx/tests/unit/vmware/test_dvs_utils.py b/vmware_nsx/tests/unit/dvs/test_utils.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_dvs_utils.py rename to vmware_nsx/tests/unit/dvs/test_utils.py diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_gwservice.json b/vmware_nsx/tests/unit/etc/fake_get_gwservice.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_gwservice.json rename to vmware_nsx/tests/unit/etc/fake_get_gwservice.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lqueue.json b/vmware_nsx/tests/unit/etc/fake_get_lqueue.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lqueue.json rename to vmware_nsx/tests/unit/etc/fake_get_lqueue.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter.json b/vmware_nsx/tests/unit/etc/fake_get_lrouter.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter.json rename to vmware_nsx/tests/unit/etc/fake_get_lrouter.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_lport.json b/vmware_nsx/tests/unit/etc/fake_get_lrouter_lport.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_lport.json rename to vmware_nsx/tests/unit/etc/fake_get_lrouter_lport.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_lport_att.json b/vmware_nsx/tests/unit/etc/fake_get_lrouter_lport_att.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_lport_att.json rename to vmware_nsx/tests/unit/etc/fake_get_lrouter_lport_att.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_nat.json b/vmware_nsx/tests/unit/etc/fake_get_lrouter_nat.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lrouter_nat.json rename to vmware_nsx/tests/unit/etc/fake_get_lrouter_nat.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch.json b/vmware_nsx/tests/unit/etc/fake_get_lswitch.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch.json rename to vmware_nsx/tests/unit/etc/fake_get_lswitch.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport.json b/vmware_nsx/tests/unit/etc/fake_get_lswitch_lport.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport.json rename to vmware_nsx/tests/unit/etc/fake_get_lswitch_lport.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport_att.json b/vmware_nsx/tests/unit/etc/fake_get_lswitch_lport_att.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport_att.json rename to vmware_nsx/tests/unit/etc/fake_get_lswitch_lport_att.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport_status.json b/vmware_nsx/tests/unit/etc/fake_get_lswitch_lport_status.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_lswitch_lport_status.json rename to vmware_nsx/tests/unit/etc/fake_get_lswitch_lport_status.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_get_security_profile.json b/vmware_nsx/tests/unit/etc/fake_get_security_profile.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_get_security_profile.json rename to vmware_nsx/tests/unit/etc/fake_get_security_profile.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_gwservice.json b/vmware_nsx/tests/unit/etc/fake_post_gwservice.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_gwservice.json rename to vmware_nsx/tests/unit/etc/fake_post_gwservice.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lqueue.json b/vmware_nsx/tests/unit/etc/fake_post_lqueue.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lqueue.json rename to vmware_nsx/tests/unit/etc/fake_post_lqueue.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter.json b/vmware_nsx/tests/unit/etc/fake_post_lrouter.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter.json rename to vmware_nsx/tests/unit/etc/fake_post_lrouter.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter_lport.json b/vmware_nsx/tests/unit/etc/fake_post_lrouter_lport.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter_lport.json rename to vmware_nsx/tests/unit/etc/fake_post_lrouter_lport.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter_nat.json b/vmware_nsx/tests/unit/etc/fake_post_lrouter_nat.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lrouter_nat.json rename to vmware_nsx/tests/unit/etc/fake_post_lrouter_nat.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lswitch.json b/vmware_nsx/tests/unit/etc/fake_post_lswitch.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lswitch.json rename to vmware_nsx/tests/unit/etc/fake_post_lswitch.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_lswitch_lport.json b/vmware_nsx/tests/unit/etc/fake_post_lswitch_lport.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_lswitch_lport.json rename to vmware_nsx/tests/unit/etc/fake_post_lswitch_lport.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_post_security_profile.json b/vmware_nsx/tests/unit/etc/fake_post_security_profile.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_post_security_profile.json rename to vmware_nsx/tests/unit/etc/fake_post_security_profile.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_put_lrouter_lport_att.json b/vmware_nsx/tests/unit/etc/fake_put_lrouter_lport_att.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_put_lrouter_lport_att.json rename to vmware_nsx/tests/unit/etc/fake_put_lrouter_lport_att.json diff --git a/vmware_nsx/tests/unit/vmware/etc/fake_put_lswitch_lport_att.json b/vmware_nsx/tests/unit/etc/fake_put_lswitch_lport_att.json similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/fake_put_lswitch_lport_att.json rename to vmware_nsx/tests/unit/etc/fake_put_lswitch_lport_att.json diff --git a/vmware_nsx/tests/unit/vmware/etc/neutron.conf.test b/vmware_nsx/tests/unit/etc/neutron.conf.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/neutron.conf.test rename to vmware_nsx/tests/unit/etc/neutron.conf.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nsx.ini.agentless.test b/vmware_nsx/tests/unit/etc/nsx.ini.agentless.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nsx.ini.agentless.test rename to vmware_nsx/tests/unit/etc/nsx.ini.agentless.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nsx.ini.basic.test b/vmware_nsx/tests/unit/etc/nsx.ini.basic.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nsx.ini.basic.test rename to vmware_nsx/tests/unit/etc/nsx.ini.basic.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nsx.ini.combined.test b/vmware_nsx/tests/unit/etc/nsx.ini.combined.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nsx.ini.combined.test rename to vmware_nsx/tests/unit/etc/nsx.ini.combined.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nsx.ini.full.test b/vmware_nsx/tests/unit/etc/nsx.ini.full.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nsx.ini.full.test rename to vmware_nsx/tests/unit/etc/nsx.ini.full.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nsx.ini.test b/vmware_nsx/tests/unit/etc/nsx.ini.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nsx.ini.test rename to vmware_nsx/tests/unit/etc/nsx.ini.test diff --git a/vmware_nsx/tests/unit/vmware/etc/nvp.ini.full.test b/vmware_nsx/tests/unit/etc/nvp.ini.full.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/nvp.ini.full.test rename to vmware_nsx/tests/unit/etc/nvp.ini.full.test diff --git a/vmware_nsx/tests/unit/vmware/etc/vcns.ini.test b/vmware_nsx/tests/unit/etc/vcns.ini.test similarity index 100% rename from vmware_nsx/tests/unit/vmware/etc/vcns.ini.test rename to vmware_nsx/tests/unit/etc/vcns.ini.test diff --git a/vmware_nsx/tests/unit/vmware/db/__init__.py b/vmware_nsx/tests/unit/extensions/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/db/__init__.py rename to vmware_nsx/tests/unit/extensions/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_addresspairs.py b/vmware_nsx/tests/unit/extensions/test_addresspairs.py similarity index 95% rename from vmware_nsx/tests/unit/vmware/extensions/test_addresspairs.py rename to vmware_nsx/tests/unit/extensions/test_addresspairs.py index 8085e3dc57..74767f33b4 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_addresspairs.py +++ b/vmware_nsx/tests/unit/extensions/test_addresspairs.py @@ -16,7 +16,7 @@ from neutron.extensions import allowedaddresspairs as addr_pair from neutron.tests.unit.db import test_allowedaddresspairs_db as ext_pairs -from vmware_nsx.tests.unit.vmware import test_nsx_plugin +from vmware_nsx.tests.unit.nsx_mh import test_plugin as test_nsx_plugin class TestAllowedAddressPairs(test_nsx_plugin.NsxPluginV2TestCase, diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_maclearning.py b/vmware_nsx/tests/unit/extensions/test_maclearning.py similarity index 97% rename from vmware_nsx/tests/unit/vmware/extensions/test_maclearning.py rename to vmware_nsx/tests/unit/extensions/test_maclearning.py index 0a9128dd3a..6cc833ad73 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_maclearning.py +++ b/vmware_nsx/tests/unit/extensions/test_maclearning.py @@ -23,9 +23,9 @@ import six from vmware_nsx.api_client import version from vmware_nsx.common import sync -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake -from vmware_nsx.tests.unit.vmware import test_utils +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake +from vmware_nsx.tests.unit import test_utils class MacLearningExtensionManager(object): diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_networkgw.py b/vmware_nsx/tests/unit/extensions/test_networkgw.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/extensions/test_networkgw.py rename to vmware_nsx/tests/unit/extensions/test_networkgw.py index 922c086a88..9fc6a46ea1 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_networkgw.py +++ b/vmware_nsx/tests/unit/extensions/test_networkgw.py @@ -38,8 +38,8 @@ from vmware_nsx.db import nsx_models from vmware_nsx.extensions import networkgw from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import l2gateway as l2gwlib -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware import test_nsx_plugin +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh import test_plugin as test_nsx_plugin _uuid = test_base._uuid _get_path = test_base._get_path diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_portsecurity.py b/vmware_nsx/tests/unit/extensions/test_portsecurity.py similarity index 91% rename from vmware_nsx/tests/unit/vmware/extensions/test_portsecurity.py rename to vmware_nsx/tests/unit/extensions/test_portsecurity.py index cd7fd76314..441bfe928a 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_portsecurity.py +++ b/vmware_nsx/tests/unit/extensions/test_portsecurity.py @@ -17,9 +17,9 @@ import mock from neutron.tests.unit.extensions import test_portsecurity as psec from vmware_nsx.common import sync -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake -from vmware_nsx.tests.unit.vmware import test_utils +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake +from vmware_nsx.tests.unit import test_utils class PortSecurityTestCase(psec.PortSecurityDBTestCase): diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_providernet.py b/vmware_nsx/tests/unit/extensions/test_providernet.py similarity index 98% rename from vmware_nsx/tests/unit/vmware/extensions/test_providernet.py rename to vmware_nsx/tests/unit/extensions/test_providernet.py index b23c78df58..1dbab9e7d4 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_providernet.py +++ b/vmware_nsx/tests/unit/extensions/test_providernet.py @@ -18,8 +18,8 @@ import webob.exc from neutron.extensions import multiprovidernet as mpnet from neutron.extensions import providernet as pnet -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware import test_nsx_plugin +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh import test_plugin as test_nsx_plugin class TestProvidernet(test_nsx_plugin.NsxPluginV2TestCase): diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_qosqueues.py b/vmware_nsx/tests/unit/extensions/test_qosqueues.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/extensions/test_qosqueues.py rename to vmware_nsx/tests/unit/extensions/test_qosqueues.py index c0b7387588..ebd7fa8742 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_qosqueues.py +++ b/vmware_nsx/tests/unit/extensions/test_qosqueues.py @@ -24,8 +24,8 @@ from neutron.tests.unit.api import test_extensions from vmware_nsx.db import qos_db from vmware_nsx.extensions import qos as ext_qos from vmware_nsx.nsxlib import mh as nsxlib -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware import test_nsx_plugin +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh import test_plugin as test_nsx_plugin class QoSTestExtensionManager(object): diff --git a/vmware_nsx/tests/unit/vmware/extensions/test_vnic_index.py b/vmware_nsx/tests/unit/extensions/test_vnic_index.py similarity index 97% rename from vmware_nsx/tests/unit/vmware/extensions/test_vnic_index.py rename to vmware_nsx/tests/unit/extensions/test_vnic_index.py index 5b12ffb917..27f12b7e27 100644 --- a/vmware_nsx/tests/unit/vmware/extensions/test_vnic_index.py +++ b/vmware_nsx/tests/unit/extensions/test_vnic_index.py @@ -24,10 +24,10 @@ from neutron import manager from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin from vmware_nsx.db import vnic_index_db from vmware_nsx.extensions import vnicindex as vnicidx -from vmware_nsx.tests.unit import vmware +from vmware_nsx.tests import unit as vmware -DB_PLUGIN_KLASS = ('vmware_nsx.tests.unit.vmware.extensions.' +DB_PLUGIN_KLASS = ('vmware_nsx.tests.unit.extensions.' 'test_vnic_index.VnicIndexTestPlugin') _uuid = uuidutils.generate_uuid diff --git a/vmware_nsx/tests/unit/vmware/extensions/__init__.py b/vmware_nsx/tests/unit/nsx_mh/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/extensions/__init__.py rename to vmware_nsx/tests/unit/nsx_mh/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/nsx_v/__init__.py b/vmware_nsx/tests/unit/nsx_mh/apiclient/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsx_v/__init__.py rename to vmware_nsx/tests/unit/nsx_mh/apiclient/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/apiclient/fake.py b/vmware_nsx/tests/unit/nsx_mh/apiclient/fake.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/apiclient/fake.py rename to vmware_nsx/tests/unit/nsx_mh/apiclient/fake.py diff --git a/vmware_nsx/tests/unit/vmware/apiclient/test_api_common.py b/vmware_nsx/tests/unit/nsx_mh/apiclient/test_api_common.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/apiclient/test_api_common.py rename to vmware_nsx/tests/unit/nsx_mh/apiclient/test_api_common.py diff --git a/vmware_nsx/tests/unit/vmware/apiclient/test_api_eventlet_request.py b/vmware_nsx/tests/unit/nsx_mh/apiclient/test_api_eventlet_request.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/apiclient/test_api_eventlet_request.py rename to vmware_nsx/tests/unit/nsx_mh/apiclient/test_api_eventlet_request.py index 5eeb90adea..510efaaf49 100644 --- a/vmware_nsx/tests/unit/vmware/apiclient/test_api_eventlet_request.py +++ b/vmware_nsx/tests/unit/nsx_mh/apiclient/test_api_eventlet_request.py @@ -27,7 +27,7 @@ from vmware_nsx.api_client import ( eventlet_client as client) from vmware_nsx.api_client import ( eventlet_request as request) -from vmware_nsx.tests.unit import vmware +from vmware_nsx.tests import unit as vmware LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/__init__.py b/vmware_nsx/tests/unit/nsx_mh/db/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsxlib/__init__.py rename to vmware_nsx/tests/unit/nsx_mh/db/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/db/test_lsn_db.py b/vmware_nsx/tests/unit/nsx_mh/db/test_lsn_db.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/db/test_lsn_db.py rename to vmware_nsx/tests/unit/nsx_mh/db/test_lsn_db.py diff --git a/vmware_nsx/tests/unit/vmware/db/test_nsx_db.py b/vmware_nsx/tests/unit/nsx_mh/db/test_nsx_db.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/db/test_nsx_db.py rename to vmware_nsx/tests/unit/nsx_mh/db/test_nsx_db.py diff --git a/vmware_nsx/tests/unit/vmware/test_agent_scheduler.py b/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py similarity index 94% rename from vmware_nsx/tests/unit/vmware/test_agent_scheduler.py rename to vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py index 15cec1a440..77964e004e 100644 --- a/vmware_nsx/tests/unit/vmware/test_agent_scheduler.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py @@ -21,9 +21,9 @@ from neutron.tests.unit.db import test_agentschedulers_db # noqa from vmware_nsx.common import sync from vmware_nsx.dhcp_meta import rpc -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake -from vmware_nsx.tests.unit.vmware import test_utils +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake +from vmware_nsx.tests.unit import test_utils class DhcpAgentNotifierTestCase( diff --git a/vmware_nsx/tests/unit/vmware/test_dhcpmeta.py b/vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_dhcpmeta.py rename to vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_opts.py b/vmware_nsx/tests/unit/nsx_mh/test_opts.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_opts.py rename to vmware_nsx/tests/unit/nsx_mh/test_opts.py index f71ccae891..c30439e22b 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_opts.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_opts.py @@ -29,7 +29,7 @@ from vmware_nsx.common import exceptions from vmware_nsx.common import sync from vmware_nsx import nsx_cluster from vmware_nsx.nsxlib.mh import lsn as lsnlib -from vmware_nsx.tests.unit import vmware +from vmware_nsx.tests import unit as vmware BASE_CONF_PATH = vmware.get_fake_conf('neutron.conf.test') NSX_INI_PATH = vmware.get_fake_conf('nsx.ini.basic.test') diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_plugin.py b/vmware_nsx/tests/unit/nsx_mh/test_plugin.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_plugin.py rename to vmware_nsx/tests/unit/nsx_mh/test_plugin.py index 4e5acfd828..30db4fdf8e 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_plugin.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_plugin.py @@ -51,9 +51,9 @@ from vmware_nsx.common import sync from vmware_nsx.common import utils from vmware_nsx.db import db as nsx_db from vmware_nsx.nsxlib import mh as nsxlib -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake -from vmware_nsx.tests.unit.vmware import test_utils +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake +from vmware_nsx.tests.unit import test_utils LOG = log.getLogger(__name__) diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_sync.py b/vmware_nsx/tests/unit/nsx_mh/test_sync.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_sync.py rename to vmware_nsx/tests/unit/nsx_mh/test_sync.py index adb7418023..a698c3b5b5 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_sync.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_sync.py @@ -39,8 +39,8 @@ from vmware_nsx.db import db from vmware_nsx import nsx_cluster as cluster from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx import plugin -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake LOG = log.getLogger(__name__) diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_utils.py b/vmware_nsx/tests/unit/nsx_mh/test_utils.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_utils.py rename to vmware_nsx/tests/unit/nsx_mh/test_utils.py index 40be58e97e..7ad51fc768 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_utils.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_utils.py @@ -26,8 +26,8 @@ from vmware_nsx.common import nsx_utils from vmware_nsx.common import utils from vmware_nsx.db import nsx_models from vmware_nsx.nsxlib import mh as nsxlib -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.nsxlib import base as nsx_base +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsxlib.mh import base as nsx_base class NsxUtilsTestCase(base.BaseTestCase): diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/__init__.py b/vmware_nsx/tests/unit/nsx_v/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/__init__.py rename to vmware_nsx/tests/unit/nsx_v/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/nsx_v/test_edge_loadbalancer_driver.py b/vmware_nsx/tests/unit/nsx_v/test_edge_loadbalancer_driver.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsx_v/test_edge_loadbalancer_driver.py rename to vmware_nsx/tests/unit/nsx_v/test_edge_loadbalancer_driver.py diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_misc.py b/vmware_nsx/tests/unit/nsx_v/test_misc.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_nsx_misc.py rename to vmware_nsx/tests/unit/nsx_v/test_misc.py diff --git a/vmware_nsx/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py b/vmware_nsx/tests/unit/nsx_v/test_nsxv_loadbalancer.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py rename to vmware_nsx/tests/unit/nsx_v/test_nsxv_loadbalancer.py diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_v_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_v_plugin.py rename to vmware_nsx/tests/unit/nsx_v/test_plugin.py index c7874f9e76..11163d8421 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_v_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -56,10 +56,10 @@ from vmware_nsx.extensions import ( from vmware_nsx.plugins.nsx_v.vshield.common import ( constants as vcns_const) from vmware_nsx.plugins.nsx_v.vshield import edge_utils -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.extensions import test_vnic_index -from vmware_nsx.tests.unit.vmware import test_utils -from vmware_nsx.tests.unit.vmware.vshield import fake_vcns +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.extensions import test_vnic_index +from vmware_nsx.tests.unit.nsx_v.vshield import fake_vcns +from vmware_nsx.tests.unit import test_utils PLUGIN_NAME = 'vmware_nsx.plugin.NsxVPlugin' diff --git a/vmware_nsx/tests/unit/vmware/services/__init__.py b/vmware_nsx/tests/unit/nsx_v/vshield/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/services/__init__.py rename to vmware_nsx/tests/unit/nsx_v/vshield/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/vshield/fake_vcns.py b/vmware_nsx/tests/unit/nsx_v/vshield/fake_vcns.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/vshield/fake_vcns.py rename to vmware_nsx/tests/unit/nsx_v/vshield/fake_vcns.py diff --git a/vmware_nsx/tests/unit/vmware/vshield/test_edge_utils.py b/vmware_nsx/tests/unit/nsx_v/vshield/test_edge_utils.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/vshield/test_edge_utils.py rename to vmware_nsx/tests/unit/nsx_v/vshield/test_edge_utils.py index fb4e752796..320d598aec 100644 --- a/vmware_nsx/tests/unit/vmware/vshield/test_edge_utils.py +++ b/vmware_nsx/tests/unit/nsx_v/vshield/test_edge_utils.py @@ -27,7 +27,7 @@ from vmware_nsx.db import nsxv_db from vmware_nsx.plugins.nsx_v.vshield.common import ( constants as vcns_const) from vmware_nsx.plugins.nsx_v.vshield import edge_utils -from vmware_nsx.tests.unit import vmware +from vmware_nsx.tests import unit as vmware _uuid = uuidutils.generate_uuid diff --git a/vmware_nsx/tests/unit/vmware/vshield/test_vcns_driver.py b/vmware_nsx/tests/unit/nsx_v/vshield/test_vcns_driver.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/vshield/test_vcns_driver.py rename to vmware_nsx/tests/unit/nsx_v/vshield/test_vcns_driver.py index 2770762e92..f4b1ecaec9 100644 --- a/vmware_nsx/tests/unit/vmware/vshield/test_vcns_driver.py +++ b/vmware_nsx/tests/unit/nsx_v/vshield/test_vcns_driver.py @@ -25,8 +25,8 @@ from vmware_nsx.plugins.nsx_v.vshield.tasks import ( constants as ts_const) from vmware_nsx.plugins.nsx_v.vshield.tasks import tasks as ts from vmware_nsx.plugins.nsx_v.vshield import vcns_driver -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.vshield import fake_vcns +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_v.vshield import fake_vcns VCNS_CONFIG_FILE = vmware.get_fake_conf("vcns.ini.test") diff --git a/vmware_nsx/tests/unit/vmware/services/l2gateway/__init__.py b/vmware_nsx/tests/unit/nsx_v3/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/services/l2gateway/__init__.py rename to vmware_nsx/tests/unit/nsx_v3/__init__.py diff --git a/vmware_nsx/tests/unit/vmware/nsx_v3_mocks.py b/vmware_nsx/tests/unit/nsx_v3/mocks.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsx_v3_mocks.py rename to vmware_nsx/tests/unit/nsx_v3/mocks.py diff --git a/vmware_nsx/tests/unit/vmware/test_constants_v3.py b/vmware_nsx/tests/unit/nsx_v3/test_constants.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_constants_v3.py rename to vmware_nsx/tests/unit/nsx_v3/test_constants.py diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_parent_tag.py b/vmware_nsx/tests/unit/nsx_v3/test_parent_tag.py similarity index 97% rename from vmware_nsx/tests/unit/vmware/test_nsx_parent_tag.py rename to vmware_nsx/tests/unit/nsx_v3/test_parent_tag.py index 6d90ece979..c808d9146c 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_parent_tag.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_parent_tag.py @@ -16,7 +16,7 @@ from neutron.extensions import portbindings as pbin -from vmware_nsx.tests.unit.vmware import test_nsx_v3_plugin +from vmware_nsx.tests.unit.nsx_v3 import test_plugin as test_nsx_v3_plugin class TestParentTagPortBinding(test_nsx_v3_plugin.NsxPluginV3TestCase): diff --git a/vmware_nsx/tests/unit/vmware/test_nsx_v3_plugin.py b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/test_nsx_v3_plugin.py rename to vmware_nsx/tests/unit/nsx_v3/test_plugin.py index dffcdc72d7..53bcea77e4 100644 --- a/vmware_nsx/tests/unit/vmware/test_nsx_v3_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py @@ -37,8 +37,8 @@ from vmware_nsx.common import utils from vmware_nsx.nsxlib import v3 as nsxlib from vmware_nsx.nsxlib.v3 import dfw_api as firewall from vmware_nsx.nsxlib.v3 import resources as nsx_resources -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware import nsx_v3_mocks +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_v3 import mocks as nsx_v3_mocks PLUGIN_NAME = ('vmware_nsx.plugin.NsxV3Plugin') diff --git a/vmware_nsx/tests/unit/vmware/vshield/__init__.py b/vmware_nsx/tests/unit/nsxlib/__init__.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/vshield/__init__.py rename to vmware_nsx/tests/unit/nsxlib/__init__.py diff --git a/vmware_nsx/tests/unit/nsxlib/mh/__init__.py b/vmware_nsx/tests/unit/nsxlib/mh/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/base.py b/vmware_nsx/tests/unit/nsxlib/mh/base.py similarity index 97% rename from vmware_nsx/tests/unit/vmware/nsxlib/base.py rename to vmware_nsx/tests/unit/nsxlib/mh/base.py index 2bda19d54f..ee823bbe6d 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/base.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/base.py @@ -23,8 +23,8 @@ from vmware_nsx.api_client import exception from vmware_nsx.api_client import version from vmware_nsx.common import config # noqa from vmware_nsx import nsx_cluster as cluster -from vmware_nsx.tests.unit import vmware -from vmware_nsx.tests.unit.vmware.apiclient import fake +from vmware_nsx.tests import unit as vmware +from vmware_nsx.tests.unit.nsx_mh.apiclient import fake _uuid = test_base._uuid diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_l2gateway.py b/vmware_nsx/tests/unit/nsxlib/mh/test_l2gateway.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_l2gateway.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_l2gateway.py index c6054102ee..606f95a699 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/test_l2gateway.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_l2gateway.py @@ -24,7 +24,7 @@ from vmware_nsx.common import utils as nsx_utils from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import l2gateway as l2gwlib from vmware_nsx.nsxlib.mh import switch as switchlib -from vmware_nsx.tests.unit.vmware.nsxlib import base +from vmware_nsx.tests.unit.nsxlib.mh import base _uuid = test_base._uuid diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_lsn.py b/vmware_nsx/tests/unit/nsxlib/mh/test_lsn.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_lsn.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_lsn.py diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_queue.py b/vmware_nsx/tests/unit/nsxlib/mh/test_queue.py similarity index 97% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_queue.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_queue.py index bce07f8557..718bce17e5 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/test_queue.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_queue.py @@ -20,7 +20,7 @@ from neutron.common import exceptions from vmware_nsx.api_client import exception as api_exc from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import queue as queuelib -from vmware_nsx.tests.unit.vmware.nsxlib import base +from vmware_nsx.tests.unit.nsxlib.mh import base class TestLogicalQueueLib(base.NsxlibTestCase): diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_router.py b/vmware_nsx/tests/unit/nsxlib/mh/test_router.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_router.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_router.py index 9cf28455d9..cd1ad49c71 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/test_router.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_router.py @@ -27,7 +27,7 @@ from vmware_nsx.common import utils from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import router as routerlib from vmware_nsx.nsxlib.mh import switch as switchlib -from vmware_nsx.tests.unit.vmware.nsxlib import base +from vmware_nsx.tests.unit.nsxlib.mh import base _uuid = test_base._uuid diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_secgroup.py b/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_secgroup.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py index 076d9538bf..9b592559b7 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/test_secgroup.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py @@ -20,7 +20,7 @@ from neutron.tests.unit.api.v2 import test_base from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import secgroup as secgrouplib -from vmware_nsx.tests.unit.vmware.nsxlib import base +from vmware_nsx.tests.unit.nsxlib.mh import base _uuid = test_base._uuid diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_switch.py b/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py similarity index 99% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_switch.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_switch.py index 1d8641962b..6e153feac5 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/test_switch.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py @@ -23,7 +23,7 @@ from neutron.tests.unit.api.v2 import test_base from vmware_nsx.common import utils from vmware_nsx.nsxlib.mh import switch as switchlib -from vmware_nsx.tests.unit.vmware.nsxlib import base +from vmware_nsx.tests.unit.nsxlib.mh import base _uuid = test_base._uuid diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/test_versioning.py b/vmware_nsx/tests/unit/nsxlib/mh/test_versioning.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsxlib/test_versioning.py rename to vmware_nsx/tests/unit/nsxlib/mh/test_versioning.py diff --git a/vmware_nsx/tests/unit/nsxlib/v3/__init__.py b/vmware_nsx/tests/unit/nsxlib/v3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/nsxlib_testcase.py b/vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/nsxlib_testcase.py rename to vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_client.py b/vmware_nsx/tests/unit/nsxlib/v3/test_client.py similarity index 95% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/test_client.py rename to vmware_nsx/tests/unit/nsxlib/v3/test_client.py index 155b50e7eb..abbc2da800 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_client.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_client.py @@ -16,18 +16,26 @@ import mock import vmware_nsx.common.exceptions as exep -import vmware_nsx.tests.unit.vmware.nsx_v3_mocks as mocks from oslo_config import cfg from oslo_log import log from oslo_serialization import jsonutils from vmware_nsx.nsxlib.v3 import client -from vmware_nsx.tests.unit.vmware.nsxlib.v3 import nsxlib_testcase +from vmware_nsx.tests.unit.nsx_v3 import mocks +from vmware_nsx.tests.unit.nsxlib.v3 import nsxlib_testcase LOG = log.getLogger(__name__) CLIENT_PKG = 'vmware_nsx.nsxlib.v3.client' +# Cache the pointers to those functions because they are overridden +# by tests/unit/nsx_v3/test_plugin.py. This is only needed when running +# tox on multiple tests. +client_get_resource = client.get_resource +client_create_resource = client.create_resource +client_update_resource = client.update_resource +client_delete_resource = client.delete_resource + def assert_session_call(mock_call, url, verify, data, headers, cert): mock_call.assert_called_once_with( @@ -324,7 +332,7 @@ class NsxV3APIClientBridgeTestCase(BaseClientTestCase): @mock.patch("%s.%s" % (CLIENT_PKG, 'requests.Session.get')) @mock.patch(CLIENT_PKG + '.RESTClient._validate_result') def test_get_resource(self, mock_validate, mock_get): - client.get_resource('ports') + client_get_resource('ports') assert_session_call( mock_get, @@ -336,7 +344,7 @@ class NsxV3APIClientBridgeTestCase(BaseClientTestCase): @mock.patch("%s.%s" % (CLIENT_PKG, 'requests.Session.post')) @mock.patch(CLIENT_PKG + '.RESTClient._validate_result') def test_create_resource(self, mock_validate, mock_post): - client.create_resource('ports', {'resource-name': 'port1'}) + client_create_resource('ports', {'resource-name': 'port1'}) assert_session_call( mock_post, @@ -348,7 +356,7 @@ class NsxV3APIClientBridgeTestCase(BaseClientTestCase): @mock.patch("%s.%s" % (CLIENT_PKG, 'requests.Session.put')) @mock.patch(CLIENT_PKG + '.RESTClient._validate_result') def test_update_resource(self, mock_validate, mock_put): - client.update_resource('ports/1', {'name': 'a-new-name'}) + client_update_resource('ports/1', {'name': 'a-new-name'}) assert_session_call( mock_put, @@ -360,7 +368,7 @@ class NsxV3APIClientBridgeTestCase(BaseClientTestCase): @mock.patch("%s.%s" % (CLIENT_PKG, 'requests.Session.delete')) @mock.patch(CLIENT_PKG + '.RESTClient._validate_result') def test_delete_resource(self, mock_validate, mock_delete): - client.delete_resource('ports/11') + client_delete_resource('ports/11') assert_session_call( mock_delete, diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_qos_switching_profile.py b/vmware_nsx/tests/unit/nsxlib/v3/test_qos_switching_profile.py similarity index 95% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/test_qos_switching_profile.py rename to vmware_nsx/tests/unit/nsxlib/v3/test_qos_switching_profile.py index 76bc68244b..1c457c5c0e 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_qos_switching_profile.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_qos_switching_profile.py @@ -19,8 +19,8 @@ import mock from oslo_log import log from vmware_nsx.nsxlib import v3 as nsxlib -from vmware_nsx.tests.unit.vmware.nsxlib.v3 import nsxlib_testcase -from vmware_nsx.tests.unit.vmware import test_constants_v3 +from vmware_nsx.tests.unit.nsx_v3 import test_constants as test_constants_v3 +from vmware_nsx.tests.unit.nsxlib.v3 import nsxlib_testcase LOG = log.getLogger(__name__) diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_resources.py b/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py similarity index 91% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/test_resources.py rename to vmware_nsx/tests/unit/nsxlib/v3/test_resources.py index 68cd8900e7..c0aa2d56c3 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_resources.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_resources.py @@ -14,13 +14,13 @@ # under the License. # import mock -import vmware_nsx.tests.unit.vmware.nsx_v3_mocks as mocks from oslo_serialization import jsonutils from vmware_nsx.nsxlib.v3 import client from vmware_nsx.nsxlib.v3 import resources -from vmware_nsx.tests.unit.vmware.nsxlib.v3 import test_client -from vmware_nsx.tests.unit.vmware import test_constants_v3 +from vmware_nsx.tests.unit.nsx_v3 import mocks +from vmware_nsx.tests.unit.nsx_v3 import test_constants as test_constants_v3 +from vmware_nsx.tests.unit.nsxlib.v3 import test_client CLIENT_PKG = test_client.CLIENT_PKG @@ -163,6 +163,10 @@ class LogicalPortTestCase(test_client.BaseClientTestCase): profile_dicts.append({'resource_type': profile_id['key'], 'id': profile_id['value']}) + # Reload resources because resources.LogicalPort.create is overridden + # by tests/unit/nsx_v3/test_plugin.py. This is only needed when running + # tox on multiple tests. + reload(resources) result = resources.LogicalPort(client.NSX3Client()).create( fake_port['logical_switch_id'], fake_port['attachment']['id'], @@ -201,6 +205,10 @@ class LogicalPortTestCase(test_client.BaseClientTestCase): mock_post.return_value = mocks.MockRequestsResponse( 200, jsonutils.dumps(fake_port)) + # Reload resources because resources.LogicalPort.create is overridden + # by tests/unit/nsx_v3/test_plugin.py. This is only needed when running + # tox on multiple tests. + reload(resources) result = resources.LogicalPort(client.NSX3Client()).create( test_constants_v3.FAKE_PORT['logical_switch_id'], test_constants_v3.FAKE_PORT['attachment']['id'], @@ -218,6 +226,10 @@ class LogicalPortTestCase(test_client.BaseClientTestCase): 200, None) uuid = test_constants_v3.FAKE_PORT['id'] + # Reload resources because resources.LogicalPort.delete is overridden + # by tests/unit/nsx_v3/test_plugin.py. This is only needed when running + # tox on multiple tests. + reload(resources) result = resources.LogicalPort(client.NSX3Client()).delete(uuid) self.assertIsNone(result.content) test_client.assert_session_call( diff --git a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_switch.py b/vmware_nsx/tests/unit/nsxlib/v3/test_switch.py similarity index 81% rename from vmware_nsx/tests/unit/vmware/nsxlib/v3/test_switch.py rename to vmware_nsx/tests/unit/nsxlib/v3/test_switch.py index a774b321ff..f916f39f57 100644 --- a/vmware_nsx/tests/unit/vmware/nsxlib/v3/test_switch.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_switch.py @@ -21,11 +21,17 @@ from oslo_utils import uuidutils from vmware_nsx.common import nsx_constants from vmware_nsx.nsxlib import v3 as nsxlib -from vmware_nsx.tests.unit.vmware import nsx_v3_mocks -from vmware_nsx.tests.unit.vmware.nsxlib.v3 import nsxlib_testcase +from vmware_nsx.tests.unit.nsx_v3 import mocks as nsx_v3_mocks +from vmware_nsx.tests.unit.nsxlib.v3 import nsxlib_testcase LOG = log.getLogger(__name__) +# Cache the pointers to those functions because they are overridden +# by tests/unit/nsx_v3/test_plugin.py. This is only needed when running +# tox on multiple tests. +nsxlib_create_logical_switch = nsxlib.create_logical_switch +nsxlib_delete_logical_switch = nsxlib.delete_logical_switch + class NsxLibSwitchTestCase(nsxlib_testcase.NsxLibTestCase): @@ -39,7 +45,7 @@ class NsxLibSwitchTestCase(nsxlib_testcase.NsxLibTestCase): fake_switch = nsx_v3_mocks.make_fake_switch(tz_uuid=tz_uuid) mock_create_resource.return_value = fake_switch - result = nsxlib.create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, + result = nsxlib_create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, []) self.assertEqual(fake_switch, result) @@ -54,7 +60,7 @@ class NsxLibSwitchTestCase(nsxlib_testcase.NsxLibTestCase): fake_switch['admin_state'] = nsx_constants.ADMIN_STATE_DOWN mock_create_resource.return_value = fake_switch - result = nsxlib.create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, + result = nsxlib_create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, [], admin_state=False) self.assertEqual(fake_switch, result) @@ -69,7 +75,7 @@ class NsxLibSwitchTestCase(nsxlib_testcase.NsxLibTestCase): fake_switch['vlan_id'] = '123' mock_create_resource.return_value = fake_switch - result = nsxlib.create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, + result = nsxlib_create_logical_switch(nsx_v3_mocks.FAKE_NAME, tz_uuid, []) self.assertEqual(fake_switch, result) @@ -82,5 +88,5 @@ class NsxLibSwitchTestCase(nsxlib_testcase.NsxLibTestCase): mock_delete_resource.return_value = None fake_switch = nsx_v3_mocks.make_fake_switch() - result = nsxlib.delete_logical_switch(fake_switch['id']) + result = nsxlib_delete_logical_switch(fake_switch['id']) self.assertIsNone(result) diff --git a/vmware_nsx/tests/unit/services/__init__.py b/vmware_nsx/tests/unit/services/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vmware_nsx/tests/unit/services/l2gateway/__init__.py b/vmware_nsx/tests/unit/services/l2gateway/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vmware_nsx/tests/unit/vmware/services/l2gateway/test_nsxv3_driver.py b/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py similarity index 98% rename from vmware_nsx/tests/unit/vmware/services/l2gateway/test_nsxv3_driver.py rename to vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py index a0b417cb76..ee9c4158f4 100644 --- a/vmware_nsx/tests/unit/vmware/services/l2gateway/test_nsxv3_driver.py +++ b/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py @@ -29,8 +29,8 @@ from vmware_nsx.common import nsx_constants from vmware_nsx.nsxlib import v3 as nsxlib from vmware_nsx.services.l2gateway.common import plugin as l2gw_plugin from vmware_nsx.services.l2gateway.nsx_v3 import driver as nsx_v3_driver -from vmware_nsx.tests.unit.vmware import nsx_v3_mocks -from vmware_nsx.tests.unit.vmware import test_nsx_v3_plugin +from vmware_nsx.tests.unit.nsx_v3 import mocks as nsx_v3_mocks +from vmware_nsx.tests.unit.nsx_v3 import test_plugin as test_nsx_v3_plugin NSX_V3_PLUGIN_CLASS = ('vmware_nsx.plugins.nsx_v3.plugin.NsxV3Plugin') NSX_V3_L2GW_DRIVER_CLASS_PATH = ('vmware_nsx.services.l2gateway.' diff --git a/vmware_nsx/tests/unit/vmware/services/l2gateway/test_nsxv_driver.py b/vmware_nsx/tests/unit/services/l2gateway/test_nsxv_driver.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/services/l2gateway/test_nsxv_driver.py rename to vmware_nsx/tests/unit/services/l2gateway/test_nsxv_driver.py diff --git a/vmware_nsx/tests/unit/vmware/test_utils.py b/vmware_nsx/tests/unit/test_utils.py similarity index 100% rename from vmware_nsx/tests/unit/vmware/test_utils.py rename to vmware_nsx/tests/unit/test_utils.py diff --git a/vmware_nsx/tests/unit/vmware/__init__.py b/vmware_nsx/tests/unit/vmware/__init__.py deleted file mode 100644 index cd4e83d217..0000000000 --- a/vmware_nsx/tests/unit/vmware/__init__.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2013 OpenStack Foundation. -# -# 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. - -import os - -from networking_l2gw.db.l2gateway import l2gateway_models # noqa - -from vmware_nsx.api_client import client as nsx_client -from vmware_nsx.api_client import eventlet_client -from vmware_nsx import extensions -import vmware_nsx.plugin as neutron_plugin -from vmware_nsx.plugins.nsx_v.vshield.common import ( - VcnsApiClient as vcnsapi) -from vmware_nsx.plugins.nsx_v.vshield import edge_utils -from vmware_nsx.plugins.nsx_v.vshield import vcns -import vmware_nsx.plugins.nsx_v.vshield.vcns_driver as vcnsdriver - - -plugin = neutron_plugin.NsxPlugin -api_client = nsx_client.NsxApiClient -evt_client = eventlet_client.EventletApiClient -vcns_class = vcns.Vcns -vcns_driver = vcnsdriver.VcnsDriver -vcns_api_helper = vcnsapi.VcnsApiHelper -edge_manage_class = edge_utils.EdgeManager - -STUBS_PATH = os.path.join(os.path.dirname(__file__), 'etc') -NSXEXT_PATH = os.path.dirname(extensions.__file__) -NSXAPI_NAME = '%s.%s' % (api_client.__module__, api_client.__name__) -PLUGIN_NAME = '%s.%s' % (plugin.__module__, plugin.__name__) -CLIENT_NAME = '%s.%s' % (evt_client.__module__, evt_client.__name__) -VCNS_NAME = '%s.%s' % (vcns_class.__module__, vcns_class.__name__) -VCNS_DRIVER_NAME = '%s.%s' % (vcns_driver.__module__, vcns_driver.__name__) -VCNSAPI_NAME = '%s.%s' % (vcns_api_helper.__module__, vcns_api_helper.__name__) -EDGE_MANAGE_NAME = '%s.%s' % (edge_manage_class.__module__, - edge_manage_class.__name__) - - -def get_fake_conf(filename): - return os.path.join(STUBS_PATH, filename) - - -def nsx_method(method_name, module_name='nsxlib'): - return '%s.%s.%s' % ('vmware_nsx', module_name, - method_name)