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

@ -53,7 +53,7 @@ class TestIosVrfModule(TestIosModule):
def test_ios_vrf_name(self):
set_module_args(dict(name='test_4'))
commands = ['vrf definition test_4']
commands = ['vrf definition test_4', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit']
self.execute_module(changed=True, commands=commands, sort=False)
def test_ios_vrf_name_unchanged(self):
@ -62,12 +62,12 @@ class TestIosVrfModule(TestIosModule):
def test_ios_vrf_description(self):
set_module_args(dict(name='test_1', description='test string'))
commands = ['vrf definition test_1', 'description test string']
commands = ['vrf definition test_1', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit', 'description test string']
self.execute_module(changed=True, commands=commands, sort=False)
def test_ios_vrf_rd(self):
set_module_args(dict(name='test_1', rd='2:100'))
commands = ['vrf definition test_1', 'rd 2:100']
commands = ['vrf definition test_1', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit', 'rd 2:100']
self.execute_module(changed=True, commands=commands, sort=False)
def test_ios_vrf_interfaces(self):
@ -96,34 +96,39 @@ class TestIosVrfModule(TestIosModule):
def test_ios_vrfs_no_purge(self):
vrfs = [{'name': 'test_1'}, {'name': 'test_4'}]
set_module_args(dict(vrfs=vrfs))
commands = ['vrf definition test_4']
commands = ['vrf definition test_4',
'address-family ipv4', 'exit',
'address-family ipv6', 'exit']
self.execute_module(changed=True, commands=commands)
def test_ios_vrfs_purge(self):
vrfs = [{'name': 'test_1'}, {'name': 'test_4'}]
set_module_args(dict(vrfs=vrfs, purge=True))
commands = ['no vrf definition test_2', 'no vrf definition test_3',
'vrf definition test_4']
commands = ['vrf definition test_4',
'address-family ipv4', 'exit',
'address-family ipv6', 'exit',
'no vrf definition test_2',
'no vrf definition test_3']
self.execute_module(changed=True, commands=commands)
def test_ios_vrfs_global_arg(self):
vrfs = [{'name': 'test_1'}, {'name': 'test_2'}]
set_module_args(dict(vrfs=vrfs, description='test string'))
commands = ['vrf definition test_1', 'description test string',
'vrf definition test_2', 'description test string']
commands = ['vrf definition test_1', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit', 'description test string',
'vrf definition test_2', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit', 'description test string']
self.execute_module(changed=True, commands=commands, sort=False)
def test_ios_vrfs_local_override_description(self):
vrfs = [{'name': 'test_1', 'description': 'test vrf 1'},
{'name': 'test_2'}]
set_module_args(dict(vrfs=vrfs, description='test string'))
commands = ['vrf definition test_2', 'description test string']
commands = ['vrf definition test_2', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit', 'description test string']
self.execute_module(changed=True, commands=commands, sort=False)
def test_ios_vrfs_local_override_state(self):
vrfs = [{'name': 'test_1', 'state': 'absent'},
{'name': 'test_2'}]
set_module_args(dict(vrfs=vrfs, description='test string'))
commands = ['no vrf definition test_1', 'vrf definition test_2',
commands = ['no vrf definition test_1', 'vrf definition test_2', 'address-family ipv4', 'exit', 'address-family ipv6', 'exit',
'description test string']
self.execute_module(changed=True, commands=commands, sort=False)