Skip to content

Commit

Permalink
Refractored portconfig to be used by breakout CLI subcommand (sonic-n…
Browse files Browse the repository at this point in the history
…et#14)

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
  • Loading branch information
samaity authored and zhenggen-xu committed Jan 9, 2020
1 parent 157fe9e commit 3b7d7fe
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 3b7d7fe

Please sign in to comment.