Skip to content

Commit

Permalink
Support LOSSLESS_TRAFFIC_PATTERN and DEFAULT_LOSSLESS_BUFFER_PARAMETER (
Browse files Browse the repository at this point in the history
#11058)

#### Why I did it
Support the following tables which were introduced during dynamic buffer calculation
- LOSSLESS_TRAFFIC_PATTERN
- DEFAULT_LOSSLESS_BUFFER_PARAMETER

#### How I did it

- LOSSLESS_TRAFFIC_PATTERN

|name|type|range|mandatory|description|
|---|---|---|---|---|
|mtu|uint16|64~10240|true|The maximum packet size of a lossless packet|
|small_packet_percentage|uint8|0~100|true|The percentage of small packet|

- DEFAULT_LOSSLESS_BUFFER_PARAMETER

|name|type|range|mandatory|description|
|---|---|---|---|---|
|default_dynamic_th|int8|-8~7|true|The default dynamic_th for all buffer profiles that are dynamically generated for lossless PG|
|over_subscribe_ratio|uint16|-|false|The oversubscribe ratio for shared headroom pool.|
|||||Semantically, the upper bound is the number of physical ports but it can not be represented in the yang module. So we keep the upper bound open. As the type is (signed) integer whose lower bound is 0 by nature, we do not need to specify the range.|

#### How to verify it
Run unit test
  • Loading branch information
stephenxs authored Jun 23, 2022
1 parent 9814547 commit e9fee86
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def run(self):
'./yang-models/sonic-cable-length.yang',
'./yang-models/sonic-copp.yang',
'./yang-models/sonic-crm.yang',
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
'./yang-models/sonic-device_metadata.yang',
'./yang-models/sonic-device_neighbor.yang',
'./yang-models/sonic-dhcpv6-relay.yang',
Expand All @@ -107,6 +108,7 @@ def run(self):
'./yang-models/sonic-interface.yang',
'./yang-models/sonic-kdump.yang',
'./yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-lossless-traffic-pattern.yang',
'./yang-models/sonic-mgmt_interface.yang',
'./yang-models/sonic-mgmt_port.yang',
'./yang-models/sonic-mgmt_vrf.yang',
Expand Down
14 changes: 14 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 @@ -1878,6 +1878,20 @@
"LAG"
]
}
},

"LOSSLESS_TRAFFIC_PATTERN": {
"AZURE": {
"mtu": "1024",
"small_packet_percentage": "100"
}
},

"DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"AZURE": {
"default_dynamic_th": "0",
"over_subscribe_ratio": "0"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table."
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_NAME_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with invalid character.",
"eStr": "Invalid default lossless buffer parameter list name."
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_LONG_NAME_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with too long name.",
"eStr": "Invalid length for the default lossless buffer parameter list name."
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_SMALL_DYNAMIC_TH_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with a dynamic_th exceeding the lowerbound.",
"eStr": "Invalid default dynamic_th which should be a number in the range [-8, 7]."
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_LARGE_DYNAMIC_TH_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with a dynamic_th exceeding the upperbound.",
"eStr": "Invalid default dynamic_th which should be a number in the range [-8, 7]."
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_FORMAT_DYNAMIC_TH_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with an invalid dynamic_th",
"eStr": "Invalid"
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LACK_DYNAMIC_TH_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table without dynamic_th",
"eStrKey" : "Mandatory"
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_FORMAT_OVER_SUBSCRIBE_RATIO_TEST": {
"desc": "Configure DEFAULT_LOSSLESS_BUFFER_PARAMETER table with an invalid over subscribe ratio.",
"eStr": "Invalid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"LOSSLESS_TRAFFIC_PATTERN_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table."
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_NAME_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with invalid character.",
"eStr": "Invalid lossless traffic pattern list name."
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LONG_NAME_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with too long name.",
"eStr": "Invalid length for the lossless traffic pattern list name."
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_SMALL_MTU_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with an MTU exceeding the lowerbound.",
"eStr": "Invaild MTU which should be in [1, 9216]."
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LARGE_MTU_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with an MTU exceeding the upperbound.",
"eStr": "Invaild MTU which should be in [1, 9216]."
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_FORMAT_MTU_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with an invalid MTU",
"eStr": "Invalid"
},
"LOSSLESS_TRAFFIC_PATTERN_LACK_MTU_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table without MTU",
"eStrKey": "Mandatory"
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LARGE_SMALL_PACKET_PERCENTAGE_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with a small packet percentage exceeding the upperbound.",
"eStr": "Invalid small packets percentage which should be in [0, 100]."
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_FORMAT_SMALL_PACKET_PERCENTAGE_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table with an invalid small packet percentage",
"eStr": "Invalid"
},
"LOSSLESS_TRAFFIC_PATTERN_LACK_SMALL_PACKET_PERCENTAGE_TEST": {
"desc": "Configure LOSSLESS_TRAFFIC_PATTERN table without small packet percentage",
"eStrKey": "Mandatory"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"default_dynamic_th": "0",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_NAME_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "Invalid$",
"default_dynamic_th": "0",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_LONG_NAME_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "Long_name_which_exceeds_the_limit",
"default_dynamic_th": "0",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_SMALL_DYNAMIC_TH_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"default_dynamic_th": "-9",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_TOO_LARGE_DYNAMIC_TH_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"default_dynamic_th": "8",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_FORMAT_DYNAMIC_TH_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"default_dynamic_th": "NaN",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LACK_DYNAMIC_TH_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"over_subscribe_ratio": "0"
}
]
}
}
},
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_INVALID_FORMAT_OVER_SUBSCRIBE_RATIO_TEST": {
"sonic-default-lossless-buffer-parameter:sonic-default-lossless-buffer-parameter": {
"sonic-default-lossless-buffer-parameter:DEFAULT_LOSSLESS_BUFFER_PARAMETER": {
"DEFAULT_LOSSLESS_BUFFER_PARAMETER_LIST": [
{
"name": "AZURE",
"default_dynamic_th": "0",
"over_subscribe_ratio": "NaN"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"LOSSLESS_TRAFFIC_PATTERN_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "1024",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_NAME_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "Invalid$",
"mtu": "1024",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LONG_NAME_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "Long_name_which_exceeds_the_limit",
"mtu": "1024",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_SMALL_MTU_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "0",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LARGE_MTU_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "9217",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_FORMAT_MTU_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "NaN",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_LACK_MTU_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"small_packet_percentage": "100"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_TOO_LARGE_SMALL_PACKET_PERCENTAGE_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "1024",
"small_packet_percentage": "101"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_INVALID_FORMAT_SMALL_PACKET_PERCENTAGE_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "1024",
"small_packet_percentage": "NaN"
}
]
}
}
},
"LOSSLESS_TRAFFIC_PATTERN_LACK_SMALL_PACKET_PERCENTAGE_TEST": {
"sonic-lossless-traffic-pattern:sonic-lossless-traffic-pattern": {
"sonic-lossless-traffic-pattern:LOSSLESS_TRAFFIC_PATTERN": {
"LOSSLESS_TRAFFIC_PATTERN_LIST": [
{
"name": "AZURE",
"mtu": "1024"
}
]
}
}
}
}
Loading

0 comments on commit e9fee86

Please sign in to comment.