Commit c0dad592 authored by YannGarcia's avatar YannGarcia
Browse files

Add V2XInformationService typing

parent abb64338
......@@ -382,7 +382,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
BwManagementAPI__TypesAndValues::BwInfoList bw_info_list;
bw_info_list.decode(BwManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
msg.bwInfoList() = bw_info_list;
} else {
} else { // BwInfo
BwManagementAPI__TypesAndValues::BwInfo bw_info;
TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
bw_info.decode(BwManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
......
......@@ -228,7 +228,10 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server
#AtsMec_AppEnablementAPI_TestCases.TC_MEC_SRV_TRANS_001_OK
# ETSI GS MEC 015
AtsMec_BwManagementAPI_TestCases.TP_MEC_SRV_BWA_001_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_001_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_BR
AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_NF
[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
......
......@@ -462,7 +462,8 @@ class myHandler(http.server.BaseHTTPRequestHandler):
content_type = 'application/json'
if p_split[4].startswith('bw_allocations'): # E.g. bw_allocation?app_instance_id=InstApp01
s = p_split[4].split('?')
if s.__len__() == 1: # ue_identity_tag_info, POST
if s.__len__() == 1: # BW Allocation list requested
#resp = self.__db__.getBwAllocationList(self.path)
# Register/Unregister operation
body = None
# Extract the body if any
......
......@@ -30,6 +30,7 @@ module AtsMec_BwManagementAPI_TestCases {
import from BwManagementAPI_Pixits all;
// LibMec
import from LibMec_Templates all;
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
......@@ -41,7 +42,7 @@ module AtsMec_BwManagementAPI_TestCases {
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
* @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
*/
testcase TP_MEC_SRV_BWA_001_OK() runs on HttpComponent system HttpTestAdapter {
testcase TC_MEC_SRV_BWA_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
......@@ -63,7 +64,7 @@ module AtsMec_BwManagementAPI_TestCases {
httpPort.send(
m_http_request(
m_http_request_get(
PX_ME_BWM_URI,// & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")),
PX_ME_BWM_URI,
v_headers
)
)
......@@ -81,7 +82,7 @@ module AtsMec_BwManagementAPI_TestCases {
)))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ZoneId ***");
log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of BwInfo ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
}
[] tc_ac.timeout {
......@@ -92,7 +93,258 @@ module AtsMec_BwManagementAPI_TestCases {
// Postamble
f_cf_01_http_down();
} // End of testcase TC_MEC_PLAT_MP1_BWA_BV_001
} // End of testcase TC_MEC_SRV_BWA_001_OK
/**
* @desc Check that the IUT responds with a configured bandwidth allocation when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
* @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
*/
testcase TC_MEC_SRV_BWA_002_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// 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 ***");
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_get(
PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")),
v_headers
)
)
);
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(
mw_body_json_bw_info(
mw_bw_info(
PX_APP_INSTANCE_ID
)))))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo ***");
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_SRV_BWA_002_OK
/**
* @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
* @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
*/
testcase TC_MEC_SRV_BWA_002_BR() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// 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 ***");
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_get(
PX_ME_BWM_URI & "/app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), // 'app_instance_id=' is a wrong parameter
v_headers
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
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
)))))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error message ***");
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_SRV_BWA_002_BR
/**
* @desc Check that the IUT responds with an error when a request with an unknown resource URI is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
* @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
*/
testcase TC_MEC_SRV_BWA_002_NF() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// 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 ***");
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_get(
PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")),
v_headers
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
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
)))))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error message ***");
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_SRV_BWA_002_NF
/**
* @desc Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
* @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
*/
testcase TC_MEC_SRV_BWA_003_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// 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 ***");
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_get(
PX_ME_BWM_URI,
v_headers,
m_http_message_body_json(
m_body_json_bw_info(
m_bw_info(
PX_APP_INSTANCE_ID,
SESSION_SPECIFIC_BW_ALLOCATION, // Request type
"1024", // FixedAllocation
Downlink // AllocationDirection
)
)
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_bw_info(
mw_bw_info(
PX_APP_INSTANCE_ID
)))))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo ***");
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_SRV_BWA_003_OK
} // End of group me_app_role
......
......@@ -116,7 +116,10 @@ module AtsMec_TestControl {
}
if (PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED) {
execute(TP_MEC_SRV_BWA_001_OK());
execute(TC_MEC_SRV_BWA_001_OK());
execute(TC_MEC_SRV_BWA_002_OK());
execute(TC_MEC_SRV_BWA_002_BR());
execute(TC_MEC_SRV_BWA_002_NF());
}
} // End of 'control' statement
......
......@@ -32,6 +32,7 @@ modules := ../LibCommon \
../LibMec/RnisAPI \
../LibMec/UEAppInterfaceAPI \
../LibMec/UEidentityAPI \
../LibMec/V2XInformationService \
../../ccsrc/Ports/LibHttp \
../../ccsrc/EncDec/LibHttp \
../../ccsrc/EncDec/LibMec \
......
......@@ -8,6 +8,8 @@ module BwManagementAPI_Pixits {
modulepar Address PX_APP_INSTANCE_ID := "appInst01";
modulepar Address PX_UNKNOWN_APP_INSTANCE_ID := "appInst99";
modulepar ResourceURL PX_RESOURCE_URL := "http://example.com/exampleAPI/location/v2/users?address:acr:192.0.0.1";
} // End of module BwManagementAPI_Pixits
......@@ -13,7 +13,7 @@ module BwManagementAPI_Templates {
template (value) BwInfo m_bw_info(
in AppInsId p_appInsId := PX_APP_INSTANCE_ID,
in RequestType p_requestType,
in FixedBWPriority p_fixedBWPriority,
//in FixedBWPriority p_fixedBWPriority,
in FixedAllocation p_fixedAllocation,
in AllocationDirection p_allocationDirection
) := {
......@@ -21,7 +21,7 @@ module BwManagementAPI_Templates {
appInsId := p_appInsId,
requestType := p_requestType,
sessionFilter := omit,
fixedBWPriority := p_fixedBWPriority,
fixedBWPriority := omit, //p_fixedBWPriority,
fixedAllocation := p_fixedAllocation,
allocationDirection := p_allocationDirection
} // End of template m_bw_info
......
sources := \
ttcn/V2XInformationService_TypesAndValues.ttcn
......@@ -21,7 +21,7 @@ module LibMec_TypesAndValues {
UInt32 status optional,
JSON.String detail,
JSON.String instance optional
} with {
} with {
variant (type_) "name as 'type'";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment