Add default IP version and fix help messages for "ip availability list"
There was not a default IP version in "ip availability list" command, if we used this command without "--ip-version" option, the output was different from the outputs with the option "--ip-version 4" and "--ip-version 6" and it is not right. This patch add default IP version (default is 4) in ``ip availability list`` command and make this command work properly without ``--ip-version`` option. And also fix the help message. Change-Id: Idc08ab6eaf05946eb2ab59bfb3d4497a383d987d Closes-Bug: #1592761
This commit is contained in:
parent
0ec711c640
commit
ca5e8e6c85
@ -25,7 +25,7 @@ number of allocated IP addresses from that pool.
|
|||||||
.. option:: --ip-version {4,6}
|
.. option:: --ip-version {4,6}
|
||||||
|
|
||||||
List IP availability of given IP version networks
|
List IP availability of given IP version networks
|
||||||
(Default is 4)
|
(default is 4)
|
||||||
|
|
||||||
.. option:: --project <project>
|
.. option:: --project <project>
|
||||||
|
|
||||||
|
@ -41,15 +41,17 @@ class ListIPAvailability(command.Lister):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--ip-version',
|
'--ip-version',
|
||||||
type=int,
|
type=int,
|
||||||
|
default=4,
|
||||||
choices=[4, 6],
|
choices=[4, 6],
|
||||||
metavar='<ip-version>',
|
metavar='<ip-version>',
|
||||||
dest='ip_version',
|
dest='ip_version',
|
||||||
help=_("List IP availability of given IP version networks"),
|
help=_("List IP availability of given IP version "
|
||||||
|
"networks (default is 4)"),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
help=_("List IP availability of given project"),
|
help=_("List IP availability of given project (name or ID)"),
|
||||||
)
|
)
|
||||||
identity_common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
return parser
|
return parser
|
||||||
|
@ -82,8 +82,10 @@ class TestListIPAvailability(TestIPAvailability):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
filters = {'ip_version': 4}
|
||||||
|
|
||||||
self.network.network_ip_availabilities.assert_called_once_with()
|
self.network.network_ip_availabilities.assert_called_once_with(
|
||||||
|
**filters)
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, list(data))
|
self.assertEqual(self.data, list(data))
|
||||||
|
|
||||||
@ -116,7 +118,8 @@ class TestListIPAvailability(TestIPAvailability):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
filters = {'tenant_id': identity_fakes.project_id}
|
filters = {'tenant_id': identity_fakes.project_id,
|
||||||
|
'ip_version': 4}
|
||||||
|
|
||||||
self.network.network_ip_availabilities.assert_called_once_with(
|
self.network.network_ip_availabilities.assert_called_once_with(
|
||||||
**filters)
|
**filters)
|
||||||
|
5
releasenotes/notes/bug-1592761-f45998453d6801f7.yaml
Normal file
5
releasenotes/notes/bug-1592761-f45998453d6801f7.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Add default IP version in ``ip availability list`` command and make
|
||||||
|
this command work properly without ``--ip-version`` option.
|
||||||
|
[Bug `1592761 <https://bugs.launchpad.net/bugs/1592761>`_]
|
Loading…
Reference in New Issue
Block a user