L3: prevent associating a FIP to a DHCP port

We should not allow a floating IP to be assigned to a DHCP port.

Change-Id: I6bf940b6e9195dc7d99e13fbe4454b08488cab0f
Closes-bug: #1739071
This commit is contained in:
Gary Kotton
2017-12-19 07:09:42 -08:00
committed by garyk
parent 569b51483b
commit bab1ae8812
4 changed files with 40 additions and 0 deletions

View File

@@ -204,6 +204,15 @@ def is_dvr_serviced(device_owner):
device_owner in get_other_dvr_serviced_device_owners())
def is_fip_serviced(device_owner):
"""Check if the port can be assigned a floating IP
Helper function to check the device owner of a
port can be assigned a floating IP.
"""
return device_owner != n_const.DEVICE_OWNER_DHCP
def ip_to_cidr(ip, prefix=None):
"""Convert an ip with no prefix to cidr notation