diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index b44301533..21170ffa1 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -99,9 +99,9 @@ def _get_external_gateway_attrs(client_manager, parsed_args): gateway_info['enable_snat'] = False if parsed_args.enable_snat: gateway_info['enable_snat'] = True - if parsed_args.fixed_ip: + if parsed_args.fixed_ips: ips = [] - for ip_spec in parsed_args.fixed_ip: + for ip_spec in parsed_args.fixed_ips: if ip_spec.get('subnet', False): subnet_name_id = ip_spec.pop('subnet') if subnet_name_id: @@ -379,6 +379,7 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs): metavar='subnet=,ip-address=', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], + dest='fixed_ips', help=_( "Desired IP and/or subnet (name or ID) " "on external gateway: " @@ -449,7 +450,7 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs): if ( parsed_args.disable_snat or parsed_args.enable_snat - or parsed_args.fixed_ip + or parsed_args.fixed_ips ) and not parsed_args.external_gateway: msg = _( "You must specify '--external-gateway' in order " @@ -797,6 +798,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs): metavar='subnet=,ip-address=', action=parseractions.MultiKeyValueAction, optional_keys=['subnet', 'ip-address'], + dest='fixed_ips', help=_( "Desired IP and/or subnet (name or ID) " "on external gateway: " @@ -870,7 +872,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs): if ( parsed_args.disable_snat or parsed_args.enable_snat - or parsed_args.fixed_ip + or parsed_args.fixed_ips ) and not parsed_args.external_gateway: msg = _( "You must specify '--external-gateway' in order " diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py index 9935db4d9..fb12e3f09 100644 --- a/openstackclient/tests/unit/network/v2/test_router.py +++ b/openstackclient/tests/unit/network/v2/test_router.py @@ -230,7 +230,7 @@ class TestCreateRouter(TestRouter): ('ha', False), ('external_gateway', _network.name), ('enable_snat', True), - ('fixed_ip', [{'ip-address': '2001:db8::1'}]), + ('fixed_ips', [{'ip-address': '2001:db8::1'}]), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -1297,7 +1297,7 @@ class TestSetRouter(TestRouter): self._router.id, ] verifylist = [ - ('fixed_ip', [{'subnet': "'abc'"}]), + ('fixed_ips', [{'subnet': "'abc'"}]), ('router', self._router.id), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -1336,7 +1336,7 @@ class TestSetRouter(TestRouter): verifylist = [ ('router', self._router.id), ('external_gateway', self._network.id), - ('fixed_ip', [{'subnet': "'abc'"}]), + ('fixed_ips', [{'subnet': "'abc'"}]), ('enable_snat', True), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -1370,7 +1370,7 @@ class TestSetRouter(TestRouter): verifylist = [ ('router', self._router.id), ('external_gateway', self._network.id), - ('fixed_ip', [{'ip-address': "10.0.1.1"}]), + ('fixed_ips', [{'ip-address': "10.0.1.1"}]), ('enable_snat', True), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -1404,7 +1404,7 @@ class TestSetRouter(TestRouter): verifylist = [ ('router', self._router.id), ('external_gateway', self._network.id), - ('fixed_ip', [{'subnet': "'abc'", 'ip-address': "10.0.1.1"}]), + ('fixed_ips', [{'subnet': "'abc'", 'ip-address': "10.0.1.1"}]), ('enable_snat', True), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist)