From 20148e20031a558fb83eeb01f3d2fc393a6f170c Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Thu, 4 Aug 2022 16:09:28 -0300 Subject: [PATCH] Add stx-fm-trap-subagent docker image This change reorganizes the source directories of the stx-fm-subagent container to be reused by both CentOS and Debian Dockerfiles in order to build the images having the corresponding OS-specic base. Test plan: PASS: Debian - Build Debian docker image and upload/apply snmp-app changing the stx-fm-trap-subagent references to point to the new image. Verified that the app is applied, and the container is created. PASS: Verified common snmp scenarios: - test snmpwalk for 2c and 3 snmp version - test snmpget for 2c and 3 snmp version - verified traps are working as expected. PASS: CentOS - Same tests have been done building a CentOS container. Story: 2009831 Task: 45731 Signed-off-by: Enzo Candotti Change-Id: I962a526ad47ce320a0048e591f689453ca15cc23 --- .../stx-fm-trap-subagent/Dockerfile.debian | 21 +++++++++++++++++++ .../src/wrsAlarmMIBSubagent.c | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/stx-snmp-helm/docker/stx-fm-trap-subagent/Dockerfile.debian b/stx-snmp-helm/docker/stx-fm-trap-subagent/Dockerfile.debian index e69de29..f82661f 100644 --- a/stx-snmp-helm/docker/stx-fm-trap-subagent/Dockerfile.debian +++ b/stx-snmp-helm/docker/stx-fm-trap-subagent/Dockerfile.debian @@ -0,0 +1,21 @@ +FROM debian AS base +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get -y update +RUN apt-get -y install\ + snmp snmpd snmptrapd \ + libjson-c-dev \ + libsnmp-dev \ + gcc \ + make + +WORKDIR /home/trapagent +COPY src/* ./src/ +COPY Makefile . +RUN make + +FROM base AS deployment-env +WORKDIR /home/trapagent +COPY --from=base /home/trapagent/wrsAlarmMIB . +COPY bootstrap.sh . +RUN chmod 755 ./bootstrap.sh +ENTRYPOINT ["./bootstrap.sh"] diff --git a/stx-snmp-helm/docker/stx-fm-trap-subagent/src/wrsAlarmMIBSubagent.c b/stx-snmp-helm/docker/stx-fm-trap-subagent/src/wrsAlarmMIBSubagent.c index 66b9d57..d761e10 100644 --- a/stx-snmp-helm/docker/stx-fm-trap-subagent/src/wrsAlarmMIBSubagent.c +++ b/stx-snmp-helm/docker/stx-fm-trap-subagent/src/wrsAlarmMIBSubagent.c @@ -23,8 +23,8 @@ * --with-features="agent_check_and_process enable_stderrlog" to your * configure line. */ -netsnmp_feature_require(agent_check_and_process) - netsnmp_feature_require(enable_stderrlog) +netsnmp_feature_require(agent_check_and_process); + netsnmp_feature_require(enable_stderrlog); static int keep_running;