diff --git a/quantumclient/quantum/v2_0/router.py b/quantumclient/quantum/v2_0/router.py index 3f8ed6c..cff4ace 100644 --- a/quantumclient/quantum/v2_0/router.py +++ b/quantumclient/quantum/v2_0/router.py @@ -166,6 +166,9 @@ class SetGatewayRouter(QuantumCommand): parser.add_argument( 'external_network_id', metavar='external-network-id', help='ID of the external network for the gateway') + parser.add_argument( + '--disable-snat', action='store_false', dest='enable_snat', + help='Disable Source NAT on the router gateway') return parser def run(self, parsed_args): @@ -176,8 +179,10 @@ class SetGatewayRouter(QuantumCommand): quantum_client, self.resource, parsed_args.router_id) _ext_net_id = quantumv20.find_resourceid_by_name_or_id( quantum_client, 'network', parsed_args.external_network_id) - quantum_client.add_gateway_router(_router_id, - {'network_id': _ext_net_id}) + quantum_client.add_gateway_router( + _router_id, + {'network_id': _ext_net_id, + 'enable_snat': parsed_args.enable_snat}) print >>self.app.stdout, ( _('Set gateway for router %s') % parsed_args.router_id) diff --git a/tests/unit/test_cli20_router.py b/tests/unit/test_cli20_router.py index 5c545d8..4868320 100644 --- a/tests/unit/test_cli20_router.py +++ b/tests/unit/test_cli20_router.py @@ -159,7 +159,8 @@ class CLITestV20RouterJSON(CLITestV20Base): self._test_update_resource(resource, cmd, 'myid', args, {"external_gateway_info": - {"network_id": "externalid"}} + {"network_id": "externalid", + "enable_snat": True}} ) def test_remove_gateway(self):