Browse Source

Rename Neutron core/service plugins for VMware NSX

Short aliases are introduced for the NSX plugin(s). This patch
also switches to using the new plugin names/naming scheme in
the unit tests.

Partial-implements blueprint: nicira-plugin-renaming

Change-Id: If1f1431b098bf77b9c85e0afb3d7848083d9d451
changes/05/189505/1
armando-migliaccio 8 years ago
parent
commit
51fc1201fc
  1. 0
      neutron/plugins/vmware/__init__.py
  2. 29
      neutron/plugins/vmware/plugin.py
  3. 31
      neutron/tests/unit/vmware/__init__.py
  4. 0
      neutron/tests/unit/vmware/apiclient/__init__.py
  5. 4
      neutron/tests/unit/vmware/apiclient/test_api_common.py
  6. 7
      neutron/tests/unit/vmware/apiclient/test_api_request_eventlet.py
  7. 0
      neutron/tests/unit/vmware/etc/fake_get_gwservice.json
  8. 0
      neutron/tests/unit/vmware/etc/fake_get_lqueue.json
  9. 0
      neutron/tests/unit/vmware/etc/fake_get_lrouter.json
  10. 0
      neutron/tests/unit/vmware/etc/fake_get_lrouter_lport.json
  11. 0
      neutron/tests/unit/vmware/etc/fake_get_lrouter_lport_att.json
  12. 0
      neutron/tests/unit/vmware/etc/fake_get_lrouter_nat.json
  13. 0
      neutron/tests/unit/vmware/etc/fake_get_lswitch.json
  14. 0
      neutron/tests/unit/vmware/etc/fake_get_lswitch_lport.json
  15. 0
      neutron/tests/unit/vmware/etc/fake_get_lswitch_lport_att.json
  16. 0
      neutron/tests/unit/vmware/etc/fake_get_lswitch_lport_status.json
  17. 0
      neutron/tests/unit/vmware/etc/fake_get_security_profile.json
  18. 0
      neutron/tests/unit/vmware/etc/fake_post_gwservice.json
  19. 0
      neutron/tests/unit/vmware/etc/fake_post_lqueue.json
  20. 0
      neutron/tests/unit/vmware/etc/fake_post_lrouter.json
  21. 0
      neutron/tests/unit/vmware/etc/fake_post_lrouter_lport.json
  22. 0
      neutron/tests/unit/vmware/etc/fake_post_lrouter_nat.json
  23. 0
      neutron/tests/unit/vmware/etc/fake_post_lswitch.json
  24. 0
      neutron/tests/unit/vmware/etc/fake_post_lswitch_lport.json
  25. 0
      neutron/tests/unit/vmware/etc/fake_post_security_profile.json
  26. 0
      neutron/tests/unit/vmware/etc/fake_put_lrouter_lport_att.json
  27. 0
      neutron/tests/unit/vmware/etc/fake_put_lswitch_lport_att.json
  28. 0
      neutron/tests/unit/vmware/etc/neutron.conf.test
  29. 0
      neutron/tests/unit/vmware/etc/nsx.ini.agentless.test
  30. 0
      neutron/tests/unit/vmware/etc/nsx.ini.basic.test
  31. 0
      neutron/tests/unit/vmware/etc/nsx.ini.full.test
  32. 0
      neutron/tests/unit/vmware/etc/nsx.ini.test
  33. 0
      neutron/tests/unit/vmware/etc/nvp.ini.full.test
  34. 0
      neutron/tests/unit/vmware/etc/vcns.ini.test
  35. 0
      neutron/tests/unit/vmware/fake_nvpapiclient.py
  36. 0
      neutron/tests/unit/vmware/nsxlib/__init__.py
  37. 10
      neutron/tests/unit/vmware/nsxlib/base.py
  38. 2
      neutron/tests/unit/vmware/nsxlib/test_l2gateway.py
  39. 0
      neutron/tests/unit/vmware/nsxlib/test_lsn.py
  40. 2
      neutron/tests/unit/vmware/nsxlib/test_queue.py
  41. 2
      neutron/tests/unit/vmware/nsxlib/test_router.py
  42. 2
      neutron/tests/unit/vmware/nsxlib/test_secgroup.py
  43. 2
      neutron/tests/unit/vmware/nsxlib/test_switch.py
  44. 0
      neutron/tests/unit/vmware/nsxlib/test_versioning.py
  45. 12
      neutron/tests/unit/vmware/test_agent_scheduler.py
  46. 0
      neutron/tests/unit/vmware/test_dhcpmeta.py
  47. 16
      neutron/tests/unit/vmware/test_edge_router.py
  48. 6
      neutron/tests/unit/vmware/test_fwaas_plugin.py
  49. 6
      neutron/tests/unit/vmware/test_lbaas_plugin.py
  50. 16
      neutron/tests/unit/vmware/test_maclearning.py
  51. 0
      neutron/tests/unit/vmware/test_networkgw.py
  52. 0
      neutron/tests/unit/vmware/test_nsx_db.py
  53. 4
      neutron/tests/unit/vmware/test_nsx_opts.py
  54. 28
      neutron/tests/unit/vmware/test_nsx_plugin.py
  55. 17
      neutron/tests/unit/vmware/test_nsx_sync.py
  56. 60
      neutron/tests/unit/vmware/test_nsx_utils.py
  57. 6
      neutron/tests/unit/vmware/test_vcns_driver.py
  58. 0
      neutron/tests/unit/vmware/vshield/__init__.py
  59. 0
      neutron/tests/unit/vmware/vshield/fake_vcns.py
  60. 6
      neutron/tests/unit/vmware/vshield/test_firewall_driver.py
  61. 6
      neutron/tests/unit/vmware/vshield/test_loadbalancer_driver.py
  62. 1
      setup.cfg

0
neutron/tests/unit/nicira/nsxlib/__init__.py → neutron/plugins/vmware/__init__.py

29
neutron/tests/unit/nicira/test_nvp_api_request.py → neutron/plugins/vmware/plugin.py

@ -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.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):
from neutron.plugins.nicira import NeutronPlugin
from neutron.plugins.nicira import NeutronServicePlugin
pass
NsxPlugin = NeutronPlugin.NvpPluginV2
NsxServicePlugin = NeutronServicePlugin.NvpAdvancedPlugin

31
neutron/tests/unit/nicira/__init__.py → neutron/tests/unit/vmware/__init__.py

@ -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

4
neutron/tests/unit/nicira/test_nvp_api_common.py → neutron/tests/unit/vmware/apiclient/test_api_common.py

@ -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

7
neutron/tests/unit/nicira/test_nvp_api_request_eventlet.py → neutron/tests/unit/vmware/apiclient/test_api_request_eventlet.py

@ -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/nicira/etc/fake_get_gwservice.json → neutron/tests/unit/vmware/etc/fake_get_gwservice.json

0
neutron/tests/unit/nicira/etc/fake_get_lqueue.json → neutron/tests/unit/vmware/etc/fake_get_lqueue.json

0
neutron/tests/unit/nicira/etc/fake_get_lrouter.json → neutron/tests/unit/vmware/etc/fake_get_lrouter.json

0
neutron/tests/unit/nicira/etc/fake_get_lrouter_lport.json → neutron/tests/unit/vmware/etc/fake_get_lrouter_lport.json

0
neutron/tests/unit/nicira/etc/fake_get_lrouter_lport_att.json → neutron/tests/unit/vmware/etc/fake_get_lrouter_lport_att.json

0
neutron/tests/unit/nicira/etc/fake_get_lrouter_nat.json → neutron/tests/unit/vmware/etc/fake_get_lrouter_nat.json

0
neutron/tests/unit/nicira/etc/fake_get_lswitch.json → neutron/tests/unit/vmware/etc/fake_get_lswitch.json

0
neutron/tests/unit/nicira/etc/fake_get_lswitch_lport.json → neutron/tests/unit/vmware/etc/fake_get_lswitch_lport.json

0
neutron/tests/unit/nicira/etc/fake_get_lswitch_lport_att.json → neutron/tests/unit/vmware/etc/fake_get_lswitch_lport_att.json

0
neutron/tests/unit/nicira/etc/fake_get_lswitch_lport_status.json → neutron/tests/unit/vmware/etc/fake_get_lswitch_lport_status.json

0
neutron/tests/unit/nicira/etc/fake_get_security_profile.json → neutron/tests/unit/vmware/etc/fake_get_security_profile.json

0
neutron/tests/unit/nicira/etc/fake_post_gwservice.json → neutron/tests/unit/vmware/etc/fake_post_gwservice.json

0
neutron/tests/unit/nicira/etc/fake_post_lqueue.json → neutron/tests/unit/vmware/etc/fake_post_lqueue.json

0
neutron/tests/unit/nicira/etc/fake_post_lrouter.json → neutron/tests/unit/vmware/etc/fake_post_lrouter.json

0
neutron/tests/unit/nicira/etc/fake_post_lrouter_lport.json → neutron/tests/unit/vmware/etc/fake_post_lrouter_lport.json

0
neutron/tests/unit/nicira/etc/fake_post_lrouter_nat.json → neutron/tests/unit/vmware/etc/fake_post_lrouter_nat.json

0
neutron/tests/unit/nicira/etc/fake_post_lswitch.json → neutron/tests/unit/vmware/etc/fake_post_lswitch.json

0
neutron/tests/unit/nicira/etc/fake_post_lswitch_lport.json → neutron/tests/unit/vmware/etc/fake_post_lswitch_lport.json

0
neutron/tests/unit/nicira/etc/fake_post_security_profile.json → neutron/tests/unit/vmware/etc/fake_post_security_profile.json

0
neutron/tests/unit/nicira/etc/fake_put_lrouter_lport_att.json → neutron/tests/unit/vmware/etc/fake_put_lrouter_lport_att.json

0
neutron/tests/unit/nicira/etc/fake_put_lswitch_lport_att.json → neutron/tests/unit/vmware/etc/fake_put_lswitch_lport_att.json

0
neutron/tests/unit/nicira/etc/neutron.conf.test → neutron/tests/unit/vmware/etc/neutron.conf.test

0
neutron/tests/unit/nicira/etc/nsx.ini.agentless.test → neutron/tests/unit/vmware/etc/nsx.ini.agentless.test

0
neutron/tests/unit/nicira/etc/nsx.ini.basic.test → neutron/tests/unit/vmware/etc/nsx.ini.basic.test

0
neutron/tests/unit/nicira/etc/nsx.ini.full.test → neutron/tests/unit/vmware/etc/nsx.ini.full.test

0
neutron/tests/unit/nicira/etc/nsx.ini.test → neutron/tests/unit/vmware/etc/nsx.ini.test

0
neutron/tests/unit/nicira/etc/nvp.ini.full.test → neutron/tests/unit/vmware/etc/nvp.ini.full.test

0
neutron/tests/unit/nicira/etc/vcns.ini.test → neutron/tests/unit/vmware/etc/vcns.ini.test

0
neutron/tests/unit/nicira/fake_nvpapiclient.py → neutron/tests/unit/vmware/fake_nvpapiclient.py

0
neutron/tests/unit/vmware/nsxlib/__init__.py

10
neutron/tests/unit/nicira/nsxlib/base.py → neutron/tests/unit/vmware/nsxlib/base.py

@ -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

2
neutron/tests/unit/nicira/nsxlib/test_l2gateway.py → neutron/tests/unit/vmware/nsxlib/test_l2gateway.py

@ -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

0
neutron/tests/unit/nicira/nsxlib/test_lsn.py → neutron/tests/unit/vmware/nsxlib/test_lsn.py

2
neutron/tests/unit/nicira/nsxlib/test_queue.py → neutron/tests/unit/vmware/nsxlib/test_queue.py

@ -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):

2
neutron/tests/unit/nicira/nsxlib/test_router.py → neutron/tests/unit/vmware/nsxlib/test_router.py

@ -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

2
neutron/tests/unit/nicira/nsxlib/test_secgroup.py → neutron/tests/unit/vmware/nsxlib/test_secgroup.py

@ -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):

2
neutron/tests/unit/nicira/nsxlib/test_switch.py → neutron/tests/unit/vmware/nsxlib/test_switch.py

@ -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

0
neutron/tests/unit/nicira/nsxlib/test_versioning.py → neutron/tests/unit/vmware/nsxlib/test_versioning.py

12
neutron/tests/unit/nicira/test_agent_scheduler.py → neutron/tests/unit/vmware/test_agent_scheduler.py

@ -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')

0
neutron/tests/unit/nicira/test_dhcpmeta.py → neutron/tests/unit/vmware/test_dhcpmeta.py

16
neutron/tests/unit/nicira/test_edge_router.py → neutron/tests/unit/vmware/test_edge_router.py

@ -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'

6
neutron/tests/unit/nicira/test_fwaas_plugin.py → neutron/tests/unit/vmware/test_fwaas_plugin.py

@ -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(

6
neutron/tests/unit/nicira/test_lbaas_plugin.py → neutron/tests/unit/vmware/test_lbaas_plugin.py

@ -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(

16
neutron/tests/unit/nicira/test_maclearning.py → neutron/tests/unit/vmware/test_maclearning.py

@ -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')

0
neutron/tests/unit/nicira/test_networkgw.py → neutron/tests/unit/vmware/test_networkgw.py

0
neutron/tests/unit/nicira/test_nicira_db.py → neutron/tests/unit/vmware/test_nsx_db.py

4
neutron/tests/unit/nicira/test_nvpopts.py → neutron/tests/unit/vmware/test_nsx_opts.py

@ -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')

28
neutron/tests/unit/nicira/test_nicira_plugin.py → neutron/tests/unit/vmware/test_nsx_plugin.py

@ -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):

17
neutron/tests/unit/nicira/test_nvp_sync.py → neutron/tests/unit/vmware/test_nsx_sync.py

@ -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')

60
neutron/tests/unit/nicira/test_nsx_utils.py → neutron/tests/unit/vmware/test_nsx_utils.py

@ -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)

6
neutron/tests/unit/nicira/test_vcns_driver.py → neutron/tests/unit/vmware/test_vcns_driver.py

@ -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")

0
neutron/tests/unit/nicira/vshield/__init__.py → neutron/tests/unit/vmware/vshield/__init__.py

0
neutron/tests/unit/nicira/vshield/fake_vcns.py → neutron/tests/unit/vmware/vshield/fake_vcns.py

6
neutron/tests/unit/nicira/vshield/test_firewall_driver.py → neutron/tests/unit/vmware/vshield/test_firewall_driver.py

@ -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

6
neutron/tests/unit/nicira/vshield/test_loadbalancer_driver.py → neutron/tests/unit/vmware/vshield/test_loadbalancer_driver.py

@ -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

1
setup.cfg

@ -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…
Cancel
Save