[sonic-py-common] Add platform.json to port_config files candidates only if interfaces are present within platform.json (#5538)
* [sonic-py-common] add platform.json to port_config Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
This commit is contained in:
parent
4a390e93cf
commit
3cd1d8e923
@ -1,4 +1,5 @@
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@ -255,8 +256,21 @@ def get_path_to_port_config_file(hwsku=None, asic=None):
|
||||
|
||||
# if 'hwsku.json' file is available, Check for 'platform.json' file presence,
|
||||
# if 'platform.json' is available, APPEND it. Otherwise, SKIP it.
|
||||
|
||||
"""
|
||||
This length check for interfaces in platform.json is performed to make sure
|
||||
the cfggen does not fail if port configuration information is not present
|
||||
TODO: once platform.json has all the necessary port config information
|
||||
remove this check
|
||||
"""
|
||||
|
||||
if os.path.isfile(hwsku_json_file):
|
||||
port_config_candidates.append(os.path.join(platform_path, PLATFORM_JSON_FILE))
|
||||
if os.path.isfile(os.path.join(platform_path, PLATFORM_JSON_FILE)):
|
||||
json_file = os.path.join(platform_path, PLATFORM_JSON_FILE)
|
||||
platform_data = json.loads(open(json_file).read())
|
||||
interfaces = platform_data.get('interfaces', None)
|
||||
if interfaces is not None and len(interfaces) > 0:
|
||||
port_config_candidates.append(os.path.join(platform_path, PLATFORM_JSON_FILE))
|
||||
|
||||
# Check for 'port_config.ini' file presence in a few locations
|
||||
if asic:
|
||||
|
Reference in New Issue
Block a user