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

[yang]Add FG-ECMP yang model #13443

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
51 changes: 51 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Table of Contents
* [Device Metadata](#device-metadata)
* [Device neighbor metada](#device-neighbor-metada)
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FG_NHG](#fg_nhg)
* [FG_NHG_MEMBER](#fg_nhg_member)
* [FG_NHG_PREFIX](#fg_nhg_prefix)
* [FLEX_COUNTER_TABLE](#flex_counter_table)
* [KDUMP](#kdump)
* [Kubernetes Master](#kubernetes-master)
Expand Down Expand Up @@ -890,6 +893,54 @@ instance is supported in SONiC.
```


### FG_NHG

lmingz marked this conversation as resolved.
Show resolved Hide resolved
```
"FG_NHG": {
"fgnhg_v4": {
"bucket_size": "120",
"match_mode": "nexthop-based"
},
"fgnhg_v6": {
"bucket_size": "120",
"match_mode": "nexthop-based"
}
}

```

### FG_NHG_MEMBER

lmingz marked this conversation as resolved.
Show resolved Hide resolved
```
"FG_NHG_MEMBER": {
"200.200.200.4": {
"FG_NHG": "fgnhg_v4",
"bank": "0",
"link": "Ethernet8"
},
"200.200.200.5": {
"FG_NHG": "fgnhg_v4",
"bank": "1",
"link": "Ethernet12"
}
}

```

### FG_NHG_PREFIX

lmingz marked this conversation as resolved.
Show resolved Hide resolved
```
"FG_NHG_PREFIX": {
"100.50.25.12/32": {
"FG_NHG": "fgnhg_v4"
},
"fc:05::/128": {
"FG_NHG": "fgnhg_v6"
}
}

```

### MPLS_TC_TO_TC_MAP
```
{
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def run(self):
'./yang-models/sonic-extension.yang',
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-feature.yang',
'./yang-models/sonic-fine-grained-ecmp.yang',
'./yang-models/sonic-system-defaults.yang',
'./yang-models/sonic-interface.yang',
'./yang-models/sonic-kdump.yang',
Expand Down Expand Up @@ -199,6 +200,7 @@ def run(self):
'./cvlyang-models/sonic-extension.yang',
'./cvlyang-models/sonic-flex_counter.yang',
'./cvlyang-models/sonic-feature.yang',
'./cvlyang-models/sonic-fine-grained-ecmp.yang',
'./cvlyang-models/sonic-system-defaults.yang',
'./cvlyang-models/sonic-interface.yang',
'./cvlyang-models/sonic-kdump.yang',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"VALID_FINE_GRAINED_ECMP": {
"desc": "VALID_FINE_GRAINED_ECMP no failure."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"VALID_FINE_GRAINED_ECMP":{
"sonic-fine-grained-ecmp:sonic-fine-grained-ecmp":{
"sonic-fine-grained-ecmp:FG_NHG":{
"FG_NHG_LIST":[
{
"name":"fgnhg_v4",
"bucket_size": "120",
"match_mode": "nexthop-based"
},
{
"name":"fgnhg_v6",
"bucket_size": "120",
"match_mode": "nexthop-based"
}
],
"FG_NHG_PREFIX_LIST":[
{
"ip_prefix":"100.50.25.12/32",
"FG_NHG": "fgnhg_v4"
},
{
"ip_prefix":"fc:05::/128",
"FG_NHG": "fgnhg_v6"
}
],
"FG_NHG_MEMBER_LIST":[
{
"next_hop_ip":"200.200.200.4",
"FG_NHG": "fgnhg_v4",
"bank": "0",
"link": "Ethernet8"
},
{
"next_hop_ip":"200.200.200.5",
"FG_NHG": "fgnhg_v4",
"bank": "1",
"link": "Ethernet12"
}
]
}
}
}
}
136 changes: 136 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-fine-grained-ecmp.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
module sonic-fine-grained-ecmp {

yang-version 1.1;

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

import ietf-inet-types {
prefix inet;
}

import sonic-types {
prefix stypes;
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC Fine Grained ECMP";

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


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 string{
pattern "(route-based|nexthop-based)"{
lmingz marked this conversation as resolved.
Show resolved Hide resolved
error-message "Invalid FG_NHG match mode";
}
}
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.";
}
}
/* 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 string;
lmingz marked this conversation as resolved.
Show resolved Hide resolved
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 string;
lmingz marked this conversation as resolved.
Show resolved Hide resolved
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 string;
lmingz marked this conversation as resolved.
Show resolved Hide resolved
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 */