|
|
@ -91,6 +91,7 @@ def map_obj_to_commands(updates, module):
|
|
|
|
commands = list()
|
|
|
|
commands = list()
|
|
|
|
want, have = updates
|
|
|
|
want, have = updates
|
|
|
|
state = module.params['state']
|
|
|
|
state = module.params['state']
|
|
|
|
|
|
|
|
purge = module.params['purge']
|
|
|
|
|
|
|
|
|
|
|
|
for w in want:
|
|
|
|
for w in want:
|
|
|
|
name = w['name']
|
|
|
|
name = w['name']
|
|
|
@ -100,7 +101,7 @@ def map_obj_to_commands(updates, module):
|
|
|
|
obj_in_have = search_obj_in_list(name, have)
|
|
|
|
obj_in_have = search_obj_in_list(name, have)
|
|
|
|
|
|
|
|
|
|
|
|
if state == 'absent':
|
|
|
|
if state == 'absent':
|
|
|
|
if have:
|
|
|
|
if obj_in_have:
|
|
|
|
commands.append('no vrf definition %s' % name)
|
|
|
|
commands.append('no vrf definition %s' % name)
|
|
|
|
elif state == 'present':
|
|
|
|
elif state == 'present':
|
|
|
|
if not obj_in_have:
|
|
|
|
if not obj_in_have:
|
|
|
@ -130,6 +131,12 @@ def map_obj_to_commands(updates, module):
|
|
|
|
commands.append('interface %s' % i)
|
|
|
|
commands.append('interface %s' % i)
|
|
|
|
commands.append('vrf forwarding %s' % w['name'])
|
|
|
|
commands.append('vrf forwarding %s' % w['name'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if purge:
|
|
|
|
|
|
|
|
for h in have:
|
|
|
|
|
|
|
|
obj_in_want = search_obj_in_list(h['name'], want)
|
|
|
|
|
|
|
|
if not obj_in_want:
|
|
|
|
|
|
|
|
commands.append('no vrf definition %s' % h['name'])
|
|
|
|
|
|
|
|
|
|
|
|
return commands
|
|
|
|
return commands
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|