diff --git a/sfputil/main.py b/sfputil/main.py index eddc43f3dc..937b13fa2d 100644 --- a/sfputil/main.py +++ b/sfputil/main.py @@ -24,6 +24,7 @@ from utilities_common.sfp_helper import covert_application_advertisement_to_output_string from utilities_common.sfp_helper import QSFP_DATA_MAP from tabulate import tabulate +from utilities_common.general import load_db_config VERSION = '3.0' @@ -563,6 +564,7 @@ def load_sfputilhelper(): def load_port_config(): + load_db_config() try: if multi_asic.is_multi_asic(): # For multi ASIC platforms we pass DIR of port_config_file_path and the number of asics diff --git a/tests/sfputil_test.py b/tests/sfputil_test.py index 63814f31c5..e732140f83 100644 --- a/tests/sfputil_test.py +++ b/tests/sfputil_test.py @@ -1412,3 +1412,15 @@ def test_target_firmware(self, mock_chassis): result = runner.invoke(sfputil.cli.commands['firmware'].commands['target'], ["Ethernet0", "1"]) assert result.output == 'Target Mode set failed!\n' assert result.exit_code == EXIT_FAIL + + @patch('sfputil.main.multi_asic.is_multi_asic') + @patch('sfputil.main.platform_sfputil', MagicMock()) + @patch('sfputil.main.device_info.get_paths_to_platform_and_hwsku_dirs', + MagicMock(return_value=(None, None))) + @patch('sfputil.main.device_info.get_path_to_port_config_file', MagicMock(return_value=(''))) + def test_load_port_config(self, mock_is_multi_asic): + mock_is_multi_asic.return_value = True + assert sfputil.load_port_config() == True + + mock_is_multi_asic.return_value = False + assert sfputil.load_port_config() == True