From b309cadca102bc856165fcc159855b6df6e1611c Mon Sep 17 00:00:00 2001 From: Thomas Morin Date: Thu, 14 Sep 2017 11:12:46 -0600 Subject: [PATCH] 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 --- neutron_lib/api/definitions/bgpvpn.py | 9 +++------ releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml | 5 +++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml diff --git a/neutron_lib/api/definitions/bgpvpn.py b/neutron_lib/api/definitions/bgpvpn.py index 12ff5de0c..473677a56 100644 --- a/neutron_lib/api/definitions/bgpvpn.py +++ b/neutron_lib/api/definitions/bgpvpn.py @@ -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' diff --git a/releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml b/releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml new file mode 100644 index 000000000..9fbe2e701 --- /dev/null +++ b/releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml @@ -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).