eos_eapi: Added fix for bug # 51144 (#63632)

* Added fix for bug # 51144

* Corrected Lint errors

* Added fix for bug 51144

* Corrected errors

* Added unit testcase
This commit is contained in:
GomathiselviS 2019-10-23 10:16:43 -04:00 committed by Sumit Jaiswal
parent b1e8a6c1cb
commit 68de182555
2 changed files with 6 additions and 2 deletions

View file

@ -264,7 +264,7 @@ def map_obj_to_commands(updates, module, warnings):
else: else:
add('protocol unix-socket') add('protocol unix-socket')
if needs_update('state') and not needs_update('vrf'): if needs_update('state'):
if want['state'] == 'stopped': if want['state'] == 'stopped':
add('shutdown') add('shutdown')
elif want['state'] == 'started': elif want['state'] == 'started':

View file

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