Skip to content

Commit

Permalink
fixing migrate_config_db_port_table_for_switchport_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadUmarAsad committed Feb 18, 2023
1 parent 499b6d5 commit 63e28aa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,12 @@ 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')
vlan_member_table = self.configDB.get_table('VLAN_MEMBER')
if vlan_member_table is None:
pass
for key, value in port_table.items():
if 'mode' in value:
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", key), 'mode', value['mode'])
else:
if key in vlan_member_table.keys():
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format("PORT", key), 'mode', 'trunk')
else:
self.configDB.set(self.configDB.CONFIG_DB, '{}|{}'.format('PORT', key), 'mode', 'routed')


def migrate_qos_db_fieldval_reference_remove(self, table_list, db, db_num, db_delimeter):
Expand Down
2 changes: 1 addition & 1 deletion tests/db_migrator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_lacp_key_migrator(self):
dbconnector.dedicated_dbs['CONFIG_DB'] = os.path.join(mock_db_path, 'config_db', 'portchannel-expected')
expected_db = Db()
advance_version_for_expected_database(dbmgtr.configDB, expected_db.cfgdb, 'version_3_0_2')

assert dbmgtr.configDB.get_table('PORTCHANNEL') == expected_db.cfgdb.get_table('PORTCHANNEL')
assert dbmgtr.configDB.get_table('VERSIONS') == expected_db.cfgdb.get_table('VERSIONS')

Expand Down

0 comments on commit 63e28aa

Please sign in to comment.