Skip to content

Commit

Permalink
[ignore] Make Documentation clearer for ndo_tenant_custom_qos_policy.…
Browse files Browse the repository at this point in the history
… Adjust format_list_dict function in module_utils/utils.py.
  • Loading branch information
gmicol committed Dec 3, 2024
1 parent a719f0c commit 56cd354
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
5 changes: 3 additions & 2 deletions plugins/module_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def generate_api_endpoint(path, **kwargs):
def format_list_dict(list_dict, keys_map):
"""
Convert an Python list of dictionaries into its equivalent NDO API format.
All keys must be definied in the keys map even if no conversion is needed for some keys.
:param list_dict: The Python list of dictionaries to format. -> List[Dict]
:param keys_map: the mapping from the Ansible argument's keys to NDO API keys. Can also include the map between values -> Dict
Expand All @@ -44,9 +45,9 @@ def format_dict(d):
for key, value in keys_map.items():
# keys_map can have values of type list including the API key string and the map conversion for values\
if isinstance(value, list):
formated_dict[value[0]] = value[1].get(list_dict.get(key))
formated_dict[value[0]] = value[1].get(d.get(key))
else:
formated_dict[value] = list_dict.get(key)
formated_dict[value] = d.get(key)
return formated_dict

formated_list = [format_dict(d) for d in list_dict]
Expand Down
38 changes: 25 additions & 13 deletions plugins/modules/ndo_tenant_custom_qos_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
module: ndo_tenant_custom_qos_policy
short_description: Manage Custom QoS Policies in Tenant Policy Templates on Cisco Nexus Dashboard Orchestrator (NDO).
description:
- Manage Custom Quality of Service (QoS) Policies in Tenant Policy Templates on Cisco Nexus Dashboard Orchestrator (NDO).
- Manage Custom Quality of Service (QoS) Policies in Tenant Policy Templates on Cisco Nexus Dashboard Orchestrator (NDO).
- This module is only supported on ND v3.1 (NDO v4.3) and later.
author:
- Gaspard Micol (@gmicol)
Expand Down Expand Up @@ -46,12 +46,14 @@
dscp_mappings:
description:
- The Differentiated Services Code Point (DSCP) mappings of the Custom QoS Policy.
- O(dscp_from) and O(dscp_to) cannot both be C(unspecified).
type: list
elements: dict
suboptions:
dscp_from:
description:
- The DSCP range starting value.
- The starting encoding point of the DSCP range.
- Defaults to unspecified when unset during creation.
type: str
choices:
- af11
Expand Down Expand Up @@ -80,7 +82,8 @@
aliases: [ from ]
dscp_to:
description:
- The DSCP range ending value.
- The ending encoding point of the DSCP range.
- Defaults to unspecified when unset during creation.
type: str
choices:
- af11
Expand Down Expand Up @@ -109,7 +112,8 @@
aliases: [ to ]
dscp_target:
description:
- The DSCP target value.
- The DSCP target encoding point for egressing traffic.
- Defaults to unspecified when unset during creation.
type: str
choices:
- af11
Expand Down Expand Up @@ -138,36 +142,42 @@
aliases: [ target ]
target_cos:
description:
- The target CoS to be driven based on the range of input values of DSCP coming into the fabric.
- The target CoS traffic type for the egressing traffic.
- Defaults to unspecified when unset during creation.
type: str
choices: [ background, best_effort, excellent_effort, critical_applications, video, voice, internetwork_control, network_control, unspecified ]
qos_priority:
description:
- The desired QoS class level to be used.
- The QoS priority level to which the DSCP values will be mapped.
- Defaults to unspecified when unset during creation.
type: str
choices: [ level1, level2, level3, level4, level5, level6, unspecified ]
aliases: [ priority, prio ]
cos_mappings:
description:
- The CoS mappings of the Custom QoS Policy.
- The Class of Service (CoS) mappings of the Custom QoS Policy.
- O(dot1p_from) and O(dot1p_to) cannot both be C(unspecified).
type: list
elements: dict
suboptions:
dot1p_from:
description:
- The Dot1P range starting value.
- The starting traffic type of the CoS range.
- Defaults to unspecified when unset during creation.
type: str
choices: [ background, best_effort, excellent_effort, critical_applications, video, voice, internetwork_control, network_control, unspecified ]
aliases: [ from ]
dot1p_to:
description:
- The Dot1P range ending value.
- The encoding traffic type of the CoS range.
- Defaults to unspecified when unset during creation.
type: str
choices: [ background, best_effort, excellent_effort, critical_applications, video, voice, internetwork_control, network_control, unspecified ]
aliases: [ to ]
dscp_target:
description:
- The DSCP target value.
- The DSCP target encoding point for egressing traffic.
- Defaults to unspecified when unset during creation.
type: str
choices:
- af11
Expand Down Expand Up @@ -196,12 +206,14 @@
aliases: [ target ]
target_cos:
description:
- The target CoS to be driven based on the range of input values of Dot1P coming into the fabric.
- The target CoS traffic type for the egressing traffic.
- Defaults to unspecified when unset during creation.
type: str
choices: [ background, best_effort, excellent_effort, critical_applications, video, voice, internetwork_control, network_control, unspecified ]
qos_priority:
description:
- The desired QoS class level to be used.
- The QoS priority level to which the DSCP values will be mapped.
- Defaults to unspecified when unset during creation.
type: str
choices: [ level1, level2, level3, level4, level5, level6, unspecified ]
aliases: [ priority, prio ]
Expand Down Expand Up @@ -262,7 +274,7 @@
template: tenant_template
name: custom_qos_policy_1
state: query
register: query_uuid
register: query_name
- name: Query a Custom QoS Policy object with UUID
cisco.mso.ndo_tenant_custom_qos_policy:
Expand Down

0 comments on commit 56cd354

Please sign in to comment.