tools: Silly typo in regex for catching ip route syntax

Ticket: CM-14600
Reviewed By: CCR-5615
Testing Done: Verifying the issue with/without the fix

I had intended the regexp to catch both ip and ipv6 routes, but somewhere
along the way, I left out the grouping in the regexp to catch if it was
ip or ipv6 at the start. This caused all the rest of the matches and replaces
to be off causing the issue reported by the bug.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
This commit is contained in:
Dinesh G Dutt 2017-01-25 11:55:02 -08:00 committed by Donald Sharp
parent 659b52a845
commit 4d760f4255

View File

@ -181,16 +181,16 @@ class Config(object):
11.1.1.0/24. Ensure we don't do a needless operation for such
lines. IS-IS & OSPFv3 have no "network" support.
'''
re_key_rt = re.match(r'ip\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0])
re_key_rt = re.match(r'(ip|ipv6)\s+route\s+([A-Fa-f:.0-9/]+)(.*)$', key[0])
if re_key_rt:
addr = re_key_rt.group(2)
if '/' in addr:
try:
newaddr = IPNetwork(addr)
key[0] = 'ip %s %s/%s%s' % (re_key_rt.group(1),
newaddr.network,
newaddr.prefixlen,
re_key_rt.group(3))
key[0] = '%s route %s/%s%s' % (re_key_rt.group(1),
newaddr.network,
newaddr.prefixlen,
re_key_rt.group(3))
except ValueError:
pass