Skip to content
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

[swss/cfgmgr] teammgr configure lacp rate #2121

Merged

Conversation

globaltrouble
Copy link
Contributor

@globaltrouble globaltrouble commented Jan 25, 2022

What I did

Make lacp_rate configurable for portchannel.

	Option specifying the rate in which we'll ask our link partner
	to transmit LACPDU packets in 802.3ad mode.  Possible values
	are:

	slow
		Request partner to transmit LACPDUs every 30 seconds

	fast
		Request partner to transmit LACPDUs every 1 second

	The default is slow.

Why I did it

In case of slow lacp_rate configuration link down will be detected in 60-90 seconds, it may be to long (for example for MCLAG high availability), in case of using --fast-rate=true link down will be detected in 2-3 seconds.

How I did it

How to verify it

Confgiure bond on other side, then configure portchannel and sniff the traffic from it.

config portchannel add PortChannel0001  --fast-rate=true
config portchannel member add PortChannel0001 Ethernet0
config interface ip add PortChannel0001  192.168.1.2/24
tcpdump -ne

@@ -1139,21 +1139,25 @@ name as object key and member list as attribute.
```
{
"PORTCHANNEL": {
"PortChannel0003": {
Copy link
Contributor Author

@globaltrouble globaltrouble Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix formatting and reorder as in config utility for better readability, "PortChannel0003" contains all mandatory attrs, "PortChannel0004" additionally contains options attrs

@globaltrouble globaltrouble marked this pull request as ready for review January 28, 2022 15:01
@globaltrouble
Copy link
Contributor Author

@stcheng could you please review it?

@@ -553,6 +559,11 @@ task_process_status TeamMgr::addLag(const string &alias, int min_links, bool fal
conf << ",\"fallback\":true";
}

if (lacp_rate == "fast")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "teamd.conf", (LACP RUNNER SPECIFIC OPTIONS), fast_rate is defined to be a boolean,

runner.fast_rate (bool) Option specifies the rate at which our link partner is asked to transmit LACPDU packets. If this is true then packets will be sent once per second. Otherwise they will be sent every 30 seconds.

https://www.unix.com/man-page/centos/5/teamd.conf/
http://manpages.ubuntu.com/manpages/xenial/man5/teamd.conf.5.html

While spawning the teamd process with it's config file, "slow|fast" should be converted to "false|true". Instead why can't we define "fast_rate/lacp_rate" to be a boolean in consistent with "teamd" configuration ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Arthi, please use fast_rate in the config-DB as well.

Copy link
Contributor Author

@globaltrouble globaltrouble Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering your question:

  • It's easier to read concreate status than to read a boolean flag and convert it to concreate status.
  • Boolean flags are harder to maintain (update code base), in case new type need to be added - all code need to be change (boolean flags and conditions using them).
  • If it's possible: modules should not depend on low level details. In this example for persion unfarmiliar with teamd it will be easier to find info only about lacp_rate, without dig in teamd.

@venkatmahalingam @ArthiSivanantham, thank you for the review, changed it to be consistent with links you pointed. Also changed config tool too.

Copy link
Collaborator

@nazariig nazariig Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@venkatmahalingam / @ArthiSivanantham IMHO, the arguments provided by @globaltrouble seems to be reasonable. Do we have a strong opinion here? Although, the original approach is compliant with the teamd.conf but it is not user friendly.

IMHO, lacp_rate with SLOW/FAST looks better to me

Copy link
Contributor

@venkatmahalingam venkatmahalingam Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any strong opinion @nazariig it's just a suggestion as well known teamd uses fast_rate to control the LACP rate and also we can avoid conversion (lacp_rate to fast_rate) in the back-end, some NOS vendors do use "[no] lacp fast rate" config knobs.

@prsunny prsunny requested a review from judyjoseph February 1, 2022 01:02
@globaltrouble globaltrouble force-pushed the feature/teamd-configure-lacp-rate branch from 0cdaec9 to 74c52f4 Compare February 1, 2022 09:15
@msosyak
Copy link
Contributor

msosyak commented Feb 16, 2022

@ArthiSivanantham @venkatmahalingam @prsunny Are there any other comments? If not, please, help to merge this and related PR

@msosyak msosyak force-pushed the feature/teamd-configure-lacp-rate branch 3 times, most recently from 3e38104 to 1107049 Compare March 22, 2022 09:29
@msosyak
Copy link
Contributor

msosyak commented Mar 24, 2022

@ArthiSivanantham @venkatmahalingam @prsunny Could we merge this and related?

@msosyak
Copy link
Contributor

msosyak commented Mar 29, 2022

@venkatmahalingam @ArthiSivanantham do you have other comments? If not, please approve.

@msosyak
Copy link
Contributor

msosyak commented Apr 5, 2022

@qiluo-msft @prsunny @nazariig Please help review and merge


# Create PortChannels
tbl = swsscommon.Table(self.cdb, "PORTCHANNEL")
fvs_base = [("admin_status", "up"), ("mtu", "9100"), ("oper_status", "up"), ("lacp_key", "auto")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msosyak why do we need oper_status in Config DB?

self.cdb = swsscommon.DBConnector(4, dvs.redis_sock, 0)

# Create PortChannels
tbl = swsscommon.Table(self.cdb, "PORTCHANNEL")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.sleep(1)

# Add members to PortChannels
tbl = swsscommon.Table(self.cdb, "PORTCHANNEL_MEMBER")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.sleep(1)

# test fast rate was not set on portchannel_slow
output = dvs.runcmd("teamdctl {} state dump".format(portchannel_slow[0]))[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msosyak suggest extending and reusing LAG testing framework: https://github.com/Azure/sonic-swss/blob/master/tests/dvslib/dvs_lag.py

tbl = swsscommon.Table(self.cdb, "PORTCHANNEL_MEMBER")
for portchannel in portchannel_slow, portchannel_fast:
tbl._del(portchannel[0] + "|" + portchannel[1])
time.sleep(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msosyak get_and_verify_port_channel_members assert?

tbl = swsscommon.Table(self.cdb, "PORTCHANNEL")
for portchannel in portchannel_slow, portchannel_fast:
tbl._del(portchannel[0])
time.sleep(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msosyak get_and_verify_port_channel assert?

@prsunny
Copy link
Collaborator

prsunny commented Apr 6, 2022

@qiluo-msft @prsunny @nazariig Please help review and merge

@msosyak , changes looks good to me. Please address the outstanding comments and also get the dependent PRs in sonic-utilities, HLD merged.

@nazariig , @venkatmahalingam , @ArthiSivanantham to signoff

@bratashX
Copy link
Contributor

will be good to include these changes into 202111 branch

@msosyak msosyak force-pushed the feature/teamd-configure-lacp-rate branch 3 times, most recently from de2d6d3 to 1a64d22 Compare July 5, 2022 13:14
@msosyak msosyak force-pushed the feature/teamd-configure-lacp-rate branch from 1a64d22 to 5565488 Compare July 12, 2022 18:38
@msosyak
Copy link
Contributor

msosyak commented Jul 13, 2022

Sorry for the late reaction.

@prsunny @nazariig Conflicts resolved. UT updated.

@@ -89,6 +91,30 @@ def test_Portchannel(self, dvs, testlog):
lagms = lagmtbl.getKeys()
assert len(lagms) == 0

def test_Portchannel_fast_rate(self, dvs, testlog):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msosyak please use test parametrization to avoid loops

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@msosyak msosyak force-pushed the feature/teamd-configure-lacp-rate branch from 5565488 to c38790c Compare July 14, 2022 10:49
@msosyak
Copy link
Contributor

msosyak commented Jul 19, 2022

@nazariig Do you have other comments?

@msosyak
Copy link
Contributor

msosyak commented Jul 20, 2022

@prsunny Could we merge this?

@prsunny
Copy link
Collaborator

prsunny commented Jul 22, 2022

@judyjoseph , can you please review/signoff?

Copy link
Contributor

@judyjoseph judyjoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Can you also add the test results (the o/p of teamdctl state dump) in PR description with local/peer device having lacp rate configured as fast/slow rate respectively.

@judyjoseph judyjoseph merged commit dc477fb into sonic-net:master Aug 3, 2022
preetham-singh pushed a commit to preetham-singh/sonic-swss that referenced this pull request Aug 6, 2022
* add lacp_rate config
* add lacp_rate to teammgr addLag params
* docs for portchannel db config
* add test

Co-authored-by: Anton <antonx.novikau@intel.com>
Co-authored-by: Myron Sosyak <myronx.sosyak@intel.com>
qiluo-msft pushed a commit to sonic-net/sonic-utilities that referenced this pull request Aug 13, 2022
#### What I did

Make lacp_rate configurable for portchannel.


```
	Option specifying the rate in which we'll ask our link partner
	to transmit LACPDU packets in 802.3ad mode.  Possible values
	are:

	slow
		Request partner to transmit LACPDUs every 30 seconds

	fast
		Request partner to transmit LACPDUs every 1 second

	The default is slow.
```

#### Why I did it

In case of slow lacp_rate configuration link down will be detected in 60-90 seconds, it may be to long (for example for MCLAG high availability), in case of using ` --fast-rate=true` link down will be detected in 2-3 seconds.

#### How I did it
   
* add optional argument to `config portchannel` command, default=slow for backward compatibility. (this PR)
* parse argument in `teammgr` and forward it to `teamd` (other PR: sonic-net/sonic-swss#2121)
* update docs sonic-net/SONiC#937

#### How to verify it

Confgiure bond on other side, then configure portchannel and sniff the traffic from it.

```
config portchannel add PortChannel0001 --fast-rate=true
config portchannel member add PortChannel0001 Ethernet0
config interface ip add PortChannel0001  192.168.1.2/24
tcpdump -ne
```
preetham-singh pushed a commit to preetham-singh/sonic-utilities that referenced this pull request Nov 21, 2022
#### What I did

Make lacp_rate configurable for portchannel.


```
	Option specifying the rate in which we'll ask our link partner
	to transmit LACPDU packets in 802.3ad mode.  Possible values
	are:

	slow
		Request partner to transmit LACPDUs every 30 seconds

	fast
		Request partner to transmit LACPDUs every 1 second

	The default is slow.
```

#### Why I did it

In case of slow lacp_rate configuration link down will be detected in 60-90 seconds, it may be to long (for example for MCLAG high availability), in case of using ` --fast-rate=true` link down will be detected in 2-3 seconds.

#### How I did it
   
* add optional argument to `config portchannel` command, default=slow for backward compatibility. (this PR)
* parse argument in `teammgr` and forward it to `teamd` (other PR: sonic-net/sonic-swss#2121)
* update docs sonic-net/SONiC#937

#### How to verify it

Confgiure bond on other side, then configure portchannel and sniff the traffic from it.

```
config portchannel add PortChannel0001 --fast-rate=true
config portchannel member add PortChannel0001 Ethernet0
config interface ip add PortChannel0001  192.168.1.2/24
tcpdump -ne
```
malletvapid23 added a commit to malletvapid23/Sonic-Utility that referenced this pull request Aug 3, 2023
#### What I did

Make lacp_rate configurable for portchannel.


```
	Option specifying the rate in which we'll ask our link partner
	to transmit LACPDU packets in 802.3ad mode.  Possible values
	are:

	slow
		Request partner to transmit LACPDUs every 30 seconds

	fast
		Request partner to transmit LACPDUs every 1 second

	The default is slow.
```

#### Why I did it

In case of slow lacp_rate configuration link down will be detected in 60-90 seconds, it may be to long (for example for MCLAG high availability), in case of using ` --fast-rate=true` link down will be detected in 2-3 seconds.

#### How I did it
   
* add optional argument to `config portchannel` command, default=slow for backward compatibility. (this PR)
* parse argument in `teammgr` and forward it to `teamd` (other PR: sonic-net/sonic-swss#2121)
* update docs sonic-net/SONiC#937

#### How to verify it

Confgiure bond on other side, then configure portchannel and sniff the traffic from it.

```
config portchannel add PortChannel0001 --fast-rate=true
config portchannel member add PortChannel0001 Ethernet0
config interface ip add PortChannel0001  192.168.1.2/24
tcpdump -ne
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants