-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support LOSSLESS_TRAFFIC_PATTERN and DEFAULT_LOSSLESS_BUFFER_PARAMETER (
#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
Showing
8 changed files
with
436 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/sonic-yang-models/tests/yang_model_tests/tests/default_lossless_buffer_parameter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/sonic-yang-models/tests/yang_model_tests/tests/lossless_traffic_pattern.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
105 changes: 105 additions & 0 deletions
105
...ic-yang-models/tests/yang_model_tests/tests_config/default_lossless_buffer_parameter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
src/sonic-yang-models/tests/yang_model_tests/tests_config/lossless_traffic_pattern.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.