#NEWLINE# def try_to_bind_segment_for_agent( self , context , segment , agent ) : #NEWLINE# #INDENT# if self . check_segment_for_agent ( segment , agent ) : #NEWLINE# #INDENT# vif_details_segment = self . vif_details #NEWLINE# mappings = self . get_mappings ( agent ) #NEWLINE# interface = mappings [ segment [ 'physical_network' ] ] #NEWLINE# network_type = segment [ api . NETWORK_TYPE ] #NEWLINE# if ( network_type == p_constants . TYPE_VLAN ) : #NEWLINE# #INDENT# vlan_id = segment [ api . SEGMENTATION_ID ] #NEWLINE# macvtap_src = macvtap_common . get_vlan_device_name ( interface , vlan_id ) #NEWLINE# vif_details_segment [ 'vlan' ] = vlan_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# macvtap_src = interface #NEWLINE# #UNINDENT# vif_details_segment [ 'physical_interface' ] = interface #NEWLINE# vif_details_segment [ 'macvtap_source' ] = macvtap_src #NEWLINE# vif_details_segment [ 'macvtap_mode' ] = MACVTAP_MODE_BRIDGE #NEWLINE# LOG . debug ( 'Macvtap vif_details added to context binding: %s' , vif_details_segment ) #NEWLINE# context . set_binding ( segment [ api . ID ] , self . vif_type , vif_details_segment ) #NEWLINE# return True #NEWLINE# #UNINDENT# return False