X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fct.sh;fp=example%2Fdiameter%2Flauncher%2Fresources%2Frest_api%2Fct%2Fct.sh;h=4d485df0128c867e845863ff3f4b5f9178feb5f3;hb=882e3764e48fdf93aeb078c1832b10a956288da3;hp=0000000000000000000000000000000000000000;hpb=e688b5354af3a5fe0add859710cae41ffe123f65;p=anna.git diff --git a/example/diameter/launcher/resources/rest_api/ct/ct.sh b/example/diameter/launcher/resources/rest_api/ct/ct.sh new file mode 100755 index 0000000..4d485df --- /dev/null +++ b/example/diameter/launcher/resources/rest_api/ct/ct.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +############# +# VARIABLES # +############# + +REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null)" +[ -z "$REPO_DIR" ] && { echo "You must execute under a valid git repository !" ; exit 1 ; } + +SERVICES=${REPO_DIR}/example/diameter/launcher/resources/rest_api/ct/resources/servicesJson-request.json +ENDPOINT=http://localhost:8074 +PORT=$(echo ${ENDPOINT} | cut -d: -f3) +C_NAME=adml-http + +############# +# EXECUTION # +############# +cd $(dirname $0) + +# Basic requirement: +nghttp --version 2>/dev/null +[ $? -ne 0 ] && { echo -e "\nThe HTTP2 client 'nghttp' is required. Install with: sudo apt install nghttp\n" ; exit 1 ; } +echo "Requirement found !" + +echo +echo "Rebuild ADML HTTP service image (y/n) [y]:" +read opt +[ -z "${opt}" ] && opt=y +[ "${opt}" = "y" ] && ${REPO_DIR}/tools/build-adml-http + +version=$(${REPO_DIR}/tools/version) +echo "Restart ADML HTTP service image (version '${version}') ..." +docker kill ${C_NAME} >/dev/null +cid=$(docker run --rm -d -p ${PORT}:${PORT} --name ${C_NAME} anna-adml-http:${version}) +echo "Container id: ${cid} (deployed as '${C_NAME}')" + +echo +echo "Configuring services (${SERVICES}) ..." +sleep 4 # wait for docker running +nghttp -H ":method: POST" -d ${SERVICES} ${ENDPOINT}/services +echo + +echo +echo -n "Waiting for server-client connection ..." +while true +do + docker exec -it ${C_NAME} bash -c "netstat -p $(pgrep ADML) --numeric-ports | grep -w 3868 | grep -w ESTABLISHED" >/dev/null + [ $? -eq 0 ] && break + echo -n . +done +echo "Ready !" + +echo +echo "Press ENTER to start component test, CTRL-C to abort ..." +read dummy + +pytest +