Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sfputil] Add support of platform.json #767

Merged
merged 3 commits into from
Jun 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sfputil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

# Global platform-specific sfputil class instance
platform_sfputil = None

PLATFORM_JSON = 'platform.json'
PORT_CONFIG_INI = 'port_config.ini'

# ========================== Syslog wrappers ==========================

Expand Down Expand Up @@ -329,14 +330,13 @@ def get_path_to_port_config_file():
hwsku_path = "/".join([platform_path, hwsku])

# First check for the presence of the new 'port_config.ini' file
port_config_file_path = "/".join([hwsku_path, "port_config.ini"])
port_config_file_path = "/".join([platform_path, PLATFORM_JSON])
if not os.path.isfile(port_config_file_path):
# port_config.ini doesn't exist. Try loading the legacy 'portmap.ini' file
port_config_file_path = "/".join([hwsku_path, "portmap.ini"])
# platform.json doesn't exist. Try loading the legacy 'port_config.ini' file
port_config_file_path = "/".join([hwsku_path, PORT_CONFIG_INI])

return port_config_file_path


# Loads platform specific sfputil module from source
def load_platform_sfputil():
global platform_sfputil
Expand Down