Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
{%- if include_macsec == "y" %}{% do features.append(("macsec", "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}{% endif %}
{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
"FEATURE": {
{# has_timer field if set, will start the feature systemd .timer unit instead of .service unit #}
{%- for feature, state, has_timer, autorestart in features %}
{# delayed field if set, will start the feature systemd .timer unit instead of .service unit #}
{%- for feature, state, delayed, autorestart in features %}
"{{feature}}": {
"state": "{{state}}",
"has_timer" : {{has_timer | lower()}},
"delayed" : {{delayed | lower()}},
"has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %},
{%- if feature in ["lldp"] %}
"has_per_asic_scope": {% raw %}"{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}"{% endraw %},
Expand Down
11 changes: 0 additions & 11 deletions files/build_templates/mgmt-framework.timer

This file was deleted.

12 changes: 0 additions & 12 deletions files/build_templates/per_namespace/lldp.timer.j2

This file was deleted.

12 changes: 0 additions & 12 deletions files/build_templates/pmon.timer

This file was deleted.

12 changes: 0 additions & 12 deletions files/build_templates/snmp.timer

This file was deleted.

5 changes: 0 additions & 5 deletions files/build_templates/sonic-delayed.target

This file was deleted.

34 changes: 0 additions & 34 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -843,19 +843,6 @@ if [ -f {{service}} ]; then
echo "{{service}}" | sudo tee -a $GENERATED_SERVICE_FILE
fi
{% endfor %}
{% for timer in installer_timers.split(' ') -%}
if [ -f {{timer}} ]; then
sudo cp {{timer}} $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM

{% if "@" in timer %}
MULTI_INSTANCE="{{timer}}"
SINGLE_INSTANCE=${MULTI_INSTANCE/"@"}
sudo cp $SINGLE_INSTANCE $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
{% endif %}

echo "{{timer}}" | sudo tee -a $GENERATED_SERVICE_FILE
fi
{% endfor %}
if [ -f iccpd.service ]; then
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable iccpd.service
fi
Expand Down Expand Up @@ -889,30 +876,9 @@ sudo LANG=C cp $SCRIPTS_DIR/write_standby.py $FILESYSTEM_ROOT/usr/local/bin/writ
# Copy mark_dhcp_packet script
sudo LANG=C cp $SCRIPTS_DIR/mark_dhcp_packet.py $FILESYSTEM_ROOT/usr/local/bin/mark_dhcp_packet.py

# Copy systemd timer configuration
# It implements delayed start of services
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
echo "snmp.timer" | sudo tee -a $GENERATED_SERVICE_FILE

{% if include_system_telemetry == 'y' %}
sudo cp $BUILD_TEMPLATES/telemetry.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
echo "telemetry.timer" | sudo tee -a $GENERATED_SERVICE_FILE
{% endif %}

{% if include_mgmt_framework == 'y' %}
sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
{% endif %}

sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE

sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target

sudo cp $BUILD_TEMPLATES/sonic-delayed.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic-delayed.target

sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python3-dev
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config
Expand Down
11 changes: 0 additions & 11 deletions files/build_templates/telemetry.timer

This file was deleted.

2 changes: 2 additions & 0 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ stop() {
if [[ x"$WARM_BOOT" != x"true" ]] && [[ x"$FAST_BOOT" != x"true" ]]; then
/usr/bin/${SERVICE}.sh stop $DEV
debug "Stopped ${SERVICE}$DEV service..."
$SONIC_DB_CLI APPL_DB DEL PORT_TABLE:PortInitDone
debug "Cleared PortInitDone from APPL_DB..."
else
debug "Killing Docker swss..."
/usr/bin/docker kill swss &> /dev/null || debug "Docker swss is not running ($?) ..."
Expand Down
31 changes: 0 additions & 31 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1330,14 +1330,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(eval $(docker:-dbg.gz=.gz)_GLOBAL = yes)
)
fi
if [ -f files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then
j2 files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer

# Set the flag GLOBAL_TIMER for all the global system-wide dockers timers.
$(if $(shell ls files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\
$(eval $(docker:-dbg.gz=.gz)_GLOBAL_TIMER = yes)
)
fi
# Any service template, inside instance directory, will be used to generate .service and @.service file.
if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then
export multi_instance="true"
Expand All @@ -1348,16 +1340,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export multi_instance="false"
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service
fi
# Any timer template, inside instance directory, will be used to generate .timer and @.timer file.
if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then
export multi_instance="true"
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME)@.timer
$(if $(shell ls files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\
$(eval $(docker:-dbg.gz=.gz)_TEMPLATE_TIMER = yes)
)
export multi_instance="false"
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer
fi
# Any service template, inside share_image directory, will be used to generate -chassis.service file.
# TODO: need better way to name the image-shared service
if [ -f files/build_templates/share_image/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then
Expand Down Expand Up @@ -1394,20 +1376,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(eval SERVICES += "$(addsuffix -chassis.service, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")
)
)
# Marks template timers with an "@" according to systemd convention
# If the $($docker)_TEMPLATE_TIMER) variable is set, the timer will be treated as a template
# If the $($docker)_GLOBAL_TIMER) and $($docker)_TEMPLATE_TIMER) variables are set the timer will be added both as a global and template timer.
$(foreach docker, $($*_DOCKERS),\
$(if $($(docker:-dbg.gz=.gz)_TEMPLATE_TIMER),\
$(if $($(docker:-dbg.gz=.gz)_GLOBAL_TIMER),\
$(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")\
)\
$(eval TIMERS += "$(addsuffix @.timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))"),\
$(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")
)
)
export installer_services="$(SERVICES)"
export installer_timers="$(TIMERS)"

export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker:-dbg.gz=.gz)_BASE_IMAGE_FILES), $($(docker:-dbg.gz=.gz)_PATH)/base_image_files/$(file)))"

Expand Down
14 changes: 7 additions & 7 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@
"auto_restart": "enabled",
"has_global_scope": "False",
"has_per_asic_scope": "True",
"has_timer": "False",
"delayed": "False",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "local",
Expand All @@ -1705,7 +1705,7 @@
"auto_restart": "always_enabled",
"has_global_scope": "true",
"has_per_asic_scope": "true",
"has_timer": "false",
"delayed": "false",
"high_mem_alert": "disabled",
"state": "always_enabled",
"set_owner": "local",
Expand All @@ -1716,7 +1716,7 @@
"auto_restart": "enabled",
"has_global_scope": "true",
"has_per_asic_scope": "false",
"has_timer": "true",
"delayed": "true",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "kube",
Expand All @@ -1727,7 +1727,7 @@
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"delayed": "false",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "local",
Expand All @@ -1738,7 +1738,7 @@
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"delayed": "false",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "local",
Expand All @@ -1749,7 +1749,7 @@
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"has_timer": "false",
"delayed": "false",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "kube",
Expand All @@ -1760,7 +1760,7 @@
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"delayed": "false",
"high_mem_alert": "disabled",
"state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}",
"set_owner": "kube",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "database",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "False",
"delayed": "False",
"has_global_scope": "True",
"has_per_asic_scope": "True",
"set_owner": "local",
Expand All @@ -18,7 +18,7 @@
"name": "swss",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "local",
Expand All @@ -29,7 +29,7 @@
"name": "syncd",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "local",
Expand All @@ -40,7 +40,7 @@
"name": "snmp",
"state": "enabled",
"auto_restart": "enabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "true",
"has_per_asic_scope": "false",
"set_owner": "kube",
Expand All @@ -51,7 +51,7 @@
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"set_owner": "kube",
Expand All @@ -62,7 +62,7 @@
"name": "dhcp_relay",
"state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}",
"auto_restart": "disabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"set_owner": "kube",
Expand All @@ -81,7 +81,7 @@
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"set_owner": "invalid",
Expand All @@ -100,7 +100,7 @@
"name": "lldp",
"state": "disabled",
"auto_restart": "disabled",
"has_timer": "false",
"delayed": "false",
"has_global_scope": "false",
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
"check_up_status": "false",
Expand All @@ -119,7 +119,7 @@
"name": "database",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "FALSE",
"delayed": "FALSE",
"has_global_scope": "TRUE",
"has_per_asic_scope": "TRUE",
"check_up_status": "FALSE",
Expand Down
6 changes: 3 additions & 3 deletions src/sonic-yang-models/yang-models/sonic-feature.yang
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ module sonic-feature{
default "enabled";
}

leaf has_timer {
description "This configuration identicates if there is
timer associated to this feature";
leaf delayed {
description "This configuration identicates if the feature needs to be delayed until
system initialization";
type stypes:boolean_type;
default "false";
}
Expand Down