ios_vrf speed fix (#43765)
This commit is contained in:
parent
1fac494d8c
commit
49f692b08f
1 changed files with 14 additions and 7 deletions
|
@ -405,12 +405,16 @@ def parse_rd(configobj, name):
|
|||
return match.group(1)
|
||||
|
||||
|
||||
def parse_interfaces(configobj, name):
|
||||
vrf_cfg = 'vrf forwarding %s' % name
|
||||
interfaces = list()
|
||||
for intf in re.findall('^interface .+', str(configobj), re.M):
|
||||
if vrf_cfg in '\n'.join(configobj[intf].children):
|
||||
interfaces.append(intf.split(' ')[1])
|
||||
def parse_interfaces(configobj):
|
||||
vrf_cfg = 'vrf forwarding'
|
||||
interfaces = dict()
|
||||
for intf in set(re.findall('^interface .+', str(configobj), re.M)):
|
||||
for line in configobj[intf].children:
|
||||
if vrf_cfg in line:
|
||||
try:
|
||||
interfaces[line.split()[-1]].append(intf.split(' ')[1])
|
||||
except KeyError:
|
||||
interfaces[line.split()[-1]] = [intf.split(' ')[1]]
|
||||
return interfaces
|
||||
|
||||
|
||||
|
@ -507,13 +511,16 @@ def map_config_to_obj(module):
|
|||
return list()
|
||||
|
||||
instances = list()
|
||||
|
||||
interfaces = parse_interfaces(configobj)
|
||||
|
||||
for item in set(match):
|
||||
obj = {
|
||||
'name': item,
|
||||
'state': 'present',
|
||||
'description': parse_description(configobj, item),
|
||||
'rd': parse_rd(configobj, item),
|
||||
'interfaces': parse_interfaces(configobj, item),
|
||||
'interfaces': interfaces.get(item),
|
||||
'route_import': parse_import(configobj, item),
|
||||
'route_export': parse_export(configobj, item),
|
||||
'route_both': parse_both(configobj, item),
|
||||
|
|
Loading…
Reference in a new issue