Commit 96deb314 authored by YannGarcia's avatar YannGarcia
Browse files

Start implementing MEC-10-2 V2.2.1

parent dcb5cc73
/**
* @Author ETSI / STF569
* @version $URL:$
* $ID:$
* @desc This module provides the MEC test cases.
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
* @see ETSI GS MEC 003, Draft ETSI GS MEC 010-2 V2.1.1
*/
module AtsMec_Granting_TestCases {
// Libcommon
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_ApplicationPackageLifecycleAndOperationGrantingAPI
import from ApplicationPackageLifecycleAndOperationGrantingAPI_Templates all;
import from ApplicationPackageLifecycleAndOperationGrantingAPI_Pics all;
import from ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits all;
// LibMec
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
group grant {
/**
* @desc: Check that MEO sends a synchronous grant response when a grant request is requested
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.1,
* ETSI GS MEC 010-2 2.0.10, Table 6.2.4.2.2-1, //GrantRequest
* ETSI GS MEC 010-2 2.0.10, Table 6.2.4.4.2-1 //Grant
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_001_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_MEO_GRANT_URI,
v_headers,
m_http_message_body_json(
m_body_json_grant_request(
m_grant_request(
PX_APP_INSTANCE_ID,
PX_APP_OPERATION
)
)
)
)));
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_grant_response(
mw_grant_response(
PX_APP_INSTANCE_ID
)
))))) -> value v_response {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a Grant Response ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_001_OK
/**
* @desc: Check that MEO responds with an error when it receives a malformed request when a new grant request is performed
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.1,
* ETSI GS MEC 010-2 2.0.10, Table 6.2.4.2.2-1, //GrantRequest
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_001_BR() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_MEO_GRANT_URI,
v_headers,
m_http_message_body_json(
m_body_json_grant_request_with_error(
m_grant_request_with_error(
PX_APP_INSTANCE_ID,
PX_APP_OPERATION_ERROR
)
)
)
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_400_bad_request(
))) -> value v_response {
tc_ac.stop;
if (v_response.response.statuscode == 400) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a Bad response ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_001_BR
/**
* @desc: Check that MEO sends a asynchronous grant response when a grant request is requested
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.1,
* ETSI GS MEC 010-2 2.0.10, Table 6.2.4.2.2-1, //GrantRequest
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_002_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
PICS_ROOT_API & PX_MEO_GRANT_URI,
v_headers,
m_http_message_body_json(
m_body_json_grant_request(
m_grant_request(
PX_APP_INSTANCE_ID,
PX_APP_OPERATION
)
)
)
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
//@TODO: Need to add 202 accepted to the library
mw_http_response_202_accepted()
)) -> value v_response {
tc_ac.stop;
//@TODO: How to check Location???
if (v_response.response.statuscode == 202) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted status code ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_002_OK
/**
* @desc: Check that MEO sends the status of a grant request when a query on a granting ID is performed
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.2,
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_003_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_get(
PICS_ROOT_API & PX_MEO_GRANT_URI & oct2char(unichar2oct(PX_GRANTING_ID, "UTF-8")),
v_headers
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
//@TODO: Need to add 202 accepted to the library
mw_http_response_202_accepted()
)) -> value v_response {
tc_ac.stop;
//@TODO: How to check Location???
if (v_response.response.statuscode == 201) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted status code ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_003_OK
/**
* @desc: Check that MEO responds with an error when it receives a request for returning a grant referred with a wrong ID
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.2
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_003_NF() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_get(
PICS_ROOT_API & PX_MEO_GRANT_URI & oct2char(unichar2oct(PX_NON_EXISTANT_GRANTING_ID, "UTF-8")),
v_headers,
m_http_message_body_json(
m_body_json_grant_request(
m_grant_request(
PX_APP_INSTANCE_ID,
PX_APP_OPERATION
)
)
)
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_404_not_found(
))) -> value v_response {
tc_ac.stop;
if (v_response.response.statuscode == 404) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a not found status code ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_003_NF
/**
* @desc: Check that MEO sends the status of a grant request when a query on a granting ID is performed
* ETSI GS MEC 010-2 2.0.10, clause 7.6.1.3.2
* ETSI GS MEC 010-2 2.0.10, Table 6.2.4.4.2-1 //Grant
*/
testcase TC_MEC_MEC010p2_MEO_GRANT_004_OK() runs on HttpComponent system HttpTestAdapter {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not(PIC_GRANTS_MANAGEMENT)){
log("*** " & testcasename() & ": PIC_GRANTS_MANAGEMENT required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_get(
PICS_ROOT_API & PX_MEO_GRANT_URI & oct2char(unichar2oct(PX_GRANTING_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_grant_response(
mw_grant_response(
PX_APP_INSTANCE_ID
)
))))) -> value v_response {
tc_ac.stop;
//@TODO: How to check Location???
if (v_response.response.statuscode == 200) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted status code ***");
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
} // End of testcase TC_MEC_MEC010p2_MEO_GRANT_004_OK
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -12,11 +12,8 @@ sources := \
AtsMec_V2XInformationServiceAPI_TestCases.ttcn \
AtsMec_DeviceApplicationInterfaceAPI_TestCases.ttcn \
AtsMec_WlanInformationAPI_TestCases.ttcn \
# AtsMec_AppLifecycleManagement_TestCases.ttcn \
# AtsMec_Granting_TestCases.ttcn \
AtsMec_ApplicationPackageLifecycleAndOperationGrantingAPI_TestCases.ttcn \
# AtsMec_Ams_TestCases.ttcn \
# AtsMec_MeoPkgm_TestCases.ttcn \
# AtsMec_MepmPkgm_TestCases.ttcn \
# AtsMec_FixedAccessInfoAPI_TestCases.ttcn \
# AtsMec_RadioNodeLocationAPI_TestCases.ttcn \
......
module ApplicationPackageLifecycleAndOperationGrantingAPI_EncdecDeclarations {
// LibMec_ApplicationPackageLifecycleAndOperationGrantingAPI
import from ApplicationPackageLifecycleAndOperationGrantingAPI_TypesAndValues all;
} // End of ApplicationPackageLifecycleAndOperationGrantingAPI_EncdecDeclarations
module ApplicationPackageLifecycleAndOperationGrantingAPI_Pics {
/**
* @desc Does the IUT support GRANT?
*/
modulepar boolean PICS_GRANT_API_SUPPORTED := true;
} // End of module ApplicationPackageLifecycleAndOperationGrantingAPI_Pics
module ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits {
// JSON
import from JSON all;
// LibMec_ApplicationPackageLifecycleAndOperationGrantingAPI
import from ApplicationPackageLifecycleAndOperationGrantingAPI_TypesAndValues all;
modulepar JSON.String PX_APP_INSTANCE_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1a";
modulepar JSON.String PX_APP_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1b";
modulepar OperationType PX_APP_OPERATION := INSTANTIATE;
modulepar OperationType PX_APP_OPERATION_ERROR := INSTANTIATE;
modulepar JSON.String PX_APP_LCM_OP_OCC_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1c"
modulepar JSON.String PX_GRANTING_ID := "e0deee2b-6e50-4f33-ab09-8bf0585025d3";
modulepar JSON.String PX_NON_EXISTANT_GRANTING_ID := "PX_NON_EXISTANT_GRANTING_ID";
modulepar JSON.String PX_APP_PKG_NAME := "APP_PKG_NAME"
modulepar JSON.String PX_APP_PKG_VERSION := "APP_PKG_VERSION"
modulepar JSON.String PX_CHECKSUM := "CHECKSUM"
modulepar JSON.String PX_APP_PKG_PATH := "APP_PKG_PATH"
modulepar OperationalState PX_OPERATIONAL_STATE := STARTED
modulepar UsageState PX_USAGE_STATE := NOT_IN_USE
modulepar JSON.String PX_APP_PKG_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f"
modulepar JSON.String PX_ON_BOARDED_APP_PKG_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f"
modulepar JSON.String PX_NON_EXISTENT_APP_PKG_ID := "NON_EXISTENT_APP_PKG_ID"
modulepar JSON.AnyURI PX_CALLBACK_URI := "http://127.0.0.1/callback"
modulepar JSON.String PX_SUBSCRIPTION_ID := "e0deee2b-6e50-4f33-ab09-8bf0585025d3"
modulepar JSON.String PX_NON_EXISTENT_SUBSCRIPTION_ID := "NON_EXISTENT_SUBSCRIPTION_ID"
} // End of module ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits
......@@ -3,6 +3,179 @@ module ApplicationPackageLifecycleAndOperationGrantingAPI_Templates {
// JSON
import from JSON all;
// LibMec_ApplicationPackageLifecycleAndOperationGrantingAPI
import from ApplicationPackageLifecycleAndOperationGrantingAPI_TypesAndValues all;
import from ApplicationPackageLifecycleAndOperationGrantingAPI_Pixits all;
group granting {
template (value) GrantRequest m_grant_request(
in String p_app_instance_id := PX_APP_INSTANCE_ID,
in String p_appLcmOpOccId := PX_APP_LCM_OP_OCC_ID,
in String p_appDId := PX_APP_ID,
in OperationType p_operation := PX_APP_OPERATION,
in template (value) GrantRequest_Link p_links
) := {
appInstanceId := p_app_instance_id,
appLcmOpOccId := p_appLcmOpOccId,
appDId := p_appDId,
operation := p_operation,
addResources := omit,
tempResources := omit,
updateResources := omit,
additionalParams := omit,
links := p_links
} // End of template m_grant_request
template (present) GrantRequest mw_grant_request(
template (present) String p_app_instance_id := ?,
template (present) String p_appLcmOpOccId := ?,
template (present) String p_appDId := ?,
template (present) OperationType p_operation := ?,
template (present) GrantRequest_Link p_links := ?
) := {
appInstanceId := p_app_instance_id,
appLcmOpOccId := p_appLcmOpOccId,
appDId := p_appDId,
operation := p_operation,
addResources := *,
tempResources := *,
updateResources := *,
additionalParams := *,
links := p_links
} // End of template mw_grant_request
template (present) Grant mw_grant(
template (present) String p_id := ?,
template (present) String p_app_instance_id := PX_APP_INSTANCE_ID,
template (present) String p_appLcmOpOccId := ?,
template (present) Grant_Link p_links := ?
) := {
id := p_id,
appInstanceId := p_app_instance_id,
appLcmOpOccId := p_appLcmOpOccId,
vimConnections := *,
zones := *,
zoneGroups := *,
addResources := *,
tempResources := *,
removeResources := *,
updateResources := *,
vimAssets := *,
extVirtualLinks := *,
additionalParams := *,
links := p_links
} // End of template mw_grant
template (value) GrantRequest_Link m_grant_request_link(
in template (value) LinkType p_appLcmOpOcc,
in template (value) LinkType p_appInstance
) := {
appLcmOpOcc := p_appLcmOpOcc,
appInstance := p_appInstance
} // End of template m_grant_request_link
template (present) GrantRequest_Link mw_grant_request_link(
template (present) LinkType p_appLcmOpOcc := ?,
template (present) LinkType p_appInstance := ?
) := {
appLcmOpOcc := p_appLcmOpOcc,
appInstance := p_appInstance
} // End of template mw_grant_request_link
template (value) LinkType m_link_type(
in template (value) JSON.AnyURI p_href
) := {
href := p_href
} // End of template m_link_type
template (present) LinkType mw_link_type(
template (present) JSON.AnyURI p_href := ?
) := {
href := p_href
} // End of template mw_link_type