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/servicesJson-request.json
11 ENDPOINT=http://localhost:8074
12 PORT=$(echo ${ENDPOINT} | cut -d: -f3)
14 # Entrypoint arguments (ft/st):
15 EXTRA_ARGUMENTS= # default is ft (function test: debug traces and traffic logs)
25 echo "Variant: ${VARIANT}"
26 echo "Remember usage: $0 [variant: <[Release]|Debug]>"
32 nghttp --version 2>/dev/null
33 [ $? -ne 0 ] && { echo -e "\nThe HTTP2 client 'nghttp' is required. Install with: sudo apt install nghttp\n" ; exit 1 ; }
34 echo "Requirement found !"
37 echo "Rebuild ADML HTTP service image (y/n) [n]:"
39 [ -z "${opt}" ] && opt=n
42 ${REPO_DIR}/tools/build-anna-adml-http ${VARIANT}
45 version=$(${REPO_DIR}/tools/version)
46 [ "${VARIANT}" = "Debug" ] && { version=${version}-debug ; C_NAME=${C_NAME}-debug ; }
47 echo "Restart ADML HTTP service image (version '${version}') ..."
48 docker kill ${C_NAME} &>/dev/null
49 cid=$(docker run --rm -d -p ${PORT}:${PORT} --name ${C_NAME} anna-adml-http:${version} ${EXTRA_ARGUMENTS} >/dev/null)
50 [ $? -ne 0 ] && exit 1
52 echo "Container id: ${cid} (deployed as '${C_NAME}')"
55 echo "Configuring services (${SERVICES}) ..."
56 sleep 4 # wait for docker running
57 nghttp -H ":method: POST" -d ${SERVICES} ${ENDPOINT}/services | tee .response.json | jq '.'
58 result=$(cat .response.json | jq -r '.["success"]')
60 if [ "${result}" = "false" ]
63 echo "Check if another ADML HTTP service (anna-adml-http*) has been started (port ${PORT} busy ?)"
68 echo -n "Waiting for server-client connection ..."
71 docker exec -it ${C_NAME} bash -c "netstat -p \$(pgrep ADML) --numeric-ports | grep -w 3868 | grep -w ESTABLISHED" >/dev/null
79 echo "Press ENTER to start component test, CTRL-C to abort ..."