Assert that IPv6 ctlplane networks should be /64

We're using statless addressing for the ctlplane with requires
a /64 network.

Change-Id: Ic70b70f1363b97ab7b9e6c671f3106ce350a08a8
This commit is contained in:
Derek Higgins 2017-09-06 12:10:58 +01:00
parent 7dd3434afe
commit 78dd7240cc
1 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,10 @@ def _validate_value_formats(params, error_callback):
local_ip = netaddr.IPNetwork(params['local_ip'])
if local_ip.prefixlen == 32:
raise netaddr.AddrFormatError('Invalid netmask')
# If IPv6 the ctlplane network uses the EUI-64 address format,
# which requires the prefix to be /64
if local_ip.version == 6 and local_ip.prefixlen != 64:
raise netaddr.AddrFormatError('Prefix must be 64 for IPv6')
except netaddr.core.AddrFormatError as e:
message = ('local_ip "%s" not valid: "%s" '
'Value must be in CIDR format.' %