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

[code sync] Merge code from sonic-net/sonic-buildimage:202205 to 202205 #135

Merged
merged 3 commits into from
Oct 11, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"DEVICE_METADATA": {
"localhost": {
"create_only_config_db_buffers": "true"
}
}
}
12 changes: 12 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,18 @@ start() {
MOUNTPATH="$MOUNTPATH/$DEV"
fi
{%- endif %}

{%- if docker_container_name == "swss" %}
# Insert "create_only_config_db_buffers" attribute
HWSKU_FOLDER="/usr/share/sonic/device/$PLATFORM/$HWSKU"
if [ -d "$HWSKU_FOLDER" ]; then
CREATE_ONLY_CONFIG_DB_BUFFERS_JSON="$HWSKU_FOLDER/create_only_config_db_buffers.json"
if [ -f "$CREATE_ONLY_CONFIG_DB_BUFFERS_JSON" ]; then
$SONIC_CFGGEN -j $CREATE_ONLY_CONFIG_DB_BUFFERS_JSON --write-to-db
fi
fi
{%- endif %}

DOCKERCHECK=`docker inspect --type container ${DOCKERNAME} 2>/dev/null`
if [ "$?" -eq "0" ]; then
{%- if docker_container_name == "database" %}
Expand Down
7 changes: 5 additions & 2 deletions src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,18 @@ def get_platform_info(config_db=None):
if hw_info_dict:
return hw_info_dict

from .multi_asic import get_num_asics
from .multi_asic import get_asic_presence_list

version_info = get_sonic_version_info()

hw_info_dict['platform'] = get_platform()
hw_info_dict['hwsku'] = get_hwsku()
if version_info:
hw_info_dict['asic_type'] = version_info.get('asic_type')
hw_info_dict['asic_count'] = get_num_asics()
try:
hw_info_dict['asic_count'] = len(get_asic_presence_list())
except:
hw_info_dict['asic_count'] = 'N/A'

try:
# TODO: enforce caller to provide config_db explicitly and remove its default value
Expand Down
3 changes: 3 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 @@ -484,4 +484,7 @@ def get_asic_presence_list():
for asic in asics_presence_list:
# asic is asid id: asic0, asic1.... asicN. Get the numeric value.
asics_list.append(int(get_asic_id_from_name(asic)))
else:
# This is not multi-asic, all asics should be present.
asics_list = list(range(0, get_num_asics()))
return asics_list
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
"DEVICE_METADATA_INVALID_RACK_MGMT_MAP": {
"desc": "Verifying invalid rack_mgmt_map configuration.",
"eStr": "Invalid length for the rack mgmt map."
},
"DEVICE_METADATA_VALID_CREATE_ONLY_CONFIG_DB_BUFFERS": {
"desc": "Verifying the create_only_config_db_buffers value"
},
"DEVICE_METADATA_INVALID_CREATE_ONLY_CONFIG_DB_BUFFERS": {
"desc": "Verifying invalid create_only_config_db_buffers value",
"eStrKey": "InvalidValue"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,23 @@
}
}
}
},
"DEVICE_METADATA_VALID_CREATE_ONLY_CONFIG_DB_BUFFERS": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"create_only_config_db_buffers": "true"
}
}
}
},
"DEVICE_METADATA_INVALID_CREATE_ONLY_CONFIG_DB_BUFFERS": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"create_only_config_db_buffers": "invalid"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ module sonic-device_metadata {
}
description "Information of rack mgmt map.";
}

leaf create_only_config_db_buffers {
type boolean;
description "If this attribute exists and is equal to true - the buffers will be created
according to the config_db configuration (for example BUFFER_QUEUE|* table),
otherwise the maximum available buffers (which are read from SAI) will be
created, regardless of the CONFIG_DB buffers configuration.";
}
}
/* end of container localhost */
}
Expand Down