snmp-armada-app/stx-snmp-helm/docker/stx-fm-subagent/bootstrap.sh
Enzo Candotti 90a317189a Add stx-fm-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.

The files Dockerfile.debian for stx-snmp and stx-fm-trap-subagent have
been added with no content in order to work on them on different
reviews.

Test plan:

PASS: Debian - Build Debian docker image and upload/apply snmp-app changing
the stx-fm-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: 45730

Signed-off-by: Enzo Candotti <enzo.candotti@windriver.com>
Change-Id: Idfb46224429061f11493c111588b542cf809b79f
2022-07-29 12:36:46 +00:00

49 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -u
# Option handling in sh
if [ "$OPTIONDEBUG" != "" ]; then
case "$OPTIONDEBUG" in
-DALL) echo "-DALL - debug option enable"
;;
-*) echo "Unrecognized option $OPTIONDEBUG"
OPTIONDEBUG=""
;;
*) echo "Bad argument $OPTIONDEBUG"
OPTIONDEBUG=""
;;
esac
fi
# Waiting master agent initialization
if [ "$MASTER_AGENT_HOST" == "" ]; then
MASTER_AGENT_HOST="localhost";
fi
if [ "$MASTER_AGENT_PORT" == "" ]; then
MASTER_AGENT_PORT=705;
fi
if [ "$MASTER_AGENT_CONNECTION_RETRIES" == "" ]; then
MASTER_AGENT_CONNECTION_RETRIES=20;
fi
HOST=$MASTER_AGENT_HOST
PORT=$MASTER_AGENT_PORT
RETRIES=$MASTER_AGENT_CONNECTION_RETRIES
echo "Waiting master agent initialization ($HOST:$PORT) [MaxRetries:$RETRIES]"
counter=0
until </dev/tcp/$HOST/$PORT; do
sleep 1;
[[ counter -eq $RETRIES ]] && exit 1;
echo "Trying again, try #$counter";
$((counter++));
done
# Internal params
RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:${HOST}:$PORT"
# Launch
$RUN_CMD