diff options
Diffstat (limited to 'development/bin/run-xnf-simulator.sh')
-rwxr-xr-x | development/bin/run-xnf-simulator.sh | 46 |
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 |