1313
1414"""IP Floating action implementations"""
1515
16+ import logging
17+
1618from osc_lib import utils
1719
1820from openstackclient .i18n import _
@@ -31,25 +33,26 @@ def _get_attrs(client_manager, parsed_args):
3133 attrs = {}
3234 network_client = client_manager .network
3335
36+ # Name of a network could be empty string.
3437 if parsed_args .network is not None :
3538 network = network_client .find_network (parsed_args .network ,
3639 ignore_missing = False )
3740 attrs ['floating_network_id' ] = network .id
3841
39- if parsed_args .subnet is not None :
42+ if parsed_args .subnet :
4043 subnet = network_client .find_subnet (parsed_args .subnet ,
4144 ignore_missing = False )
4245 attrs ['subnet_id' ] = subnet .id
4346
44- if parsed_args .port is not None :
47+ if parsed_args .port :
4548 port = network_client .find_port (parsed_args .port ,
4649 ignore_missing = False )
4750 attrs ['port_id' ] = port .id
4851
49- if parsed_args .floating_ip_address is not None :
52+ if parsed_args .floating_ip_address :
5053 attrs ['floating_ip_address' ] = parsed_args .floating_ip_address
5154
52- if parsed_args .fixed_ip_address is not None :
55+ if parsed_args .fixed_ip_address :
5356 attrs ['fixed_ip_address' ] = parsed_args .fixed_ip_address
5457
5558 return attrs
@@ -110,6 +113,30 @@ def take_action_compute(self, client, parsed_args):
110113 return (columns , data )
111114
112115
116+ class CreateIPFloating (CreateFloatingIP ):
117+ """Create floating IP"""
118+
119+ # TODO(tangchen): Remove this class and ``ip floating create`` command
120+ # two cycles after Mitaka.
121+
122+ # This notifies cliff to not display the help for this command
123+ deprecated = True
124+
125+ log = logging .getLogger ('deprecated' )
126+
127+ def take_action_network (self , client , parsed_args ):
128+ self .log .warning (_ ('This command has been deprecated. '
129+ 'Please use "floating ip create" instead.' ))
130+ return super (CreateIPFloating , self ).take_action_network (
131+ client , parsed_args )
132+
133+ def take_action_compute (self , client , parsed_args ):
134+ self .log .warning (_ ('This command has been deprecated. '
135+ 'Please use "floating ip create" instead.' ))
136+ return super (CreateIPFloating , self ).take_action_compute (
137+ client , parsed_args )
138+
139+
113140class DeleteFloatingIP (common .NetworkAndComputeDelete ):
114141 """Delete floating IP(s)"""
115142
@@ -135,6 +162,30 @@ def take_action_compute(self, client, parsed_args):
135162 client .floating_ips .delete (obj .id )
136163
137164
165+ class DeleteIPFloating (DeleteFloatingIP ):
166+ """Delete floating IP(s)"""
167+
168+ # TODO(tangchen): Remove this class and ``ip floating delete`` command
169+ # two cycles after Mitaka.
170+
171+ # This notifies cliff to not display the help for this command
172+ deprecated = True
173+
174+ log = logging .getLogger ('deprecated' )
175+
176+ def take_action_network (self , client , parsed_args ):
177+ self .log .warning (_ ('This command has been deprecated. '
178+ 'Please use "floating ip delete" instead.' ))
179+ return super (DeleteIPFloating , self ).take_action_network (
180+ client , parsed_args )
181+
182+ def take_action_compute (self , client , parsed_args ):
183+ self .log .warning (_ ('This command has been deprecated. '
184+ 'Please use "floating ip delete" instead.' ))
185+ return super (DeleteIPFloating , self ).take_action_compute (
186+ client , parsed_args )
187+
188+
138189class ListFloatingIP (common .NetworkAndComputeLister ):
139190 """List floating IP(s)"""
140191
@@ -186,8 +237,32 @@ def take_action_compute(self, client, parsed_args):
186237 ) for s in data ))
187238
188239
240+ class ListIPFloating (ListFloatingIP ):
241+ """List floating IP(s)"""
242+
243+ # TODO(tangchen): Remove this class and ``ip floating list`` command
244+ # two cycles after Mitaka.
245+
246+ # This notifies cliff to not display the help for this command
247+ deprecated = True
248+
249+ log = logging .getLogger ('deprecated' )
250+
251+ def take_action_network (self , client , parsed_args ):
252+ self .log .warning (_ ('This command has been deprecated. '
253+ 'Please use "floating ip list" instead.' ))
254+ return super (ListIPFloating , self ).take_action_network (
255+ client , parsed_args )
256+
257+ def take_action_compute (self , client , parsed_args ):
258+ self .log .warning (_ ('This command has been deprecated. '
259+ 'Please use "floating ip list" instead.' ))
260+ return super (ListIPFloating , self ).take_action_compute (
261+ client , parsed_args )
262+
263+
189264class ShowFloatingIP (common .NetworkAndComputeShowOne ):
190- """Show floating IP details"""
265+ """Display floating IP details"""
191266
192267 def update_parser_common (self , parser ):
193268 parser .add_argument (
@@ -211,3 +286,27 @@ def take_action_compute(self, client, parsed_args):
211286 columns = _get_columns (obj ._info )
212287 data = utils .get_dict_properties (obj ._info , columns )
213288 return (columns , data )
289+
290+
291+ class ShowIPFloating (ShowFloatingIP ):
292+ """Display floating IP details"""
293+
294+ # TODO(tangchen): Remove this class and ``ip floating show`` command
295+ # two cycles after Mitaka.
296+
297+ # This notifies cliff to not display the help for this command
298+ deprecated = True
299+
300+ log = logging .getLogger ('deprecated' )
301+
302+ def take_action_network (self , client , parsed_args ):
303+ self .log .warning (_ ('This command has been deprecated. '
304+ 'Please use "floating ip show" instead.' ))
305+ return super (ShowIPFloating , self ).take_action_network (
306+ client , parsed_args )
307+
308+ def take_action_compute (self , client , parsed_args ):
309+ self .log .warning (_ ('This command has been deprecated. '
310+ 'Please use "floating ip show" instead.' ))
311+ return super (ShowIPFloating , self ).take_action_compute (
312+ client , parsed_args )
0 commit comments