#NEWLINE# def _add_redundancy_routers( self , context , start_index , stop_index , user_visible_router , ports = None , ha_settings_db = None , create_ha_group = True ) : #NEWLINE# #INDENT# 'Creates a redundancy router and its interfaces on\n        the specified subnets.\n        ' #NEWLINE# priority = ( DEFAULT_MASTER_PRIORITY + ( ( start_index - 1 ) * PRIORITY_INCREASE_STEP ) ) #NEWLINE# r = copy . deepcopy ( user_visible_router ) #NEWLINE# r [ 'tenant_id' ] = '' #NEWLINE# name = r [ 'name' ] #NEWLINE# redundancy_r_ids = [ ] #NEWLINE# for i in range ( start_index , stop_index ) : #NEWLINE# #INDENT# del r [ 'id' ] #NEWLINE# r . pop ( 'routes' , None ) #NEWLINE# r [ ha . ENABLED ] = False #NEWLINE# r [ 'name' ] = ( ( name + REDUNDANCY_ROUTER_SUFFIX ) + str ( i ) ) #NEWLINE# r [ routerrole . ROUTER_ROLE_ATTR ] = ROUTER_ROLE_HA_REDUNDANCY #NEWLINE# gw_info = r [ EXTERNAL_GW_INFO ] #NEWLINE# if ( gw_info and gw_info [ 'external_fixed_ips' ] ) : #NEWLINE# #INDENT# for e_fixed_ip in gw_info [ 'external_fixed_ips' ] : #NEWLINE# #INDENT# e_fixed_ip . pop ( 'ip_address' , None ) #NEWLINE# #UNINDENT# #UNINDENT# r = self . create_router ( context , { #NEWLINE# #INDENT# 'router' : r , #NEWLINE# #UNINDENT# } ) #NEWLINE# LOG . debug ( 'Created redundancy router %(index)d with router id %(r_id)s' , { #NEWLINE# #INDENT# 'index' : i , #NEWLINE# 'r_id' : r [ 'id' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# priority += PRIORITY_INCREASE_STEP #NEWLINE# r_b_b = RouterRedundancyBinding ( redundancy_router_id = r [ 'id' ] , priority = priority , user_router_id = user_visible_router [ 'id' ] ) #NEWLINE# context . session . add ( r_b_b ) #NEWLINE# redundancy_r_ids . append ( r [ 'id' ] ) #NEWLINE# #UNINDENT# for port_db in ( ports or [ ] ) : #NEWLINE# #INDENT# port = self . _core_plugin . _make_port_dict ( port_db ) #NEWLINE# self . _add_redundancy_router_interfaces ( context , user_visible_router , None , port , redundancy_r_ids , ha_settings_db , create_ha_group )