Handle ip name-server lines containing multiple nameservers (#32235)

In CSR, multiple nameservers are defined in one line, whereas on IOS
it's on multiple ones.
This change handles both.
This commit is contained in:
Ricardo Carrillo Cruz 2017-10-27 10:55:52 +02:00 committed by GitHub
parent d088b7ab93
commit 80c8b99a62

View file

@ -266,12 +266,13 @@ def parse_domain_search(config):
return matches
def parse_name_servers(config):
match = re.findall('^ip name-server (?:vrf (\S+) )*(\S+)', config, re.M)
match = re.findall('^ip name-server (?:vrf (\S+) )*(.*)', config, re.M)
matches = list()
for vrf, server in match:
for vrf, servers in match:
if not vrf:
vrf = None
matches.append({'server': server, 'vrf': vrf})
for server in servers.split():
matches.append({'server': server, 'vrf': vrf})
return matches
def parse_lookup_source(config):