Skip to content

Commit

Permalink
Copp Changes (sonic-net#1004)
Browse files Browse the repository at this point in the history
Added DB migrator script for removing old copp APP DB entries.

Co-authored-by: dgsudharsan <[email protected]>
  • Loading branch information
Sudharsan Dhamal Gopalarathnam and dgsudharsan authored Nov 12, 2020
1 parent b226159 commit dadfc18
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dadfc18

Please sign in to comment.