Skip to content

Commit d440df7

Browse files
authored
[warmboot] Migrate 10G ports during warm-reboot on s6100 (#2064)
1 parent 494c6d7 commit d440df7

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
@@ -73,6 +73,7 @@ def __init__(self, namespace, socket=None):
7373
version_info = device_info.get_sonic_version_info()
7474
asic_type = version_info.get('asic_type')
7575
self.asic_type = asic_type
76+
self.hwsku = device_info.get_hwsku()
7677

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

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

668706
self.migrate_copp_table()
707+
if self.asic_type == "broadcom" and 'Force10-S6100' in self.hwsku:
708+
self.migrate_mgmt_ports_on_s6100()
709+
else:
710+
log.log_notice("Asic Type: {}, Hwsku: {}".format(self.asic_type, self.hwsku))
669711

670712
def migrate(self):
671713
version = self.get_version()

0 commit comments

Comments
 (0)