From 88871ce8d9e069c7967734163c4406d78f91823d Mon Sep 17 00:00:00 2001 From: Filip Krzywka Date: Tue, 18 Dec 2018 10:10:06 +0100 Subject: Add script for sending messages from multiple xNFs Change-Id: I9acd3278929c30a3036f97f403a31a8817723d27 Issue-ID: DCAEGEN2-1027 Signed-off-by: Filip Krzywka --- development/bin/run-xnf-simulator.sh | 46 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'development/bin/run-xnf-simulator.sh') diff --git a/development/bin/run-xnf-simulator.sh b/development/bin/run-xnf-simulator.sh index 3fe96928..d8de0097 100755 --- a/development/bin/run-xnf-simulator.sh +++ b/development/bin/run-xnf-simulator.sh @@ -20,7 +20,7 @@ set -euo pipefail usage() { - echo "Start xnf-simulator container on given port and inside of given docker-network (by default 'development_default')" + echo "Start xnf-simulator container on given port and inside of given docker-network" echo "Usage: $0 [-h|--help] [-v|--verbose] []" exit 1 } @@ -31,27 +31,20 @@ while getopts "$optspec" arg; do -) # handle longopts case "${OPTARG}" in verbose) - VERBOSE=True - ;; + VERBOSE=True ;; help) - usage - ;; + usage ;; *) echo "Unknown option --${OPTARG}" >&2 - usage - ;; - esac - ;; + usage ;; + esac ;; v) - VERBOSE=True - ;; + VERBOSE=True ;; h) - usage - ;; + usage ;; *) echo "Unknown option -${OPTARG}" >&2 - usage - ;; + usage ;; esac done shift $((OPTIND-1)) @@ -60,22 +53,33 @@ shift $((OPTIND-1)) LISTEN_PORT=$1 -HV_VES_NETWORK=${2:-development_default} +if [ $# -gt 1 ]; then + HV_VES_NETWORK=${2} +fi PORTS="${LISTEN_PORT}:${LISTEN_PORT}/tcp" -HV_VES_REPO_HOME=`pwd`/.. +HV_VES_REPO_HOME=$(realpath $(dirname "$0"))/.. if [ -n "${VERBOSE+x}" ]; then - echo "Starting xnf-simulator with ports configuration: ${PORTS} on network: ${HV_VES_NETWORK}" + echo "Starting xnf-simulator with ports configuration: ${PORTS}" echo "Container id:" fi -docker run -d \ + +XNF_CONTAINER_ID=$(docker run -d \ -v ${HV_VES_REPO_HOME}/ssl/:/etc/ves-hv/ \ -p ${PORTS} \ - --network ${HV_VES_NETWORK} \ onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-xnf-simulator \ --listen-port ${LISTEN_PORT} \ --ves-host ves-hv-collector \ --ves-port 6061 \ --key-store-password onaponap \ - --trust-store-password onaponap \ No newline at end of file + --trust-store-password onaponap) + +echo $XNF_CONTAINER_ID + +if [ -n "${HV_VES_NETWORK+x}" ]; then + if [ -n "${VERBOSE+x}" ]; then + echo "Adding container to network: ${HV_VES_NETWORK}" + fi + docker network connect ${HV_VES_NETWORK} ${XNF_CONTAINER_ID} +fi -- cgit 1.2.3-korg