From 9f20f8024154e9069fa8287dda77a7b6d425352a Mon Sep 17 00:00:00 2001 From: akinross Date: Tue, 3 Sep 2024 10:50:46 +0200 Subject: [PATCH] [minor_change] Add stratum attribute to aci_ntp_policy module --- plugins/modules/aci_ntp_policy.py | 10 ++++++++++ .../integration/targets/aci_ntp_policy/tasks/main.yml | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/modules/aci_ntp_policy.py b/plugins/modules/aci_ntp_policy.py index 1adb35cc3..7643620c0 100644 --- a/plugins/modules/aci_ntp_policy.py +++ b/plugins/modules/aci_ntp_policy.py @@ -50,6 +50,12 @@ - Enable master mode. Only applicable if server_state is enabled type: str choices: [ disabled, enabled ] + stratum: + description: + - The NTP stratum value. + - The APIC defaults to C(8) when not provided. + - The value must be minimal C(1) and maximum C(15). + type: int state: description: - Use C(present) or C(absent) for adding or removing. @@ -68,6 +74,7 @@ link: https://developer.cisco.com/docs/apic-mim-ref/ author: - Tim Cragg (@timcragg) +- Akini Ross (@akinross) """ EXAMPLES = r""" @@ -231,6 +238,7 @@ def main(): server_state=dict(type="str", choices=["disabled", "enabled"]), auth_state=dict(type="str", choices=["disabled", "enabled"]), master_mode=dict(type="str", choices=["disabled", "enabled"]), + stratum=dict(type="int"), state=dict(type="str", default="present", choices=["absent", "present", "query"]), ) @@ -249,6 +257,7 @@ def main(): server_state = module.params.get("server_state") auth_state = module.params.get("auth_state") master_mode = module.params.get("master_mode") + stratum = module.params.get("stratum") state = module.params.get("state") child_classes = ["datetimeNtpProv"] @@ -275,6 +284,7 @@ def main(): serverState=server_state, authSt=auth_state, masterMode=master_mode, + StratumValue=stratum, ), ) diff --git a/tests/integration/targets/aci_ntp_policy/tasks/main.yml b/tests/integration/targets/aci_ntp_policy/tasks/main.yml index 6d07f2b00..dfa6cf252 100644 --- a/tests/integration/targets/aci_ntp_policy/tasks/main.yml +++ b/tests/integration/targets/aci_ntp_policy/tasks/main.yml @@ -1,5 +1,6 @@ # Test code for the ACI modules -# Copyright: (c) 2022, Tim Cragg (timcragg) +# Copyright: (c) 2022, Tim Cragg (@timcragg) +# Copyright: (c) 2024, Akini Ross (@akinross) # # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -66,6 +67,7 @@ - nm_add_policy.current.0.datetimePol.attributes.adminSt == 'enabled' - nm_add_policy.current.0.datetimePol.attributes.serverState == 'disabled' - nm_add_policy.current.0.datetimePol.attributes.authSt == 'disabled' + - nm_add_policy.current.0.datetimePol.attributes.StratumValue == '8' - cm_add_policy_again is not changed - nm_add_policy_again is not changed - nm_add_policy_again.current.0.datetimePol.attributes.dn == 'uni/fabric/time-ansible_ntp_policy' @@ -74,6 +76,7 @@ - nm_add_policy_again.current.0.datetimePol.attributes.adminSt == 'enabled' - nm_add_policy_again.current.0.datetimePol.attributes.serverState == 'disabled' - nm_add_policy_again.current.0.datetimePol.attributes.authSt == 'disabled' + - nm_add_policy_again.current.0.datetimePol.attributes.StratumValue == '8' # MODIFY POLICY - name: Modify policy (check_mode) @@ -84,6 +87,7 @@ admin_state: enabled server_state: enabled auth_state: disabled + stratum: 9 state: present check_mode: true register: cm_modify_policy @@ -115,6 +119,7 @@ - nm_modify_policy.current.0.datetimePol.attributes.adminSt == 'enabled' - nm_modify_policy.current.0.datetimePol.attributes.serverState == 'enabled' - nm_modify_policy.current.0.datetimePol.attributes.authSt == 'disabled' + - nm_modify_policy.current.0.datetimePol.attributes.StratumValue == '9' - cm_modify_policy_again is not changed - nm_modify_policy_again is not changed - nm_modify_policy_again.current.0.datetimePol.attributes.dn == 'uni/fabric/time-ansible_ntp_policy' @@ -123,6 +128,7 @@ - nm_modify_policy_again.current.0.datetimePol.attributes.adminSt == 'enabled' - nm_modify_policy_again.current.0.datetimePol.attributes.serverState == 'enabled' - nm_modify_policy_again.current.0.datetimePol.attributes.authSt == 'disabled' + - nm_modify_policy_again.current.0.datetimePol.attributes.StratumValue == '9' # QUERY ALL POLICIES - name: Query all policies (check_mode) @@ -169,6 +175,7 @@ - nm_query_policy.current.0.datetimePol.attributes.adminSt == 'enabled' - nm_query_policy.current.0.datetimePol.attributes.serverState == 'enabled' - nm_query_policy.current.0.datetimePol.attributes.authSt == 'disabled' + - nm_query_policy.current.0.datetimePol.attributes.StratumValue == '9' # REMOVE POLICY - name: Remove policy (check_mode) @@ -205,5 +212,6 @@ - nm_remove_policy.previous.0.datetimePol.attributes.adminSt == 'enabled' - nm_remove_policy.previous.0.datetimePol.attributes.serverState == 'enabled' - nm_remove_policy.previous.0.datetimePol.attributes.authSt == 'disabled' + - nm_remove_policy.previous.0.datetimePol.attributes.StratumValue == '9' - cm_remove_policy_again is not changed - nm_remove_policy_again is not changed