#NEWLINE# def test_process_binding_port_host_id_changed( self ) : #NEWLINE# #INDENT# ctx = context . get_admin_context ( ) #NEWLINE# plugin = manager . NeutronManager . get_plugin ( ) #NEWLINE# host_id = { #NEWLINE# #INDENT# portbindings . HOST_ID : 'host1' , #NEWLINE# #UNINDENT# } #NEWLINE# with self . port ( ** host_id ) as port : #NEWLINE# #INDENT# plugin . update_port_status ( ctx , port [ 'port' ] [ 'id' ] , const . PORT_STATUS_ACTIVE ) #NEWLINE# attrs = port [ 'port' ] #NEWLINE# attrs [ 'status' ] = const . PORT_STATUS_ACTIVE #NEWLINE# original_port = attrs . copy ( ) #NEWLINE# attrs [ 'binding:host_id' ] = 'host2' #NEWLINE# updated_port = attrs . copy ( ) #NEWLINE# network = { #NEWLINE# #INDENT# 'id' : attrs [ 'network_id' ] , #NEWLINE# #UNINDENT# } #NEWLINE# binding = ml2_models . PortBinding ( port_id = original_port [ 'id' ] , host = original_port [ 'binding:host_id' ] , vnic_type = original_port [ 'binding:vnic_type' ] , profile = original_port [ 'binding:profile' ] , vif_type = original_port [ 'binding:vif_type' ] , vif_details = original_port [ 'binding:vif_details' ] ) #NEWLINE# levels = 1 #NEWLINE# mech_context = driver_context . PortContext ( plugin , ctx , updated_port , network , binding , levels , original_port = port_dict ) #NEWLINE# plugin . _process_port_binding ( mech_context , port [ 'port' ] ) #NEWLINE# self . assertEqual ( const . PORT_STATUS_DOWN , updated_port [ 'status' ] ) #NEWLINE# port_dict = plugin . get_port ( ctx , port [ 'port' ] [ 'id' ] ) #NEWLINE# self . assertEqual ( const . PORT_STATUS_DOWN , port_dict [ 'status' ] )