Skip to content

Commit

Permalink
[db_migrator] Add missing attribute 'weight' to route entries in APPL DB
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavhd committed Feb 23, 2023
1 parent 33e85d3 commit 4a065b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,17 @@ def common_migration_ops(self):
else:
log.log_notice("Asic Type: {}, Hwsku: {}".format(self.asic_type, self.hwsku))

route_table = self.appDB.get_table("ROUTE_TABLE")
for route_prefix, route_attr in route_table.items():
if 'weight' not in route_attr:
if type(route_prefix) == tuple:
# IPv6 route_prefix is returned from db as tuple
route_key = "ROUTE_TABLE:" + ":".join(route_prefix)
else:
# IPv4 route_prefix is returned from db as str
route_key = "ROUTE_TABLE:{}".format(route_prefix)
self.appDB.set(self.appDB.APPL_DB, route_key, 'weight','')

def migrate(self):
version = self.get_version()
log.log_info('Upgrading from version ' + version)
Expand Down

0 comments on commit 4a065b4

Please sign in to comment.