Merge "Enhance the help info of "neutron router-gateway-set""

This commit is contained in:
Jenkins
2016-01-13 00:58:46 +00:00
committed by Gerrit Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -226,9 +226,12 @@ class SetGatewayRouter(neutronV20.NeutronCommand):
'--disable-snat', action='store_true',
help=_('Disable source NAT on the router gateway.'))
parser.add_argument(
'--fixed-ip', action='append',
'--fixed-ip', metavar='subnet_id=SUBNET,ip_address=IP_ADDR',
action='append',
help=_('Desired IP and/or subnet on external network: '
'subnet_id=<name_or_id>,ip_address=<ip>. '
'You can specify both of subnet_id and ip_address or '
'specify one of them as well. '
'You can repeat this option.'))
return parser

View File

@@ -383,6 +383,21 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
{"subnet_id": "mysubnet"}]}}
)
def test_set_gateway_external_ip_and_subnet(self):
# set external gateway for router: myid externalid --fixed-ip ...
resource = 'router'
cmd = router.SetGatewayRouter(test_cli20.MyApp(sys.stdout), None)
args = ['myid', 'externalid', '--fixed-ip',
'ip_address=10.0.0.2,subnet_id=mysubnet']
self._test_update_resource(resource, cmd, 'myid',
args,
{"external_gateway_info":
{"network_id": "externalid",
"external_fixed_ips": [
{"subnet_id": "mysubnet",
"ip_address": "10.0.0.2"}]}}
)
def test_remove_gateway(self):
# Remove external gateway from router: externalid.
resource = 'router'