#NEWLINE# def test_scheduler( self ) : #NEWLINE# #INDENT# self . _set_l3_agent_admin_state ( self . adminContext , self . agent_id2 , False ) #NEWLINE# with self . subnet ( ) as subnet : #NEWLINE# #INDENT# self . _set_net_external ( subnet [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# with self . router_with_ext_gw ( name = 'r1' , subnet = subnet ) as r1 : #NEWLINE# #INDENT# agents = self . get_l3_agents_hosting_routers ( self . adminContext , [ r1 [ 'router' ] [ 'id' ] ] , admin_state_up = True ) #NEWLINE# self . assertEqual ( 1 , len ( agents ) ) #NEWLINE# agent_id1 = agents [ 0 ] [ 'id' ] #NEWLINE# with self . router_with_ext_gw ( name = 'r2' , subnet = subnet ) as r2 : #NEWLINE# #INDENT# agents = self . get_l3_agents_hosting_routers ( self . adminContext , [ r2 [ 'router' ] [ 'id' ] ] , admin_state_up = True ) #NEWLINE# self . assertEqual ( 1 , len ( agents ) ) #NEWLINE# agent_id2 = agents [ 0 ] [ 'id' ] #NEWLINE# self . assertEqual ( agent_id1 , agent_id2 ) #NEWLINE# self . _set_l3_agent_admin_state ( self . adminContext , self . agent_id2 , True ) #NEWLINE# with self . router_with_ext_gw ( name = 'r3' , subnet = subnet ) as r3 : #NEWLINE# #INDENT# agents = self . get_l3_agents_hosting_routers ( self . adminContext , [ r3 [ 'router' ] [ 'id' ] ] , admin_state_up = True ) #NEWLINE# self . assertEqual ( 1 , len ( agents ) ) #NEWLINE# agent_id3 = agents [ 0 ] [ 'id' ] #NEWLINE# self . assertNotEqual ( agent_id1 , agent_id3 )