Skip to content

Commit 58605cc

Browse files
raphaelt-nvidiajudyjoseph
authored andcommitted
Increase min-links limit for portchannel from 128 to 1024. (#7265)
#### 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.
1 parent e3cb49f commit 58605cc

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
diff --git a/man/teamd.conf.5 b/man/teamd.conf.5
2+
index 350ffc9..dc913cd 100644
3+
--- a/man/teamd.conf.5
4+
+++ b/man/teamd.conf.5
5+
@@ -248,7 +248,7 @@ Default:
6+
.RE
7+
.TP
8+
.BR "runner.min_ports " (int)
9+
-Specifies the minimum number of ports that must be active before asserting carrier in the master interface, value can be 1 \(en 255.
10+
+Specifies the minimum number of ports that must be active before asserting carrier in the master interface, value can be 1 \(en 1024.
11+
.RS 7
12+
.PP
13+
Default:
14+
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
15+
index 9354ebb..a901398 100644
16+
--- a/teamd/teamd_runner_lacp.c
17+
+++ b/teamd/teamd_runner_lacp.c
18+
@@ -151,6 +151,7 @@ struct lacp {
19+
#define LACP_CFG_DFLT_FALLBACK false
20+
int min_ports;
21+
#define LACP_CFG_DFLT_MIN_PORTS 1
22+
+#define LACP_CFG_DFLT_MIN_PORTS_MAX 1024
23+
enum lacp_agg_select_policy agg_select_policy;
24+
#define LACP_CFG_DFLT_AGG_SELECT_POLICY LACP_AGG_SELECT_LACP_PRIO
25+
} cfg;
26+
@@ -493,7 +494,7 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp)
27+
err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports");
28+
if (err) {
29+
lacp->cfg.min_ports = LACP_CFG_DFLT_MIN_PORTS;
30+
- } else if (tmp < 1 || tmp > UCHAR_MAX) {
31+
+ } else if (tmp < 1 || tmp > LACP_CFG_DFLT_MIN_PORTS_MAX) {
32+
teamd_log_err("\"min_ports\" value is out of its limits.");
33+
return -EINVAL;
34+
} else {

src/libteam/patch/series

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
0009-Fix-ifinfo_link_with_port-race-condition-with-newlink.patch
1010
0010-When-read-of-timerfd-returned-0-don-t-consider-this-.patch
1111
0011-Remove-extensive-debug-output.patch
12+
0012-Increase-min_ports-upper-limit-to-1024.patch

src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
"PORT_CHANNEL_TEST": {
33
"desc": "Configure a member port in PORT_CHANNEL table."
44
},
5+
"PORT_CHANNEL_MAX_VALID_MIN_LINKS": {
6+
"desc": "Configure PortChannel with maximum valid value of min-links."
7+
},
8+
"PORT_CHANNEL_OUT_OF_RANGE_MIN_LINKS": {
9+
"desc": "Configure PortChannel with greater than maximum valid value of min-links.",
10+
"eStr": ["Value", "does not satisfy the constraint"]
11+
},
512
"PORT_CHANNEL_WRONG_PATTERN": {
613
"desc": "INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.",
714
"eStrKey" : "Pattern",

src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json

+64
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,70 @@
3434
}
3535
}
3636
},
37+
"PORT_CHANNEL_MAX_VALID_MIN_LINKS": {
38+
"sonic-port:sonic-port": {
39+
"sonic-port:PORT": {
40+
"PORT_LIST": [
41+
{
42+
"admin_status": "up",
43+
"alias": "eth0",
44+
"description": "Ethernet0",
45+
"lanes": "65",
46+
"mtu": 9000,
47+
"name": "Ethernet0",
48+
"speed": 25000
49+
}
50+
]
51+
}
52+
},
53+
"sonic-portchannel:sonic-portchannel": {
54+
"sonic-portchannel:PORTCHANNEL": {
55+
"PORTCHANNEL_LIST": [
56+
{
57+
"admin_status": "up",
58+
"members": [
59+
"Ethernet0"
60+
],
61+
"min_links": "1024",
62+
"mtu": "9100",
63+
"name": "PortChannel0001"
64+
}
65+
]
66+
}
67+
}
68+
},
69+
"PORT_CHANNEL_OUT_OF_RANGE_MIN_LINKS": {
70+
"sonic-port:sonic-port": {
71+
"sonic-port:PORT": {
72+
"PORT_LIST": [
73+
{
74+
"admin_status": "up",
75+
"alias": "eth0",
76+
"description": "Ethernet0",
77+
"lanes": "65",
78+
"mtu": 9000,
79+
"name": "Ethernet0",
80+
"speed": 25000
81+
}
82+
]
83+
}
84+
},
85+
"sonic-portchannel:sonic-portchannel": {
86+
"sonic-portchannel:PORTCHANNEL": {
87+
"PORTCHANNEL_LIST": [
88+
{
89+
"admin_status": "up",
90+
"members": [
91+
"Ethernet0"
92+
],
93+
"min_links": "1025",
94+
"mtu": "9100",
95+
"name": "PortChannel0001"
96+
}
97+
]
98+
}
99+
}
100+
},
37101
"PORT_CHANNEL_WRONG_PATTERN": {
38102
"sonic-portchannel:sonic-portchannel": {
39103
"sonic-portchannel:PORTCHANNEL": {

src/sonic-yang-models/yang-models/sonic-portchannel.yang

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module sonic-portchannel {
2626

2727
description "PORTCHANNEL yang Module for SONiC OS";
2828

29+
revision 2021-06-13 {
30+
description "Change min-links valid range from 1-128 to 1-1024";
31+
}
32+
2933
revision 2021-03-31 {
3034
description "Add PortChannel Interface List with VRF attribute";
3135
}
@@ -74,8 +78,8 @@ module sonic-portchannel {
7478
}
7579

7680
leaf min_links {
77-
type uint8 {
78-
range 1..128;
81+
type uint16 {
82+
range 1..1024;
7983
}
8084
}
8185

0 commit comments

Comments
 (0)