Skip to content

Commit

Permalink
updated migrate_config_db_port_table_for_switchport_mode to migrate_c…
Browse files Browse the repository at this point in the history
…onfig_db_port_portchannel_table_for_switchport_mode and added support for portchannel
  • Loading branch information
MuhammadUmarAsad committed Feb 18, 2023
1 parent 63e28aa commit b4197b9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,22 @@ def migrate_config_db_port_table_for_auto_neg(self):

def migrate_config_db_port_table_for_switchport_mode(self):
port_table = self.configDB.get_table('PORT')
portchannel_table = self.configDB.get_table('PORTCHANNEL')
vlan_member_table = self.configDB.get_table('VLAN_MEMBER')
for key, value in port_table.items():
if 'mode' in value:
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", key), 'mode', value['mode'])

for p_key, p_value in port_table.items():
if 'mode' in p_value:
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", p_key), 'mode', p_value['mode'])
else:
if p_key in vlan_member_table.keys():
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", p_key), 'mode', 'trunk')

for pc_key, pc_value in portchannel_table.items():
if 'mode' in pc_value:
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", pc_key), 'mode', pc_value['mode'])
else:
if key in vlan_member_table.keys():
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", key), 'mode', 'trunk')
if pc_key in vlan_member_table.keys():
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", pc_key), 'mode', 'trunk')


def migrate_qos_db_fieldval_reference_remove(self, table_list, db, db_num, db_delimeter):
Expand Down

0 comments on commit b4197b9

Please sign in to comment.