Skip to content

adding LACP attributes port priority and rate v1 #495

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
78 changes: 78 additions & 0 deletions docs/cisco.dcnm.dcnm_interface_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,45 @@ Parameters
<div>Minimum Value (1), Maximum Value (31)</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>lacp_port_priority</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">32768</div>
</td>
<td>
<div>&lt;1-65535&gt; Set LACP port priority on member interfaces, default is 32768</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>lacp_rate</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>normal</b>&nbsp;&larr;</div></li>
<li>fast</li>
</ul>
</td>
<td>
<div>Set the rate at which LACP control packets are sent to an LACP-supported interface. Normal rate (30 seconds), fast rate (1 second), rate is set on member interfaces, default is normal</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down Expand Up @@ -2441,6 +2480,45 @@ Parameters
<div>Enable lacp convergence for vPC port-channels</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>lacp_port_priority</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">32768</div>
</td>
<td>
<div>&lt;1-65535&gt; Set LACP port priority on member interfaces, default is 32768</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>lacp_rate</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>normal</b>&nbsp;&larr;</div></li>
<li>fast</li>
</ul>
</td>
<td>
<div>Set the rate at which LACP control packets are sent to an LACP-supported interface. Normal rate (30 seconds), fast rate (1 second), rate is set on member interfaces, default is normal</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down
60 changes: 60 additions & 0 deletions plugins/modules/dcnm_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@
- State of Switchport Monitor for SPAN/ERSPAN
type: bool
default: false
lacp_port_priority:
description:
- <1-65535> Set LACP port priority on member interfaces, default is 32768
type: int
default: 32768
lacp_rate:
description:
- Set the rate at which LACP control packets are sent to an LACP-supported
interface. Normal rate (30 seconds), fast rate (1 second), rate is set on member
interfaces, default is normal
type: str
choices: ['normal', 'fast']
default: normal
profile_vpc:
description:
- Though the key shown here is 'profile_vpc' the actual key to be used in playbook
Expand Down Expand Up @@ -335,6 +348,19 @@
- Enable lacp convergence for vPC port-channels
type: bool
default: false
lacp_port_priority:
description:
- <1-65535> Set LACP port priority on member interfaces, default is 32768
type: int
default: 32768
lacp_rate:
description:
- Set the rate at which LACP control packets are sent to an LACP-supported
interface. Normal rate (30 seconds), fast rate (1 second), rate is set on member
interfaces, default is normal
type: str
choices: ['normal', 'fast']
default: normal
profile_subint:
description:
- Though the key shown here is 'profile_subint' the actual key to be used in playbook
Expand Down Expand Up @@ -1963,6 +1989,8 @@ def __init__(self, module):
"ENABLE_ORPHAN_PORT": "orphan_port",
"DISABLE_LACP_SUSPEND": "disable_lacp_suspend_individual",
"ENABLE_LACP_VPC_CONV": "enable_lacp_vpc_convergence",
"LACP_PORT_PRIO": "lacp_port_priority",
"LACP_RATE": "lacp_rate",
"ENABLE_PFC": "enable_pfc",
"ENABLE_MONITOR": "enable_monitor",
"CDP_ENABLE": "enable_cdp",
Expand Down Expand Up @@ -2320,6 +2348,8 @@ def dcnm_intf_validate_port_channel_input(self, config):
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
lacp_port_priority=dict(type="int", default=32768, range_min=1, range_max=65535),
lacp_rate=dict(type="str", default="normal"),
)

pc_prof_spec_access = dict(
Expand All @@ -2340,6 +2370,8 @@ def dcnm_intf_validate_port_channel_input(self, config):
enable_pfc=dict(type="bool", default=False),
duplex=dict(
type="str", default="auto", choices=["auto", "full", "half"]),
lacp_port_priority=dict(type="int", default=32768, range_min=1, range_max=65535),
lacp_rate=dict(type="str", default="normal"),
)

pc_prof_spec_l3 = dict(
Expand Down Expand Up @@ -2426,6 +2458,8 @@ def dcnm_intf_validate_virtual_port_channel_input(self, cfg):
admin_state=dict(type="bool", default=True),
disable_lacp_suspend_individual=dict(type="bool", default=False),
enable_lacp_vpc_convergence=dict(type="bool", default=False),
lacp_port_priority=dict(type="int", default=32768, range_min=1, range_max=65535),
lacp_rate=dict(type="str", default="normal"),
)

vpc_prof_spec_access = dict(
Expand Down Expand Up @@ -2912,6 +2946,14 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile):
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile].get("lacp_port_priority"):
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = delem[profile]["lacp_port_priority"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = 32768
if delem[profile].get("lacp_rate"):
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = delem[profile]["lacp_rate"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = "normal"
if delem[profile]["mode"] == "access":
if delem[profile]["members"] is None:
intf["interfaces"][0]["nvPairs"]["MEMBER_INTERFACES"] = ""
Expand Down Expand Up @@ -2945,6 +2987,14 @@ def dcnm_intf_get_pc_payload(self, delem, intf, profile):
"ENABLE_MONITOR"] = delem[profile]["enable_monitor"]
intf["interfaces"][0]["nvPairs"][
"PORT_DUPLEX_MODE"] = delem[profile]["duplex"]
if delem[profile].get("lacp_port_priority"):
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = delem[profile]["lacp_port_priority"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = 32768
if delem[profile].get("lacp_rate"):
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = delem[profile]["lacp_rate"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = "normal"
if delem[profile]["mode"] == "l3":
if delem[profile]["members"] is None:
intf["interfaces"][0]["nvPairs"]["MEMBER_INTERFACES"] = ""
Expand Down Expand Up @@ -3170,6 +3220,14 @@ def dcnm_intf_get_vpc_payload(self, delem, intf, profile):
intf["interfaces"][0]["nvPairs"]["ENABLE_LACP_VPC_CONV"] = delem[profile]["enable_lacp_vpc_convergence"]
else:
intf["interfaces"][0]["nvPairs"]["ENABLE_LACP_VPC_CONV"] = False
if delem[profile].get("lacp_port_priority"):
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = delem[profile]["lacp_port_priority"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_PORT_PRIO"] = 32768
if delem[profile].get("lacp_rate"):
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = delem[profile]["lacp_rate"]
else:
intf["interfaces"][0]["nvPairs"]["LACP_RATE"] = "normal"
intf["interfaces"][0]["nvPairs"]["INTF_NAME"] = ifname
intf["interfaces"][0]["nvPairs"]["SPEED"] = self.dcnm_intf_xlate_speed(
str(delem[profile].get("speed", ""))
Expand Down Expand Up @@ -4267,6 +4325,8 @@ def dcnm_intf_compare_want_and_have(self, state):
"CDP_ENABLE",
"DISABLE_LACP_SUSPEND",
"ENABLE_LACP_VPC_CONV",
"LACP_PORT_PRIO",
"LACP_RATE",
"ENABLE_MONITOR",
"ENABLE_ORPHAN_PORT",
"ENABLE_PFC",
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/modules/dcnm/test_dcnm_intf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2997,6 +2997,8 @@ def test_dcnm_intf_pc_replaced_existing(self):
"ROUTING_TAG",
"SPEED",
"CONF",
"LACP_PORT_PRIO",
"LACP_RATE"
]

for d in result["diff"][0]["replaced"]:
Expand Down Expand Up @@ -4224,7 +4226,9 @@ def test_dcnm_intf_vpc_replaced_existing(self):
"PEER2_PO_CONF",
"INTF_NAME",
"ENABLE_LACP_VPC_CONV",
"DISABLE_LACP_SUSPEND"
"DISABLE_LACP_SUSPEND",
"LACP_PORT_PRIO",
"LACP_RATE"
]

for d in result["diff"][0]["replaced"]:
Expand Down