Skip to content

Commit

Permalink
[ignore_changes] Fixing documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
anvitha-jain committed Nov 11, 2024
1 parent e253d7b commit 54cabb7
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 79 deletions.
59 changes: 24 additions & 35 deletions plugins/modules/ndo_physical_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
DOCUMENTATION = r"""
---
module: ndo_physical_interface
short_description: Manage physical interface on Cisco Nexus Dashboard Orchestrator (NDO).
short_description: Manage Physical Interfaces on Cisco Nexus Dashboard Orchestrator (NDO).
description:
- Manage physical interface on Cisco Nexus Dashboard Orchestrator (NDO).
- Manage Physical Interfaces on Cisco Nexus Dashboard Orchestrator (NDO).
- This module is only supported on ND v3.1 (NDO v4.3) and later.
author:
- Anvitha Jain (@anvjain)
Expand All @@ -29,22 +29,22 @@
required: true
physical_interface:
description:
- The name of the physical interface.
- The name of the Physical Interface.
type: str
aliases: [ name ]
physical_interface_uuid:
description:
- The UUID of the physical interface.
- The UUID of the Physical Interface.
- This parameter is required when the O(physical_interface) needs to be updated.
type: str
aliases: [ uuid ]
description:
description:
- The description of the physical interface.
- The description of the Physical Interface.
type: str
nodes:
description:
- The node IDs where the physical interface policy will be deployed.
- The node IDs where the Physical Interface policy will be deployed.
type: list
elements: int
interfaces:
Expand All @@ -61,7 +61,7 @@
physical_policy_uuid:
description:
- The UUID of the Interface Setting Policy.
- This is only required when creating a new Port Channel Interface.
- This is only required when creating a new Interface Setting Policy.
- This parameter is required when O(physical_interface_type) is C(physical).
- This parameter can be used instead of O(physical_policy).
type: str
Expand All @@ -75,23 +75,23 @@
suboptions:
name:
description:
- The name of the Port Channel Interface Setting Policy.
- The name of the Interface Setting Policy.
type: str
template:
description:
- The name of the template in which is referred the Port Channel Interface Policy Group.
- The name of the template in which is referred the Interface Setting Policy.
type: str
aliases: [ policy, interface_policy, interface_policy_group, interface_setting ]
breakout_mode:
description:
- The breakout mode enabled splitting of the ethernet ports.
- Breakout mode enables breaking down an ethernet port into multiple low-speed ports.
- This parameter is available only when O(physical_interface_type) is C(breakout).
- The default value is C(4x10G).
type: str
choices: [ 4x10G, 4x25G, 4x100G ]
interface_descriptions:
description:
- The interface settings defined in the interface settings policy will be applied to the interfaces on the nodes you provided.
- The interface settings defined in the interface settings policy will be applied to the interfaces on the node IDs configured in C(nodes).
type: list
elements: dict
suboptions:
Expand Down Expand Up @@ -124,21 +124,21 @@
"""

EXAMPLES = r"""
- name: Create an physical interface physical_interface_type physical
- name: Create a Physical Interface with physical_interface_type set to physical
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
password: SomeSecretPassword
template: ansible_test_template
physical_interface: ansible_test_physical_interface_physical
description: "physical interface for Ansible Test"
description: "Physical Interface for Ansible Test"
nodes: [101]
interfaces: "1/1"
physical_interface_type: physical
physical_policy: ansible_test_interface_setting_policy_uuid
state: present
- name: Create an physical interface physical_interface_type breakout
- name: Create a Physical Interface with physical_interface_type set to breakout
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
Expand All @@ -164,7 +164,7 @@
state: query
register: query_all
- name: Query a specific physical interface with name
- name: Query a specific Physical Interface with name
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
Expand All @@ -174,17 +174,17 @@
state: query
register: query_one_name
- name: Query a specific physical interface with UUID
- name: Query a specific Physical Interface with UUID
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
password: SomeSecretPassword
template: ansible_test_template
physical_interface_uuid: ansible_test_physical_interface_uuid
physical_interface_uuid: "{{ query_one_uuid.current.uuid }}"
state: query
register: query_one_uuid
- name: Delete an physical interface with name
- name: Delete a Physical Interface with name
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
Expand All @@ -193,13 +193,13 @@
physical_interface: ansible_test_physical_interface_physical
state: absent
- name: Delete an physical interface with UUID
- name: Delete a Physical Interface with UUID
cisco.mso.ndo_physical_interface:
host: mso_host
username: admin
password: SomeSecretPassword
template: ansible_test_template
physical_interface_uuid: ansible_test_physical_interface_uuid
physical_interface_uuid: "{{ query_one_uuid.current.uuid }}"
state: absent
"""

Expand All @@ -211,6 +211,7 @@
from ansible_collections.cisco.mso.plugins.module_utils.mso import (
MSOModule,
mso_argument_spec,
format_interface_descriptions,
)
from ansible_collections.cisco.mso.plugins.module_utils.template import MSOTemplate, KVPair
import copy
Expand Down Expand Up @@ -342,7 +343,7 @@ def main():

# Node changes are not reflected on UI
if interface_descriptions and match.details.get("interfaceDescriptions") != interface_descriptions:
updated_interface_descriptions = validate_interface_description(interface_descriptions)
updated_interface_descriptions = format_interface_descriptions(interface_descriptions, "")
ops.append(dict(op="replace", path="{0}/{1}/interfaceDescriptions".format(path, match.index), value=updated_interface_descriptions))
match.details["interfaceDescriptions"] = updated_interface_descriptions
elif interface_descriptions == [] and match.details.get("interfaceDescriptions"):
Expand All @@ -355,7 +356,7 @@ def main():
mso.fail_json(msg=("ERROR: Missing 'nodes' for creating a Physical Interface."))

if not physical_interface_type:
mso.fail_json(msg=("ERROR: Missing physical interface type for creating a Physical Interface."))
mso.fail_json(msg=("ERROR: Missing Physical Interface type for creating a Physical Interface."))

payload = {
"name": physical_interface,
Expand All @@ -376,7 +377,7 @@ def main():
payload["breakoutMode"] = breakout_mode

if interface_descriptions:
payload["interfaceDescriptions"] = validate_interface_description(interface_descriptions)
payload["interfaceDescriptions"] = format_interface_descriptions(interface_descriptions, "")

ops.append(dict(op="add", path="{0}/-".format(path), value=copy.deepcopy(payload)))

Expand Down Expand Up @@ -406,17 +407,5 @@ def main():
mso.exit_json()


def validate_interface_description(interface_descriptions):
interface_descriptions = [
{
"interfaceID": interface_description.get("interface_id"),
"description": interface_description.get("description"),
}
for interface_description in interface_descriptions
]

return interface_descriptions


if __name__ == "__main__":
main()
Loading

0 comments on commit 54cabb7

Please sign in to comment.