[openstack-dev] ML2 port binding?

Robert Kukura kukura at noironetworks.com
Thu Jan 22 03:18:56 UTC 2015

Hi Harish,

Port binding in ML2 is the process by which a mechanism driver (or once
is merged, potentially a set of mechanism drivers) is selected for the 
port, determining how connectivity is provided for that port. Since ML2 
is designed to support heterogeneous deployments, its possible for 
different ports to be bound using different mechanism drivers.

The end results of port binding visible outside ML2 are the values of 
the binding:vif_type and binding:vif_details port attributes that 
control the Nova VIF driver behavior.  The inputs to the port binding 
process are the port and the network to which the port belongs, 
including the network's set of segments, as well as the values of the 
binding:host_id, binding:vnic_type, and binding:profile port attributes. 
Nova (or any L3, DHCP, or service agent owning the port) sets 
binding:host_id to indicate the host on which the port is being bound. 
The setting of this attribute triggers the port binding process.

During port binding, the bind_port() method is called by ML2 on each 
registered mechanism driver until one driver indicates it has succeeded 
by calling PortContext.set_binding(). The driver calls 
PortContext.set_binding()  with the identity of the network segment it 
bound, and the values for the binding:vif_type and binding:vif_details 
attributes. Typical mechanism drivers for L2 agents decide whether they 
can bind the port by looking through the list of network segment for one 
with a network_type value that the agent on the host identified by 
binding:host_id can handle, and if relevant, a physical_network value 
for which that agent has connectivity. The current L2 agent mechanism 
drivers use agents_db info sent from the agents to the service via RPC, 
including the agent's health and the bridge_mappings or 
interface_mappings value that describes its connectivity to 

The doc strings in neutron.plugins.ml2.driver_api provide more detail on 
port binding and the classes and methods involved.

Hope this helps,


On 1/21/15 9:42 PM, Harish Patil wrote:
> Hello,
> I’m a newbie here. Can someone please explain to me as to what exactly is
> involved in ‘port_binding’ in ML2 mechanism driver and any specific
> pointers? Is it just an association with its corresponding L2 agent? What
> is mechanism driver expected to return back to port_bind?
> Thanks
> Harish
> ________________________________
> This message and any attached documents contain information from the sending company or its parent company(s), subsidiaries, divisions or branch offices that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

More information about the OpenStack-dev mailing list