Skip to content

Commit

Permalink
[sonic-utilities]update submodule with fix
Browse files Browse the repository at this point in the history
Fix pfcwd stats crash with invalid queue name (sonic-net#1077)
[show][bgp]Display the Total number of neighbors in the show ip bgp(v6) summary. (sonic-net#1079)
[config] Update SONiC Environment Vars When Loading Minigraph (sonic-net#1073)
Multi asic platform changes for interface, portchannel commands (sonic-net#878)
Update Command-Reference.md (sonic-net#1075)
[filter-fdb] Fix Filter FDB With IPv6 Present in Config DB (sonic-net#1059)
[config] Remove _get_breakout_cfg_file_name helper function (sonic-net#1069)
[SHOW][BGP] support show ip(v6) bgp summary for multi asic platform (sonic-net#1064)
[fanshow] Display other fan status, such as Updating (sonic-net#1014)
Add ip_prefix len based on proxy_arp status (sonic-net#1046)
Enable the platform specific ssd firmware upgrade during reboot (sonic-net#954)
[show][cli[show interface portchannel support for Multi ASIC (sonic-net#1005)
support show interface commands for multi ASIC platforms (sonic-net#1006)

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
  • Loading branch information
vdahiya12 committed Aug 27, 2020
1 parent a8016a6 commit c7a9f2f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
37 changes: 23 additions & 14 deletions src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,36 @@ def get_paths_to_platform_and_hwsku_dirs():

return (platform_path, hwsku_path)


def get_path_to_port_config_file():
def get_path_to_port_config_file(asic=None):
"""
Retrieves the path to the device's port configuration file
Returns:
A string containing the path the the device's port configuration file
"""
# Get platform and hwsku path
(platform_path, hwsku_path) = get_paths_to_platform_and_hwsku_dirs()

# First check for the presence of the new 'platform.json' file
port_config_file_path = os.path.join(platform_path, PLATFORM_JSON_FILE)
if not os.path.isfile(port_config_file_path):
# platform.json doesn't exist. Try loading the legacy 'port_config.ini' file
port_config_file_path = os.path.join(hwsku_path, PORT_CONFIG_FILE)
if not os.path.isfile(port_config_file_path):
raise OSError("Failed to detect port config file: {}".format(port_config_file_path))

return port_config_file_path
(platform, hwsku) = get_platform_and_hwsku()

# check 'platform.json' file presence
port_config_candidates_json = []
port_config_candidates_json.append(os.path.join(PLATFORM_ROOT_PATH_DOCKER, PLATFORM_JSON))
port_config_candidates_json.append(os.path.join(PLATFORM_ROOT_PATH, platform, PLATFORM_JSON))

# check 'portconfig.ini' file presence
port_config_candidates = []
port_config_candidates.append(os.path.join(HWSKU_ROOT_PATH, PORT_CONFIG_INI))
if asic:
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, hwsku, asic, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, hwsku, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH_DOCKER, hwsku, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(SONIC_ROOT_PATH, hwsku, PORT_CONFIG_INI))

if platform and not hwsku:
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, PORT_CONFIG_INI))

for candidate in port_config_candidates_json + port_config_candidates:
if os.path.isfile(candidate):
return candidate
return None

def get_sonic_version_info():
if not os.path.isfile(SONIC_VERSION_YAML_PATH):
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-utilities

0 comments on commit c7a9f2f

Please sign in to comment.