From c597505ca0a676a652dcc579d3e18ff50d99c93e Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Wed, 2 Jul 2025 17:20:26 +0500 Subject: [PATCH 1/5] validate and bug fixes in MEC015 Traffic Management API --- ccsrc/Protocols/Json/json_codec.cc | 169 ++++++++---------- .../Json/json_codec_factory_mec015.hh | 46 +++++ ccsrc/Protocols/Json/json_codec_mec015.cc | 154 ++++++++++++++++ ccsrc/Protocols/Json/json_codec_mec015.hh | 24 +++ ccsrc/Protocols/Json/module.mk | 3 +- .../AtsMec_TrafficManagement.cfg_ | 10 +- ..._BandwidthChangeEventSubAPI_TestCases.ttcn | 115 ++++++------ ..._MultiAccessSteeringInfoAPI_TestCases.ttcn | 6 +- ...AtsMec_TrafficManagementAPI_TestCases.ttcn | 22 +-- .../ttcn/TrafficManagementAPI_Functions.ttcn | 13 +- .../ttcn/TrafficManagementAPI_Pixits.ttcn | 4 +- .../ttcn/TrafficManagementAPI_Templates.ttcn | 80 +++++---- .../TrafficManagementAPI_TypesAndValues.ttcn | 27 ++- .../ttcn/LibHttp_JsonMessageBodyTypes.ttcn | 4 +- .../ttcn/LibHttp_JsonTemplates.ttcn | 12 +- 15 files changed, 471 insertions(+), 218 deletions(-) create mode 100644 ccsrc/Protocols/Json/json_codec_factory_mec015.hh create mode 100644 ccsrc/Protocols/Json/json_codec_mec015.cc create mode 100644 ccsrc/Protocols/Json/json_codec_mec015.hh diff --git a/ccsrc/Protocols/Json/json_codec.cc b/ccsrc/Protocols/Json/json_codec.cc index 3c31d8a..cb6d90c 100644 --- a/ccsrc/Protocols/Json/json_codec.cc +++ b/ccsrc/Protocols/Json/json_codec.cc @@ -8,39 +8,34 @@ #include "LibHttp_JsonMessageBodyTypes.hh" -int json_codec::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTETSTRING& data) +int json_codec::encode(const LibHttp__JsonMessageBodyTypes::JsonBody &msg, OCTETSTRING &data) { - loggers::get_instance().log_msg(">>> json_codec::encode: ", (const Base_Type&)msg); + loggers::get_instance().log_msg(">>> json_codec::encode: ", (const Base_Type &)msg); TTCN_EncDec::clear_error(); TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_Buffer encoding_buffer; - if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_ueIdentityTagInfo)) { - const UEidentityAPI__TypesAndValues::UeIdentityTagInfo& ue_identity_tag_info = msg.ueIdentityTagInfo(); + if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_ueIdentityTagInfo)) + { + const UEidentityAPI__TypesAndValues::UeIdentityTagInfo &ue_identity_tag_info = msg.ueIdentityTagInfo(); ue_identity_tag_info.encode(UEidentityAPI__TypesAndValues::UeIdentityTagInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); - } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_cellChangeSubscription)) { - const RnisAPI__TypesAndValues::CellChangeSubscription& cell_change_subscription = msg.cellChangeSubscription(); + } + else if (msg.ischosen(LibHttp__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 if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appContext)) { - const UEAppInterfaceAPI__TypesAndValues::AppContext& app_context = msg.appContext(); + data = /*char2oct(CHARSTRING("{\"CellChangeSubscription\": ")) + */ OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) /* + char2oct(CHARSTRING("}"))*/; + } + else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appContext)) + { + const UEAppInterfaceAPI__TypesAndValues::AppContext &app_context = msg.appContext(); app_context.encode(UEAppInterfaceAPI__TypesAndValues::AppContext_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); data = char2oct(CHARSTRING("{\"AppContext\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}")); - } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_bwInfo)) { - const TrafficManagementAPI__TypesAndValues::BwInfo& bw_info = msg.bwInfo(); - bw_info.encode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; - } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ATL_bwchgeventsubscription)) { - const TrafficManagementAPI__TypesAndValues::BwChgEventSubscription& bw_chg_event_subscription = msg.bwInfo(); - bw_info.encode(TrafficManagementAPI__TypesAndValues::BwChgEventSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; - } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_mtsSessionInfo)) { - const TrafficManagementAPI__TypesAndValues::MtsSessionInfo& mts_session_info = msg.mtsSessionInfo(); - mts_session_info.encode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; - } else { + } + else + { loggers::get_instance().error("json_codec::encode: Not supported"); } @@ -48,18 +43,22 @@ int json_codec::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTE return 0; } -int json_codec::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody& msg, params* p_params) +int json_codec::decode(const OCTETSTRING &p_data, LibHttp__JsonMessageBodyTypes::JsonBody &msg, params *p_params) { loggers::get_instance().log_msg(">>> json_codec::decode: p_data=", p_data); // Sanity checks params::const_iterator it; - if (p_params == nullptr) { + if (p_params == nullptr) + { loggers::get_instance().warning("json_codec::decode: Failed to access p_params (null pointer)"); return -1; // TODO Use p_data instead of return -1 - } else { + } + else + { it = p_params->find("decode_str"); - if (it == p_params->cend()) { + if (it == p_params->cend()) + { loggers::get_instance().warning("json_codec::decode: Failed to access p_params item (decode_str)"); return -1; // TODO Use p_data instead of return -1 } @@ -68,129 +67,109 @@ int json_codec::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes // Remove data structure name (if present) ... std::string str; - if ((it->second[0] != '[') && (it->second[0] != '{')) { + if ((it->second[0] != '[') && (it->second[0] != '{')) + { int idx_begin = it->second.find(":"); int idx_end = it->second.rfind("}") - 1; // Remove the last '}' str = it->second.substr(idx_begin + 1, idx_end - idx_begin); - } else { + } + else + { str = it->second; } // ..and create the decoding buffer TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_EncDec::clear_error(); loggers::get_instance().log("json_codec::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str()); - TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); + TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); - if (it->second.find("\"ueIdentityTagInfo\"") != std::string::npos) { + 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 if (it->second.find("\"CellChangeSubscription\"") != std::string::npos) { + } + 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("\"cellInfo\"") != std::string::npos) { + // TODO Continue with other ChangeSubscription + } + else if (it->second.find("\"cellInfo\"") != std::string::npos) + { RnisAPI__TypesAndValues::L2Meas l2_meas; l2_meas.decode(RnisAPI__TypesAndValues::L2Meas_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.l2Meas() = l2_meas; - } else if ((it->second.find("\"appInstanceId\"") != std::string::npos) && (it->second.find("\"requestId\"") != std::string::npos)) { + } + else if ((it->second.find("\"appInstanceId\"") != std::string::npos) && (it->second.find("\"requestId\"") != 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("\"S1BearerInfo\"") != std::string::npos) { + } + else if (it->second.find("\"S1BearerInfo\"") != std::string::npos) + { RnisAPI__TypesAndValues::S1BearerInfo s1_nearer_info; s1_nearer_info.decode(RnisAPI__TypesAndValues::S1BearerInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.s1BearerInfo() = s1_nearer_info; - } else if ((it->second.find("\"appInstanceId\"") != std::string::npos) && (it->second.find("\"plmn\"") != std::string::npos)) { + } + else if ((it->second.find("\"appInstanceId\"") != std::string::npos) && (it->second.find("\"plmn\"") != std::string::npos)) + { RnisAPI__TypesAndValues::PlmnInfos plmn_infos; plmn_infos.decode(RnisAPI__TypesAndValues::PlmnInfos_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.plmnInfos() = plmn_infos; - } else if (it->second.find("\"RabEstSubscription\"") != std::string::npos) { + } + else if (it->second.find("\"RabEstSubscription\"") != std::string::npos) + { RnisAPI__TypesAndValues::RabEstSubscription rab_est_subscription; rab_est_subscription.decode(RnisAPI__TypesAndValues::RabEstSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.rabEstSubscription() = rab_est_subscription; - } else if (it->second.find("\"RabModSubscription\"") != std::string::npos) { + } + else if (it->second.find("\"RabModSubscription\"") != std::string::npos) + { RnisAPI__TypesAndValues::RabModSubscription rab_mod_subscription; rab_mod_subscription.decode(RnisAPI__TypesAndValues::RabModSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.rabModSubscription() = rab_mod_subscription; - } else if (it->second.find("\"RabRelSubscription\"") != std::string::npos) { + } + else if (it->second.find("\"RabRelSubscription\"") != std::string::npos) + { RnisAPI__TypesAndValues::RabRelSubscription rab_rel_subscription; rab_rel_subscription.decode(RnisAPI__TypesAndValues::RabRelSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.rabRelSubscription() = rab_rel_subscription; - } else if ((it->second.find("\"_links\"") != std::string::npos) && (it->second.find("subscriptions\"") != std::string::npos)) { // SubscriptionLinkList + } + else if ((it->second.find("\"_links\"") != std::string::npos) && (it->second.find("subscriptions\"") != std::string::npos)) + { // SubscriptionLinkList // FIXME Conflict with MEC-028 SubscriptionLinkList data type 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("\"associateDevAppId\"") != std::string::npos) { + } + else if (it->second.find("\"associateDevAppId\"") != std::string::npos) + { UEAppInterfaceAPI__TypesAndValues::AppContext appContext; appContext.decode(UEAppInterfaceAPI__TypesAndValues::AppContext_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.appContext() = appContext; - } else if (it->second.find("\"appInfo\"") != std::string::npos) { + } + else if (it->second.find("\"appInfo\"") != std::string::npos) + { UEAppInterfaceAPI__TypesAndValues::AppInfo appInfo; appInfo.decode(UEAppInterfaceAPI__TypesAndValues::AppInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.appInfo() = appInfo; - } else if ((it->second.find("\"bwInfo\"") != std::string::npos) || (it->second.find("\"fixedBWPriority\"") != std::string::npos)) { - // Need to change some enumerated string not supported by TTCN-3 language - while (true) { - if (str.find("\"00\"") != std::string::npos) { - str = regex_replace(str, regex("\"00\""), "\"Downlink\""); - } else if (str.find("\"01\"") != std::string::npos) { - str = regex_replace(str, regex("\"01\""), "\"Uplink\""); - } else if (str.find("\"10\"") != std::string::npos) { - str = regex_replace(str, regex("\"10\""), "\"Symmetrical\""); - } else { - loggers::get_instance().log("json_codec::decode: BwInfo in break"); - break; - } - } // End of 'while' loop - loggers::get_instance().log("json_codec::decode: BwInfo after converting enum: %s", str.c_str()); - if (it->second[0] == '[') { // BwInfoList - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - TrafficManagementAPI__TypesAndValues::BwInfoList bw_info_list; - bw_info_list.decode(TrafficManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.bwInfoList() = bw_info_list; - } else { // BwInfo - TrafficManagementAPI__TypesAndValues::BwInfo bw_info; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - bw_info.decode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.bwInfo() = bw_info; - } - } else if ((it->second.find("\"_links\"") != std::string::npos) && (it->second.find("subscriptions\"") != std::string::npos)) { // SubscriptionLinkList - TrafficManagementAPI__TypesAndValues::SubscriptionLinkList subscription_link_list; - subscription_link_list.decode(TrafficManagementAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); - msg.subscriptionLinkList() = subscription_link_list; - } else if ((it->second.find("\"bwchgeventsubscription\"") != std::string::npos) { - TrafficManagementAPI__TypesAndValues::BwChgEventSubscription bw_chg_event_subscription; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - bw_chg_event_subscription.decode(TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.bwchgeventsubscription() = bw_chg_event_subscription; - } else if ((it->second.find("\"mtsCapabilityInfo\"") != std::string::npos) || (it->second.find("\"mtsAccessInfo\"") != std::string::npos)) { - TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo mts_cap_info; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - mts_cap_info.decode(TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.mtsCapabilityInfo() = mts_cap_info; - } else if ((it->second.find("\"mtsSessionInfo\"") != std::string::npos) || (it->second.find("\"mtsMode\"") != std::string::npos)) { - TrafficManagementAPI__TypesAndValues::MtsSessionInfo mts_session_info; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - mts_session_info.decode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.mtsSessionInfo() = mts_session_info; - } else if ((it->second[0] == '[') && (it->second.find("\"iotPlatformId\"") != std::string::npos)) { - IoTAPI__TypesAndValues::IotPlatformInfoList iot_platform_info_list; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); - iot_platform_info_list.decode(IoTAPI__TypesAndValues::IotPlatformInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.iotPlatformInfoList() = iot_platform_info_list; - } else if (it->second.find("\"detail\"") != std::string::npos) { + } + else if (it->second.find("\"detail\"") != std::string::npos) + { LibMec__TypesAndValues::ProblemDetails problem_details; problem_details.decode(LibMec__TypesAndValues::ProblemDetails_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.problemDetails() = problem_details; - } else { + } + else + { loggers::get_instance().warning("json_codec::decode: Unsupported variant"); return -1; } - loggers::get_instance().log_msg("<<< json_codec::decode: ", (const Base_Type&)msg); + loggers::get_instance().log_msg("<<< json_codec::decode: ", (const Base_Type &)msg); return 0; } diff --git a/ccsrc/Protocols/Json/json_codec_factory_mec015.hh b/ccsrc/Protocols/Json/json_codec_factory_mec015.hh new file mode 100644 index 0000000..d02ab43 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_factory_mec015.hh @@ -0,0 +1,46 @@ +/*! + * \file json_codec_factory_mec015.hh + * \brief Header file for ITS JSON/IP protocol codec factory. + * \author ETSI STF569 / TTF T027 + * \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. + * \version 0.1 + */ +#pragma once + +#include "codec_stack_builder.hh" + +#include "json_codec_mec015.hh" + +class Record_Type; //! TITAN forward declaration + +/*! + * \class json_codec_factory_mec015 + * \brief This class provides a factory class to create a json_codec class instance + */ +class json_codec_factory_mec015: public codec_factory { + static json_codec_factory_mec015 _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the json_codec_factory_mec015 class + * \remark The MEC015 codec identifier is json_codec_mec015 + */ + json_codec_factory_mec015() { + // register factory + codec_stack_builder::register_codec_factory("json_codec_mec015", this); + }; + /*! + * \fn codec* create_codec(const std::string & type, const std::string & param); + * \brief Create the codecs stack based on the provided codecs stack description + * \param[in] p_type The provided codecs stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + * \inline + */ + inline virtual codec_gen* create_codec() { + return (codec_gen*)new json_codec_mec015(); + }; +}; // End of class json_codec_factory_mec015 diff --git a/ccsrc/Protocols/Json/json_codec_mec015.cc b/ccsrc/Protocols/Json/json_codec_mec015.cc new file mode 100644 index 0000000..89772ac --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec015.cc @@ -0,0 +1,154 @@ +#include +#include +#include + +#include "json_codec_factory_mec015.hh" +#include "loggers.hh" +#include "LibHttp_JsonMessageBodyTypes.hh" + + +int json_codec_mec015::encode (const LibHttp__JsonMessageBodyTypes::JsonBody &msg, OCTETSTRING &data) +{ + loggers::get_instance().log_msg(">>> json_codec::encode: ", (const Base_Type &)msg); + + TTCN_EncDec::clear_error(); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_Buffer encoding_buffer; + + if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_bwInfo)) + { + const TrafficManagementAPI__TypesAndValues::BwInfo &bw_info = msg.bwInfo(); + bw_info.encode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + } + else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_bwchgeventsubscription)) + { + const TrafficManagementAPI__TypesAndValues::BwChgEventSubscription &bw_chg_event_subscription = msg.bwchgeventsubscription(); + bw_chg_event_subscription.encode(TrafficManagementAPI__TypesAndValues::BwChgEventSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + } + else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_mtsSessionInfo)) + { + const TrafficManagementAPI__TypesAndValues::MtsSessionInfo &mts_session_info = msg.mtsSessionInfo(); + mts_session_info.encode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + } + else + { + loggers::get_instance().error("json_codec::encode: Not supported"); + } + + loggers::get_instance().log("<<< json_codec::encode"); + return 0; +} + +int json_codec_mec015::decode(const OCTETSTRING &p_data, LibHttp__JsonMessageBodyTypes::JsonBody &msg, params *p_params) +{ + loggers::get_instance().log_msg(">>> json_codec::decode: p_data=", p_data); + + params::const_iterator it; + if (p_params == nullptr) + { + loggers::get_instance().warning("json_codec::decode: Failed to access p_params (null pointer)"); + return -1; + } + else + { + it = p_params->find("decode_str"); + if (it == p_params->cend()) + { + loggers::get_instance().warning("json_codec::decode: Failed to access p_params item (decode_str)"); + return -1; + } + } + + std::string str; + if ((it->second[0] != '[') && (it->second[0] != '{')) + { + int idx_begin = it->second.find(":"); + int idx_end = it->second.rfind("}") - 1; + str = it->second.substr(idx_begin + 1, idx_end - idx_begin); + } + else + { + str = it->second; + } + + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_EncDec::clear_error(); + TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + + if ((it->second.find("\"bwInfo\"") != std::string::npos) || (it->second.find("\"fixedBWPriority\"") != std::string::npos)) + { + while (true) + { + if (str.find("\"00\"") != std::string::npos) + str = regex_replace(str, regex("\"00\""), "\"Downlink\""); + else if (str.find("\"01\"") != std::string::npos) + str = regex_replace(str, regex("\"01\""), "\"Uplink\""); + else if (str.find("\"10\"") != std::string::npos) + str = regex_replace(str, regex("\"10\""), "\"Symmetrical\""); + else + break; + } + + if (it->second[0] == '[') + { + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + TrafficManagementAPI__TypesAndValues::BwInfoList bw_info_list; + bw_info_list.decode(TrafficManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.bwInfoList() = bw_info_list; + } + else + { + TrafficManagementAPI__TypesAndValues::BwInfo bw_info; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + bw_info.decode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.bwInfo() = bw_info; + } + } + else if ((it->second.find("\"_links\"") != std::string::npos) && (it->second.find("subscriptions\"") != std::string::npos)) + { + TrafficManagementAPI__TypesAndValues::SubscriptionLinkList subscription_link_list; + subscription_link_list.decode(TrafficManagementAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.subscriptionLinkList__bw() = subscription_link_list; + } + else if ((it->second.find("\"BwChgEventSubscription\"") != std::string::npos)) + { + TrafficManagementAPI__TypesAndValues::BwChgEventSubscription bw_chg_event_subscription; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + bw_chg_event_subscription.decode(TrafficManagementAPI__TypesAndValues::BwChgEventSubscription_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.bwchgeventsubscription() = bw_chg_event_subscription; + } + else if ((it->second.find("\"notificationType\"") != std::string::npos)) + { + TrafficManagementAPI__TypesAndValues::BwChgEventNotification bw_chg_event_notification; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + bw_chg_event_notification.decode(TrafficManagementAPI__TypesAndValues::BwChgEventNotification_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.bwChgEventNotification() = bw_chg_event_notification; + } + else if ((it->second.find("\"mtsCapabilityInfo\"") != std::string::npos) || (it->second.find("\"mtsAccessInfo\"") != std::string::npos)) + { + TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo mts_cap_info; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + mts_cap_info.decode(TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.mtsCapabilityInfo() = mts_cap_info; + } + else if ((it->second.find("\"mtsSessionInfo\"") != std::string::npos) || (it->second.find("\"mtsMode\"") != std::string::npos)) + { + TrafficManagementAPI__TypesAndValues::MtsSessionInfo mts_session_info; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + mts_session_info.decode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.mtsSessionInfo() = mts_session_info; + } + else + { + loggers::get_instance().warning("json_codec::decode: Unsupported variant"); + return -1; + } + + loggers::get_instance().log_msg("<<< json_codec::decode: ", (const Base_Type &)msg); + return 0; +} + +json_codec_factory_mec015 json_codec_factory_mec015::_f; diff --git a/ccsrc/Protocols/Json/json_codec_mec015.hh b/ccsrc/Protocols/Json/json_codec_mec015.hh new file mode 100644 index 0000000..a235de4 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec015.hh @@ -0,0 +1,24 @@ +#pragma once + +#include "codec_gen.hh" +#include "params.hh" +#include "json_codec.hh" + +class Base_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibHttp__JsonMessageBodyTypes { + class JsonBody; +} + +class json_codec_mec015: public json_codec +{ +public: + explicit json_codec_mec015() : json_codec() { }; + virtual ~json_codec_mec015() { }; + + int encode (const LibHttp__JsonMessageBodyTypes::JsonBody&, OCTETSTRING& data); + int decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody&, params* p_params = NULL); + +}; // End of class json_codec_mec015 diff --git a/ccsrc/Protocols/Json/module.mk b/ccsrc/Protocols/Json/module.mk index 3f873bb..270da2a 100644 --- a/ccsrc/Protocols/Json/module.mk +++ b/ccsrc/Protocols/Json/module.mk @@ -2,11 +2,10 @@ sources := \ json_codec.cc \ json_codec_mec011.cc \ json_codec_mec013.cc \ + json_codec_mec015.cc \ json_codec_mec030.cc \ json_codec_mec028.cc \ - json_codec_mec033.cc \ json_codec_mec040.cc \ - json_codec_mec046.cc \ includes := . diff --git a/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ b/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ index 5464190..e73de25 100644 --- a/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ +++ b/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ @@ -8,7 +8,7 @@ LibCommon_Time.PX_TAC := 30.0 LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0; LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0; -LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.39" +LibHttp_Pics.PICS_HEADER_HOST := "172.26.214.231" LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json" LibHttp_Pics.PICS_USE_TOKEN_HEADER := true @@ -33,9 +33,9 @@ LogEventTypes:= Yes [TESTPORT_PARAMETERS] # In this section you can specify parameters that are passed to Test Ports. -system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=192.168.1.12,port=30030,use_ssl=0)" +system.httpPort.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server=172.26.208.1,port=3002,use_ssl=0)" #system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=try-mec.etsi.org,port=443,use_ssl=1)" -system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server_mode=1,local_port=80,use_ssl=0)" +#system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server_mode=1,use_ssl=0)" [DEFINE] # In this section you can create macro definitions, @@ -107,7 +107,7 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server #Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_006_NF -// Multi-access Traffic Steering information Test Cases +# Multi-access Traffic Steering information Test Cases #Check that the IUT responds with the Multi-access Traffic Steering information when queried by a MEC Application #AtsMec_MultiAccessSteeringInfoAPI_TestCases.TC_MEC_MEC015_SRV_MTS_001_OK #Check that the IUT responds with the list of configured Multi-access Traffic Steering when queried by a MEC Application - none @@ -145,7 +145,7 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server #Check that the IUT responds with an error when a request with an unknown resource URI is sent by a MEC Application #AtsMec_MultiAccessSteeringInfoAPI_TestCases.TC_MEC_MEC015_SRV_MTS_006_NF -// BWM change event susbsciption Testcases +# BWM change event susbsciption Testcases #Check that the IUT responds with a list of BWM change event susbsciption when queried by a MEC Application #AtsMec_BandwidthChangeEventSubAPI_TestCases.TC_MEC_MEC015_SRV_BWMSUBLOOKUP_001_OK #Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application diff --git a/ttcn/AtsMec_TrafficManagement/AtsMec_BandwidthChangeEventSubAPI_TestCases.ttcn b/ttcn/AtsMec_TrafficManagement/AtsMec_BandwidthChangeEventSubAPI_TestCases.ttcn index 0bf8bcf..967d1e2 100644 --- a/ttcn/AtsMec_TrafficManagement/AtsMec_BandwidthChangeEventSubAPI_TestCases.ttcn +++ b/ttcn/AtsMec_TrafficManagement/AtsMec_BandwidthChangeEventSubAPI_TestCases.ttcn @@ -50,6 +50,7 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { var Headers v_headers; var BwChgEventSubscription v_bw_chg_event_subscription; var charstring v_subscription_id; + // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_BWMANAGEMENT_SUBCRIPTION_API_SUPPORTED)) { @@ -83,14 +84,15 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { mw_http_response_ok( mw_http_message_body_json( mw_body_json_bw_subscription_link_list( - mw_subscription_link_list( - { href := pattern "http?+" & PICS_ROOT_API & PX_ME_BWM_SUB_URI }, - superset( - mw_subscription( - v_bw_chg_event_subscription.links.self_.href, - "BwChgEventSubscription" - ) - ))))))) { + mw_subscription_link( + mw_subscription_link_list( + -, + superset( + mw_subscription( + v_bw_chg_event_subscription.links.self_.href, + "BwChgEventSubscription" + ) + )))))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a BW event subscription list ***"); @@ -254,14 +256,15 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { mw_http_response_ok( mw_http_message_body_json( mw_body_json_bw_subscription_link_list( - mw_subscription_link_list( - { href := pattern "http?+" & PICS_ROOT_API & PX_ME_BWM_SUB_URI }, - superset( - mw_subscription( - v_bw_chg_event_subscription.links.self_.href, - "BwChgEventSubscription" - ) - ))))))) { + mw_subscription_link( + mw_subscription_link_list( + -, + superset( + mw_subscription( + v_bw_chg_event_subscription.links.self_.href, + v_bw_chg_event_subscription.subscriptionType + ) + )))))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a BW event subscription list ***"); @@ -379,11 +382,11 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { v_bw_chg_event_subscription.callbackReference, -, mw_links( - v_bw_chg_event_subscription.links.self.href + v_bw_chg_event_subscription.links.self_ ), - mw_filter_criteria( - v_bw_chg_event_subscription.filterCriteria.appInsId - ) + v_bw_chg_event_subscription.filterCriteria + + )))))) { tc_ac.stop; @@ -451,7 +454,6 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { } // End of 'alt' statement // Postamble - f_delete_bw_chg_event_subscription(v_subscription_id); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_BWSUBLOOKUP_003_NF @@ -492,13 +494,15 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( - PX_BW_Subcription_type, + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + {m_filter_criteria(PX_APP_INSTANCE_ID,-)} )))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + tc_ac.start; alt { [] httpPort.receive( @@ -507,11 +511,11 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { mw_http_message_body_json( mw_body_json_bw_chg_event_subscription( mw_bw_chg_event_subscription( - PX_BW_Subcription_type, + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + {m_filter_criteria(PX_APP_INSTANCE_ID,-)} )))))) -> value v_response { tc_ac.stop; @@ -543,7 +547,6 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { } // End of testcase TC_MEC_MEC015_SRV_BW_SUB_NOT_001_OK - /** * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - Invalid subscriptionType */ @@ -577,7 +580,9 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_bw_chg_event_subscription( PX_UNKNOWN_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, - m_filter_Criteria + -, + -, + {m_filter_criteria} )))))); // Test Body @@ -634,11 +639,13 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( - PX_BW_Subcription_type, + PX_BW_SUBSCRIPTION_TYPE, -, -, -, - m_filter_criteria + { + m_filter_criteria + } )))))); // Test Body @@ -693,11 +700,11 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( - PX_BW_Subcription_Type, + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, { websocketUri := PX_BW_SUB_WEB_SOCKET, requestWebsocketUri := omit }, -, - m_filter_criteria + {m_filter_criteria} )))))); // Test Body @@ -753,11 +760,11 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( - PX_BW_Subcription_Type + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + {m_filter_criteria} )))))); tc_ac.start; @@ -768,12 +775,14 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { mw_http_message_body_json( mw_body_json_bw_chg_event_subscription( mw_bw_chg_event_subscription( - PX_BW_Subcription_Type + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria - )))))) -> value v_response { + { + m_filter_criteria + } + )))))) { tc_ac.stop; @@ -824,11 +833,16 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( - PX_BW_Subcription_Type + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + { + m_filter_criteria ( + -, + - + ) + } )))))); // Test Body tc_ac.start; @@ -972,8 +986,10 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { // Local variables var Headers v_headers; var HttpMessage v_response; + var BwChgEventSubscription v_bw_chg_event_subscription; var charstring v_subscription_id; + // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_BWMANAGEMENT_SUBCRIPTION_API_SUPPORTED)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_BWMANAGEMENT_SUBCRIPTION_API_SUPPORTED required for executing the TC ***"); @@ -989,34 +1005,33 @@ module AtsMec_BandwidthChangeEventSubAPI_TestCases { // Preamble f_create_bw_chg_event_subscription(v_bw_chg_event_subscription, v_subscription_id); + action("Trigger a event"); f_selfOrClientSyncAndVerdict(c_prDone, e_success); tc_wait.start; alt { [] httpPort_notif.receive( - mw_http_response( + mw_http_request( mw_http_request_post( -, -, mw_http_message_body_json( - mw_body_json__bw_chg_event_notification( + mw_body_json_bw_chg_event_notification( mw_bw_chg_event_notification( + PX_BW_NOTIFICATION_TYPE, -, - -, - mw_data_vol_dispersion( - 1024,PX_APP_INSTANCE_ID - ), - - + { + mw_data_vol_dispersion( + 1024,PX_APP_INSTANCE_ID,- + ) + }, + v_bw_chg_event_subscription.links )))))) -> value v_response { tc_wait.stop; f_init_default_headers_list(-, -, v_headers); - httpPort_notif.send( - m_http_response( - m_http_response_ok_no_body( - v_headers - ))); + httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers))); log("*** " & testcasename() & ": PASS: IUT successfully sends notification ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } diff --git a/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn b/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn index 091c223..b8cb2d9 100644 --- a/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn +++ b/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn @@ -785,7 +785,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & "mts/v0/mts_sessions/" & PX_UNKNOWN_APP_INSTANCE_ID, // Wrong version number + PICS_ROOT_API & "mts/v0/mts_sessions/" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")), // Wrong version number v_headers ) ) @@ -846,7 +846,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & PX_UNKNOWN_APP_INSTANCE_ID, + PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")), v_headers ) ) @@ -1156,7 +1156,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( - PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & PX_UNKNOWN_APP_INSTANCE_ID, + PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")), v_headers ))); diff --git a/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn b/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn index 50d2114..096ac87 100644 --- a/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn +++ b/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn @@ -118,7 +118,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & PX_APP_INSTANCE_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -173,7 +173,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?app_name=" & PX_APP_NAME, + PICS_ROOT_API & PX_ME_BWM_URI & "?app_name=" & oct2char(unichar2oct(PX_APP_NAME, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -230,7 +230,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & PX_APP_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & oct2char(unichar2oct(PX_APP_ALLOCATION_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -288,7 +288,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?appInstId=" & PX_APP_INSTANCE_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "?appInstId=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -339,7 +339,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & PX_UNKNOWN_APP_INSTANCE_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -390,7 +390,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?app_name=" & PX_UNKNOWN_APP_NAME, + PICS_ROOT_API & PX_ME_BWM_URI & "?app_name=" & oct2char(unichar2oct(PX_UNKNOWN_APP_NAME, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -441,7 +441,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & PX_UNKNOWN_APP_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & oct2char(unichar2oct(PX_UNKNOWN_APP_ALLOCATION_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -762,7 +762,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & PX_UNKNOWN_BW_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -1005,7 +1005,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & PX_UNKNOWN_BW_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_bw_info( @@ -1267,7 +1267,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_patch( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & PX_UNKNOWN_BW_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_bw_info_deltas( @@ -1386,7 +1386,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & PX_UNKNOWN_BW_ALLOCATION_ID, + PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), v_headers ))); diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn index e126aac..b6fcd66 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn @@ -124,10 +124,11 @@ module TrafficManagementAPI_Functions { m_http_message_body_json( m_body_json_bw_chg_event_subscription( m_bw_chg_event_subscription( + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + {m_filter_criteria(PX_APP_INSTANCE_ID,-)} )))))); tc_ac.start; alt { @@ -137,11 +138,15 @@ module TrafficManagementAPI_Functions { mw_http_message_body_json( mw_body_json_bw_chg_event_subscription( mw_bw_chg_event_subscription( - PX_BW_Subcription_type, + PX_BW_SUBSCRIPTION_TYPE, PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - m_filter_criteria + { + mw_filter_criteria( + PX_APP_INSTANCE_ID + ) + } )))))) -> value v_response { tc_ac.stop; @@ -154,7 +159,7 @@ module TrafficManagementAPI_Functions { "?+" & PX_ME_BWM_SUB_URI & "/(?*)", 0 ); - p_bw_chg_event_subscription := v_response.response.body.json_body.m_bw_chg_event_subscription; + p_bw_chg_event_subscription := v_response.response.body.json_body.bwchgeventsubscription; log("f_create_bw_chg_event_subscription: INFO: IUT successfully responds to the subscription: ", p_bw_chg_event_subscription); log("f_create_bw_chg_event_subscription: INFO: p_subscription_id: ", p_subscription_id); } diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn index 3abc8a6..79f1edb 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn @@ -29,7 +29,9 @@ module TrafficManagementAPI_Pixits { modulepar ResourceURL PX_RESOURCE_URL := "http://example.com/exampleAPI/location/v2/users?address:acr:192.0.0.1"; - modulepar Json.String PX_BW_Subcription_Type := "BwChgEventSubscription"; + modulepar Json.String PX_BW_SUBSCRIPTION_TYPE := "BwChgEventSubscription"; + + modulepar Json.String PX_BW_NOTIFICATION_TYPE := "BwChgEventNotification"; modulepar Json.String PX_BW_EVENT_SUB_CALLBACK_URI := "http://clientApp.example.com/location_notifications/123456"; diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn index 4d0300e..3f2abd0 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn @@ -120,20 +120,26 @@ module TrafficManagementAPI_Templates { } // End of template mw_session_filter template (omit) BwChgEventSubscription m_bw_chg_event_subscription( - in template (omit) Json.String p_subscription_type := ?, - in template (omit) Json.AnyURI p_callbackReference, + in Json.String p_subscription_type, + in template (omit) Json.AnyURI p_callbackReference := omit, in template (omit) WebsockNotifConfig p_websockNotifConfig := omit, in template (omit) Links p_links := omit, - in template (value) FlowFilter p_flowfilter := ? + in template (omit) FilterCriteria p_filtercriteria := omit ) := { subscriptionType := p_subscription_type, callbackReference := p_callbackReference, websockNotifConfig := p_websockNotifConfig, links := p_links, - filterCriteria := p_flowfilter + filterCriteria := p_filtercriteria } - template (omit) FilterCriteria m_filter_criteria( + template (present) Links m_links( + template (present) LinkType p_self := ? + ) := { + self_ := p_self + } // End of template m_links + + template (omit) FilterCriteria_ m_filter_criteria( in AppInsId p_appInsId := PX_APP_INSTANCE_ID, in template (omit) Json.String p_ueIp := omit ) := { @@ -142,66 +148,72 @@ module TrafficManagementAPI_Templates { } // End of template m_flowfilterW template (present) BwChgEventSubscription mw_bw_chg_event_subscription( - template (present) Json.String p_subscriptionType := ? + template (present) Json.String p_subscriptionType := ?, template (present) Json.AnyURI p_callbackReference := ?, - template WebsockNotifConfig p_websockNotifConfig := *, + template (omit) WebsockNotifConfig p_websockNotifConfig := omit, template Links p_links := *, - template (present) FlowFilter p_flowfilter := ? + template (present) FilterCriteria p_filtercriteria := ? ) := { subscriptionType := p_subscriptionType, callbackReference := p_callbackReference, websockNotifConfig := p_websockNotifConfig, links := p_links, - filterCriteria := p_flowfilter + filterCriteria := p_filtercriteria } - template (present) SubscriptionLinkList mw_subscription_link_list( - template (present) Links p_links := ?, - template Subscriptions p_subscription := * + template (present) SubscriptionLinkList mw_subscription_link( + template (present) SubscriptionLink_List p_links := ? + ) := { + links := p_links + } // End of template mw_subscription_link_list + + template (present) SubscriptionLink_List mw_subscription_link_list( + template LinkType p_links := *, + template (present) Subscriptions p_subscription := ? ) := { - links := p_links, - subscription := p_subscription + self_ := p_links, + subscriptions := p_subscription } // End of template mw_subscription_link_list template (present) Links mw_links( - template (value) LinkType p_self - ) :={ - self := p_self - } // End of template m_links + template (present) LinkType p_self := ? + ) := { + self_ := p_self + } // End of template mw_links template (present) Subscription mw_subscription( template (present) Json.AnyURI p_href := ?, template (present) Json.String p_subscriptionType := ? - ) := { + ) := { href := p_href, subscriptionType := p_subscriptionType } // End of template mw_subscription - - - template (present) FilterCriteria mw_filter_criteria( + template (present) FilterCriteria_ mw_filter_criteria( template Json.String p_appInsId := *, - template Json.String p_ueIp := * + template (omit) Json.String p_ueIp := omit ) := { appInsId := p_appInsId, ueIp := p_ueIp } // End of template m_flowfilterW - template (present) BwChgEventNotification mw_bw_chg_event_notificatipn( - template (present) Json.String p_notificationType := "BwChgEventNotification", - template TimeStamp p_timeStamp := ?, - template DataVolDispersion p_dataVolDispersion := *, - template Links p_links := ?, + template (present) BwChgEventNotification mw_bw_chg_event_notification( + template (present) Json.String p_notificationType := ?, + template TimeStamp p_timeStamp := *, + template (present) DataVolDispersion p_dataVolDispersion := ?, + template Links p_links := ? ) := { - appInsId := p_appInsId, - ueIp := p_ueIp + notificationType := p_notificationType, + timeStamp := p_timeStamp, + dataVolDispersion := p_dataVolDispersion, + links := p_links } // End of template mw_bw_chg_event_notificatipn - template (present) DataVolDispersion mw_data_vol_dispersion( - template (value) uint32 p_dataVol, - template (value) Json.String p_appInsId, - template (present) Json.String p_ueIp := ? + template (present) DataVolDispersion_ mw_data_vol_dispersion( + template (present) UInt32 p_dataVol, + template (present) Json.String p_appInsId, + template Json.String p_ueIp := * ) := { dataVol := p_dataVol, appInsId := p_appInsId, diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn index 0d3b625..1b8c4b7 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn @@ -3,6 +3,9 @@ module TrafficManagementAPI_TypesAndValues { // JSON import from Json all; + // LibCommon + import from LibCommon_BasicTypesAndValues all; + // LibMec import from LibMec_TypesAndValues all; @@ -212,8 +215,8 @@ module TrafficManagementAPI_TypesAndValues { * @see ETSI GS MEC 015 V3.1.1 (2024-04) Table 7.3.2: Attributes of the BwChgEventSubscription */ type record FilterCriteria_ { - Json.String appInsId optional, - Json.String ueIp optional + AppInsId appInsId optional, + Json.String ueIp optional } type set of FilterCriteria_ FilterCriteria @@ -224,12 +227,25 @@ module TrafficManagementAPI_TypesAndValues { * @see Table 7.3.3-1: Attributes of the SubscriptionLinkList */ type record SubscriptionLinkList { - Links links optional, // URI of this resource - Subscription subscriptions optional // List of subscriptions + SubscriptionLink_List links optional // URI of this resource } with { variant (links) "name as '_links'"; } + /** + * @desc List of links related to currently existing subscriptions for the service consumer + * @member links List of hyperlinks related to the resource + * @member subscription + * @see Table 7.3.3-1: Attributes of the SubscriptionLinkList + */ + type record SubscriptionLink_List { + LinkType self_, + Subscriptions subscriptions optional // List of subscriptions + } with { + variant (self_) "name as 'self'"; + } + + /** * @desc Hyperlink related to the resource * @see ETSI GS MEC 015 V3.1.1 (2024-03) Table 7.3.2: Attributes of the BwChgEventSubscription @@ -256,7 +272,7 @@ module TrafficManagementAPI_TypesAndValues { * @see Table 7.3.3-1: Attributes of the SubscriptionLinkList */ type record Subscription { - Json.AnyURI href // The URI referring to the subscription + Json.AnyURI href, // The URI referring to the subscription Json.String subscriptionType // Type of the subscription } type set of Subscription Subscriptions @@ -292,6 +308,7 @@ module TrafficManagementAPI_TypesAndValues { type set of DataVolDispersion_ DataVolDispersion + /** * @desc The information on access network connection * @member timeStamp Time stamp to indicate when the corresponding information elements are sent diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn index feb1ec9..6bc800b 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn @@ -84,8 +84,8 @@ module LibHttp_JsonMessageBodyTypes { BwInfo bwInfo, BwInfoDeltas bwInfoDeltas, BwChgEventSubscription bwchgeventsubscription, - TrafficManagementAPI_TypesAndValues.SubscriptionLinkList subscriptionLinkList_bw - BwChgEventNotification bwChgEventNotification + TrafficManagementAPI_TypesAndValues.SubscriptionLinkList subscriptionLinkList_bw, + BwChgEventNotification bwChgEventNotification, MtsCapabilityInfo mtsCapabilityInfo, MtsSessionInfo mtsSessionInfo, MtsSessionInfos mtsSessionInfos, diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn index 255ddcb..3e00be4 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn @@ -937,22 +937,22 @@ module LibHttp_JsonTemplates { bwchgeventsubscription := p_bwchgeventsubscription } // End - template (present) JsonBody mw_body_json_bw_chg_event_subscription( + template (present) JsonBody mw_body_json_bw_subscription_link_list( template (present) TrafficManagementAPI_TypesAndValues.SubscriptionLinkList p_subscriptionlinklist := ? ) := { - subscriptionLinkList := p_subscriptionlinklist + subscriptionLinkList_bw := p_subscriptionlinklist } // End - template (value) JsonBody m_body_json__bw_chg_event_notification( + template (value) JsonBody m_body_json_bw_chg_event_notification( in template (value) BwChgEventNotification p_bwchgeventnotification ) := { - mobilityProcedureNotification := p_mobilityProcedureNotification + bwChgEventNotification := p_bwchgeventnotification } // End of template m_body_json__bw_chg_event_notification - template (present) JsonBody mw_body_json__bw_chg_event_notification( + template (present) JsonBody mw_body_json_bw_chg_event_notification( template (present) BwChgEventNotification p_bwchgeventnotification := ? ) := { - mobilityProcedureNotification := p_mobilityProcedureNotification + bwChgEventNotification := p_bwchgeventnotification } // End of template mw_body_json__bw_chg_event_notification template (value) JsonBody m_body_json_mts_capability_info( -- GitLab From 78ed2ceea54b4ab75352c6a20113033e45fbf79f Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Wed, 2 Jul 2025 17:21:13 +0500 Subject: [PATCH 2/5] fix code bugs in MEC010-2 API --- ...ycleAndOperationGrantingAPI_TestCases.ttcn | 49 +++++++++++++------ .../module.mk | 1 - ...ycleAndOperationGrantingAPI_Functions.ttcn | 12 +++-- ...fecycleAndOperationGrantingAPI_Pixits.ttcn | 10 ++-- ...ycleAndOperationGrantingAPI_Templates.ttcn | 2 +- 5 files changed, 48 insertions(+), 26 deletions(-) diff --git a/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn b/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn index 02680c7..e11644d 100644 --- a/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn +++ b/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn @@ -623,7 +623,7 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { m_create_package_management( PX_APP_PKG_NAME, PX_APP_PKG_VERSION, - m_checksum(-, PX_CHECKSUM) + m_checksum(-,PX_CHECKSUM) )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -639,8 +639,9 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { -, mw_checksum, CREATED, - PX_OPERATIONAL_STATE, - PX_USAGE_STATE + -, + PX_USAGE_STATE, + - )))))) -> value v_response { tc_ac.stop; @@ -753,11 +754,11 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { { *, mw_app_pkg_info( - -, + v_app_pkg_info.id, mw_checksum, - PX_ONBOARDED_STATE, - PX_OPERATIONAL_STATE, - PX_USAGE_STATE, + CREATED, + -, + -, - ), * @@ -821,13 +822,14 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { { *, mw_app_pkg_info_onboarded( - -, -, + v_app_pkg_info.id, + -, PX_APP_PKG_NAME, PX_APP_PKG_VERSION, -, mw_checksum, -, - PX_ONBOARDED_STATE_ONBOARDED + PX_ONBOARDED_STATE_ONBOARDED ), * } @@ -938,7 +940,12 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { mw_http_message_body_json( mw_body_json_app_pkg_info( mw_app_pkg_info( - v_app_pkg_info.id + v_app_pkg_info.id, + -, + PX_ONBOARDED_STATE, + -, + PX_USAGE_STATE, + v_app_pkg_info.links )))))) -> value v_response { tc_ac.stop; @@ -996,11 +1003,22 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { mw_http_message_body_json( mw_body_json_app_pkg_info( mw_app_pkg_info_onboarded( - v_app_pkg_info.id + v_app_pkg_info.id, + v_app_pkg_info.appDId, + v_app_pkg_info.appName, + v_app_pkg_info.appSoftwareVersion, + v_app_pkg_info.appDVersion, + v_app_pkg_info.checksum, + -, + PX_ONBOARDED_STATE_ONBOARDED, + -, + -, + v_app_pkg_info.mecInfo, + v_app_pkg_info.links )))))) -> value v_response { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with an App Package ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with an Onboarded App Package ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -2213,7 +2231,7 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { -, mw_checksum, PX_ONBOARDED_STATE, - PX_OPERATIONAL_STATE, + PX_APPPKGINFO_OPERATIONAL_STATE, PX_USAGE_STATE ), * @@ -2286,7 +2304,7 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { ))))) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with an App Package list ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with an Onboarded App Package list ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -2388,7 +2406,8 @@ module AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases { mw_body_json_app_pkg_info( mw_app_pkg_info( v_app_pkg_info.id, - v_app_pkg_info.appDId + -, + PX_ONBOARDED_STATE_ONBOARDED )))))) { tc_ac.stop; diff --git a/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/module.mk b/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/module.mk index 9b2aa7c..13df0a9 100644 --- a/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/module.mk +++ b/ttcn/AtsMec_ApplicationPackageLifecycleAndOperationGranting/module.mk @@ -22,7 +22,6 @@ modules := ../LibCommon \ ../LibMec/WlanInformationAPI \ ../LibMec/FixedAccessInformationServiceAPI \ ../LibMec/ApplicationMobilityServiceAPI \ - ../LibMec/FederationEnablementAPI \ ../LibMec/IoTAPI \ ../../titan-test-system-framework/ccsrc/Framework \ ../../titan-test-system-framework/ccsrc/loggers \ diff --git a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Functions.ttcn b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Functions.ttcn index ecff7dd..243a912 100644 --- a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Functions.ttcn +++ b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Functions.ttcn @@ -143,11 +143,13 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Functions { mw_http_message_body_json( mw_body_json_app_pkg_info( mw_app_pkg_info( - -, -, - PX_APP_PKG_NAME, - PX_APP_PKG_VERSION, - -, - mw_checksum + -, + mw_checksum(-, PX_CHECKSUM), + CREATED, + -, + -, + - + )))))) -> value v_response { tc_ac.stop; diff --git a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits.ttcn b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits.ttcn index 2a037b2..cf91989 100644 --- a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits.ttcn +++ b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits.ttcn @@ -54,11 +54,13 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits { modulepar Json.String PX_APP_PKG_PATH := "APP_PKG_PATH"; - modulepar Json.String PX_ONBOARDED_STATE_ONBOARDED := "ONBOARDED"; + modulepar OnboardingState PX_ONBOARDED_STATE_ONBOARDED := ONBOARDED; - modulepar Json.String PX_ONBOARDED_STATE := "CREATED"; - - modulepar OperationalState PX_OPERATIONAL_STATE := "ENABLED"; + modulepar OnboardingState PX_ONBOARDED_STATE := CREATED; + + modulepar AppPkgInfo_OperationalState PX_APPPKGINFO_OPERATIONAL_STATE := ENABLED; + + modulepar OperationalState PX_OPERATIONAL_STATE := STARTED; modulepar UsageState PX_USAGE_STATE := NOT_IN_USE; diff --git a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Templates.ttcn b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Templates.ttcn index 3a9495d..2a39429 100644 --- a/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Templates.ttcn +++ b/ttcn/LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI/ttcn/ApplicationPackageLifecycleAndOperationGrantingAPI_Templates.ttcn @@ -189,7 +189,7 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Templates { in String p_appPkgName, in String p_appPkgVersion, in template (value) Checksum p_checksum, - in AnyURI p_appPkgPath + in template (omit) AnyURI p_appPkgPath := omit ) := { appPkgName := p_appPkgName, appPkgVersion := p_appPkgVersion, -- GitLab From 4aef2a380a7c720c84d60ce2682e55d5a385d4e0 Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Mon, 7 Jul 2025 10:30:38 +0500 Subject: [PATCH 3/5] validate MEC015 Traffic Management API and Multi-access Traffic Steering API --- ccsrc/Protocols/Json/json_codec_mec015.cc | 99 +++++++++-- ..._MultiAccessSteeringInfoAPI_TestCases.ttcn | 100 ++++++----- ...AtsMec_TrafficManagementAPI_TestCases.ttcn | 167 +++++++++++------- .../ttcn/TrafficManagementAPI_Functions.ttcn | 37 ++-- .../ttcn/TrafficManagementAPI_Pixits.ttcn | 12 +- .../ttcn/TrafficManagementAPI_Templates.ttcn | 9 +- .../TrafficManagementAPI_TypesAndValues.ttcn | 11 +- 7 files changed, 282 insertions(+), 153 deletions(-) diff --git a/ccsrc/Protocols/Json/json_codec_mec015.cc b/ccsrc/Protocols/Json/json_codec_mec015.cc index 89772ac..cd3c997 100644 --- a/ccsrc/Protocols/Json/json_codec_mec015.cc +++ b/ccsrc/Protocols/Json/json_codec_mec015.cc @@ -6,8 +6,7 @@ #include "loggers.hh" #include "LibHttp_JsonMessageBodyTypes.hh" - -int json_codec_mec015::encode (const LibHttp__JsonMessageBodyTypes::JsonBody &msg, OCTETSTRING &data) +int json_codec_mec015::encode(const LibHttp__JsonMessageBodyTypes::JsonBody &msg, OCTETSTRING &data) { loggers::get_instance().log_msg(">>> json_codec::encode: ", (const Base_Type &)msg); @@ -19,6 +18,24 @@ int json_codec_mec015::encode (const LibHttp__JsonMessageBodyTypes::JsonBody &ms { const TrafficManagementAPI__TypesAndValues::BwInfo &bw_info = msg.bwInfo(); bw_info.encode(TrafficManagementAPI__TypesAndValues::BwInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + // Convert raw buffer to string + std::string json_str((const char *)encoding_buffer.get_data(), encoding_buffer.get_len()); + + // Apply single substitution + if (json_str.find("\"Downlink\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Downlink\""), "\"00\""); + else if (json_str.find("\"Uplink\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Uplink\""), "\"01\""); + else if (json_str.find("\"Symmetrical\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Symmetrical\""), "\"10\""); + + // Set output + data = OCTETSTRING(json_str.length(), (const unsigned char *)json_str.c_str()); + } + else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_bwInfoDeltas)) + { + const TrafficManagementAPI__TypesAndValues::BwInfoDeltas &bw_info_deltas = msg.bwInfoDeltas(); + bw_info_deltas.encode(TrafficManagementAPI__TypesAndValues::BwInfoDeltas_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_bwchgeventsubscription)) @@ -31,14 +48,26 @@ int json_codec_mec015::encode (const LibHttp__JsonMessageBodyTypes::JsonBody &ms { const TrafficManagementAPI__TypesAndValues::MtsSessionInfo &mts_session_info = msg.mtsSessionInfo(); mts_session_info.encode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); - data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + // Convert raw buffer to string + std::string json_str((const char *)encoding_buffer.get_data(), encoding_buffer.get_len()); + + // Apply single substitution + if (json_str.find("\"Downlink\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Downlink\""), "\"00\""); + else if (json_str.find("\"Uplink\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Uplink\""), "\"01\""); + else if (json_str.find("\"Symmetrical\"") != std::string::npos) + json_str = std::regex_replace(json_str, std::regex("\"Symmetrical\""), "\"10\""); + + // Set output + data = OCTETSTRING(json_str.length(), (const unsigned char *)json_str.c_str()); } else { - loggers::get_instance().error("json_codec::encode: Not supported"); + return json_codec::encode(msg, data); } - loggers::get_instance().log("<<< json_codec::encode"); + loggers::get_instance().log("<<< json_codec_mec015::encode"); return 0; } @@ -78,7 +107,13 @@ int json_codec_mec015::decode(const OCTETSTRING &p_data, LibHttp__JsonMessageBod TTCN_EncDec::clear_error(); TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); - if ((it->second.find("\"bwInfo\"") != std::string::npos) || (it->second.find("\"fixedBWPriority\"") != std::string::npos)) + if (it->second == "[]") + { + msg.bwInfoList().set_size(0); // Assign bound empty list + return 0; + } + + if ((it->second.find("\"bwInfo\"") != std::string::npos) || (it->second.find("\"fixedBWPriority\"") != std::string::npos) || (it->second.find("\"allocationId\"") != std::string::npos)) { while (true) { @@ -94,9 +129,13 @@ int json_codec_mec015::decode(const OCTETSTRING &p_data, LibHttp__JsonMessageBod if (it->second[0] == '[') { - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + OCTETSTRING json_str_oct((int)str.length(), (const unsigned char *)str.c_str()); + loggers::get_instance().log_msg("Attempting to decode BwInfoList JSON string:", json_str_oct); + + TTCN_Buffer decoding_buffer_(json_str_oct); TrafficManagementAPI__TypesAndValues::BwInfoList bw_info_list; bw_info_list.decode(TrafficManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + loggers::get_instance().warning("Decoded BwInfoList successfully."); msg.bwInfoList() = bw_info_list; } else @@ -127,24 +166,54 @@ int json_codec_mec015::decode(const OCTETSTRING &p_data, LibHttp__JsonMessageBod bw_chg_event_notification.decode(TrafficManagementAPI__TypesAndValues::BwChgEventNotification_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); msg.bwChgEventNotification() = bw_chg_event_notification; } - else if ((it->second.find("\"mtsCapabilityInfo\"") != std::string::npos) || (it->second.find("\"mtsAccessInfo\"") != std::string::npos)) + else if ((it->second.find("\"mtsCapabilityInfo\"") != std::string::npos) || (it->second.find("\"mtsAccessInfo\"") != std::string::npos) || (it->second.find("\"allocationId\"") != std::string::npos)) { TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo mts_cap_info; TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); mts_cap_info.decode(TrafficManagementAPI__TypesAndValues::MtsCapabilityInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); msg.mtsCapabilityInfo() = mts_cap_info; } - else if ((it->second.find("\"mtsSessionInfo\"") != std::string::npos) || (it->second.find("\"mtsMode\"") != std::string::npos)) + else if ((it->second.find("\"mtsSessionInfo\"") != std::string::npos) || (it->second.find("\"sessionId\"") != std::string::npos)) { - TrafficManagementAPI__TypesAndValues::MtsSessionInfo mts_session_info; - TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); - mts_session_info.decode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); - msg.mtsSessionInfo() = mts_session_info; + while (true) + { + if (str.find("\"00\"") != std::string::npos) + str = regex_replace(str, regex("\"00\""), "\"Downlink\""); + else if (str.find("\"01\"") != std::string::npos) + str = regex_replace(str, regex("\"01\""), "\"Uplink\""); + else if (str.find("\"10\"") != std::string::npos) + str = regex_replace(str, regex("\"10\""), "\"Symmetrical\""); + else + break; + } + if (it->second[0] == '[') + { + OCTETSTRING json_str_oct((int)str.length(), (const unsigned char *)str.c_str()); + loggers::get_instance().log_msg("Attempting to decode mtsSessionInfoList JSON string:", json_str_oct); + + TTCN_Buffer decoding_buffer_(json_str_oct); + TrafficManagementAPI__TypesAndValues::MtsSessionInfos mts_session_infos; + mts_session_infos.decode(TrafficManagementAPI__TypesAndValues::MtsSessionInfos_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + loggers::get_instance().warning("Decoded mtsSessionInfoList successfully"); + msg.mtsSessionInfos() = mts_session_infos; + } + else + { + TrafficManagementAPI__TypesAndValues::MtsSessionInfo mts_session_info; + TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char *)str.c_str())); + mts_session_info.decode(TrafficManagementAPI__TypesAndValues::MtsSessionInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON); + msg.mtsSessionInfo() = mts_session_info; + } + } + else if (it->second.find("\"detail\"") != std::string::npos) + { + LibMec__TypesAndValues::ProblemDetails problem_details; + problem_details.decode(LibMec__TypesAndValues::ProblemDetails_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.problemDetails() = problem_details; } else { - loggers::get_instance().warning("json_codec::decode: Unsupported variant"); - return -1; + return json_codec::decode(p_data, msg, p_params); } loggers::get_instance().log_msg("<<< json_codec::decode: ", (const Base_Type &)msg); diff --git a/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn b/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn index b8cb2d9..4838dab 100644 --- a/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn +++ b/ttcn/AtsMec_TrafficManagement/AtsMec_MultiAccessSteeringInfoAPI_TestCases.ttcn @@ -141,13 +141,17 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { mw_mts_session_info( v_mts_session_info_1.appInsId, v_mts_session_info_1.requestType, - -, -, -, + -, + -, + -, v_mts_session_info_1.sessionId ), mw_mts_session_info( v_mts_session_info_2.appInsId, v_mts_session_info_2.requestType, - -, -, -, + -, + -, + -, v_mts_session_info_2.sessionId ), * @@ -209,16 +213,22 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_mts_session_info( - mw_mts_session_info( - v_mts_session_info.appInsId, - v_mts_session_info.requestType, - -, -, -, - v_mts_session_id - )))))) { + mw_body_json_mts_session_info_list( + { + *, + mw_mts_session_info( + v_mts_session_info.appInsId, + v_mts_session_info.requestType, + -,-,-, + v_mts_session_info.sessionId + ), + * + } + + ))))) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with an MtsSessionInfo list ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with an MtsSessionInfo list - app_instance_id ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -228,7 +238,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { } // End of 'alt' statement // Postamble - f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, v_mts_session_id); + f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8"))); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_MTS_002_OK_02 @@ -271,14 +281,19 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_mts_session_info( - mw_mts_session_info( - v_mts_session_info.appInsId, - v_mts_session_info.requestType, - -, -, -, - v_mts_session_id, - v_mts_session_info.appName - )))))) { + mw_body_json_mts_session_info_list( + { + *, + mw_mts_session_info( + v_mts_session_info.appInsId, + v_mts_session_info.requestType, + -, -, -, + v_mts_session_info.sessionId, + v_mts_session_info.appName + ), + * + } + ))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with an MtsSessionInfo list ***"); @@ -291,7 +306,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { } // End of 'alt' statement // Postamble - f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, v_mts_session_id); + f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8"))); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_MTS_002_OK_03 @@ -334,14 +349,19 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_mts_session_info( + mw_body_json_mts_session_info_list( + { + *, mw_mts_session_info( v_mts_session_info.appInsId, v_mts_session_info.requestType, -, -, -, v_mts_session_info.sessionId, v_mts_session_info.appName - )))))) { + ), + * + } + ))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with an MtsSessionInfo list ***"); @@ -506,7 +526,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_MTS_SESSION, // Request type m_qosd, // QoS - LowCost, // MtsMode + QoS, // MtsMode Downlink // TrafficDirection )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -584,7 +604,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { PX_APP_INSTANCE_ID, FLOW_SPECIFIC_MTS_SESSION, // Request type m_qosd, // QoS - LowCost, // MtsMode + QoS, // MtsMode Downlink, // TrafficDirection -, -, { m_flow_filter("10.10.10.10", 1010) } // FIXME Use PIXITs @@ -721,7 +741,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & v_mts_session_id, + PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8")), v_headers ))); @@ -741,7 +761,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { )))))) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with a MTS session ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -751,7 +771,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { } // End of 'alt' statement // Postamble - f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, v_mts_session_id); + f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8"))); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_MTS_004_OK @@ -794,12 +814,8 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_404_not_found( - mw_http_message_body_json( - mw_body_json_problem_details( - mw_problem_details( - -, -, 404 - )))))) { + mw_http_response_404_not_found + )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error code ***"); @@ -904,7 +920,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & v_mts_session_id, + PICS_ROOT_API & PX_ME_MTS_SESSIONS_URI & "/" & oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_mts_session_info( @@ -912,10 +928,10 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_MTS_SESSION, // Request type m_qosd_1, // QoS - LowCost, // MtsMode + QoS, // MtsMode Downlink // TrafficDirection )))))); - + f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { @@ -928,7 +944,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_MTS_SESSION, // Request type mw_qosd_1, // QoS - LowCost, // MtsMode + QoS, // MtsMode Downlink // TrafficDirection )))))) { tc_ac.stop; @@ -943,7 +959,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { } // End of 'alt' statement // Postamble - f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, v_mts_session_id); + f_delete_mts_session_info_resource(PX_APP_INSTANCE_ID, oct2char(unichar2oct(v_mts_session_info.sessionId, "UTF-8"))); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_MTS_005_OK @@ -980,10 +996,12 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases { m_body_json_mts_session_info( m_mts_session_info( // MEC015 Clause 7.2.5 Type: MtsSessionInfo Table 7.2.5-1: Elements of MtsSessionInfo, flowFilter shall be omit PX_APP_INSTANCE_ID, - FLOW_SPECIFIC_MTS_SESSION, // Request type + APPLICATION_SPECIFIC_MTS_SESSION, // Request type m_qosd_1, // QoS - LowCost, // MtsMode - Downlink // TrafficDirection + QoS, // MtsMode + Downlink, // TrafficDirection + -,-, + { m_flow_filter("10.10.10.10", 1010) } )))))); // Test Body diff --git a/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn b/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn index 096ac87..6a05b12 100644 --- a/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn +++ b/ttcn/AtsMec_TrafficManagement/AtsMec_TrafficManagementAPI_TestCases.ttcn @@ -47,7 +47,7 @@ module AtsMec_TrafficManagementAPI_TestCases { testcase TC_MEC_MEC015_SRV_TM_001_OK_01() runs on HttpComponent system HttpTestAdapter { // Local variables var Headers v_headers; - + // Test control if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED required for executing the TC ***"); @@ -77,7 +77,7 @@ module AtsMec_TrafficManagementAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_bw_info_list + mw_body_json_bw_info_list({}) )))) { tc_ac.stop; @@ -100,6 +100,8 @@ module AtsMec_TrafficManagementAPI_TestCases { testcase TC_MEC_MEC015_SRV_TM_001_OK_02() runs on HttpComponent system HttpTestAdapter { // Local variables var Headers v_headers; + var charstring v_bw_allocation_id; + var BwInfo v_bw_info; // Test control if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { @@ -114,6 +116,7 @@ module AtsMec_TrafficManagementAPI_TestCases { // Test adapter configuration // Preamble + f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( @@ -130,13 +133,19 @@ module AtsMec_TrafficManagementAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_bw_info( - mw_bw_info( - PX_APP_INSTANCE_ID - )))))) { + mw_body_json_bw_info_list( + { + *, + mw_bw_info( + PX_APP_INSTANCE_ID + ), + * + } + + ))))) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with the required BwInfo ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with the required BwInfo List***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -146,6 +155,7 @@ module AtsMec_TrafficManagementAPI_TestCases { } // End of 'alt' statement // Postamble + f_delete_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_TM_001_OK_02 @@ -155,6 +165,8 @@ module AtsMec_TrafficManagementAPI_TestCases { testcase TC_MEC_MEC015_SRV_TM_001_OK_03() runs on HttpComponent system HttpTestAdapter { // Local variables var Headers v_headers; + var charstring v_bw_allocation_id; + var BwInfo v_bw_info; // Test control if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { @@ -169,6 +181,7 @@ module AtsMec_TrafficManagementAPI_TestCases { // Test adapter configuration // Preamble + f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( @@ -185,12 +198,17 @@ module AtsMec_TrafficManagementAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_bw_info( - mw_bw_info( - PX_APP_INSTANCE_ID, - -, -, -, - PX_APP_NAME - )))))) { + mw_body_json_bw_info_list( + { + *, + mw_bw_info( + PX_APP_INSTANCE_ID, + -, -, -, + PX_APP_NAME + ), + * + } + ))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with the required BwInfo ***"); @@ -203,6 +221,7 @@ module AtsMec_TrafficManagementAPI_TestCases { } // End of 'alt' statement // Postamble + f_delete_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_TM_001_OK_03 @@ -212,6 +231,9 @@ module AtsMec_TrafficManagementAPI_TestCases { testcase TC_MEC_MEC015_SRV_TM_001_OK_04() runs on HttpComponent system HttpTestAdapter { // Local variables var Headers v_headers; + var charstring v_bw_allocation_id; + var BwInfo v_bw_info; + // Test control if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { @@ -226,11 +248,12 @@ module AtsMec_TrafficManagementAPI_TestCases { // Test adapter configuration // Preamble + f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & oct2char(unichar2oct(PX_APP_ALLOCATION_ID, "UTF-8")), + PICS_ROOT_API & PX_ME_BWM_URI & "?session_id=" & oct2char(unichar2oct(v_bw_info.allocationId, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -242,16 +265,21 @@ module AtsMec_TrafficManagementAPI_TestCases { mw_http_response( mw_http_response_ok( mw_http_message_body_json( - mw_body_json_bw_info( - mw_bw_info( - PX_APP_INSTANCE_ID, - -, -, -, - PX_APP_NAME, - PX_APP_ALLOCATION_ID - )))))) { + mw_body_json_bw_info_list( + { + *, + mw_bw_info( + PX_APP_INSTANCE_ID, + -, -, -, + PX_APP_NAME, + v_bw_info.allocationId + ), + * + } + ))))) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with the required BwInfo ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with the required BwInfo - session_id ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -261,6 +289,7 @@ module AtsMec_TrafficManagementAPI_TestCases { } // End of 'alt' statement // Postamble + f_delete_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id); f_cf_01_http_down(); } // End of testcase TC_MEC_MEC015_SRV_TM_001_OK_04 @@ -494,7 +523,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + PICS_ROOT_API & PX_ME_BWM_URI, v_headers, m_http_message_body_json( m_body_json_bw_info( @@ -526,7 +555,7 @@ module AtsMec_TrafficManagementAPI_TestCases { // Check HTTP Location header if (f_check_headers(v_response.response.header) == false) { - log("*** " & testcasename() & ": FAIL: IUT failed in Area subscription ***"); + log("*** " & testcasename() & ": FAIL: IUT failed in creation of a bandwidthAllocation resource ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_error); } else { var charstring_list v_header_location; @@ -540,6 +569,7 @@ module AtsMec_TrafficManagementAPI_TestCases { log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo, CreationID: ", v_bw_allocation_id," ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } + } [] tc_ac.timeout { log("*** " & testcasename() & ": INCONC: Expected message not received ***"); @@ -576,7 +606,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + PICS_ROOT_API & PX_ME_BWM_URI, v_headers, m_http_message_body_json( m_body_json_bw_info( @@ -587,7 +617,7 @@ module AtsMec_TrafficManagementAPI_TestCases { Downlink, PX_APP_NAME, PX_APP_ALLOCATION_ID, - { m_session_filter("10.10.10.10", 1010) } // FIXME Use PIXITs + { m_session_filter(PX_SESSION_IPv4, PX_SESSION_PORT), m_session_filter(PX_SESSION_IPv4, PX_SESSION_PORT) } // sessionFilter shall be omitted when APPLICATION_SPECIFIC_BW_ALLOCATION )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -637,7 +667,7 @@ module AtsMec_TrafficManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + PICS_ROOT_API & PX_ME_BWM_URI, v_headers, m_http_message_body_json( m_body_json_bw_info( @@ -816,18 +846,21 @@ module AtsMec_TrafficManagementAPI_TestCases { f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); } f_init_default_headers_list(-, -, v_headers); + httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & v_bw_allocation_id, - v_headers, - m_http_message_body_json( + PICS_ROOT_API & PX_ME_BWM_URI & "/" & v_bw_allocation_id, + v_headers, + m_http_message_body_json( m_body_json_bw_info( m_bw_info( PX_APP_INSTANCE_ID, - APPLICATION_SPECIFIC_BW_ALLOCATION, // Request type - "2048", // FixedAllocation - Downlink // AllocationDirection + APPLICATION_SPECIFIC_BW_ALLOCATION, + "2048", + Downlink, + PX_APP_NAME, + PX_APP_ALLOCATION_ID )))))); // Test Body @@ -887,15 +920,15 @@ module AtsMec_TrafficManagementAPI_TestCases { f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); } f_init_default_headers_list(-, -, v_headers); - v_bw_info.sessionFilter := { valueof(m_session_filter("10.10.10.10", 1010)) }; // FIXME Use PIXITs + v_bw_info.sessionFilter := { valueof(m_session_filter(PX_SESSION_IPv4, PX_SESSION_PORT)) }; // FIXME Use PIXITs httpPort.send( m_http_request( - m_http_request_put( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & v_bw_allocation_id, - v_headers, - m_http_message_body_json( - m_body_json_bw_info( - v_bw_info + m_http_request_put( + PICS_ROOT_API & PX_ME_BWM_URI & "/" & v_bw_allocation_id, + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + v_bw_info ))))); // Test Body @@ -944,9 +977,9 @@ module AtsMec_TrafficManagementAPI_TestCases { // Preamble f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); - if (v_bw_allocation_id == "") { - f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); - } + // if (v_bw_allocation_id == "") { + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // } f_init_default_headers_list(-, -, v_headers); v_bw_info.requestType := SESSION_SPECIFIC_BW_ALLOCATION; httpPort.send( @@ -998,23 +1031,26 @@ module AtsMec_TrafficManagementAPI_TestCases { // Test component configuration f_cf_01_http_up(); - - // Test adapter configuration - + + // oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), + // Preamble + f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), - v_headers, - m_http_message_body_json( + PICS_ROOT_API & PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_BW_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( m_body_json_bw_info( m_bw_info( PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_BW_ALLOCATION, - "2048", // FixedAllocation - Downlink - )))))); + "2048", + Downlink, + PX_APP_NAME, + PX_UNKNOWN_BW_ALLOCATION_ID + )))))); // Test Body tc_ac.start; @@ -1074,7 +1110,8 @@ module AtsMec_TrafficManagementAPI_TestCases { m_body_json_bw_info_deltas( m_bw_info_deltas( PX_APP_INSTANCE_ID, - APPLICATION_SPECIFIC_BW_ALLOCATION + APPLICATION_SPECIFIC_BW_ALLOCATION, + v_bw_info.allocationId )))))); // Test Body @@ -1145,7 +1182,7 @@ module AtsMec_TrafficManagementAPI_TestCases { PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_BW_ALLOCATION, v_bw_info.allocationId, - { m_session_filter("10.10.10.10", 1010) } // FIXME Use PIXITs + { m_session_filter(PX_SESSION_IPv4, PX_SESSION_PORT) } // FIXME Use PIXITs )))))); // Test Body @@ -1213,7 +1250,7 @@ module AtsMec_TrafficManagementAPI_TestCases { PX_APP_INSTANCE_ID, SESSION_SPECIFIC_BW_ALLOCATION, v_bw_info.allocationId - //{ m_session_filter("10.10.10.10", 1010) } sessionFilter shall be present + //{ m_session_filter(PX_SESSION_IPv4, PX_SESSION_PORT) } sessionFilter shall be present )))))); // Test Body @@ -1321,9 +1358,9 @@ module AtsMec_TrafficManagementAPI_TestCases { // Preamble f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); - if (v_bw_allocation_id == "") { - f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); - } + // if (v_bw_allocation_id == "") { + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // } f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( @@ -1344,6 +1381,7 @@ module AtsMec_TrafficManagementAPI_TestCases { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds to deletion ***"); + setverdict(pass, "IUT successfully responds to deletion"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -1379,9 +1417,9 @@ module AtsMec_TrafficManagementAPI_TestCases { // Preamble f_create_bw_allocation_resource(PX_APP_INSTANCE_ID, v_bw_allocation_id, v_bw_info); - if (v_bw_allocation_id == "") { - f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); - } + // if (v_bw_allocation_id == "") { + // f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + // } f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( @@ -1395,11 +1433,10 @@ module AtsMec_TrafficManagementAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_204_no_content - )) { + mw_http_response_404_not_found + )) { tc_ac.stop; - - log("*** " & testcasename() & ": PASS: IUT successfully responds to deletion ***"); + log("*** " & testcasename() & ": PASS: IUT responds with an error when a request for an unknown URI is sent by a MEC Application ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn index b6fcd66..b164253 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Functions.ttcn @@ -36,20 +36,23 @@ module TrafficManagementAPI_Functions { var HttpMessage v_response; p_bw_allocation_id := ""; + f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( - m_http_request_post( - PICS_ROOT_API & PX_ME_BWM_URI, - v_headers, - m_http_message_body_json( + m_http_request_post( + PICS_ROOT_API & PX_ME_BWM_URI, + v_headers, + m_http_message_body_json( m_body_json_bw_info( m_bw_info( p_app_instance_id, - APPLICATION_SPECIFIC_BW_ALLOCATION, // Request type - "1024", // FixedAllocation - Downlink // AllocationDirection - )))))); + APPLICATION_SPECIFIC_BW_ALLOCATION, + "1024", + Downlink, + PX_APP_NAME, + PX_APP_ALLOCATION_ID + )))))); tc_ac.start; alt { [] httpPort.receive( @@ -59,11 +62,9 @@ module TrafficManagementAPI_Functions { mw_body_json_bw_info( mw_bw_info( p_app_instance_id - )))))) -> value v_response { - var charstring_list v_header_location; - + )))))) -> value v_response { + // var charstring_list v_header_location; tc_ac.stop; - log("f_create_bw_allocation_resource: BwInfo resource created: ", v_response); f_get_header(valueof(v_response.response.header), "Location", v_header_location); p_bw_allocation_id := regexp( @@ -128,7 +129,7 @@ module TrafficManagementAPI_Functions { PX_BW_EVENT_SUB_CALLBACK_URI, -, -, - {m_filter_criteria(PX_APP_INSTANCE_ID,-)} + {m_filter_criteria(-,-)} )))))); tc_ac.start; alt { @@ -218,9 +219,11 @@ module TrafficManagementAPI_Functions { PX_APP_INSTANCE_ID, APPLICATION_SPECIFIC_MTS_SESSION, // Request type m_qosd, // QoS - LowCost, // MtsMode - Downlink // TrafficDirection - )))))); + QoS, // MtsMode + Downlink, // TrafficDirection + -, + PX_APP_NAME + )))))); tc_ac.start; alt { [] httpPort.receive( @@ -241,6 +244,8 @@ module TrafficManagementAPI_Functions { p_mts_session_id := v_mts_session_info_id[0]; p_mts_session_info := v_response.response.body.json_body.mtsSessionInfo; } + p_mts_session_info := v_response.response.body.json_body.mtsSessionInfo; + log("f_create_mts_session_info_resource: BwInfo resource created: ", p_mts_session_info); } [] tc_ac.timeout { log("f_create_mts_session_info_resource: Expected message not received"); diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn index 79f1edb..442f5e3 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Pixits.ttcn @@ -8,16 +8,18 @@ module TrafficManagementAPI_Pixits { // LibMec/TrafficManagementAPI import from TrafficManagementAPI_TypesAndValues all; - // LibMec/LocationAPI - import from LocationAPI_TypesAndValues all; - modulepar Json.String PX_APP_INSTANCE_ID := "appInst01"; + modulepar Json.String PX_APP_INSTANCE_ID := "81c51643-8c6f-4781-ad45-f8a457ca549b"; modulepar Json.String PX_APP_INSTANCE_ID_2 := "appInst02"; - modulepar Json.String PX_APP_ALLOCATION_ID := "appAllocationId01"; + modulepar Json.String PX_APP_ALLOCATION_ID := "1"; modulepar Json.String PX_APP_NAME := "appName01"; + + modulepar Json.String PX_SESSION_IPv4 := "10.10.10.10"; + + modulepar Json.String PX_SESSION_PORT := "1010"; modulepar Json.String PX_UNKNOWN_APP_INSTANCE_ID := "appInst99"; @@ -26,8 +28,6 @@ module TrafficManagementAPI_Pixits { modulepar Json.String PX_UNKNOWN_APP_ALLOCATION_ID := "appAllocationId99"; modulepar Json.String PX_UNKNOWN_BW_ALLOCATION_ID := "bwAllocationId99"; - - modulepar ResourceURL PX_RESOURCE_URL := "http://example.com/exampleAPI/location/v2/users?address:acr:192.0.0.1"; modulepar Json.String PX_BW_SUBSCRIPTION_TYPE := "BwChgEventSubscription"; diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn index 3f2abd0..d57cdb8 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_Templates.ttcn @@ -14,7 +14,7 @@ module TrafficManagementAPI_Templates { import from TrafficManagementAPI_Pixits all; template (omit) BwInfo m_bw_info( - in AppInsId p_appInsId := PX_APP_INSTANCE_ID, + in AppInsId p_appInsId, in BwRequestType p_requestType, in FixedAllocation p_fixedAllocation, in AllocationDirection p_allocationDirection, @@ -161,7 +161,6 @@ module TrafficManagementAPI_Templates { filterCriteria := p_filtercriteria } - template (present) SubscriptionLinkList mw_subscription_link( template (present) SubscriptionLink_List p_links := ? ) := { @@ -265,7 +264,7 @@ module TrafficManagementAPI_Templates { template MtsSessionInfo mw_mts_session_info( template (present) AppInsId p_appInsId := ?, template (present) MtsRequestType p_requestType := ?, - template (present) QosD p_qosD := ?, + template QosD p_qosD := *, template (present) MtsMode p_mtsMode := ?, template (present) TrafficDirection p_trafficDirection := ?, template SessionId p_sessionId := *, @@ -286,7 +285,7 @@ module TrafficManagementAPI_Templates { template (omit) FlowFilterItem m_flow_filter( in template (value) SourceIp p_sourceIp, - in template (value) SourcePort p_sourcePort, + in template (value) Json.UInteger p_sourcePort, in template (omit) DstAddress p_dstIp := omit, in template (omit) DstPort p_dstPort := omit, in template (omit) Protocol p_protocol := omit, @@ -304,7 +303,7 @@ module TrafficManagementAPI_Templates { template FlowFilterItem mw_flow_filter( template (present) SourceIp p_sourceIp := ?, - template (present) SourcePort p_sourcePort := ?, + template (present) Json.UInteger p_sourcePort := ?, template DstAddress p_dstIp := *, template DstPort p_dstPort := *, template Protocol p_protocol := *, diff --git a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn index 1b8c4b7..781e242 100644 --- a/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/TrafficManagementAPI/ttcn/TrafficManagementAPI_TypesAndValues.ttcn @@ -31,7 +31,7 @@ module TrafficManagementAPI_TypesAndValues { FixedBWPriority fixedBWPriority optional, FixedAllocation fixedAllocation, AllocationDirection allocationDirection - } + } type set of BwInfo BwInfoList; /** @@ -142,6 +142,7 @@ module TrafficManagementAPI_TypesAndValues { * @desc The direction of the requested BW allocation * @see ETSI GS MEC 015 V3.1.1 (2024-04) Clause 7.2.2 Type: BwInfo */ + type enumerated AllocationDirection { Downlink, Uplink, @@ -158,7 +159,7 @@ module TrafficManagementAPI_TypesAndValues { * @desc Source port identity of session * @see ETSI GS MEC 015 V3.1.1 (2024-04) Clause 7.2.2 Type: BwInfo */ - type Json.UInteger SourcePort; + type Json.String SourcePort; /** * @desc Destination address identity of session (including range) @@ -409,8 +410,8 @@ type set of DataVolDispersion_ DataVolDispersion AppInsId appInsId, Json.String appName optional, MtsRequestType requestType, - FlowFilter flowFilter, - QosD qosD, + FlowFilter flowFilter optional, + QosD qosD optional, MtsMode mtsMode, TrafficDirection trafficDirection } @@ -435,7 +436,7 @@ type set of DataVolDispersion_ DataVolDispersion */ type record FlowFilterItem { SourceIp sourceIp optional, - SourcePort sourcePort optional, + Json.UInteger sourcePort optional, DstAddress dstIp optional, DstPort dstPort optional, Protocol protocol optional, -- GitLab From 90eff7af96c0014050af87a74486b37f41a87b06 Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Wed, 9 Jul 2025 13:57:12 +0500 Subject: [PATCH 4/5] validate and bug fixes MEC016 --- .../Json/json_codec_factory_mec016.hh | 46 ++++ ccsrc/Protocols/Json/json_codec_mec016.cc | 93 ++++++++ ccsrc/Protocols/Json/json_codec_mec016.hh | 24 +++ ccsrc/Protocols/Json/module.mk | 1 + .../AtsMec_DeviceApplicationInterface.cfg | 115 ++++++++++ .../AtsMec_TrafficManagement.cfg_ | 23 +- ...viceApplicationInterfaceAPI_TestCases.ttcn | 203 ++++++++++-------- ...viceApplicationInterfaceAPI_Functions.ttcn | 21 +- .../DeviceApplicationInterfaceAPI_Pixits.ttcn | 42 ++-- ...viceApplicationInterfaceAPI_Templates.ttcn | 23 +- ...pplicationInterfaceAPI_TypesAndValues.ttcn | 41 ++-- ttcn/LibMec/ttcn/LibMec_Pixits.ttcn | 6 + 12 files changed, 493 insertions(+), 145 deletions(-) create mode 100644 ccsrc/Protocols/Json/json_codec_factory_mec016.hh create mode 100644 ccsrc/Protocols/Json/json_codec_mec016.cc create mode 100644 ccsrc/Protocols/Json/json_codec_mec016.hh create mode 100644 etc/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterface.cfg diff --git a/ccsrc/Protocols/Json/json_codec_factory_mec016.hh b/ccsrc/Protocols/Json/json_codec_factory_mec016.hh new file mode 100644 index 0000000..a6dd5b9 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_factory_mec016.hh @@ -0,0 +1,46 @@ +/*! + * \file json_codec_factory_mec013.hh + * \brief Header file for ITS JSON/IP protocol codec factory. + * \author ETSI STF569 / TTF T027 + * \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. + * \version 0.1 + */ +#pragma once + +#include "codec_stack_builder.hh" + +#include "json_codec_mec016.hh" + +class Record_Type; //! TITAN forward declaration + +/*! + * \class json_codec_factory_mec013 + * \brief This class provides a factory class to create an json_codec class instance + */ +class json_codec_factory_mec016: public codec_factory { + static json_codec_factory_mec016 _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the json_codec_factory_mec013 class + * \remark The HELD/IP codec identifier is HELD + */ + json_codec_factory_mec016() { + // register factory + codec_stack_builder::register_codec_factory("json_codec_mec016", this); + }; + /*! + * \fn codec* create_codec(const std::string & type, const std::string & param); + * \brief Create the codecs stack based on the provided codecs stack description + * \param[in] p_type The provided codecs stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + * \inline + */ + inline virtual codec_gen* create_codec() { + return (codec_gen*)new json_codec_mec016(); + }; +}; // End of class json_codec_factory_mec013 diff --git a/ccsrc/Protocols/Json/json_codec_mec016.cc b/ccsrc/Protocols/Json/json_codec_mec016.cc new file mode 100644 index 0000000..eccd133 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec016.cc @@ -0,0 +1,93 @@ +#include +#include +#include + +#include "json_codec_factory_mec016.hh" + +#include "loggers.hh" +#include "LibHttp_JsonMessageBodyTypes.hh" + +int json_codec_mec016::encode(const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTETSTRING& data) { + loggers::get_instance().log_msg(">>> json_codec_mec016::encode: ", (const Base_Type&)msg); + + TTCN_EncDec::clear_error(); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_Buffer encoding_buffer; + + // Application Context + if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_appContext__device__info)) { + const DeviceApplicationInterfaceAPI__TypesAndValues::AppContext& ctx = msg.appContext__device__info(); + ctx.encode(DeviceApplicationInterfaceAPI__TypesAndValues::AppContext_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + //data = char2oct(CHARSTRING("{\"appContext\": ")) + OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()) + char2oct(CHARSTRING("}")); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_applicationLocationAvailability)) { + const DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationLocationAvailability& ctx = msg.applicationLocationAvailability(); + ctx.encode(DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationLocationAvailability_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data()); + } + // // Fallback to generic codec + else { + return json_codec::encode(msg, data); + } + + loggers::get_instance().log("<<< json_codec_mec016::encode"); + return 0; +} + +int json_codec_mec016::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody& msg, params* p_params) { + + loggers::get_instance().log_msg(">>> json_codec_mec016::decode: p_data=", p_data); + + // Sanity checks + params::const_iterator it; + if (p_params == nullptr) { + loggers::get_instance().warning("json_codec_mec016::decode: Failed to access p_params (null pointer)"); + return -1; // TODO Use p_data instead of return -1 + } else { + it = p_params->find("decode_str"); + if (it == p_params->cend()) { + loggers::get_instance().warning("json_codec_mec016::decode: Failed to access p_params item (decode_str)"); + return -1; // TODO Use p_data instead of return -1 + } + loggers::get_instance().log("json_codec_mec016::decode: it->second='%c' / '%s'", it->second.c_str()[0], it->second.c_str()); + } + + // Remove data structure name (if present) ... + std::string str; + if ((it->second[0] != '[') && (it->second[0] != '{')) { + int idx_begin = it->second.find(":"); + int idx_end = it->second.rfind("}") - 1; // Remove the last '}' + str = it->second.substr(idx_begin + 1, idx_end - idx_begin); + } else { + str = it->second; + } + + + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_EncDec::clear_error(); + loggers::get_instance().log("json_codec_mec016::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str()); + TTCN_Buffer decoding_buffer(OCTETSTRING(str.size(), (const unsigned char*)str.c_str())); + + // Determine body type by finding JSON field name + if ((str.find("\"userAppInstanceInfo\"") != std::string::npos) && (str.find("\"appInfo\"") != std::string::npos)) { + DeviceApplicationInterfaceAPI__TypesAndValues::AppContext ctx; + ctx.decode(DeviceApplicationInterfaceAPI__TypesAndValues::AppContext_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.appContext__device__info() = ctx; + } else if ((str.find("\"appList\"") != std::string::npos) && (str.find("\"appInfo\"") != std::string::npos)) { + DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationList ctx; + ctx.decode(DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.applicationList() = ctx; + } else if ((it->second.find("\"appInfo\"") != std::string::npos) && (str.find("\"availableLocations\"") != std::string::npos)) { + DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationLocationAvailability application_location_availability; + application_location_availability.decode(DeviceApplicationInterfaceAPI__TypesAndValues::ApplicationLocationAvailability_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.applicationLocationAvailability() = application_location_availability; + } else { + return json_codec::decode(p_data, msg, p_params); + } + + loggers::get_instance().log_msg("<<< json_codec_mec016::decode: ", (const Base_Type&)msg); + return 0; +} + +// Register codec factory +json_codec_factory_mec016 json_codec_factory_mec016::_f; diff --git a/ccsrc/Protocols/Json/json_codec_mec016.hh b/ccsrc/Protocols/Json/json_codec_mec016.hh new file mode 100644 index 0000000..f8e194d --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec016.hh @@ -0,0 +1,24 @@ +#pragma once + +#include "codec_gen.hh" +#include "params.hh" +#include "json_codec.hh" + +class Base_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibHttp__JsonMessageBodyTypes { + class JsonBody; +} + +class json_codec_mec016: public json_codec +{ +public: + explicit json_codec_mec016() : json_codec() { }; + virtual ~json_codec_mec016() { }; + + int encode (const LibHttp__JsonMessageBodyTypes::JsonBody&, OCTETSTRING& data); + int decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody&, params* p_params = NULL); + +}; // End of class json_codec_mec013 diff --git a/ccsrc/Protocols/Json/module.mk b/ccsrc/Protocols/Json/module.mk index 270da2a..2978aa9 100644 --- a/ccsrc/Protocols/Json/module.mk +++ b/ccsrc/Protocols/Json/module.mk @@ -3,6 +3,7 @@ sources := \ json_codec_mec011.cc \ json_codec_mec013.cc \ json_codec_mec015.cc \ + json_codec_mec016.cc \ json_codec_mec030.cc \ json_codec_mec028.cc \ json_codec_mec040.cc \ diff --git a/etc/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterface.cfg b/etc/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterface.cfg new file mode 100644 index 0000000..27b44cf --- /dev/null +++ b/etc/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterface.cfg @@ -0,0 +1,115 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT roles + +LibCommon_Time.PX_TAC := 30.0 +#LibCommon_Time.PX_TWAIT := 30.0 +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0; + +LibHttp_Pics.PICS_HEADER_HOST := "192.168.40.50" + +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json" +LibHttp_Pics.PICS_USE_TOKEN_HEADER := true +#LibHttp_Pics.PICS_TOKEN_HEADER := "Basic WrongToken" + +#LibMec_Pics.PICS_ROOT_API := "/sbxnfzm34p/mep1/" + +# LibMec_Pixits +DeviceApplicationInterfaceAPI_Pixits.PX_APP_INSTANCE_ID := "81c51643-8c6f-4781-ad45-f8a457ca549b" +# DeviceApplicationInterfaceAPI_Pixits.PX_APPD_ID := "onboarded-demo4" +# DeviceApplicationInterfaceAPI_Pixits.PX_APP_DESCRIPTION := "Basic HTTP" +# DeviceApplicationInterfaceAPI_Pixits.PX_APP_PROVIDER := "demo" +# DeviceApplicationInterfaceAPI_Pixits.PX_ASSOCIATE_DEV_APPID := "bcee2135-2750-4d23-b786-a3062a371c8a" + + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsMec_DeviceApplicationInterface/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +system.httpPort.params := "HTTP(codecs=json:json_codec_mec016)/TCP(debug=1,server=192.168.40.50,port=80,use_ssl=0)" +#system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=try-mec.etsi.org,port=443,use_ssl=1)" +#system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server_mode=1,use_ssl=0)" + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsMec_TestControl.control + +# Check that the IUT responds with the list of user applications when requested by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPS_001_OK +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPS_001_NF +# Check that the IUT responds with the list of user applications when requested by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPS_002_OK +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPS_002_BR +#Check that the IUT acknowledges the creation of the application context when requested by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_001_OK +# Check that the IUT responds with an error when a request with incorrect URL is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_001_BR +# Check that the IUT responds with an error when a request with incorrect URL is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_001_NF +# Check that the IUT acknowledges the creation of the application context when requested by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_002_OK +# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_002_BR +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_002_NF +# Check that the IUT deletes the application context when commanded by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_003_OK +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPCTX_003_NF +# Check that the IUT sends the locations available for instantiation of a specific user application when requested by an UE Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPLOC_001_OK +# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application +#AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPLOC_001_BR +# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application +AtsMec_DeviceApplicationInterfaceAPI_TestCases.TC_MEC_MEC016_MEO_UEAPPLOC_001_NF + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ b/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ index e73de25..0f34812 100644 --- a/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ +++ b/etc/AtsMec_TrafficManagement/AtsMec_TrafficManagement.cfg_ @@ -8,14 +8,17 @@ LibCommon_Time.PX_TAC := 30.0 LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0; LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0; -LibHttp_Pics.PICS_HEADER_HOST := "172.26.214.231" +LibHttp_Pics.PICS_HEADER_HOST := "192.168.40.50" LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json" LibHttp_Pics.PICS_USE_TOKEN_HEADER := true #LibHttp_Pics.PICS_TOKEN_HEADER := "Basic WrongToken" -# LibMec_Pixits +LibMec_Pics.PICS_ROOT_API := "/sbxnfzm34p/mep1/" +# LibMec_Pixits +TrafficManagementAPI_Pixits.PX_APP_INSTANCE_ID := "81c51643-8c6f-4781-ad45-f8a457ca549b" +TrafficManagementAPI_Pixits.PX_APP_INSTANCE_ID_2 := "81c51643-8c6f-4781-ad45-f8a457ca549b" [LOGGING] # In this section you can specify the name of the log file and the classes of events @@ -33,7 +36,7 @@ LogEventTypes:= Yes [TESTPORT_PARAMETERS] # In this section you can specify parameters that are passed to Test Ports. -system.httpPort.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server=172.26.208.1,port=3002,use_ssl=0)" +system.httpPort.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server=192.168.40.50,port=80,use_ssl=0)" #system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=try-mec.etsi.org,port=443,use_ssl=1)" #system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server_mode=1,use_ssl=0)" @@ -84,24 +87,26 @@ system.httpPort.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,serve #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_002_BR_01 # Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - sessionFilter shall be present #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_002_BR_02 -# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +# Check that the IUT responds with the configured bandwidth allocation when queried by a MEC Application #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_OK -#Check that the IUT updates the requested bandwidth requirements when commanded by a MEC Application +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_NF +# Check that the IUT updates the requested bandwidth requirements when commanded by a MEC Application #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_004_OK # Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - sessionFilter shall be omitted #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_004_BR_01 #Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - sessionFilter shall be present -#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_004_BR_01 -# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_004_BR_02 +# Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application +#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_004_NF #Check that the IUT when provided with just the changes (deltas) updates the requested bandwidth requirements when commanded by a MEC Application -#TC_MEC_MEC015_SRV_TM_005_OK +#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_005_OK #Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - sessionFilter shall be omitted #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_005_BR_01 #Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - sessionFilter shall be present #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_005_BR_02 #Check that the IUT when provided with just the changes (deltas) updates the requested bandwidth requirements when commanded by a MEC Application -#TC_MEC_MEC015_SRV_TM_005_NF +#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_005_NF #Check that the IUT unregisters from the Bandwidth Management Service when commanded by a MEC Application #AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_006_OK #Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application diff --git a/ttcn/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterfaceAPI_TestCases.ttcn b/ttcn/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterfaceAPI_TestCases.ttcn index eda51f7..ce71620 100644 --- a/ttcn/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterfaceAPI_TestCases.ttcn +++ b/ttcn/AtsMec_DeviceApplicationInterface/AtsMec_DeviceApplicationInterfaceAPI_TestCases.ttcn @@ -83,7 +83,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { mw_http_response_ok( mw_http_message_body_json( mw_body_json_device_info_app_list - )))) -> value v_response { + )))) -> value v_response { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of Application ***"); @@ -125,7 +125,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "appName", + PICS_ROOT_API & "dev_app/v1/app_list_error", v_headers ) ) @@ -181,7 +181,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "?appName=" & PX_DEVICE_APP_NAME, + PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "?appName=" & oct2char(unichar2oct(PX_DEVICE_APP_NAME, "UTF-8")), v_headers ) ) @@ -238,7 +238,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "appName", + PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "?APP_NAME", v_headers ) ) @@ -331,7 +331,9 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { // Local variables var Headers v_headers; var HttpMessage v_response; - + + var UserAppInstanceInfoList v_userAppInstanceInfo := {{appInstanceId := PX_APP_INSTANCE_ID, referenceURI := "http://example.com/aeiou", appLocation := {countryCode := "countryCode", civicAddressElement := {{caType := 7, caValue := "caValue"}, {caType := 7, caValue := "caValue"}}, area := {coordinates := {{{2.302136, 2.302136}, {2.302136, 2.302136}}, {{2.302136, 2.302136}, {2.302136, 2.302136}}}}}}}; + // Test control if (not(PICS_MEC_PLAT) or not(PICS_DEVICE_APPLICATION_INTERFACE_API_SUPPORTED)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_DEVICE_APPLICATION_INTERFACE_API_SUPPORTED required for executing the TC ***"); @@ -354,12 +356,16 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + -, PX_ASSOCIATE_DEV_APPID, m_app_context_info( PX_APPD_ID, PX_APP_NAME, PX_APP_PROVIDER, - PX_APPD_VERSION + PX_APPD_VERSION, + PX_APP_DESCRIPTION, + PX_APP_SOFT_VERSION, + v_userAppInstanceInfo ), PX_DEVICE_APP_CALLBACK ) @@ -427,17 +433,21 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "Invalid", + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI, v_headers, m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + -, PX_ASSOCIATE_DEV_APPID, m_app_context_info( PX_APPD_ID, PX_APP_NAME, PX_APP_PROVIDER, - PX_APPD_VERSION + PX_APPD_VERSION, + PX_APP_DESCRIPTION, + PX_APP_SOFT_VERSION, + omit ), PX_DEVICE_APP_CALLBACK ) @@ -496,11 +506,12 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "WRONGURL", v_headers, m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + -, PX_ASSOCIATE_DEV_APPID, m_app_context_info( PX_APPD_ID, @@ -568,17 +579,18 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & v_device_info_app_context.contextId, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & oct2char(unichar2oct(v_device_info_app_context.contextId, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + v_device_info_app_context.contextId, PX_ASSOCIATE_DEV_APPID, m_app_context_info( - PX_APPD_ID, - PX_APP_NAME, - PX_APP_PROVIDER, - PX_APPD_VERSION + PX_APPD_ID_2, + PX_APP_NAME_2, + PX_APP_PROVIDER_2, + PX_APPD_VERSION_2 ), PX_DEVICE_NEW_APP_CALLBACK ) @@ -642,11 +654,12 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & v_device_info_app_context.contextId, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & oct2char(unichar2oct(v_device_info_app_context.contextId, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + -, PX_INVALID_ASSOCIATE_DEV_APPID, m_app_context_info( PX_APPD_ID, @@ -711,11 +724,12 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & PX_UNKNOWN_APP_CONTEXT_ID, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_CONTEXT_ID, "UTF-8")), v_headers, m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( + PX_UNKNOWN_APP_CONTEXT_ID, PX_ASSOCIATE_DEV_APPID, m_app_context_info( PX_APPD_ID, @@ -782,7 +796,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & PX_UNKNOWN_APP_CONTEXT_ID, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & oct2char(unichar2oct(v_device_info_app_context.contextId, "UTF-8")), v_headers ) ) @@ -837,7 +851,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_delete( - PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & PX_UNKNOWN_APP_CONTEXT_ID, + PICS_ROOT_API & PX_DEVICE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_CONTEXT_ID, "UTF-8")), v_headers ) ) @@ -872,71 +886,90 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/v3.1.1-dev/Test%20Purposes/MEC016/MEO/UEAPPS/SysUeApplicationsLocation.tplan2 */ testcase TC_MEC_MEC016_MEO_UEAPPLOC_001_OK() runs on HttpComponent system HttpTestAdapter { - // Local variables - var Headers v_headers; - - // Test control - if (not(PICS_MEC_PLAT) or not(PICS_DEVICE_APPLICATION_INTERFACE_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_DEVICE_APPLICATION_INTERFACE_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_ROOT_API & PX_DEVICE_APP_LIST_URI, - v_headers, - m_http_message_body_json( - m_body_json_device_info_app_location_availability( - m_application_location_availability( - PX_ASSOCIATE_DEV_APPID, - m_application_location_availability_info( - PX_APPD_ID, - PX_APP_NAME, - PX_APP_PROVIDER, - PX_APPD_VERSION - ) - ) - ) - ) - ) - ) - ); - f_selfOrClientSyncAndVerdict(c_prDone, e_success); + // Local variables + var Headers v_headers; + template (value) ApplicationLocationAvailability_AppInfo t_appLocAvail := + { + appName := "onboarded-demo4", + appProvider := "ETSI", + appSoftVersion := "v0.1.0", + appDVersion := "v0.1.0", + appDescription := "Basic HTTP Ping Pong", + availableLocations := { + { + appLocation := { + countryCode := "492", + civicAddressElement := { + { caType := 1, caValue := "A1" }, + { caType := 2, caValue := "A2" } + }, + area := {coordinates := {{{2.302136, 2.302136}, {2.302136, 2.302136}}, {{2.302136, 2.302136}, {2.302136, 2.302136}}}} + } + } + }, + appPackageSource := "http://example.com/aeiou" + }; - // Test Body - tc_ac.start; - alt { - [] httpPort.receive( - mw_http_response( - mw_http_response_ok( - mw_http_message_body_json( - m_body_json_device_info_app_location_availability( - mw_application_location_availability( - PX_ASSOCIATE_DEV_APPID, - mw_application_location_availability_info - )))))) { - tc_ac.stop; - - log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of Application ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); - } - [] tc_ac.timeout { - log("*** " & testcasename() & ": INCONC: Expected message not received ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); - } - } // End of 'alt' statement - - // Postamble - f_cf_01_http_down(); + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_DEVICE_APPLICATION_INTERFACE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_DEVICE_APPLICATION_INTERFACE_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_ROOT_API & PX_DEVICE_APP_LOC_URI, + v_headers, + m_http_message_body_json( + m_body_json_device_info_app_location_availability( + m_application_location_availability( + PX_ASSOCIATE_DEV_APPID, + t_appLocAvail + ) + + ) + + ) + ) + ) + + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + m_body_json_device_info_app_location_availability( + mw_application_location_availability( + PX_ASSOCIATE_DEV_APPID, + t_appLocAvail + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of Application ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_cf_01_http_down(); } // End of testcase TC_MEC_MEC016_MEO_UEAPPLOC_001_OK /** @@ -965,7 +998,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { httpPort.send( m_http_request( m_http_request_post( - PICS_ROOT_API & PX_DEVICE_APP_LIST_URI & "_invalid", + PICS_ROOT_API & PX_DEVICE_APP_LIST_URI, v_headers, m_http_message_body_json( m_body_json_device_info_app_location_availability( @@ -973,7 +1006,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { PX_ASSOCIATE_DEV_APPID, m_application_location_availability_info( PX_APPD_ID, - PX_APP_NAME, + PX_UNKNOWN_APP_NAME, PX_APP_PROVIDER, PX_APPD_VERSION ) @@ -1062,7 +1095,7 @@ module AtsMec_DeviceApplicationInterfaceAPI_TestCases { )) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of Application ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error code ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { diff --git a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Functions.ttcn b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Functions.ttcn index 0f43a1f..4cf0942 100644 --- a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Functions.ttcn +++ b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Functions.ttcn @@ -33,6 +33,7 @@ module DeviceApplicationInterfaceAPI_Functions { ) runs on HttpComponent { var Headers v_headers; var HttpMessage v_response; + var UserAppInstanceInfoList v_userAppInstanceInfo := {{appInstanceId := PX_APP_INSTANCE_ID, referenceURI := "http://example.com/aeiou", appLocation := {countryCode := "countryCode", civicAddressElement := {{caType := 7, caValue := "caValue"}, {caType := 7, caValue := "caValue"}}, area := {coordinates := {{{2.302136, 2.302136}, {2.302136, 2.302136}}, {{2.302136, 2.302136}, {2.302136, 2.302136}}}}}}}; f_init_default_headers_list(-, -, v_headers); httpPort.send( @@ -43,14 +44,18 @@ module DeviceApplicationInterfaceAPI_Functions { m_http_message_body_json( m_body_json_device_info_app_context( m_device_app_context( - PX_ASSOCIATE_DEV_APPID, - m_app_context_info( - PX_APPD_ID, - PX_UNKNOWN_APP_NAME, - PX_APP_PROVIDER, - PX_APPD_VERSION - ), - PX_DEVICE_APP_CALLBACK + -, + PX_ASSOCIATE_DEV_APPID, + m_app_context_info( + PX_APPD_ID, + PX_APP_NAME, + PX_APP_PROVIDER, + PX_APPD_VERSION, + PX_APP_DESCRIPTION, + PX_APP_SOFT_VERSION, + v_userAppInstanceInfo + ), + PX_DEVICE_APP_CALLBACK ) ) ) diff --git a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Pixits.ttcn b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Pixits.ttcn index 49e31f2..56a6d9f 100644 --- a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Pixits.ttcn +++ b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Pixits.ttcn @@ -3,34 +3,46 @@ module DeviceApplicationInterfaceAPI_Pixits { // JSON import from Json all; - modulepar charstring PX_DEVICE_APP_LIST_URI := "/dev_app/v1/app_list"; + modulepar Json.String PX_APP_INSTANCE_ID := "81c51643-8c6f-4781-ad45-f8a457ca549b"; - modulepar charstring PX_DEVICE_APP_CTX_URI := "/dev_app/v1/app_contexts"; + modulepar Json.String PX_DEVICE_APP_NAME := ""; - modulepar charstring PX_DEVICE_APP_LOC_URI := "/dev_app/v1/obtain_app_loc_availability"; + modulepar Json.String PX_DEVICE_UNKNOWN_APP_NAME := ""; - modulepar charstring PX_DEVICE_APP_NAME := ""; + modulepar Json.String PX_ASSOCIATE_DEV_APPID := "bcee2135-2750-4d23-b786-a3062a371c8a"; - modulepar charstring PX_DEVICE_UNKNOWN_APP_NAME := ""; + modulepar Json.String PX_UNKNOWN_ASSOCIATE_DEV_APPID := "bcee2135-2750-4d23"; - modulepar charstring PX_ASSOCIATE_DEV_APPID := ""; + modulepar Json.String PX_INVALID_ASSOCIATE_DEV_APPID := ""; - modulepar charstring PX_INVALID_ASSOCIATE_DEV_APPID := ""; + modulepar Json.String PX_DEVICE_APP_CALLBACK := "http://clientApp.example.com/location_notifications/123456"; - modulepar charstring PX_DEVICE_APP_CALLBACK := ""; + modulepar Json.String PX_DEVICE_NEW_APP_CALLBACK := ""; - modulepar charstring PX_DEVICE_NEW_APP_CALLBACK := ""; + modulepar Json.String PX_APPD_ID := ""; + + modulepar Json.String PX_APPD_ID_2 := "Ccee2135-2750-4d23-b786-a3062a371c8a"; - modulepar charstring PX_APPD_ID := ""; + modulepar Json.String PX_APP_NAME := "onboarded-demo4"; - modulepar charstring PX_APP_NAME := ""; + modulepar Json.String PX_APP_NAME_2 := "demo2"; - modulepar charstring PX_UNKNOWN_APP_NAME := ""; + modulepar Json.String PX_UNKNOWN_APP_NAME := "UNKNOWN"; - modulepar charstring PX_APP_PROVIDER := ""; + modulepar Json.String PX_APP_PROVIDER := "ETSI"; - modulepar charstring PX_APPD_VERSION := ""; + modulepar Json.String PX_APP_PROVIDER_2 := "ETSI_2"; - modulepar charstring PX_UNKNOWN_APP_CONTEXT_ID := ""; + modulepar Json.String PX_APPD_VERSION := "v0.1.0"; + + modulepar Json.String PX_APPD_VERSION_2 := "v0.1.1"; + + modulepar Json.String PX_APP_SOFT_VERSION := "v0.1.0" + + modulepar Json.String PX_APP_SOFT_VERSION_2 := "v0.1.1" + + modulepar Json.String PX_APP_DESCRIPTION := "" + + modulepar Json.String PX_UNKNOWN_APP_CONTEXT_ID := "ccee2135-2750-4d23-b786-a3062a371c8aaa"; } // End of module DeviceApplicationInterfaceAPI_Pixits diff --git a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Templates.ttcn b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Templates.ttcn index 8b1ab83..8114254 100644 --- a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Templates.ttcn +++ b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_Templates.ttcn @@ -12,13 +12,14 @@ module DeviceApplicationInterfaceAPI_Templates { template (omit) AppContext m_device_app_context( + in template (omit) Json.String p_contextID := omit, in template (value) Json.String p_associateDevAppId, in template (value) ApplicationContext_AppInfo p_appInfo, in template (omit) Json.AnyURI p_callbackReference := omit, in template (omit) boolean p_appLocationUpdates := omit, in template (omit) boolean p_appAutoInstantiation := omit ) := { - contextId := omit, + contextId := p_contextID, associateDevAppId := p_associateDevAppId, callbackReference := p_callbackReference, appLocationUpdates := p_appLocationUpdates, @@ -82,24 +83,23 @@ module DeviceApplicationInterfaceAPI_Templates { appPackageSource := p_appPackageSource } // End ot template mw_app_context_info - template (value) ApplicationLocationAvailability m_application_location_availability( - in Json.String p_associateDevAppId, - in template (value) ApplicationLocationAvailability_AppInfo p_appInfo + template (omit) ApplicationLocationAvailability m_application_location_availability( + in template (value) Json.String p_associateDevAppId, + in template (omit) ApplicationLocationAvailability_AppInfo p_appInfo := omit ) := { associateDevAppId := p_associateDevAppId, appInfo := p_appInfo } // End of template m_application_location_availability - template (present) ApplicationLocationAvailability mw_application_location_availability( - template (present) Json.String p_associateDevAppId := ?, - template (present) ApplicationLocationAvailability_AppInfo p_appInfo := ? - ) := { + template ApplicationLocationAvailability mw_application_location_availability( + template (present) Json.String p_associateDevAppId := ?, + template (present) ApplicationLocationAvailability_AppInfo p_appInfo := ? + ) := { associateDevAppId := p_associateDevAppId, appInfo := p_appInfo } // End of template mw_application_location_availability template (omit) ApplicationLocationAvailability_AppInfo m_application_location_availability_info( - in Json.String p_appDId, in Json.String p_appName, in Json.String p_appProvider, in Json.String p_appDVersion, @@ -108,7 +108,6 @@ module DeviceApplicationInterfaceAPI_Templates { in template (omit) AvailableLocationsList p_availableLocations := omit, in template (omit) Json.AnyURI p_appPackageSource := omit ) := { - appDId := p_appDId, appName := p_appName, appProvider := p_appProvider, appSoftVersion := p_appSoftVersion, @@ -118,8 +117,7 @@ module DeviceApplicationInterfaceAPI_Templates { appPackageSource := p_appPackageSource } // End of template m_application_location_availability_info - template (present) ApplicationLocationAvailability_AppInfo mw_application_location_availability_info( - template (present) Json.String p_appDId := ?, + template ApplicationLocationAvailability_AppInfo mw_application_location_availability_info( template (present) Json.String p_appName := ?, template (present) Json.String p_appProvider := ?, template (present) Json.String p_appDVersion := ?, @@ -128,7 +126,6 @@ module DeviceApplicationInterfaceAPI_Templates { template AvailableLocationsList p_availableLocations := *, template Json.AnyURI p_appPackageSource := * ) := { - appDId := p_appDId, appName := p_appName, appProvider := p_appProvider, appSoftVersion := p_appSoftVersion, diff --git a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_TypesAndValues.ttcn b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_TypesAndValues.ttcn index 72e35ca..f1b0575 100644 --- a/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/DeviceApplicationInterfaceAPI/ttcn/DeviceApplicationInterfaceAPI_TypesAndValues.ttcn @@ -174,7 +174,6 @@ module DeviceApplicationInterfaceAPI_TypesAndValues { * @seeETSI GS MEC 016 V3.1.1 (2024-03) Clause 6.2.4 Type: ApplicationLocationAvailability */ type record ApplicationLocationAvailability_AppInfo { - Json.String appDId, Json.String appName, Json.String appProvider, Json.String appSoftVersion optional, @@ -255,7 +254,7 @@ module DeviceApplicationInterfaceAPI_TypesAndValues { */ type record LocationConstraints { Json.String countryCode optional, - CivicAddressElement civicAddressElement optional, + CivicAddressElementList civicAddressElement optional, Polygon area optional } type set of LocationConstraints LocationConstraintsList; @@ -270,33 +269,45 @@ module DeviceApplicationInterfaceAPI_TypesAndValues { Json.Integer caType, Json.String caValue } + type set of CivicAddressElement CivicAddressElementList /** * @desc * @see ETSI GS MEC 016 V3.1.1 (2024-03) Clause 6.5.2 Type: LocationConstraints */ - type record Polygon { - Json.String type_, - Geometry geometry, - Properties properties, - Json.String this_ - } with { - variant (type_) "name as 'type'"; - variant (this_) "name as 'this'"; - } + // type record Polygon_ { + // Json.String type_, + // Geometry geometry, + // Properties properties, + // Json.String this_ + // } with { + // variant (type_) "name as 'type'"; + // variant (this_) "name as 'this'"; + // } +type record Polygon { + Coordinates coordinates +} with { + variant (coordinates) "name as 'coordinates'" +} /** * @desc * @see ETSI GS MEC 016 V3.1.1 (2024-03) Clause 6.5.2 Type: LocationConstraints */ type record Geometry { - Json.String type_, - Coordinates coordinates + Json.String type_ optional, + Coordinates coordinates_ } with { variant (type_) "name as 'type'"; + variant (coordinates_) "name as 'coordinates'"; } - type set of Json.Number Coordinate; - type set of Coordinate Coordinates; + + + +type record length(2) of Json.Number Position; +type set of Position LinearRing; +type set of LinearRing Coordinates; + /** * @desc diff --git a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn index 55a8c4d..4456a24 100644 --- a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn @@ -30,6 +30,12 @@ module LibMec_Pixits { // FIXME FSCOM Split this file according to the different modulepar charstring PX_ME_MTS_SESSIONS_URI := "mts/v1/mts_sessions"; + modulepar charstring PX_DEVICE_APP_LIST_URI := "dev_app/v1/app_list"; + + modulepar charstring PX_DEVICE_APP_CTX_URI := "dev_app/v1/app_contexts"; + + modulepar charstring PX_DEVICE_APP_LOC_URI := "dev_app/v1/obtain_app_loc_availability"; + modulepar charstring PX_ME_WLAN_QUERIES_URI := "wai/v2/queries"; modulepar charstring PX_ME_WLAN_URI := "wai/v2"; -- GitLab From f20a18139dba7c7e8398f259fbb3e5e0e11bbac3 Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Mon, 14 Jul 2025 16:13:02 +0500 Subject: [PATCH 5/5] validate and bugfixes MEC014 using mockserver --- etc/AtsMec_UEidentity/AtsMec_UEidentity.cfg_ | 90 +++++++++++++++++++ .../AtsMec_UEidentityAPI_TestCases.ttcn | 36 ++++---- .../ttcn/UEidentityAPI_Functions.ttcn | 6 +- 3 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 etc/AtsMec_UEidentity/AtsMec_UEidentity.cfg_ diff --git a/etc/AtsMec_UEidentity/AtsMec_UEidentity.cfg_ b/etc/AtsMec_UEidentity/AtsMec_UEidentity.cfg_ new file mode 100644 index 0000000..7d8a960 --- /dev/null +++ b/etc/AtsMec_UEidentity/AtsMec_UEidentity.cfg_ @@ -0,0 +1,90 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT roles + +LibCommon_Time.PX_TAC := 30.0 +#LibCommon_Time.PX_TWAIT := 30.0 +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0; + +LibHttp_Pics.PICS_HEADER_HOST := "192.168.40.7" + +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json" +LibHttp_Pics.PICS_USE_TOKEN_HEADER := true +#LibHttp_Pics.PICS_TOKEN_HEADER := "Basic WrongToken" + +#LibMec_Pics.PICS_ROOT_API := "/sbxnfzm34p/mep1/" + +# LibMec_Pixits +UEidentityAPI_Pixits.PX_APP_INSTANCE_ID := "APP_INSTANCE_ID" +UEidentityAPI_Pixits.PX_UE_IDENTITY_TAG := "UE_IDENTITY_TAG" + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsMec_UEidentity/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=192.168.40.7,port=5000,use_ssl=0)" +#system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=try-mec.etsi.org,port=443,use_ssl=1)" +#system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server_mode=1,use_ssl=0)" + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsMec_TestControl.control + +# Check that the IUT responds with the information on a UE Identity tag when queried by a MEC Application +#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_OK +# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Applicati +#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_BR +# Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application +#AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_001_NF +# Check that the IUT registers a tag (representing a UE) or a list of tags when commanded by a MEC Application +AtsMec_UEidentityAPI_TestCases.TC_MEC_MEC014_SRV_UETAG_002_OK + + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/ttcn/AtsMec_UEidentity/AtsMec_UEidentityAPI_TestCases.ttcn b/ttcn/AtsMec_UEidentity/AtsMec_UEidentityAPI_TestCases.ttcn index 7a85b02..f8d87cd 100644 --- a/ttcn/AtsMec_UEidentity/AtsMec_UEidentityAPI_TestCases.ttcn +++ b/ttcn/AtsMec_UEidentity/AtsMec_UEidentityAPI_TestCases.ttcn @@ -60,7 +60,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -115,7 +115,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/invalid/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -125,15 +125,11 @@ module AtsMec_UEidentityAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_400_bad_request( - mw_http_message_body_json( - mw_body_json_problem_details( - mw_problem_details( - -, -, 400 - )))))) { + mw_http_response_400_bad_request + )) { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error code ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -170,7 +166,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -179,13 +175,13 @@ module AtsMec_UEidentityAPI_TestCases { tc_ac.start; alt { [] httpPort.receive( - mw_http_response( - mw_http_response_404_not_found( - mw_http_message_body_json( - mw_body_json_problem_details( - mw_problem_details( - -, -, 404 - )))))) { + mw_http_response( + mw_http_response_404_not_found( + mw_http_message_body_json( + mw_body_json_problem_details( + mw_problem_details( + -, -, 404 + )))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***"); @@ -230,7 +226,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", v_headers, m_http_message_body_json( m_body_json_ue_identity_tag_info( @@ -304,7 +300,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", v_headers, m_http_message_body_json( m_body_json_ue_identity_tag_info( @@ -368,7 +364,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_put( - PICS_ROOT_API & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", v_headers, m_http_message_body_json( m_body_json_ue_identity_tag_info( diff --git a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Functions.ttcn b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Functions.ttcn index 7b48d64..7795a25 100644 --- a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Functions.ttcn +++ b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Functions.ttcn @@ -39,8 +39,8 @@ module UEidentityAPI_Functions { httpPort.send( m_http_request( m_http_request_get( - "/" & PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(p_ue_identity_tag, "UTF-8")), - p_headers + PICS_ROOT_API & PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(p_ue_identity_tag, "UTF-8")), + p_headers ) ) ); @@ -60,7 +60,7 @@ module UEidentityAPI_Functions { for (var integer v_i := 0; v_i < lengthof(v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags); v_i := v_i + 1) { if (v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].ueIdentityTag == p_ue_identity_tag) { //log("Processing ", v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].ueIdentityTag); - //log("State ", v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].state); + log("State ", v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].state); if (v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].state == UNREGISTERED) { v_result := 0; } else if (v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].state == REGISTERED) { -- GitLab