NSXv BGP: Fix bgp-peer esg-id validation

Change-Id: I93685568a80ac056cbb8c41fd9e7011e0da8aaea
This commit is contained in:
Roey Chen 2017-07-19 05:26:57 -07:00
parent d5f933120a
commit 0b1840a209

View File

@ -26,10 +26,12 @@ ESG_BGP_PEER_EXT_ALIAS = 'edge-service-gateway-bgp-peer'
def _validate_edge_service_gw_id(esg_id, valid_values=None):
if esg_id is None:
return
msg = validators.validate_string(esg_id, max_len=EDGE_ID_MAX_LEN)
if msg:
return msg
if esg_id and re.match(r'^edge-[1-9]+[0-9]*$', esg_id) is None:
if re.match(r'^edge-[1-9]+[0-9]*$', esg_id) is None:
msg = _("'%s' is not a valid edge service gateway id.") % esg_id
return msg