Commit 68867733 authored by Elian Kraja's avatar Elian Kraja
Browse files

Merging jsonMessageBodyTypes and JsonTemplates

parents 30d3f8ad b55fa194
Loading
Loading
Loading
Loading

LICENSE

0 → 100644
+25 −0
Original line number Diff line number Diff line
ETSI Software License

As long as the hereunder conditions are respected, non-exclusive permission is 
hereby granted, free of charge, to use, reproduce and modify this software 
source code, under the following conditions:

- This source code is provided “AS IS” with no warranties, express or implied, 
  including but not limited to, the warranties of merchantability, fitness for 
  a particular purpose and warranties for non-infringement of intellectual 
  property rights. ETSI shall not be held liable in any event for any direct or 
  indirect damages whatsoever (including, without limitation, damages for loss 
  of profits, business interruption, loss of information, or any other pecuniary 
  loss) arising out of or related to the use of or inability to use the 
  source code.
  
- This permission is granted to facilitate the implementation of the related 
  ETSI standard, provided that ETSI is given the right to use, reproduce and 
  amend the modified source code under the same conditions as the 
  present permission.
  
- This permission does not apply to any documentation associated with this 
  source code for which ETSI keeps all rights reserved. 
  
The present ETSI Source Code license shall be included in all copies of whole 
or part of this source code and shall not imply any sub-license right.
+32 −4
Original line number Diff line number Diff line
@@ -21,6 +21,14 @@ This file provides the list of the TODOs related to the STF 569.

### RNIS

Draft ETSI GS MEC 012 2.0.4

https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/RNIS/RnisSpecificSubscription_BV.tplan2
https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/RNIS/RnisSpecificSubscription_BV.tplan2

- TC_MEC_SRV_RNIS_011_OK       <font color="color:green">To be tested</font>
- TC_MEC_SRV_RNIS_012_OK       <font color="color:green">To be tested</font>

### SAQ

### SRVSUB
@@ -29,19 +37,40 @@ This file provides the list of the TODOs related to the STF 569.

### TRAF

Draft ETSI GS MEC 011 V2.0.9 (2018-10)

https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/TRAF/PlatTrafficRules.tplan2

- TC_MEC_SRV_TRANS_001_OK       <font color="color:green">To be tested</font>
- TC_MEC_SRV_TRAF_001_OK        <font color="color:green">To be tested</font>
- TC_MEC_SRV_TRAF_002_OK        <font color="color:green">To be tested</font>
- TC_MEC_SRV_TRAF_003_OK        <font color="color:green">To be tested</font>
- TC_MEC_SRV_TRAF_001_NF        <font color="color:green">To be tested</font>

### TRANS 

Draft ETSI GS MEC 011 V2.0.9 (2018-10)

https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/TRANS/PlatTransport.tplan2

- TP_MEC_SRV_TRAF_001_OK       <font color="color:green">To be tested</font>

### UEAREASUB

Draft ETSI GS MEC 013 V2.0.3 (2018-10)

https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/UEDISTSUB/PlatUeAreaSubscription.tplan2

TODO CircleNotificationSubscription data structure not found

### UEDISTLOOK

Draft ETSI GS MEC 013 V2.0.3 (2018-10)

https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/UEDISTSUB/PlatUeDistanceSubscription.tplan2
https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20Purposes/SRV/UEDISTLOOK/PlatUeDistanceSubscription.tplan2

TODO TerminalDistance data structure not found


### UEDISTSUB

Draft ETSI GS MEC 013 V2.0.3 (2018-10)
@@ -50,7 +79,6 @@ https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/remove-401s/Test%20

TODO DistanceNotificationSubscription data structure not found


### UEINFLOOK

Draft ETSI GS MEC 013 V2.0.3 (2018-10)
+43 −9
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
    const LocationAPI__TypesAndValues::UserTrackingSubscription& user_tracking_subscription = msg.userTrackingSubscription();
    user_tracking_subscription.encode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = char2oct(CHARSTRING("{\"userTrackingSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
  } else if (msg.ischosen(LibItsHttp__JsonMessageBodyTypes::JsonBody::ALT_cellChangeSubscription)) {
    const RnisAPI__TypesAndValues::CellChangeSubscription& cell_change_subscription = msg.cellChangeSubscription();
    cell_change_subscription.encode(RnisAPI__TypesAndValues::CellChangeSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
    data = char2oct(CHARSTRING("{\"CellChangeSubscription\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}"));
  } else {
    loggers::get_instance().error("json_codec::encode: Not supported");
  }
@@ -58,21 +62,26 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
  // ..and create the decoding buffer
  TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));

  if (it->second.find("\"userList\"") != std::string::npos) { // Be carefull to the order
  if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order
                                                              // TODO To be refined, find("\"userList\"") is not optimal
      LocationAPI__TypesAndValues::UserList user_list;
      user_list.decode(LocationAPI__TypesAndValues::UserList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
      msg.userList() = user_list;
    } else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be carefull to the order
    } else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be careful to the order
                                                                              // TODO To be refined, find("\"accessPointList\"") is not optimal
    LocationAPI__TypesAndValues::AccessPointList access_point_list;
    access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.accessPointList() = access_point_list;
  } else if (it->second.find("\"SubscriptionLinkList\"") != std::string::npos) { // Be carefull to the order
  } else if (it->second.find("\"SubscriptionLinkList\"") != std::string::npos) { // Be careful to the order
                                                                                 // TODO To be refined, find("\"accessPointList\"") is not optimal
    RnisAPI__TypesAndValues::SubscriptionLinkList subscription_link_list;
    subscription_link_list.decode(RnisAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.subscriptionLinkList() = subscription_link_list;
  } else if (it->second.find("\"transportInfoList\"") != std::string::npos) { // Be careful to the order
                                                                              // TODO To be refined, find("\"accessPointList\"") is not optimal
    AppEnablementAPI__TypesAndValues::TransportInfoList transport_info_list;
    transport_info_list.decode(AppEnablementAPI__TypesAndValues::TransportInfoList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.transportInfoList() = transport_info_list;
  } else if (it->second.find("\"userTrackingSubscription\"") != std::string::npos) {
    LocationAPI__TypesAndValues::UserTrackingSubscription user_tracking_subscription;
    user_tracking_subscription.decode(LocationAPI__TypesAndValues::UserTrackingSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
@@ -85,6 +94,23 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
    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 if (it->second.find("\"trafficRule\"") != std::string::npos) {
    AppEnablementAPI__TypesAndValues::TrafficRule traffic_rule;
    traffic_rule.decode(AppEnablementAPI__TypesAndValues::TrafficRule_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.trafficRule() = traffic_rule;
  } else if (it->second.find("\"CellChangeSubscription\"") != std::string::npos) {
    RnisAPI__TypesAndValues::CellChangeSubscription cell_change_subscription;
    cell_change_subscription.decode(RnisAPI__TypesAndValues::CellChangeSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.cellChangeSubscription() = cell_change_subscription;
    //TODO Continue with other ChangeSubscription
  } else if (it->second.find("\"RabInfo\"") != std::string::npos) {
    RnisAPI__TypesAndValues::RabInfo rab_info;
    rab_info.decode(RnisAPI__TypesAndValues::RabInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.rabInfo() = rab_info;
  } else if (it->second.find("\"PlmnInfo\"") != std::string::npos) {
    RnisAPI__TypesAndValues::PlmnInfo plmn_info;
    plmn_info.decode(RnisAPI__TypesAndValues::PlmnInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.plmnInfo() = plmn_info;
  } else if (it->second.find("\"bwInfo\"") != std::string::npos) {
    BwManagementAPI__TypesAndValues::BwInfo bw_info;

@@ -105,9 +131,17 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
    bw_info.decode(BwManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
    msg.bwInfo() = bw_info;
  } else if (it->second.find("\"problemDetails\"") != std::string::npos) { // TODO To be refined, problemDetails in different modules
    UEidentityAPI__TypesAndValues::ProblemDetails problem_details;
    problem_details.decode(UEidentityAPI__TypesAndValues::ProblemDetails_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.problemDetails__ue__identity() = problem_details;


//    UEidentityAPI__TypesAndValues::ProblemDetails problem_details;
//    problem_details.decode(UEidentityAPI__TypesAndValues::ProblemDetails_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
//    msg.problemDetails__ue__identity() = problem_details;

    RnisAPI__TypesAndValues::ProblemDetails problem_details;
    problem_details.decode(RnisAPI__TypesAndValues::ProblemDetails_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.problemDetails__rni() = problem_details;


  } else {
    loggers::get_instance().warning("json_codec::decode: Unsupported variant");
    return -1;
+3 −4
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
      libssl-dev \
      libtool-bin \
      libtool \
      libwebsockets-dev \
      libwireshark-dev \
      libxml2-dev \
      lsof \
@@ -87,9 +88,9 @@ RUN cd /home/etsi \

# Seems that COPY does not work as expected, to be investaged
#==> Fallback to more secured solution
#COPY [^.]* /home/etsi/dev/STF569_Mec/
ADD . /home/etsi/dev/STF569_Mec
#COPY home home/etsi
RUN git clone https://forge.etsi.org/gitlab/mec/gs032p3-ttcn-test-suite.git /home/etsi/dev/STF569_Mec
# RUN git clone https://forge.etsi.org/gitlab/mec/gs032p3-ttcn-test-suite.git /home/etsi/dev/STF569_Mec
RUN chown -R etsi /home/etsi/dev/STF569_Mec/ && cd /home/etsi/dev/STF569_Mec

USER etsi
@@ -107,8 +108,6 @@ RUN cd /home/etsi/frameworks \
    && rm -f ./eclipse-cpp-photon-R-linux-gtk-x86_64.tar.gz \
    && 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/STF569_Mec/ttcn/LibIts \
+9 −4
Original line number Diff line number Diff line
@@ -3,20 +3,25 @@
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

#set -e
#set -vx
set -vx

DOCKER_FILE=./docker/Dockerfile
if [ -f ${DOCKER_FILE} ]
then
    docker rm --force stf569_Mec
    docker build --tag stf569_Mec --force-rm -f ${DOCKER_FILE} .
    #check and build stf569_mec image
    DOCKER_ID=`docker ps -a | grep -e stf569_mec | awk '{ print $1 }'`
    if [ ! -z "${DOCKER_ID}" ]
    then
        docker rm --force stf569_mec
    fi
    docker build --tag stf569_mec --force-rm -f ${DOCKER_FILE} .
    if [ "$?" != "0" ]
    then
        echo "Docker build failed: $?"
        exit -1
    fi
    docker image ls -a
    docker inspect stf569_Mec:latest
    docker inspect stf569_mec:latest
    if [ "$?" != "0" ]
    then
        echo "Docker inspect failed: $?"
Loading