Commit 3c059675 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add UEidentityAPI support

parent 751fba11
......@@ -47,11 +47,15 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
std::string str = it->second.substr(idx_begin + 1, idx_end - idx_begin);
// ..and create the decoding buffer
TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
if (it->second.find("{\"userInfo\"") != std::string::npos) {
LocationAPI__TypesAndValues::UserInfo user_info;
if (it->second.find("\"userInfo\"") != std::string::npos) {
LocationAPI__TypesAndValues::UserInfo user_info;
user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.userInfo() = user_info;
} else if (it->second.find("\"ueIdentityTagInfo\"") != std::string::npos) {
UEidentityAPI__TypesAndValues::UeIdentityTagInfo ue_identity_tag_info;
ue_identity_tag_info.decode(UEidentityAPI__TypesAndValues::UeIdentityTagInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.ueIdentityTagInfo() = ue_identity_tag_info;
} else {
loggers::get_instance().warning("json_codec::decode: Unsupported variant");
return -1;
......
FROM ubuntu:18.04
MAINTAINER ETSI STF 549
MAINTAINER ETSI STF 569
LABEL description="STF549 Docker Image"
LABEL description="STF569 Docker Image"
ENV TERM=xterm
ENV HOSTNAME docker-titan-STF549
ENV HOSTNAME docker-titan-STF569
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y \
......@@ -66,7 +66,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get autoclean \
&& rm -rf /var/lib/apt/lists/*
RUN echo "docker-titan-STF549" > /etc/hostname \
RUN echo "docker-titan-STF569" > /etc/hostname \
&& echo "root:etsi" | chpasswd
RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \
......@@ -76,7 +76,7 @@ RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \
RUN cd /home/etsi \
&& echo "" >> /home/etsi/.bashrc \
&& echo "export HOME=/home/etsi" >> /home/etsi/.bashrc \
&& echo "export LD_LIBRARY_PATH=/home/etsi/dev/etsi_emcom/lib:$LD_LIBRARY_PATH" >> /home/etsi/.bashrc \
&& echo "export LD_LIBRARY_PATH=/home/etsi/dev/etsi_mec/lib:$LD_LIBRARY_PATH" >> /home/etsi/.bashrc \
&& echo "export PATH=/home/etsi/bin:$PATH" >> /home/etsi/.bashrc \
&& echo "cd /home/etsi" >> /home/etsi/.bashrc \
&& echo ". ./devenv.bash" >> /home/etsi/.bashrc \
......@@ -87,10 +87,10 @@ RUN cd /home/etsi \
# Seems that COPY does not work as expected, to be investaged
#==> Fallback to more secured solution
#COPY [^.]* /home/etsi/dev/STF549_Ng112/
#COPY [^.]* /home/etsi/dev/STF569_Mec/
#COPY home home/etsi
RUN git clone https://forge.etsi.org/gitlab/emergency-communications/NG112.git /home/etsi/dev/STF549_Ng112
RUN chown -R etsi /home/etsi/dev/STF549_Ng112/ && cd /home/etsi/dev/STF549_Ng112
RUN git clone https://forge.etsi.org/gitlab/garciay/MEC.git /home/etsi/dev/STF569_Mec
RUN chown -R etsi /home/etsi/dev/STF569_Mec/ && cd /home/etsi/dev/STF569_Mec
USER etsi
......@@ -105,27 +105,27 @@ RUN cd /home/etsi/frameworks \
&& wget -q 'http://ftp.halifax.rwth-aachen.de/eclipse//technology/epp/downloads/release/oxygen/2/eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz' -Oeclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz \
&& tar -zxvf ./eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz \
&& rm -f ./eclipse-cpp-oxygen-2-linux-gtk-x86_64.tar.gz \
&& cd /home/etsi/dev/STF549_Ng112 \
&& cd /home/etsi/dev/STF549_Ng112/ttcn \
&& cd /home/etsi/dev/STF569_Mec \
&& cd /home/etsi/dev/STF569_Mec/ttcn \
&& git clone https://forge.etsi.org/gitlab/LIBS/LibSip.git ./LibSip \
&& git clone https://forge.etsi.org/gitlab/LIBS/LibIms.git ./LibIms \
&& git clone https://forge.etsi.org/gitlab/LIBS/LibCommon.git ./LibCommon \
&& git clone -bSTF525 https://forge.etsi.org/gitlab/LIBS/LibIts ./LibIts \
&& cd /home/etsi/dev/STF549_Ng112/ttcn/LibIts \
&& cd /home/etsi/dev/STF569_Mec/ttcn/LibIts \
&& rm -fr asn1 t3q xsd \
&& cd ttcn && rm -fr BTP CALM CAM Common DCC DENM GeoNetworking Ipv6OverGeoNetworking IVIM MapemSpatem Pki Security SremSsem V2G \
&& cd /home/etsi/dev/STF549_Ng112/scripts \
&& cd /home/etsi/dev/STF569_Mec/scripts \
&& chmod 775 *.bash devenv.bash.* \
&& cd /home/etsi \
&& ln -sf /home/etsi/dev/STF549_Ng112/scripts/devenv.bash.ubuntu /home/etsi/devenv.bash \
&& ln -sf /home/etsi/dev/STF569_Mec/scripts/devenv.bash.ubuntu /home/etsi/devenv.bash \
&& ls -ltr /home/etsi \
&& export HOME=/home/etsi \
&& . /home/etsi/devenv.bash \
&& cd /home/etsi/dev/STF549_Ng112/scripts \
&& cd /home/etsi/dev/STF569_Mec/scripts \
&& ./build_titan.bash \
&& . /home/etsi/devenv.bash \
&& ./update_emcom_project.bash \
&& cd /home/etsi/dev/etsi_emcom/src/AtsNg112/objs \
&& ../bin/ng112_generate_makefile.bash
&& ./update_mec_project.bash \
&& cd /home/etsi/dev/etsi_mec/src/AtsMec/objs \
&& ../bin/mec_generate_makefile.bash
# That's all Floks
......@@ -9,7 +9,7 @@ LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0;
LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.0.5"
LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json;charset=utf-8"
LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json"
LibMec_Pics.PICS_ME_APP_IUT := true
......
......@@ -52,7 +52,7 @@ find .. -type f -name "*.bak" -exec rm {} \;
find .. -type f -name "*.log" -exec rm {} \;
# Build JSON files if any and put them in objs directory
REFERENCES="LibCommon LibHttp LibMec LibMec/LocationAPI"
REFERENCES="LibCommon LibHttp LibMec LibMec/LocationAPI LibMec/UEidentityAPI"
for i in ${REFERENCES}
do
# TTCN code
......@@ -166,7 +166,7 @@ else
fi
LDFLAGS_DEBUG_MODE='s/LDFLAGS = /LDFLAGS = -g -pthread -fPIC -fstack-check -fstack-protector -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer/g'
fi
ADD_INCLUDE='/CPPFLAGS = /a\\CPPFLAGS += -I/usr/local/share -I$(PATH_DEV_MEC)/include -I$(PATH_DEV_MEC)/framework/include -I../include -I../../LibEmcom/Common/include -I../../LibEmcom/LibMec/include -I$(HOME_FRAMEWORKS)/osip/include -I$(HOME_INC) -I.'
ADD_INCLUDE='/CPPFLAGS = /a\\CPPFLAGS += -I/usr/local/share -I$(PATH_DEV_MEC)/include -I$(PATH_DEV_MEC)/framework/include -I../include -I../../LibMec/Common/include -I../../LibMec/include -I$(HOME_FRAMEWORKS)/osip/include -I$(HOME_INC) -I.'
ADD_LIBRARIES='s/LINUX_LIBS = -lxml2/LINUX_LIBS = -lrt -lxml2 -lpcap -lstdc++fs -lssl -L\$\(HOME_FRAMEWORKS\)\/osip\/src\/osipparser2\/\.libs -losipparser2/g'
sed --in-place "${CXXFLAGS_DEBUG_MODE}" ./Makefile
sed --in-place "${LDFLAGS_DEBUG_MODE}" ./Makefile
......
......@@ -158,7 +158,7 @@ done
echo 'Update TTCN-3 files'
TTCN_3_ORG_PATH=${SRC_MEC_PATH}/ttcn
TTCN_3_DST_PATH=${PATH_DEV_MEC}/src
TTCN_3_ATS_LIST='AtsNg112 LibMec LibMec/LocationAPI LibCommon LibHttp'
TTCN_3_ATS_LIST='AtsNg112 LibMec LibMec/LocationAPI LibMec/UEidentityAPI LibHttp LibCommon'
for i in ${TTCN_3_ATS_LIST}
do
# TTCN-3 files
......
......@@ -165,7 +165,7 @@ else
fi
LDFLAGS_DEBUG_MODE='s/LDFLAGS = /LDFLAGS = -g -pthread -fPIC -fstack-check -fstack-protector -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer/g'
fi
ADD_INCLUDE='/CPPFLAGS = /a\\CPPFLAGS += -I/usr/local/share -I$(PATH_DEV_MEC)/include -I$(PATH_DEV_MEC)/framework/include -I../include -I../../LibEmcom/Common/include -I../../LibEmcom/LibNg112/include -I$(HOME_FRAMEWORKS)/osip/include -I$(HOME_INC) -I.'
ADD_INCLUDE='/CPPFLAGS = /a\\CPPFLAGS += -I/usr/local/share -I$(PATH_DEV_MEC)/include -I$(PATH_DEV_MEC)/framework/include -I../include -I../../LibMec/Common/include -I../../LibMec/include -I$(HOME_FRAMEWORKS)/osip/include -I$(HOME_INC) -I.'
ADD_LIBRARIES='s/LINUX_LIBS = -lxml2/LINUX_LIBS = -lrt -lxml2 -lpcap -lstdc++fs -lssl -L\$\(HOME_FRAMEWORKS\)\/osip\/src\/osipparser2\/\.libs -losipparser2/g'
sed --in-place "${CXXFLAGS_DEBUG_MODE}" ./Makefile
sed --in-place "${LDFLAGS_DEBUG_MODE}" ./Makefile
......
......@@ -125,7 +125,7 @@ do
done
# Update libraries & CC files
TTCN_3_LIB_LIST='LibMec LibMec/LocationAPI LibHttp LibCommon'
TTCN_3_LIB_LIST='LibMec LibMec/LocationAPI LibMec/UEidentityAPI LibHttp LibCommon'
for i in ${TTCN_3_LIB_LIST}
do
if [ ! -d ${TTCN_3_DST_PATH}/$i ]
......@@ -142,8 +142,10 @@ do
then
cp ${TTCN_3_ORG_PATH}/$i/ttcn/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
cp ${TTCN_3_ORG_PATH}/$i/json/*.json ${TTCN_3_DST_PATH}/$i/json
cp ${CC_SRC_PATH}/include/$i/*.hh ${TTCN_3_DST_PATH}/$i/include
cp ${CC_SRC_PATH}/src/$i/*.cc ${TTCN_3_DST_PATH}/$i/src
elif [ "$i" == "LibMec/UEidentityAPI" ]
then
cp ${TTCN_3_ORG_PATH}/$i/ttcn/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
cp ${TTCN_3_ORG_PATH}/$i/json/*.json ${TTCN_3_DST_PATH}/$i/json
elif [ "$i" == "LibHttp" ]
then
cp ${TTCN_3_ORG_PATH}/LibIts/ttcn/Http/*.ttcn ${TTCN_3_DST_PATH}/$i/ttcn
......
......@@ -2,12 +2,15 @@ module AtsMec_TestControl {
// LibMec_LocationAPI
import from LocationAPI_Pics all;
// LibMec_UEidentityAPI
import from UEidentityAPI_Pics all;
// LibMec
import from LibMec_Pics all;
// AtsMec
import from AtsMec_LocationAPI_TestCases all;
import from AtsMec_UEidentityAPI_TestCases all;
control {
......@@ -15,6 +18,9 @@ module AtsMec_TestControl {
if (PICS_LOCATION_API_SUPPORTED) {
execute(TC_MEC_PLAT_MP1_LOC_BV_001());
}
if (PICS_UE_IDENTITY_API_SUPPORTED) {
execute(TC_MEC_PLAT_MP1_UETAG_BV_001());
}
}
}
......
/**
* @author ETSI / STF569
* @version $URL:$
* $ID:$
* @desc This module provides the MEC test cases.
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
* @see ETSI GS MEC 003, Draft ETSI GS MEC 013 V2.0.3 (2018-10)
*/
module AtsMec_UEidentityAPI_TestCases {
// Libcommon
import from LibCommon_Time all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_Functions all;
import from LibItsHttp_Templates all;
import from LibItsHttp_JsonTemplates all;
import from LibItsHttp_TestSystem all;
// LibMec_UEidentityAPI
import from UEidentityAPI_TypesAndValues all;
import from UEidentityAPI_Templates all;
import from UEidentityAPI_Pics all;
import from UEidentityAPI_Pixits all;
// LibMec
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
group me_app_role {
/**
* @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2
*/
testcase TC_MEC_PLAT_MP1_UETAG_BV_001() runs on HttpComponent system HttpTestAdapter {
// Local variables
var HeaderLines v_headers;
var HttpMessage v_response;
// Test control
if (not(PICS_ME_APP_IUT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_ME_APP_IUT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info",
v_headers
)
)
);
f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_json(
mw_body_json_ue_identity_tag_info(
mw_ue_identity_tag_info(
?
)))))) -> value v_response {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_001
} // End of group me_app_role
} // End of module AtsMec_TestCases
module LocationAPI_Pics {
/**
* @desc Does the IUT support LocationAPI?
*/
modulepar boolean PICS_LOCATION_API_SUPPORTED := true;
} // End of module LocationAPI_Pics
{
"swagger": "2.0",
"info": {
"description": "The ETSI MEC ISG MEC014 UE Identity API described using OpenAPI",
"version": "1.1.1",
"title": "UE Identity API",
"license": {
"name": "ETSI Forge copyright notice",
"url": "https://forge.etsi.org/etsi-forge-copyright-notice.txt"
}
},
"externalDocs": {
"description": "ETSI GS MEC014 UE Identity API, V1.1.1",
"url": "http://www.etsi.org/deliver/etsi_gs/MEC/001_099/014/01.01.01_60/gs_mec014v010101p.pdf"
},
"host": "127.0.0.1:8081",
"basePath": "/ui/v1",
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"OauthSecurity": [
"all"
]
}
],
"securityDefinitions": {
"OauthSecurity": {
"type": "oauth2",
"flow": "application",
"tokenUrl": "https://oauth.exampleAPI/token",
"scopes": {
"all": "Single oauth2 scope for API"
}
}
},
"parameters": {
"Body.UeIdentityTagInfo": {
"name": "UeIdentityTagInfo",
"in": "body",
"description": "'The updated \"state\" for each included UE Identity tag is included in the entity body of the request'",
"required": true,
"schema": {
"$ref": "#/definitions/UeIdentityTagInfo"
}
},
"Path.AppInstanceId": {
"name": "appInstanceId",
"in": "path",
"description": "Represents a mobile edge application instance",
"required": true,
"type": "string"
},
"Query.UeIdentityTag": {
"name": "ueIdentityTag",
"in": "query",
"description": "Represents a UE",
"required": true,
"type": "array",
"items": {
"type": "string"
}
}
},
"paths": {
"/{appInstanceId}/ue_identity_tag_info": {
"parameters": [
{
"$ref": "#/parameters/Path.AppInstanceId"
}
],
"get": {
"description": "Retrieves information about a specific UeIdentityTagInfo resource",
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/Query.UeIdentityTag"
}
],
"responses": {
"200": {
"description": "It is used to indicate nonspecific success. The response body contains a representation of the UeIdentityTagInfo resource.",
"schema": {
"required": [
"UeIdentityTagInfo"
],
"properties": {
"UeIdentityTagInfo": {
"$ref": "#/definitions/UeIdentityTagInfo"
}
}
}
},
"400": {
"description": "Incorrect parameters were passed in the request.In the returned ProblemDetails structure, the \"detail\" attribute should convey more information about the error.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"403": {
"description": "The operation is not allowed given the current status of the resource. More information should be provided in the \"detail\" attribute of the \"ProblemDetails\" structure.",
"schema": {
"required": [
"ProblemDetails"
],
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"404": {
"description": "The client provided a URI that cannot be mapped to a valid resource URL. In the returned ProblemDetails structure, the \"detail\" attribute should convey more information about the error.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
}
}
},
"put": {
"description": "Register/De-register the information about specific a UeIdentityTagInfo resource",
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/Body.UeIdentityTagInfo"
}
],
"responses": {
"200": {
"description": "It is used to indicate success. The response body contains a representation of the UeIdentityTagInfo resource",
"schema": {
"required": [
"UeIdentityTagInfo"
],
"properties": {
"UeIdentityTagInfo": {
"$ref": "#/definitions/UeIdentityTagInfo"
}
}
}
},
"400": {
"description": "Incorrect parameters were passed in the request.In the returned ProblemDetails structure, the \"detail\" attribute should convey more information about the error.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"401": {
"description": "An erroneous or missing bearer token. More information should be provided in the \"detail\" attribute of the \"ProblemDetails\" structure.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"403": {
"description": "The operation is not allowed given the current status of the resource. More information should be provided in the \"detail\" attribute of the \"ProblemDetails\" structure.",
"schema": {
"required": [
"ProblemDetails"
],
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"404": {
"description": "The client provided a URI that cannot be mapped to a valid resource URL. In the returned ProblemDetails structure, the \"detail\" attribute should convey more information about the error.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
},
"412": {
"description": "It is used when a condition has failed during conditional requests, e.g. when using ETags to avoid write conflicts.In the returned ProblemDetails structure, the \"detail\" attribute should convey more information about the error.",
"schema": {
"properties": {
"ProblemDetails": {
"$ref": "#/definitions/ProblemDetails"
}
}
}
}
}
}
}
},
"definitions": {
"ProblemDetails": {
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/Problem.type"
},
"title": {
"$ref": "#/definitions/Problem.title"
},
"status": {
"$ref": "#/definitions/Problem.status"
},
"detail": {
"$ref": "#/definitions/Problem.detail"
},
"instance": {
"$ref": "#/definitions/Problem.instance"
}
}
},
"Problem.type": {
"type": "string",
"format": "uri",
"description": "A URI reference according to IETF RFC 3986 that identifies the problem type"
},
"Problem.title": {
"type": "string",
"description": "A short, human-readable summary of the problem type"
},
"Problem.status": {
"type": "integer",
"format": "uint32",
"description": "The HTTP status code for this occurrence of the problem"
},
"Problem.detail": {
"type": "string",
"description": "A human-readable explanation specific to this occurrence of the problem"
},
"Problem.instance": {
"type": "string",
"format": "uri",
"description": "A URI reference that identifies the specific occurrence of the problem"
},
"UeIdentityTagInfo": {
"description": "information of UE identity tag used in UE Identity feature",
"type": "object",
"required": [
"ueIdentityTags"
],
"properties": {
"ueIdentityTags": {
"$ref": "#/definitions/UeIdentityTags"
}
}
},
"UeIdentityTags": {
"description": "1 to N tags presented by a ME Application instance to a ME Platform",
"type": "array",
"items": {
"required": [
"ueIdentityTag",
"state"
],
"properties": {
"ueIdentityTag": {
"$ref": "#/definitions/UeIdentityTag"
},
"state": {
"$ref": "#/definitions/State"
}
}