Skip to content

Commit

Permalink
Add unit test for pfcwd status
Browse files Browse the repository at this point in the history
  • Loading branch information
ganglyu committed Jun 21, 2024
1 parent 65a43bc commit 49c29d2
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions test/test_gnmi_configdb_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,79 @@ def create_checkpoint(file_name, text):
}
]

test_data_pfcwd_status_patch = [
{
"test_name": "test_start_pfcwd",
"operations": [
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/PFC_WD/Ethernet0",
"value": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
}
},
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/PFC_WD/Ethernet4",
"value": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
}
}
],
"origin_json": {
"PFC_WD": {}
},
"target_json": {
"PFC_WD": {
"Ethernet0": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
},
"Ethernet4": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
}
}
}
},
{
"test_name": "test_stop_pfcwd",
"operations": [
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/PFC_WD/Ethernet0"
},
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/PFC_WD/Ethernet4"
}
],
"origin_json": {
"PFC_WD": {
"Ethernet0": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
},
"Ethernet4": {
"action": "drop",
"detection_time": "400",
"restoration_time": "400"
}
}
},
"target_json": {
"PFC_WD": {}
}
}
]

class TestGNMIConfigDbPatch:

def common_test_handler(self, test_data):
Expand Down Expand Up @@ -2807,3 +2880,10 @@ def test_gnmi_pfcwd_interval_patch(self, test_data):
Generate GNMI request for pfcwd interval and verify jsonpatch
'''
self.common_test_handler(test_data)

@pytest.mark.parametrize("test_data", test_data_pfcwd_status_patch)
def test_gnmi_pfcwd_status_patch(self, test_data):
'''
Generate GNMI request for pfcwd status and verify jsonpatch
'''
self.common_test_handler(test_data)

0 comments on commit 49c29d2

Please sign in to comment.