Skip to content

Commit

Permalink
[yang]Add FG-ECMP yang model (sonic-net#14003)
Browse files Browse the repository at this point in the history
Why I did it
Add yang model definition for FG_NHG_MEMBER, FG_NHG and FG_NHG_PREFIX from request: sonic-net#12457

How I did it
Add yang model refereeing to description https://github.com/sonic-net/SONiC/blob/master/doc/ecmp/fine_grained_next_hop_hld.md

How to verify it
pyang tests
  • Loading branch information
lmingz authored and xumia committed Mar 10, 2023
1 parent e5cf564 commit 52bcde0
Show file tree
Hide file tree
Showing 6 changed files with 721 additions and 0 deletions.
54 changes: 54 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)
* [Hash](#hash)
* [KDUMP](#kdump)
Expand Down Expand Up @@ -892,6 +895,57 @@ instance is supported in SONiC.
```

### 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.

```
"FG_NHG": {
"fgnhg_v4": {
"bucket_size": "120",
"match_mode": "nexthop-based"
},
"fgnhg_v6": {
"bucket_size": "120",
"match_mode": "nexthop-based"
}
}
```

### FG_NHG_MEMBER

The FG_NHG_MEMBER table provides information about the members of a next hop group, including the group name (FG_NHG), the index at which redistribution is performed (bank), and the link associated with the next-hop-ip (link).

```
"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

The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desired, and Fine Grained next-hop group name.

```
"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-events-syncd.yang',
'./yang-models/sonic-extension.yang',
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-fine-grained-ecmp.yang',
'./yang-models/sonic-feature.yang',
'./yang-models/sonic-hash.yang',
'./yang-models/sonic-system-defaults.yang',
Expand Down Expand Up @@ -203,6 +204,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-hash.yang',
'./cvlyang-models/sonic-system-defaults.yang',
'./cvlyang-models/sonic-interface.yang',
Expand Down
40 changes: 40 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 @@ -2273,6 +2273,46 @@
"vni": "10",
"guid":"guid-vnet1"
}
},
"FG_NHG": {
"nhg1": {
"bucket_size": "16",
"match_mode": "nexthop-based"
},
"nhg2": {
"bucket_size": "32",
"match_mode": "route-based"
}
},
"FG_NHG_PREFIX": {
"10.0.0.0/24": {
"FG_NHG": "nhg1"
},
"192.168.0.0/16": {
"FG_NHG": "nhg2"
}
},
"FG_NHG_MEMBER": {
"192.168.1.1": {
"FG_NHG": "nhg1",
"bank": "0",
"link": "Ethernet1"
},
"192.168.1.2": {
"FG_NHG": "nhg1",
"bank": "0",
"link": "Ethernet2"
},
"10.0.0.1": {
"FG_NHG": "nhg2",
"bank": "1",
"link": "PortChannel42"
},
"10.0.0.2": {
"FG_NHG": "nhg2",
"bank": "1",
"link": "PortChannel2"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"FG_NHG_TEST": {
"desc": "Fine-grained ECMP next-hop group configuration in FG_NHG_LIST table."
},
"FG_NHG_PREFIX_TEST": {
"desc": "Fine-grained ECMP prefix configuration in FG_NHG_PREFIX_LIST table."
},
"FG_NHG_MEMBER_TEST": {
"desc": "Fine-grained ECMP next-hop member configuration in FG_NHG_MEMBER_LIST table."
},
"FG_NHG_MEMBER_MULTI_LINK_TEST": {
"desc": "Fine-grained ECMP next-hop member configuration with multiple links in FG_NHG_MEMBER_LIST table."
},
"FG_NHG_TEST_DUPLICATE_NAME": {
"desc": "Fine-grained ECMP next-hop group configuration with duplicate name in FG_NHG_LIST table.",
"eStr": "Duplicated instance of \"FG_NHG_LIST\" list."
},
"FG_NHG_MEMBER_TEST_INVALID_IP": {
"desc": "Fine-grained ECMP next-hop member configuration with invalid IP value in FG_NHG_MEMBER_LIST table.",
"eStrKey": "InvalidValue",
"eStr": [
"next_hop_ip"
]
},
"FG_NHG_PREFIX_TEST_INVALID_PREFIX": {
"desc": "Fine-grained ECMP prefix configuration with invalid prefix value in FG_NHG_PREFIX_LIST table.",
"eStrKey": "InvalidValue",
"eStr": [
"ip_prefix"
]
},
"FG_NHG_MEMBER_TEST_INVALID_LINK": {
"desc": "Fine-grained ECMP next-hop member configuration with invalid link value in FG_NHG_MEMBER_LIST table.",
"eStrKey": "InvalidValue",
"eStr": [
"link"
]
},
"FG_NHG_MEMBER_TEST_MISSING_FG_NHG_REF": {
"desc": "Fine-grained ECMP next-hop member configuration with missing FG_NHG reference in FG_NHG_MEMBER_LIST table.",
"eStr": "Missing required element \"FG_NHG\" in \"FG_NHG_MEMBER_LIST\". "
},
"FG_NHG_PREFIX_TEST_MISSING_FG_NHG_REF": {
"desc": "Fine-grained ECMP prefix configuration with missing FG_NHG reference in FG_NHG_PREFIX_LIST table.",
"eStr": "Missing required element \"FG_NHG\" in \"FG_NHG_PREFIX_LIST\". "
},
"FG_NHG_MEMBER_TEST_MISSING_BANK": {
"desc": "Fine-grained ECMP next-hop member configuration with missing bank in FG_NHG_MEMBER_LIST table.",
"eStr": "Missing required element \"bank\""
},
"FG_NHG_PREFIX_TEST_DUPLICATE_ENTRY": {
"desc": "Fine-grained ECMP prefix configuration with duplicate entry in FG_NHG_PREFIX_LIST table.",
"eStr": "Duplicated instance of \"FG_NHG_PREFIX_LIST\" list."
},
"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."
}
}
Loading

0 comments on commit 52bcde0

Please sign in to comment.