Merge branch 'sonic-net:master' into fix-14909
This commit is contained in:
commit
5106589077
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"create_only_config_db_buffers": "true"
|
||||
}
|
||||
}
|
||||
}
|
@ -387,6 +387,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" %}
|
||||
|
@ -59,8 +59,9 @@ HWMGMT_SYSTEM_ROOT = '/var/run/hw-management/system/'
|
||||
|
||||
#reboot cause related definitions
|
||||
REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT
|
||||
|
||||
REBOOT_CAUSE_FILE_LENGTH = 1
|
||||
REBOOT_CAUSE_MAX_WAIT_TIME = 45
|
||||
REBOOT_CAUSE_CHECK_INTERVAL = 5
|
||||
REBOOT_CAUSE_READY_FILE = '/run/hw-management/config/reset_attr_ready'
|
||||
|
||||
REBOOT_TYPE_KEXEC_FILE = "/proc/cmdline"
|
||||
REBOOT_TYPE_KEXEC_PATTERN_WARM = ".*SONIC_BOOT_TYPE=(warm|fastfast).*"
|
||||
@ -782,6 +783,16 @@ class Chassis(ChassisBase):
|
||||
return 'fast-reboot'
|
||||
return None
|
||||
|
||||
def _wait_reboot_cause_ready(self):
|
||||
max_wait_time = REBOOT_CAUSE_MAX_WAIT_TIME
|
||||
while max_wait_time > 0:
|
||||
if utils.read_int_from_file(REBOOT_CAUSE_READY_FILE, log_func=None) == 1:
|
||||
return True
|
||||
time.sleep(REBOOT_CAUSE_CHECK_INTERVAL)
|
||||
max_wait_time -= REBOOT_CAUSE_CHECK_INTERVAL
|
||||
|
||||
return False
|
||||
|
||||
def get_reboot_cause(self):
|
||||
"""
|
||||
Retrieves the cause of the previous reboot
|
||||
@ -802,6 +813,10 @@ class Chassis(ChassisBase):
|
||||
if reboot_cause:
|
||||
return self.REBOOT_CAUSE_NON_HARDWARE, ''
|
||||
|
||||
if not self._wait_reboot_cause_ready():
|
||||
logger.log_error("Hardware reboot cause is not ready")
|
||||
return self.REBOOT_CAUSE_NON_HARDWARE, ''
|
||||
|
||||
if not self.reboot_cause_initialized:
|
||||
self.initialize_reboot_cause()
|
||||
|
||||
|
@ -194,6 +194,7 @@ class TestChassis:
|
||||
assert status is True
|
||||
assert 'sfp' in event_dict and not event_dict['sfp']
|
||||
|
||||
@mock.patch('sonic_platform.chassis.Chassis._wait_reboot_cause_ready', MagicMock(return_value=True))
|
||||
def test_reboot_cause(self):
|
||||
from sonic_platform import utils
|
||||
from sonic_platform.chassis import REBOOT_CAUSE_ROOT
|
||||
@ -242,6 +243,22 @@ class TestChassis:
|
||||
assert minor == value
|
||||
mock_file_content[file_path] = 0
|
||||
|
||||
@mock.patch('sonic_platform.chassis.Chassis._wait_reboot_cause_ready', MagicMock(return_value=False))
|
||||
def test_reboot_cause_timeout(self):
|
||||
chassis = Chassis()
|
||||
major, minor = chassis.get_reboot_cause()
|
||||
assert major == chassis.REBOOT_CAUSE_NON_HARDWARE
|
||||
assert minor == ''
|
||||
|
||||
@mock.patch('sonic_platform.utils.read_int_from_file')
|
||||
@mock.patch('sonic_platform.chassis.time.sleep', mock.MagicMock())
|
||||
def test_wait_reboot_cause_ready(self, mock_read_int):
|
||||
mock_read_int.return_value = 1
|
||||
chassis = Chassis()
|
||||
assert chassis._wait_reboot_cause_ready()
|
||||
mock_read_int.return_value = 0
|
||||
assert not chassis._wait_reboot_cause_ready()
|
||||
|
||||
def test_parse_warmfast_reboot_from_proc_cmdline(self):
|
||||
chassis = Chassis()
|
||||
with mock.patch("builtins.open", mock.mock_open(read_data="SONIC_BOOT_TYPE=warm")):
|
||||
|
@ -32,7 +32,7 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG)
|
||||
|
||||
$(DOCKER_EVENTD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
$(DOCKER_EVENTD)_CONTAINER_NAME = eventd
|
||||
$(DOCKER_EVENTD)_RUN_OPT += --privileged -t
|
||||
$(DOCKER_EVENTD)_RUN_OPT += -t
|
||||
$(DOCKER_EVENTD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_EVENTD)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
|
||||
|
||||
|
@ -30,7 +30,7 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MUX_DBG)
|
||||
endif
|
||||
|
||||
$(DOCKER_MUX)_CONTAINER_NAME = mux
|
||||
$(DOCKER_MUX)_RUN_OPT += --privileged -t
|
||||
$(DOCKER_MUX)_RUN_OPT += -t
|
||||
$(DOCKER_MUX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_MUX)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
|
||||
$(DOCKER_MUX)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
|
@ -29,7 +29,7 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_ROUTER_ADVERTISER_DBG)
|
||||
endif
|
||||
|
||||
$(DOCKER_ROUTER_ADVERTISER)_CONTAINER_NAME = radv
|
||||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += --privileged -t
|
||||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -t
|
||||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_ROUTER_ADVERTISER)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
|
||||
$(DOCKER_ROUTER_ADVERTISER)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
|
@ -501,6 +501,11 @@ RUN patch -p1 -i /disable-non-manylinux.patch /usr/local/lib/python3.9/dist-pack
|
||||
# For building sonic-utilities
|
||||
RUN pip3 install fastentrypoints mock
|
||||
|
||||
# For building sonic_ycabled
|
||||
# Note: upstream build breaks with old version of setuptools
|
||||
# ref: https://github.com/grpc/grpc/issues/34569
|
||||
RUN pip3 install grpcio==1.58.0 grpcio-tools==1.58.0
|
||||
|
||||
# For running Python unit tests
|
||||
RUN pip3 install pytest-runner==5.2
|
||||
RUN pip3 install nose==1.3.7
|
||||
|
@ -149,5 +149,12 @@
|
||||
"DEVICE_METADATA_INVALID_TIMEZONE": {
|
||||
"desc": "Verifying invalid timezone value",
|
||||
"eStrKey": "Range"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@ -398,5 +398,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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,6 +234,14 @@ module sonic-device_metadata {
|
||||
description "The TZ database name to use for the system, such as 'Europe/Stockholm'.";
|
||||
reference "IANA Time Zone Database http://www.iana.org/time-zones";
|
||||
}
|
||||
|
||||
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 */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user