Skip to content

Commit

Permalink
Convert docker-snmp-sv2 to buster (#4529)
Browse files Browse the repository at this point in the history
* Fix libsnmp-base compilation failure
* Convert docker-snmp-sv2 to buster
* Define install_python3_wheels
* Address review comments
* Address review comments
* Advance snmpagent submodule
* Bump net-snmp to the Buster version
* Revert "Fix libsnmp-base compilation failure"
* use azure storage url
  • Loading branch information
joyas-joseph committed May 14, 2020
1 parent 0542afb commit 9dea816
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 247 deletions.
19 changes: 10 additions & 9 deletions dockers/docker-snmp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-stretch
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python3_wheels, copy_files %}
FROM docker-config-engine-buster

ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
Expand All @@ -18,7 +18,9 @@ ENV DEBIAN_FRONTEND=noninteractive
# The file referenced (`/usr/share/dpkg/no-pie-compile.specs`) is in the `libdpkg-perl` package on Debian
RUN apt-get update && \
apt-get install -y \
curl \
python3 \
python3-pip \
python3-dev \
ca-certificates \
gcc \
make \
Expand All @@ -43,11 +45,11 @@ RUN sed -i '/^#.* en_US.* /s/^#//' /etc/locale.gen
RUN locale-gen

# Install up-to-date version of pip
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
RUN pip3 install --no-cache-dir setuptools wheel

# Install pyyaml dependency for use by some plugins
# Install smbus dependency for use by some plugins
RUN python3.6 -m pip install --no-cache-dir \
RUN python3 -m pip install --no-cache-dir \
hiredis \
pyyaml \
smbus
Expand All @@ -57,15 +59,14 @@ RUN python3.6 -m pip install --no-cache-dir \
{{ copy_files("python-wheels/", docker_snmp_sv2_whls.split(' '), "/python-wheels/") }}

# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_snmp_sv2_whls.split(' ')) }}
{{ install_python3_wheels(docker_snmp_sv2_whls.split(' ')) }}
{% endif %}

RUN python3.6 -m sonic_ax_impl install
RUN python3 -m sonic_ax_impl install

# Clean up
RUN apt-get -y purge \
libpython3.6-dev \
libpython3.6 \
python3-dev \
curl \
gcc \
make \
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-snmp-sv2/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stdout_logfile=syslog
stderr_logfile=syslog

[program:snmp-subagent]
command=/usr/bin/env python3.6 -m sonic_ax_impl
command=/usr/bin/env python3 -m sonic_ax_impl
priority=4
autostart=false
autorestart=false
Expand Down
4 changes: 4 additions & 0 deletions dockers/dockerfile-macros.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
RUN cd /python-wheels/ && pip install {{ packages | join(' ') }}
{%- endmacro %}

{% macro install_python3_wheels(packages) -%}
RUN cd /python-wheels/ && pip3 install {{ packages | join(' ') }}
{%- endmacro %}

{% macro copy_files(prefix, files, dest) -%}
COPY \
{%- for file in files %}
Expand Down
10 changes: 4 additions & 6 deletions rules/docker-snmp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ 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) $(PY3) $(LIBPY3_DEV)
$(DOCKER_SNMP_SV2)_DEPENDS += $(SNMP) $(SNMPD)

$(DOCKER_SNMP_SV2)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(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_STRETCH)_DBG_IMAGE_PACKAGES)
$(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_STRETCH)
$(DOCKER_SNMP_SV2)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

SONIC_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP_SV2)
SONIC_STRETCH_DOCKERS += $(DOCKER_SNMP_SV2)

SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_SV2_DBG)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SNMP_SV2_DBG)
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SNMP_SV2_DBG)

$(DOCKER_SNMP_SV2)_CONTAINER_NAME = snmp
$(DOCKER_SNMP_SV2)_RUN_OPT += --privileged -t
Expand Down
35 changes: 0 additions & 35 deletions rules/python3.mk

This file was deleted.

2 changes: 1 addition & 1 deletion rules/snmpd.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# snmpd package

SNMPD_VERSION = 5.7.3+dfsg
SNMPD_VERSION_FULL = $(SNMPD_VERSION)-1.5
SNMPD_VERSION_FULL = $(SNMPD_VERSION)-5

export SNMPD_VERSION SNMPD_VERSION_FULL

Expand Down
5 changes: 1 addition & 4 deletions src/snmpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf net-snmp-$(SNMPD_VERSION)

# download debian net-snmp
wget -NO net-snmp_$(SNMPD_VERSION_FULL).dsc "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg-1.5.dsc?sv=2015-04-05&sr=b&sig=vDAYAKlwi7JjF%2FesdJUyf4VIEXPsCfLhqqTqNr75zBs%3D&se=2030-10-12T13%3A59%3A45Z&sp=r"
wget -NO net-snmp_$(SNMPD_VERSION).orig.tar.xz "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg.orig.tar.xz?sv=2015-04-05&sr=b&sig=UjIh%2FTcHrIEzEV7a%2BV2ZP4ks3xHlAA3wqyxkyV7Ms8I%3D&se=2030-10-12T13%3A58%3A19Z&sp=r"
wget -NO net-snmp_$(SNMPD_VERSION_FULL).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/net-snmp_5.7.3+dfsg-1.5.debian.tar.xz?sv=2015-04-05&sr=b&sig=xJkmxjtKXYcPe4yR%2FuCA0TXUfT40rj4XUMBaiK9CjsA%3D&se=2030-10-12T14%3A00%3A15Z&sp=r"
dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc
dget -u https://sonicstorage.blob.core.windows.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).dsc

pushd net-snmp-$(SNMPD_VERSION)
git init
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ diff --git a/debian/rules b/debian/rules
index 4c3b5b6..1fab6a4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,7 @@
# without -pie build fails during perl module build somehow...
export DEB_BUILD_MAINT_OPTIONS := hardening=+all,-pie
@@ -4,4 +4,5 @@
export DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)

LIB_VERSION = 30
UPSTREAM_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ':' | sed 's/ //' | sed 's/~dfsg.*$$//')
--
2.18.0

2 changes: 0 additions & 2 deletions src/snmpd/patch-5.7.3+dfsg/series
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch
0002-at.c-properly-check-return-status-from-realloc.-Than.patch
0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch
0005-Port-OpenSSL-1.1.0-with-support-for-1.0.2.patch
0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch
0007-Linux-VRF-5.7.3-Support.patch
0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch
2 changes: 1 addition & 1 deletion src/sonic-snmpagent

0 comments on commit 9dea816

Please sign in to comment.