CLI support for disabling SNAT

blueprint l3-ext-gw-modes

Adds the --disable-snat option to the router-gateway-set command

Change-Id: I1e6e339e3332d7073f761f407318811f22d283b1
This commit is contained in:
Salvatore Orlando
2013-03-26 09:01:29 +01:00
parent eba4e345fc
commit 2815be00b0
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):