#NEWLINE# def test__notify_l3_agent_update_port_with_port_binding_change( self ) : #NEWLINE# #INDENT# source_host = 'vm-host1' #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'context' : self . adminContext , #NEWLINE# 'original_port' : { #NEWLINE# #INDENT# 'id' : str ( uuid . uuid4 ( ) ) , #NEWLINE# portbindings . HOST_ID : source_host , #NEWLINE# 'device_owner' : DEVICE_OWNER_COMPUTE , #NEWLINE# #UNINDENT# } , #NEWLINE# 'port' : { #NEWLINE# #INDENT# portbindings . HOST_ID : 'vm-host2' , #NEWLINE# 'device_owner' : DEVICE_OWNER_COMPUTE , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# l3plugin = mock . Mock ( ) #NEWLINE# with mock . patch . object ( manager . NeutronManager , 'get_service_plugins' , return_value = { #NEWLINE# #INDENT# 'L3_ROUTER_NAT' : l3plugin , #NEWLINE# #UNINDENT# } ) , mock . patch . object ( l3plugin , 'get_dvr_routers_to_remove' , return_value = [ { #NEWLINE# #INDENT# 'agent_id' : 'foo_agent' , #NEWLINE# 'router_id' : 'foo_id' , #NEWLINE# 'host' : source_host , #NEWLINE# #UNINDENT# } ] ) : #NEWLINE# #INDENT# l3_dvrscheduler_db . _notify_l3_agent_port_update ( 'port' , 'after_update' , mock . ANY , ** kwargs ) #NEWLINE# l3plugin . l3_rpc_notifier . router_removed_from_agent . assert_called_once_with ( mock . ANY , 'foo_id' , source_host ) #NEWLINE# self . assertEqual ( 1 , l3plugin . update_arp_entry_for_dvr_service_port . call_count ) #NEWLINE# self . assertEqual ( 1 , l3plugin . delete_arp_entry_for_dvr_service_port . call_count ) #NEWLINE# l3plugin . dvr_handle_new_service_port . assert_called_once_with ( self . adminContext , kwargs . get ( 'port' ) , dest_host = None )