7 REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null)"
8 [ -z "$REPO_DIR" ] && { echo "You must execute under a valid git repository !" ; exit 1 ; }
10 SERVICES=${REPO_DIR}/example/diameter/launcher/resources/rest_api/ct/resources/servicesRxJson-request.json
11 ENDPOINT=http://localhost:8074
12 PORT=$(echo ${ENDPOINT} | cut -d: -f3)
13 SVC_NAME=anna-adml-http
14 # Entrypoint arguments (ft/st):
15 EXTRA_ARGUMENTS= # default is ft (function test: debug traces and traffic logs)
24 echo "Variant: ${VARIANT}"
25 echo "Remember usage: $0 [variant: <[Release]|Debug]>"
31 nghttp --version 2>/dev/null
32 [ $? -ne 0 ] && { echo -e "\nThe HTTP2 client 'nghttp' is required. Install with: sudo apt install nghttp\n" ; exit 1 ; }
33 echo "Requirement found !"
36 echo "Rebuild ADML HTTP service image (y/n) [y]:"
38 [ -z "${opt}" ] && opt=y
41 ${REPO_DIR}/tools/build-anna-adml-http ${VARIANT}
44 version=$(${REPO_DIR}/tools/version)
46 [ "${VARIANT}" = "Debug" ] && { version=${version}-debug ; cname=${cname}-debug ; }
47 echo "Restart ADML HTTP service image (version '${version}') (y/n) [y]:"
49 [ -z "${opt}" ] && opt=y
52 docker kill ${SVC_NAME} &>/dev/null
53 docker kill ${SVC_NAME}-debug &>/dev/null
55 echo "Optimize for system test (disable traffic logs and set warning level for traces) (y/n) [n]:"
57 [ -z "${opt}" ] && opt=n
58 [ "${opt}" = "y" ] && EXTRA_ARGUMENTS=st
60 cid=$(docker run --rm -d -p ${PORT}:${PORT} --name ${cname} anna-adml-http:${version} ${EXTRA_ARGUMENTS} >/dev/null)
61 [ $? -ne 0 ] && exit 1
62 echo "Container id: ${cid} (deployed as '${cname}')"
66 echo "Configuring services (${SERVICES}) ..."
67 sleep 4 # wait for docker running
68 nghttp -H ":method: POST" -d ${SERVICES} ${ENDPOINT}/services | tee .response.json | jq '.'
69 result=$(cat .response.json | jq -r '.["success"]')
71 if [ "${result}" = "false" ]
74 echo "Check if another ADML HTTP service (anna-adml-http*) has been started (port ${PORT} busy ?)"
79 echo -n "Waiting for server-client connection ..."
82 docker exec -it ${cname} bash -c "netstat -p \$(pgrep ADML) --numeric-ports | grep -w 3868 | grep -w ESTABLISHED" >/dev/null
90 echo "Press ENTER to start component test, CTRL-C to abort ..."