diff --git a/generic_config_updater/change_applier.py b/generic_config_updater/change_applier.py index 63ca98049c..9871e554b2 100644 --- a/generic_config_updater/change_applier.py +++ b/generic_config_updater/change_applier.py @@ -71,6 +71,11 @@ class ChangeApplier: def __init__(self): self.config_db = get_config_db() + self.backend_tables = [ + "BUFFER_PG", + "BUFFER_PROFILE", + "FLEX_COUNTER_TABLE" + ] if (not ChangeApplier.updater_conf) and os.path.exists(UPDATER_CONF_FILE): with open(UPDATER_CONF_FILE, "r") as s: ChangeApplier.updater_conf = json.load(s) @@ -142,6 +147,8 @@ def apply(self, change): ret = self._services_validate(run_data, upd_data, upd_keys) if not ret: run_data = self._get_running_config() + self.remove_backend_tables_from_config(upd_data) + self.remove_backend_tables_from_config(run_data) if upd_data != run_data: self._report_mismatch(run_data, upd_data) ret = -1 @@ -150,6 +157,11 @@ def apply(self, change): return ret + def remove_backend_tables_from_config(self, data): + for key in self.backend_tables: + data.pop(key, None) + + def _get_running_config(self): (_, fname) = tempfile.mkstemp(suffix="_changeApplier") os.system("sonic-cfggen -d --print-data > {}".format(fname)) diff --git a/generic_config_updater/generic_updater.py b/generic_config_updater/generic_updater.py index ee7af65620..56297039aa 100644 --- a/generic_config_updater/generic_updater.py +++ b/generic_config_updater/generic_updater.py @@ -77,6 +77,8 @@ def apply(self, patch): # Validate config updated successfully self.logger.log_notice("Verifying patch updates are reflected on ConfigDB.") new_config = self.config_wrapper.get_config_db_as_json() + self.changeapplier.remove_backend_tables_from_config(target_config) + self.changeapplier.remove_backend_tables_from_config(new_config) if not(self.patch_wrapper.verify_same_json(target_config, new_config)): raise GenericConfigUpdaterError(f"After applying patch to config, there are still some parts not updated")