Skip to content

Access interface parameters #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ This collection is intended for use with the following release versions:
<!--start requires_ansible-->
## Ansible version compatibility

This collection has been tested against following Ansible versions: **>=2.15.0**.
This collection has been tested against the following Ansible versions: **>=2.15.0**.

For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
fully qualified collection name (for example, `cisco.ios.ios`).
Plugins and modules within a collection may be tested with only specific Ansible versions.
A collection may contain metadata that identifies these versions.
PEP440 is the schema used to describe the versions of Ansible.
Expand Down
126 changes: 126 additions & 0 deletions docs/cisco.dcnm.dcnm_interface_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,69 @@ Parameters
<div>Duplex of the interface. Speed must be set to use duplex.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_cdp</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>State of CDP protocol on the interface</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_monitor</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>State of Switchport Monitor for SPAN/ERSPAN</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_pfc</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>State of Priority Flow Control (PFC) on the interface</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down Expand Up @@ -1105,6 +1168,69 @@ Parameters
<div>Duplex of the interface. Speed must be set to use duplex.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_cdp</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>State of CDP protocol on the interface</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_monitor</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>State of Switchport Monitor for SPAN/ERSPAN</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_pfc</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>State of Priority Flow Control (PFC) on the interface</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down
71 changes: 70 additions & 1 deletion plugins/modules/dcnm_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@
type: str
choices: ['auto', 'full', 'half']
default: auto
enable_pfc:
description:
- State of Priority Flow Control (PFC) on the interface
type: bool
default: false
enable_cdp:
description:
- State of CDP protocol on the interface
type: bool
default: true
enable_monitor:
description:
- State of Switchport Monitor for SPAN/ERSPAN
type: bool
default: false
profile_vpc:
description:
- Though the key shown here is 'profile_vpc' the actual key to be used in playbook
Expand Down Expand Up @@ -564,6 +579,21 @@
- Administrative state of the interface
type: bool
default: true
enable_pfc:
description:
- State of Priority Flow Control (PFC) on the interface
type: bool
default: false
enable_cdp:
description:
- State of CDP protocol on the interface
type: bool
default: true
enable_monitor:
description:
- State of Switchport Monitor for SPAN/ERSPAN
type: bool
default: false
profile_svi:
description:
- Though the key shown here is 'profile_svi' the actual key to be used in playbook
Expand Down Expand Up @@ -1920,6 +1950,9 @@ def __init__(self, module):
"DCI_ROUTING_PROTO": "dci_routing_proto",
"DCI_ROUTING_TAG": "dci_routing_tag",
"ENABLE_ORPHAN_PORT": "orphan_port",
"ENABLE_PFC": "enable_pfc",
"ENABLE_MONITOR": "enable_monitor",
"CDP_ENABLE": "enable_cdp",
}

# New Interfaces
Expand Down Expand Up @@ -2268,6 +2301,9 @@ def dcnm_intf_validate_port_channel_input(self, config):
description=dict(type="str", default=""),
admin_state=dict(type="bool", default=True),
orphan_port=dict(type="bool", default=False),
enable_cdp=dict(type="bool", default=True),
enable_monitor=dict(type="bool", default=False),
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
)
Expand All @@ -2285,6 +2321,9 @@ def dcnm_intf_validate_port_channel_input(self, config):
description=dict(type="str", default=""),
admin_state=dict(type="bool", default=True),
orphan_port=dict(type="bool", default=False),
enable_cdp=dict(type="bool", default=True),
enable_monitor=dict(type="bool", default=False),
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
)
Expand Down Expand Up @@ -2487,6 +2526,9 @@ def dcnm_intf_validate_ethernet_interface_input(self, cfg):
description=dict(type="str", default=""),
admin_state=dict(type="bool", default=True),
orphan_port=dict(type="bool", default=False),
enable_cdp=dict(type="bool", default=True),
enable_monitor=dict(type="bool", default=False),
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
)
Expand All @@ -2504,6 +2546,9 @@ def dcnm_intf_validate_ethernet_interface_input(self, cfg):
description=dict(type="str", default=""),
admin_state=dict(type="bool", default=True),
orphan_port=dict(type="bool", default=False),
enable_cdp=dict(type="bool", default=True),
enable_monitor=dict(type="bool", default=False),
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
)
Expand Down Expand Up @@ -2843,6 +2888,12 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile):
intf["interfaces"][0]["nvPairs"]["PO_ID"] = ifname
intf["interfaces"][0]["nvPairs"][
"ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"]
intf["interfaces"][0]["nvPairs"][
"CDP_ENABLE"] = delem[profile]["enable_cdp"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_PFC"] = delem[profile]["enable_pfc"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile]["mode"] == "access":
Expand Down Expand Up @@ -2870,6 +2921,12 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile):
intf["interfaces"][0]["nvPairs"]["PO_ID"] = ifname
intf["interfaces"][0]["nvPairs"][
"ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"]
intf["interfaces"][0]["nvPairs"][
"CDP_ENABLE"] = delem[profile]["enable_cdp"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_PFC"] = delem[profile]["enable_pfc"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile]["mode"] == "l3":
Expand Down Expand Up @@ -3241,6 +3298,12 @@ def dcnm_intf_get_eth_payload(self, delem, intf, profile):
intf["interfaces"][0]["nvPairs"]["INTF_NAME"] = ifname
intf["interfaces"][0]["nvPairs"][
"ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"]
intf["interfaces"][0]["nvPairs"][
"CDP_ENABLE"] = delem[profile]["enable_cdp"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_PFC"] = delem[profile]["enable_pfc"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile]["mode"] == "access":
Expand All @@ -3259,6 +3322,12 @@ def dcnm_intf_get_eth_payload(self, delem, intf, profile):
intf["interfaces"][0]["nvPairs"]["INTF_NAME"] = ifname
intf["interfaces"][0]["nvPairs"][
"ENABLE_ORPHAN_PORT"] = delem[profile]["orphan_port"]
intf["interfaces"][0]["nvPairs"][
"CDP_ENABLE"] = delem[profile]["enable_cdp"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_PFC"] = delem[profile]["enable_pfc"]
intf["interfaces"][0]["nvPairs"][
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile]["mode"] == "routed":
Expand Down Expand Up @@ -3884,7 +3953,7 @@ def dcnm_intf_compare_elements(
else:
t_e2 = e2

if k == 'ENABLE_ORPHAN_PORT':
if k in ['ENABLE_ORPHAN_PORT', 'ENABLE_PFC', 'ENABLE_MONITOR', 'CDP_ENABLE']:
# This is a special case where the value is a boolean and we need to compare it as such
t_e1 = str(t_e1).lower()
t_e2 = str(t_e2).lower()
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
"allowed_vlans": "none",
"native_vlan": 10,
"orphan_port": false,
"enable_pfc": false,
"enable_cdp": true,
"enable_monitor": false,
"duplex": "auto",
"cmds": [
"no shutdown"
Expand Down Expand Up @@ -219,6 +222,9 @@
"allowed_vlans": "all",
"native_vlan": 10,
"orphan_port": false,
"enable_pfc": false,
"enable_cdp": true,
"enable_monitor": false,
"duplex": "auto",
"cmds": [
"no shutdown",
Expand Down Expand Up @@ -469,6 +475,9 @@
"allowed_vlans": "all",
"native_vlan": 10,
"orphan_port": false,
"enable_pfc": false,
"enable_cdp": true,
"enable_monitor": false,
"duplex": "auto",
"cmds": [
"no shutdown",
Expand Down Expand Up @@ -500,6 +509,9 @@
"allowed_vlans": "all",
"native_vlan": 10,
"orphan_port": false,
"enable_pfc": false,
"enable_cdp": true,
"enable_monitor": false,
"duplex": "auto",
"cmds": [
"no shutdown",
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/modules/dcnm/fixtures/dcnm_intf_eth_payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"PORT_DUPLEX_MODE": "auto",
"DESC": "eth interface acting as trunk",
"NATIVE_VLAN": "10",
"ENABLE_ORPHAN_PORT": false
"ENABLE_ORPHAN_PORT": false,
"ENABLE_PFC": false,
"CDP_ENABLE": true,
"ENABLE_MONITOR": false
},
"ifName": "Ethernet1/30",
"serialNumber": "SAL1819SAN8",
Expand Down Expand Up @@ -53,6 +56,9 @@
"BPDUGUARD_ENABLED": "True",
"SPEED": "auto",
"ENABLE_ORPHAN_PORT": false,
"ENABLE_PFC": false,
"CDP_ENABLE": true,
"ENABLE_MONITOR": false,
"PORT_DUPLEX_MODE": "auto",
"DESC": "eth interface acting as access"
},
Expand Down
Loading