Skip to content

Commit 6dfbdcb

Browse files
tjchadagaqiluo-msft
authored andcommitted
[warmboot] Migrate 10G ports during warm-reboot on s6100 (#2064)
1 parent 40d1365 commit 6dfbdcb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

scripts/db_migrator.py

+42
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(self, namespace, socket=None):
7272
version_info = device_info.get_sonic_version_info()
7373
asic_type = version_info.get('asic_type')
7474
self.asic_type = asic_type
75+
self.hwsku = device_info.get_hwsku()
7576

7677
if asic_type == "mellanox":
7778
from mellanox_buffer_migrator import MellanoxBufferMigrator
@@ -124,6 +125,43 @@ def migrate_interface_table(self):
124125
self.configDB.set_entry(table, key[0], data[key])
125126
if_db.append(key[0])
126127

128+
def migrate_mgmt_ports_on_s6100(self):
129+
'''
130+
During warm-reboot, add back two 10G management ports which got removed from 6100
131+
to ensure no change in bcm.config from older image
132+
'''
133+
if device_info.is_warm_restart_enabled('swss') == False:
134+
log.log_notice("Skip migration on {}, warm-reboot flag not set".format(self.hwsku))
135+
return True
136+
137+
entries = {}
138+
entries['Ethernet64'] = {'alias': 'tenGigE1/1', 'description': 'tenGigE1/1', 'index': '64', 'lanes': '129', 'mtu': '9100', 'pfc_asym': 'off', 'speed': '10000'}
139+
entries['Ethernet65'] = {'alias': 'tenGigE1/2', 'description': 'tenGigE1/2', 'index': '65', 'lanes': '131', 'mtu': '9100', 'pfc_asym': 'off', 'speed': '10000'}
140+
added_ports = 0
141+
for portName in entries.keys():
142+
if self.configDB.get_entry('PORT', portName):
143+
log.log_notice("Skipping migration for port {} - entry exists".format(portName))
144+
continue
145+
146+
log.log_notice("Migrating port {} to configDB for warm-reboot on {}".format(portName, self.hwsku))
147+
self.configDB.set_entry('PORT', portName, entries[portName])
148+
149+
#Copy port to APPL_DB
150+
key = 'PORT_TABLE:' + portName
151+
for field, value in entries[portName].items():
152+
self.appDB.set(self.appDB.APPL_DB, key, field, value)
153+
self.appDB.set(self.appDB.APPL_DB, key, 'admin_status', 'down')
154+
log.log_notice("Copied port {} to appdb".format(key))
155+
added_ports += 1
156+
157+
#Update port count in APPL_DB
158+
portCount = self.appDB.get(self.appDB.APPL_DB, 'PORT_TABLE:PortConfigDone', 'count')
159+
if portCount != '':
160+
total_count = int(portCount) + added_ports
161+
self.appDB.set(self.appDB.APPL_DB, 'PORT_TABLE:PortConfigDone', 'count', str(total_count))
162+
log.log_notice("Port count updated from {} to : {}".format(portCount, self.appDB.get(self.appDB.APPL_DB, 'PORT_TABLE:PortConfigDone', 'count')))
163+
return True
164+
127165
def migrate_intf_table(self):
128166
'''
129167
Migrate all data from existing INTF table in APP DB during warmboot with IP Prefix
@@ -546,6 +584,10 @@ def common_migration_ops(self):
546584
self.configDB.set_entry(init_cfg_table, key, new_cfg)
547585

548586
self.migrate_copp_table()
587+
if self.asic_type == "broadcom" and 'Force10-S6100' in self.hwsku:
588+
self.migrate_mgmt_ports_on_s6100()
589+
else:
590+
log.log_notice("Asic Type: {}, Hwsku: {}".format(self.asic_type, self.hwsku))
549591

550592
# To migrate buffer on Mellanox platforms
551593
# For legacy branches, this is the only place it can be called because

0 commit comments

Comments
 (0)