Skip to content

Commit

Permalink
Add unit test for ECN config (#250)
Browse files Browse the repository at this point in the history
Why I did it
GCU has verified ECN config, we need to verify that GNMI can support the same ECN config.
Microsoft ADO: 27231797

How I did it
This unit test uses ECN config from GCU test.
This unit test generates GNMI request for DHCP relay and use jsonpatch to verify patch file generated by GNMI server.

How to verify it
Run GNMI unit test.
  • Loading branch information
ganglyu authored Jun 19, 2024
1 parent 56f17eb commit 2e1eb05
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/test_gnmi_configdb_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,47 @@ def create_checkpoint(file_name, text):
}
]

test_data_ecn_config_patch = [
{
"test_name": "test_ecn_config_updates",
"operations": [
{
"op": "replace",
"path": "/sonic-db:CONFIG_DB/localhost/WRED_PROFILE/AZURE_LOSSLESS/green_min_threshold",
"value": "2000001"
},
{
"op": "replace",
"path": "/sonic-db:CONFIG_DB/localhost/WRED_PROFILE/AZURE_LOSSLESS/green_max_threshold",
"value": "10000001"
},
{
"op": "replace",
"path": "/sonic-db:CONFIG_DB/localhost/WRED_PROFILE/AZURE_LOSSLESS/green_drop_probability",
"value": "6"
},
],
"origin_json": {
"WRED_PROFILE": {
"AZURE_LOSSLESS": {
"green_min_threshold": "2000000",
"green_max_threshold": "10000000",
"green_drop_probability": "5"
}
}
},
"target_json": {
"WRED_PROFILE": {
"AZURE_LOSSLESS": {
"green_min_threshold": "2000001",
"green_max_threshold": "10000001",
"green_drop_probability": "6"
}
}
}
}
]

class TestGNMIConfigDbPatch:

def common_test_handler(self, test_data):
Expand Down Expand Up @@ -1804,3 +1845,10 @@ def test_gnmi_dynamic_acl_patch(self, test_data):
Generate GNMI request for dynamic acl and verify jsonpatch
'''
self.common_test_handler(test_data)

@pytest.mark.parametrize("test_data", test_data_ecn_config_patch)
def test_gnmi_ecn_config_patch(self, test_data):
'''
Generate GNMI request for ecn config and verify jsonpatch
'''
self.common_test_handler(test_data)

0 comments on commit 2e1eb05

Please sign in to comment.