Skip to content

Commit dadfc18

Browse files
Sudharsan Dhamal Gopalarathnamdgsudharsan
Sudharsan Dhamal Gopalarathnam
and
dgsudharsan
authored
Copp Changes (sonic-net#1004)
Added DB migrator script for removing old copp APP DB entries. Co-authored-by: dgsudharsan <[email protected]>
1 parent b226159 commit dadfc18

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/db_migrator.py

+15
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ def migrate_intf_table(self):
145145
self.appDB.set(self.appDB.APPL_DB, table, 'NULL', 'NULL')
146146
if_db.append(if_name)
147147

148+
def migrate_copp_table(self):
149+
'''
150+
Delete the existing COPP table
151+
'''
152+
if self.appDB is None:
153+
return
154+
155+
keys = self.appDB.keys(self.appDB.APPL_DB, "COPP_TABLE:*")
156+
if keys is None:
157+
return
158+
for copp_key in keys:
159+
self.appDB.delete(self.appDB.APPL_DB, copp_key)
160+
148161
def version_unknown(self):
149162
"""
150163
version_unknown tracks all SONiC versions that doesn't have a version
@@ -248,6 +261,8 @@ def common_migration_ops(self):
248261
for init_table_key, init_table_val in table_val.items():
249262
self.configDB.set_entry(init_cfg_table, init_table_key, init_table_val)
250263

264+
self.migrate_copp_table()
265+
251266
def migrate(self):
252267
version = self.get_version()
253268
log.log_info('Upgrading from version ' + version)

0 commit comments

Comments
 (0)