#NEWLINE# def test_l3_cfg_agent_query_global_router_info( self ) : #NEWLINE# #INDENT# with self . subnet ( cidr = '10.0.1.0/24' ) as s_ext : #NEWLINE# #INDENT# self . _set_net_external ( s_ext [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# ext_gw = { #NEWLINE# #INDENT# 'network_id' : s_ext [ 'subnet' ] [ 'network_id' ] , #NEWLINE# #UNINDENT# } #NEWLINE# with self . router ( external_gateway_info = ext_gw ) as router : #NEWLINE# #INDENT# r = router [ 'router' ] #NEWLINE# self . plugin . _process_backlogged_routers ( ) #NEWLINE# r_after = self . _show ( 'routers' , r [ 'id' ] ) [ 'router' ] #NEWLINE# hd_id = r_after [ HOSTING_DEVICE_ATTR ] #NEWLINE# id_r_ha_backup = r_after [ ha . DETAILS ] [ ha . REDUNDANCY_ROUTERS ] [ 0 ] [ 'id' ] #NEWLINE# r_ha_backup_after = self . _show ( 'routers' , id_r_ha_backup ) [ 'router' ] #NEWLINE# ha_backup_hd_id = r_ha_backup_after [ HOSTING_DEVICE_ATTR ] #NEWLINE# q_p = ( '%s=%s' % ( ROUTER_ROLE_ATTR , ROUTER_ROLE_LOGICAL_GLOBAL ) ) #NEWLINE# g_l_rtrs = self . _list ( 'routers' , query_params = q_p ) [ 'routers' ] #NEWLINE# self . assertEqual ( len ( g_l_rtrs ) , 1 ) #NEWLINE# g_l_rtr = g_l_rtrs [ 0 ] #NEWLINE# g_l_rtr_rr_ids = { r_info [ 'id' ] for r_info in g_l_rtr [ ha . DETAILS ] [ ha . REDUNDANCY_ROUTERS ] } #NEWLINE# self . assertEqual ( g_l_rtr [ ha . ENABLED ] , True ) #NEWLINE# self . assertEqual ( g_l_rtr [ routertype . TYPE_ATTR ] , r [ routertype . TYPE_ATTR ] ) #NEWLINE# self . assertEqual ( g_l_rtr [ AUTO_SCHEDULE_ATTR ] , False ) #NEWLINE# q_p = ( '%s=%s' % ( ROUTER_ROLE_ATTR , ROUTER_ROLE_GLOBAL ) ) #NEWLINE# g_rtrs = { g_r [ HOSTING_DEVICE_ATTR ] : g_r for g_r in self . _list ( 'routers' , query_params = q_p ) [ 'routers' ] } #NEWLINE# self . assertEqual ( len ( g_rtrs ) , 2 ) #NEWLINE# for g_r in g_rtrs . values ( ) : #NEWLINE# #INDENT# self . assertEqual ( g_r [ routertype . TYPE_ATTR ] , r [ routertype . TYPE_ATTR ] ) #NEWLINE# self . assertEqual ( g_r [ ha . ENABLED ] , False ) #NEWLINE# self . assertEqual ( r [ AUTO_SCHEDULE_ATTR ] , False ) #NEWLINE# self . assertIn ( g_r [ 'id' ] , g_l_rtr_rr_ids ) #NEWLINE# #UNINDENT# e_context = context . get_admin_context ( ) #NEWLINE# ha_settings = self . _get_ha_defaults ( ha_type = cfg . CONF . ha . default_ha_mechanism , redundancy_level = 2 , priority = ha_db . DEFAULT_MASTER_PRIORITY ) #NEWLINE# ids_colocated_routers = [ r [ 'id' ] , g_rtrs [ hd_id ] [ 'id' ] ] #NEWLINE# self . _verify_sync_data ( e_context , ids_colocated_routers , g_l_rtr , g_l_rtr_rr_ids , ha_settings ) #NEWLINE# ids_colocated_routers = [ r_ha_backup_after [ 'id' ] , g_rtrs [ ha_backup_hd_id ] [ 'id' ] ] #NEWLINE# self . _verify_sync_data ( e_context , ids_colocated_routers , g_l_rtr , g_l_rtr_rr_ids , ha_settings )