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 1 commit
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]
}
}
197 changes: 197 additions & 0 deletions sonic-fine-grained-ecmp.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
module sonic-fine-grained-ecmp {

yang-version 1.1;

namespace "http://github.com/sonic-net/sonic-fine-grained-ecmp";
prefix sfgecmp;

import ietf-inet-types {
prefix inet;
}

import sonic-portchannel {
prefix lag;
}

import sonic-port {
prefix port;
}

import sonic-types {
prefix stypes;
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC Fine Grained ECMP";

revision 2023-01-19 {
description "Initial revision.";
}

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

typedef match-mode-name {

type enumeration {

enum route-based {
description
"Fine grained ecmp is used when the route prefix matches the FG_NHG_PREFIX prefix";
}

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

description
"This enumeration type defines the method used to determine whether fine grained ecmp should be applied.";
}

typedef nhg-mode-name {
type enumeration {
enum static-nhg {
description
"List of nexthops is statically configured in FG_NHG_MEMBER table.";
}

enum dynamic-nhg {
description
"List of nexthops is dynamically derived from the route updates. FG_NHG_MEMBER table is not configured.";
}
}

description
"This enumeration type defines whether the list of nexthops used for fine grained ecmp are statically configure or derived from route updates.";
}

container sonic-fine-grained-ecmp {

container FG_NHG {

description "FG_NHG part of config_db.json";

list FG_NHG_LIST{

key "name";

leaf name{
type string;
description "FG_NHG group name";
}

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}";
}

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.";
}

leaf nhg_mode{
when "current()/../match_mode = 'route-based'";
type nhg-mode-name;
default 'static-nhg';
description " static-nhg : List of nexthops needs to be statically configured in FG_NHG_MEMBER table. dynamic-nhg : List of nexthops will be dynamically derived from the route updates.";
}

leaf max_next_hops{
when "current()/../nhg_mode = 'dynamic-nhg'";
must "current() > 0" {
error-message "max_next_hops needs to be a positive value in dynamic-nhg mode";
}
type uint16;
description "Applicable only when nhg_mode = dynamic-nhg. 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 */
}
/* end of container FG_NHG */

container FG_NHG_PREFIX{

description "FG_NHG_PREFIX part of config_db.json";

list FG_NHG_PREFIX_LIST{

key "ip_prefix";

leaf ip_prefix{
type stypes:sonic-ip-prefix;
description "FG_NHG_PREFIX for which FG behavior is
desired";
}

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";
}
}
/* end of list FG_NHG_PREFIX_LIST */
}
/* end of container FG_NHG_PREFIX */

container FG_NHG_MEMBER{

description "FG_NHG_MEMBER part of config_db.json";

list FG_NHG_MEMBER_LIST{

key "next_hop_ip";

leaf next_hop_ip{
type inet:ip-address;
description "FG_NHG next-hop-ip member associated
with prefix";
}

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";
}

leaf link{
type union {
type leafref {
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
}
type leafref {
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";
}
}
/* end of list FG_NHG_MEMBER_LIST */
}
/* end of container FG_NHG_MEMBER */
}
/* end of container sonic-fine-grained-ecmp */
}
/* end of module sonic-fine-grained-ecmp */
25 changes: 22 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,8 @@ 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, nexthopgroup mode to distinguish between static vs
dynamic nexthop configuration and an optional max-next-hops attribute for dynamic mode.

```
"FG_NHG": {
Expand All @@ -1155,7 +1156,19 @@ 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": "nexthop-based",
"nhg_mode": "dynamic-nhg",
"max_next_hops": "6"
},
"dynamic_fgnhg_v6": {
"bucket_size": "120",
"match_mode": "nexthop-based",
"nhg_mode": "dynamic-nhg",
"max_next_hops": "6"
}
}
```

Expand Down Expand Up @@ -1189,7 +1202,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
9 changes: 9 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,12 @@
"nhg2": {
"bucket_size": "32",
"match_mode": "route-based"
},
"nhg3": {
"bucket_size": "24",
"match_mode": "route-based",
"nhg_mode": "dynamic-nhg",
"max_next_hops": "6"
}
},
"FG_NHG_PREFIX": {
Expand All @@ -2734,6 +2740,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,18 @@
"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_TEST_DYNAMIC_NHG_MISSING_MAX_NEXT_HOPS": {
"desc": "Fine-grained ECMP Dynamic next-hop group configuration with missing max_next_hops in FG_NHG_LIST table.",
"eStrKey": "Mandatory",
"eStr": ["max_next_hops"]
},
"FG_NHG_TEST_DYNAMIC_NHG_MISSING_BUCKET_SIZE": {
"desc": "Fine-grained ECMP Dynamic next-hop group configuration with missing bucket_size in FG_NHG_LIST table.",
"eStr": "Missing required element \"bucket_size\" in \"FG_NHG_LIST\"."
},
"FG_NHG_TEST_DYNAMIC_NHG_INVALID_MATCH_MODE": {
"desc": "Fine-grained ECMP Dynamic next-hop group configuration with invalid nexthop-based match_mode in FG_NHG_LIST table.",
"eStrKey": "When"
}
}
}
Loading
Loading