@@ -76,6 +76,16 @@ def _get_attrs(client_manager, parsed_args):
7676 parsed_args .availability_zone_hints is not None :
7777 attrs ['availability_zone_hints' ] = parsed_args .availability_zone_hints
7878
79+ # update_external_network_options
80+ if parsed_args .internal :
81+ attrs ['router:external' ] = False
82+ if parsed_args .external :
83+ attrs ['router:external' ] = True
84+ if parsed_args .no_default :
85+ attrs ['is_default' ] = False
86+ if parsed_args .default :
87+ attrs ['is_default' ] = True
88+
7989 return attrs
8090
8191
@@ -197,14 +207,6 @@ def update_parser_compute(self, parser):
197207
198208 def take_action_network (self , client , parsed_args ):
199209 attrs = _get_attrs (self .app .client_manager , parsed_args )
200- if parsed_args .internal :
201- attrs ['router:external' ] = False
202- if parsed_args .external :
203- attrs ['router:external' ] = True
204- if parsed_args .no_default :
205- attrs ['is_default' ] = False
206- if parsed_args .default :
207- attrs ['is_default' ] = True
208210 if parsed_args .provider_network_type :
209211 attrs ['provider:network_type' ] = parsed_args .provider_network_type
210212 if parsed_args .physical_network :
@@ -379,6 +381,26 @@ def get_parser(self, prog_name):
379381 action = 'store_true' ,
380382 help = 'Do not share the network between projects' ,
381383 )
384+ external_router_grp = parser .add_mutually_exclusive_group ()
385+ external_router_grp .add_argument (
386+ '--external' ,
387+ action = 'store_true' ,
388+ help = 'Set this network as an external network. '
389+ 'Requires the "external-net" extension to be enabled.' )
390+ external_router_grp .add_argument (
391+ '--internal' ,
392+ action = 'store_true' ,
393+ help = 'Set this network as an internal network' )
394+ default_router_grp = parser .add_mutually_exclusive_group ()
395+ default_router_grp .add_argument (
396+ '--default' ,
397+ action = 'store_true' ,
398+ help = 'Specify if this network should be used as '
399+ 'the default external network' )
400+ default_router_grp .add_argument (
401+ '--no-default' ,
402+ action = 'store_true' ,
403+ help = 'Do not use the network as the default external network.' )
382404 return parser
383405
384406 def take_action (self , parsed_args ):
0 commit comments