Merge "CLI support for disabling SNAT"
This commit is contained in:
@@ -166,6 +166,9 @@ class SetGatewayRouter(QuantumCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'external_network_id', metavar='external-network-id',
|
'external_network_id', metavar='external-network-id',
|
||||||
help='ID of the external network for the gateway')
|
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
|
return parser
|
||||||
|
|
||||||
def run(self, parsed_args):
|
def run(self, parsed_args):
|
||||||
@@ -176,8 +179,10 @@ class SetGatewayRouter(QuantumCommand):
|
|||||||
quantum_client, self.resource, parsed_args.router_id)
|
quantum_client, self.resource, parsed_args.router_id)
|
||||||
_ext_net_id = quantumv20.find_resourceid_by_name_or_id(
|
_ext_net_id = quantumv20.find_resourceid_by_name_or_id(
|
||||||
quantum_client, 'network', parsed_args.external_network_id)
|
quantum_client, 'network', parsed_args.external_network_id)
|
||||||
quantum_client.add_gateway_router(_router_id,
|
quantum_client.add_gateway_router(
|
||||||
{'network_id': _ext_net_id})
|
_router_id,
|
||||||
|
{'network_id': _ext_net_id,
|
||||||
|
'enable_snat': parsed_args.enable_snat})
|
||||||
print >>self.app.stdout, (
|
print >>self.app.stdout, (
|
||||||
_('Set gateway for router %s') % parsed_args.router_id)
|
_('Set gateway for router %s') % parsed_args.router_id)
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ class CLITestV20RouterJSON(CLITestV20Base):
|
|||||||
self._test_update_resource(resource, cmd, 'myid',
|
self._test_update_resource(resource, cmd, 'myid',
|
||||||
args,
|
args,
|
||||||
{"external_gateway_info":
|
{"external_gateway_info":
|
||||||
{"network_id": "externalid"}}
|
{"network_id": "externalid",
|
||||||
|
"enable_snat": True}}
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_remove_gateway(self):
|
def test_remove_gateway(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user