diff --git a/changelogs/fragments/62420-ios-lldp-global-update.yaml b/changelogs/fragments/62420-ios-lldp-global-update.yaml new file mode 100644 index 00000000000..15ac46ed287 --- /dev/null +++ b/changelogs/fragments/62420-ios-lldp-global-update.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "Fix ios_lldp_global enable to enabled(https://github.com/ansible/ansible/pull/62420)" diff --git a/lib/ansible/module_utils/network/ios/argspec/lldp_global/lldp_global.py b/lib/ansible/module_utils/network/ios/argspec/lldp_global/lldp_global.py index 55973404699..62630036c2c 100644 --- a/lib/ansible/module_utils/network/ios/argspec/lldp_global/lldp_global.py +++ b/lib/ansible/module_utils/network/ios/argspec/lldp_global/lldp_global.py @@ -36,7 +36,7 @@ class Lldp_globalArgs(object): argument_spec = {'config': {'options': {'holdtime': {'type': 'int'}, 'reinit': {'type': 'int'}, - 'enable': {'type': 'bool'}, + 'enabled': {'type': 'bool'}, 'timer': {'type': 'int'}, 'tlv_select': { 'options': { diff --git a/lib/ansible/module_utils/network/ios/config/lldp_global/lldp_global.py b/lib/ansible/module_utils/network/ios/config/lldp_global/lldp_global.py index 6a0c11af7c6..02eec6ddc7b 100644 --- a/lib/ansible/module_utils/network/ios/config/lldp_global/lldp_global.py +++ b/lib/ansible/module_utils/network/ios/config/lldp_global/lldp_global.py @@ -190,7 +190,7 @@ class Lldp_global(ConfigBase): if diff: diff = dict(diff) holdtime = diff.get('holdtime') - enable = diff.get('enable') + enabled = diff.get('enabled') timer = diff.get('timer') reinit = diff.get('reinit') tlv_select = diff.get('tlv_select') @@ -198,7 +198,7 @@ class Lldp_global(ConfigBase): if holdtime: cmd = 'lldp holdtime {0}'.format(holdtime) self.add_command_to_config_list(cmd, commands) - if enable: + if enabled: cmd = 'lldp run' self.add_command_to_config_list(cmd, commands) if timer: @@ -223,7 +223,7 @@ class Lldp_global(ConfigBase): if have.get('holdtime'): cmd = 'lldp holdtime' self._remove_command_from_config_list(cmd, commands) - if have.get('enable'): + if have.get('enabled'): cmd = 'lldp run' self._remove_command_from_config_list(cmd, commands) if have.get('timer'): diff --git a/lib/ansible/module_utils/network/ios/facts/lldp_global/lldp_global.py b/lib/ansible/module_utils/network/ios/facts/lldp_global/lldp_global.py index 368851b7180..1643d524763 100644 --- a/lib/ansible/module_utils/network/ios/facts/lldp_global/lldp_global.py +++ b/lib/ansible/module_utils/network/ios/facts/lldp_global/lldp_global.py @@ -81,7 +81,7 @@ class Lldp_globalFacts(object): if holdtime: config['holdtime'] = int(holdtime) if 'lldp run' in conf: - config['enable'] = True + config['enabled'] = True if timer: config['timer'] = int(timer) if reinit: diff --git a/lib/ansible/modules/network/ios/ios_lldp_global.py b/lib/ansible/modules/network/ios/ios_lldp_global.py index a83d899a9cf..f82b2359310 100644 --- a/lib/ansible/modules/network/ios/ios_lldp_global.py +++ b/lib/ansible/modules/network/ios/ios_lldp_global.py @@ -69,7 +69,7 @@ options: For any other reinit value, idempotency will be maintained since any other reinit value is recorded in the Cisco device. type: int - enable: + enabled: description: - Enable LLDP type: bool @@ -150,7 +150,7 @@ EXAMPLES = """ ios_lldp_global: config: holdtime: 10 - run: True + enabled: True reinit: 3 timer: 10 state: merged diff --git a/test/integration/targets/ios_lldp_global/tests/cli/merged.yaml b/test/integration/targets/ios_lldp_global/tests/cli/merged.yaml index e84e475ad6e..00757ecfac4 100644 --- a/test/integration/targets/ios_lldp_global/tests/cli/merged.yaml +++ b/test/integration/targets/ios_lldp_global/tests/cli/merged.yaml @@ -9,7 +9,7 @@ ios_lldp_global: &merged config: holdtime: 10 - enable: True + enabled: True reinit: 3 timer: 20 state: merged diff --git a/test/integration/targets/ios_lldp_global/vars/main.yaml b/test/integration/targets/ios_lldp_global/vars/main.yaml index e40498f01d4..ed87644bf83 100644 --- a/test/integration/targets/ios_lldp_global/vars/main.yaml +++ b/test/integration/targets/ios_lldp_global/vars/main.yaml @@ -12,14 +12,14 @@ merged: timer: 20 holdtime: 10 reinit: 3 - enable: True + enabled: True replaced: before: timer: 100 holdtime: 10 reinit: 3 - enable: True + enabled: True commands: - "no lldp run" @@ -36,7 +36,7 @@ deleted: timer: 100 holdtime: 10 reinit: 3 - enable: True + enabled: True commands: - "no lldp holdtime"