configures address-families when vrf is created (#28615)

* configures address-families when vrf is created

fixes #26725

* fix up unit test cases
This commit is contained in:
Peter Sprygada 2017-08-25 07:51:20 -04:00 committed by GitHub
parent a03a1cde88
commit 75293d83ca
2 changed files with 29 additions and 12 deletions

View file

@ -167,7 +167,11 @@ def get_interface_type(interface):
def add_command_to_vrf(name, cmd, commands):
if 'vrf definition %s' % name not in commands:
commands.append('vrf definition %s' % name)
commands.extend([
'vrf definition %s' % name,
'address-family ipv4', 'exit',
'address-family ipv6', 'exit',
])
commands.append(cmd)
def map_obj_to_commands(updates, module):
@ -185,7 +189,11 @@ def map_obj_to_commands(updates, module):
continue
if not have.get('state'):
commands.append('vrf definition %s' % want['name'])
commands.extend([
'vrf definition %s' % want['name'],
'address-family ipv4', 'exit',
'address-family ipv6', 'exit',
])
if needs_update(want, have, 'description'):
cmd = 'description %s' % want['description']
@ -337,6 +345,9 @@ def check_declarative_intent_params(want, module):
if rc == 0:
data = out.strip().split()
# data will be empty if the vrf was just added
if not data:
return
vrf = data[0]
interface = data[-1]
@ -356,6 +367,7 @@ def main():
name=dict(),
description=dict(),
rd=dict(),
interfaces=dict(type='list'),
delay=dict(default=10, type='int'),