Add SCTP support
Listener, pool and health-monitor objects now support SCTP protocol. Depends-On: https://review.opendev.org/#/c/738381/ Story: 2007884 Task: 40257 Change-Id: Ib92c9896b6bd397c7fda2658a0e710f1014877fb
This commit is contained in:
parent
898d0b747b
commit
78c08edf3d
|
@ -30,7 +30,7 @@ HTTP_METHODS = ['GET', 'POST', 'DELETE', 'PUT', 'HEAD', 'OPTIONS', 'PATCH',
|
|||
'CONNECT', 'TRACE']
|
||||
HTTP_VERSIONS = [1.0, 1.1]
|
||||
TYPE_CHOICES = ['PING', 'HTTP', 'TCP', 'HTTPS', 'TLS-HELLO',
|
||||
'UDP-CONNECT']
|
||||
'UDP-CONNECT', 'SCTP']
|
||||
|
||||
|
||||
class CreateHealthMonitor(command.ShowOne):
|
||||
|
|
|
@ -25,7 +25,7 @@ from octaviaclient.osc.v2 import constants as const
|
|||
from octaviaclient.osc.v2 import utils as v2_utils
|
||||
from octaviaclient.osc.v2 import validate
|
||||
|
||||
PROTOCOL_CHOICES = ['TCP', 'HTTP', 'HTTPS', 'TERMINATED_HTTPS', 'UDP']
|
||||
PROTOCOL_CHOICES = ['TCP', 'HTTP', 'HTTPS', 'TERMINATED_HTTPS', 'UDP', 'SCTP']
|
||||
CLIENT_AUTH_CHOICES = ['NONE', 'OPTIONAL', 'MANDATORY']
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ from octaviaclient.osc.v2 import constants as const
|
|||
from octaviaclient.osc.v2 import utils as v2_utils
|
||||
|
||||
PROTOCOL_CHOICES = ['TCP', 'HTTP', 'HTTPS', 'TERMINATED_HTTPS', 'PROXY',
|
||||
'UDP']
|
||||
'UDP', 'SCTP']
|
||||
ALGORITHM_CHOICES = ['SOURCE_IP', 'ROUND_ROBIN', 'LEAST_CONNECTIONS',
|
||||
'SOURCE_IP_PORT']
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ def check_l7rule_attrs(attrs):
|
|||
|
||||
# Handling these range validations here instead of "choices" as "choices" will
|
||||
# output every possible option in the error message.
|
||||
def _validate_TCPUDP_port_range(port_number, parameter_name):
|
||||
def _validate_TCP_UDP_SCTP_port_range(port_number, parameter_name):
|
||||
if (port_number < constants.MIN_PORT_NUMBER or
|
||||
port_number > constants.MAX_PORT_NUMBER):
|
||||
msg = ("Invalid input for field/attribute '{name}', Value: "
|
||||
|
@ -58,15 +58,17 @@ def _validate_TCPUDP_port_range(port_number, parameter_name):
|
|||
|
||||
def check_listener_attrs(attrs):
|
||||
if 'protocol_port' in attrs:
|
||||
_validate_TCPUDP_port_range(attrs['protocol_port'], 'protocol-port')
|
||||
_validate_TCP_UDP_SCTP_port_range(attrs['protocol_port'],
|
||||
'protocol-port')
|
||||
|
||||
|
||||
def check_member_attrs(attrs):
|
||||
if 'protocol_port' in attrs:
|
||||
_validate_TCPUDP_port_range(attrs['protocol_port'], 'protocol-port')
|
||||
_validate_TCP_UDP_SCTP_port_range(attrs['protocol_port'],
|
||||
'protocol-port')
|
||||
|
||||
if 'member_port' in attrs:
|
||||
_validate_TCPUDP_port_range(attrs['member_port'], 'member-port')
|
||||
_validate_TCP_UDP_SCTP_port_range(attrs['member_port'], 'member-port')
|
||||
|
||||
if 'weight' in attrs:
|
||||
if(attrs['weight'] < constants.MIN_WEIGHT or
|
||||
|
|
|
@ -75,19 +75,19 @@ class TestValidations(utils.TestCommand):
|
|||
exceptions.CommandError,
|
||||
validate.check_l7rule_attrs, attrs_dict)
|
||||
|
||||
def test_validate_TCPUDP_port_range(self):
|
||||
def test_validate_TCP_UDP_SCTP_port_range(self):
|
||||
# Positive tests, should not raise
|
||||
validate._validate_TCPUDP_port_range(constants.MIN_PORT_NUMBER,
|
||||
"fake-parameter")
|
||||
validate._validate_TCPUDP_port_range(constants.MAX_PORT_NUMBER,
|
||||
"fake-parameter")
|
||||
validate._validate_TCP_UDP_SCTP_port_range(constants.MIN_PORT_NUMBER,
|
||||
"fake-parameter")
|
||||
validate._validate_TCP_UDP_SCTP_port_range(constants.MAX_PORT_NUMBER,
|
||||
"fake-parameter")
|
||||
|
||||
# Negative tests, should raise
|
||||
self.assertRaises(exceptions.InvalidValue,
|
||||
validate._validate_TCPUDP_port_range,
|
||||
validate._validate_TCP_UDP_SCTP_port_range,
|
||||
constants.MIN_PORT_NUMBER - 1, "fake-parameter")
|
||||
self.assertRaises(exceptions.InvalidValue,
|
||||
validate._validate_TCPUDP_port_range,
|
||||
validate._validate_TCP_UDP_SCTP_port_range,
|
||||
constants.MAX_PORT_NUMBER + 1, "fake-parameter")
|
||||
|
||||
def test_check_listener_attrs(self):
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Add support for SCTP protocol in listener, pool and health-monitor objects.
|
Loading…
Reference in New Issue