I'm taking Thierry at his word that I should merge early and merge often :)  
I'm taking Thierry at his word that I should merge early and merge often :)  

In Diablo-3 we introduced "vif-plugging" to the hypervisor "virt" layer, allowing flexibility in how vNICs are attached to the network switch. This allowed non-linux bridge switch technologies (e.g., Open vSwitch, 802.1qbh) to be used with nova.

This blueprint adds a similar capability to linux_net.py, allowing the L3/DHCP capabilities to be "plugged" into Quantum networks.  Like in the virt layer, we created a vif driver that represents the behavior of Nova prior to the change (LinuxBridgeInterfaceDriver) and make it the default.  We also add a new driver for Open Vswitch that can be enabled using a flag (LinuxOVSInterfaceDriver).  The code is designed to support other drivers as well.  

Most of the interesting code is at the bottom of linux_net.py, where the drivers are defined.  I had to pull some common code related to setting IPs on devices out of ensure_bridge() so it could be used by either approach.  The driver's plug() method is invoked by the VlanManager's _setup_network() method.  Currently unplug() is unused, which seems to be inline with how the existing nova code works. 

In many places in linux_net.py, I had to tweak functions to accept the name of the linux device to configure, rather than just assuming it was the 'bridge' field in the network object, since with OVS it could be any linux device.  The code I am least sure about are the changes to bin/nova-dhcpbridge.  I changed to this key off of the network ID, rather than the bridge name.  

I've tested this with the linux bridge and with the OVS vif-plugging driver.  I was able to confirm that L3 forwarding and DHCP were operating correctly.  
n0ano/ganttclient