-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[db_migrator] Add missing attribute 'weight' to route entries in APPL DB #2691
Changes from 4 commits
4a065b4
e825097
138975d
0089c2a
f0c5422
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -579,6 +579,18 @@ def migrate_port_qos_map_global(self): | |
self.configDB.set_entry('PORT_QOS_MAP', 'global', {"dscp_to_tc_map": dscp_to_tc_map_table_names[0]}) | ||
log.log_info("Created entry for global DSCP_TO_TC_MAP {}".format(dscp_to_tc_map_table_names[0])) | ||
|
||
def migrate_route_table_weights(self): | ||
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 version_unknown(self): | ||
""" | ||
version_unknown tracks all SONiC versions that doesn't have a version | ||
|
@@ -899,6 +911,8 @@ def common_migration_ops(self): | |
else: | ||
log.log_notice("Asic Type: {}, Hwsku: {}".format(self.asic_type, self.hwsku)) | ||
|
||
self.migrate_route_table_weights() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since we have other functions as " There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that's a good idea. Updated now. |
||
|
||
def migrate(self): | ||
version = self.get_version() | ||
log.log_info('Upgrading from version ' + version) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"ROUTE_TABLE:192.168.104.0/25": { | ||
"nexthop": "10.0.0.57,10.0.0.59,10.0.0.61,10.0.0.63", | ||
"ifname" : "PortChannel101,PortChannel102,PortChannel103,PortChannel104", | ||
"weight": "" | ||
}, | ||
"ROUTE_TABLE:20c0:fe28:0:80::/64": { | ||
"nexthop": "fc00::72,fc00::76,fc00::7a,fc00::7e", | ||
"ifname" : "PortChannel101,PortChannel102,PortChannel103,PortChannel104", | ||
"weight": "" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"ROUTE_TABLE:192.168.104.0/25": { | ||
"nexthop": "10.0.0.57,10.0.0.59,10.0.0.61,10.0.0.63", | ||
"ifname" : "PortChannel101,PortChannel102,PortChannel103,PortChannel104" | ||
}, | ||
"ROUTE_TABLE:20c0:fe28:0:80::/64": { | ||
"nexthop": "fc00::72,fc00::76,fc00::7a,fc00::7e", | ||
"ifname" : "PortChannel101,PortChannel102,PortChannel103,PortChannel104" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"VERSIONS|DATABASE": {"VERSION": "version_1_0_1"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also check how the subnet routes looks like? IIRC, it may not have weights today. The ones without
nexthop
but justifname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic will still add the weight attr to these routes.
It did not create an issue though, as the bootup path took two diff directions: For all other routes which do not have nexthops - weight attribute added by my logic will be removed after reconciliation.