Fix port create with mac learning set to false

We should allow creating a port with mac_learning_enabled
set to false and port_security_enabled set to true.

Change-Id: I91aceb6eb05003497230a003f31db3cc8ee014b1
Closes-bug:#1943863
This commit is contained in:
Christopher Chu Lin 2017-08-22 19:13:43 -04:00
parent 0fb50b8089
commit 3da2ddf055

View File

@ -2174,7 +2174,9 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
if psgids:
sgids = list(set(sgids) | set(psgids))
self._extend_nsx_port_dict_binding(context, port_data)
if validators.is_attr_set(port_data.get(mac_ext.MAC_LEARNING)):
# Make sure mac_learning and port sec are not both enabled
if (validators.is_attr_set(port_data.get(mac_ext.MAC_LEARNING)) and
port_data.get(mac_ext.MAC_LEARNING)):
if is_psec_on:
msg = _('Mac learning requires that port security be '
'disabled')