From 52dd8e778514b9cf516774f19f491ac4bd9c18d8 Mon Sep 17 00:00:00 2001 From: ganglv <88995770+ganglyu@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:33:42 +0800 Subject: [PATCH] Add unit test for pg headroom (#261) 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 --- test/test_gnmi_configdb_patch.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/test_gnmi_configdb_patch.py b/test/test_gnmi_configdb_patch.py index ddc8c9be..c83beeaa 100644 --- a/test/test_gnmi_configdb_patch.py +++ b/test/test_gnmi_configdb_patch.py @@ -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): @@ -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)