Remove ovs dependency in embrane plugin

This patch changes the dependency of the embrane plugin from ovs to ml2.
Existing users of the old entry point will be upgraded on a case-by-case
base as needed, therefore no generic upgrade procedure is required.

Change-Id: Id192fc32bd6ba7a8926eff1190070b8df5327129
Closes-Bug: #1343024
This commit is contained in:
Ignacio Scopetta 2014-07-19 23:37:22 -07:00 committed by Marco Chirico
parent f56328738d
commit 43eab852f4
5 changed files with 38 additions and 47 deletions

View File

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

View File

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

View File

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

View File

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