Add enable_tls option into Pool CLI

This patch add a new option into Pool to enable or disable backend
re-encryption.

Change-Id: I5b4acc1d2025bd8d24e1efd753b6f96cc40fdf99
Story: 2003858
Task: 26680
Depends-On: https://review.openstack.org/#/c/624264/
This commit is contained in:
ZhaoBo 2018-12-11 11:02:29 +08:00 committed by Michael Johnson
parent be64125af7
commit 307f62bae0
5 changed files with 42 additions and 6 deletions

View File

@ -103,7 +103,8 @@ POOL_ROWS = (
'updated_at',
'tls_container_ref',
'ca_tls_container_ref',
'crl_container_ref')
'crl_container_ref',
'tls_enabled')
POOL_COLUMNS = (
'id',

View File

@ -108,6 +108,19 @@ class CreatePool(command.ShowOne):
"containting the CA revocation list file for ``tls_enabled`` "
"pools to validate the backend member servers certificates."
)
tls_enable = parser.add_mutually_exclusive_group()
tls_enable.add_argument(
'--enable-tls',
action='store_true',
default=None,
help="Enable backend member re-encryption."
)
tls_enable.add_argument(
'--disable-tls',
action='store_true',
default=None,
help="Disable backend member re-encryption."
)
return parser
@ -124,7 +137,8 @@ class CreatePool(command.ShowOne):
'session_persistence': v2_utils.format_hash}
return (rows, (utils.get_dict_properties(
data['pool'], rows, formatters=formatters)))
data['pool'], rows, formatters=formatters,
mixed_case_fields=['enable-tls'])))
class DeletePool(command.Command):
@ -204,7 +218,8 @@ class ShowPool(command.ShowOne):
'session_persistence': v2_utils.format_hash}
return (rows, (utils.get_dict_properties(
data, rows, formatters=formatters)))
data, rows, formatters=formatters,
mixed_case_fields=['enable-tls'])))
class SetPool(command.Command):
@ -276,6 +291,19 @@ class SetPool(command.Command):
"listeners to valid the backend servers certificates in ssl "
"traffic."
)
tls_enable = parser.add_mutually_exclusive_group()
tls_enable.add_argument(
'--enable-tls',
action='store_true',
default=None,
help="Enable backend associated members re-encryption."
)
tls_enable.add_argument(
'--disable-tls',
action='store_true',
default=None,
help="disable backend associated members re-encryption."
)
return parser

View File

@ -259,6 +259,9 @@ def get_pool_attrs(client_manager, parsed_args):
_format_str_if_need_treat_unset),
'crl_container_ref': ('crl_container_ref',
_format_str_if_need_treat_unset),
'enable_tls': ('tls_enabled', lambda x: True),
'disable_tls': ('tls_enabled', lambda x: False),
}
_attrs = vars(parsed_args)

View File

@ -149,7 +149,8 @@ POOL_ATTRS = {
"provisioning_status": "ACTIVE",
"tls_container_ref": uuidutils.generate_uuid(),
"ca_tls_container_ref": uuidutils.generate_uuid(),
"crl_container_ref": uuidutils.generate_uuid()
"crl_container_ref": uuidutils.generate_uuid(),
"tls_enabled": True
}
QUOTA_ATTRS = {

View File

@ -105,6 +105,7 @@ class TestPoolCreate(TestPool):
'--name', self._po.name,
'--protocol', 'HTTP',
'--lb-algorithm', 'ROUND_ROBIN',
'--enable-tls',
'--tls-container-ref', self._po.tls_container_ref,
'--ca-tls-container-ref', self._po.ca_tls_container_ref,
'--crl-container-ref', self._po.crl_container_ref]
@ -114,6 +115,7 @@ class TestPoolCreate(TestPool):
('name', self._po.name),
('protocol', 'HTTP'),
('lb_algorithm', 'ROUND_ROBIN'),
('enable_tls', self._po.tls_enabled),
('tls_container_ref', self._po.tls_container_ref),
('ca_tls_container_ref', self._po.ca_tls_container_ref),
('crl_container_ref', self._po.crl_container_ref)
@ -158,7 +160,7 @@ class TestPoolSet(TestPool):
'test-crl-container-id')
arglist = [self._po.id, '--name', 'new_name', '--tls-container-ref',
new_tls_id, '--ca-tls-container-ref', new_ca_id,
'--crl-container-ref', new_crl_id]
'--crl-container-ref', new_crl_id, '--enable-tls']
verifylist = [
('pool', self._po.id),
('name', 'new_name')
@ -169,4 +171,5 @@ class TestPoolSet(TestPool):
self._po.id, json={'pool': {'name': 'new_name',
'tls_container_ref': new_tls_id,
'ca_tls_container_ref': new_ca_id,
'crl_container_ref': new_crl_id}})
'crl_container_ref': new_crl_id,
'tls_enabled': True}})