Commit db194c1b authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'test-rhel7-deployment' into 'develop'

fix(rhel): installing curl version that supports HTTP2

See merge request oai/cn5g/oai-cn5g-upf-vpp!40
parents 2f72eea2 5a7143ac
......@@ -74,6 +74,11 @@ RUN yum repolist --disablerepo=* && \
http://repo.openfusion.net/centos7-x86_64/hyperscan-5.3.0-1.of.el7.x86_64.rpm && \
rpm -i *.rpm && \
rm *.rpm && \
# The CURL version installed is 7.29 and does not support HTTP2
wget --tries=4 --retry-connrefused --wait=8 \
https://github.com/moparisthebest/static-curl/releases/download/v7.85.0/curl-amd64 \
-O /usr/bin/curl && \
chmod +x /usr/bin/curl && \
yum remove -y wget && \
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
......
......@@ -110,6 +110,11 @@ RUN yum repolist --disablerepo=* && \
http://repo.openfusion.net/centos7-x86_64/hyperscan-5.3.0-1.of.el7.x86_64.rpm && \
rpm -i *.rpm && \
rm *.rpm && \
# The CURL version installed is 7.29 and does not support HTTP2
wget --tries=4 --retry-connrefused --wait=8 \
https://github.com/moparisthebest/static-curl/releases/download/v7.85.0/curl-amd64 \
-O /usr/bin/curl && \
chmod +x /usr/bin/curl && \
yum remove -y wget && \
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
......
......@@ -29,26 +29,40 @@
#*/
#"""
if [ ! -v CONFIG_DIR ]; then
CONFIG_DIR=/openair-upf/etc
fi
UPF_PROFILE=$CONFIG_DIR/upf_profile.json
if [ ! -v UUID ]; then
echo "UUID is not defined"
UUID=`grep nfInstanceId ${UPF_PROFILE} | sed -e 's@ "nfInstanceId": "@@' -e 's@",@@'`
else
echo "UUID is exported: ${UUID}"
fi
NRF_URL=$NRF_IP_ADDR:$NRF_PORT/nnrf-nfm/v1/nf-instances/$UUID
echo "NRF_URL is ${NRF_URL}"
##### Variables #####
DUMP_STATUS_CODE=$(echo '--write-out %{http_code} --silent --output /dev/null')
PATCH_DATA=$(echo '[{"op":"replace","path":"/nfStatus","value":"REGISTERED"}]')
CONTENT_TYPE=$(echo 'Content-Type: application/json')
HTTP2=--http2-prior-knowledge
UPF_PROFILE=$CONFIG_DIR/upf_profile.json
NF_HEARTBEAT_TIMER=10
NF_HEARTBEAT_START=5
##### NF Registration #####
echo "Sending NF Registration Request (HTTP Version $HTTP_VERSION)"
if [[ ${HTTP_VERSION} == 2 ]];then
echo "curl command options are: ${HTTP2} ${DUMP_STATUS_CODE} -X PUT ${NRF_URL} -d @${UPF_PROFILE} -H \"${CONTENT_TYPE}\""
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
else
echo "curl command options are: ${DUMP_STATUS_CODE} -X PUT ${NRF_URL} -d @${UPF_PROFILE} -H \"${CONTENT_TYPE}\""
response=$(curl $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
fi
##### NF Heartbeat #####
DISPLAY_CMD=1
if [[ ${response} == 201 || ${response} == 200 ]];then
echo -e "Received NF registration response (HTTP_STATUS_CODE_200/201)\n"
sleep $NF_HEARTBEAT_START
......@@ -56,16 +70,23 @@ if [[ ${response} == 201 || ${response} == 200 ]];then
do
echo "Sending NF heartbeat request"
if [[ ${HTTP_VERSION} == 2 ]]; then
if [ $DISPLAY_CMD -eq 1 ]; then
echo "curl command options are: ${HTTP2} ${DUMP_STATUS_CODE} -X PATCH ${NRF_URL} -d ${PATCH_DATA} -H \"${CONTENT_TYPE}\""
fi
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
else
if [ $DISPLAY_CMD -eq 1 ]; then
echo "curl command options are: ${DUMP_STATUS_CODE} -X PATCH ${NRF_URL} -d ${PATCH_DATA} -H \"${CONTENT_TYPE}\""
fi
response=$(curl $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
fi
DISPLAY_CMD=0
if [[ ${response} == 204 ]];then
echo -e "Received NF heartbeat response (HTTP_STATUS_CODE_204)\n"
fi
sleep $NF_HEARTBEAT_TIMER
done
else
echo -e "\nNF Registration Procedure Failed ........!!!!"
echo -e "\nNF Registration Procedure Failed (response is ${response}) ........!!!!"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment