From dadfc1869314f8ee2ee6ff30b7dea0e6808dd295 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 12 Nov 2020 10:46:54 -0800 Subject: [PATCH] Copp Changes (#1004) Added DB migrator script for removing old copp APP DB entries. Co-authored-by: dgsudharsan --- scripts/db_migrator.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 813ed0377b37..326eed41f7fc 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -145,6 +145,19 @@ def migrate_intf_table(self): self.appDB.set(self.appDB.APPL_DB, table, 'NULL', 'NULL') if_db.append(if_name) + def migrate_copp_table(self): + ''' + Delete the existing COPP table + ''' + if self.appDB is None: + return + + keys = self.appDB.keys(self.appDB.APPL_DB, "COPP_TABLE:*") + if keys is None: + return + for copp_key in keys: + self.appDB.delete(self.appDB.APPL_DB, copp_key) + def version_unknown(self): """ version_unknown tracks all SONiC versions that doesn't have a version @@ -248,6 +261,8 @@ def common_migration_ops(self): for init_table_key, init_table_val in table_val.items(): self.configDB.set_entry(init_cfg_table, init_table_key, init_table_val) + self.migrate_copp_table() + def migrate(self): version = self.get_version() log.log_info('Upgrading from version ' + version)