Commit 1f75fd25 authored by YannGarcia's avatar YannGarcia
Browse files

Update Codec for new types - MEC015

parent 8fb418af
......@@ -64,6 +64,10 @@ int json_codec::encode (const LibItsHttp__JsonMessageBodyTypes::JsonBody& msg, O
const AppEnablementAPI__TypesAndValues::TrafficRule& traffic_rule = msg.trafficRule();
traffic_rule.encode(AppEnablementAPI__TypesAndValues::TrafficRule_descr_, encoding_buffer, TTCN_EncDec::CT_JSON);
data = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else if (msg.ischosen(LibItsHttp__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 = /*char2oct(CHARSTRING("{\"TrafficRule\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/;
} else {
loggers::get_instance().error("json_codec::encode: Not supported");
}
......@@ -105,8 +109,8 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
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()));
if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
if (it->second.find("\"userList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"userList\"") is not optimal
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);
......@@ -115,7 +119,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
user_list.decode(LocationAPI__TypesAndValues::UserList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.userList() = user_list;
} else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be careful to the order
// TODO To be refined, find("\"accessPointList\"") is not optimal
// TODO To be refined, find("\"accessPointList\"") is not optimal
LocationAPI__TypesAndValues::AccessPointList access_point_list;
access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.accessPointList() = access_point_list;
......@@ -221,123 +225,123 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
current_time.decode(AppEnablementAPI__TypesAndValues::CurrentTime_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.currentTime() = current_time;
} else if (it->second.find("\"CellChangeSubscription\"") != std::string::npos) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// //loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// //loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
RnisAPI__TypesAndValues::CellChangeSubscription cell_change_subscription;
cell_change_subscription.decode(RnisAPI__TypesAndValues::CellChangeSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
msg.cellChangeSubscription() = cell_change_subscription;
//TODO Continue with other ChangeSubscription
} else if (it->second.find("\"RabInfo\"") != std::string::npos) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
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) {
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
// // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"...
// // TODO Create a method instead of copy/past
// // loggers::get_instance().log("json_codec::decode: Before, str=%s", str.c_str());
// std::size_t it_start = str.find("\"type\"");
// loggers::get_instance().log("json_codec::decode: id_start=%d", it_start);
// if (it_start != std::string::npos) {
// std::size_t it_stop = str.find(",", it_start);
// //loggers::get_instance().log("json_codec::decode: id_stop=%d", it_stop);
// //loggers::get_instance().log("json_codec::decode: segment=%s", str.substr(it_start, it_stop - it_start).c_str());
// std::size_t it = str.find("1", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV4_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("2", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "UE_IPV6_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("3", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "NATED_IP_ADDRESS" + str.substr(it + 1);
// } else {
// it = str.find("4", it_start, 1);
// //loggers::get_instance().log("json_codec::decode: it=%d", it);
// if ((it != std::string::npos) && (it < it_stop)) {
// str = str.substr(0, it) + "GTP_TEID" + str.substr(it + 1);
// }
// }
// }
// }
// }
// //loggers::get_instance().log("json_codec::decode: After, str=%s", str.c_str());
// decoding_buffer.clear();
// decoding_buffer.put_os(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
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;
......@@ -367,16 +371,19 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
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
if (str.find("not defined in the present document") != std::string::npos) {
str = regex_replace(str, regex("not defined in the present document"), "not_defined_in_the_present_document");
}
if (str.find("00") != std::string::npos) {
str = regex_replace(str, regex("00"), "Downlink");
} else if (str.find("01 = Uplink (towards the application/session)") != std::string::npos) {
str = regex_replace(str, regex("01"), "Uplink");
} else if (str.find("10 = Symmetrical") != std::string::npos) {
str = regex_replace(str, regex("10"), "Symmetrical");
}
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;
......@@ -384,9 +391,9 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
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;
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("\"detail\"") != std::string::npos) {
LibMec__TypesAndValues::ProblemDetails problem_details;
......
......@@ -238,10 +238,10 @@ 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_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_002_NF
# Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application
AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_OK_01
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_OK_01
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_OK_02
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_BR_01
AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_BR_01
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_BR_02
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_BR_03
# Check that the IUT responds with the configured bandwidth allocation when queried by a MEC Application
......@@ -274,7 +274,7 @@ AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_TM_003_OK_01
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_MTS_002_NF
# Check that the IUT responds with a configured Multi-access Traffic Steering when queried by a MEC Application
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_MTS_003_OK
#Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
# Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
#AtsMec_TrafficManagementAPI_TestCases.TC_MEC_MEC015_SRV_MTS_003_BR
# 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_MTS_003_NF
......
......@@ -316,7 +316,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases {
{
m_session_filter(
"10.10.10.10",
{"10"}
{"1010"}
)
} // FlowFilter
......@@ -400,7 +400,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases {
{
m_session_filter(
"10.10.10.10",
{"10.10.10.10"} // Invalid port number
{"10.10"} // Invalid port number
)
} // FlowFilter
......@@ -793,7 +793,7 @@ module AtsMec_MultiAccessSteeringInfoAPI_TestCases {
{
m_session_filter(
"10.10.10.10",
{"10"}
{"1010"}
)
} // FlowFilter
)
......
......@@ -286,6 +286,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
var JSON.String v_app_instance_id := PX_APP_INSTANCE_ID & oct2unichar(char2oct("001"));
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
......@@ -309,7 +310,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
m_http_message_body_json(
m_body_json_bw_info(
m_bw_info(
PX_APP_INSTANCE_ID,
v_app_instance_id,
APPLICATION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink // AllocationDirection
......@@ -330,7 +331,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
mw_http_message_body_json(
mw_body_json_bw_info(
mw_bw_info(
PX_APP_INSTANCE_ID
v_app_instance_id
)))))) -> value v_response {
tc_ac.stop;
......@@ -363,6 +364,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
var JSON.String v_app_instance_id := PX_APP_INSTANCE_ID & oct2unichar(char2oct("002"));
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
......@@ -386,11 +388,11 @@ module AtsMec_TrafficManagementAPI_TestCases {
m_http_message_body_json(
m_body_json_bw_info(
m_bw_info(
PX_APP_INSTANCE_ID,
v_app_instance_id,
SESSION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink, // AllocationDirection
{ m_session_filter("10.10.10.10", { "10" }) }
{ m_session_filter("10.10.10.10", { "1010" }) }
)
)
)
......@@ -408,7 +410,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
mw_http_message_body_json(
mw_body_json_bw_info(
mw_bw_info(
PX_APP_INSTANCE_ID,
v_app_instance_id,
SESSION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink, // AllocationDirection
......@@ -541,7 +543,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
APPLICATION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink, // AllocationDirection
{ m_session_filter("10.10.10.10", { "10" }) } // MEC015 Clause 7.2.2 Type: BwInfo Table 7.2.2-1: Elements of BwInfo, sessionFilter shall be omit
{ m_session_filter("10.10.10.10", { "1010" }) } // MEC015 Clause 7.2.2 Type: BwInfo Table 7.2.2-1: Elements of BwInfo, sessionFilter shall be omit
)
)
)
......@@ -644,7 +646,7 @@ module AtsMec_TrafficManagementAPI_TestCases {
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_MEC015_SRV_TM_003_BR_02
} // End of testcase TC_MEC_MEC015_SRV_TM_003_BR_03
/**
* @desc Check that the IUT responds with the configured bandwidth allocation when queried by a MEC Application
......
module TrafficManagementAPI_Functions {
// JSON
import from JSON all;
// LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_Time all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_Functions all;
import from LibItsHttp_Templates all;
import from LibItsHttp_JsonTemplates all;
import from LibItsHttp_TestSystem all;
// LibMec/TrafficManagementAPI
import from TrafficManagementAPI_TypesAndValues all;
import from TrafficManagementAPI_Templates all;
import from TrafficManagementAPI_Pixits all;
// LibMec
import from LibMec_Templates all;
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
function f_create_bw_allocation_resource(
in JSON.String p_app_instance_id,
out charstring p_bw_allocation_id,
out BwInfo p_bw_info
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
p_bw_allocation_id := "";
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
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
))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_json(
mw_body_json_bw_info(
mw_bw_info(
p_app_instance_id
)))))) -> value v_response {
var charstring_list v_bw_allocation_id;
tc_ac.stop;
log("f_create_bw_allocation_resource: BwInfo recsource created: ", v_response);
f_get_header(valueof(v_response.response.header), "Location", v_bw_allocation_id);
if (lengthof(v_bw_allocation_id) != 0) {
p_bw_allocation_id := v_bw_allocation_id[0];
p_bw_info := v_response.response.body.json_body.bwInfo;
}
}
[] tc_ac.timeout {
log("f_create_bw_allocation_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_bw_allocation_resource
function f_delete_bw_allocation_resource(
in JSON.String p_app_instance_id,
in charstring p_bw_allocation_id
) runs on HttpComponent {
var Headers v_headers;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
PX_ME_BWM_URI & "/" & p_bw_allocation_id,
v_headers
)));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
}
[] tc_ac.timeout {
log("f_delete_bw_allocation_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_delete_bw_allocation_resource
function f_create_mts_session_info_resource(
in JSON.String p_app_instance_id,
out charstring p_mts_session_id,
out MtsSessionInfo p_mts_session_info
) runs on HttpComponent {
var Headers v_headers;
var HttpMessage v_response;
p_mts_session_id := "";
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PX_ME_MTS_SESSIONS_URI,
v_headers,
m_http_message_body_json(
m_body_json_mts_session_info(
m_mts_session_info(
PX_APP_INSTANCE_ID,
APPLICATION_SPECIFIC_MTS_ALLOCATION, // Request type
m_qosd, // QoS
LowCost, // MtsMode
Downlink, // TrafficDirection
{
m_session_filter(
"10.10.10.10",
{"1010"}
)
} // FlowFilter
))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_json(
mw_body_json_mts_session_info(
mw_mts_session_info(
p_app_instance_id
)))))) -> value v_response {
var charstring_list v_mts_session_info_id;
tc_ac.stop;
log("f_create_mts_session_info_resource: BwInfo recsource created: ", v_response);
f_get_header(valueof(v_response.response.header), "Location", v_mts_session_info_id);
if (lengthof(v_mts_session_info_id) != 0) {
p_mts_session_id := v_mts_session_info_id[0];
p_mts_session_info := v_response.response.body.json_body.mtsSessionInfo;
}
}
[] tc_ac.timeout {
log("f_create_mts_session_info_resource: Expected message not received");
}
} // End of 'alt' statement
} // End of function f_create_mts_session_info_resource