Fix to - eos_vlans using state parameter replaced is giving odd behavior (#67318)
* Added fix for bug # 54400 * Adding files for RM static_routes * Added Integration tests * Revert "Added fix for bug # 54400" This reverts commitbf42db4269
. * Revert "Adding files for RM static_routes" This reverts commitdafdd92d43
. * Revert "Added Integration tests" This reverts commit129dc87682
. * Adding files for RM static_routes * Added Integration tests * Corrected lint errors * Added fix for bug # 54400 * Revert "Added fix for bug # 54400" This reverts commitbf42db4269
. * Revert "Adding files for RM static_routes" This reverts commitdafdd92d43
. * Revert "Added Integration tests" This reverts commit129dc87682
. * fix to bug #67313 * fixing rebase issue * fixing rebase issue * addressed review comments * addressed review comments
This commit is contained in:
parent
cd146b836e
commit
4ec1437212
3 changed files with 9 additions and 7 deletions
|
@ -208,16 +208,17 @@ def generate_commands(vlan_id, to_set, to_remove):
|
||||||
if "vlan_id" in to_remove:
|
if "vlan_id" in to_remove:
|
||||||
return ["no vlan {0}".format(vlan_id)]
|
return ["no vlan {0}".format(vlan_id)]
|
||||||
|
|
||||||
|
for key in to_remove:
|
||||||
|
if key in to_set.keys():
|
||||||
|
continue
|
||||||
|
commands.append("no {0}".format(key))
|
||||||
|
|
||||||
for key, value in to_set.items():
|
for key, value in to_set.items():
|
||||||
if key == "vlan_id" or value is None:
|
if key == "vlan_id" or value is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
commands.append("{0} {1}".format(key, value))
|
commands.append("{0} {1}".format(key, value))
|
||||||
|
|
||||||
for key in to_remove:
|
|
||||||
commands.append("no {0}".format(key))
|
|
||||||
|
|
||||||
if commands:
|
if commands:
|
||||||
commands.insert(0, "vlan {0}".format(vlan_id))
|
commands.insert(0, "vlan {0}".format(vlan_id))
|
||||||
|
|
||||||
return commands
|
return commands
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
config:
|
config:
|
||||||
- vlan_id: 20
|
- vlan_id: 20
|
||||||
state: suspend
|
state: suspend
|
||||||
|
name: twentyreplaced
|
||||||
other_config:
|
other_config:
|
||||||
- vlan_id: 10
|
- vlan_id: 10
|
||||||
name: ten
|
name: ten
|
||||||
|
|
|
@ -102,12 +102,12 @@ class TestEosVlansModule(TestEosModule):
|
||||||
self.execute_show_command.return_value = []
|
self.execute_show_command.return_value = []
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
config=[dict(
|
config=[dict(
|
||||||
vlan_id=30,
|
vlan_id=10,
|
||||||
name="thirty",
|
name="tenreplaced",
|
||||||
state="suspend"
|
state="suspend"
|
||||||
)], state="replaced"
|
)], state="replaced"
|
||||||
))
|
))
|
||||||
commands = ['vlan 30', 'name thirty', 'state suspend']
|
commands = ['vlan 10', 'name tenreplaced', 'state suspend']
|
||||||
self.execute_module(changed=True, commands=commands)
|
self.execute_module(changed=True, commands=commands)
|
||||||
|
|
||||||
def test_eos_vlan_replaced_idempotent(self):
|
def test_eos_vlan_replaced_idempotent(self):
|
||||||
|
|
Loading…
Reference in a new issue