Merge "Rename Neutron core/service plugins for VMware NSX"
This commit is contained in:
commit
77dfe0962b
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2011 Nicira, Inc.
|
||||
# Copyright 2014 VMware, Inc.
|
||||
#
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -14,24 +13,10 @@
|
||||
# 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 eventlet
|
||||
eventlet.monkey_patch()
|
||||
import logging
|
||||
import urllib2
|
||||
from neutron.plugins.nicira import NeutronPlugin
|
||||
from neutron.plugins.nicira import NeutronServicePlugin
|
||||
|
||||
from neutron.tests import base
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
lg = logging.getLogger("test_nvp_api_request")
|
||||
|
||||
REQUEST_TIMEOUT = 1
|
||||
|
||||
|
||||
def fetch(url):
|
||||
return urllib2.urlopen(url).read()
|
||||
|
||||
|
||||
class NvpApiRequestTest(base.BaseTestCase):
|
||||
|
||||
pass
|
||||
NsxPlugin = NeutronPlugin.NvpPluginV2
|
||||
NsxServicePlugin = NeutronServicePlugin.NvpAdvancedPlugin
|
@ -19,40 +19,37 @@ import os
|
||||
|
||||
import neutron.plugins.nicira.api_client.client_eventlet as client
|
||||
from neutron.plugins.nicira import extensions
|
||||
import neutron.plugins.nicira.NeutronPlugin as plugin
|
||||
import neutron.plugins.nicira.NeutronServicePlugin as service_plugin
|
||||
import neutron.plugins.nicira.NvpApiClient as nvpapi
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.plugins.nicira.vshield.common import (
|
||||
VcnsApiClient as vcnsapi)
|
||||
from neutron.plugins.nicira.vshield.common import VcnsApiClient as vcnsapi
|
||||
from neutron.plugins.nicira.vshield import vcns
|
||||
import neutron.plugins.nicira.vshield.vcns_driver as vcnsdriver
|
||||
import neutron.plugins.vmware.plugin as neutron_plugin
|
||||
|
||||
nvp_plugin = plugin.NvpPluginV2
|
||||
nvp_service_plugin = service_plugin.NvpAdvancedPlugin
|
||||
plugin = neutron_plugin.NsxPlugin
|
||||
service_plugin = neutron_plugin.NsxServicePlugin
|
||||
api_helper = nvpapi.NVPApiHelper
|
||||
nvp_client = client.NvpApiClientEventlet
|
||||
api_client = client.NvpApiClientEventlet
|
||||
vcns_class = vcns.Vcns
|
||||
vcns_driver = vcnsdriver.VcnsDriver
|
||||
vcns_api_helper = vcnsapi.VcnsApiHelper
|
||||
|
||||
STUBS_PATH = os.path.join(os.path.dirname(__file__), 'etc')
|
||||
NVPEXT_PATH = os.path.dirname(extensions.__file__)
|
||||
NVPAPI_NAME = '%s.%s' % (api_helper.__module__, api_helper.__name__)
|
||||
NVPLIB_NAME = nvplib.__name__
|
||||
PLUGIN_NAME = '%s.%s' % (nvp_plugin.__module__, nvp_plugin.__name__)
|
||||
SERVICE_PLUGIN_NAME = '%s.%s' % (nvp_service_plugin.__module__,
|
||||
nvp_service_plugin.__name__)
|
||||
CLIENT_NAME = '%s.%s' % (nvp_client.__module__, nvp_client.__name__)
|
||||
NSXEXT_PATH = os.path.dirname(extensions.__file__)
|
||||
NSXAPI_NAME = '%s.%s' % (api_helper.__module__, api_helper.__name__)
|
||||
NSXLIB_NAME = nvplib.__name__
|
||||
PLUGIN_NAME = '%s.%s' % (plugin.__module__, plugin.__name__)
|
||||
SERVICE_PLUGIN_NAME = '%s.%s' % (service_plugin.__module__,
|
||||
service_plugin.__name__)
|
||||
CLIENT_NAME = '%s.%s' % (api_client.__module__, api_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__)
|
||||
VCNSAPI_NAME = '%s.%s' % (vcns_api_helper.__module__, vcns_api_helper.__name__)
|
||||
|
||||
|
||||
def get_fake_conf(filename):
|
||||
return os.path.join(STUBS_PATH, filename)
|
||||
|
||||
|
||||
def nicira_method(method_name, module_name='nvplib'):
|
||||
def nsx_method(method_name, module_name='nvplib'):
|
||||
return '%s.%s.%s' % ('neutron.plugins.nicira', module_name, method_name)
|
0
neutron/tests/unit/vmware/apiclient/__init__.py
Normal file
0
neutron/tests/unit/vmware/apiclient/__init__.py
Normal file
@ -1,6 +1,6 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2011 Nicira, Inc.
|
||||
# Copyright 2011 VMware, Inc.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -15,10 +15,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# System
|
||||
import httplib
|
||||
|
||||
# Local
|
||||
import neutron.plugins.nicira.api_client.common as naco
|
||||
from neutron.tests import base
|
||||
|
@ -1,6 +1,6 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2009-2012 Nicira Networks, Inc. All Rights Reserved.
|
||||
# Copyright (C) 2009-2012 VMware, Inc. 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
|
||||
@ -27,11 +27,11 @@ from mock import patch
|
||||
from neutron.plugins.nicira.api_client import client_eventlet as nace
|
||||
from neutron.plugins.nicira.api_client import request_eventlet as nare
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import CLIENT_NAME
|
||||
from neutron.tests.unit.vmware import CLIENT_NAME
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
LOG = logging.getLogger("test_nvp_api_request_eventlet")
|
||||
LOG = logging.getLogger("test_api_request_eventlet")
|
||||
|
||||
|
||||
REQUEST_TIMEOUT = 1
|
||||
@ -157,7 +157,6 @@ class NvpApiRequestEventletTest(base.BaseTestCase):
|
||||
self.client.acquire_connection.return_value = None
|
||||
|
||||
self.req._issue_request()
|
||||
LOG.info('request_error: %s' % self.req._request_error)
|
||||
self.assertIsInstance(self.req._request_error, Exception)
|
||||
self.assertTrue(self.client.acquire_connection.called)
|
||||
|
0
neutron/tests/unit/vmware/nsxlib/__init__.py
Normal file
0
neutron/tests/unit/vmware/nsxlib/__init__.py
Normal file
@ -23,10 +23,10 @@ from neutron.plugins.nicira import nsx_cluster
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit import test_api_v2
|
||||
from neutron.tests.unit.vmware import fake_nvpapiclient
|
||||
from neutron.tests.unit.vmware import NSXAPI_NAME
|
||||
from neutron.tests.unit.vmware import STUBS_PATH
|
||||
|
||||
_uuid = test_api_v2._uuid
|
||||
|
||||
@ -36,7 +36,7 @@ class NsxlibTestCase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nsxapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nsxapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nsxapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
fake_version = getattr(self, 'fake_version', "3.0")
|
||||
@ -70,7 +70,7 @@ class NsxlibNegativeBaseTestCase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
# mock nsx api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nsxapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nsxapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nsxapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
# Choose 3.0, but the version is irrelevant for the aim of
|
@ -17,8 +17,8 @@
|
||||
from neutron.plugins.nicira.nsxlib import l2gateway as l2gwlib
|
||||
from neutron.plugins.nicira.nsxlib import switch as switchlib
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests.unit.nicira.nsxlib import base
|
||||
from neutron.tests.unit import test_api_v2
|
||||
from neutron.tests.unit.vmware.nsxlib import base
|
||||
|
||||
_uuid = test_api_v2._uuid
|
||||
|
@ -19,7 +19,7 @@ import mock
|
||||
from neutron.common import exceptions
|
||||
from neutron.plugins.nicira.nsxlib import queue as queuelib
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.tests.unit.nicira.nsxlib import base
|
||||
from neutron.tests.unit.vmware.nsxlib import base
|
||||
|
||||
|
||||
class TestLogicalQueueLib(base.NsxlibTestCase):
|
@ -24,8 +24,8 @@ from neutron.plugins.nicira.nsxlib import router as routerlib
|
||||
from neutron.plugins.nicira.nsxlib import switch as switchlib
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests.unit.nicira.nsxlib import base
|
||||
from neutron.tests.unit import test_api_v2
|
||||
from neutron.tests.unit.vmware.nsxlib import base
|
||||
|
||||
_uuid = test_api_v2._uuid
|
||||
|
@ -17,7 +17,7 @@
|
||||
from neutron.common import exceptions
|
||||
from neutron.plugins.nicira.nsxlib import secgroup as secgrouplib
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests.unit.nicira.nsxlib import base
|
||||
from neutron.tests.unit.vmware.nsxlib import base
|
||||
|
||||
|
||||
class SecurityProfileTestCase(base.NsxlibTestCase):
|
@ -21,8 +21,8 @@ from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
from neutron.plugins.nicira.common import utils
|
||||
from neutron.plugins.nicira.nsxlib import switch as switchlib
|
||||
from neutron.tests.unit.nicira.nsxlib import base
|
||||
from neutron.tests.unit import test_api_v2
|
||||
from neutron.tests.unit.vmware.nsxlib import base
|
||||
|
||||
_uuid = test_api_v2._uuid
|
||||
|
@ -22,12 +22,12 @@ from neutron.common import constants
|
||||
from neutron.common.test_lib import test_config
|
||||
from neutron.plugins.nicira.common import sync
|
||||
from neutron.plugins.nicira.dhcp_meta import rpc
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit.openvswitch import test_agent_scheduler as test_base
|
||||
from neutron.tests.unit.vmware import fake_nvpapiclient
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import NSXAPI_NAME
|
||||
from neutron.tests.unit.vmware import PLUGIN_NAME
|
||||
from neutron.tests.unit.vmware import STUBS_PATH
|
||||
|
||||
|
||||
class NVPDhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase):
|
||||
@ -38,7 +38,7 @@ class NVPDhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase):
|
||||
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
# Avoid runs of the synchronizer looping call
|
||||
patch_sync = mock.patch.object(sync, '_start_loopingcall')
|
@ -29,12 +29,12 @@ from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.nicira.common import utils
|
||||
from neutron.plugins.nicira import NeutronServicePlugin as nsp
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import NVPEXT_PATH
|
||||
from neutron.tests.unit.nicira import SERVICE_PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import test_nicira_plugin
|
||||
from neutron.tests.unit.nicira import VCNS_NAME
|
||||
from neutron.tests.unit.nicira.vshield import fake_vcns
|
||||
from neutron.tests.unit import test_l3_plugin
|
||||
from neutron.tests.unit.vmware import NSXEXT_PATH
|
||||
from neutron.tests.unit.vmware import SERVICE_PLUGIN_NAME
|
||||
from neutron.tests.unit.vmware import test_nsx_plugin
|
||||
from neutron.tests.unit.vmware import VCNS_NAME
|
||||
from neutron.tests.unit.vmware.vshield import fake_vcns
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
|
||||
@ -63,7 +63,7 @@ class ServiceRouterTestExtensionManager(object):
|
||||
return []
|
||||
|
||||
|
||||
class ServiceRouterTest(test_nicira_plugin.NiciraL3NatTest,
|
||||
class ServiceRouterTest(test_nsx_plugin.NiciraL3NatTest,
|
||||
test_l3_plugin.L3NatTestCaseMixin):
|
||||
|
||||
def vcns_patch(self):
|
||||
@ -97,7 +97,7 @@ class ServiceRouterTest(test_nicira_plugin.NiciraL3NatTest,
|
||||
self.fc2.enable_service_loadbalancer)
|
||||
|
||||
def setUp(self, ext_mgr=None, service_plugins=None):
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
cfg.CONF.set_override('task_status_check_interval', 100, group="vcns")
|
||||
|
||||
# vcns does not support duplicated router name, ignore router name
|
||||
@ -158,7 +158,7 @@ class ServiceRouterTest(test_nicira_plugin.NiciraL3NatTest,
|
||||
|
||||
|
||||
class ServiceRouterTestCase(ServiceRouterTest,
|
||||
test_nicira_plugin.TestNiciraL3NatTestCase):
|
||||
test_nsx_plugin.TestNiciraL3NatTestCase):
|
||||
|
||||
def test_router_create(self):
|
||||
name = 'router1'
|
@ -27,13 +27,11 @@ from neutron import manager
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.common import constants as const
|
||||
from neutron.tests.unit.db.firewall import test_db_firewall
|
||||
from neutron.tests.unit.nicira import test_edge_router
|
||||
from neutron.tests.unit.vmware import test_edge_router
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
|
||||
FW_PLUGIN_CLASS = (
|
||||
"neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin"
|
||||
)
|
||||
FW_PLUGIN_CLASS = "neutron.plugins.vmware.plugin.NsxServicePlugin"
|
||||
|
||||
|
||||
class FirewallTestExtensionManager(
|
@ -27,13 +27,11 @@ from neutron.extensions import loadbalancer as lb
|
||||
from neutron import manager
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||
from neutron.tests.unit.nicira import test_edge_router
|
||||
from neutron.tests.unit.vmware import test_edge_router
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
|
||||
LBAAS_PLUGIN_CLASS = (
|
||||
"neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin"
|
||||
)
|
||||
LBAAS_PLUGIN_CLASS = "neutron.plugins.vmware.plugin.NsxServicePlugin"
|
||||
|
||||
|
||||
class LoadBalancerTestExtensionManager(
|
@ -26,13 +26,13 @@ from neutron import context
|
||||
from neutron.extensions import agent
|
||||
from neutron.plugins.nicira.common import sync
|
||||
from neutron.plugins.nicira.NvpApiClient import NVPVersion
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import NVPEXT_PATH
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
from neutron.tests.unit.vmware import fake_nvpapiclient
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import NSXAPI_NAME
|
||||
from neutron.tests.unit.vmware import NSXEXT_PATH
|
||||
from neutron.tests.unit.vmware import PLUGIN_NAME
|
||||
from neutron.tests.unit.vmware import STUBS_PATH
|
||||
|
||||
|
||||
class MacLearningExtensionManager(object):
|
||||
@ -59,7 +59,7 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
def setUp(self):
|
||||
self.adminContext = context.get_admin_context()
|
||||
test_config['config_files'] = [get_fake_conf('nsx.ini.full.test')]
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
# Save the original RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
|
||||
@ -67,7 +67,7 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
ext_mgr = MacLearningExtensionManager()
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
# Avoid runs of the synchronizer looping call
|
||||
patch_sync = mock.patch.object(sync, '_start_loopingcall')
|
@ -30,8 +30,8 @@ from neutron.plugins.nicira import nsx_cluster
|
||||
from neutron.plugins.nicira.nsxlib import lsn as lsnlib
|
||||
from neutron.plugins.nicira import NvpApiClient as nvp_client
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import PLUGIN_NAME
|
||||
|
||||
BASE_CONF_PATH = get_fake_conf('neutron.conf.test')
|
||||
NSX_INI_PATH = get_fake_conf('nsx.ini.basic.test')
|
@ -51,13 +51,6 @@ from neutron.plugins.nicira import nsxlib
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira.NvpApiClient import NVPVersion
|
||||
from neutron.tests.unit import _test_extension_portbindings as test_bindings
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import NVPEXT_PATH
|
||||
from neutron.tests.unit.nicira import PLUGIN_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
import neutron.tests.unit.nicira.test_networkgw as test_l2_gw
|
||||
import neutron.tests.unit.test_db_plugin as test_plugin
|
||||
import neutron.tests.unit.test_extension_allowedaddresspairs as test_addr_pair
|
||||
import neutron.tests.unit.test_extension_ext_gw_mode as test_ext_gw_mode
|
||||
@ -66,6 +59,13 @@ import neutron.tests.unit.test_extension_security_group as ext_sg
|
||||
from neutron.tests.unit import test_extensions
|
||||
import neutron.tests.unit.test_l3_plugin as test_l3_plugin
|
||||
from neutron.tests.unit import testlib_api
|
||||
from neutron.tests.unit.vmware import fake_nvpapiclient
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import NSXAPI_NAME
|
||||
from neutron.tests.unit.vmware import NSXEXT_PATH
|
||||
from neutron.tests.unit.vmware import PLUGIN_NAME
|
||||
from neutron.tests.unit.vmware import STUBS_PATH
|
||||
import neutron.tests.unit.vmware.test_networkgw as test_l2_gw
|
||||
|
||||
|
||||
from neutron.openstack.common import log
|
||||
@ -108,7 +108,7 @@ class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nsx.ini.test')]
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
self.mock_instance = self.mock_nvpapi.start()
|
||||
# Avoid runs of the synchronizer looping call
|
||||
patch_sync = mock.patch.object(sync, '_start_loopingcall')
|
||||
@ -390,7 +390,7 @@ class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase):
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nsx.ini.test')]
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
# Avoid runs of the synchronizer looping call
|
||||
@ -423,7 +423,7 @@ class NiciraSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
|
||||
test_lib.test_config['config_files'] = [get_fake_conf('nsx.ini.test')]
|
||||
# mock nvp api client
|
||||
fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
self.mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
self.mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
instance = self.mock_nvpapi.start()
|
||||
instance.return_value.login.return_value = "the_cookie"
|
||||
# Avoid runs of the synchronizer looping call
|
||||
@ -521,7 +521,7 @@ class NiciraL3NatTest(test_l3_plugin.L3BaseForIntTests,
|
||||
for item in l3.RESOURCE_ATTRIBUTE_MAP:
|
||||
self._l3_attribute_map_bk[item] = (
|
||||
l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
l3_attribute_map_bk = backup_l3_attribute_map()
|
||||
self.addCleanup(restore_l3_attribute_map, l3_attribute_map_bk)
|
||||
ext_mgr = ext_mgr or TestNiciraL3ExtensionManager()
|
||||
@ -1048,7 +1048,7 @@ class NvpQoSTestExtensionManager(object):
|
||||
class TestQoSQueue(NiciraPluginV2TestCase):
|
||||
|
||||
def setUp(self, plugin=None):
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
super(TestQoSQueue, self).setUp()
|
||||
ext_mgr = NvpQoSTestExtensionManager()
|
||||
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
|
||||
@ -1460,7 +1460,7 @@ class TestNiciraNetworkGateway(NiciraPluginV2TestCase,
|
||||
test_l2_gw.NetworkGatewayDbTestCase):
|
||||
|
||||
def setUp(self, plugin=PLUGIN_NAME, ext_mgr=None):
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
super(TestNiciraNetworkGateway,
|
||||
self).setUp(plugin=plugin, ext_mgr=ext_mgr)
|
||||
|
||||
@ -1559,7 +1559,7 @@ class TestNiciraNetworkGateway(NiciraPluginV2TestCase,
|
||||
class TestNiciraMultiProviderNetworks(NiciraPluginV2TestCase):
|
||||
|
||||
def setUp(self, plugin=None):
|
||||
cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH)
|
||||
cfg.CONF.set_override('api_extensions_path', NSXEXT_PATH)
|
||||
super(TestNiciraMultiProviderNetworks, self).setUp()
|
||||
|
||||
def test_create_network_provider(self):
|
@ -27,19 +27,18 @@ from neutron.common import config
|
||||
from neutron.common import constants
|
||||
from neutron import context
|
||||
from neutron.openstack.common import jsonutils as json
|
||||
from neutron.openstack.common import log
|
||||
from neutron.plugins.nicira.common import sync
|
||||
from neutron.plugins.nicira import NeutronPlugin
|
||||
from neutron.plugins.nicira import nsx_cluster
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.plugins.vmware import plugin
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import fake_nvpapiclient
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import NVPAPI_NAME
|
||||
from neutron.tests.unit.nicira import STUBS_PATH
|
||||
from neutron.tests.unit import test_api_v2
|
||||
|
||||
from neutron.openstack.common import log
|
||||
from neutron.tests.unit.vmware import fake_nvpapiclient
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import NSXAPI_NAME
|
||||
from neutron.tests.unit.vmware import STUBS_PATH
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@ -259,7 +258,7 @@ class NvpSyncTestCase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
# mock nvp api client
|
||||
self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH)
|
||||
mock_nvpapi = mock.patch(NVPAPI_NAME, autospec=True)
|
||||
mock_nvpapi = mock.patch(NSXAPI_NAME, autospec=True)
|
||||
# Avoid runs of the synchronizer looping call
|
||||
# These unit tests will excplicitly invoke synchronization
|
||||
patch_sync = mock.patch.object(sync, '_start_loopingcall')
|
||||
@ -288,7 +287,7 @@ class NvpSyncTestCase(base.BaseTestCase):
|
||||
'--config-file', get_fake_conf('nsx.ini.test')]
|
||||
config.parse(args=args)
|
||||
cfg.CONF.set_override('allow_overlapping_ips', True)
|
||||
self._plugin = NeutronPlugin.NvpPluginV2()
|
||||
self._plugin = plugin.NsxPlugin()
|
||||
# Mock neutron manager plugin load functions to speed up tests
|
||||
mock_nm_get_plugin = mock.patch('neutron.manager.NeutronManager.'
|
||||
'get_plugin')
|
@ -25,8 +25,8 @@ from neutron.plugins.nicira.common import utils
|
||||
from neutron.plugins.nicira import NvpApiClient
|
||||
from neutron.plugins.nicira import nvplib
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import nicira_method
|
||||
from neutron.tests.unit.nicira.nsxlib import base as nsx_base
|
||||
from neutron.tests.unit.vmware import nsx_method
|
||||
from neutron.tests.unit.vmware.nsxlib import base as nsx_base
|
||||
|
||||
|
||||
class NsxUtilsTestCase(base.BaseTestCase):
|
||||
@ -39,33 +39,33 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# Mock relevant db calls
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nicira_method('get_nsx_switch_and_port_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
mock.patch(nsx_method('get_nsx_switch_and_port_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nicira_method('add_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
mock.patch(nicira_method('delete_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
mock.patch(nsx_method('delete_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
|
||||
def _mock_network_mapping_db_calls(self, ret_value):
|
||||
# Mock relevant db calls
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nicira_method('get_nsx_switch_ids',
|
||||
module_name='dbexts.nicira_db'),
|
||||
mock.patch(nsx_method('get_nsx_switch_ids',
|
||||
module_name='dbexts.nicira_db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nicira_method('add_neutron_nsx_network_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_network_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
|
||||
def _mock_router_mapping_db_calls(self, ret_value):
|
||||
# Mock relevant db calls
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nicira_method('get_nsx_router_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
mock.patch(nsx_method('get_nsx_router_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nicira_method('add_neutron_nsx_router_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_router_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
|
||||
def _verify_get_nsx_switch_and_port_id(self, exp_ls_uuid, exp_lp_uuid):
|
||||
# The nvplib and db calls are mocked, therefore the cluster
|
||||
@ -107,8 +107,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
exp_lp_uuid = uuidutils.generate_uuid()
|
||||
ret_value = None, exp_lp_uuid
|
||||
self._mock_port_mapping_db_calls(ret_value)
|
||||
with mock.patch(nicira_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
with mock.patch(nsx_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
return_value=[{'uuid': exp_lp_uuid,
|
||||
'_relations': {
|
||||
'LogicalSwitchConfig': {
|
||||
@ -123,8 +123,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
exp_lp_uuid = uuidutils.generate_uuid()
|
||||
ret_value = None, None
|
||||
self._mock_port_mapping_db_calls(ret_value)
|
||||
with mock.patch(nicira_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
with mock.patch(nsx_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
return_value=[{'uuid': exp_lp_uuid,
|
||||
'_relations': {
|
||||
'LogicalSwitchConfig': {
|
||||
@ -137,8 +137,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# mappings are not found both in the db and the backend
|
||||
ret_value = None, None
|
||||
self._mock_port_mapping_db_calls(ret_value)
|
||||
with mock.patch(nicira_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
with mock.patch(nsx_method('query_lswitch_lports',
|
||||
module_name='nsxlib.switch'),
|
||||
return_value=[]):
|
||||
self._verify_get_nsx_switch_and_port_id(None, None)
|
||||
|
||||
@ -154,8 +154,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# found for a given network identifier
|
||||
exp_ls_uuids = [uuidutils.generate_uuid()]
|
||||
self._mock_network_mapping_db_calls(None)
|
||||
with mock.patch(nicira_method('get_lswitches',
|
||||
module_name='nsxlib.switch'),
|
||||
with mock.patch(nsx_method('get_lswitches',
|
||||
module_name='nsxlib.switch'),
|
||||
return_value=[{'uuid': uuid}
|
||||
for uuid in exp_ls_uuids]):
|
||||
self._verify_get_nsx_switch_ids(exp_ls_uuids)
|
||||
@ -164,8 +164,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# This test verifies that the function returns None if the mappings
|
||||
# are not found both in the db and in the backend
|
||||
self._mock_network_mapping_db_calls(None)
|
||||
with mock.patch(nicira_method('get_lswitches',
|
||||
module_name='nsxlib.switch'),
|
||||
with mock.patch(nsx_method('get_lswitches',
|
||||
module_name='nsxlib.switch'),
|
||||
return_value=[]):
|
||||
self._verify_get_nsx_switch_ids(None)
|
||||
|
||||
@ -181,8 +181,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# found for a given port identifier
|
||||
exp_lr_uuid = uuidutils.generate_uuid()
|
||||
self._mock_router_mapping_db_calls(None)
|
||||
with mock.patch(nicira_method('query_lrouters',
|
||||
module_name='nsxlib.router'),
|
||||
with mock.patch(nsx_method('query_lrouters',
|
||||
module_name='nsxlib.router'),
|
||||
return_value=[{'uuid': exp_lr_uuid}]):
|
||||
self._verify_get_nsx_router_id(exp_lr_uuid)
|
||||
|
||||
@ -190,8 +190,8 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# This test verifies that the function returns None if the mapping
|
||||
# are not found both in the db and in the backend
|
||||
self._mock_router_mapping_db_calls(None)
|
||||
with mock.patch(nicira_method('query_lrouters',
|
||||
module_name='nsxlib.router'),
|
||||
with mock.patch(nsx_method('query_lrouters',
|
||||
module_name='nsxlib.router'),
|
||||
return_value=[]):
|
||||
self._verify_get_nsx_router_id(None)
|
||||
|
@ -27,9 +27,9 @@ from neutron.plugins.nicira.vshield.tasks.constants import TaskStatus
|
||||
from neutron.plugins.nicira.vshield.tasks import tasks as ts
|
||||
from neutron.plugins.nicira.vshield import vcns_driver
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import VCNS_NAME
|
||||
from neutron.tests.unit.nicira.vshield import fake_vcns
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import VCNS_NAME
|
||||
from neutron.tests.unit.vmware.vshield import fake_vcns
|
||||
|
||||
VCNS_CONFIG_FILE = get_fake_conf("vcns.ini.test")
|
||||
|
@ -27,9 +27,9 @@ from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.nicira.vshield.common import exceptions as vcns_exc
|
||||
from neutron.plugins.nicira.vshield import vcns_driver
|
||||
from neutron.tests.unit.db.firewall import test_db_firewall
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import VCNS_NAME
|
||||
from neutron.tests.unit.nicira.vshield import fake_vcns
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import VCNS_NAME
|
||||
from neutron.tests.unit.vmware.vshield import fake_vcns
|
||||
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
@ -27,9 +27,9 @@ from neutron.plugins.nicira.vshield import (
|
||||
from neutron.plugins.nicira.vshield.common import (
|
||||
exceptions as vcns_exc)
|
||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||
from neutron.tests.unit.nicira import get_fake_conf
|
||||
from neutron.tests.unit.nicira import VCNS_NAME
|
||||
from neutron.tests.unit.nicira.vshield import fake_vcns
|
||||
from neutron.tests.unit.vmware import get_fake_conf
|
||||
from neutron.tests.unit.vmware import VCNS_NAME
|
||||
from neutron.tests.unit.vmware.vshield import fake_vcns
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
|
@ -136,6 +136,7 @@ neutron.core_plugins =
|
||||
openvswitch = neutron.plugins.openvswitch.ovs_neutron_plugin:OVSNeutronPluginV2
|
||||
plumgrid = neutron.plugins.plumgrid.plumgrid_plugin.plumgrid_plugin:NeutronPluginPLUMgridV2
|
||||
ryu = neutron.plugins.ryu.ryu_neutron_plugin:RyuNeutronPluginV2
|
||||
vmware = neutron.plugins.vmware.plugin:NsxPlugin
|
||||
neutron.service_plugins =
|
||||
dummy = neutron.tests.unit.dummy_plugin:DummyServicePlugin
|
||||
router = neutron.services.l3_router.l3_router_plugin:L3RouterPlugin
|
||||
|
Loading…
Reference in New Issue
Block a user