def add_vlan_binding(vlanid, vlanname, netid):
 LOG.debug(_('add_vlan_binding() called'))
 session = db.get_session()
 try:
  binding = session.query(network_models_v2.Vlan_Binding).filter_by(vlan_id=vlanid).one()
  raise c_exc.NetworkVlanBindingAlreadyExists(vlan_id=vlanid, network_id=netid)
 except exc.NoResultFound:
  binding = network_models_v2.Vlan_Binding(vlanid, vlanname, netid)
  session.add(binding)
  session.flush()
  return binding

def add_vlan_binding ( vlanid , vlanname , netid ) : LOG . debug ( _ ( 'add_vlan_binding() called' ) ) session = db . get_session ( ) try : binding = session . query ( network_models_v2 . Vlan_Binding ) . filter_by ( vlan_id = vlanid ) . one ( ) raise c_exc . NetworkVlanBindingAlreadyExists ( vlan_id = vlanid , network_id = netid ) except exc . NoResultFound : binding = network_models_v2 . Vlan_Binding ( vlanid , vlanname , netid ) session . add ( binding ) session . flush ( ) return binding
adds a vlan to network association .