diff --git a/neutron/plugins/embrane/l2base/ml2/__init__.py b/neutron/plugins/embrane/l2base/ml2/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/neutron/plugins/embrane/l2base/openvswitch/openvswitch_support.py b/neutron/plugins/embrane/l2base/ml2/ml2_support.py similarity index 50% rename from neutron/plugins/embrane/l2base/openvswitch/openvswitch_support.py rename to neutron/plugins/embrane/l2base/ml2/ml2_support.py index b5635a861d..047973b09f 100644 --- a/neutron/plugins/embrane/l2base/openvswitch/openvswitch_support.py +++ b/neutron/plugins/embrane/l2base/ml2/ml2_support.py @@ -1,4 +1,4 @@ -# Copyright 2013 Embrane, Inc. +# Copyright 2014 Embrane, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -14,6 +14,7 @@ # under the License. # # @author: Ivar Lazzaro, Embrane, Inc. +# @author: Ignacio Scopetta, Embrane, Inc. from heleosapi import info as h_info @@ -21,36 +22,34 @@ from neutron.common import constants from neutron import manager from neutron.plugins.embrane.l2base import support_base as base from neutron.plugins.embrane.l2base import support_exceptions as exc -from neutron.plugins.openvswitch import ovs_db_v2 -class OpenvswitchSupport(base.SupportBase): - """OpenVSwitch plugin support. +class Ml2Support(base.SupportBase): + """Modular Layer 2 plugin support. - Obtains the informations needed to build the user security zones + Obtains the information needed to build the user security zones. """ def __init__(self): - super(OpenvswitchSupport, self).__init__() + super(Ml2Support, self).__init__() def retrieve_utif_info(self, context, neutron_port): plugin = manager.NeutronManager.get_plugin() - session = context.session - network_id = neutron_port["network_id"] - network_binding = ovs_db_v2.get_network_binding(session, network_id) - if not network_binding["segmentation_id"]: - raise exc.UtifInfoError( - err_msg=_("No segmentation_id found for the network, " - "please be sure that tenant_network_type is vlan")) - network = plugin._get_network(context, network_id) + network = plugin.get_network( + context, neutron_port['network_id']) is_gw = (neutron_port["device_owner"] == constants.DEVICE_OWNER_ROUTER_GW) - result = h_info.UtifInfo(vlan=network_binding["segmentation_id"], - network_name=network["name"], - network_id=network["id"], - is_gw=is_gw, - owner_tenant=network["tenant_id"], - port_id=neutron_port["id"], - mac_address=neutron_port["mac_address"]) + network_type = network.get('provider:network_type') + if network_type != 'vlan': + raise exc.UtifInfoError( + err_msg=_("Network type %s not supported. Please be sure " + "that tenant_network_type is vlan") % network_type) + result = h_info.UtifInfo(network.get('provider:segmentation_id'), + network['name'], + network['id'], + is_gw, + network['tenant_id'], + neutron_port['id'], + neutron_port['mac_address']) return result diff --git a/neutron/plugins/embrane/l2base/openvswitch/__init__.py b/neutron/plugins/embrane/l2base/openvswitch/__init__.py deleted file mode 100644 index 25dc46b070..0000000000 --- a/neutron/plugins/embrane/l2base/openvswitch/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2013 Embrane, 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. -# -# @author: Ivar Lazzaro, Embrane, Inc. diff --git a/neutron/plugins/embrane/plugins/embrane_ovs_plugin.py b/neutron/plugins/embrane/plugins/embrane_ml2_plugin.py similarity index 51% rename from neutron/plugins/embrane/plugins/embrane_ovs_plugin.py rename to neutron/plugins/embrane/plugins/embrane_ml2_plugin.py index 3318885e85..954e5ea8a7 100644 --- a/neutron/plugins/embrane/plugins/embrane_ovs_plugin.py +++ b/neutron/plugins/embrane/plugins/embrane_ml2_plugin.py @@ -1,4 +1,4 @@ -# Copyright 2013 Embrane, Inc. +# Copyright 2014 Embrane, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -14,23 +14,31 @@ # under the License. # # @author: Ivar Lazzaro, Embrane, Inc. +# @author: Ignacio Scopetta, Embrane, Inc. +from neutron.db import extraroute_db +from neutron.db import l3_dvr_db +from neutron.db import l3_gwmode_db from neutron.plugins.embrane import base_plugin as base -from neutron.plugins.embrane.l2base.openvswitch import openvswitch_support -from neutron.plugins.openvswitch import ovs_neutron_plugin as l2 +from neutron.plugins.embrane.l2base.ml2 import ml2_support +from neutron.plugins.ml2 import plugin as l2 -class EmbraneOvsPlugin(base.EmbranePlugin, l2.OVSNeutronPluginV2): - '''EmbraneOvsPlugin. +class EmbraneMl2Plugin(base.EmbranePlugin, l2.Ml2Plugin, + l3_dvr_db.L3_NAT_with_dvr_db_mixin, + l3_gwmode_db.L3_NAT_db_mixin, + extraroute_db.ExtraRoute_db_mixin): + '''EmbraneMl2Plugin. - This plugin uses OpenVSwitch specific L2 plugin for providing L2 networks + This plugin uses Modular Layer 2 plugin for providing L2 networks and the base EmbranePlugin for L3. ''' - _plugin_support = openvswitch_support.OpenvswitchSupport() + _plugin_support = ml2_support.Ml2Support() def __init__(self): '''First run plugin specific initialization, then Embrane's.''' - self._supported_extension_aliases.remove("l3_agent_scheduler") - l2.OVSNeutronPluginV2.__init__(self) + self._supported_extension_aliases.extend(["router", "extraroute", + "ext-gw-mode"]) + l2.Ml2Plugin.__init__(self) self._run_embrane_config() diff --git a/setup.cfg b/setup.cfg index 94f7d9cd7b..cf251094b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -121,7 +121,7 @@ neutron.core_plugins = bigswitch = neutron.plugins.bigswitch.plugin:NeutronRestProxyV2 brocade = neutron.plugins.brocade.NeutronPlugin:BrocadePluginV2 cisco = neutron.plugins.cisco.network_plugin:PluginV2 - embrane = neutron.plugins.embrane.plugins.embrane_ovs_plugin:EmbraneOvsPlugin + embrane = neutron.plugins.embrane.plugins.embrane_ml2_plugin:EmbraneMl2Plugin hyperv = neutron.plugins.hyperv.hyperv_neutron_plugin:HyperVNeutronPlugin ibm = neutron.plugins.ibm.sdnve_neutron_plugin:SdnvePluginV2 linuxbridge = neutron.plugins.linuxbridge.lb_neutron_plugin:LinuxBridgePluginV2