[synchronous-mode] Add template file for synchronous mode (#5644)
The orchagent and syncd need to have the same default synchronous mode configuration. This PR adds a template file to translate the default value in CONFIG_DB (empty field) to an explicit mode so that the orchagent and syncd could have the same default mode.
This commit is contained in:
parent
15c59e1d8c
commit
67408c85aa
@ -39,6 +39,9 @@ RUN pip install \
|
|||||||
{{ install_python_wheels(docker_config_engine_buster_whls.split(' ')) }}
|
{{ install_python_wheels(docker_config_engine_buster_whls.split(' ')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# Copy files
|
||||||
|
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y \
|
RUN apt-get purge -y \
|
||||||
python-pip \
|
python-pip \
|
||||||
|
@ -38,6 +38,9 @@ RUN pip install \
|
|||||||
{{ install_python_wheels(docker_config_engine_stretch_whls.split(' ')) }}
|
{{ install_python_wheels(docker_config_engine_stretch_whls.split(' ')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
# Copy files
|
||||||
|
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y \
|
RUN apt-get purge -y \
|
||||||
python-pip \
|
python-pip \
|
||||||
|
@ -42,6 +42,9 @@ python-wheels/{{ whl }}{{' '}}
|
|||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
# Copy files
|
||||||
|
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /debs /python-wheels
|
RUN rm -rf /debs /python-wheels
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
EXIT_SWSS_VARS_FILE_NOT_FOUND=1
|
|
||||||
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
|
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
|
||||||
|
|
||||||
if [ ! -f "$SWSS_VARS_FILE" ]; then
|
|
||||||
echo "SWSS vars template file not found"
|
|
||||||
exit $EXIT_SWSS_VARS_FILE_NOT_FOUND
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Retrieve SWSS vars from sonic-cfggen
|
# Retrieve SWSS vars from sonic-cfggen
|
||||||
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE)
|
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
|
||||||
export platform=$(echo $SWSS_VARS | jq -r '.asic_type')
|
export platform=$(echo $SWSS_VARS | jq -r '.asic_type')
|
||||||
|
|
||||||
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
|
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
|
||||||
|
@ -2,6 +2,5 @@
|
|||||||
"asic_type": "{{ asic_type }}",
|
"asic_type": "{{ asic_type }}",
|
||||||
"asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}",
|
"asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}",
|
||||||
"mac": "{{ DEVICE_METADATA.localhost.mac }}",
|
"mac": "{{ DEVICE_METADATA.localhost.mac }}",
|
||||||
"synchronous_mode": "{{ DEVICE_METADATA.localhost.synchronous_mode }}"
|
"synchronous_mode": {% if DEVICE_METADATA.localhost.synchronous_mode == "enable" %}"enable"{% else %}"disable"{% endif %}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
MAC_ADDRESS=$(sonic-cfggen -d -v 'DEVICE_METADATA.localhost.mac')
|
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
|
||||||
|
|
||||||
|
# Retrieve SWSS vars from sonic-cfggen
|
||||||
|
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
|
||||||
|
|
||||||
|
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
|
||||||
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
|
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
|
||||||
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
|
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
|
||||||
logger "Mac address not found in Device Metadata, Falling back to eth0"
|
logger "Mac address not found in Device Metadata, Falling back to eth0"
|
||||||
@ -14,7 +19,7 @@ ORCHAGENT_ARGS="-d /var/log/swss "
|
|||||||
ORCHAGENT_ARGS+="-b 8192 "
|
ORCHAGENT_ARGS+="-b 8192 "
|
||||||
|
|
||||||
# Set synchronous mode if it is enabled in CONFIG_DB
|
# Set synchronous mode if it is enabled in CONFIG_DB
|
||||||
SYNC_MODE=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.synchronous_mode)
|
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode')
|
||||||
if [ "$SYNC_MODE" == "enable" ]; then
|
if [ "$SYNC_MODE" == "enable" ]; then
|
||||||
ORCHAGENT_ARGS+="-s "
|
ORCHAGENT_ARGS+="-s "
|
||||||
fi
|
fi
|
||||||
|
@ -6,8 +6,12 @@ else
|
|||||||
export platform=$fake_platform
|
export platform=$fake_platform
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CFG_VARS=$(sonic-cfggen -d --var-json 'DEVICE_METADATA')
|
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
|
||||||
MAC_ADDRESS=$(echo $CFG_VARS | jq -r '.localhost.mac')
|
|
||||||
|
# Retrieve SWSS vars from sonic-cfggen
|
||||||
|
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
|
||||||
|
|
||||||
|
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
|
||||||
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
|
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
|
||||||
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
|
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
|
||||||
logger "Mac address not found in Device Metadata, Falling back to eth0"
|
logger "Mac address not found in Device Metadata, Falling back to eth0"
|
||||||
@ -21,7 +25,7 @@ ORCHAGENT_ARGS="-d /var/log/swss "
|
|||||||
ORCHAGENT_ARGS+="-b 8192 "
|
ORCHAGENT_ARGS+="-b 8192 "
|
||||||
|
|
||||||
# Set synchronous mode if it is enabled in CONFIG_DB
|
# Set synchronous mode if it is enabled in CONFIG_DB
|
||||||
SYNC_MODE=$(echo $CFG_VARS | jq -r '.localhost.synchronous_mode')
|
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode')
|
||||||
if [ "$SYNC_MODE" == "enable" ]; then
|
if [ "$SYNC_MODE" == "enable" ]; then
|
||||||
ORCHAGENT_ARGS+="-s "
|
ORCHAGENT_ARGS+="-s "
|
||||||
fi
|
fi
|
||||||
|
@ -7,6 +7,7 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SWSSSDK_PY2)
|
|||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
|
||||||
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE)
|
||||||
|
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER)_DBG_DEPENDS)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER)_DBG_DEPENDS)
|
||||||
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BUSTER)_DBG_IMAGE_PACKAGES)
|
$(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BUSTER)_DBG_IMAGE_PACKAGES)
|
||||||
|
@ -6,6 +6,7 @@ $(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2)
|
|||||||
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE_STRETCH)_LOAD_DOCKERS += $(DOCKER_BASE_STRETCH)
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_LOAD_DOCKERS += $(DOCKER_BASE_STRETCH)
|
||||||
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_FILES += $(SWSS_VARS_TEMPLATE)
|
||||||
|
|
||||||
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS = $($(DOCKER_BASE_STRETCH)_DBG_DEPENDS)
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS = $($(DOCKER_BASE_STRETCH)_DBG_DEPENDS)
|
||||||
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_STRETCH)_DBG_IMAGE_PACKAGES)
|
$(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_STRETCH)_DBG_IMAGE_PACKAGES)
|
||||||
|
@ -6,4 +6,5 @@ $(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SWSSSDK_PY2)
|
|||||||
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
$(DOCKER_CONFIG_ENGINE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
|
||||||
$(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE)
|
$(DOCKER_CONFIG_ENGINE)_LOAD_DOCKERS += $(DOCKER_BASE)
|
||||||
|
$(DOCKER_CONFIG_ENGINE)_FILES += $(SWSS_VARS_TEMPLATE)
|
||||||
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE)
|
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE)
|
||||||
|
@ -23,6 +23,9 @@ $(SYSCTL_NET_CONFIG)_PATH = files/image_config/sysctl
|
|||||||
UPDATE_CHASSISDB_CONFIG_SCRIPT = update_chassisdb_config
|
UPDATE_CHASSISDB_CONFIG_SCRIPT = update_chassisdb_config
|
||||||
$(UPDATE_CHASSISDB_CONFIG_SCRIPT)_PATH = files/scripts
|
$(UPDATE_CHASSISDB_CONFIG_SCRIPT)_PATH = files/scripts
|
||||||
|
|
||||||
|
SWSS_VARS_TEMPLATE = swss_vars.j2
|
||||||
|
$(SWSS_VARS_TEMPLATE)_PATH = files/build_templates
|
||||||
|
|
||||||
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
|
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
|
||||||
$(ARP_UPDATE_SCRIPT) \
|
$(ARP_UPDATE_SCRIPT) \
|
||||||
$(ARP_UPDATE_VARS_TEMPLATE) \
|
$(ARP_UPDATE_VARS_TEMPLATE) \
|
||||||
@ -30,4 +33,5 @@ SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
|
|||||||
$(QOS_CONFIG_TEMPLATE) \
|
$(QOS_CONFIG_TEMPLATE) \
|
||||||
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) \
|
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) \
|
||||||
$(SYSCTL_NET_CONFIG) \
|
$(SYSCTL_NET_CONFIG) \
|
||||||
$(UPDATE_CHASSISDB_CONFIG_SCRIPT)
|
$(UPDATE_CHASSISDB_CONFIG_SCRIPT) \
|
||||||
|
$(SWSS_VARS_TEMPLATE)
|
||||||
|
Loading…
Reference in New Issue
Block a user