Merge "CLI support for disabling SNAT"

This commit is contained in:
Jenkins
2013-06-02 13:37:01 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 3 deletions

View File

@@ -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)

View File

@@ -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):