#NEWLINE# def _auto_schedule_when_agent_added( self , specific_router ) : #NEWLINE# #INDENT# router = self . _create_ha_router ( ) #NEWLINE# agents = self . plugin . get_l3_agents_hosting_routers ( self . adminContext , [ router [ 'id' ] ] , admin_state_up = True ) #NEWLINE# self . assertEqual ( 2 , len ( agents ) ) #NEWLINE# agent_ids = [ agent [ 'id' ] for agent in agents ] #NEWLINE# self . assertIn ( self . agent_id1 , agent_ids ) #NEWLINE# self . assertIn ( self . agent_id2 , agent_ids ) #NEWLINE# agent = helpers . register_l3_agent ( host = 'host_3' ) #NEWLINE# self . agent_id3 = agent . id #NEWLINE# routers_to_auto_schedule = ( [ agent_ids [ 'id' ] ] if specific_router else [ ] ) #NEWLINE# self . plugin . auto_schedule_routers ( self . adminContext , 'host_3' , routers_to_auto_schedule ) #NEWLINE# agents = self . plugin . get_l3_agents_hosting_routers ( self . adminContext , [ router [ 'id' ] ] , admin_state_up = True ) #NEWLINE# self . assertEqual ( 3 , len ( agents ) ) #NEWLINE# self . plugin . auto_schedule_routers ( self . adminContext , 'host_3' , routers_to_auto_schedule )