mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix nxos_hsrp (#27306)
* fix nxos_hsrp Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * modify nxos_hsrp test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
5fbd42eca5
commit
41ce724801
2 changed files with 10 additions and 8 deletions
|
@ -374,10 +374,7 @@ def main():
|
|||
vip=dict(type='str', required=False),
|
||||
auth_type=dict(choices=['text', 'md5'], required=False),
|
||||
auth_string=dict(type='str', required=False),
|
||||
state=dict(choices=['absent', 'present'], required=False, default='present'),
|
||||
include_defaults=dict(default=True),
|
||||
config=dict(),
|
||||
save=dict(type='bool', default=False)
|
||||
state=dict(choices=['absent', 'present'], required=False, default='present')
|
||||
)
|
||||
|
||||
argument_spec.update(nxos_argument_spec)
|
||||
|
@ -464,11 +461,15 @@ def main():
|
|||
module.exit_json(**results)
|
||||
else:
|
||||
load_config(module, commands)
|
||||
|
||||
# validate IP
|
||||
if transport == 'cli':
|
||||
commands.insert(0, 'config t')
|
||||
body = run_commands(module, commands)
|
||||
validate_config(body, vip, module)
|
||||
|
||||
results['changed'] = True
|
||||
end_state = get_hsrp_group(group, interface, module)
|
||||
|
||||
if 'configure' in commands:
|
||||
commands.pop(0)
|
||||
|
||||
|
|
|
@ -46,15 +46,16 @@ class TestNxosHsrpModule(TestNxosModule):
|
|||
|
||||
def test_nxos_hsrp(self):
|
||||
set_module_args(dict(group='10',
|
||||
vip='192.0.2.2',
|
||||
vip='192.0.2.2/8',
|
||||
priority='150',
|
||||
interface='Ethernet1/2',
|
||||
preempt='enabled',
|
||||
host='192.0.2.1'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['commands']), sorted(['interface ethernet1/2',
|
||||
self.assertEqual(sorted(result['commands']), sorted(['config t',
|
||||
'interface ethernet1/2',
|
||||
'hsrp version 2',
|
||||
'hsrp 10',
|
||||
'priority 150',
|
||||
'ip 192.0.2.2',
|
||||
'ip 192.0.2.2/8',
|
||||
'preempt']))
|
||||
|
|
Loading…
Reference in a new issue