aboutsummaryrefslogtreecommitdiffstats
path: root/development/bin/run-xnf-simulator.sh
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2018-12-18 10:10:06 +0100
committerFilip Krzywka <filip.krzywka@nokia.com>2019-01-03 08:36:41 +0000
commit88871ce8d9e069c7967734163c4406d78f91823d (patch)
tree39e1f60210c18658e821117dbf653d9097a41b23 /development/bin/run-xnf-simulator.sh
parent3d3eff47f0f94176f351d05f7dca39957a0c3c8b (diff)
Add script for sending messages from multiple xNFs
Change-Id: I9acd3278929c30a3036f97f403a31a8817723d27 Issue-ID: DCAEGEN2-1027 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'development/bin/run-xnf-simulator.sh')
-rwxr-xr-xdevelopment/bin/run-xnf-simulator.sh46
1 files changed, 25 insertions, 21 deletions
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] <xnf listen port> [<hv ves docker network>]"
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