Skip to content

Commit d24d7d0

Browse files
komaldesai13pre-commit-ci[bot]KB-perByte
authored
Added alias for mode option as switchport_mode for nxos_l2_interfaces (#1009)
* Added alias for switchport_mode * chore: auto fixes from pre-commit.com hooks * Added changelog and documentation * Added changelog and documentation * chore: auto fixes from pre-commit.com hooks * Make integration test for alias non voting * Update vars --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sagar Paul <sagpaul@redhat.com> Co-authored-by: KB-perByte <paul.sagar@yahoo.com>
1 parent a5bd9c8 commit d24d7d0

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- Added alias for mode option as switchport_mode for nxos_l2_interfaces

docs/cisco.nxos.nxos_l2_interfaces_module.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ Parameters
216216
<td>
217217
<div>Mode in which interface needs to be configured.</div>
218218
<div>Access mode is not shown in interface facts, so idempotency will not be maintained for switchport mode access and every time the output will come as changed=True.</div>
219+
<div style="font-size: small; color: darkgreen"><br/>aliases: switchport_mode</div>
219220
</td>
220221
</tr>
221222
<tr>

plugins/module_utils/network/nxos/argspec/l2_interfaces/l2_interfaces.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class L2_interfacesArgs(object): # pylint: disable=R0903
5555
"fex-fabric",
5656
"fabricpath",
5757
],
58+
"aliases": ["switchport_mode"],
5859
},
5960
"cdp_enable": {"type": "bool"},
6061
"link_flap": {

plugins/modules/nxos_l2_interfaces.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
- trunk
7373
- fex-fabric
7474
- fabricpath
75+
aliases:
76+
- switchport_mode
7577
cdp_enable:
7678
type: bool
7779
description: Enable/disable CDP on the interface

tests/integration/targets/nxos_l2_interfaces/tests/common/merged.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,26 @@
9595
that:
9696
- result.changed == false
9797
- result.commands|length == 0
98+
99+
- name: Using switchport_mode alias with dot1q-tunnel (alias running with check_mode)
100+
register: result_check
101+
check_mode: true
102+
cisco.nxos.nxos_l2_interfaces:
103+
config:
104+
- name: "{{ nxos_int2 }}"
105+
switchport_mode: dot1q-tunnel
106+
access:
107+
vlan: 30
108+
state: merged
109+
110+
- ansible.builtin.assert:
111+
that:
112+
- result_check.changed == true
113+
- "'interface {{ nxos_int2 }}' in result_check.commands"
114+
- "'switchport mode dot1q-tunnel' in result_check.commands"
115+
- "'switchport access vlan 30' in result_check.commands"
116+
- result_check.commands|length == 3
117+
98118
always:
99119
- name: Teardown
100120
ignore_errors: true

0 commit comments

Comments
 (0)