Merge "Add floating-ip-address to floatingip-create"
This commit is contained in:
@@ -61,6 +61,9 @@ class CreateFloatingIP(neutronV20.CreateCommand):
|
||||
parser.add_argument(
|
||||
'--fixed_ip_address',
|
||||
help=argparse.SUPPRESS)
|
||||
parser.add_argument(
|
||||
'--floating-ip-address',
|
||||
help=_('IP address of the floating IP'))
|
||||
|
||||
def args2body(self, parsed_args):
|
||||
_network_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
@@ -73,6 +76,9 @@ class CreateFloatingIP(neutronV20.CreateCommand):
|
||||
if parsed_args.fixed_ip_address:
|
||||
body[self.resource].update({'fixed_ip_address':
|
||||
parsed_args.fixed_ip_address})
|
||||
if parsed_args.floating_ip_address:
|
||||
body[self.resource].update({'floating_ip_address':
|
||||
parsed_args.floating_ip_address})
|
||||
return body
|
||||
|
||||
|
||||
|
@@ -71,6 +71,20 @@ class CLITestV20FloatingIpsJSON(test_cli20.CLITestV20Base):
|
||||
self._test_create_resource(resource, cmd, name, myid, args,
|
||||
position_names, position_values)
|
||||
|
||||
def test_create_floatingip_with_ip_address_of_floating_ip(self):
|
||||
"""Create floatingip: fip1 with a given IP address of floating IP."""
|
||||
resource = 'floatingip'
|
||||
cmd = fip.CreateFloatingIP(test_cli20.MyApp(sys.stdout), None)
|
||||
name = 'fip1'
|
||||
myid = 'myid'
|
||||
addr = '10.0.0.99'
|
||||
|
||||
args = [name, '--floating-ip-address', addr]
|
||||
position_values = [name, addr]
|
||||
position_names = ['floating_network_id', 'floating_ip_address']
|
||||
self._test_create_resource(resource, cmd, name, myid, args,
|
||||
position_names, position_values)
|
||||
|
||||
def test_list_floatingips(self):
|
||||
"""list floatingips: -D."""
|
||||
resources = 'floatingips'
|
||||
|
Reference in New Issue
Block a user