Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions src/sonic-py-common/sonic_py_common/multi_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,19 @@ def get_asic_presence_list():
return asics_list


def get_container_name_from_asic_id(service_name, asic_id):
"""Get the container name for a service according to the ASIC ID

Args:
service_name (str): feature/service name
asic_id (int): ASIC ID

Returns:
str: container name of the service in the given ASIC namespace
"""
return '{}{}'.format(service_name, asic_id)


def is_front_panel_port(port, role=None):
"""
@summary: This function will check if the interface is a front-panel port
Expand Down
6 changes: 6 additions & 0 deletions src/sonic-py-common/tests/multi_asic_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from sonic_py_common import multi_asic


class TestMultiAsic:
def test_get_container_name_from_asic_id(self):
assert multi_asic.get_container_name_from_asic_id('database', 0) == 'database0'