Add --ha option to os router create command
This patch added --ha option which the 'os router create' command was missed. Change-Id: I77635fb17af32beb0d8ed9aa080ef79285719fdc Closes-Bug: #1610161
This commit is contained in:
parent
15069ef50e
commit
e2fc436d53
@ -63,7 +63,7 @@ Create new router
|
|||||||
os router create
|
os router create
|
||||||
[--project <project> [--project-domain <project-domain>]]
|
[--project <project> [--project-domain <project-domain>]]
|
||||||
[--enable | --disable]
|
[--enable | --disable]
|
||||||
[--distributed]
|
[--distributed] [--ha]
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
[--availability-zone-hint <availability-zone>]
|
[--availability-zone-hint <availability-zone>]
|
||||||
<name>
|
<name>
|
||||||
@ -89,6 +89,10 @@ Create new router
|
|||||||
|
|
||||||
Create a distributed router
|
Create a distributed router
|
||||||
|
|
||||||
|
.. option:: --ha
|
||||||
|
|
||||||
|
Create a highly available router
|
||||||
|
|
||||||
.. option:: --description <description>
|
.. option:: --description <description>
|
||||||
|
|
||||||
Set router description
|
Set router description
|
||||||
|
@ -94,7 +94,6 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
).id
|
).id
|
||||||
attrs['tenant_id'] = project_id
|
attrs['tenant_id'] = project_id
|
||||||
|
|
||||||
# TODO(tangchen): Support getting 'ha' property.
|
|
||||||
# TODO(tangchen): Support getting 'external_gateway_info' property.
|
# TODO(tangchen): Support getting 'external_gateway_info' property.
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
@ -180,10 +179,15 @@ class CreateRouter(command.ShowOne):
|
|||||||
default=False,
|
default=False,
|
||||||
help=_("Create a distributed router")
|
help=_("Create a distributed router")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--ha',
|
||||||
|
action='store_true',
|
||||||
|
help=_("Create a highly available router")
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--description',
|
'--description',
|
||||||
metavar='<description>',
|
metavar='<description>',
|
||||||
help=_('Set router description')
|
help=_("Set router description")
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
@ -207,6 +211,8 @@ class CreateRouter(command.ShowOne):
|
|||||||
client = self.app.client_manager.network
|
client = self.app.client_manager.network
|
||||||
|
|
||||||
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
||||||
|
if parsed_args.ha:
|
||||||
|
attrs['ha'] = parsed_args.ha
|
||||||
obj = client.create_router(**attrs)
|
obj = client.create_router(**attrs)
|
||||||
|
|
||||||
columns = _get_columns(obj)
|
columns = _get_columns(obj)
|
||||||
|
@ -166,6 +166,7 @@ class TestCreateRouter(TestRouter):
|
|||||||
('name', self.new_router.name),
|
('name', self.new_router.name),
|
||||||
('enable', True),
|
('enable', True),
|
||||||
('distributed', False),
|
('distributed', False),
|
||||||
|
('ha', False),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -178,6 +179,29 @@ 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):
|
||||||
|
arglist = [
|
||||||
|
'--ha',
|
||||||
|
self.new_router.name,
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('name', self.new_router.name),
|
||||||
|
('enable', True),
|
||||||
|
('distributed', False),
|
||||||
|
('ha', True),
|
||||||
|
]
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
columns, data = (self.cmd.take_action(parsed_args))
|
||||||
|
|
||||||
|
self.network.create_router.assert_called_once_with(**{
|
||||||
|
'admin_state_up': True,
|
||||||
|
'name': self.new_router.name,
|
||||||
|
'ha': True,
|
||||||
|
})
|
||||||
|
self.assertEqual(self.columns, columns)
|
||||||
|
self.assertEqual(self.data, data)
|
||||||
|
|
||||||
def test_create_with_AZ_hints(self):
|
def test_create_with_AZ_hints(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self.new_router.name,
|
self.new_router.name,
|
||||||
@ -189,6 +213,7 @@ class TestCreateRouter(TestRouter):
|
|||||||
('availability_zone_hints', ['fake-az', 'fake-az2']),
|
('availability_zone_hints', ['fake-az', 'fake-az2']),
|
||||||
('enable', True),
|
('enable', True),
|
||||||
('distributed', False),
|
('distributed', False),
|
||||||
|
('ha', False)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
5
releasenotes/notes/bug-1610161-7c34c7b735701bd4.yaml
Normal file
5
releasenotes/notes/bug-1610161-7c34c7b735701bd4.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add ``--ha`` option to ``router create`` command.
|
||||||
|
[Bug `1610161 <https://bugs.launchpad.net/bugs/1610161>`_]
|
Loading…
Reference in New Issue
Block a user