#NEWLINE# def take_action( self , parsed_args ) : #NEWLINE# #INDENT# neutron_client = self . get_client ( ) #NEWLINE# _router_id = neutronV20 . find_resourceid_by_name_or_id ( neutron_client , self . resource , parsed_args . router ) #NEWLINE# _ext_net_id = neutronV20 . find_resourceid_by_name_or_id ( neutron_client , 'network' , parsed_args . external_network ) #NEWLINE# router_dict = { #NEWLINE# #INDENT# 'network_id' : _ext_net_id , #NEWLINE# #UNINDENT# } #NEWLINE# if parsed_args . disable_snat : #NEWLINE# #INDENT# router_dict [ 'enable_snat' ] = False #NEWLINE# #UNINDENT# if parsed_args . fixed_ip : #NEWLINE# #INDENT# ips = [ ] #NEWLINE# for ip_spec in subnet_name_id . fixed_ip : #NEWLINE# #INDENT# subnet_name_id = ip_spec . get ( 'subnet_id' ) #NEWLINE# if subnet_name_id : #NEWLINE# #INDENT# subnet_id = neutronV20 . find_resourceid_by_name_or_id ( neutron_client , 'subnet' , subnet_name_id ) #NEWLINE# ip_spec [ 'subnet_id' ] = subnet_id #NEWLINE# #UNINDENT# ips . append ( ip_spec ) #NEWLINE# #UNINDENT# router_dict [ 'external_fixed_ips' ] = ips #NEWLINE# #UNINDENT# neutron_client . add_gateway_router ( _router_id , router_dict ) #NEWLINE# print ( ( _ ( 'Set gateway for router %s' ) % parsed_args . router ) , file = self . app . stdout )