Enable P4RT at build time and disable at startup (#10499)

#### Why I did it
Currently at the Azure build system, the P4RT container is disabled by default at the build time. Here the goal is to include the P4RT container at the build time while disabling it at the runtime. The user can enable/disable the p4rt app through the config based on the preference. 

#### How I did it
Changed the config in rules/config and init-cfg.json.j2
This commit is contained in:
ntoorchi 2022-10-31 16:18:42 -07:00 committed by GitHub
parent 0dd4d5dda9
commit 45d174663a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 13 deletions

View File

@ -49,7 +49,7 @@
{%- 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", "enabled", false, "enabled")) %}{% endif %}
{%- if include_p4rt == "y" %}{% do features.append(("p4rt", "disabled", false, "enabled")) %}{% endif %}
{%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %}
{%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", false, "enabled")) %}{% endif %}
{%- if include_macsec == "y" %}{% do features.append(("macsec", "disabled", false, "enabled")) %}{% endif %}

View File

@ -151,7 +151,7 @@ INCLUDE_NAT = y
INCLUDE_DHCP_RELAY = y
# INCLUDE_P4RT - build docker-p4rt for P4RT support
INCLUDE_P4RT = n
INCLUDE_P4RT = y
# ENABLE_AUTO_TECH_SUPPORT - Enable the configuration for event-driven techsupport & coredump mgmt feature
ENABLE_AUTO_TECH_SUPPORT = y

View File

@ -19,12 +19,13 @@ $(DOCKER_P4RT)_PACKAGE_NAME = p4rt
$(DOCKER_P4RT)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_P4RT)_FAST_SHUTDOWN_BEFORE = swss
# TODO: Enable P4RT DBG
SONIC_DOCKER_IMAGES += $(DOCKER_P4RT)
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG)
# SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG)
ifeq ($(INCLUDE_P4RT), y)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_P4RT)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG)
# SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG)
endif
$(DOCKER_P4RT)_CONTAINER_NAME = p4rt

View File

@ -17,4 +17,5 @@ export SONIC_P4RT SONIC_P4RT_DBG SONIC_P4RT_VERSION
# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
# are archived into debug one image to facilitate debugging.
DBG_SRC_ARCHIVE += sonic-p4rt
# TODO: Enable P4RT DBG
# DBG_SRC_ARCHIVE += sonic-p4rt

View File

@ -178,10 +178,10 @@ endif
# Pre-built Bazel is not available for armhf, so exclude P4RT
# TODO(PINS): Remove when Bazel binaries are available for armhf
ifeq ($(CONFIGURED_ARCH),armhf)
ifeq ($(INCLUDE_P4RT),y)
$(Q)echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)"
endif
override INCLUDE_P4RT = n
ifeq ($(INCLUDE_P4RT),y)
$(Q)echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)"
endif
override INCLUDE_P4RT = n
endif
ifeq ($(SONIC_INCLUDE_MACSEC),y)
@ -206,10 +206,10 @@ endif
ifeq ($(ENABLE_ASAN),y)
ifneq ($(CONFIGURED_ARCH),amd64)
$(Q)echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)"
override ENABLE_ASAN = n
endif
ifneq ($(CONFIGURED_ARCH),amd64)
$(Q)echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)"
override ENABLE_ASAN = n
endif
endif
include $(RULES_PATH)/functions