fix state present nxos_evpn_vni (#25212)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2017-06-01 08:57:17 +05:30 committed by GitHub
parent ea8c9a9b73
commit fb87680046
2 changed files with 8 additions and 5 deletions

View file

@ -220,9 +220,8 @@ def state_present(module, existing, proposed):
command = '{0} {1}'.format(key, value)
commands.append(command)
else:
commands = ['vni {0} l2'.format(module.params['vni'])]
parents = ['evpn']
if commands:
parents = ['evpn', 'vni {0} l2'.format(module.params['vni'])]
return commands, parents

View file

@ -50,9 +50,13 @@ class TestNxosEvpnVniModule(TestNxosModule):
self.load_config.return_value = None
def test_nxos_evpn_vni_present(self):
set_module_args(dict(vni='6000', state='present'))
set_module_args(dict(vni='6000',
route_target_import='5000:10',
state='present'))
result = self.execute_module(changed=True)
self.assertEqual(result['commands'], ['evpn', 'vni 6000 l2'])
self.assertEqual(result['commands'], ['evpn',
'vni 6000 l2',
'route-target import 5000:10'])
def test_nxos_evpn_vni_absent_not_existing(self):
set_module_args(dict(vni='12000', state='absent'))