Rename nvp_cluster for VMware NSX plugin

Rename the module into nsx_cluster and the class into NSXCluster,
and update references accordingly.

Also, rename utility method create_nvp_cluster to create_nsx_cluster
and move it into nsx_utils.

Partial-implements blueprint: nicira-plugin-renaming

Change-Id: I1a943cc64730ea67f464c3804370dad46411f8a2
This commit is contained in:
Salvatore Orlando 2014-01-22 04:55:46 -08:00
parent a2220fad2c
commit 2399337b3a
7 changed files with 39 additions and 39 deletions

View File

@ -75,7 +75,6 @@ from neutron.plugins.nicira import dhcpmeta_modes
from neutron.plugins.nicira.extensions import maclearning as mac_ext
from neutron.plugins.nicira.extensions import nvp_networkgw as networkgw
from neutron.plugins.nicira.extensions import nvp_qos as ext_qos
from neutron.plugins.nicira import nvp_cluster
from neutron.plugins.nicira import NvpApiClient
from neutron.plugins.nicira import nvplib
@ -100,26 +99,6 @@ class NetworkTypes:
BRIDGE = 'bridge'
def create_nvp_cluster(cluster_opts, concurrent_connections,
nsx_gen_timeout):
cluster = nvp_cluster.NVPCluster(**cluster_opts)
def _ctrl_split(x, y):
return (x, int(y), True)
api_providers = [_ctrl_split(*ctrl.split(':'))
for ctrl in cluster.nsx_controllers]
cluster.api_client = NvpApiClient.NVPApiHelper(
api_providers, cluster.nsx_user, cluster.nsx_password,
request_timeout=cluster.req_timeout,
http_timeout=cluster.http_timeout,
retries=cluster.retries,
redirects=cluster.redirects,
concurrent_connections=concurrent_connections,
nvp_gen_timeout=nsx_gen_timeout)
return cluster
class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
agentschedulers_db.DhcpAgentSchedulerDbMixin,
db_base_plugin_v2.NeutronDbPluginV2,
@ -195,9 +174,10 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
neutron_extensions.append_api_extensions_path([NVP_EXT_PATH])
self.nvp_opts = cfg.CONF.NSX
self.nvp_sync_opts = cfg.CONF.NSX_SYNC
self.cluster = create_nvp_cluster(cfg.CONF,
self.nvp_opts.concurrent_connections,
self.nvp_opts.nsx_gen_timeout)
self.cluster = nsx_utils.create_nsx_cluster(
cfg.CONF,
self.nvp_opts.concurrent_connections,
self.nvp_opts.nsx_gen_timeout)
self.base_binding_dict = {
pbin.VIF_TYPE: pbin.VIF_TYPE_OVS,

View File

@ -23,7 +23,7 @@ from oslo.config import cfg
from neutron.common import config
from neutron.plugins.nicira.common import config as nsx_config # noqa
from neutron.plugins.nicira import NeutronPlugin
from neutron.plugins.nicira.common import nsx_utils
from neutron.plugins.nicira import nvplib
config.setup_logging(cfg.CONF)
@ -106,7 +106,7 @@ def main():
print("\tretries: %s" % cfg.CONF.retries)
print("\tredirects: %s" % cfg.CONF.redirects)
print("\thttp_timeout: %s" % cfg.CONF.http_timeout)
cluster = NeutronPlugin.create_nvp_cluster(
cluster = nsx_utils.create_nsx_cluster(
cfg.CONF,
cfg.CONF.NSX.concurrent_connections,
cfg.CONF.NSX.nsx_gen_timeout)

View File

@ -17,6 +17,8 @@
from neutron.openstack.common import log
from neutron.plugins.nicira.dbexts import nicira_db
from neutron.plugins.nicira import nsx_cluster
from neutron.plugins.nicira import NvpApiClient
from neutron.plugins.nicira import nvplib
@ -73,3 +75,22 @@ def get_nsx_switch_and_port_id(session, cluster, neutron_port_id):
session, neutron_port_id,
nvp_switch_id, nvp_port_id)
return nvp_switch_id, nvp_port_id
def create_nsx_cluster(cluster_opts, concurrent_connections, nsx_gen_timeout):
cluster = nsx_cluster.NSXCluster(**cluster_opts)
def _ctrl_split(x, y):
return (x, int(y), True)
api_providers = [_ctrl_split(*ctrl.split(':'))
for ctrl in cluster.nsx_controllers]
cluster.api_client = NvpApiClient.NVPApiHelper(
api_providers, cluster.nsx_user, cluster.nsx_password,
request_timeout=cluster.req_timeout,
http_timeout=cluster.http_timeout,
retries=cluster.retries,
redirects=cluster.redirects,
concurrent_connections=concurrent_connections,
nvp_gen_timeout=nsx_gen_timeout)
return cluster

View File

@ -35,11 +35,10 @@ DEPRECATED_ATTRIBUTES = ['metadata_dhcp_host_route',
'nvp_user', 'nvp_password', 'nvp_controllers']
class NVPCluster(object):
"""NVP cluster class.
class NSXCluster(object):
"""NSX cluster class.
Encapsulates controller connections and the API client for a NVP cluster.
Accessed within the NvpPluginV2 class.
Encapsulates controller connections and the API client for a NSX cluster.
Controller-specific parameters, such as timeouts are stored in the
elements of the controllers attribute, which are dicts.

View File

@ -29,7 +29,7 @@ from neutron import context
from neutron.openstack.common import jsonutils as json
from neutron.plugins.nicira.common import sync
from neutron.plugins.nicira import NeutronPlugin
from neutron.plugins.nicira import nvp_cluster
from neutron.plugins.nicira import nsx_cluster
from neutron.plugins.nicira import NvpApiClient
from neutron.plugins.nicira import nvplib
from neutron.tests import base
@ -274,7 +274,7 @@ class NvpSyncTestCase(base.BaseTestCase):
return self.fc.fake_request(*args, **kwargs)
self.mock_nvpapi.return_value.request.side_effect = _fake_request
self.fake_cluster = nvp_cluster.NVPCluster(
self.fake_cluster = nsx_cluster.NSXCluster(
name='fake-cluster', nsx_controllers=['1.1.1.1:999'],
default_tz_uuid=_uuid(), nsx_user='foo', nsx_password='bar')
self.fake_cluster.api_client = NvpApiClient.NVPApiHelper(

View File

@ -25,7 +25,7 @@ from neutron.common import exceptions
from neutron.plugins.nicira.common import config # noqa
from neutron.plugins.nicira.common import exceptions as nvp_exc
from neutron.plugins.nicira.common import utils
from neutron.plugins.nicira import nvp_cluster
from neutron.plugins.nicira import nsx_cluster
from neutron.plugins.nicira import NvpApiClient
from neutron.plugins.nicira import nvplib
from neutron.tests import base
@ -55,7 +55,7 @@ class NvplibTestCase(base.BaseTestCase):
return self.fc.fake_request(*args, **kwargs)
instance.return_value.request.side_effect = _fake_request
self.fake_cluster = nvp_cluster.NVPCluster(
self.fake_cluster = nsx_cluster.NSXCluster(
name='fake-cluster', nsx_controllers=['1.1.1.1:999'],
default_tz_uuid=_uuid(), nsx_user='foo', nsx_password='bar')
self.fake_cluster.api_client = NvpApiClient.NVPApiHelper(
@ -121,7 +121,7 @@ class NvplibNegativeTests(base.BaseTestCase):
raise nvplib.NvpApiClient.NvpApiException
instance.return_value.request.side_effect = _faulty_request
self.fake_cluster = nvp_cluster.NVPCluster(
self.fake_cluster = nsx_cluster.NSXCluster(
name='fake-cluster', nsx_controllers=['1.1.1.1:999'],
default_tz_uuid=_uuid(), nsx_user='foo', nsx_password='bar')
self.fake_cluster.api_client = NvpApiClient.NVPApiHelper(

View File

@ -26,8 +26,8 @@ from neutron.openstack.common import uuidutils
from neutron.plugins.nicira.common import config # noqa
from neutron.plugins.nicira.common import exceptions
from neutron.plugins.nicira.common import sync
from neutron.plugins.nicira import nsx_cluster
from neutron.plugins.nicira.nsxlib import lsn as lsnlib
from neutron.plugins.nicira import nvp_cluster
from neutron.plugins.nicira import NvpApiClient as nvp_client
from neutron.tests import base
from neutron.tests.unit.nicira import get_fake_conf
@ -55,14 +55,14 @@ class NSXClusterTest(base.BaseTestCase):
'nsx_controllers': ['1.1.1.1:443']}
def test_create_cluster(self):
cluster = nvp_cluster.NVPCluster(**self.cluster_opts)
cluster = nsx_cluster.NSXCluster(**self.cluster_opts)
for (k, v) in self.cluster_opts.iteritems():
self.assertEqual(v, getattr(cluster, k))
def test_create_cluster_default_port(self):
opts = self.cluster_opts.copy()
opts['nsx_controllers'] = ['1.1.1.1']
cluster = nvp_cluster.NVPCluster(**opts)
cluster = nsx_cluster.NSXCluster(**opts)
for (k, v) in self.cluster_opts.iteritems():
self.assertEqual(v, getattr(cluster, k))
@ -70,7 +70,7 @@ class NSXClusterTest(base.BaseTestCase):
opts = self.cluster_opts.copy()
opts.pop('default_tz_uuid')
self.assertRaises(exceptions.NvpInvalidClusterConfiguration,
nvp_cluster.NVPCluster, **opts)
nsx_cluster.NSXCluster, **opts)
class ConfigurationTest(base.BaseTestCase):