#NEWLINE# def test__notify_port_delete( self ) : #NEWLINE# #INDENT# plugin = manager . NeutronManager . get_plugin ( ) #NEWLINE# l3plugin = mock . Mock ( ) #NEWLINE# l3plugin . supported_extension_aliases = [ 'router' , constants . L3_AGENT_SCHEDULER_EXT_ALIAS , constants . L3_DISTRIBUTED_EXT_ALIAS ] #NEWLINE# port = { #NEWLINE# #INDENT# 'id' : str ( uuid . uuid4 ( ) ) , #NEWLINE# 'device_id' : 'abcd' , #NEWLINE# 'device_owner' : DEVICE_OWNER_COMPUTE_NOVA , #NEWLINE# portbindings . HOST_ID : 'host1' , #NEWLINE# #UNINDENT# } #NEWLINE# with mock . patch . object ( manager . NeutronManager , 'get_service_plugins' , return_value = { #NEWLINE# #INDENT# 'L3_ROUTER_NAT' : l3plugin , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# 'context' : self . adminContext , #NEWLINE# 'port' : port , #NEWLINE# 'removed_routers' : [ { #NEWLINE# #INDENT# 'agent_id' : 'foo_agent' , #NEWLINE# 'router_id' : 'foo_id' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# removed_routers = [ { #NEWLINE# #INDENT# 'agent_id' : 'foo_agent' , #NEWLINE# 'router_id' : 'foo_id' , #NEWLINE# 'host' : 'foo_host' , #NEWLINE# #UNINDENT# } ] #NEWLINE# l3plugin . get_dvr_routers_to_remove . return_value = removed_routers #NEWLINE# l3_dvrscheduler_db . _notify_port_delete ( 'port' , 'after_delete' , kwargs , ** kwargs ) #NEWLINE# l3plugin . delete_arp_entry_for_dvr_service_port . assert_called_once_with ( self . adminContext , mock . ANY ) #NEWLINE# l3plugin . l3_rpc_notifier . router_removed_from_agent . assert_called_once_with ( mock . ANY , 'foo_id' , 'foo_host' )