Merge "Enable to create legacy router"
This commit is contained in:
commit
27f96a3a7a
@ -64,7 +64,7 @@ Create new router
|
|||||||
[--project <project> [--project-domain <project-domain>]]
|
[--project <project> [--project-domain <project-domain>]]
|
||||||
[--enable | --disable]
|
[--enable | --disable]
|
||||||
[--distributed]
|
[--distributed]
|
||||||
[--ha]
|
[--ha | --no-ha]
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
[--availability-zone-hint <availability-zone>]
|
[--availability-zone-hint <availability-zone>]
|
||||||
<name>
|
<name>
|
||||||
@ -94,6 +94,10 @@ Create new router
|
|||||||
|
|
||||||
Create a highly available router
|
Create a highly available router
|
||||||
|
|
||||||
|
.. option:: --no-ha
|
||||||
|
|
||||||
|
Create a legacy router
|
||||||
|
|
||||||
.. option:: --description <description>
|
.. option:: --description <description>
|
||||||
|
|
||||||
Set router description
|
Set router description
|
||||||
|
@ -183,11 +183,17 @@ class CreateRouter(command.ShowOne):
|
|||||||
default=False,
|
default=False,
|
||||||
help=_("Create a distributed router")
|
help=_("Create a distributed router")
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
ha_group = parser.add_mutually_exclusive_group()
|
||||||
|
ha_group.add_argument(
|
||||||
'--ha',
|
'--ha',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help=_("Create a highly available router")
|
help=_("Create a highly available router")
|
||||||
)
|
)
|
||||||
|
ha_group.add_argument(
|
||||||
|
'--no-ha',
|
||||||
|
action='store_true',
|
||||||
|
help=_("Create a legacy router")
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
metavar='<description>',
|
metavar='<description>',
|
||||||
@ -216,7 +222,9 @@ class CreateRouter(command.ShowOne):
|
|||||||
|
|
||||||
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
||||||
if parsed_args.ha:
|
if parsed_args.ha:
|
||||||
attrs['ha'] = parsed_args.ha
|
attrs['ha'] = True
|
||||||
|
if parsed_args.no_ha:
|
||||||
|
attrs['ha'] = False
|
||||||
obj = client.create_router(**attrs)
|
obj = client.create_router(**attrs)
|
||||||
|
|
||||||
display_columns, columns = _get_columns(obj)
|
display_columns, columns = _get_columns(obj)
|
||||||
|
@ -181,16 +181,17 @@ class TestCreateRouter(TestRouter):
|
|||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, data)
|
self.assertEqual(self.data, data)
|
||||||
|
|
||||||
def test_create_with_ha_option(self):
|
def _test_create_with_ha_options(self, option, ha):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--ha',
|
option,
|
||||||
self.new_router.name,
|
self.new_router.name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('name', self.new_router.name),
|
('name', self.new_router.name),
|
||||||
('enable', True),
|
('enable', True),
|
||||||
('distributed', False),
|
('distributed', False),
|
||||||
('ha', True),
|
('ha', ha),
|
||||||
|
('no_ha', not ha),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -199,11 +200,17 @@ class TestCreateRouter(TestRouter):
|
|||||||
self.network.create_router.assert_called_once_with(**{
|
self.network.create_router.assert_called_once_with(**{
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'name': self.new_router.name,
|
'name': self.new_router.name,
|
||||||
'ha': True,
|
'ha': ha,
|
||||||
})
|
})
|
||||||
self.assertEqual(self.columns, columns)
|
self.assertEqual(self.columns, columns)
|
||||||
self.assertEqual(self.data, data)
|
self.assertEqual(self.data, data)
|
||||||
|
|
||||||
|
def test_create_with_ha_option(self):
|
||||||
|
self._test_create_with_ha_options('--ha', True)
|
||||||
|
|
||||||
|
def test_create_with_no_ha_option(self):
|
||||||
|
self._test_create_with_ha_options('--no-ha', False)
|
||||||
|
|
||||||
def test_create_with_AZ_hints(self):
|
def test_create_with_AZ_hints(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self.new_router.name,
|
self.new_router.name,
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add ``--no-ha`` option to the ``router create`` command
|
||||||
|
[Bug `1675514 <https://bugs.launchpad.net/python-openstackclient/+bug/1675514>`_]
|
Loading…
Reference in New Issue
Block a user