From 0b1840a2098912ebf897b84da7c302854056fce7 Mon Sep 17 00:00:00 2001 From: Roey Chen Date: Wed, 19 Jul 2017 05:26:57 -0700 Subject: [PATCH] NSXv BGP: Fix bgp-peer esg-id validation Change-Id: I93685568a80ac056cbb8c41fd9e7011e0da8aaea --- vmware_nsx/extensions/edge_service_gateway_bgp_peer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmware_nsx/extensions/edge_service_gateway_bgp_peer.py b/vmware_nsx/extensions/edge_service_gateway_bgp_peer.py index 4901630cd7..0de8085d9e 100644 --- a/vmware_nsx/extensions/edge_service_gateway_bgp_peer.py +++ b/vmware_nsx/extensions/edge_service_gateway_bgp_peer.py @@ -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