#NEWLINE# def test_list_all_routers_on_hosting_devices( self ) : #NEWLINE# #INDENT# with self . router ( name = 'router1' ) as router1 , self . router ( name = 'router2' ) , self . router ( name = 'router3' ) as router3 : #NEWLINE# #INDENT# r1 = router1 [ 'router' ] #NEWLINE# r3 = router3 [ 'router' ] #NEWLINE# hd1_id = '00000000-0000-0000-0000-000000000001' #NEWLINE# self . _add_router_to_hosting_device ( hd1_id , r1 [ 'id' ] ) #NEWLINE# hd2_id = '00000000-0000-0000-0000-000000000002' #NEWLINE# self . _add_router_to_hosting_device ( hd2_id , r3 [ 'id' ] ) #NEWLINE# template_id = '00000000-0000-0000-0000-000000000005' #NEWLINE# with self . hosting_device ( template_id , no_delete = True ) as h_d3 , self . router ( name = 'router4' ) as router4 , self . router ( name = 'router5' ) as router5 : #NEWLINE# #INDENT# hd3 = h_d3 [ 'hosting_device' ] #NEWLINE# r4 = router4 [ 'router' ] #NEWLINE# r5 = router5 [ 'router' ] #NEWLINE# self . _add_router_to_hosting_device ( hd3 [ 'id' ] , r4 [ 'id' ] ) #NEWLINE# self . _add_router_to_hosting_device ( hd3 [ 'id' ] , r5 [ 'id' ] ) #NEWLINE# r_l = self . plugin . list_all_routers_on_hosting_devices ( self . adminContext ) #NEWLINE# r_set = { r1 [ 'id' ] , r3 [ 'id' ] , r4 [ 'id' ] , r5 [ 'id' ] } #NEWLINE# self . assertEqual ( len ( r_set ) , len ( r_l ) ) #NEWLINE# hds = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for r in r_l : #NEWLINE# #INDENT# self . assertTrue ( ( r [ 'id' ] in r_set ) ) #NEWLINE# router_host = r [ HOSTING_DEVICE_ATTR ] #NEWLINE# self . assertIsNotNone ( router_host ) #NEWLINE# if ( router_host not in hds ) : #NEWLINE# #INDENT# hd = self . _show ( 'hosting_devices' , router_host ) #NEWLINE# hds [ router_host ] = hd [ 'hosting_device' ]