eos_eapi: adding the desired state config to the new vrf fixes #32111 (#32112)

* adding the desired state config to the new vrf fixes #32111

* fix default vrf initial configured

* add unit test
pull/32451/head
Dave Thelen 7 years ago committed by Ganesh Nalawade
parent 4faf4ff215
commit 2c99cbc874

@ -260,11 +260,17 @@ def map_obj_to_commands(updates, module, warnings):
else:
add('protocol unix-socket')
if needs_update('state') and not needs_update('vrf'):
if want['state'] == 'stopped':
add('shutdown')
elif want['state'] == 'started':
add('no shutdown')
if needs_update('vrf'):
add('vrf %s' % want['vrf'])
if needs_update('state'):
# switching operational vrfs here
# need to add the desired state as well
if want['state'] == 'stopped':
add('shutdown')
elif want['state'] == 'started':

@ -134,6 +134,11 @@ class TestEosEapiModule(TestEosModule):
commands = ['management api http-commands', 'vrf test', 'no shutdown']
self.start_unconfigured(changed=True, commands=commands)
def test_eos_eapi_change_from_default_vrf(self):
set_module_args(dict(vrf='test'))
commands = ['management api http-commands', 'vrf test', 'no shutdown']
self.start_configured(changed=True, commands=commands)
def test_eos_eapi_vrf_missing(self):
set_module_args(dict(vrf='missing'))
self.start_unconfigured(failed=True)

Loading…
Cancel
Save