From 79fbeb7ebebc0dfbe143aee96fbc250d1b9e7582 Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Thu, 2 Jan 2014 13:02:11 -0800 Subject: [PATCH] Rename nicira configuration elements to match new naming structure - Every config item prefixed with nvp is prefixed with nsx - deprecation qualifiers are added to preserve bw compatibility - nicira/nvp.ini is renamed to vmware/nsx.ini - symlink nicira/nvp.ini is created to point to vmware/nsx.ini - UT added to verify that nvp.ini and old config items can still parsed correctly; bw-compat will be dropped in Juno Partial-implements blueprint nicira-plugin-renaming Change-Id: I676b868e61064cc5ff17e2246e83ba5c5e4a3449 --- etc/neutron/plugins/nicira | 1 + .../{nicira/nvp.ini => vmware/nsx.ini} | 178 +++++++++--------- etc/neutron/plugins/vmware/nvp.ini | 1 + neutron/plugins/nicira/NeutronPlugin.py | 16 +- .../plugins/nicira/NeutronServicePlugin.py | 2 +- neutron/plugins/nicira/check_nsx_config.py | 16 +- neutron/plugins/nicira/common/__init__.py | 16 -- neutron/plugins/nicira/common/config.py | 54 ++++-- neutron/plugins/nicira/dhcp_meta/nvp.py | 23 ++- neutron/plugins/nicira/dhcp_meta/rpc.py | 10 +- neutron/plugins/nicira/dhcpmeta_modes.py | 6 +- neutron/plugins/nicira/nvp_cluster.py | 43 +---- ....agentless.test => nsx.ini.agentless.test} | 6 +- .../tests/unit/nicira/etc/nsx.ini.basic.test | 5 + .../tests/unit/nicira/etc/nsx.ini.full.test | 13 ++ .../nicira/etc/{nvp.ini.test => nsx.ini.test} | 6 +- .../tests/unit/nicira/etc/nvp.ini.basic.test | 5 - .../tests/unit/nicira/etc/nvp.ini.full.test | 8 +- .../tests/unit/nicira/test_agent_scheduler.py | 4 +- neutron/tests/unit/nicira/test_dhcpmeta.py | 16 +- neutron/tests/unit/nicira/test_maclearning.py | 4 +- .../tests/unit/nicira/test_nicira_plugin.py | 18 +- neutron/tests/unit/nicira/test_nvp_sync.py | 14 +- neutron/tests/unit/nicira/test_nvplib.py | 12 +- neutron/tests/unit/nicira/test_nvpopts.py | 109 +++++++---- setup.cfg | 1 + 26 files changed, 309 insertions(+), 278 deletions(-) create mode 120000 etc/neutron/plugins/nicira rename etc/neutron/plugins/{nicira/nvp.ini => vmware/nsx.ini} (89%) create mode 120000 etc/neutron/plugins/vmware/nvp.ini rename neutron/tests/unit/nicira/etc/{nvp.ini.agentless.test => nsx.ini.agentless.test} (82%) create mode 100644 neutron/tests/unit/nicira/etc/nsx.ini.basic.test create mode 100644 neutron/tests/unit/nicira/etc/nsx.ini.full.test rename neutron/tests/unit/nicira/etc/{nvp.ini.test => nsx.ini.test} (65%) delete mode 100644 neutron/tests/unit/nicira/etc/nvp.ini.basic.test diff --git a/etc/neutron/plugins/nicira b/etc/neutron/plugins/nicira new file mode 120000 index 000000000..6b0ed8df8 --- /dev/null +++ b/etc/neutron/plugins/nicira @@ -0,0 +1 @@ +vmware \ No newline at end of file diff --git a/etc/neutron/plugins/nicira/nvp.ini b/etc/neutron/plugins/vmware/nsx.ini similarity index 89% rename from etc/neutron/plugins/nicira/nvp.ini rename to etc/neutron/plugins/vmware/nsx.ini index 57cce39b2..f2b47a3ae 100644 --- a/etc/neutron/plugins/nicira/nvp.ini +++ b/etc/neutron/plugins/vmware/nsx.ini @@ -1,9 +1,9 @@ [DEFAULT] -# User name for NVP controller -# nvp_user = admin +# User name for NSX controller +# nsx_user = admin -# Password for NVP controller -# nvp_password = admin +# Password for NSX controller +# nsx_password = admin # Total time limit for a cluster request # (including retries across different controllers) @@ -18,11 +18,11 @@ # Maximum number of times a redirect response should be followed # redirects = 2 -# Comma-separated list of NVP controller endpoints (:). When port +# Comma-separated list of NSX controller endpoints (:). When port # is omitted, 443 is assumed. This option MUST be specified, e.g.: -# nvp_controllers = xx.yy.zz.ww:443, aa.bb.cc.dd, ee.ff.gg.hh.ee:80 +# nsx_controllers = xx.yy.zz.ww:443, aa.bb.cc.dd, ee.ff.gg.hh.ee:80 -# UUID of the pre-existing default NVP Transport zone to be used for creating +# UUID of the pre-existing default NSX Transport zone to be used for creating # tunneled isolated "Neutron" networks. This option MUST be specified, e.g.: # default_tz_uuid = 1e8e52cf-fa7f-46b0-a14a-f99835a9cb53 @@ -49,86 +49,6 @@ # number of network gateways allowed per tenant, -1 means unlimited # quota_network_gateway = 5 -[nvp] -# Maximum number of ports for each bridged logical switch -# The recommended value for this parameter varies with NVP version -# Please use: -# NVP 2.x -> 64 -# NVP 3.0, 3.1 -> 5000 -# NVP 3.2 -> 10000 -# max_lp_per_bridged_ls = 5000 - -# Maximum number of ports for each overlay (stt, gre) logical switch -# max_lp_per_overlay_ls = 256 - -# Number of connections to each controller node. -# default is 10 -# concurrent_connections = 10 - -# Number of seconds a generation id should be valid for (default -1 meaning do not time out) -# nvp_gen_timeout = -1 - -# Acceptable values for 'metadata_mode' are: -# - 'access_network': this enables a dedicated connection to the metadata -# proxy for metadata server access via Neutron router. -# - 'dhcp_host_route': this enables host route injection via the dhcp agent. -# This option is only useful if running on a host that does not support -# namespaces otherwise access_network should be used. -# metadata_mode = access_network - -# The default network transport type to use (stt, gre, bridge, ipsec_gre, or ipsec_stt) -# default_transport_type = stt - -# Specifies in which mode the plugin needs to operate in order to provide DHCP and -# metadata proxy services to tenant instances. If 'agent' is chosen (default) -# the NVP plugin relies on external RPC agents (i.e. dhcp and metadata agents) to -# provide such services. In this mode, the plugin supports API extensions 'agent' -# and 'dhcp_agent_scheduler'. If 'agentless' is chosen (experimental in Havana), -# the plugin will use NVP logical services for DHCP and metadata proxy. This -# simplifies the deployment model for Neutron, in that the plugin no longer requires -# the RPC agents to operate. When 'agentless' is chosen, the config option metadata_mode -# becomes ineffective. The mode 'agentless' is not supported for NVP 3.2 or below. -# agent_mode = agent - -[nvp_sync] -# Interval in seconds between runs of the status synchronization task. -# The plugin will aim at resynchronizing operational status for all -# resources in this interval, and it should be therefore large enough -# to ensure the task is feasible. Otherwise the plugin will be -# constantly synchronizing resource status, ie: a new task is started -# as soon as the previous is completed. -# If this value is set to 0, the state synchronization thread for this -# Neutron instance will be disabled. -# state_sync_interval = 120 - -# Random additional delay between two runs of the state synchronization task. -# An additional wait time between 0 and max_random_sync_delay seconds -# will be added on top of state_sync_interval. -# max_random_sync_delay = 0 - -# Minimum delay, in seconds, between two status synchronization requests for NVP. -# Depending on chunk size, controller load, and other factors, state -# synchronization requests might be pretty heavy. This means the -# controller might take time to respond, and its load might be quite -# increased by them. This parameter allows to specify a minimum -# interval between two subsequent requests. -# The value for this parameter must never exceed state_sync_interval. -# If this does, an error will be raised at startup. -# min_sync_req_delay = 10 - -# Minimum number of resources to be retrieved from NVP in a single status -# synchronization request. -# The actual size of the chunk will increase if the number of resources is such -# that using the minimum chunk size will cause the interval between two -# requests to be less than min_sync_req_delay -# min_chunk_size = 500 - -# Enable this option to allow punctual state synchronization on show -# operations. In this way, show operations will always fetch the operational -# status of the resource from the NVP backend, and this might have -# a considerable impact on overall performance. -# always_read_status = False - [vcns] # URL for VCNS manager # manager_uri = https://management_ip @@ -160,7 +80,87 @@ # default is 2000 (millisecond) # task_status_check_interval = 2000 -[nvp_dhcp] +[nsx] +# Maximum number of ports for each bridged logical switch +# The recommended value for this parameter varies with NSX version +# Please use: +# NSX 2.x -> 64 +# NSX 3.0, 3.1 -> 5000 +# NSX 3.2 -> 10000 +# max_lp_per_bridged_ls = 5000 + +# Maximum number of ports for each overlay (stt, gre) logical switch +# max_lp_per_overlay_ls = 256 + +# Number of connections to each controller node. +# default is 10 +# concurrent_connections = 10 + +# Number of seconds a generation id should be valid for (default -1 meaning do not time out) +# nsx_gen_timeout = -1 + +# Acceptable values for 'metadata_mode' are: +# - 'access_network': this enables a dedicated connection to the metadata +# proxy for metadata server access via Neutron router. +# - 'dhcp_host_route': this enables host route injection via the dhcp agent. +# This option is only useful if running on a host that does not support +# namespaces otherwise access_network should be used. +# metadata_mode = access_network + +# The default network transport type to use (stt, gre, bridge, ipsec_gre, or ipsec_stt) +# default_transport_type = stt + +# Specifies in which mode the plugin needs to operate in order to provide DHCP and +# metadata proxy services to tenant instances. If 'agent' is chosen (default) +# the NSX plugin relies on external RPC agents (i.e. dhcp and metadata agents) to +# provide such services. In this mode, the plugin supports API extensions 'agent' +# and 'dhcp_agent_scheduler'. If 'agentless' is chosen (experimental in Havana), +# the plugin will use NSX logical services for DHCP and metadata proxy. This +# simplifies the deployment model for Neutron, in that the plugin no longer requires +# the RPC agents to operate. When 'agentless' is chosen, the config option metadata_mode +# becomes ineffective. The mode 'agentless' is not supported for NSX 4.0 or below. +# agent_mode = agent + +[nsx_sync] +# Interval in seconds between runs of the status synchronization task. +# The plugin will aim at resynchronizing operational status for all +# resources in this interval, and it should be therefore large enough +# to ensure the task is feasible. Otherwise the plugin will be +# constantly synchronizing resource status, ie: a new task is started +# as soon as the previous is completed. +# If this value is set to 0, the state synchronization thread for this +# Neutron instance will be disabled. +# state_sync_interval = 120 + +# Random additional delay between two runs of the state synchronization task. +# An additional wait time between 0 and max_random_sync_delay seconds +# will be added on top of state_sync_interval. +# max_random_sync_delay = 0 + +# Minimum delay, in seconds, between two status synchronization requests for NSX. +# Depending on chunk size, controller load, and other factors, state +# synchronization requests might be pretty heavy. This means the +# controller might take time to respond, and its load might be quite +# increased by them. This parameter allows to specify a minimum +# interval between two subsequent requests. +# The value for this parameter must never exceed state_sync_interval. +# If this does, an error will be raised at startup. +# min_sync_req_delay = 10 + +# Minimum number of resources to be retrieved from NSX in a single status +# synchronization request. +# The actual size of the chunk will increase if the number of resources is such +# that using the minimum chunk size will cause the interval between two +# requests to be less than min_sync_req_delay +# min_chunk_size = 500 + +# Enable this option to allow punctual state synchronization on show +# operations. In this way, show operations will always fetch the operational +# status of the resource from the NSX backend, and this might have +# a considerable impact on overall performance. +# always_read_status = False + +[nsx_dhcp] # (Optional) Comma separated list of additional dns servers. Default is an empty list # extra_domain_name_servers = @@ -170,7 +170,7 @@ # Default DHCP lease time # default_lease_time = 43200 -[nvp_metadata] +[nsx_metadata] # IP address used by Metadata server # metadata_server_address = 127.0.0.1 diff --git a/etc/neutron/plugins/vmware/nvp.ini b/etc/neutron/plugins/vmware/nvp.ini new file mode 120000 index 000000000..b2ff094a7 --- /dev/null +++ b/etc/neutron/plugins/vmware/nvp.ini @@ -0,0 +1 @@ +nsx.ini \ No newline at end of file diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index d46c3cf27..671f6743d 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -99,22 +99,22 @@ class NetworkTypes: def create_nvp_cluster(cluster_opts, concurrent_connections, - nvp_gen_timeout): + 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.nvp_controllers] + for ctrl in cluster.nsx_controllers] cluster.api_client = NvpApiClient.NVPApiHelper( - api_providers, cluster.nvp_user, cluster.nvp_password, + 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=nvp_gen_timeout) + nvp_gen_timeout=nsx_gen_timeout) return cluster @@ -191,11 +191,11 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin, } neutron_extensions.append_api_extensions_path([NVP_EXT_PATH]) - self.nvp_opts = cfg.CONF.NVP - self.nvp_sync_opts = cfg.CONF.NVP_SYNC + 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.nvp_gen_timeout) + self.nvp_opts.nsx_gen_timeout) self.base_binding_dict = { pbin.VIF_TYPE: pbin.VIF_TYPE_OVS, @@ -872,7 +872,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin, if (network and not attr.is_attr_set( network.get(mpnet.SEGMENTS))): return [{"zone_uuid": cluster.default_tz_uuid, - "transport_type": cfg.CONF.NVP.default_transport_type}] + "transport_type": cfg.CONF.NSX.default_transport_type}] # Convert fields from db to nvp format if bindings: diff --git a/neutron/plugins/nicira/NeutronServicePlugin.py b/neutron/plugins/nicira/NeutronServicePlugin.py index 5930e4c01..297b752e5 100644 --- a/neutron/plugins/nicira/NeutronServicePlugin.py +++ b/neutron/plugins/nicira/NeutronServicePlugin.py @@ -401,7 +401,7 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin, # use defautl transport zone transport_zone_config = [{ "zone_uuid": self.cluster.default_tz_uuid, - "transport_type": cfg.CONF.NVP.default_transport_type + "transport_type": cfg.CONF.NSX.default_transport_type }] return self.vcns_driver.create_lswitch(name, transport_zone_config) diff --git a/neutron/plugins/nicira/check_nsx_config.py b/neutron/plugins/nicira/check_nsx_config.py index 2b69131b3..31bb0a992 100644 --- a/neutron/plugins/nicira/check_nsx_config.py +++ b/neutron/plugins/nicira/check_nsx_config.py @@ -22,7 +22,7 @@ import sys from oslo.config import cfg from neutron.common import config -from neutron.plugins.nicira.common import config as nvp_cfg # noqa +from neutron.plugins.nicira.common import config as nsx_config # noqa from neutron.plugins.nicira import NeutronPlugin from neutron.plugins.nicira import nvplib @@ -35,7 +35,7 @@ def help(name): def get_nsx_controllers(cluster): - return cluster.nvp_controllers + return cluster.nsx_controllers def config_helper(config_entity, cluster): @@ -79,11 +79,11 @@ def main(): print("\tretry_interval: %d" % cfg.CONF.database.retry_interval) print("\tmax_retries: %d" % cfg.CONF.database.max_retries) print("----------------------- NSX Options -----------------------") - print("\tNSX Generation Timeout %d" % cfg.CONF.NVP.nvp_gen_timeout) + print("\tNSX Generation Timeout %d" % cfg.CONF.NSX.nsx_gen_timeout) print("\tNumber of concurrent connections to each controller %d" % - cfg.CONF.NVP.concurrent_connections) - print("\tmax_lp_per_bridged_ls: %s" % cfg.CONF.NVP.max_lp_per_bridged_ls) - print("\tmax_lp_per_overlay_ls: %s" % cfg.CONF.NVP.max_lp_per_overlay_ls) + cfg.CONF.NSX.concurrent_connections) + print("\tmax_lp_per_bridged_ls: %s" % cfg.CONF.NSX.max_lp_per_bridged_ls) + print("\tmax_lp_per_overlay_ls: %s" % cfg.CONF.NSX.max_lp_per_overlay_ls) print("----------------------- Cluster Options -----------------------") print("\trequested_timeout: %s" % cfg.CONF.req_timeout) print("\tretries: %s" % cfg.CONF.retries) @@ -91,8 +91,8 @@ def main(): print("\thttp_timeout: %s" % cfg.CONF.http_timeout) cluster = NeutronPlugin.create_nvp_cluster( cfg.CONF, - cfg.CONF.NVP.concurrent_connections, - cfg.CONF.NVP.nvp_gen_timeout) + cfg.CONF.NSX.concurrent_connections, + cfg.CONF.NSX.nsx_gen_timeout) nsx_controllers = get_nsx_controllers(cluster) num_controllers = len(nsx_controllers) print("Number of controllers found: %s" % num_controllers) diff --git a/neutron/plugins/nicira/common/__init__.py b/neutron/plugins/nicira/common/__init__.py index 07dd0007e..e69de29bb 100644 --- a/neutron/plugins/nicira/common/__init__.py +++ b/neutron/plugins/nicira/common/__init__.py @@ -1,16 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 Nicira Networks, 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 -# 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. diff --git a/neutron/plugins/nicira/common/config.py b/neutron/plugins/nicira/common/config.py index 12306b030..41c3c0679 100644 --- a/neutron/plugins/nicira/common/config.py +++ b/neutron/plugins/nicira/common/config.py @@ -1,6 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright 2012 Nicira, Inc. +# Copyright 2012 VMware, Inc. # # 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 @@ -29,20 +29,26 @@ class MetadataModes: INDIRECT = 'dhcp_host_route' -nvp_opts = [ +base_opts = [ cfg.IntOpt('max_lp_per_bridged_ls', default=5000, + deprecated_group='NVP', help=_("Maximum number of ports of a logical switch on a " "bridged transport zone (default 5000)")), cfg.IntOpt('max_lp_per_overlay_ls', default=256, + deprecated_group='NVP', help=_("Maximum number of ports of a logical switch on an " "overlay transport zone (default 256)")), cfg.IntOpt('concurrent_connections', default=10, - help=_("Maximum concurrent connections to each NVP " + deprecated_group='NVP', + help=_("Maximum concurrent connections to each NSX " "controller.")), - cfg.IntOpt('nvp_gen_timeout', default=-1, + cfg.IntOpt('nsx_gen_timeout', default=-1, + deprecated_name='nvp_gen_timeout', + deprecated_group='NVP', help=_("Number of seconds a generation id should be valid for " "(default -1 meaning do not time out)")), cfg.StrOpt('metadata_mode', default=MetadataModes.DIRECT, + deprecated_group='NVP', help=_("If set to access_network this enables a dedicated " "connection to the metadata proxy for metadata server " "access via Neutron router. If set to dhcp_host_route " @@ -51,41 +57,50 @@ nvp_opts = [ "does not support namespaces otherwise access_network " "should be used.")), cfg.StrOpt('default_transport_type', default='stt', + deprecated_group='NVP', help=_("The default network tranport type to use (stt, gre, " "bridge, ipsec_gre, or ipsec_stt)")), cfg.StrOpt('agent_mode', default=AgentModes.AGENT, + deprecated_group='NVP', help=_("The mode used to implement DHCP/metadata services.")) ] sync_opts = [ cfg.IntOpt('state_sync_interval', default=120, + deprecated_group='NVP_SYNC', help=_("Interval in seconds between runs of the state " "synchronization task. Set it to 0 to disable it")), cfg.IntOpt('max_random_sync_delay', default=0, + deprecated_group='NVP_SYNC', help=_("Maximum value for the additional random " "delay in seconds between runs of the state " "synchronization task")), cfg.IntOpt('min_sync_req_delay', default=10, + deprecated_group='NVP_SYNC', help=_('Minimum delay, in seconds, between two state ' - 'synchronization queries to NVP. It must not ' + 'synchronization queries to NSX. It must not ' 'exceed state_sync_interval')), cfg.IntOpt('min_chunk_size', default=500, - help=_('Minimum number of resources to be retrieved from NVP ' + deprecated_group='NVP_SYNC', + help=_('Minimum number of resources to be retrieved from NSX ' 'during state synchronization')), cfg.BoolOpt('always_read_status', default=False, + deprecated_group='NVP_SYNC', help=_('Always read operational status from backend on show ' 'operations. Enabling this option might slow down ' 'the system.')) ] connection_opts = [ - cfg.StrOpt('nvp_user', + cfg.StrOpt('nsx_user', default='admin', - help=_('User name for NVP controllers in this cluster')), - cfg.StrOpt('nvp_password', + deprecated_name='nvp_user', + help=_('User name for NSX controllers in this cluster')), + cfg.StrOpt('nsx_password', default='admin', + deprecated_name='nvp_password', secret=True, - help=_('Password for NVP controllers in this cluster')), + help=_('Password for NSX controllers in this cluster')), cfg.IntOpt('req_timeout', default=30, help=_('Total time limit for a cluster request')), @@ -98,22 +113,23 @@ connection_opts = [ cfg.IntOpt('redirects', default=2, help=_('Number of times a redirect should be followed')), - cfg.ListOpt('nvp_controllers', - help=_("Lists the NVP controllers in this cluster")), + cfg.ListOpt('nsx_controllers', + deprecated_name='nvp_controllers', + help=_("Lists the NSX controllers in this cluster")), ] cluster_opts = [ cfg.StrOpt('default_tz_uuid', - help=_("This is uuid of the default NVP Transport zone that " + help=_("This is uuid of the default NSX Transport zone that " "will be used for creating tunneled isolated " - "\"Neutron\" networks. It needs to be created in NVP " - "before starting Neutron with the nvp plugin.")), + "\"Neutron\" networks. It needs to be created in NSX " + "before starting Neutron with the nsx plugin.")), cfg.StrOpt('default_l3_gw_service_uuid', - help=_("Unique identifier of the NVP L3 Gateway service " + help=_("Unique identifier of the NSX L3 Gateway service " "which will be used for implementing routers and " "floating IPs")), cfg.StrOpt('default_l2_gw_service_uuid', - help=_("Unique identifier of the NVP L2 Gateway service " + help=_("Unique identifier of the NSX L2 Gateway service " "which will be used by default for network gateways")), cfg.StrOpt('default_service_cluster_uuid', help=_("Unique identifier of the Service Cluster which will " @@ -158,6 +174,6 @@ vcns_opts = [ # Register the configuration options cfg.CONF.register_opts(connection_opts) cfg.CONF.register_opts(cluster_opts) -cfg.CONF.register_opts(nvp_opts, "NVP") -cfg.CONF.register_opts(sync_opts, "NVP_SYNC") cfg.CONF.register_opts(vcns_opts, group="vcns") +cfg.CONF.register_opts(base_opts, group="NSX") +cfg.CONF.register_opts(sync_opts, group="NSX_SYNC") diff --git a/neutron/plugins/nicira/dhcp_meta/nvp.py b/neutron/plugins/nicira/dhcp_meta/nvp.py index 15ffe8127..574a65218 100644 --- a/neutron/plugins/nicira/dhcp_meta/nvp.py +++ b/neutron/plugins/nicira/dhcp_meta/nvp.py @@ -45,24 +45,31 @@ SPECIAL_OWNERS = (const.DEVICE_OWNER_DHCP, dhcp_opts = [ cfg.ListOpt('extra_domain_name_servers', + deprecated_group='NVP_DHCP', default=[], help=_('Comma separated list of additional ' 'domain name servers')), cfg.StrOpt('domain_name', + deprecated_group='NVP_DHCP', default='openstacklocal', help=_('Domain to use for building the hostnames')), cfg.IntOpt('default_lease_time', default=43200, + deprecated_group='NVP_DHCP', help=_("Default DHCP lease time")), ] metadata_opts = [ - cfg.StrOpt('metadata_server_address', default='127.0.0.1', + cfg.StrOpt('metadata_server_address', + deprecated_group='NVP_METADATA', + default='127.0.0.1', help=_("IP address used by Metadata server.")), cfg.IntOpt('metadata_server_port', + deprecated_group='NVP_METADATA', default=8775, help=_("TCP Port used by Metadata server.")), cfg.StrOpt('metadata_shared_secret', + deprecated_group='NVP_METADATA', default='', help=_('Shared secret to sign instance-id request'), secret=True) @@ -70,11 +77,11 @@ metadata_opts = [ def register_dhcp_opts(config): - config.CONF.register_opts(dhcp_opts, "NVP_DHCP") + config.CONF.register_opts(dhcp_opts, group="NSX_DHCP") def register_metadata_opts(config): - config.CONF.register_opts(metadata_opts, "NVP_METADATA") + config.CONF.register_opts(metadata_opts, group="NSX_METADATA") class LsnManager(object): @@ -268,10 +275,10 @@ class LsnManager(object): """Enable/disable dhcp services with the given config options.""" is_enabled = subnet["enable_dhcp"] dhcp_options = { - "domain_name": cfg.CONF.NVP_DHCP.domain_name, - "default_lease_time": cfg.CONF.NVP_DHCP.default_lease_time, + "domain_name": cfg.CONF.NSX_DHCP.domain_name, + "default_lease_time": cfg.CONF.NSX_DHCP.default_lease_time, } - dns_servers = cfg.CONF.NVP_DHCP.extra_domain_name_servers + dns_servers = cfg.CONF.NSX_DHCP.extra_domain_name_servers dns_servers.extend(subnet["dns_nameservers"]) if subnet['gateway_ip']: dhcp_options["routers"] = subnet["gateway_ip"] @@ -295,7 +302,7 @@ class LsnManager(object): """Configure metadata service for the specified subnet.""" subnet = self.plugin.get_subnet(context, subnet_id) network_id = subnet['network_id'] - meta_conf = cfg.CONF.NVP_METADATA + meta_conf = cfg.CONF.NSX_METADATA metadata_options = { 'metadata_server_ip': meta_conf.metadata_server_address, 'metadata_server_port': meta_conf.metadata_server_port, @@ -492,7 +499,7 @@ def is_user_port(p, check_dev_id=False): def check_services_requirements(cluster): ver = cluster.api_client.get_nvp_version() - # It sounds like 4.1 is the first one where DHCP in NSX/NVP + # It sounds like 4.1 is the first one where DHCP in NSX # will have the experimental feature if ver.major >= 4 and ver.minor >= 1: cluster_id = cfg.CONF.default_service_cluster_uuid diff --git a/neutron/plugins/nicira/dhcp_meta/rpc.py b/neutron/plugins/nicira/dhcp_meta/rpc.py index dd1375348..bfb5181e3 100644 --- a/neutron/plugins/nicira/dhcp_meta/rpc.py +++ b/neutron/plugins/nicira/dhcp_meta/rpc.py @@ -71,7 +71,7 @@ def handle_port_dhcp_access(plugin, context, port_data, action): net = plugin.get_network(context, port_data['network_id']) plugin.schedule_network(context, net) - active_port = (cfg.CONF.NVP.metadata_mode == config.MetadataModes.INDIRECT + active_port = (cfg.CONF.NSX.metadata_mode == config.MetadataModes.INDIRECT and port_data.get('device_owner') == const.DEVICE_OWNER_DHCP and port_data.get('fixed_ips', [])) if active_port: @@ -81,7 +81,7 @@ def handle_port_dhcp_access(plugin, context, port_data, action): def handle_port_metadata_access(plugin, context, port, is_delete=False): - if (cfg.CONF.NVP.metadata_mode == config.MetadataModes.INDIRECT and + if (cfg.CONF.NSX.metadata_mode == config.MetadataModes.INDIRECT and port.get('device_owner') == const.DEVICE_OWNER_DHCP): if port.get('fixed_ips', []) or is_delete: fixed_ip = port['fixed_ips'][0] @@ -113,7 +113,7 @@ def handle_port_metadata_access(plugin, context, port, is_delete=False): def handle_router_metadata_access(plugin, context, router_id, interface=None): - if cfg.CONF.NVP.metadata_mode != config.MetadataModes.DIRECT: + if cfg.CONF.NSX.metadata_mode != config.MetadataModes.DIRECT: LOG.debug(_("Metadata access network is disabled")) return if not cfg.CONF.allow_overlapping_ips: @@ -141,7 +141,7 @@ def handle_router_metadata_access(plugin, context, router_id, interface=None): "No metadata access network should be " "created or destroyed"), router_id) # TODO(salvatore-orlando): A better exception handling in the - # NVP plugin would allow us to improve error handling here + # NSX plugin would allow us to improve error handling here except (ntn_exc.NeutronException, nvp_exc.NvpPluginException, NvpApiClient.NvpApiException): # Any exception here should be regarded as non-fatal @@ -161,7 +161,7 @@ def _find_metadata_port(plugin, context, ports): def _create_metadata_access_network(plugin, context, router_id): # Add network - # Network name is likely to be truncated on NVP + # Network name is likely to be truncated on NSX net_data = {'name': 'meta-%s' % router_id, 'tenant_id': '', # intentionally not set 'admin_state_up': True, diff --git a/neutron/plugins/nicira/dhcpmeta_modes.py b/neutron/plugins/nicira/dhcpmeta_modes.py index 8a857fdaa..030eeb2ef 100644 --- a/neutron/plugins/nicira/dhcpmeta_modes.py +++ b/neutron/plugins/nicira/dhcpmeta_modes.py @@ -36,10 +36,10 @@ class DhcpMetadataAccess(object): def setup_dhcpmeta_access(self): """Initialize support for DHCP and Metadata services.""" - if cfg.CONF.NVP.agent_mode == config.AgentModes.AGENT: + if cfg.CONF.NSX.agent_mode == config.AgentModes.AGENT: self._setup_rpc_dhcp_metadata() mod = nvp_rpc - elif cfg.CONF.NVP.agent_mode == config.AgentModes.AGENTLESS: + elif cfg.CONF.NSX.agent_mode == config.AgentModes.AGENTLESS: self._setup_nvp_dhcp_metadata() mod = nvp_svc self.handle_network_dhcp_access_delegate = ( @@ -90,7 +90,7 @@ class DhcpMetadataAccess(object): error = None nvp_svc.check_services_requirements(self.cluster) except nvp_exc.NvpInvalidVersion: - error = _("Unable to run Neutron with config option '%s', as NVP " + error = _("Unable to run Neutron with config option '%s', as NSX " "does not support it") % config.AgentModes.AGENTLESS except nvp_exc.ServiceClusterUnavailable: error = _("Unmet dependency for config option " diff --git a/neutron/plugins/nicira/nvp_cluster.py b/neutron/plugins/nicira/nvp_cluster.py index 7d570d974..d3753bbdc 100644 --- a/neutron/plugins/nicira/nvp_cluster.py +++ b/neutron/plugins/nicira/nvp_cluster.py @@ -26,13 +26,13 @@ from neutron.plugins.nicira.common import exceptions LOG = logging.getLogger(__name__) DEFAULT_PORT = 443 # Raise if one of those attributes is not specified -REQUIRED_ATTRIBUTES = ['default_tz_uuid', 'nvp_user', - 'nvp_password', 'nvp_controllers'] +REQUIRED_ATTRIBUTES = ['default_tz_uuid', 'nsx_user', + 'nsx_password', 'nsx_controllers'] # Emit a INFO log if one of those attributes is not specified IMPORTANT_ATTRIBUTES = ['default_l3_gw_service_uuid'] # Deprecated attributes DEPRECATED_ATTRIBUTES = ['metadata_dhcp_host_route', - 'nvp_controller_connection'] + 'nvp_user', 'nvp_password', 'nvp_controllers'] class NVPCluster(object): @@ -93,38 +93,13 @@ class NVPCluster(object): else: LOG.debug(_("Attribute:%s is empty or null"), attribute) - def _process_nvp_controllers(self): + def _process_nsx_controllers(self): # If this raises something is not right, so let it bubble up # TODO(salvatore-orlando): Also validate attribute here - for i, ctrl in enumerate(self.nvp_controllers or []): + for i, ctrl in enumerate(self.nsx_controllers or []): if len(ctrl.split(':')) == 1: - self.nvp_controllers[i] = '%s:%s' % (ctrl, DEFAULT_PORT) + self.nsx_controllers[i] = '%s:%s' % (ctrl, DEFAULT_PORT) - def _process_nvp_controller_connection(self, connections): - - def parse_conn_str(ip, port, user, password, req_timeout, - http_timeout, retries, redirects): - # TODO(salvatore-orlando): Set the attributes only - # if correspondent non-deprecated options have been - # explicitly specified in the ini file - # TODO(salvatore-orlando): Validate data to avoid ugly ValueError - self.nvp_user = user - self._process_attribute('nvp_user') - self.nvp_password = password - self._process_attribute('nvp_password') - self.req_timeout = int(req_timeout) - self._process_attribute('req_timeout') - self.http_timeout = int(http_timeout) - self._process_attribute('http_timeout') - self.retries = int(retries) - self._process_attribute('retries') - self.redirects = int(redirects) - self._process_attribute('redirects') - try: - nvp_controllers = getattr(self, 'nvp_controllers') - nvp_controllers.append('%s:%s' % (ip, port)) - except AttributeError: - self.nvp_controllers = ['%s:%s' % (ip, port)] - self._process_attribute('nvp_controllers') - for conn in connections: - parse_conn_str(*conn.split(':')) + def _process_nvp_controllers(self): + self.nsx_controllers = self.nvp_controllers + self._process_nsx_controllers() diff --git a/neutron/tests/unit/nicira/etc/nvp.ini.agentless.test b/neutron/tests/unit/nicira/etc/nsx.ini.agentless.test similarity index 82% rename from neutron/tests/unit/nicira/etc/nvp.ini.agentless.test rename to neutron/tests/unit/nicira/etc/nsx.ini.agentless.test index f1c25f4f3..7df03a8da 100644 --- a/neutron/tests/unit/nicira/etc/nvp.ini.agentless.test +++ b/neutron/tests/unit/nicira/etc/nsx.ini.agentless.test @@ -1,9 +1,9 @@ [DEFAULT] default_tz_uuid = fake_tz_uuid nova_zone_id = whatever -nvp_controllers = fake_1, fake_2 -nvp_user = foo -nvp_password = bar +nsx_controllers = fake_1, fake_2 +nsx_user = foo +nsx_password = bar default_l3_gw_service_uuid = whatever default_l2_gw_service_uuid = whatever default_service_cluster_uuid = whatever diff --git a/neutron/tests/unit/nicira/etc/nsx.ini.basic.test b/neutron/tests/unit/nicira/etc/nsx.ini.basic.test new file mode 100644 index 000000000..c8fb9886e --- /dev/null +++ b/neutron/tests/unit/nicira/etc/nsx.ini.basic.test @@ -0,0 +1,5 @@ +[DEFAULT] +default_tz_uuid = fake_tz_uuid +nsx_controllers=fake_1,fake_2 +nsx_user=foo +nsx_password=bar diff --git a/neutron/tests/unit/nicira/etc/nsx.ini.full.test b/neutron/tests/unit/nicira/etc/nsx.ini.full.test new file mode 100644 index 000000000..7ca29bd42 --- /dev/null +++ b/neutron/tests/unit/nicira/etc/nsx.ini.full.test @@ -0,0 +1,13 @@ +[DEFAULT] +default_tz_uuid = fake_tz_uuid +nova_zone_id = whatever +nsx_controllers = fake_1, fake_2 +nsx_user = foo +nsx_password = bar +default_l3_gw_service_uuid = whatever +default_l2_gw_service_uuid = whatever +default_interface_name = whatever +req_timeout = 14 +http_timeout = 13 +redirects = 12 +retries = 11 diff --git a/neutron/tests/unit/nicira/etc/nvp.ini.test b/neutron/tests/unit/nicira/etc/nsx.ini.test similarity index 65% rename from neutron/tests/unit/nicira/etc/nvp.ini.test rename to neutron/tests/unit/nicira/etc/nsx.ini.test index f59b71f45..1bb959be3 100644 --- a/neutron/tests/unit/nicira/etc/nvp.ini.test +++ b/neutron/tests/unit/nicira/etc/nsx.ini.test @@ -1,7 +1,7 @@ [DEFAULT] default_tz_uuid = fake_tz_uuid -nvp_controllers=fake_1, fake_2 -nvp_user=foo -nvp_password=bar +nsx_controllers=fake_1, fake_2 +nsx_user=foo +nsx_password=bar default_l3_gw_service_uuid = whatever default_l2_gw_service_uuid = whatever diff --git a/neutron/tests/unit/nicira/etc/nvp.ini.basic.test b/neutron/tests/unit/nicira/etc/nvp.ini.basic.test deleted file mode 100644 index b9daa5045..000000000 --- a/neutron/tests/unit/nicira/etc/nvp.ini.basic.test +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -default_tz_uuid = fake_tz_uuid -nvp_controllers=fake_1,fake_2 -nvp_user=foo -nvp_password=bar diff --git a/neutron/tests/unit/nicira/etc/nvp.ini.full.test b/neutron/tests/unit/nicira/etc/nvp.ini.full.test index b856b2af6..500cc0eed 100644 --- a/neutron/tests/unit/nicira/etc/nvp.ini.full.test +++ b/neutron/tests/unit/nicira/etc/nvp.ini.full.test @@ -7,7 +7,7 @@ nvp_password = bar default_l3_gw_service_uuid = whatever default_l2_gw_service_uuid = whatever default_interface_name = whatever -req_timeout = 14 -http_timeout = 13 -redirects = 12 -retries = 11 +req_timeout = 4 +http_timeout = 3 +redirects = 2 +retries = 2 diff --git a/neutron/tests/unit/nicira/test_agent_scheduler.py b/neutron/tests/unit/nicira/test_agent_scheduler.py index 99ba313a1..258533ea1 100644 --- a/neutron/tests/unit/nicira/test_agent_scheduler.py +++ b/neutron/tests/unit/nicira/test_agent_scheduler.py @@ -34,7 +34,7 @@ class NVPDhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase): def setUp(self): test_config['plugin_name_v2'] = PLUGIN_NAME - test_config['config_files'] = [get_fake_conf('nvp.ini.full.test')] + test_config['config_files'] = [get_fake_conf('nsx.ini.full.test')] # mock nvp api client self.fc = fake_nvpapiclient.FakeClient(STUBS_PATH) @@ -82,7 +82,7 @@ class NVPDhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase): return host_calls def _test_gateway_subnet_notification(self, gateway='10.0.0.1'): - cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NVP') + cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NSX') hosts = ['hosta'] [mock_dhcp, net, subnet, port] = self._network_port_create( hosts, gateway=gateway, owner=constants.DEVICE_OWNER_DHCP) diff --git a/neutron/tests/unit/nicira/test_dhcpmeta.py b/neutron/tests/unit/nicira/test_dhcpmeta.py index a3e116cf6..5c9cd9407 100644 --- a/neutron/tests/unit/nicira/test_dhcpmeta.py +++ b/neutron/tests/unit/nicira/test_dhcpmeta.py @@ -261,32 +261,32 @@ class LsnManagerTestCase(base.BaseTestCase): def test_lsn_port_dhcp_configure(self): expected = { 'routers': '127.0.0.1', - 'default_lease_time': cfg.CONF.NVP_DHCP.default_lease_time, - 'domain_name': cfg.CONF.NVP_DHCP.domain_name + 'default_lease_time': cfg.CONF.NSX_DHCP.default_lease_time, + 'domain_name': cfg.CONF.NSX_DHCP.domain_name } self._test_lsn_port_dhcp_configure_with_subnet( expected, dns=[], gw='127.0.0.1', routes=[]) def test_lsn_port_dhcp_configure_gatewayless(self): expected = { - 'default_lease_time': cfg.CONF.NVP_DHCP.default_lease_time, - 'domain_name': cfg.CONF.NVP_DHCP.domain_name + 'default_lease_time': cfg.CONF.NSX_DHCP.default_lease_time, + 'domain_name': cfg.CONF.NSX_DHCP.domain_name } self._test_lsn_port_dhcp_configure_with_subnet(expected, gw=None) def test_lsn_port_dhcp_configure_with_extra_dns_servers(self): expected = { - 'default_lease_time': cfg.CONF.NVP_DHCP.default_lease_time, + 'default_lease_time': cfg.CONF.NSX_DHCP.default_lease_time, 'domain_name_servers': '8.8.8.8,9.9.9.9', - 'domain_name': cfg.CONF.NVP_DHCP.domain_name + 'domain_name': cfg.CONF.NSX_DHCP.domain_name } self._test_lsn_port_dhcp_configure_with_subnet( expected, dns=['8.8.8.8', '9.9.9.9']) def test_lsn_port_dhcp_configure_with_host_routes(self): expected = { - 'default_lease_time': cfg.CONF.NVP_DHCP.default_lease_time, - 'domain_name': cfg.CONF.NVP_DHCP.domain_name, + 'default_lease_time': cfg.CONF.NSX_DHCP.default_lease_time, + 'domain_name': cfg.CONF.NSX_DHCP.domain_name, 'classless_static_routes': '8.8.8.8,9.9.9.9' } self._test_lsn_port_dhcp_configure_with_subnet( diff --git a/neutron/tests/unit/nicira/test_maclearning.py b/neutron/tests/unit/nicira/test_maclearning.py index 2df2e7419..a97a2d7ca 100644 --- a/neutron/tests/unit/nicira/test_maclearning.py +++ b/neutron/tests/unit/nicira/test_maclearning.py @@ -58,7 +58,7 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): def setUp(self): self.adminContext = context.get_admin_context() - test_config['config_files'] = [get_fake_conf('nvp.ini.full.test')] + test_config['config_files'] = [get_fake_conf('nsx.ini.full.test')] test_config['plugin_name_v2'] = PLUGIN_NAME cfg.CONF.set_override('api_extensions_path', NVPEXT_PATH) # Save the original RESOURCE_ATTRIBUTE_MAP @@ -81,7 +81,7 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): # Emulate tests against NVP 2.x instance.return_value.get_nvp_version.return_value = NVPVersion("3.0") instance.return_value.request.side_effect = _fake_request - cfg.CONF.set_override('metadata_mode', None, 'NVP') + cfg.CONF.set_override('metadata_mode', None, 'NSX') self.addCleanup(self.fc.reset_all) self.addCleanup(self.mock_nvpapi.stop) self.addCleanup(patch_sync.stop) diff --git a/neutron/tests/unit/nicira/test_nicira_plugin.py b/neutron/tests/unit/nicira/test_nicira_plugin.py index bccd9aaee..544cbd586 100644 --- a/neutron/tests/unit/nicira/test_nicira_plugin.py +++ b/neutron/tests/unit/nicira/test_nicira_plugin.py @@ -103,7 +103,7 @@ class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): plugin=PLUGIN_NAME, ext_mgr=None, service_plugins=None): - test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')] + 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) @@ -122,7 +122,7 @@ class NiciraPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): plugin = plugin or PLUGIN_NAME super(NiciraPluginV2TestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr) - cfg.CONF.set_override('metadata_mode', None, 'NVP') + cfg.CONF.set_override('metadata_mode', None, 'NSX') self.addCleanup(self.fc.reset_all) self.addCleanup(mock.patch.stopall) @@ -172,7 +172,7 @@ class TestNiciraPortsV2(NiciraPluginV2TestCase, HAS_PORT_FILTER = True def test_exhaust_ports_overlay_network(self): - cfg.CONF.set_override('max_lp_per_overlay_ls', 1, group='NVP') + cfg.CONF.set_override('max_lp_per_overlay_ls', 1, group='NSX') with self.network(name='testnet', arg_list=(pnet.NETWORK_TYPE, pnet.PHYSICAL_NETWORK, @@ -183,7 +183,7 @@ class TestNiciraPortsV2(NiciraPluginV2TestCase, self._create_port('json', net['network']['id'], 400) def test_exhaust_ports_bridged_network(self): - cfg.CONF.set_override('max_lp_per_bridged_ls', 1, group="NVP") + cfg.CONF.set_override('max_lp_per_bridged_ls', 1, group="NSX") providernet_args = {pnet.NETWORK_TYPE: 'flat', pnet.PHYSICAL_NETWORK: 'tzuuid'} with self.network(name='testnet', @@ -375,7 +375,7 @@ class TestNiciraNetworksV2(test_plugin.TestNetworksV2, class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase): def setUp(self): - test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')] + 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) @@ -408,7 +408,7 @@ class TestNiciraAllowedAddressPairs(test_addr_pair.TestAllowedAddressPairs, class NiciraSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase): def setUp(self): - test_lib.test_config['config_files'] = [get_fake_conf('nvp.ini.test')] + 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) @@ -747,10 +747,10 @@ class TestNiciraL3NatTestCase(NiciraL3NatTest, self._test_floatingip_with_invalid_create_port(self._plugin_name) def _nvp_metadata_setup(self): - cfg.CONF.set_override('metadata_mode', 'access_network', 'NVP') + cfg.CONF.set_override('metadata_mode', 'access_network', 'NSX') def _nvp_metadata_teardown(self): - cfg.CONF.set_override('metadata_mode', None, 'NVP') + cfg.CONF.set_override('metadata_mode', None, 'NSX') def test_create_router_name_exceeds_40_chars(self): name = 'this_is_a_router_whose_name_is_longer_than_40_chars' @@ -942,7 +942,7 @@ class TestNiciraL3NatTestCase(NiciraL3NatTest, self._nvp_metadata_teardown() def test_metadata_dhcp_host_route(self): - cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NVP') + cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NSX') subnets = self._list('subnets')['subnets'] with self.subnet() as s: with self.port(subnet=s, device_id='1234', diff --git a/neutron/tests/unit/nicira/test_nvp_sync.py b/neutron/tests/unit/nicira/test_nvp_sync.py index c0adfd3fb..39a70b4c8 100644 --- a/neutron/tests/unit/nicira/test_nvp_sync.py +++ b/neutron/tests/unit/nicira/test_nvp_sync.py @@ -275,17 +275,17 @@ class NvpSyncTestCase(base.BaseTestCase): self.mock_nvpapi.return_value.request.side_effect = _fake_request self.fake_cluster = nvp_cluster.NVPCluster( - name='fake-cluster', nvp_controllers=['1.1.1.1:999'], - default_tz_uuid=_uuid(), nvp_user='foo', nvp_password='bar') + 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( ('1.1.1.1', '999', True), - self.fake_cluster.nvp_user, self.fake_cluster.nvp_password, + self.fake_cluster.nsx_user, self.fake_cluster.nsx_password, self.fake_cluster.req_timeout, self.fake_cluster.http_timeout, self.fake_cluster.retries, self.fake_cluster.redirects) # Instantiate Neutron plugin # and setup needed config variables args = ['--config-file', get_fake_conf('neutron.conf.test'), - '--config-file', get_fake_conf('nvp.ini.test')] + '--config-file', get_fake_conf('nsx.ini.test')] config.parse(args=args) cfg.CONF.set_override('allow_overlapping_ips', True) self._plugin = NeutronPlugin.NvpPluginV2() @@ -554,7 +554,7 @@ class NvpSyncTestCase(base.BaseTestCase): self.assertEqual(exp_status, q_net['status']) def test_synchronize_network_on_get(self): - cfg.CONF.set_override('always_read_status', True, 'NVP_SYNC') + cfg.CONF.set_override('always_read_status', True, 'NSX_SYNC') ctx = context.get_admin_context() with self._populate_data(ctx): # Put a network down to verify punctual synchronization @@ -583,7 +583,7 @@ class NvpSyncTestCase(base.BaseTestCase): self.assertEqual(exp_status, q_port['status']) def test_synchronize_port_on_get(self): - cfg.CONF.set_override('always_read_status', True, 'NVP_SYNC') + cfg.CONF.set_override('always_read_status', True, 'NSX_SYNC') ctx = context.get_admin_context() with self._populate_data(ctx): # Put a port down to verify punctual synchronization @@ -613,7 +613,7 @@ class NvpSyncTestCase(base.BaseTestCase): self.assertEqual(exp_status, q_rtr['status']) def test_synchronize_router_on_get(self): - cfg.CONF.set_override('always_read_status', True, 'NVP_SYNC') + cfg.CONF.set_override('always_read_status', True, 'NSX_SYNC') ctx = context.get_admin_context() with self._populate_data(ctx): # Put a router down to verify punctual synchronization diff --git a/neutron/tests/unit/nicira/test_nvplib.py b/neutron/tests/unit/nicira/test_nvplib.py index 64e15b6df..0121f2255 100644 --- a/neutron/tests/unit/nicira/test_nvplib.py +++ b/neutron/tests/unit/nicira/test_nvplib.py @@ -56,11 +56,11 @@ class NvplibTestCase(base.BaseTestCase): instance.return_value.request.side_effect = _fake_request self.fake_cluster = nvp_cluster.NVPCluster( - name='fake-cluster', nvp_controllers=['1.1.1.1:999'], - default_tz_uuid=_uuid(), nvp_user='foo', nvp_password='bar') + 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( ('1.1.1.1', '999', True), - self.fake_cluster.nvp_user, self.fake_cluster.nvp_password, + self.fake_cluster.nsx_user, self.fake_cluster.nsx_password, self.fake_cluster.req_timeout, self.fake_cluster.http_timeout, self.fake_cluster.retries, self.fake_cluster.redirects) @@ -122,11 +122,11 @@ class NvplibNegativeTests(base.BaseTestCase): instance.return_value.request.side_effect = _faulty_request self.fake_cluster = nvp_cluster.NVPCluster( - name='fake-cluster', nvp_controllers=['1.1.1.1:999'], - default_tz_uuid=_uuid(), nvp_user='foo', nvp_password='bar') + 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( ('1.1.1.1', '999', True), - self.fake_cluster.nvp_user, self.fake_cluster.nvp_password, + self.fake_cluster.nsx_user, self.fake_cluster.nsx_password, self.fake_cluster.req_timeout, self.fake_cluster.http_timeout, self.fake_cluster.retries, self.fake_cluster.redirects) diff --git a/neutron/tests/unit/nicira/test_nvpopts.py b/neutron/tests/unit/nicira/test_nvpopts.py index ab6690038..30afa1f43 100644 --- a/neutron/tests/unit/nicira/test_nvpopts.py +++ b/neutron/tests/unit/nicira/test_nvpopts.py @@ -1,6 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# Copyright 2013 Nicira Networks, Inc. +# Copyright 2013 VMware, Inc. # # 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 @@ -34,28 +34,28 @@ from neutron.tests.unit.nicira import get_fake_conf from neutron.tests.unit.nicira import PLUGIN_NAME BASE_CONF_PATH = get_fake_conf('neutron.conf.test') -NVP_BASE_CONF_PATH = get_fake_conf('neutron.conf.test') -NVP_INI_PATH = get_fake_conf('nvp.ini.basic.test') -NVP_INI_FULL_PATH = get_fake_conf('nvp.ini.full.test') -NVP_INI_AGENTLESS_PATH = get_fake_conf('nvp.ini.agentless.test') +NSX_INI_PATH = get_fake_conf('nsx.ini.basic.test') +NSX_INI_FULL_PATH = get_fake_conf('nsx.ini.full.test') +NSX_INI_AGENTLESS_PATH = get_fake_conf('nsx.ini.agentless.test') +NVP_INI_DEPR_PATH = get_fake_conf('nvp.ini.full.test') -class NVPClusterTest(testtools.TestCase): +class NSXClusterTest(testtools.TestCase): cluster_opts = {'default_tz_uuid': uuidutils.generate_uuid(), 'default_l2_gw_service_uuid': uuidutils.generate_uuid(), 'default_l2_gw_service_uuid': uuidutils.generate_uuid(), - 'nvp_user': 'foo', - 'nvp_password': 'bar', + 'nsx_user': 'foo', + 'nsx_password': 'bar', 'req_timeout': 45, 'http_timeout': 25, 'retries': 7, 'redirects': 23, 'default_interface_name': 'baz', - 'nvp_controllers': ['1.1.1.1:443']} + 'nsx_controllers': ['1.1.1.1:443']} def setUp(self): - super(NVPClusterTest, self).setUp() + super(NSXClusterTest, self).setUp() self.addCleanup(cfg.CONF.reset) def test_create_cluster(self): @@ -65,7 +65,7 @@ class NVPClusterTest(testtools.TestCase): def test_create_cluster_default_port(self): opts = self.cluster_opts.copy() - opts['nvp_controllers'] = ['1.1.1.1'] + opts['nsx_controllers'] = ['1.1.1.1'] cluster = nvp_cluster.NVPCluster(**opts) for (k, v) in self.cluster_opts.iteritems(): self.assertEqual(v, getattr(cluster, k)) @@ -91,10 +91,10 @@ class ConfigurationTest(testtools.TestCase): self.addCleanup(patch_sync.stop) def _assert_required_options(self, cluster): - self.assertEqual(cluster.nvp_controllers, ['fake_1:443', 'fake_2:443']) + self.assertEqual(cluster.nsx_controllers, ['fake_1:443', 'fake_2:443']) self.assertEqual(cluster.default_tz_uuid, 'fake_tz_uuid') - self.assertEqual(cluster.nvp_user, 'foo') - self.assertEqual(cluster.nvp_password, 'bar') + self.assertEqual(cluster.nsx_user, 'foo') + self.assertEqual(cluster.nsx_password, 'bar') def _assert_extra_options(self, cluster): self.assertEqual(14, cluster.req_timeout) @@ -107,7 +107,7 @@ class ConfigurationTest(testtools.TestCase): def test_load_plugin_with_full_options(self): q_config.parse(['--config-file', BASE_CONF_PATH, - '--config-file', NVP_INI_FULL_PATH]) + '--config-file', NSX_INI_FULL_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) plugin = NeutronManager().get_plugin() cluster = plugin.cluster @@ -116,44 +116,44 @@ class ConfigurationTest(testtools.TestCase): def test_load_plugin_with_required_options_only(self): q_config.parse(['--config-file', BASE_CONF_PATH, - '--config-file', NVP_INI_PATH]) + '--config-file', NSX_INI_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) plugin = NeutronManager().get_plugin() self._assert_required_options(plugin.cluster) def test_defaults(self): - self.assertEqual(5000, cfg.CONF.NVP.max_lp_per_bridged_ls) - self.assertEqual(256, cfg.CONF.NVP.max_lp_per_overlay_ls) - self.assertEqual(10, cfg.CONF.NVP.concurrent_connections) - self.assertEqual('access_network', cfg.CONF.NVP.metadata_mode) - self.assertEqual('stt', cfg.CONF.NVP.default_transport_type) + self.assertEqual(5000, cfg.CONF.NSX.max_lp_per_bridged_ls) + self.assertEqual(256, cfg.CONF.NSX.max_lp_per_overlay_ls) + self.assertEqual(10, cfg.CONF.NSX.concurrent_connections) + self.assertEqual('access_network', cfg.CONF.NSX.metadata_mode) + self.assertEqual('stt', cfg.CONF.NSX.default_transport_type) self.assertIsNone(cfg.CONF.default_tz_uuid) - self.assertEqual('admin', cfg.CONF.nvp_user) - self.assertEqual('admin', cfg.CONF.nvp_password) + self.assertEqual('admin', cfg.CONF.nsx_user) + self.assertEqual('admin', cfg.CONF.nsx_password) self.assertEqual(30, cfg.CONF.req_timeout) self.assertEqual(10, cfg.CONF.http_timeout) self.assertEqual(2, cfg.CONF.retries) self.assertEqual(2, cfg.CONF.redirects) - self.assertIsNone(cfg.CONF.nvp_controllers) + self.assertIsNone(cfg.CONF.nsx_controllers) self.assertIsNone(cfg.CONF.default_l3_gw_service_uuid) self.assertIsNone(cfg.CONF.default_l2_gw_service_uuid) self.assertEqual('breth0', cfg.CONF.default_interface_name) def test_load_api_extensions(self): - q_config.parse(['--config-file', NVP_BASE_CONF_PATH, - '--config-file', NVP_INI_FULL_PATH]) + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NSX_INI_FULL_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) # Load the configuration, and initialize the plugin NeutronManager().get_plugin() self.assertIn('extensions', cfg.CONF.api_extensions_path) def test_agentless_extensions(self): - q_config.parse(['--config-file', NVP_BASE_CONF_PATH, - '--config-file', NVP_INI_AGENTLESS_PATH]) + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NSX_INI_AGENTLESS_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) self.assertEqual(config.AgentModes.AGENTLESS, - cfg.CONF.NVP.agent_mode) + cfg.CONF.NSX.agent_mode) # The version returned from NVP does not really matter here with mock.patch.object(nvp_client.NVPApiHelper, 'get_nvp_version', @@ -168,22 +168,22 @@ class ConfigurationTest(testtools.TestCase): plugin.supported_extension_aliases) def test_agentless_extensions_version_fail(self): - q_config.parse(['--config-file', NVP_BASE_CONF_PATH, - '--config-file', NVP_INI_AGENTLESS_PATH]) + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NSX_INI_AGENTLESS_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) self.assertEqual(config.AgentModes.AGENTLESS, - cfg.CONF.NVP.agent_mode) + cfg.CONF.NSX.agent_mode) with mock.patch.object(nvp_client.NVPApiHelper, 'get_nvp_version', return_value=nvp_client.NVPVersion("3.2")): self.assertRaises(exceptions.NvpPluginException, NeutronManager) def test_agentless_extensions_unmet_deps_fail(self): - q_config.parse(['--config-file', NVP_BASE_CONF_PATH, - '--config-file', NVP_INI_AGENTLESS_PATH]) + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NSX_INI_AGENTLESS_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) self.assertEqual(config.AgentModes.AGENTLESS, - cfg.CONF.NVP.agent_mode) + cfg.CONF.NSX.agent_mode) with mock.patch.object(nvp_client.NVPApiHelper, 'get_nvp_version', return_value=nvp_client.NVPVersion("3.2")): @@ -194,13 +194,46 @@ class ConfigurationTest(testtools.TestCase): NeutronManager) def test_agent_extensions(self): - q_config.parse(['--config-file', NVP_BASE_CONF_PATH, - '--config-file', NVP_INI_FULL_PATH]) + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NSX_INI_FULL_PATH]) cfg.CONF.set_override('core_plugin', PLUGIN_NAME) self.assertEqual(config.AgentModes.AGENT, - cfg.CONF.NVP.agent_mode) + cfg.CONF.NSX.agent_mode) plugin = NeutronManager().get_plugin() self.assertIn('agent', plugin.supported_extension_aliases) self.assertIn('dhcp_agent_scheduler', plugin.supported_extension_aliases) + + +class OldNVPConfigurationTest(testtools.TestCase): + + def setUp(self): + super(OldNVPConfigurationTest, self).setUp() + self.addCleanup(cfg.CONF.reset) + self.useFixture(fixtures.MonkeyPatch( + 'neutron.manager.NeutronManager._instance', + None)) + # Avoid runs of the synchronizer looping call + patch_sync = mock.patch.object(sync, '_start_loopingcall') + patch_sync.start() + self.addCleanup(patch_sync.stop) + + def _assert_required_options(self, cluster): + self.assertEqual(cluster.nsx_controllers, ['fake_1:443', 'fake_2:443']) + self.assertEqual(cluster.nsx_user, 'foo') + self.assertEqual(cluster.nsx_password, 'bar') + self.assertEqual(cluster.default_tz_uuid, 'fake_tz_uuid') + + def test_load_plugin_with_deprecated_options(self): + q_config.parse(['--config-file', BASE_CONF_PATH, + '--config-file', NVP_INI_DEPR_PATH]) + cfg.CONF.set_override('core_plugin', PLUGIN_NAME) + plugin = NeutronManager().get_plugin() + cluster = plugin.cluster + # Verify old nvp_* params have been fully parsed + self._assert_required_options(cluster) + self.assertEqual(4, cluster.req_timeout) + self.assertEqual(3, cluster.http_timeout) + self.assertEqual(2, cluster.retries) + self.assertEqual(2, cluster.redirects) diff --git a/setup.cfg b/setup.cfg index 8714e34ad..530630042 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,6 +64,7 @@ data_files = etc/neutron/plugins/openvswitch = etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini etc/neutron/plugins/plumgrid = etc/neutron/plugins/plumgrid/plumgrid.ini etc/neutron/plugins/ryu = etc/neutron/plugins/ryu/ryu.ini + etc/neutron/plugins/vmware = etc/neutron/plugins/vmware/nsx.ini scripts = bin/quantum-rootwrap bin/neutron-rootwrap