# ignored, as new networks will no longer be scheduled to existing dhcp agents.
# agent_mode = agent
+# Specifies which mode packet replication should be done in. If set to service
+# a service node is required in order to perform packet replication. This can
+# also be set to source if one wants replication to be performed locally (NOTE:
+# usually only useful for testing if one does not want to deploy a service node).
+# replication_mode = service
+
[nsx_sync]
# Interval in seconds between runs of the status synchronization task.
# The plugin will aim at resynchronizing operational status for all
# ignored, as new networks will no longer be scheduled to existing dhcp agents.
# agent_mode = agent
+# Specifies which mode packet replication should be done in. If set to service
+# a service node is required in order to perform packet replication. This can
+# also be set to source if one wants replication to be performed locally (NOTE:
+# usually only useful for testing if one does not want to deploy a service node).
+# replication_mode = service
+
[nsx_sync]
# Interval in seconds between runs of the status synchronization task.
# The plugin will aim at resynchronizing operational status for all
from oslo.config import cfg
+from neutron.plugins.vmware.common import exceptions as nsx_exc
+
class AgentModes:
AGENT = 'agent'
INDIRECT = 'dhcp_host_route'
+class ReplicationModes:
+ SERVICE = 'service'
+ SOURCE = 'source'
+
+
base_opts = [
cfg.IntOpt('max_lp_per_bridged_ls', default=5000,
deprecated_group='NVP',
"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."))
+ help=_("The mode used to implement DHCP/metadata services.")),
+ cfg.StrOpt('replication_mode', default=ReplicationModes.SERVICE,
+ help=_("The default option leverages service nodes to perform"
+ " packet replication though one could set to this to "
+ "'source' to perform replication locally. This is useful"
+ " if one does not want to deploy a service node(s)."))
]
sync_opts = [
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")
+
+
+def validate_config_options():
+ if cfg.CONF.NSX.replication_mode not in (ReplicationModes.SERVICE,
+ ReplicationModes.SOURCE):
+ error = (_("Invalid replication_mode: %s") %
+ cfg.CONF.NSX.replication_mode)
+ raise nsx_exc.NsxPluginException(err_msg=error)
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.config import cfg
+
from neutron.common import exceptions as exception
from neutron.openstack.common import excutils
from neutron.openstack.common import jsonutils
"routing_config": {
"type": router_type
},
- "type": "LogicalRouterConfig"
+ "type": "LogicalRouterConfig",
+ "replication_mode": cfg.CONF.NSX.replication_mode,
}
# add the distributed key only if not None (ie: True or False)
if distributed is not None:
import json
+from oslo.config import cfg
+
from neutron.common import constants
from neutron.common import exceptions as exception
from neutron.openstack.common import log
# historical reasons
lswitch_obj = {"display_name": utils.check_and_truncate(display_name),
"transport_zones": transport_zones_config,
+ "replication_mode": cfg.CONF.NSX.replication_mode,
"tags": utils.get_tags(os_tid=tenant_id,
quantum_net_id=neutron_net_id)}
# TODO(salv-orlando): Now that we have async status synchronization
def __init__(self):
super(NsxPluginV2, self).__init__()
+ config.validate_config_options()
# TODO(salv-orlando): Replace These dicts with
# collections.defaultdict for better handling of default values
# Routines for managing logical ports in NSX
import mock
+from oslo.config import cfg
+
from neutron.common import exceptions
from neutron.openstack.common import uuidutils
from neutron.plugins.vmware.api_client import exception as api_exc
'type': 'SingleDefaultRouteImplicitRoutingConfig'},
'tags': utils.get_tags(os_tid='fake_tenant_id',
q_router_id='pipita_higuain'),
- 'type': 'LogicalRouterConfig'}
+ 'type': 'LogicalRouterConfig',
+ 'replication_mode': cfg.CONF.NSX.replication_mode}
self.assertEqual(expected, body)
def test_prepare_body_without_routing_config(self):
'routing_config': {'type': 'RoutingTableRoutingConfig'},
'tags': utils.get_tags(os_tid='fake_tenant_id',
q_router_id='marekiaro_hamsik'),
- 'type': 'LogicalRouterConfig'}
+ 'type': 'LogicalRouterConfig',
+ 'replication_mode': cfg.CONF.NSX.replication_mode}
self.assertEqual(expected, body)
def test_get_lrouter(self):
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.assertEqual('service', cfg.CONF.NSX.replication_mode)
self.assertIsNone(cfg.CONF.default_tz_uuid)
self.assertEqual('admin', cfg.CONF.nsx_user)