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

Added support for dynamic nexthop groups in Fine Grained Hashing Yang… #21545

Open
wants to merge 4 commits into
base: master
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
8 changes: 4 additions & 4 deletions files/build_templates/default_manifest
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"show": [],
"config": [],
"clear": [],
"auto-generate-show": false,
"auto-generate-config": false,
"auto-generate-show-source-yang-modules": [],
"auto-generate-config-source-yang-modules": []
"auto-generate-show": true,
"auto-generate-config": true,
"auto-generate-show-source-yang-modules": [sonic-fine-grained-ecmp],
"auto-generate-config-source-yang-modules": [sonic-fine-grained-ecmp]
}
}
22 changes: 19 additions & 3 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ IPV4 DHPC Server related configuration are defined in **DHCP_SERVER_IPV4**, **DH

### FG_NHG

The FG_NHG table provides information on Next Hop Groups, including a specified Hash Bucket Size (bucket_size) and match mode for each group.
The FG_NHG table provides information on Next Hop Groups, including a specified Hash Bucket Size (bucket_size), match mode for each group, an optional max-next-hops attribute for prefix_based match_ mode.

```
"FG_NHG": {
Expand All @@ -1155,7 +1155,17 @@ The FG_NHG table provides information on Next Hop Groups, including a specified
"fgnhg_v6": {
"bucket_size": "120",
"match_mode": "nexthop-based"
}
},
"dynamic_fgnhg_v4": {
"bucket_size": "120",
"match_mode": "prefix-based",
"max_next_hops": "6"
},
"dynamic_fgnhg_v6": {
"bucket_size": "120",
"match_mode": "prefix-based",
"max_next_hops": "6"
}
}
```

Expand Down Expand Up @@ -1189,7 +1199,13 @@ The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desi
},
"fc:05::/128": {
"FG_NHG": "fgnhg_v6"
}
},
"200.175.150.125/32": {
"FG_NHG": "dynamic_fgnhg_v4"
},
"fd:06::/128": {
"FG_NHG": "dynamic_fgnhg_v6"
}
}
```

Expand Down
8 changes: 8 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,11 @@
"nhg2": {
"bucket_size": "32",
"match_mode": "route-based"
},
"nhg3": {
"bucket_size": "24",
"match_mode": "prefix-based",
"max_next_hops": "6"
}
},
"FG_NHG_PREFIX": {
Expand All @@ -2734,6 +2739,9 @@
},
"192.168.0.0/16": {
"FG_NHG": "nhg2"
},
"172.17.0.1/32": {
"FG_NHG": "nhg3"
}
},
"FIPS":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,19 @@
"FG_NHG_MEMBER_TEST_DUPLICATE_MEMBER": {
"desc": "Fine-grained ECMP next-hop member configuration with duplicate member in FG_NHG_MEMBER_LIST table.",
"eStr": "Duplicated instance of \"FG_NHG_MEMBER_LIST\" list."
},
"FG_NHG_PREFIX_BASED_MISSING_MAX_NEXT_HOPS": {
"desc": "Fine-grained ECMP prefix-based match-mode configuration with missing max_next_hops in FG_NHG_LIST table.",
"eStrKey": "Mandatory",
"eStr": ["max_next_hops"]
},
"FG_NHG_PREFIX_BASED_INVALID_MAX_NEXT_HOPS": {
"desc": "Fine-grained ECMP prefix-based match-mode configuration with out-of-range max_next_hops value in FG_NHG_LIST table.",
"eStrKey": "Range",
"eStr": ["1..128"]
},
"FG_NHG_PREFIX_BASED_MISSING_BUCKET_SIZE": {
"desc": "Fine-grained ECMP prefix-based match-mode configuration with missing bucket_size in FG_NHG_LIST table.",
"eStr": "Missing required element \"bucket_size\" in \"FG_NHG_LIST\"."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"name": "group2",
"bucket_size": 20,
"match_mode": "route-based"
},
{
"name": "group3",
"bucket_size": 30,
"match_mode": "prefix-based",
"max_next_hops": 6
}
]
}
Expand All @@ -30,6 +36,12 @@
"name": "group2",
"bucket_size": 20,
"match_mode": "route-based"
},
{
"name": "group3",
"bucket_size": 30,
"match_mode": "prefix-based",
"max_next_hops": 6
}
]
},
Expand All @@ -43,13 +55,21 @@
"ip_prefix": "10.1.0.0/24",
"FG_NHG": "group2"
},
{
"ip_prefix": "10.2.0.0/24",
"FG_NHG": "group3"
},
{
"ip_prefix": "fe80::/64",
"FG_NHG": "group1"
},
{
"ip_prefix": "::/0",
"FG_NHG": "group2"
},
{
"ip_prefix": "2001:db8::/32",
"FG_NHG": "group3"
}
]
}
Expand Down Expand Up @@ -391,5 +411,45 @@
]
}
}
},
"FG_NHG_PREFIX_BASED_MISSING_MAX_NEXT_HOPS": {
"sonic-fine-grained-ecmp:sonic-fine-grained-ecmp": {
"sonic-fine-grained-ecmp:FG_NHG": {
"FG_NHG_LIST": [
{
"name": "group3",
"bucket_size": 30,
"match_mode": "prefix-based"
}
]
}
}
},
"FG_NHG_PREFIX_BASED_INVALID_MAX_NEXT_HOPS": {
"sonic-fine-grained-ecmp:sonic-fine-grained-ecmp": {
"sonic-fine-grained-ecmp:FG_NHG": {
"FG_NHG_LIST": [
{
"name": "group3",
"bucket_size": 30,
"match_mode": "prefix-based",
"max_next_hops": 2048
}
]
}
}
},
"FG_NHG_PREFIX_BASED_MISSING_BUCKET_SIZE": {
"sonic-fine-grained-ecmp:sonic-fine-grained-ecmp": {
"sonic-fine-grained-ecmp:FG_NHG": {
"FG_NHG_LIST": [
{
"name": "group3",
"match_mode": "prefix-based",
"max_next_hops": 6
}
]
}
}
}
}
}
54 changes: 36 additions & 18 deletions src/sonic-yang-models/yang-models/sonic-fine-grained-ecmp.yang
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ module sonic-fine-grained-ecmp {
description
"SONIC Fine Grained ECMP";

revision 2024-09-15 {
description "Added support for dynamic nexthop group.";
}

revision 2023-01-19 {
description "Initial revision.";
}
Expand All @@ -40,14 +44,20 @@ module sonic-fine-grained-ecmp {

enum route-based {
description
"Fine grained ecmp is used when the route prefix matches the FG_NHG_PREFIX prefix";
"Fine grained ecmp is used when the route prefix matches the FG_NHG_PREFIX prefix and associated
nexthop IPs match the FG_NHG_MEMBER IPs";
}

enum nexthop-based {
description
"Fine grained ecmp is used when the nexthop IPs match the FG_NHG_MEMBER IPs";
}

enum prefix-based {
description
"Fine grained ecmp is used when the route prefix matches the FG_NHG_PREFIX prefix. The nexthop
IPs are derived from the route updates and FG_NHG_MEMBER table doesn't need to be programmed.";
}
}

description
Expand All @@ -72,22 +82,32 @@ module sonic-fine-grained-ecmp {
leaf bucket_size{
type uint16;
mandatory true;
description "total hash bucket size desired,
recommended value of Lowest Common Multiple
of 1..{max # of next-hops}";
description "total hash bucket size desired, recommended value of Lowest Common
Multiple of 1..{max # of next-hops}";
}

leaf match_mode{
type match-mode-name;
mandatory true;
description " The filtering method used to identify
when to use Fine Grained vs regular route handling.
nexthop-based looks to next-hop IP to filter routes
and uses fine grained ecmp when nexthop IPs matches
FG_NHG_MEMBER IPs. route-based looks to prefix to
filter routes, and uses fine grained ecmp when the
route prefix matches the FG_NHG_PREFIX prefix.";
description " The filtering method used to identify when to use Fine Grained vs regular route handling.
-- nexthop-based filters on nexthop IPs only.
-- route-based filters on both prefix and nexthop IPs.
-- prefix-based filters on prefix only.";
}

leaf max_next_hops{
when "current()/../match_mode = 'prefix-based'";
mandatory true;
type uint16 {
range 1..128; // Adjust based on platform support
}
must "current() > 0" {
error-message "max_next_hops needs to be a positive value in dynamic-nhg mode";
}
description "Applicable only for match_mode = prefix-based. Maximum number of nexthops that will be
received in route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.";
}

}
/* end of list FG_NHG_LIST */
}
Expand Down Expand Up @@ -136,16 +156,15 @@ module sonic-fine-grained-ecmp {
leaf FG_NHG{
type leafref {
path "/sfgecmp:sonic-fine-grained-ecmp/sfgecmp:FG_NHG/sfgecmp:FG_NHG_LIST/sfgecmp:name";
}
}
mandatory true;
description "Fine Grained next-hop group name";
}

leaf bank{
type uint16;
mandatory true;
description "An index which specifies a bank/group
in which the redistribution is performed";
description "An index which specifies a bank/group in which the redistribution is performed";
}

leaf link{
Expand All @@ -157,9 +176,8 @@ module sonic-fine-grained-ecmp {
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
}
}
description "Link associated with next-hop-ip, if
configured, enables next-hop withdrawal/addition
per link's operational state changes";
description "Link associated with next-hop-ip, if configured, enables next-hop withdrawal/addition
per link's operational state changes";
}
}
/* end of list FG_NHG_MEMBER_LIST */
Expand All @@ -168,4 +186,4 @@ module sonic-fine-grained-ecmp {
}
/* end of container sonic-fine-grained-ecmp */
}
/* end of module sonic-fine-grained-ecmp */
/* end of module sonic-fine-grained-ecmp */
Loading