Share docker image and use telemetry container for 202305 (#17255)

Why I did it
Need to share docker image for telemetry and gnmi, and only use telemetry container for 202305 branch

Work item tracking
Microsoft ADO (number only):
How I did it
Add a new docker image, base-gnmi, build sonic-gnmi and sonic-telemetry on this docker image.
Enable telemetry container.

How to verify it
Run end to end test for telemetry and gnmi.
This commit is contained in:
ganglv 2023-11-24 11:22:48 +08:00 committed by GitHub
parent 2b54221976
commit 2c7d53e5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 382 additions and 11 deletions

View File

@ -536,6 +536,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
DOCKER_LOCKFILE_SAVE=$(DOCKER_LOCKFILE_SAVE) \ DOCKER_LOCKFILE_SAVE=$(DOCKER_LOCKFILE_SAVE) \
SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) \ SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) \
SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \ SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \
SONIC_INCLUDE_SYSTEM_GNMI=$(INCLUDE_SYSTEM_GNMI) \
INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \ INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \
INCLUDE_MACSEC=$(INCLUDE_MACSEC) \ INCLUDE_MACSEC=$(INCLUDE_MACSEC) \
SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \ SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \

View File

@ -0,0 +1,30 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
ARG docker_container_name
ARG image_version
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# Pass the image_version to container
ENV IMAGE_VERSION=$image_version
RUN apt-get update
{% if docker_base_gnmi_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_base_gnmi_debs.split(' '), "/debs/") }}
# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_base_gnmi_debs.split(' ')) }}
{%- endif %}
RUN apt-get clean -y && \
apt-get autoclean - && \
apt-get autoremove -y && \
rm -rf /debs
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
ENTRYPOINT ["/usr/local/bin/supervisord"]

View File

@ -0,0 +1,33 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
ARG docker_container_name
ARG image_version
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# Pass the image_version to container
ENV IMAGE_VERSION=$image_version
RUN apt-get update
{% if docker_sonic_gnmi_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_sonic_gnmi_debs.split(' '), "/debs/") }}
# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_sonic_gnmi_debs.split(' ')) }}
{%- endif %}
RUN apt-get clean -y && \
apt-get autoclean - && \
apt-get autoremove -y && \
rm -rf /debs
COPY ["start.sh", "gnmi-native.sh", "dialout.sh", "/usr/bin/"]
COPY ["telemetry_vars.j2", "/usr/share/sonic/templates/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["critical_processes", "/etc/supervisor"]
ENTRYPOINT ["/usr/local/bin/supervisord"]

View File

@ -0,0 +1,5 @@
###############################################################################
## Monit configuration for telemetry container
###############################################################################
check program container_memory_gnmi with path "/usr/bin/memory_checker gnmi 419430400"
if status == 3 for 10 times within 20 cycles then exec "/usr/bin/restart_service gnmi" repeat every 2 cycles

View File

@ -0,0 +1 @@
program:gnmi-native

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Start with default config
export CVL_SCHEMA_PATH=/usr/sbin/schema
exec /usr/sbin/dialout_client_cli -insecure -logtostderr -v 2

View File

@ -0,0 +1,105 @@
#!/usr/bin/env bash
EXIT_TELEMETRY_VARS_FILE_NOT_FOUND=1
INCORRECT_TELEMETRY_VALUE=2
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2
if [ ! -f "$TELEMETRY_VARS_FILE" ]; then
echo "Telemetry vars template file not found"
exit $EXIT_TELEMETRY_VARS_FILE_NOT_FOUND
fi
# Try to read telemetry and certs config from ConfigDB.
# Use default value if no valid config exists
TELEMETRY_VARS=$(sonic-cfggen -d -t $TELEMETRY_VARS_FILE)
TELEMETRY_VARS=${TELEMETRY_VARS//[\']/\"}
X509=$(echo $TELEMETRY_VARS | jq -r '.x509')
GNMI=$(echo $TELEMETRY_VARS | jq -r '.gnmi')
CERTS=$(echo $TELEMETRY_VARS | jq -r '.certs')
TELEMETRY_ARGS=" -logtostderr"
export CVL_SCHEMA_PATH=/usr/sbin/schema
if [ -n "$CERTS" ]; then
SERVER_CRT=$(echo $CERTS | jq -r '.server_crt')
SERVER_KEY=$(echo $CERTS | jq -r '.server_key')
if [ -z $SERVER_CRT ] || [ -z $SERVER_KEY ]; then
TELEMETRY_ARGS+=" --insecure"
else
TELEMETRY_ARGS+=" --server_crt $SERVER_CRT --server_key $SERVER_KEY "
fi
CA_CRT=$(echo $CERTS | jq -r '.ca_crt')
if [ ! -z $CA_CRT ]; then
TELEMETRY_ARGS+=" --ca_crt $CA_CRT"
fi
elif [ -n "$X509" ]; then
SERVER_CRT=$(echo $X509 | jq -r '.server_crt')
SERVER_KEY=$(echo $X509 | jq -r '.server_key')
if [ -z $SERVER_CRT ] || [ -z $SERVER_KEY ]; then
TELEMETRY_ARGS+=" --insecure"
else
TELEMETRY_ARGS+=" --server_crt $SERVER_CRT --server_key $SERVER_KEY "
fi
CA_CRT=$(echo $X509 | jq -r '.ca_crt')
if [ ! -z $CA_CRT ]; then
TELEMETRY_ARGS+=" --ca_crt $CA_CRT"
fi
else
TELEMETRY_ARGS+=" --noTLS"
fi
# If no configuration entry exists for TELEMETRY, create one default port
if [ -z "$GNMI" ]; then
PORT=8080
else
PORT=$(echo $GNMI | jq -r '.port')
fi
TELEMETRY_ARGS+=" --port $PORT"
CLIENT_AUTH=$(echo $GNMI | jq -r '.client_auth')
if [ -z $CLIENT_AUTH ] || [ $CLIENT_AUTH == "false" ]; then
TELEMETRY_ARGS+=" --allow_no_client_auth"
fi
LOG_LEVEL=$(echo $GNMI | jq -r '.log_level')
if [[ $LOG_LEVEL =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" -v=$LOG_LEVEL"
else
TELEMETRY_ARGS+=" -v=2"
fi
# Enable ZMQ for SmartSwitch
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget localhost "subtype"`
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
TELEMETRY_ARGS+=" -zmq_address=tcp://127.0.0.1:8100"
fi
# Server will handle threshold connections consecutively
THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
else
if [ -z "$GNMI" ] || [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
TELEMETRY_ARGS+=" --threshold 100"
else
echo "Incorrect threshold value, expecting positive integers" >&2
exit $INCORRECT_TELEMETRY_VALUE
fi
fi
# Close idle connections after certain duration (in seconds)
IDLE_CONN_DURATION=$(echo $GNMI | jq -r '.idle_conn_duration')
if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION"
else
if [ -z "$GNMI" ] || [[ $IDLE_CONN_DURATION == "null" ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration 5"
else
echo "Incorrect idle_conn_duration value, expecting positive integers" >&2
exit $INCORRECT_TELEMETRY_VALUE
fi
fi
exec /usr/sbin/telemetry ${TELEMETRY_ARGS}

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
if [ "${RUNTIME_OWNER}" == "" ]; then
RUNTIME_OWNER="kube"
fi
CTR_SCRIPT="/usr/share/sonic/scripts/container_startup.py"
if test -f ${CTR_SCRIPT}
then
${CTR_SCRIPT} -f gnmi -o ${RUNTIME_OWNER} -v ${IMAGE_VERSION}
fi
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
TZ=$(cat /etc/timezone)
rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime

View File

@ -0,0 +1,60 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true
[eventlistener:dependent-startup]
command=python3 -m supervisord_dependent_startup
autostart=true
autorestart=unexpected
startretries=0
exitcodes=0,3
events=PROCESS_STATE
buffer_size=1024
[eventlistener:supervisor-proc-exit-listener]
command=/usr/bin/supervisor-proc-exit-listener --container-name gnmi
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING
autostart=true
autorestart=false
buffer_size=1024
[program:rsyslogd]
command=/usr/sbin/rsyslogd -n -iNONE
priority=1
autostart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
[program:start]
command=/usr/bin/start.sh
priority=2
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
[program:gnmi-native]
command=/usr/bin/gnmi-native.sh
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=start:exited
[program:dialout]
command=/usr/bin/dialout.sh
priority=4
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=gnmi-native:running

View File

@ -0,0 +1,5 @@
{
"certs": {% if "certs" in GNMI.keys() %}{{ GNMI["certs"] }}{% else %}""{% endif %},
"gnmi" : {% if "gnmi" in GNMI.keys() %}{{ GNMI["gnmi"] }}{% else %}""{% endif %},
"x509" : {% if "x509" in DEVICE_METADATA.keys() %}{{ DEVICE_METADATA["x509"] }}{% else %}""{% endif %}
}

View File

@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
ARG docker_container_name ARG docker_container_name
ARG image_version ARG image_version
@ -28,7 +28,6 @@ RUN apt-get clean -y && \
COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"] COPY ["start.sh", "telemetry.sh", "dialout.sh", "/usr/bin/"]
COPY ["telemetry_vars.j2", "/usr/share/sonic/templates/"] COPY ["telemetry_vars.j2", "/usr/share/sonic/templates/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"] COPY ["critical_processes", "/etc/supervisor"]
ENTRYPOINT ["/usr/local/bin/supervisord"] ENTRYPOINT ["/usr/local/bin/supervisord"]

View File

@ -75,7 +75,7 @@ THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS" TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
else else
if [ -z $GNMI ] || [[ $THRESHOLD_CONNECTIONS == "null" ]]; then if [ -z "$GNMI" ] || [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
TELEMETRY_ARGS+=" --threshold 100" TELEMETRY_ARGS+=" --threshold 100"
else else
echo "Incorrect threshold value, expecting positive integers" >&2 echo "Incorrect threshold value, expecting positive integers" >&2
@ -88,13 +88,13 @@ IDLE_CONN_DURATION=$(echo $GNMI | jq -r '.idle_conn_duration')
if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION" TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION"
else else
if [ -z $GNMI ] || [[ $IDLE_CONN_DURATION == "null" ]]; then if [ -z "$GNMI" ] || [[ $IDLE_CONN_DURATION == "null" ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration 5" TELEMETRY_ARGS+=" --idle_conn_duration 5"
else else
echo "Incorrect idle_conn_duration value, expecting positive integers" >&2 echo "Incorrect idle_conn_duration value, expecting positive integers" >&2
exit $INCORRECT_TELEMETRY_VALUE exit $INCORRECT_TELEMETRY_VALUE
fi fi
fi fi
TELEMETRY_ARGS+=" -gnmi_native_write=false"
exec /usr/sbin/telemetry ${TELEMETRY_ARGS} exec /usr/sbin/telemetry ${TELEMETRY_ARGS}

View File

@ -0,0 +1,16 @@
[Unit]
Description=GNMI container
Requires=database.service
After=database.service swss.service syncd.service
Before=ntp-config.service
BindsTo=sonic.target
After=sonic.target
StartLimitIntervalSec=1200
StartLimitBurst=3
[Service]
User={{ sonicadmin_user }}
ExecStartPre=/usr/local/bin/{{docker_container_name}}.sh start
ExecStart=/usr/local/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/local/bin/{{docker_container_name}}.sh stop
RestartSec=30

View File

@ -53,6 +53,7 @@
{%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %} {%- if 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_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_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_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
"FEATURE": { "FEATURE": {
{# delayed field if set, will start the feature systemd .timer unit instead of .service unit #} {# delayed field if set, will start the feature systemd .timer unit instead of .service unit #}
@ -75,7 +76,7 @@
"check_up_status" : "false", "check_up_status" : "false",
{%- endif %} {%- endif %}
{%- if include_kubernetes == "y" %} {%- if include_kubernetes == "y" %}
{%- if feature in ["lldp", "pmon", "radv", "eventd", "snmp", "telemetry"] %} {%- if feature in ["lldp", "pmon", "radv", "eventd", "snmp", "telemetry", "gnmi"] %}
"set_owner": "kube", {% else %} "set_owner": "kube", {% else %}
"set_owner": "local", {% endif %} {% endif %} "set_owner": "local", {% endif %} {% endif %}
"high_mem_alert": "disabled" "high_mem_alert": "disabled"

View File

@ -874,6 +874,7 @@ sudo LANG=C cp $SCRIPTS_DIR/radv.sh $FILESYSTEM_ROOT/usr/local/bin/radv.sh
sudo LANG=C cp $SCRIPTS_DIR/database.sh $FILESYSTEM_ROOT/usr/local/bin/database.sh sudo LANG=C cp $SCRIPTS_DIR/database.sh $FILESYSTEM_ROOT/usr/local/bin/database.sh
sudo LANG=C cp $SCRIPTS_DIR/snmp.sh $FILESYSTEM_ROOT/usr/local/bin/snmp.sh sudo LANG=C cp $SCRIPTS_DIR/snmp.sh $FILESYSTEM_ROOT/usr/local/bin/snmp.sh
sudo LANG=C cp $SCRIPTS_DIR/telemetry.sh $FILESYSTEM_ROOT/usr/local/bin/telemetry.sh sudo LANG=C cp $SCRIPTS_DIR/telemetry.sh $FILESYSTEM_ROOT/usr/local/bin/telemetry.sh
sudo LANG=C cp $SCRIPTS_DIR/gnmi.sh $FILESYSTEM_ROOT/usr/local/bin/gnmi.sh
sudo LANG=C cp $SCRIPTS_DIR/mgmt-framework.sh $FILESYSTEM_ROOT/usr/local/bin/mgmt-framework.sh sudo LANG=C cp $SCRIPTS_DIR/mgmt-framework.sh $FILESYSTEM_ROOT/usr/local/bin/mgmt-framework.sh
sudo LANG=C cp $SCRIPTS_DIR/asic_status.sh $FILESYSTEM_ROOT/usr/local/bin/asic_status.sh sudo LANG=C cp $SCRIPTS_DIR/asic_status.sh $FILESYSTEM_ROOT/usr/local/bin/asic_status.sh
sudo LANG=C cp $SCRIPTS_DIR/asic_status.py $FILESYSTEM_ROOT/usr/local/bin/asic_status.py sudo LANG=C cp $SCRIPTS_DIR/asic_status.py $FILESYSTEM_ROOT/usr/local/bin/asic_status.py

View File

@ -28,6 +28,7 @@
/var/log/syslog /var/log/syslog
/var/log/teamd.log /var/log/teamd.log
/var/log/telemetry.log /var/log/telemetry.log
/var/log/gnmi.log
/var/log/frr/bgpd.log /var/log/frr/bgpd.log
/var/log/frr/zebra.log /var/log/frr/zebra.log
/var/log/swss/sairedis*.rec /var/log/swss/sairedis*.rec

View File

@ -17,6 +17,12 @@ if $programname contains "teamd_" then {
stop stop
} }
## gnmi rules
if $msg startswith " gnmi-native" then {
/var/log/gnmi.log
stop
}
## telemetry rules ## telemetry rules
if $msg startswith " telemetry" or ($msg startswith " dialout" )then { if $msg startswith " telemetry" or ($msg startswith " dialout" )then {
/var/log/telemetry.log /var/log/telemetry.log

1
files/scripts/gnmi.sh Symbolic link
View File

@ -0,0 +1 @@
service_mgmt.sh

View File

@ -0,0 +1,11 @@
DPATH := $($(DOCKER_BASE_GNMI)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-base-gnmi.mk rules/docker-base-gnmi.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))
$(DOCKER_BASE_GNMI)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_BASE_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_BASE_GNMI)_DEP_FILES := $(DEP_FILES)
$(eval $(call add_dbg_docker,$(DOCKER_BASE_GNMI),$(DOCKER_BASE_GNMI_DBG)))

20
rules/docker-base-gnmi.mk Normal file
View File

@ -0,0 +1,20 @@
# docker image for GNMI base
DOCKER_BASE_GNMI_STEM = docker-base-gnmi
DOCKER_BASE_GNMI = $(DOCKER_BASE_GNMI_STEM).gz
DOCKER_BASE_GNMI_DBG = $(DOCKER_BASE_GNMI_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_BASE_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_BASE_GNMI_STEM)
$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_MGMT_COMMON)
$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_TELEMETRY)
$(DOCKER_BASE_GNMI)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_BASE_GNMI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_BASE_GNMI)_VERSION = 1.0.0
$(DOCKER_BASE_GNMI)_PACKAGE_NAME = base-gnmi
$(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
SONIC_DOCKER_IMAGES += $(DOCKER_BASE_GNMI)

11
rules/docker-gnmi.dep Normal file
View File

@ -0,0 +1,11 @@
DPATH := $($(DOCKER_GNMI)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-gnmi.mk rules/docker-gnmi.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))
$(DOCKER_GNMI)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_GNMI)_DEP_FILES := $(DEP_FILES)
$(eval $(call add_dbg_docker,$(DOCKER_GNMI),$(DOCKER_GNMI_DBG)))

35
rules/docker-gnmi.mk Normal file
View File

@ -0,0 +1,35 @@
# docker image for GNMI agent
DOCKER_GNMI_STEM = docker-sonic-gnmi
DOCKER_GNMI = $(DOCKER_GNMI_STEM).gz
DOCKER_GNMI_DBG = $(DOCKER_GNMI_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_GNMI_STEM)
$(DOCKER_GNMI)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS)
$(DOCKER_GNMI)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI)
$(DOCKER_GNMI)_VERSION = 1.0.0
$(DOCKER_GNMI)_PACKAGE_NAME = gnmi
$(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES)
SONIC_DOCKER_IMAGES += $(DOCKER_GNMI)
ifeq ($(INCLUDE_SYSTEM_GNMI), y)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_GNMI)
endif
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_GNMI_DBG)
ifeq ($(INCLUDE_SYSTEM_GNMI), y)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_GNMI_DBG)
endif
$(DOCKER_GNMI)_CONTAINER_NAME = gnmi
$(DOCKER_GNMI)_RUN_OPT += -t
$(DOCKER_GNMI)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_GNMI)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
$(DOCKER_GNMI)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw
$(DOCKER_GNMI)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
$(DOCKER_GNMI)_BASE_IMAGE_FILES += monit_gnmi:/etc/monit/conf.d

View File

@ -6,16 +6,14 @@ DOCKER_TELEMETRY_DBG = $(DOCKER_TELEMETRY_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/$(DOCKER_TELEMETRY_STEM) $(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/$(DOCKER_TELEMETRY_STEM)
$(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_MGMT_COMMON) $(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS)
$(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_TELEMETRY)
$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI)
$(DOCKER_TELEMETRY)_VERSION = 1.0.0 $(DOCKER_TELEMETRY)_VERSION = 1.0.0
$(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry $(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry
$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES)
SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY)
ifeq ($(INCLUDE_SYSTEM_TELEMETRY), y) ifeq ($(INCLUDE_SYSTEM_TELEMETRY), y)
@ -30,6 +28,7 @@ endif
$(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry
$(DOCKER_TELEMETRY)_RUN_OPT += --privileged -t $(DOCKER_TELEMETRY)_RUN_OPT += --privileged -t
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
ifneq ($(INCLUDE_SYSTEM_GNMI), y) ifneq ($(INCLUDE_SYSTEM_GNMI), y)
$(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw $(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw
endif endif

View File

@ -157,6 +157,10 @@ ifeq ($(SONIC_INCLUDE_SYSTEM_TELEMETRY),y)
INCLUDE_SYSTEM_TELEMETRY = y INCLUDE_SYSTEM_TELEMETRY = y
endif endif
ifeq ($(SONIC_INCLUDE_SYSTEM_GNMI),y)
INCLUDE_SYSTEM_GNMI = y
endif
ifeq ($(SONIC_INCLUDE_RESTAPI),y) ifeq ($(SONIC_INCLUDE_RESTAPI),y)
INCLUDE_RESTAPI = y INCLUDE_RESTAPI = y
endif endif
@ -413,6 +417,7 @@ $(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)")
$(info "INCLUDE_MGMT_FRAMEWORK" : "$(INCLUDE_MGMT_FRAMEWORK)") $(info "INCLUDE_MGMT_FRAMEWORK" : "$(INCLUDE_MGMT_FRAMEWORK)")
$(info "INCLUDE_ICCPD" : "$(INCLUDE_ICCPD)") $(info "INCLUDE_ICCPD" : "$(INCLUDE_ICCPD)")
$(info "INCLUDE_SYSTEM_TELEMETRY" : "$(INCLUDE_SYSTEM_TELEMETRY)") $(info "INCLUDE_SYSTEM_TELEMETRY" : "$(INCLUDE_SYSTEM_TELEMETRY)")
$(info "INCLUDE_SYSTEM_GNMI" : "$(INCLUDE_SYSTEM_GNMI)")
$(info "ENABLE_HOST_SERVICE_ON_START" : "$(ENABLE_HOST_SERVICE_ON_START)") $(info "ENABLE_HOST_SERVICE_ON_START" : "$(ENABLE_HOST_SERVICE_ON_START)")
$(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)") $(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)")
$(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)") $(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)")
@ -1287,6 +1292,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export sonic_su_mode="$(SECURE_UPGRADE_MODE)" export sonic_su_mode="$(SECURE_UPGRADE_MODE)"
export sonic_su_prod_signing_tool="/sonic/scripts/$(shell basename -- $(SECURE_UPGRADE_PROD_SIGNING_TOOL))" export sonic_su_prod_signing_tool="/sonic/scripts/$(shell basename -- $(SECURE_UPGRADE_PROD_SIGNING_TOOL))"
export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)" export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)"
export include_system_gnmi="$(INCLUDE_SYSTEM_GNMI)"
export include_restapi="$(INCLUDE_RESTAPI)" export include_restapi="$(INCLUDE_RESTAPI)"
export include_nat="$(INCLUDE_NAT)" export include_nat="$(INCLUDE_NAT)"
export include_p4rt="$(INCLUDE_P4RT)" export include_p4rt="$(INCLUDE_P4RT)"