self.driver.plug(None, ex_gw_port['id'], interface_name,
ex_gw_port['mac_address'],
bridge=self.conf.external_network_bridge,
- namespace=ri.ns_name())
+ namespace=ri.ns_name(),
+ prefix=EXTERNAL_DEV_PREFIX)
self.driver.init_l3(interface_name, [ex_gw_port['ip_cidr']],
namespace=ri.ns_name())
root_helper=self.conf.root_helper,
namespace=ri.ns_name()):
self.driver.plug(None, port_id, interface_name, mac_address,
- namespace=ri.ns_name())
+ namespace=ri.ns_name(),
+ prefix=INTERNAL_DEV_PREFIX)
self.driver.init_l3(interface_name, [internal_cidr],
namespace=ri.ns_name())
@abc.abstractmethod
def plug(self, network_id, port_id, device_name, mac_address,
- bridge=None, namespace=None):
+ bridge=None, namespace=None, prefix=None):
"""Plug in the interface."""
@abc.abstractmethod
class NullDriver(LinuxInterfaceDriver):
def plug(self, network_id, port_id, device_name, mac_address,
- bridge=None, namespace=None):
+ bridge=None, namespace=None, prefix=None):
pass
def unplug(self, device_name, bridge=None, namespace=None):
"""Driver for creating an internal interface on an OVS bridge."""
def plug(self, network_id, port_id, device_name, mac_address,
- bridge=None, namespace=None):
+ bridge=None, namespace=None, prefix=None):
"""Plug in the interface."""
if not bridge:
bridge = self.conf.ovs_integration_bridge
class BridgeInterfaceDriver(LinuxInterfaceDriver):
"""Driver for creating bridge interfaces."""
- DEV_NAME_PREFIX = 'dhc'
+ DEV_NAME_PREFIX = 'ns-'
def plug(self, network_id, port_id, device_name, mac_address,
- bridge=None, namespace=None):
+ bridge=None, namespace=None, prefix=None):
"""Plugin the interface."""
if not ip_lib.device_exists(device_name,
self.conf.root_helper,
namespace=namespace):
ip = ip_lib.IPWrapper(self.conf.root_helper)
- tap_name = device_name.replace(self.DEV_NAME_PREFIX, 'tap')
+ # Enable agent to define the prefix
+ if prefix:
+ tap_name = device_name.replace(prefix, 'tap')
+ else:
+ tap_name = device_name.replace(self.DEV_NAME_PREFIX, 'tap')
root_veth, dhcp_veth = ip.add_veth(tap_name, device_name)
root_veth.link.set_address(mac_address)
self.ryu_client = OFPClient(self.conf.ryu_api_host)
def plug(self, network_id, port_id, device_name, mac_address,
- bridge=None, namespace=None):
+ bridge=None, namespace=None, prefix=None):
"""Plug in the interface."""
super(RyuInterfaceDriver, self).plug(network_id, port_id, device_name,
mac_address, bridge=bridge,
- namespace=namespace)
+ namespace=namespace,
+ prefix=prefix)
if not bridge:
bridge = self.conf.ovs_integration_bridge
driver = self._get_driver_by_network_id(port.network_id)
return driver.get_device_name(port)
- def plug(self, network_id, port_id, device_name, mac_address):
+ def plug(self, network_id, port_id, device_name, mac_address,
+ bridge=None, namespace=None, prefix=None):
driver = self._get_driver_by_network_id(network_id)
- return driver.plug(network_id, port_id, device_name, mac_address)
+ return driver.plug(network_id, port_id, device_name, mac_address,
+ bridge=bridge, namespace=namespace, prefix=prefix)
def unplug(self, device_name):
driver = self._get_driver_by_device_name(device_name)
from quantum.db import api as db_api
from quantum.db import db_base_plugin_v2
from quantum.db import dhcp_rpc_base
+from quantum.db import l3_db
from quantum.db import models_v2
from quantum.openstack.common import context
from quantum.openstack.common import cfg
topic=self.topic_port_update)
-class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2):
+class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
+ l3_db.L3_NAT_db_mixin):
"""Implement the Quantum abstractions using Linux bridging.
A new VLAN is created for each network. An agent is relied upon
# is qualified by class
__native_bulk_support = True
- supported_extension_aliases = ["provider"]
+ supported_extension_aliases = ["provider", "os-quantum-router"]
def __init__(self):
db.initialize()
binding.physical_network,
binding.vlan_id)
return port
+
+ def delete_port(self, context, id):
+ self.disassociate_floatingips(context, id)
+ return super(LinuxBridgePluginV2, self).delete_port(context, id)