From 2dd38fb62a9cc34ff6a5f0abb66f59908191eb12 Mon Sep 17 00:00:00 2001 From: mazora Date: Mon, 30 Sep 2024 09:48:57 +0300 Subject: [PATCH 1/2] update files to begin sonic-profiling -- does not compile --- Makefile.work | 15 ++- files/build_templates/init_cfg.json.j2 | 156 +++++++++++++++++++++---- rules/config | 54 ++++++++- rules/docker-dhcp-server.mk | 4 +- rules/docker-eventd.mk | 10 +- rules/docker-gnmi.mk | 10 +- rules/docker-macsec.mk | 11 +- rules/docker-mux.mk | 4 +- rules/docker-nat.mk | 4 +- rules/docker-p4rt.mk | 13 ++- rules/docker-restapi.mk | 7 +- rules/docker-router-advertiser.mk | 4 +- rules/docker-sflow.mk | 6 +- rules/docker-sonic-mgmt-framework.mk | 9 +- rules/docker-teamd.mk | 6 +- rules/docker-telemetry.mk | 11 +- slave.mk | 94 +++++++++++++-- 17 files changed, 341 insertions(+), 77 deletions(-) diff --git a/Makefile.work b/Makefile.work index 6079906a1005..192aab0e5559 100644 --- a/Makefile.work +++ b/Makefile.work @@ -143,7 +143,20 @@ endif rules/config.user: $(Q)echo -n "" -include rules/config +# Check if SONIC_PROFILE is set +ifeq ($(SONIC_PROFILE),) + CONFIG_FILE := rules/config + $(info SONIC_PROFILE is not set. Using default configuration.) +else + CONFIG_FILE := rules/config.$(SONIC_PROFILE) + ifeq ($(wildcard $(CONFIG_FILE)),) + CONFIG_FILE := rules/config + $(info Configuration file $(CONFIG_FILE) does not exist. Using default configuration.) + endif +endif + +# Import the configuration file +include ${CONFIG_FILE} -include rules/config.user include rules/sonic-fips.mk diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index f8083f040541..6da77bdfc55b 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -42,30 +42,140 @@ ("snmp", "enabled", true, "enabled"), ("swss", "enabled", false, "enabled"), ("syncd", "enabled", false, "enabled")] %} -{%- if include_router_advertiser == "y" %}{% do features.append(("radv", "enabled", false, "enabled")) %}{% endif %} -{%- if include_teamd == "y" %}{% do features.append(("teamd", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", false, "enabled")) %}{% endif %} -{% do features.append(("dhcp_relay", "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %} -{%- if include_dhcp_server == "y" %}{% do features.append(("dhcp_server", "disabled", false, "enabled")) %}{% endif %} -{%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %} -{%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %} -{%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %} -{%- if include_mux == "y" %}{% do features.append(("mux", "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled")) %}{% endif %} -{%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %} -{%- if include_p4rt == "y" %}{% do features.append(("p4rt", "disabled", false, "enabled")) %}{% endif %} -{%- if include_restapi == "y" and BUILD_REDUCE_IMAGE_SIZE == "y" and sonic_asic_platform == "broadcom" %} - {% do features.append(("restapi", "{% if (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['LeafRouter', 'BackEndLeafRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %} +{%- if include_router_advertiser == "y" %} + {% do features.append((" + radv", + "enabled" if enable_router_advertiser == "y" else "disabled", + true if delay_router_advertiser == "y" else false, + "enabled" if autorestart_router_advertiser == "y" else "disabled" + )) %} +{% endif %} +{%- if include_teamd == "y" %} + {% do features.append(( + "teamd", + {% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}"disabled"{% else %}"enabled"{% endif %} if enable_teamd == "y" else "disabled", + true if delay_teamd == "y" else false, + "enabled" if autorestart_teamd == "y" else "disabled" + )) %} +{% endif %} +{% do features.append(( + "dhcp_relay", + {% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}"enabled"{% else %}"disabled"{% endif %}, + false, + "enabled" +)) %} +{%- if include_dhcp_server == "y" %} + {% do features.append(( + "dhcp_server", + "enabled" if enable_dhcp_server == "y" else "disabled", + true if delay_dhcp_server == "y" else false, + "enabled" if autorestart_dhcp_server == "y" else "disabled" + )) %} +{% endif %} +{%- if sonic_asic_platform == "vs" and include_gbsyncd == "y" %} + {% do features.append(( + "gbsyncd", + "enabled", + false, + "enabled" + )) %} +{% endif %} +{%- if include_iccpd == "y" %} + {% do features.append(( + "iccpd", + "enabled" if enable_iccpd == "y" else "disabled", + false if delay_iccpd == "y" else true, + "enabled" if autorestart_iccpd == "y" else "disabled" + )) %} +{% endif %} +{%- if include_mgmt_framework == "y" %} + {% do features.append(( + "mgmt-framework", + "enabled" if enable_mgmt_framework == "y" else "disabled", + true if delay_mgmt_framework == "y" else false, + "enabled" if autorestart_mgmt_framework == "y" else "disabled" + )) %} +{% endif %} +{%- if include_mux == "y" %} + {% do features.append(( + "mux", + {% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}"enabled"{% else %}"always_disabled"{% endif %}, + false, + "enabled" + )) %} +{% endif %} +{%- if include_nat == "y" %} + {% do features.append(( + "nat", + "enabled" if enable_nat == "y" else "disabled", + true if delay_nat == "y" else false, + "enabled" if autorestart_nat == "y" else "disabled" + )) %} +{% endif %} +{%- if include_p4rt == "y" %} + {% do features.append(( + "p4rt", + "enabled" if enable_p4rt == "y" else "disabled", + true if delay_p4rt == "y" else false, + "enabled" if autorestart_p4rt == "y" else "disabled" + )) %} +{% endif %} +{%- if include_restapi == "y" and build_reduce_image_size == "y" and sonic_asic_platform == "broadcom" %} + {% do features.append(( + "restapi", + {% if (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['LeafRouter', 'BackEndLeafRouter']) %}"enabled"{% else %}"disabled"{% endif %}, + false, + "enabled" + )) %} {%- elif include_restapi == "y" %} - {% do features.append(("restapi", "enabled", false, "enabled")) %} -{%- endif %} -{%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", true, "enabled")) %}{% endif %} -{%- 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_gnmi == "y" %}{% do features.append(("gnmi", "enabled", true, "enabled")) %}{% endif %} -{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %} -{%- if include_system_eventd == "y" and BUILD_REDUCE_IMAGE_SIZE == "y" %} - {% do features.append(("eventd","disabled", false, "enabled")) %} -{%- elif include_system_eventd == "y" %} - {% do features.append(("eventd", "enabled", false, "enabled")) %} + {% do features.append(( + "restapi", + "enabled" if enable_restapi == "y" else "disabled", + true if delay_restapi == "y" else false, + "enabled" if autorestart_restapi == "y" else "disabled" + )) %} {%- endif %} +{%- if include_sflow == "y" %} + {% do features.append(( + "sflow", + "disabled", + true, + "enabled" + )) %} +{% endif %} +{%- if include_macsec == "y" %} + {% do features.append(( + "macsec", + {% if enable_macsec == "y" and 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}"enabled"{% else %}"disabled"{% endif %}, + true if delay_macsec == "y" else false, + "enabled" if autorestart_macsec == "y" else "disabled" + )) %} +{% endif %} +{%- if include_system_gnmi == "y" %} + {% do features.append(( + "gnmi", + "enabled" if enable_system_gnmi == "y" else "disabled", + true if delay_system_gnmi == "y" else false, + "enabled" if autorestart_system_gnmi == "y" else "disabled" + )) %} +{% endif %} +{%- if include_system_telemetry == "y" %} + {% do features.append(( + "telemetry", + "enabled" if enable_system_telemetry == "y" else "disabled", + true if delay_system_telemetry == "y" else false, + "enabled" if autorestart_system_telemetry == "y" else "disabled" + )) %} +{% endif %} +{%- if include_system_eventd == "y" %} + {% do features.append(( + "eventd", + "disabled" if build_reduce_image_size == "y" else ("enabled" if enable_system_eventd == "y" else "disabled"), + true if delay_system_eventd == "y" else false, + "enabled" if autorestart_system_eventd == "y" else "disabled" + )) %} +{% endif %} + "FEATURE": { {# delayed field if set, will start the feature systemd .timer unit instead of .service unit #} {%- for feature, state, delayed, autorestart in features %} @@ -187,4 +297,4 @@ "vrf": "default" } } -} +} \ No newline at end of file diff --git a/rules/config b/rules/config index d2ddcb704fbe..f617038e9352 100644 --- a/rules/config +++ b/rules/config @@ -120,21 +120,39 @@ DEFAULT_VS_PREPARE_MEM = yes # INCLUDE_SYSTEM_GNMI - build docker-sonic-gnmi for system gnmi support INCLUDE_SYSTEM_GNMI = y +ENABLE_SYSTEM_GNMI = y +DELAY_SYSTEM_GNMI = y +AUTORESTART_SYSTEM_GNMI = y # INCLUDE_SYSTEM_EVENTD - build docker-eventd for system eventd support INCLUDE_SYSTEM_EVENTD = y +ENABLE_SYSTEM_EVENTD = y +DELAY_SYSTEM_EVENTD = n +AUTORESTART_SYSTEM_EVENTD = y # INCLUDE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support -INCLUDE_SYSTEM_TELEMETRY = n +INCLUDE_SYSTEM_TELEMETRY = y +ENABLE_SYSTEM_TELEMETRY = y +DELAY_SYSTEM_TELEMETRY = y +AUTORESTART_SYSTEM_TELEMETRY = y # INCLUDE_ICCPD - build docker-iccpd for mclag support INCLUDE_ICCPD = n +ENABLE_ICCPD = n +DELAY_ICCPD = n +AUTORESTART_ICCPD = y # INCLUDE_SFLOW - build docker-sflow for sFlow support INCLUDE_SFLOW = y +ENABLE_SFLOW = n +DELAY_SFLOW = y +AUTORESTART_SFLOW = y # INCLUDE_MGMT_FRAMEWORK - build docker-sonic-mgmt-framework for CLI and REST server support INCLUDE_MGMT_FRAMEWORK = y +ENABLE_MGMT_FRAMEWORK = y +DELAY_MGMT_FRAMEWORK = y +AUTORESTART_MGMT_FRAMEWORK = y # ENABLE_HOST_SERVICE_ON_START - enable sonic-host-server for mgmt-framework and/or # gnmi containers to access host functionality by default @@ -142,18 +160,35 @@ ENABLE_HOST_SERVICE_ON_START = y # INCLUDE_RESTAPI - build docker-sonic-restapi for configuring the switch using REST APIs INCLUDE_RESTAPI ?= n +ENABLE_RESTAPI = y +DELAY_RESTAPI = n +AUTORESTART_RESTAPI = y # INCLUDE_NAT - build docker-nat for nat support INCLUDE_NAT = y +ENABLE_NAT = n +DELAY_NAT = n +AUTORESTART_NAT = y # INCLUDE_DHCP_RELAY - build and install dhcp-relay package +# TODO: In init_cfg.json.j2,this docker is not surrounded by an if INCLUDE_DHCP_RELAY = y +ENABLE_DHCP_RELAY = y +DELAY_DHCP_RELAY = y +AUTORESTART_DHCP_RELAY = y # INCLUDE_DHCP_SERVER - build and install dhcp-server package +# TODO: Not added to SONIC_INSTALL_DOCKER_IMAGES in makefile INCLUDE_DHCP_SERVER ?= n +ENABLE_DHCP_SERVER = n +DELAY_DHCP_SERVER = n +AUTORESTART_DHCP_SERVER = y # INCLUDE_P4RT - build docker-p4rt for P4RT support INCLUDE_P4RT = n +ENABLE_P4RT = n +DELAY_P4RT = n +AUTORESTART_P4RT = y # ENABLE_AUTO_TECH_SUPPORT - Enable the configuration for event-driven techsupport & coredump mgmt feature ENABLE_AUTO_TECH_SUPPORT = y @@ -166,16 +201,30 @@ ENABLE_AUTO_TECH_SUPPORT = y ENABLE_NATIVE_WRITE = y # INCLUDE_MACSEC - build docker-macsec for macsec support +# TODO: no SONIC_INSTALL_DOCKER_IMAGES in makefile INCLUDE_MACSEC = y +ENABLE_MACSEC = y +DELAY_MACSEC = y +AUTORESTART_MACSEC = y # INCLUDE_GBSYNCD - build docker-gbsyncd-* for gearbox support +# TODO: only built for VS, no makefile? INCLUDE_GBSYNCD ?= y +ENABLE_GBSYNCD = y +DELAY_GBSYNCD = y +AUTORESTART_GBSYNCD = y # INCLUDE_TEAMD - build docker-teamd for LAG protocol support INCLUDE_TEAMD ?= y +ENABLE_TEAMD = y +DELAY_TEAMD = n +AUTORESTART_TEAMD = y # INCLUDE_ROUTER_ADVERTISER - build docker-router-advertiser for router advertisements support INCLUDE_ROUTER_ADVERTISER ?= y +ENABLE_ROUTER_ADVERTISER = y +DELAY_ROUTER_ADVERTISER = n +AUTORESTART_ROUTER_ADVERTISER = y # INCLUDE_KUBERNETES - if set to y kubernetes packages are installed to be able to # run as worker node in kubernetes cluster. @@ -287,6 +336,9 @@ BUILD_MULTIASIC_KVM = n # INCLUDE_MUX - build docker-mux for dual ToR (Gemini) INCLUDE_MUX = y +ENABLE_SYSTEM_GNMI = y +DELAY_SYSTEM_GNMI = y +AUTORESTART_SYSTEM_GNMI = y # ENABLE_ASAN - enable address sanitizer ENABLE_ASAN ?= n diff --git a/rules/docker-dhcp-server.mk b/rules/docker-dhcp-server.mk index b3960f16a9c6..12e20a7ddef6 100644 --- a/rules/docker-dhcp-server.mk +++ b/rules/docker-dhcp-server.mk @@ -17,8 +17,6 @@ $(DOCKER_DHCP_SERVER)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) $(DOCKER_DHCP_SERVER)_PYTHON_WHEELS += $(SONIC_DHCP_UTILITIES_PY3) $(DOCKER_DHCP_SERVER)_INSTALL_PYTHON_WHEELS = $(SONIC_UTILITIES_PY3) -SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_SERVER) -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_SERVER_DBG) ifeq ($(INCLUDE_KUBERNETES),y) $(DOCKER_DHCP_SERVER)_DEFAULT_FEATURE_OWNER = kube @@ -27,6 +25,8 @@ endif $(DOCKER_DHCP_SERVER)_DEFAULT_FEATURE_STATE_ENABLED = y ifeq ($(INCLUDE_DHCP_SERVER), y) +SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_SERVER) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_SERVER_DBG) ifeq ($(INSTALL_DEBUG_TOOLS),y) SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_SERVER_DBG) else diff --git a/rules/docker-eventd.mk b/rules/docker-eventd.mk index 77c4fad21ea8..5be7cb6105b8 100644 --- a/rules/docker-eventd.mk +++ b/rules/docker-eventd.mk @@ -21,13 +21,13 @@ $(DOCKER_EVENTD)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) $(DOCKER_EVENTD)_VERSION = 1.0.0 $(DOCKER_EVENTD)_PACKAGE_NAME = eventd -SONIC_DOCKER_IMAGES += $(DOCKER_EVENTD) ifeq ($(INCLUDE_SYSTEM_EVENTD), y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_EVENTD) -endif - +# Build System Eventd Dockers +SONIC_DOCKER_IMAGES += $(DOCKER_EVENTD) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) -ifeq ($(INCLUDE_SYSTEM_EVENTD), y) + +# Install System Eventd Dockers +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_EVENTD) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) endif diff --git a/rules/docker-gnmi.mk b/rules/docker-gnmi.mk index fccbafd2a880..3baff69c7076 100644 --- a/rules/docker-gnmi.mk +++ b/rules/docker-gnmi.mk @@ -17,15 +17,17 @@ $(DOCKER_GNMI)_PACKAGE_NAME = gnmi $(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) +ifeq ($(INCLUDE_SYSTEM_GNMI), y) +# Build System GNMI Dockers SONIC_DOCKER_IMAGES += $(DOCKER_GNMI) SONIC_BOOKWORM_DOCKERS += $(DOCKER_GNMI) -ifeq ($(INCLUDE_SYSTEM_GNMI), y) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GNMI) -endif +# Build System GNMI Debug Dockers SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GNMI_DBG) SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_GNMI_DBG) -ifeq ($(INCLUDE_SYSTEM_GNMI), y) + +# Install System GNMI Dockers +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GNMI) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GNMI_DBG) endif diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index df52eccdf70f..c2ee491b14d1 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -17,10 +17,6 @@ $(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BOOKWORM) $(DOCKER_MACSEC)_INSTALL_PYTHON_WHEELS = $(SONIC_UTILITIES_PY3) $(DOCKER_MACSEC)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) $(LIBYANG_PY3) -SONIC_DOCKER_IMAGES += $(DOCKER_MACSEC) -SONIC_BOOKWORM_DOCKERS += $(DOCKER_MACSEC) -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) -SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) ifeq ($(INCLUDE_KUBERNETES),y) $(DOCKER_MACSEC)_DEFAULT_FEATURE_OWNER = kube @@ -29,6 +25,13 @@ endif $(DOCKER_MACSEC)_DEFAULT_FEATURE_STATE_ENABLED = y ifeq ($(INCLUDE_MACSEC),y) + +SONIC_DOCKER_IMAGES += $(DOCKER_MACSEC) +SONIC_BOOKWORM_DOCKERS += $(DOCKER_MACSEC) + + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) ifeq ($(INSTALL_DEBUG_TOOLS),y) SONIC_PACKAGES_LOCAL += $(DOCKER_MACSEC_DBG) else diff --git a/rules/docker-mux.mk b/rules/docker-mux.mk index a0b173233808..b8ffb83e4be1 100644 --- a/rules/docker-mux.mk +++ b/rules/docker-mux.mk @@ -20,11 +20,11 @@ $(DOCKER_MUX)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_MUX)_FAST_SHUTDOWN_BEFORE = swss ifeq ($(INCLUDE_MUX), y) +# Build and install MUX docker image SONIC_DOCKER_IMAGES += $(DOCKER_MUX) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MUX) -endif -ifeq ($(INCLUDE_MUX), y) +# Build and install MUX debug docker image SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MUX_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MUX_DBG) endif diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index d15c43622886..16ca8129c20f 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -19,11 +19,11 @@ $(DOCKER_NAT)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_NAT)_FAST_SHUTDOWN_BEFORE = swss ifeq ($(INCLUDE_NAT), y) +# build and install nat docker image SONIC_DOCKER_IMAGES += $(DOCKER_NAT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_NAT) -endif -ifeq ($(INCLUDE_NAT), y) +# build and install nat debug docker image SONIC_DOCKER_DBG_IMAGES += $(DOCKER_NAT_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_NAT_DBG) endif diff --git a/rules/docker-p4rt.mk b/rules/docker-p4rt.mk index 85cfb67552c7..11a5f3331385 100644 --- a/rules/docker-p4rt.mk +++ b/rules/docker-p4rt.mk @@ -20,14 +20,17 @@ $(DOCKER_P4RT)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_P4RT)_FAST_SHUTDOWN_BEFORE = swss # TODO: Enable P4RT DBG -SONIC_DOCKER_IMAGES += $(DOCKER_P4RT) -SONIC_BOOKWORM_DOCKERS += $(DOCKER_P4RT) -# SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) -# SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_P4RT_DBG) ifeq ($(INCLUDE_P4RT), y) +# Build and install P4RT docker image +SONIC_BOOKWORM_DOCKERS += $(DOCKER_P4RT) +SONIC_DOCKER_IMAGES += $(DOCKER_P4RT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_P4RT) -# SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) + +# Build and install P4RT DBG docker image +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_P4RT_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) endif $(DOCKER_P4RT)_CONTAINER_NAME = p4rt diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index 0fb8e19d5c92..7d154aa3832d 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -18,11 +18,14 @@ $(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) $(DOCKER_RESTAPI)_VERSION = 1.0.0 $(DOCKER_RESTAPI)_PACKAGE_NAME = restapi -SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_RESTAPI_DBG) ifeq ($(INCLUDE_RESTAPI), y) +# build and install restapi docker image +SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_RESTAPI) + +# build and install restapi debug docker image +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_RESTAPI_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_RESTAPI_DBG) endif diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index fc23a43192ef..14a22130d9bc 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -17,13 +17,11 @@ $(DOCKER_ROUTER_ADVERTISER)_PACKAGE_NAME = radv $(DOCKER_ROUTER_ADVERTISER)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_ROUTER_ADVERTISER)_FAST_SHUTDOWN_BEFORE = swss -SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) ifeq ($(INCLUDE_ROUTER_ADVERTISER), y) +SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) -endif SONIC_DOCKER_DBG_IMAGES += $(DOCKER_ROUTER_ADVERTISER_DBG) -ifeq ($(INCLUDE_ROUTER_ADVERTISER), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_ROUTER_ADVERTISER_DBG) endif diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index cf54436a0910..1b8a5086ec8c 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -19,13 +19,13 @@ $(DOCKER_SFLOW)_PACKAGE_NAME = sflow $(DOCKER_SFLOW)_WARM_SHUTDOWN_BEFORE = swss $(DOCKER_SFLOW)_FAST_SHUTDOWN_BEFORE = swss -SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW) ifeq ($(INCLUDE_SFLOW), y) +# build and install sflow docker image +SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SFLOW) -endif +# build and install sflow debug docker image SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SFLOW_DBG) -ifeq ($(INCLUDE_SFLOW), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SFLOW_DBG) endif diff --git a/rules/docker-sonic-mgmt-framework.mk b/rules/docker-sonic-mgmt-framework.mk index b93c5e1006d3..bda56c734d27 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -11,7 +11,6 @@ $(DOCKER_MGMT_FRAMEWORK)_DEPENDS += $(SONIC_MGMT_FRAMEWORK) $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS += $(SONIC_MGMT_FRAMEWORK_DBG) -SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) $(DOCKER_MGMT_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) $(DOCKER_MGMT_FRAMEWORK)_VERSION = 1.0.0 @@ -20,14 +19,18 @@ $(DOCKER_MGMT_FRAMEWORK)_PACKAGE_NAME = mgmt-framework $(DOCKER_MGMT_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) +# build and install mgmt-framework docker image +SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) -endif +# build and install mgmt-framework debug docker image SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MGMT_FRAMEWORK_DBG) -ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MGMT_FRAMEWORK_DBG) endif +ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) +endif + $(DOCKER_MGMT_FRAMEWORK)_CONTAINER_NAME = mgmt-framework $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -t $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 6d29e0f7e4c9..549fc0ceb1bb 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -21,13 +21,13 @@ $(DOCKER_TEAMD)_WARM_SHUTDOWN_AFTER = swss $(DOCKER_TEAMD)_FAST_SHUTDOWN_BEFORE = syncd $(DOCKER_TEAMD)_FAST_SHUTDOWN_AFTER = swss -SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) ifeq ($(INCLUDE_TEAMD), y) +# Build and install teamd docker image +SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) -endif +# Build and install teamd debug docker image SONIC_DOCKER_DBG_IMAGES += $(DOCKER_TEAMD_DBG) -ifeq ($(INCLUDE_TEAMD), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_TEAMD_DBG) endif diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index f710eedd572a..1b1157c7f849 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -15,18 +15,19 @@ $(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_GNMI)_DBG_IMAGE_PACKAGES) -SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) -SONIC_BOOKWORM_DOCKERS += $(DOCKER_TELEMETRY) ifeq ($(INCLUDE_SYSTEM_TELEMETRY), y) +# Build and install System Telemetry Dockers +SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TELEMETRY) -endif +# Install and install System Telemetry Debug Dockers SONIC_DOCKER_DBG_IMAGES += $(DOCKER_TELEMETRY_DBG) -SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_TELEMETRY_DBG) -ifeq ($(INCLUDE_SYSTEM_TELEMETRY), y) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_TELEMETRY_DBG) endif +SONIC_BOOKWORM_DOCKERS += $(DOCKER_TELEMETRY) +SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_TELEMETRY_DBG) + $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_RUN_OPT += -t $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/slave.mk b/slave.mk index 15abbc7259d9..b0a2aa9ff49b 100644 --- a/slave.mk +++ b/slave.mk @@ -1425,28 +1425,105 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export sonic_asic_platform="$(patsubst %-$(CONFIGURED_ARCH),%,$(CONFIGURED_PLATFORM))" export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)" export enable_ztp="$(ENABLE_ZTP)" + + # teamd docker exports for j2 export include_teamd="$(INCLUDE_TEAMD)" + export enable_teamd="$(ENABLE_TEAMD)" + export delay_teamd="$(DELAY_TEAMD)" + export autorestart_teamd="$(AUTORESTART_TEAMD)" + + # router advertiser docker exports for j2 export include_router_advertiser="$(INCLUDE_ROUTER_ADVERTISER)" - export sonic_su_dev_signing_key="$(SECURE_UPGRADE_DEV_SIGNING_KEY)" - export sonic_su_signing_cert="$(SECURE_UPGRADE_SIGNING_CERT)" - export sonic_su_mode="$(SECURE_UPGRADE_MODE)" - export sonic_su_prod_signing_tool="/sonic/scripts/$(shell basename -- $(SECURE_UPGRADE_PROD_SIGNING_TOOL))" + export enable_router_advertiser="$(ENABLE_ROUTER_ADVERTISER)" + export delay_router_advertiser="$(DELAY_ROUTER_ADVERTISER)" + export autorestart_router_advertiser="$(AUTORESTART_ROUTER_ADVERTISER)" + + # system telemetry docker exports for j2 export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)" + export enable_system_telemetry="$(ENABLE_SYSTEM_TELEMETRY)" + export delay_system_telemetry="$(DELAY_SYSTEM_TELEMETRY)" + export autorestart_system_telemetry="$(AUTORESTART_SYSTEM_TELEMETRY)" + + # system gnmi docker exports for j2 export include_system_gnmi="$(INCLUDE_SYSTEM_GNMI)" + export enable_system_gnmi="$(ENABLE_SYSTEM_GNMI)" + export delay_system_gnmi="$(DELAY_SYSTEM_GNMI)" + export autorestart_system_gnmi="$(AUTORESTART_SYSTEM_GNMI)" + + # system eventd docker exports for j2 export include_system_eventd="$(INCLUDE_SYSTEM_EVENTD)" - export build_reduce_image_size="$(BUILD_REDUCE_IMAGE_SIZE)" + export enable_system_eventd="$(ENABLE_SYSTEM_EVENTD)" + export delay_system_eventd="$(DELAY_SYSTEM_EVENTD)" + export autorestart_system_eventd="$(AUTORESTART_SYSTEM_EVENTD)" + + # restapi docker exports for j2 export include_restapi="$(INCLUDE_RESTAPI)" + export enable_restapi="$(ENABLE_RESTAPI)" + export delay_restapi="$(DELAY_RESTAPI)" + export autorestart_restapi="$(AUTORESTART_RESTAPI)" + + # nat docker exports for j2 export include_nat="$(INCLUDE_NAT)" + export enable_nat="$(ENABLE_NAT)" + export delay_nat="$(DELAY_NAT)" + export autorestart_nat="$(AUTORESTART_NAT)" + + # p4rt docker exports for j2 export include_p4rt="$(INCLUDE_P4RT)" + export enable_p4rt="$(ENABLE_P4RT)" + export delay_p4rt="$(DELAY_P4RT)" + export autorestart_p4rt="$(AUTORESTART_P4RT)" + + # sflow docker exports for j2 export include_sflow="$(INCLUDE_SFLOW)" - export enable_auto_tech_support="$(ENABLE_AUTO_TECH_SUPPORT)" - export enable_asan="$(ENABLE_ASAN)" + export enable_sflow="$(ENABLE_SFLOW)" + export delay_sflow="$(DELAY_SFLOW)" + export autorestart_sflow="$(AUTORESTART_SFLOW)" + + # macsec docker exports for j2 export include_macsec="$(INCLUDE_MACSEC)" + export enable_macsec="$(ENABLE_MACSEC)" + export delay_macsec="$(DELAY_MACSEC)" + export autorestart_macsec="$(AUTORESTART_MACSEC)"" + + # dhcp server docker exports for j2 export include_dhcp_server="$(INCLUDE_DHCP_SERVER)" + export enable_dhcp_server="$(ENABLE_DHCP_SERVER)" + export delay_dhcp_server="$(DELAY_DHCP_SERVER)" + export autorestart_dhcp_server="$(AUTORESTART_DHCP_SERVER)" + + # mgmt framework docker exports for j2 export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)" + export enable_mgmt_framework="$(ENABLE_MGMT_FRAMEWORK)" + export delay_mgmt_framework="$(DELAY_MGMT_FRAMEWORK)" + export autorestart_mgmt_framework="$(AUTORESTART_MGMT_FRAMEWORK)" + + # iccpd docker exports for j2 export include_iccpd="$(INCLUDE_ICCPD)" - export pddf_support="$(PDDF_SUPPORT)" + export enable_iccpd="$(ENABLE_ICCPD)" + export delay_iccpd="$(DELAY_ICCPD)" + export autorestart_iccpd="$(AUTORESTART_ICCPD)" + + # pde docker exports for j2 export include_pde="$(INCLUDE_PDE)" + export enable_pde="$(ENABLE_PDE)" + export delay_pde="$(DELAY_PDE)" + export autorestart_pde="$(AUTORESTART_PDE)" + + # mux docker exports for j2 + export include_mux="$(INCLUDE_MUX)" + export enable_mux="$(ENABLE_MUX)" + export delay_mux="$(DELAY_MUX)" + export autorestart_mux="$(AUTORESTART_MUX)" + + export sonic_su_dev_signing_key="$(SECURE_UPGRADE_DEV_SIGNING_KEY)" + export sonic_su_signing_cert="$(SECURE_UPGRADE_SIGNING_CERT)" + export sonic_su_mode="$(SECURE_UPGRADE_MODE)" + export sonic_su_prod_signing_tool="/sonic/scripts/$(shell basename -- $(SECURE_UPGRADE_PROD_SIGNING_TOOL))" + export build_reduce_image_size="$(BUILD_REDUCE_IMAGE_SIZE)" + export enable_auto_tech_support="$(ENABLE_AUTO_TECH_SUPPORT)" + export enable_asan="$(ENABLE_ASAN)" + export pddf_support="$(PDDF_SUPPORT)" export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)" export default_buffer_model="$(SONIC_BUFFER_MODEL)" export include_kubernetes="$(INCLUDE_KUBERNETES)" @@ -1489,7 +1566,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export components="$(foreach component,$(notdir $^),\ $(shell [[ ! -z '$($(component)_VERSION)' && ! -z '$($(component)_NAME)' ]] && \ echo $($(component)_NAME)==$($(component)_VERSION)))" - export include_mux="$(INCLUDE_MUX)" export include_bootchart="$(INCLUDE_BOOTCHART)" export enable_bootchart="$(ENABLE_BOOTCHART)" $(foreach docker, $($*_DOCKERS),\ From 3434f827e36dd32f5e2f81b8a90d517c04181531 Mon Sep 17 00:00:00 2001 From: mazora Date: Tue, 12 Nov 2024 11:24:05 +0200 Subject: [PATCH 2/2] Fix Issues with slave.mk and init_cfg.json.j2 - Fixed extra quote in slave.mk - Fixed issues in init_cfg.json.j2 that would cause json to not be created --- files/build_templates/init_cfg.json.j2 | 16 ++++++++-------- slave.mk | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 6da77bdfc55b..4b22dce39de6 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -43,8 +43,8 @@ ("swss", "enabled", false, "enabled"), ("syncd", "enabled", false, "enabled")] %} {%- if include_router_advertiser == "y" %} - {% do features.append((" - radv", + {% do features.append(( + "radv", "enabled" if enable_router_advertiser == "y" else "disabled", true if delay_router_advertiser == "y" else false, "enabled" if autorestart_router_advertiser == "y" else "disabled" @@ -53,14 +53,14 @@ {%- if include_teamd == "y" %} {% do features.append(( "teamd", - {% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}"disabled"{% else %}"enabled"{% endif %} if enable_teamd == "y" else "disabled", + "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", true if delay_teamd == "y" else false, "enabled" if autorestart_teamd == "y" else "disabled" )) %} {% endif %} {% do features.append(( "dhcp_relay", - {% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}"enabled"{% else %}"disabled"{% endif %}, + "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled" )) %} @@ -72,7 +72,7 @@ "enabled" if autorestart_dhcp_server == "y" else "disabled" )) %} {% endif %} -{%- if sonic_asic_platform == "vs" and include_gbsyncd == "y" %} +{%- if sonic_asic_platform == "vs" %} {% do features.append(( "gbsyncd", "enabled", @@ -99,7 +99,7 @@ {%- if include_mux == "y" %} {% do features.append(( "mux", - {% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}"enabled"{% else %}"always_disabled"{% endif %}, + "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled" )) %} @@ -123,7 +123,7 @@ {%- if include_restapi == "y" and build_reduce_image_size == "y" and sonic_asic_platform == "broadcom" %} {% do features.append(( "restapi", - {% if (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['LeafRouter', 'BackEndLeafRouter']) %}"enabled"{% else %}"disabled"{% endif %}, + "{% if (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['LeafRouter', 'BackEndLeafRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled" )) %} @@ -146,7 +146,7 @@ {%- if include_macsec == "y" %} {% do features.append(( "macsec", - {% if enable_macsec == "y" and 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}"enabled"{% else %}"disabled"{% endif %}, + "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", true if delay_macsec == "y" else false, "enabled" if autorestart_macsec == "y" else "disabled" )) %} diff --git a/slave.mk b/slave.mk index b0a2aa9ff49b..836936f52c28 100644 --- a/slave.mk +++ b/slave.mk @@ -1484,7 +1484,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export include_macsec="$(INCLUDE_MACSEC)" export enable_macsec="$(ENABLE_MACSEC)" export delay_macsec="$(DELAY_MACSEC)" - export autorestart_macsec="$(AUTORESTART_MACSEC)"" + export autorestart_macsec="$(AUTORESTART_MACSEC)" # dhcp server docker exports for j2 export include_dhcp_server="$(INCLUDE_DHCP_SERVER)"