Fix listener creation allowing pool protocol
Listener can be created using proxy and proxyv2 protocol which are pool protocol and not listener protocol. Story: 2010220 Task: 45968 Change-Id: I0b8cf3cc8dbe5bc2babc469e73e32b2ed9ccb98a
This commit is contained in:
parent
e962401585
commit
05b4d36172
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from octavia_lib.common import constants as lib_constants
|
||||
from wsme import types as wtypes
|
||||
|
||||
from octavia.api.common import types
|
||||
@ -111,7 +112,8 @@ class ListenerPOST(BaseListenerType):
|
||||
name = wtypes.wsattr(wtypes.StringType(max_length=255))
|
||||
description = wtypes.wsattr(wtypes.StringType(max_length=255))
|
||||
admin_state_up = wtypes.wsattr(bool, default=True)
|
||||
protocol = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROTOCOLS),
|
||||
protocol = wtypes.wsattr(wtypes.Enum(str,
|
||||
*lib_constants.LISTENER_SUPPORTED_PROTOCOLS),
|
||||
mandatory=True)
|
||||
protocol_port = wtypes.wsattr(
|
||||
wtypes.IntegerType(minimum=constants.MIN_PORT_NUMBER,
|
||||
@ -205,7 +207,8 @@ class ListenerSingleCreate(BaseListenerType):
|
||||
name = wtypes.wsattr(wtypes.StringType(max_length=255))
|
||||
description = wtypes.wsattr(wtypes.StringType(max_length=255))
|
||||
admin_state_up = wtypes.wsattr(bool, default=True)
|
||||
protocol = wtypes.wsattr(wtypes.Enum(str, *constants.SUPPORTED_PROTOCOLS),
|
||||
protocol = wtypes.wsattr(wtypes.Enum(str,
|
||||
*lib_constants.LISTENER_SUPPORTED_PROTOCOLS),
|
||||
mandatory=True)
|
||||
protocol_port = wtypes.wsattr(
|
||||
wtypes.IntegerType(minimum=constants.MIN_PORT_NUMBER,
|
||||
|
@ -2240,6 +2240,11 @@ class TestListener(base.BaseAPITest):
|
||||
'protocol_port': 80}
|
||||
self.post(self.LISTENERS_PATH, lb_listener, status=400)
|
||||
|
||||
def test_create_listener_proxy_protocol(self):
|
||||
lb_listener = {'protocol': 'PROXY',
|
||||
'protocol_port': 80}
|
||||
self.post(self.LISTENERS_PATH, lb_listener, status=400)
|
||||
|
||||
def test_update_listener_bad_protocol(self):
|
||||
listener = self.create_listener(constants.PROTOCOL_TCP, 80, self.lb_id)
|
||||
self.set_lb_status(self.lb_id)
|
||||
@ -2767,10 +2772,6 @@ class TestListener(base.BaseAPITest):
|
||||
self._test_update_protocol_insert_headers_mismatch(
|
||||
constants.PROTOCOL_HTTPS)
|
||||
|
||||
def test_update_protocol_PROXY_insert_headers(self):
|
||||
self._test_update_protocol_insert_headers_mismatch(
|
||||
constants.PROTOCOL_PROXY)
|
||||
|
||||
def test_update_protocol_TCP_insert_headers(self):
|
||||
self._test_update_protocol_insert_headers_mismatch(
|
||||
constants.PROTOCOL_TCP)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes listener creation failure when protocol used is PROXY or PROXYV2
|
||||
which are pool protocol and not listener protocol.
|
Loading…
Reference in New Issue
Block a user