Skip to content

Commit ed91669

Browse files
committed
Updates from review.
1 parent 1a42478 commit ed91669

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/sonic-py-common/sonic_py_common/multi_asic.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ def get_front_end_namespaces():
303303
"""
304304
Get the namespaces in the platform. For multi-asic devices we get the namespaces
305305
mapped to asic which have front-panel interfaces. For single ASIC device it is the
306-
EMPTY_NAMESPACE which maps to the linux host.
306+
DEFAULT_NAMESPACE which maps to the linux host.
307307
308308
Returns:
309309
a list of namespaces
310310
"""
311-
namespaces = [EMPTY_NAMESPACE]
311+
namespaces = [DEFAULT_NAMESPACE]
312312
if is_multi_asic():
313313
ns_list = get_all_namespaces()
314314
namespaces = ns_list['front_ns']
@@ -318,13 +318,16 @@ def get_front_end_namespaces():
318318
def get_asic_index_from_namespace(namespace):
319319
"""
320320
Get asic index from the namespace name.
321-
With single ASIC platform, namespace is EMPTY_NAMESPACE, return asic_index 0
321+
With single ASIC platform, return asic_index 0, which is mapped to the only asic present.
322322
323323
Returns:
324324
asic_index as an integer.
325+
None, if namespace given as input is not mapped to any asic in multi-asic platform.
325326
"""
326-
asic_id_string = get_asic_id_from_name(namespace)
327-
if asic_id_string is not None:
328-
return int(asic_id_string)
327+
if is_multi_asic():
328+
asic_id_string = get_asic_id_from_name(namespace)
329+
if asic_id_string is not None:
330+
return int(asic_id_string)
331+
return None
329332

330333
return 0

0 commit comments

Comments
 (0)