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

Increase min-links limit for portchannel from 128 to 1024. #7265

Merged
merged 4 commits into from
Jul 8, 2021

Conversation

raphaelt-nvidia
Copy link
Contributor

@raphaelt-nvidia raphaelt-nvidia commented Apr 8, 2021

Signed-off-by: Raphael Tryster raphaelt@nvidia.com

Why I did it

Restrict the min-links parameter in "config portchannel" to the range 1-1024.
Fixes #6781 in conjunction with sonic-net/sonic-utilities#1630.
Align YANG model with limits in libteam and sonic-utilties.

How I did it

PR 1630 in sonic-utilities prevents CLI user from entering a value outside the allowed range. This PR does the following:

How to verify it

config portchannel add PortChannel0004 --min-links 1024

Command should be accepted.

show interfaces portchannel

Output should show PortChannel0004, no errors on CLI.

config portchannel add PortChannel0005 --min-links 1025

Command should be rejected

show interfaces portchannel

Output should not show PortChannel0005 , no errors on CLI.

Which release branch to backport (provide reason below if selected)

Description for the changelog

Updates YANG model to allow up to 1024 min_links for portchannel. Fixes #6781 in conjunction with #1630.

A picture of a cute animal (not mandatory but encouraged)

@lguohan
Copy link
Collaborator

lguohan commented Apr 8, 2021

do you need to update the libteam as well?

@raphaelt-nvidia
Copy link
Contributor Author

The link I quoted above is the change in libteam.

@@ -23,7 +23,7 @@ module sonic-portchannel {
description "PORTCHANNEL yang Module for SONiC OS";

revision 2019-07-01 {
description "First Revision";
description "Increased range for min_links";

Choose a reason for hiding this comment

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

Yang model subgroup meeting 4/8:
Please confirm if revision needs to be changed. (cc: @praveen-li)

Copy link
Contributor

Choose a reason for hiding this comment

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

For each update to the yang, it is better to maintain a corresponding revision with the description of the change.

type uint8 {
range 1..128;
type uint16 {
range 1..1024;
}

Choose a reason for hiding this comment

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

Yang model subgroup meeting 4/8:
Do any tests need to be updated with new range limit (128->1024)? (cc: @praveen-li )

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like a test case needs to be added for the range check.

@joyas-joseph
Copy link
Contributor

The link I quoted above is the change in libteam.

That change is not available in sonic yet, right? The version being checked out is much older (from Feb 4, 2020).

        git clone https://github.com/jpirko/libteam.git
        pushd ./libteam
        git checkout -b teamd -f c7237377dead39ae4a711297203bacf7edb9fa41

@liat-grozovik
Copy link
Collaborator

@lguohan and @judyjoseph can you please clarify what is needed?
do we want to keep this change and work to fix the conflict or should we abandon this as libteam is not the latest one? i dont think libteam should be updated just because of this yang model.

@joyas-joseph
Copy link
Contributor

@lguohan and @judyjoseph can you please clarify what is needed?
do we want to keep this change and work to fix the conflict or should we abandon this as libteam is not the latest one? i dont think libteam should be updated just because of this yang model.

Let's have it consistent.
We can have the range 1..1024, if we bring in at least the commit (jpirko/libteam@69a7494) as a patch.
Without that, lets have the range 1..255.

@lguohan
Copy link
Collaborator

lguohan commented May 7, 2021

can you help to resolve conflict?

@joyas-joseph
Copy link
Contributor

@lguohan and @judyjoseph can you please clarify what is needed?
do we want to keep this change and work to fix the conflict or should we abandon this as libteam is not the latest one? i dont think libteam should be updated just because of this yang model.

Let's have it consistent.
We can have the range 1..1024, if we bring in at least the commit (jpirko/libteam@69a7494) as a patch.
Without that, lets have the range 1..255.

@raphaelt-nvidia. Please update to have range from 1..255.

@raphaelt-nvidia
Copy link
Contributor Author

raphaelt-nvidia commented May 11, 2021 via email

type uint8 {
range 1..128;
type uint16 {
range 0..1024;
}
Copy link
Contributor

@joyas-joseph joyas-joseph Jun 4, 2021

Choose a reason for hiding this comment

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

Shouldnt the range be 1..1024?

If we do support value 0, what does it indicate? #Closed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found this necessary to be compatible with related sonic-net/sonic-utilities#1630. The original code there sets the default value of min-links to 0, and now that I have introduced range checking there, keeping a lower bound of 1 causes range check to fail. So this change aligns yang with CLI.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you test the 0 in current sonic image? Does teamd support it? ie. you set it as 0, and admin down all the member ports, and the portchannel itself is still up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Results are the same with current master and with the changes in this PR. Recall that the default value of min-links in sonic-utilities is 0. In both cases, shutting down all members of the LAG causes the portchannel to go oper down. I noticed some non-deterministic behaviour, that may be a separate bug: with one of two member ports down, the LAG is sometimes up and sometimes down.

Since the default is 0, one would expect that in the current master, a portchannel created with default min-links should be up when all members are down. On the other hand, the work in this PR is supposed to clean up mismatches, and based on Qi's question, I now think that it doesn't do what it should. What I did was align yang with CLI, but it seems teamd is now the odd one out, as the change in teamd only adjusted the upper limit and kept the lower at 1. If you think it is reasonable to specify that a portchannel with all members down should be up (i.e. min-links = 0), then we have some more work to do to make teamd comply. (Any other places?) If not, then I should do the alignment the other way: put the lower limit in yang back to 1, and change the lower limit and default in sonic-utilities to 1.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the great insight! I prefer set lower limit of min-link to 1 to make life a little bit easier.

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. Let's have the lower limit of min-links set to 1.

Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

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

As comments

joyas-joseph
joyas-joseph previously approved these changes Jun 14, 2021
qiluo-msft
qiluo-msft previously approved these changes Jun 14, 2021
Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
… tests

Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
@liat-grozovik
Copy link
Collaborator

@qiluo-msft and @judyjoseph could you please help to review recent fixes and approve for merge?

@qiluo-msft
Copy link
Collaborator

I am confused about the numbers in PR description, like 0, 255. So I changed it according to my understanding. Please double check.

@raphaelt-nvidia
Copy link
Contributor Author

I am confused about the numbers in PR description, like 0, 255. So I changed it according to my understanding. Please double check.

Now I am confused. What and where did you change? I think your confusion stems from the mismatches that existed before this work was done, and it appears above in the discussion. Originally, teamd was 1-255, cli was any integer with default 0, and yang was 1-128. Now, they should all be aligned on 1-1024.

@qiluo-msft
Copy link
Collaborator

You can check my changes by clicking the dropdown menu button
image

@raphaelt-nvidia
Copy link
Contributor Author

You can check my changes by clicking the dropdown menu button
image

I had a bit of trouble finding it because I see it as Apr 8. I deduce from this that you are in China (I am in Israel) and github shows the date of a comment according to the viewer's time zone. Anyway, I saw your changes, and I think they are neither better nor worse than the original, because of the mismatches between the modules. So, no problem.

@qiluo-msft qiluo-msft merged commit 79300a9 into sonic-net:master Jul 8, 2021
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…#7265)

#### Why I did it

Restrict the min-links parameter in "config portchannel" to the range 1-1024.
Fixes sonic-net#6781 in conjunction with sonic-net#1630.
Align YANG model with limits in libteam and sonic-utilties.

#### How I did it

PR 1630 in sonic-utilities prevents CLI user from entering a value outside the allowed range.  This PR does the following:

- Increases the maximum value of min-links from 128 to 1024.
- Provides validation in libteam, incorporating as a patch the code in https://git.kernel.org/pub/scm/linux/kernel/git/jpirko/libteam.git/commit/?id=69a7494bb77dc10bb27076add07b380dbd778592.
- Updates the Yang model upper limit from 128 to 1024 (was inconsistent with libteam value).
- Updates the Yang model lower limit from 1 to 0, since 0 is set as default in sonic-utilities which would fail its new range check otherwise.
- Added Yang tests for valid and invalid value.

#### How to verify it

config portchannel add PortChannel0004 --min-links 1024

Command should be accepted.

show interfaces portchannel

Output should show PortChannel0004, no errors on CLI.

config portchannel add PortChannel0005 --min-links 1025

Command should be rejected

show interfaces portchannel

Output should not show PortChannel0005 , no errors on CLI.

#### Which release branch to backport (provide reason below if selected)


#### Description for the changelog

Updates YANG model to allow up to 1024 min_links for portchannel.  Fixes sonic-net#6781 in conjunction with sonic-net#1630.
@raphaelt-nvidia
Copy link
Contributor Author

raphaelt-nvidia commented Oct 11, 2021

@liat-grozovik This PR fixes #6781 in conjunction with sonic-net/sonic-utilities#1630. The other PR was also merged to 202106 but this one was not. Please add a label to request that this PR be merged to 202106. I see no merge conflicts.

judyjoseph pushed a commit that referenced this pull request Oct 14, 2021
#### Why I did it

Restrict the min-links parameter in "config portchannel" to the range 1-1024.
Fixes #6781 in conjunction with #1630.
Align YANG model with limits in libteam and sonic-utilties.

#### How I did it

PR 1630 in sonic-utilities prevents CLI user from entering a value outside the allowed range.  This PR does the following:

- Increases the maximum value of min-links from 128 to 1024.
- Provides validation in libteam, incorporating as a patch the code in https://git.kernel.org/pub/scm/linux/kernel/git/jpirko/libteam.git/commit/?id=69a7494bb77dc10bb27076add07b380dbd778592.
- Updates the Yang model upper limit from 128 to 1024 (was inconsistent with libteam value).
- Updates the Yang model lower limit from 1 to 0, since 0 is set as default in sonic-utilities which would fail its new range check otherwise.
- Added Yang tests for valid and invalid value.

#### How to verify it

config portchannel add PortChannel0004 --min-links 1024

Command should be accepted.

show interfaces portchannel

Output should show PortChannel0004, no errors on CLI.

config portchannel add PortChannel0005 --min-links 1025

Command should be rejected

show interfaces portchannel

Output should not show PortChannel0005 , no errors on CLI.

#### Which release branch to backport (provide reason below if selected)


#### Description for the changelog

Updates YANG model to allow up to 1024 min_links for portchannel.  Fixes #6781 in conjunction with #1630.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PortChannel creation with out of range(0-255) value of "min-links", leads to Exception during update_data()
8 participants