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

Refractored portconfig to be used by breakout CLI subcommand #14

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
12 changes: 9 additions & 3 deletions src/sonic-config-engine/portconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
HWSKU_ROOT_PATH = '/usr/share/sonic/hwsku'

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

PORT_STR = "Ethernet"
BRKOUT_MODE = "default_brkout_mode"
Expand All @@ -33,8 +33,7 @@ def db_connect_configdb():
return None
try:
config_db.connect()
except Exception as e:
print("Config DB is not available with error {}".format(str(e)))
except:
config_db = None
return config_db

Expand Down Expand Up @@ -204,10 +203,17 @@ def parse_platform_json_file(port_config_file, interface_name=None, target_brkou
if match_list is not None:
offset = 0
parent_intf_id = int(re.search("Ethernet(\d+)", intf).group(1))

if interface_name is not None and interface_name == intf:
ports = {}

for k in match_list:
# k is a tuple in "match_list"
offset = gen_port_config(ports, parent_intf_id, index, alias_at_lanes, lanes, k, offset)
brkout_mode = None

if interface_name is not None and interface_name == intf:
return ports
else:
raise Exception("match_list should not be None.")
if not ports:
Expand Down