From 5d5d5739c2d80feb08cae2d3baaaeb0b745bc836 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 11 Jun 2020 16:04:23 -0700 Subject: [PATCH] [dockers] Rename 'docker-snmp-sv2' to 'docker-snmp' (#4699) The `-sv2` suffix was used to differentiate SNMP Dockers when we transitioned from "SONiCv1" to "SONiCv2", about four years ago. The old Docker materials were removed long ago; there is no need to keep this suffix. Removing it aligns the name with all the other Dockers. Also edit Monit configuration to detect proper snmp-subagent command line in Buster, and make snmpd command line matching more robust. --- .../Dockerfile.j2 | 12 +++---- .../base_image_files/monit_snmp | 4 +-- .../critical_processes | 0 .../snmpd.conf.j2 | 0 .../{docker-snmp-sv2 => docker-snmp}/start.sh | 0 .../supervisord.conf | 0 .../sysDescription.j2 | 0 platform/generic/rules.mk | 2 +- rules/docker-snmp-sv2.dep | 11 ------- rules/docker-snmp-sv2.mk | 32 ------------------- rules/docker-snmp.dep | 11 +++++++ rules/docker-snmp.mk | 32 +++++++++++++++++++ 12 files changed, 52 insertions(+), 52 deletions(-) rename dockers/{docker-snmp-sv2 => docker-snmp}/Dockerfile.j2 (86%) rename dockers/{docker-snmp-sv2 => docker-snmp}/base_image_files/monit_snmp (76%) rename dockers/{docker-snmp-sv2 => docker-snmp}/critical_processes (100%) rename dockers/{docker-snmp-sv2 => docker-snmp}/snmpd.conf.j2 (100%) rename dockers/{docker-snmp-sv2 => docker-snmp}/start.sh (100%) rename dockers/{docker-snmp-sv2 => docker-snmp}/supervisord.conf (100%) rename dockers/{docker-snmp-sv2 => docker-snmp}/sysDescription.j2 (100%) delete mode 100644 rules/docker-snmp-sv2.dep delete mode 100644 rules/docker-snmp-sv2.mk create mode 100644 rules/docker-snmp.dep create mode 100644 rules/docker-snmp.mk diff --git a/dockers/docker-snmp-sv2/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 similarity index 86% rename from dockers/docker-snmp-sv2/Dockerfile.j2 rename to dockers/docker-snmp/Dockerfile.j2 index a7e46a5866..213d941c58 100644 --- a/dockers/docker-snmp-sv2/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -19,12 +19,12 @@ RUN apt-get update && \ make \ ipmitool -{% if docker_snmp_sv2_debs.strip() -%} +{% if docker_snmp_debs.strip() -%} # Copy locally-built Debian package dependencies -{{ copy_files("debs/", docker_snmp_sv2_debs.split(' '), "/debs/") }} +{{ copy_files("debs/", docker_snmp_debs.split(' '), "/debs/") }} # Install locally-built Debian packages and implicitly install their dependencies -{{ install_debian_packages(docker_snmp_sv2_debs.split(' ')) }} +{{ install_debian_packages(docker_snmp_debs.split(' ')) }} {%- endif %} # Fix for hiredis compilation issues for ARM @@ -46,12 +46,12 @@ RUN python3 -m pip install --no-cache-dir \ pyyaml \ smbus -{% if docker_snmp_sv2_whls.strip() -%} +{% if docker_snmp_whls.strip() -%} # Copy locally-built Python wheel dependencies -{{ copy_files("python-wheels/", docker_snmp_sv2_whls.split(' '), "/python-wheels/") }} +{{ copy_files("python-wheels/", docker_snmp_whls.split(' '), "/python-wheels/") }} # Install locally-built Python wheel dependencies -{{ install_python3_wheels(docker_snmp_sv2_whls.split(' ')) }} +{{ install_python3_wheels(docker_snmp_whls.split(' ')) }} {% endif %} RUN python3 -m sonic_ax_impl install diff --git a/dockers/docker-snmp-sv2/base_image_files/monit_snmp b/dockers/docker-snmp/base_image_files/monit_snmp similarity index 76% rename from dockers/docker-snmp-sv2/base_image_files/monit_snmp rename to dockers/docker-snmp/base_image_files/monit_snmp index 811f9d14b3..cfb1a2b668 100644 --- a/dockers/docker-snmp-sv2/base_image_files/monit_snmp +++ b/dockers/docker-snmp/base_image_files/monit_snmp @@ -4,8 +4,8 @@ ## snmpd ## snmpd_subagent ############################################################################### -check process snmpd matching "/usr/sbin/snmpd -f" +check process snmpd matching "/usr/sbin/snmpd\s" if does not exist for 5 times within 5 cycles then alert -check process snmp_subagent matching "python3.6 -m sonic_ax_impl" +check process snmp_subagent matching "python3 -m sonic_ax_impl" if does not exist for 5 times within 5 cycles then alert diff --git a/dockers/docker-snmp-sv2/critical_processes b/dockers/docker-snmp/critical_processes similarity index 100% rename from dockers/docker-snmp-sv2/critical_processes rename to dockers/docker-snmp/critical_processes diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp/snmpd.conf.j2 similarity index 100% rename from dockers/docker-snmp-sv2/snmpd.conf.j2 rename to dockers/docker-snmp/snmpd.conf.j2 diff --git a/dockers/docker-snmp-sv2/start.sh b/dockers/docker-snmp/start.sh similarity index 100% rename from dockers/docker-snmp-sv2/start.sh rename to dockers/docker-snmp/start.sh diff --git a/dockers/docker-snmp-sv2/supervisord.conf b/dockers/docker-snmp/supervisord.conf similarity index 100% rename from dockers/docker-snmp-sv2/supervisord.conf rename to dockers/docker-snmp/supervisord.conf diff --git a/dockers/docker-snmp-sv2/sysDescription.j2 b/dockers/docker-snmp/sysDescription.j2 similarity index 100% rename from dockers/docker-snmp-sv2/sysDescription.j2 rename to dockers/docker-snmp/sysDescription.j2 diff --git a/platform/generic/rules.mk b/platform/generic/rules.mk index 5ba9119409..c836c1faec 100644 --- a/platform/generic/rules.mk +++ b/platform/generic/rules.mk @@ -2,8 +2,8 @@ include $(PLATFORM_PATH)/aboot-image.mk include $(PLATFORM_PATH)/onie-image.mk SONIC_ALL += $(DOCKER_DATABASE) \ + $(DOCKER_SNMP) \ $(DOCKER_LLDP) \ - $(DOCKER_SNMP_SV2) \ $(DOCKER_PLATFORM_MONITOR) \ $(DOCKER_DHCP_RELAY) \ $(DOCKER_PTF) \ diff --git a/rules/docker-snmp-sv2.dep b/rules/docker-snmp-sv2.dep deleted file mode 100644 index 38d46e1fbb..0000000000 --- a/rules/docker-snmp-sv2.dep +++ /dev/null @@ -1,11 +0,0 @@ - -DPATH := $($(DOCKER_SNMP_SV2)_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-snmp-sv2.mk rules/docker-snmp-sv2.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(DPATH)) - -$(DOCKER_SNMP_SV2)_CACHE_MODE := GIT_CONTENT_SHA -$(DOCKER_SNMP_SV2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(DOCKER_SNMP_SV2)_DEP_FILES := $(DEP_FILES) - -$(eval $(call add_dbg_docker,$(DOCKER_SNMP_SV2),$(DOCKER_SNMP_SV2_DBG))) diff --git a/rules/docker-snmp-sv2.mk b/rules/docker-snmp-sv2.mk deleted file mode 100644 index 7eebf0c56f..0000000000 --- a/rules/docker-snmp-sv2.mk +++ /dev/null @@ -1,32 +0,0 @@ -# docker image for snmp agent - -DOCKER_SNMP_SV2_STEM = docker-snmp-sv2 -DOCKER_SNMP_SV2 = $(DOCKER_SNMP_SV2_STEM).gz -DOCKER_SNMP_SV2_DBG = $(DOCKER_SNMP_SV2_STEM)-$(DBG_IMAGE_MARK).gz - -$(DOCKER_SNMP_SV2)_PATH = $(DOCKERS_PATH)/docker-snmp-sv2 - -## TODO: remove LIBPY3_DEV if we can get pip3 directly -$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD) - -$(DOCKER_SNMP_SV2)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) -$(DOCKER_SNMP_SV2)_DBG_DEPENDS += $(SNMP_DBG) $(SNMPD_DBG) $(LIBSNMP_DBG) - -$(DOCKER_SNMP_SV2)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) - -$(DOCKER_SNMP_SV2)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) $(SWSSSDK_PY3) $(ASYNCSNMP_PY3) -$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) - -SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2) - -SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_SV2_DBG) -SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_SV2_DBG) - -$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp -$(DOCKER_SNMP_SV2)_RUN_OPT += --privileged -t -$(DOCKER_SNMP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -# mount Arista platform python libraries to support corresponding platforms SNMP power status query -$(DOCKER_SNMP_SV2)_RUN_OPT += -v /usr/lib/python3/dist-packages/arista:/usr/lib/python3/dist-packages/arista:ro -$(DOCKER_SNMP_SV2)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) -$(DOCKER_SNMP_SV2)_BASE_IMAGE_FILES += monit_snmp:/etc/monit/conf.d diff --git a/rules/docker-snmp.dep b/rules/docker-snmp.dep new file mode 100644 index 0000000000..580ee65d53 --- /dev/null +++ b/rules/docker-snmp.dep @@ -0,0 +1,11 @@ + +DPATH := $($(DOCKER_SNMP)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-snmp.mk rules/docker-snmp.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SNMP)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SNMP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SNMP)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_SNMP),$(DOCKER_SNMP_DBG))) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk new file mode 100644 index 0000000000..39d5f2584b --- /dev/null +++ b/rules/docker-snmp.mk @@ -0,0 +1,32 @@ +# docker image for snmp agent + +DOCKER_SNMP_STEM = docker-snmp +DOCKER_SNMP = $(DOCKER_SNMP_STEM).gz +DOCKER_SNMP_DBG = $(DOCKER_SNMP_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_SNMP)_PATH = $(DOCKERS_PATH)/docker-snmp + +## TODO: remove LIBPY3_DEV if we can get pip3 directly +$(DOCKER_SNMP)_DEPENDS += $(SNMP) $(SNMPD) + +$(DOCKER_SNMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_SNMP)_DBG_DEPENDS += $(SNMP_DBG) $(SNMPD_DBG) $(LIBSNMP_DBG) + +$(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) + +$(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) $(SWSSSDK_PY3) $(ASYNCSNMP_PY3) +$(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +SONIC_DOCKER_IMAGES += $(DOCKER_SNMP) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP) + +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_DBG) + +$(DOCKER_SNMP)_CONTAINER_NAME = snmp +$(DOCKER_SNMP)_RUN_OPT += --privileged -t +$(DOCKER_SNMP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +# mount Arista platform python libraries to support corresponding platforms SNMP power status query +$(DOCKER_SNMP)_RUN_OPT += -v /usr/lib/python3/dist-packages/arista:/usr/lib/python3/dist-packages/arista:ro +$(DOCKER_SNMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) +$(DOCKER_SNMP)_BASE_IMAGE_FILES += monit_snmp:/etc/monit/conf.d