Skip to content

Commit

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

How I did it
This unit test uses pg headroom config from GCU test.
This unit test generates GNMI request for pg headroom config 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 21, 2024
1 parent 8a10d9f commit 52dd8e7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/test_gnmi_configdb_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2717,6 +2717,33 @@ def create_checkpoint(file_name, text):
}
]

test_data_pg_headroom_patch = [
{
"test_name": "test_pg_headroom_update",
"operations": [
{
"op": "replace",
"path": "/sonic-db:CONFIG_DB/localhost/BUFFER_PROFILE/pg_lossless_100000_300m_profile/xoff",
"value": "160001"
}
],
"origin_json": {
"BUFFER_PROFILE": {
"pg_lossless_100000_300m_profile": {
"xoff": "160000"
},
}
},
"target_json": {
"BUFFER_PROFILE": {
"pg_lossless_100000_300m_profile": {
"xoff": "160001"
},
}
}
}
]

class TestGNMIConfigDbPatch:

def common_test_handler(self, test_data):
Expand Down Expand Up @@ -2887,3 +2914,10 @@ def test_gnmi_pfcwd_status_patch(self, test_data):
Generate GNMI request for pfcwd status and verify jsonpatch
'''
self.common_test_handler(test_data)

@pytest.mark.parametrize("test_data", test_data_pg_headroom_patch)
def test_gnmi_pg_headroom_patch(self, test_data):
'''
Generate GNMI request for pg headroom and verify jsonpatch
'''
self.common_test_handler(test_data)

0 comments on commit 52dd8e7

Please sign in to comment.