Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit test for syslog config #263

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions test/test_gnmi_configdb_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2849,6 +2849,88 @@ def create_checkpoint(file_name, text):
}
]

test_data_syslog_patch = [
{
"test_name": "syslog_server_tc1_add_init",
"operations": [
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER",
"value": {
"10.0.0.5": {},
"cc98:2008::1": {}
}
}
],
"origin_json": {
"SYSLOG_SERVER": {}
},
"target_json": {
"SYSLOG_SERVER": {
"10.0.0.5": {},
"cc98:2008::1": {}
}
}
},
{
"test_name": "syslog_server_tc1_replace",
"operations": [
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/10.0.0.5"
},
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/cc98:2008::1"
},
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/10.0.0.6",
"value": {}
},
{
"op": "update",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/cc98:2008::2",
"value": {}
}
],
"origin_json": {
"SYSLOG_SERVER": {
"10.0.0.5": {},
"cc98:2008::1": {}
}
},
"target_json": {
"SYSLOG_SERVER": {
"10.0.0.6": {},
"cc98:2008::2": {}
}
}
},
{
"test_name": "syslog_server_tc1_remove",
"operations": [
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/10.0.0.5"
},
{
"op": "del",
"path": "/sonic-db:CONFIG_DB/localhost/SYSLOG_SERVER/cc98:2008::1"
}
],
"origin_json": {
"SYSLOG_SERVER": {
"10.0.0.5": {},
"cc98:2008::1": {}
}
},
"target_json": {
"SYSLOG_SERVER": {}
}
}
]

class TestGNMIConfigDbPatch:

def common_test_handler(self, test_data):
Expand Down Expand Up @@ -3033,3 +3115,10 @@ def test_gnmi_portchannel_interface_patch(self, test_data):
Generate GNMI request for portchannel interface and verify jsonpatch
'''
self.common_test_handler(test_data)

@pytest.mark.parametrize("test_data", test_data_syslog_patch)
def test_gnmi_syslog_patch(self, test_data):
'''
Generate GNMI request for syslog and verify jsonpatch
'''
self.common_test_handler(test_data)
Loading