From 3e4d48eb5446847d7f22e3526a028b8c28b14af9 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Wed, 3 Apr 2024 00:16:03 +0000 Subject: [PATCH 1/3] test configlet --- tests/configlet/util/common.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/configlet/util/common.py b/tests/configlet/util/common.py index 1370524351e..e8e01eba24c 100755 --- a/tests/configlet/util/common.py +++ b/tests/configlet/util/common.py @@ -115,9 +115,11 @@ def do_pause(secs, msg): "VLAN_MEMBER_TABLE", "VLAN_TABLE" }, - "keys_to_skip_comp": set(), - "keys_skip_val_comp": { + "keys_to_skip_comp": { "PORT_TABLE" + }, + "keys_skip_val_comp": { + "last_up_time" } } } @@ -235,8 +237,13 @@ def get_dump(duthost, db_name, db_info, dir_name, data_dir): db_write = {} for k in db_read: # Transient keys start with "_"; Hence skipped - if ((not k.startswith("_")) and (not match_key(k, keys_skip_cmp))): - db_write[k] = {} if match_key(k, keys_skip_val) else db_read[k] + if (not k.startswith("_")) and (not match_key(k, keys_skip_cmp)): + value = db_read[k].get("value", {}) # Get the value or empty dictionary if + + for skip_val in keys_skip_val: + if match_key(skip_val, value): + value.pop(skip_val) + db_write[k] = db_read[k] dst_file = os.path.join(dir_name, "{}.json".format(db_name)) with open(dst_file, "w") as s: From 904cf1447f62fbd3ce836c56ec8006782df5983f Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Wed, 3 Apr 2024 01:19:43 +0000 Subject: [PATCH 2/3] update configlet test based on swss update --- tests/configlet/util/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/configlet/util/common.py b/tests/configlet/util/common.py index e8e01eba24c..4f26a2f96c6 100755 --- a/tests/configlet/util/common.py +++ b/tests/configlet/util/common.py @@ -119,7 +119,8 @@ def do_pause(secs, msg): "PORT_TABLE" }, "keys_skip_val_comp": { - "last_up_time" + "last_up_time", + "flap_count" } } } From 82016297c0deae71b9a140ef3cd05f26407cec15 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Wed, 3 Apr 2024 02:04:14 +0000 Subject: [PATCH 3/3] change set --- tests/configlet/util/common.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/configlet/util/common.py b/tests/configlet/util/common.py index 4f26a2f96c6..c3d5f38f1c3 100755 --- a/tests/configlet/util/common.py +++ b/tests/configlet/util/common.py @@ -104,7 +104,10 @@ def do_pause(secs, msg): # BUFFER_PG.*3-4 is an auto created entry by buffermgr # configlet skips it. So skip verification too. "BUFFER_PG_TABLE:Ethernet[0-9][0-9]*:3-4"}, - "keys_skip_val_comp": set() + "keys_skip_val_comp": { + "last_up_time", + "flap_count" + } }, "state-db": { "db_no": 6, @@ -118,10 +121,7 @@ def do_pause(secs, msg): "keys_to_skip_comp": { "PORT_TABLE" }, - "keys_skip_val_comp": { - "last_up_time", - "flap_count" - } + "keys_skip_val_comp": set() } }