Skip to content

Commit dff86ef

Browse files
committed
[ignore] Enhance Documentation and test file for ndo_ntp_policy.
1 parent 094c913 commit dff86ef

File tree

2 files changed

+216
-47
lines changed

2 files changed

+216
-47
lines changed

plugins/modules/ndo_ntp_policy.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,23 @@
5454
id:
5555
description:
5656
- The key's ID.
57+
- The value must be between 1 and 65535.
5758
type: int
5859
aliases: [ key_id ]
5960
key:
6061
description:
6162
- The key.
63+
- Up to 40 alphanumerical characters.
6264
type: str
63-
authentification_type:
65+
authentication_type:
6466
description:
65-
- the type of authentification.
67+
- the type of authentication.
68+
- The default value is O(ntp_keys.authentication_type=md5).
6669
type: str
6770
choices: [ md5, sha1 ]
6871
trusted:
6972
description:
70-
- Set the NTP client authentification key to trusted.
73+
- Set the NTP client authentication key to trusted.
7174
type: bool
7275
ntp_providers:
7376
description:
@@ -84,11 +87,15 @@
8487
minimum_poll_interval:
8588
description:
8689
- The Minimum Polling interval value.
90+
- The default value is O(ntp_providers.minimum_poll_interval=4).
91+
- The value must be between 4 and 16.
8792
type: int
8893
aliases: [ min_poll ]
8994
maximum_poll_interval:
9095
description:
9196
- The Maximum Polling interval value.
97+
- The default value is O(ntp_providers.maximum_poll_interval=6).
98+
- The value must be between 4 and 16.
9299
type: int
93100
aliases: [ max_poll ]
94101
management_epg_type:
@@ -106,33 +113,40 @@
106113
description:
107114
- Set the NTP provider to preferred.
108115
type: bool
109-
authentification_key_id:
116+
authentication_key_id:
110117
description:
111-
- The NTP authentification key ID.
118+
- The NTP authentication key ID.
119+
- The value must be between 1 and 65535.
112120
type: int
113121
aliases: [ key_id ]
114122
admin_state:
115123
description:
116124
- Enable admin state.
125+
- The default value is O(admin_state=enabled).
117126
type: str
118127
choices: [ enabled, disabled ]
119128
server_state:
120129
description:
121130
- Enable server state.
131+
- The default value is O(server_state=disabled).
122132
type: str
123133
choices: [ enabled, disabled ]
124134
master_mode:
125135
description:
126136
- Enable master mode.
137+
- The default value is O(master_mode=disabled).
127138
type: str
128139
choices: [ enabled, disabled ]
129140
stratum:
130141
description:
131142
- The numerical value of the stratum.
143+
- The default value is O(stratum=4).
144+
- The value must be between 1 and 14.
132145
type: int
133-
authentification_state:
146+
authentication_state:
134147
description:
135-
- Enable authentification state.
148+
- Enable authentication state.
149+
- The default value is O(authentication_state=disabled).
136150
type: str
137151
choices: [ enabled, disabled ]
138152
state:
@@ -162,7 +176,7 @@
162176
ntp_keys:
163177
- id: 1
164178
key: my_key
165-
authentification_type: md5
179+
authentication_type: md5
166180
trusted: true
167181
ntp_providers:
168182
- host: background
@@ -171,12 +185,12 @@
171185
management_epg_type: oob
172186
management_epg: default
173187
preferred: true
174-
authentification_key_id: 1
188+
authentication_key_id: 1
175189
admin_state: enabled
176190
server_state: enabled
177191
master_mode: enabled
178192
stratum: 4
179-
authentification_state: enabled
193+
authentication_state: enabled
180194
state: present
181195
register: ntp_policy_1
182196
@@ -261,7 +275,7 @@ def main():
261275
options=dict(
262276
id=dict(type="int", aliases=["key_id"]),
263277
key=dict(type="str", no_log=True),
264-
authentification_type=dict(type="str", choices=["md5", "sha1"]),
278+
authentication_type=dict(type="str", choices=["md5", "sha1"]),
265279
trusted=dict(type="bool"),
266280
),
267281
no_log=False,
@@ -276,14 +290,14 @@ def main():
276290
management_epg_type=dict(type="str", choices=["inb", "oob"], aliases=["epg_type"]),
277291
management_epg=dict(type="str", aliases=["epg"]),
278292
preferred=dict(type="bool"),
279-
authentification_key_id=dict(type="int", aliases=["key_id"]),
293+
authentication_key_id=dict(type="int", aliases=["key_id"]),
280294
),
281295
),
282296
admin_state=dict(type="str", choices=["enabled", "disabled"]),
283297
server_state=dict(type="str", choices=["enabled", "disabled"]),
284298
master_mode=dict(type="str", choices=["enabled", "disabled"]),
285299
stratum=dict(type="int"),
286-
authentification_state=dict(type="str", choices=["enabled", "disabled"]),
300+
authentication_state=dict(type="str", choices=["enabled", "disabled"]),
287301
state=dict(type="str", default="query", choices=["absent", "query", "present"]),
288302
)
289303

@@ -308,7 +322,7 @@ def main():
308322
{
309323
"id": item.get("id"),
310324
"key": item.get("key"),
311-
"authType": item.get("authentification_type"),
325+
"authType": item.get("authentication_type"),
312326
"trusted": item.get("trusted"),
313327
}
314328
for item in ntp_keys
@@ -323,19 +337,19 @@ def main():
323337
"mgmtEpgType": item.get("management_epg_type"),
324338
"mgmtEpgName": item.get("management_epg"),
325339
"preferred": item.get("preferred"),
326-
"authKeyID": item.get("authentification_key_id"),
340+
"authKeyID": item.get("authentication_key_id"),
327341
}
328342
for item in ntp_providers
329343
]
330344
admin_state = module.params.get("admin_state")
331345
server_state = module.params.get("server_state")
332346
master_mode = module.params.get("master_mode")
333347
stratum = module.params.get("stratum")
334-
authentification_state = module.params.get("authentification_state")
348+
authentication_state = module.params.get("authentication_state")
335349
state = module.params.get("state")
336350

337-
template_object = MSOTemplate(mso, "tenant", template)
338-
template_object.validate_template("tenantPolicy")
351+
template_object = MSOTemplate(mso, "fabric_policy", template)
352+
template_object.validate_template("fabricPolicy")
339353

340354
ntp_policies = template_object.template.get("fabricPolicyTemplate", {}).get("template", {}).get("ntpPolicies", [])
341355
object_description = "NTP Policy"
@@ -365,7 +379,7 @@ def main():
365379
serverState=server_state,
366380
masterMode=master_mode,
367381
stratum=stratum,
368-
authState=authentification_state,
382+
authState=authentication_state,
369383
)
370384

371385
if mso.existing:

0 commit comments

Comments
 (0)