+
+ docker run \
+ --detach \
+ --name ${DOCKER_NAME} \
+ --env HOST_IP=${IP} \
+ --env ENVNAME="${DEP_ENV}" \
+ --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" \
+ --log-driver=json-file \
+ --log-opt max-size=100m \
+ --log-opt max-file=10 \
+ --ulimit memlock=-1:-1 \
+ --ulimit nofile=4096:100000 \
+ --volume ${WORKSPACE}/data/logs/FE/:${JETTY_BASE}/logs \
+ --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments \
+ ${LOCAL_TIME_MOUNT_CMD} \
+ ${PLUGINS_CONF_VOLUME_MOUNT} \
+ --publish 9443:9443 \
+ --publish 8181:8181 \
+ ${ADDITIONAL_ARGUMENTS} \
+ ${IMAGE_NAME}
+
+ command_exit_status $? ${DOCKER_NAME}
+ echo "Please wait while '${DOCKER_NAME}' container is starting..."
+ monitor_docker ${DOCKER_NAME}
+}
+#
+
+
+# apis-sanity
+function sdc-api-tests {
+ if [[ ${RUN_API_TESTS} = true ]] ; then
+ healthCheck
+ healthCheck_http_code=$?
+ if [[ ${healthCheck_http_code} == 200 ]] ; then
+ echo "docker run sdc-api-tests..."
+ echo "Trigger sdc-api-tests docker, please wait..."
+
+ if [ ${LOCAL} = false ]; then
+ docker pull ${PREFIX}/sdc-api-tests:${RELEASE}
+ fi
+
+ docker run --detach --name sdc-api-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${API_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${API_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-api-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-api-tests/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:/var/lib/tests/cert --publish 9560:9560 ${PREFIX}/sdc-api-tests:${RELEASE} echo "please wait while SDC-API-TESTS is starting....."
+ monitor_docker sdc-api-tests
+ fi
+ fi
+}
+#
+
+
+# ui-sanity
+function sdc-ui-tests {
+
+ if [[ ${RUN_UI_TESTS} = true ]] ; then
+ healthCheck
+ healthCheck_http_code=$?
+ if [[ ${healthCheck_http_code} == 200 ]]; then
+ echo "docker run sdc-ui-tets..."
+ echo "Trigger sdc-ui-tests docker, please wait..."
+
+ if [ ${LOCAL} = false ]; then
+ docker pull ${PREFIX}/sdc-ui-tests:${RELEASE}
+ fi
+ RUN_SIMULATOR=true;
+ sdc-sim
+ docker run --detach --name sdc-ui-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${UI_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${UI_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-ui-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5901:5901 --publish 6901:6901 ${PREFIX}/sdc-ui-tests:${RELEASE}
+ echo "please wait while SDC-UI-TESTS is starting....."
+ monitor_docker sdc-ui-tests
+ fi
+ fi
+}
+#
+
+
+# SDC-Simulator
+function sdc-sim {
+ if [ "${RUN_SIMULATOR}" == true ]; then
+ echo "docker run sdc-webSimulator..."
+ if [ ${LOCAL} = false ]; then
+ docker pull ${PREFIX}/sdc-simulator:${RELEASE}
+ fi
+
+ probe_sim
+ sim_stat=$?
+ if [ ${sim_stat} == 1 ]; then
+ docker run \
+ --detach \
+ --name sdc-sim \
+ --env FE_URL="${FE_URL}" \
+ --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" \
+ --env ENVNAME="${DEP_ENV}" \
+ ${LOCAL_TIME_MOUNT_CMD} \
+ --volume ${WORKSPACE}/data/logs/WS/:${JETTY_BASE}/logs \
+ --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \
+ --publish 8285:8080 \
+ --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE}
+ echo "please wait while SDC-WEB-SIMULATOR is starting....."
+ monitor_docker sdc-sim
+ fi
+ fi
+}
+#
+
+
+#
+# Main
+#
+
+# Handle command line arguments
+while [ $# -gt 0 ]; do
+ case $1 in
+
+ # -r | --release - The specific docker version to pull and deploy
+ -r | --release )
+ shift 1 ;
+ RELEASE=$1;
+ shift 1;;
+
+ # -e | --environment - The environment name you want to deploy
+ -e | --environment )
+ shift 1;
+ DEP_ENV=$1;
+ shift 1 ;;
+
+ # -p | --port - The port from which to connect to the docker nexus
+ -p | --port )
+ shift 1 ;
+ PORT=$1;
+ shift 1 ;;
+
+ # -l | --local - Use this for deploying your local dockers without pulling them first
+ -l | --local )
+ LOCAL=true;
+ shift 1;;
+
+ # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed
+ -ta )
+ shift 1 ;
+ API_SUITE=$1;
+ RUN_API_TESTS=true;
+ shift 1 ;;
+
+ # -tu - Use this for running the UI sanity docker after all other dockers have been deployed
+ -tu )
+ shift 1 ;
+ UI_SUITE=$1;
+ RUN_UI_TESTS=true;
+ shift 1 ;;
+
+ # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed
+ -tad | -t )
+ API_SUITE="onapApiSanity";
+ RUN_API_TESTS=true;
+ shift 1 ;;
+
+ # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed
+ -tud )
+ UI_SUITE="onapUiSanity";
+ RUN_UI_TESTS=true;
+ shift 1 ;;
+
+ # -d | --docker - The init specified docker
+ -d | --docker )
+ shift 1 ;
+ DOCKER=$1;
+ shift 1 ;;
+ # -sim | --simulator run the simulator
+ -sim | --simulator )
+ RUN_SIMULATOR=true;
+ shift 1 ;;
+ # -sim | --simulator run the simulator
+ -u | --fe_url )
+ shift 1 ;
+ FE_URL=$1;
+ shift 1 ;;
+
+ # -h | --help - Display the help message with all the available run options
+ -h | --help )
+ usage;
+ exit ${SUCCESS};;
+
+ * )
+ usage;
+ exit ${FAILURE};;
+ esac
+done
+
+
+#Prefix those with WORKSPACE so it can be set to something other than /opt
+[ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || echo ${DEP_ENV}
+[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release
+[ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
+[ -f ${WORKSPACE}/opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat ${WORKSPACE}/opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT}
+[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
+
+
+export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
+#If OSX, then use this to get IP
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ export IP=$(ipconfig getifaddr en0)
+fi
+export PREFIX=${NEXUS_DOCKER_REPO}'/onap'
+
+if [ ${LOCAL} = true ]; then
+ PREFIX='onap'
+fi
+
+echo ""
+
+if [ -z "${DOCKER}" ]; then
+ cleanup all
+ dir_perms
+ sdc-cs
+ sdc-cs-init
+ sdc-cs-onboard-init
+ sdc-onboard-BE
+ sdc-BE
+ sdc-BE-init
+ sdc-FE
+ healthCheck
+ sdc-sim
+ sdc-api-tests
+ sdc-ui-tests
+else
+ cleanup ${DOCKER}
+ dir_perms
+ ${DOCKER}
+ healthCheck
+fi