Browse Source

Add timeout options to listener resource

This commit adds timeout_client_data, timeout_member_connect,
timeout_member_data, timeout_tcp_inspect to `listener create` and
`listener set`.

Story: 1457556
Task: 12487
Change-Id: I495fcbcc395f1c7314943fcdcd4d300b192913e8
changes/07/570007/5
Michał Dulko 3 years ago
committed by Michael Johnson
parent
commit
5b2c89f3a6
6 changed files with 104 additions and 1 deletions
  1. +4
    -0
      octaviaclient/osc/v2/constants.py
  2. +56
    -0
      octaviaclient/osc/v2/listener.py
  3. +5
    -1
      octaviaclient/osc/v2/utils.py
  4. +4
    -0
      octaviaclient/tests/unit/osc/v2/constants.py
  5. +27
    -0
      octaviaclient/tests/unit/osc/v2/test_listener.py
  6. +8
    -0
      releasenotes/notes/exposed-timeouts-eb29f55de5e56261.yaml

+ 4
- 0
octaviaclient/osc/v2/constants.py View File

@ -66,6 +66,10 @@ LISTENER_ROWS = (
'protocol_port',
'provisioning_status',
'sni_container_refs',
'timeout_client_data',
'timeout_member_connect',
'timeout_member_data',
'timeout_tcp_inspect',
'updated_at')
LISTENER_COLUMNS = (


+ 56
- 0
octaviaclient/osc/v2/listener.py View File

@ -94,6 +94,34 @@ class CreateListener(command.ShowOne):
required=True,
help="Set the protocol port number for the listener."
)
parser.add_argument(
'--timeout-client-data',
type=int,
metavar='<timeout>',
help="Frontend client inactivity timeout in milliseconds. "
"Default: 50000."
)
parser.add_argument(
'--timeout-member-connect',
type=int,
metavar='<timeout>',
help="Backend member connection timeout in milliseconds. "
"Default: 5000."
)
parser.add_argument(
'--timeout-member-data',
type=int,
metavar='<timeout>',
help="Backend member inactivity timeout in milliseconds. "
"Default: 50000."
)
parser.add_argument(
'--timeout-tcp-inspect',
type=int,
metavar='<timeout>',
help="Time, in milliseconds, to wait for additional TCP packets "
"for content inspection. Default: 0."
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',
@ -289,6 +317,34 @@ class SetListener(command.Command):
help="A dictionary of optional headers to insert into the request "
"before it is sent to the backend member."
)
parser.add_argument(
'--timeout-client-data',
type=int,
metavar='<timeout>',
help="Frontend client inactivity timeout in milliseconds. "
"Default: 50000."
)
parser.add_argument(
'--timeout-member-connect',
type=int,
metavar='<timeout>',
help="Backend member connection timeout in milliseconds. "
"Default: 5000."
)
parser.add_argument(
'--timeout-member-data',
type=int,
metavar='<timeout>',
help="Backend member inactivity timeout in milliseconds. "
"Default: 50000."
)
parser.add_argument(
'--timeout-tcp-inspect',
type=int,
metavar='<timeout>',
help="Time, in milliseconds, to wait for additional TCP packets "
"for content inspection. Default: 0."
)
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
'--enable',


+ 5
- 1
octaviaclient/osc/v2/utils.py View File

@ -198,7 +198,11 @@ def get_listener_attrs(client_manager, parsed_args):
'disable': ('admin_state_up', lambda x: False),
'insert_headers': ('insert_headers', _format_kv),
'default_tls_container_ref': ('default_tls_container_ref', str),
'sni_container_refs': ('sni_container_refs', list)
'sni_container_refs': ('sni_container_refs', list),
'timeout_client_data': ('timeout_client_data', int),
'timeout_member_connect': ('timeout_member_connect', int),
'timeout_member_data': ('timeout_member_data', int),
'timeout_tcp_inspect': ('timeout_tcp_inspect', int),
}
_attrs = vars(parsed_args)


+ 4
- 0
octaviaclient/tests/unit/osc/v2/constants.py View File

@ -68,6 +68,10 @@ LISTENER_ATTRS = {
"default_tls_container_ref": uuidutils.generate_uuid(dashed=True),
"sni_container_refs": [uuidutils.generate_uuid(dashed=True),
uuidutils.generate_uuid(dashed=True)],
"timeout_client_data": 50000,
"timeout_member_connect": 5000,
"timeout_member_data": 50000,
"timeout_tcp_inspect": 0,
}
LOADBALANCER_ATTRS = {


+ 27
- 0
octaviaclient/tests/unit/osc/v2/test_listener.py View File

@ -154,6 +154,33 @@ class TestListenerCreate(TestListener):
self.api_mock.listener_create.assert_called_with(
json={'listener': self.listener_info})
@mock.patch('octaviaclient.osc.v2.utils.get_listener_attrs')
def test_listener_create_timeouts(self, mock_client):
mock_client.return_value = self.listener_info
arglist = ['mock_lb_id',
'--name', self._listener.name,
'--protocol', 'HTTP',
'--protocol-port', '80',
'--timeout-client-data', '123',
'--timeout-member-connect', '234',
'--timeout-member-data', '345',
'--timeout-tcp-inspect', '456']
verifylist = [
('loadbalancer', 'mock_lb_id'),
('name', self._listener.name),
('protocol', 'HTTP'),
('protocol_port', '80'),
('timeout_client_data', 123),
('timeout_member_connect', 234),
('timeout_member_data', 345),
('timeout_tcp_inspect', 456),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.api_mock.listener_create.assert_called_with(
json={'listener': self.listener_info})
class TestListenerShow(TestListener):


+ 8
- 0
releasenotes/notes/exposed-timeouts-eb29f55de5e56261.yaml View File

@ -0,0 +1,8 @@
---
features:
- |
Added ``--timeout-client-data``, ``--timeout-member-connect``,
``--timeout-member-data`` and ``--timeout-tcp-inspect`` options to
``listener create`` and ``listener set`` commands. Those options control
the connection, inactivity and content inspection timeouts on the load
balancer.

Loading…
Cancel
Save