Don't allow an empty-string Route Target

Somehow there was a mixup confusing allowing an empty list
of route targets (which is ok), and allowing a route target string to be
empty (which is not).

Change-Id: Idb97459c6d37ce027b6fef4f15883017120095e2
Closes-Bug: 1717233
This commit is contained in:
Thomas Morin 2017-09-14 11:12:46 -06:00
parent 342ad9b38a
commit b309cadca1
2 changed files with 8 additions and 6 deletions

View File

@ -16,8 +16,6 @@ from neutron_lib.api import converters
from neutron_lib.api.definitions import l3
from neutron_lib.db import constants as db_const
# Regular expression to validate an empty string
EMPTY_REGEX = (r'^$')
# Regular expression to validate 32 bits unsigned int
UINT32_REGEX = (r'(0|[1-9]\d{0,8}|[1-3]\d{9}|4[01]\d{8}|42[0-8]\d{7}'
r'|429[0-3]\d{6}|4294[0-8]\d{5}|42949[0-5]\d{4}'
@ -34,10 +32,9 @@ IP4_REGEX = (r'(%s\.%s\.%s\.%s)') % (UINT8_REGEX, UINT8_REGEX, UINT8_REGEX,
# Regular expression to validate Route Target list format
# Support of the Type 0, Type 1 and Type 2, cf. chapter 4.2 in RFC 4364
# Also validates Route Distinguisher list format
RTRD_REGEX = (r'%s|^(%s:%s|%s:%s|%s:%s)$') % (EMPTY_REGEX, UINT16_REGEX,
UINT32_REGEX, IP4_REGEX,
UINT16_REGEX, UINT32_REGEX,
UINT16_REGEX)
RTRD_REGEX = (r'^(%s:%s|%s:%s|%s:%s)$') % (UINT16_REGEX, UINT32_REGEX,
IP4_REGEX, UINT16_REGEX,
UINT32_REGEX, UINT16_REGEX)
# The alias of the extension.
ALIAS = 'bgpvpn'

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes BGPVPN Interconnection API to not allow the definition of an empty
string Route Target (allowing it was simply wrong and unintentional).