Newer
Older
/**
* @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 011 V2.1.1
// 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;
import from AppEnablementAPI_TypesAndValues all;
import from AppEnablementAPI_Templates all;
import from AppEnablementAPI_Pics all;
import from AppEnablementAPI_Pixits all;
import from LibMec_TypesAndValues all;
import from LibMec_Templates all;
import from LibMec_Functions all;
import from LibMec_Pics all;
import from LibMec_Pixits all;
/*
* Application Service Availability Query (APPSAQ)
*/
/**
* @desc Check that the IUT responds with a list of available MEC services for a given application instance when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_001_OK() runs on HttpComponent system HttpTestAdapter {
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services",
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_service_info_list
)))) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ServiceInfoList ***");
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_MEC011_SRV_APPSAQ_001_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/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
testcase TC_MEC_MEC011_SRV_APPSAQ_001_BR() runs on HttpComponent system HttpTestAdapter {
if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
// 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_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services?instance_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID)),
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
)) {
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***");
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_MEC011_SRV_APPSAQ_001_BR
* @desc Check that the IUT notifies the authorised relevant (subscribed) application instances when a new service for a given application instance is registered.
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
testcase TC_MEC_MEC011_SRV_APPSAQ_002_OK() runs on HttpComponent system HttpTestAdapter {
if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not (PICS_NOTIFICATIONS) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PIC_NOTIFICATIONS and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc())));
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services",
v_headers,
m_http_message_body_json(
m_body_json_service_info(
"TC_MEC_MEC011_SRV_APPSAQ_002_OK",
REST_HTTP,
"HTTP",
"2.0",
m_end_point_uris({"/meMp1/service/MyEntryPoint"}),
m_security_info
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_message_body_json(
mw_body_json_service_info(
mw_service_info(
tc_ac.stop;
if (f_check_headers(valueof(v_response.response.header)) == true) {
/* TODO how to test this as the notification is for another MEC Application?
and
// MEC 011, clause 6.4.2
the IUT entity sends a notification_message containing
body containing
notificationType set to "SerAvailabilityNotification",
services containing
serName set to SERVICE_NAME
_links containing
subscription set to MP1_SUBSCRIPTION_A
;
;
;
;
to the MEC_APP_Subscriber entity
*/
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ServiceInfo and set notification ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Header 'Location' was not present in the response headers ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
}
}
[] 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_MEC011_SRV_APPSAQ_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/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
testcase TC_MEC_MEC011_SRV_APPSAQ_002_BR() runs on HttpComponent system HttpTestAdapter {
if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
// Test component configuration
f_cf_01_http_up();
// Preamble
f_init_default_headers_list(-, -, v_headers);
v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc())));
httpPort.send(
m_http_request(
m_http_request_post(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services",
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***");
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_MEC011_SRV_APPSAQ_002_BR
/**
* @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_002_NF() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/services",
v_headers,
m_http_message_body_json(
m_body_json_service_info(
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
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_MEC011_SRV_APPSAQ_002_NF
/**
* @desc Check that the IUT responds with the information on a specific service for a given application instance when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_003_OK() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(PX_SERVICE_ID, "UTF-8")),
v_headers
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_message_body_json(
mw_body_json_service_info(
mw_service_info(
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ServiceInfo ***");
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_MEC011_SRV_APPSAQ_003_OK
/**
* @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_003_NF() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(PX_NON_EXISTENT_SERVICE_ID, "UTF-8")),
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
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()
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
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_MEC011_SRV_APPSAQ_003_NF
group f_TC_MEC_MEC011_SRV_APPSAQ_004 {
/**
* @desc This function request the createion of a new service
* @param p_service_name Indicates the name of the new serivce
* @return 0 on success, -1 otherwise
*/
function f_create_service(
out universal charstring p_service_name,
out ServiceInfo p_service_info,
out Headers p_headers
) runs on HttpComponent return integer {
var universal charstring v_service_name;
var Headers v_headers;
var integer v_result := -1;
var HttpMessage v_response;
f_init_default_headers_list(-, -, v_headers);
v_service_name := oct2unichar(char2oct("service_" & int2str(f_get_current_timestamp_utc())));
httpPort.send(
m_http_request(
m_http_request_post(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services",
v_headers,
m_http_message_body_json(
m_body_json_service_info(
m_service_info(
v_service_name,
-, -, -, -, -, //-,
m_transport_info(
"transportId1",
"TC_MEC_MEC011_SRV_APPSAQ_002_OK",
REST_HTTP,
"HTTP",
"2.0",
m_end_point_uris({"/meMp1/service/MyEntryPoint"}),
m_security_info
)
)
)
)
)
)
);
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_201_created(
mw_http_message_body_json(
mw_body_json_service_info(
mw_service_info(
v_service_name //serName
)))))) -> value v_response {
tc_ac.stop;
p_service_name := v_service_name;
p_service_info := v_response.response.body.json_body.serviceInfo;
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
v_result := 0;
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
}
} // End of 'alt' statement
return v_result;
} // End of function f_create_service_info
/**
* @desc This function request the deletion of a service
* @param p_service_name Indicates the name of the serivce to delete
* @return 0 on success, -1 otherwise
*/
function f_delete_service(
in universal charstring p_service_name
) runs on HttpComponent return integer {
var Headers v_headers;
var integer v_result := -1;
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_delete(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(p_service_name)),
v_headers
)
)
);
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_204_no_content
)) {
tc_ac.stop;
v_result := 0;
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
}
} // End of 'alt' statement
return v_result;
} // End of function f_delete_service_info
} // End of group f_TC_MEC_MEC011_SRV_APPSAQ_004
/**
* @desc Check that the IUT updates a service information for a given application instance when commanded by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_004_OK() runs on HttpComponent system HttpTestAdapter {
var universal charstring v_service_name;
var ServiceInfo v_service_info;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
if (f_check_headers(v_headers, c_etag_http_header) == false) {
log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
f_get_header(v_headers, c_etag_http_header, v_etag); // TODO Check headers
log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
// If-Match header needs to have a PROPER_ETAG
f_init_default_headers_list(-, -, v_headers);
f_set_headers_list({ "If-Match" }, v_etag, v_headers);
httpPort.send(
m_http_request(
m_http_request_put(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(v_service_name, "UTF-8")),
v_headers,
m_http_message_body_json(
m_body_json_service_info(
m_service_info(
v_service_name,
PX_NEW_SERVICE_INFO_VERSION,
-, -, -, -,
v_service_info.transportInfo
)
)
)
)
)
);
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_service_info(
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ServiceInfo ***");
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
} // End of testcase TC_MEC_MEC011_SRV_APPSAQ_004_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/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_004_BR() runs on HttpComponent system HttpTestAdapter {
var universal charstring v_service_name := "";
var ServiceInfo v_service_info;
// Test control
if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
if (f_check_headers(v_headers, c_etag_http_header) == false) {
log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
f_get_header(v_headers, c_etag_http_header, v_etag); // TODO Check headers
log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
// If-Match header needs to have a PROPER_ETAG
f_init_default_headers_list(-, -, v_headers);
f_set_headers_list({ "If-Match" }, v_etag, v_headers);
httpPort.send(
m_http_request(
m_http_request_put(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(v_service_name, "UTF-8")),
v_headers,
m_http_message_body_json(
m_body_json_service_info(
v_service_name & char(0, 0, 1, 111),
PX_NEW_SERVICE_INFO_VERSION
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***");
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
} // End of testcase TC_MEC_MEC011_SRV_APPSAQ_004_BR
/**
* @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_004_NF() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
// TODO If-Match header needs to have a PROPER_ETAG
f_init_default_headers_list(-, -, v_headers);
httpPort.send(
m_http_request(
m_http_request_put(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(PX_NON_EXISTENT_SERVICE_ID, "UTF-8")),
v_headers,
m_http_message_body_json(
m_body_json_service_info(
m_service_info(
PX_SERVICE_NAME,
PX_NEW_SERVICE_INFO_VERSION
)
)
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***");
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_MEC011_SRV_APPSAQ_004_NF
/**
* @desc Check that the IUT responds with an error when a request sent by a MEC Application doesn't comply with a required condition
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppServices.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSAQ_004_PF() runs on HttpComponent system HttpTestAdapter {
var universal charstring v_service_name;
var ServiceInfo v_service_info;
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_API_SUPPORTED required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cf_01_http_up();
// Test adapter configuration
// Preamble
if(f_create_service(v_service_name, v_service_info, v_headers) == -1) {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
if (f_check_headers(v_headers, c_etag_http_header) == false) {
log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
f_get_header(v_headers, c_etag_http_header, v_etag);
log("*** " & testcasename() & ": INFO: New servie created: ", v_service_name, ", transportID=", v_service_info.transportInfo.id, ", ETag=", v_etag[0]);
// If-Match header needs to have an INVALID_ETAG
f_init_default_headers_list(-, -, v_headers);
f_set_headers_list({ "If-Match" }, { int2str(f_get_current_timestamp_utc()) }, v_headers);
httpPort.send(
m_http_request(
m_http_request_put(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/services/" & oct2char(unichar2oct(v_service_name, "UTF-8")),
v_headers,
m_http_message_body_json(
m_body_json_service_info(
m_service_info(
v_service_name,
PX_NEW_SERVICE_INFO_VERSION,
-, -, -, -,
v_service_info.transportInfo
)
)
)
)
)
);
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
)) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 412 Precondition Failed ***");
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
} // End of testcase TC_MEC_MEC011_SRV_APPSAQ_004_PF
/*
* Application Subscriptions (APPSUB)
*/
/**
* @desc Check that the IUT responds with a list of subscriptions for notifications on services availability when queried by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppSubscriptions.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSUB_001_OK() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
"/" & PICS_ROOT_API & PX_ME_APP_SUPPORT_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions",
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_subscription_link_list(
mw_subscription_link_list
))))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT successfully responds with a Mp1SubscriptionLinkList ***");
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_MEC011_SRV_APPSUB_001_OK
/**
* @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
* @see https://forge.etsi.org/gitlab/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/SRV/APPSAQ/PlatAppSubscriptions.tplan2
*/
testcase TC_MEC_MEC011_SRV_APPSUB_001_NF() runs on HttpComponent system HttpTestAdapter {
// Test control
if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_APP_ENABLEMENT_API_SUPPORTED)) {
log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_APP_ENABLEMENT_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(
"/" & PICS_ROOT_API & PX_MEC_SVC_MGMT_APPS_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/subscriptions",