<s> from __future__ import print_function <EOL> from neutronclient . _i18n import _ <EOL> from neutronclient . neutron import v2_0 as neutronV20 <EOL> from neutronclient . neutron . v2_0 . bgp import speaker as bgp_speaker <EOL> def add_common_args ( parser ) : <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> class AddBGPSpeakerToDRAgent ( neutronV20 . NeutronCommand ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( AddBGPSpeakerToDRAgent , self ) . get_parser ( prog_name ) <EOL> add_common_args ( parser ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> neutron_client = self . get_client ( ) <EOL> _speaker_id = bgp_speaker . get_bgp_speaker_id ( neutron_client , <EOL> parsed_args . bgp_speaker ) <EOL> neutron_client . add_bgp_speaker_to_dragent ( <EOL> parsed_args . dragent_id , { '<STR_LIT>' : _speaker_id } ) <EOL> print ( _ ( '<STR_LIT>' ) <EOL> % parsed_args . bgp_speaker , file = self . app . stdout ) <EOL> class RemoveBGPSpeakerFromDRAgent ( neutronV20 . NeutronCommand ) : <EOL> """<STR_LIT>""" <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( RemoveBGPSpeakerFromDRAgent , self ) . get_parser ( <EOL> prog_name ) <EOL> add_common_args ( parser ) <EOL> return parser <EOL> def take_action ( self , parsed_args ) : <EOL> neutron_client = self . get_client ( ) <EOL> _speaker_id = bgp_speaker . get_bgp_speaker_id ( neutron_client , <EOL> parsed_args . bgp_speaker ) <EOL> neutron_client . remove_bgp_speaker_from_dragent ( parsed_args . dragent_id , <EOL> _speaker_id ) <EOL> print ( _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> % parsed_args . bgp_speaker , file = self . app . stdout ) <EOL> class ListBGPSpeakersOnDRAgent ( neutronV20 . ListCommand ) : <EOL> """<STR_LIT>""" <EOL> list_columns = [ '<STR_LIT:id>' , '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> resource = '<STR_LIT>' <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( ListBGPSpeakersOnDRAgent , <EOL> self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> return parser <EOL> def call_server ( self , neutron_client , search_opts , parsed_args ) : <EOL> data = neutron_client . list_bgp_speaker_on_dragent ( <EOL> parsed_args . dragent_id , ** search_opts ) <EOL> return data <EOL> class ListDRAgentsHostingBGPSpeaker ( neutronV20 . ListCommand ) : <EOL> """<STR_LIT>""" <EOL> resource = '<STR_LIT>' <EOL> _formatters = { } <EOL> list_columns = [ '<STR_LIT:id>' , '<STR_LIT:host>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> unknown_parts_flag = False <EOL> def get_parser ( self , prog_name ) : <EOL> parser = super ( ListDRAgentsHostingBGPSpeaker , <EOL> self ) . get_parser ( prog_name ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' , <EOL> help = _ ( '<STR_LIT>' ) ) <EOL> return parser <EOL> def extend_list ( self , data , parsed_args ) : <EOL> for agent in data : <EOL> agent [ '<STR_LIT>' ] = "<STR_LIT>" if agent [ '<STR_LIT>' ] else '<STR_LIT>' <EOL> def call_server ( self , neutron_client , search_opts , parsed_args ) : <EOL> _speaker_id = bgp_speaker . get_bgp_speaker_id ( neutron_client , <EOL> parsed_args . bgp_speaker ) <EOL> search_opts [ '<STR_LIT>' ] = _speaker_id <EOL> data = neutron_client . list_dragents_hosting_bgp_speaker ( ** search_opts ) <EOL> return data </s>
