NSX|V: Issue proper error on UDP listeners

Change-Id: I04b7345135c168840843eab633f4015f14d4f74f
This commit is contained in:
asarfaty 2020-11-23 15:49:02 +02:00
parent 1ed3a3a895
commit e6c38616cd

View File

@ -19,6 +19,8 @@ from oslo_log import helpers as log_helpers
from oslo_log import log as logging
from oslo_utils import excutils
from neutron_lib import exceptions as n_exc
from vmware_nsx._i18n import _
from vmware_nsx.common import exceptions as nsxv_exc
from vmware_nsx.common import locking
@ -159,6 +161,14 @@ class EdgeListenerManagerFromDict(base_mgr.EdgeLoadbalancerBaseManager):
context.session, lb_id)
edge_id = lb_binding['edge_id']
# Validate the listener protocol
if (listener.get('protocol') and
listener['protocol'] not in lb_const.PROTOCOL_MAP):
completor(success=False)
msg = (_("Listener protocol %s is not supported") %
listener['protocol'])
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
if listener.get('default_pool') and listener['default_pool'].get('id'):
pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(
context.session, lb_id, listener['default_pool']['id'])