jolly has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43620?usp=email )
Change subject: IPAd: Add test case for multple eIM packages ......................................................................
IPAd: Add test case for multple eIM packages
IPAd will cycle through the main loop until there is no eIM package available. The IPAd process keeps running. Provide multiple eIM packes to see if they do not conflict with each other. At the end there must be no memory leak, but this is checked in a later patch.
To re-use code from other tests, move the package processing of other tests to extra functions. These functions are called in this test multiple times.
Related: SYS#8199 Change-Id: I74bba77cc391ed243729e99a5aeaefb9dbde2922 --- M ipad/IPAd_Tests.ttcn 1 file changed, 106 insertions(+), 37 deletions(-)
Approvals: dexter: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn index 8f3af56..c543ef8 100644 --- a/ipad/IPAd_Tests.ttcn +++ b/ipad/IPAd_Tests.ttcn @@ -43,7 +43,8 @@ integer mp_esipa_port := 4430; boolean mp_esipa_disable_ssl := false; boolean mp_use_vpcd := true; - float mp_restart_guardtime := 2.0 + float mp_restart_guardtime := 2.0; + integer mp_tc_multi_package_rounds := 5; }
/* Altstep to handle card power up/down and ATR transmission */ @@ -502,15 +503,11 @@
/* A testcase to try out an indirect profile download, * See also: GSMA SGP.32, section 3.2.3.2: Indirect Profile Download */ -private function f_TC_proc_indirect_prfle_dwnld(charstring id) runs on IPAd_ConnHdlr { +private function f_package_indirect_prfle_dwnld(charstring id) runs on IPAd_ConnHdlr { var integer i; var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port); var BoundProfilePackage boundProfilePackage;
- f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* Prepare indirect profile download by responding with a download trigger request */ f_esipa_transceive(valueof(ts_getEimPackageResponse_dnlTrigReq(ts_profileDownloadTriggerRequest(eimTransactionId := '42'O))), tr_getEimPackageRequest); @@ -567,6 +564,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_indirect_prfle_dwnld(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_indirect_prfle_dwnld(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -592,14 +596,10 @@
/* A testcase to try out an the Generic eUICC Package Download and Execution Procedure, * See also: GSMA SGP.32, section 3.3.1: Generic eUICC Package Download and Execution */ -private function f_TC_proc_euicc_pkg_dwnld_exec(charstring id) runs on IPAd_ConnHdlr { +private function f_package_euicc_pkg_dwnld_exec(charstring id) runs on IPAd_ConnHdlr { template (value) EuiccPackageSigned euiccPackageSigned := ts_euiccPackageSigned(eimTransactionId := '42'O); template (present) EuiccPackageRequest euiccPackageRequest := ts_euiccPackageRequest(euiccPackageSigned);
- f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* Step #1-#2 */ f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccPkgReq(euiccPackageRequest)), tr_getEimPackageRequest);
@@ -626,6 +626,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_euicc_pkg_dwnld_exec(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_euicc_pkg_dwnld_exec(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -652,11 +659,7 @@
/* A testcase to try out an the Generic eUICC Package Download and Execution Procedure, * but this time we force a rollback meneuver */ -private function f_TC_proc_euicc_pkg_dwnld_exec_rollback(charstring id) runs on IPAd_ConnHdlr { - f_exec_ipad(); - f_es10x_init(); - f_http_register(); - +private function f_package_euicc_pkg_dwnld_exec_rollback(charstring id) runs on IPAd_ConnHdlr { /* Step #1-#2 */ f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccPkgReq), tr_getEimPackageRequest);
@@ -702,6 +705,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_euicc_pkg_dwnld_exec_rollback(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_euicc_pkg_dwnld_exec_rollback(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -727,13 +737,9 @@
/* A testcase to try out an IpaEuiccDataRequest */ -private function f_TC_proc_euicc_data_req(charstring id) runs on IPAd_ConnHdlr { +private function f_package_euicc_data_req(charstring id) runs on IPAd_ConnHdlr { var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
- f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* IPAd requests a package, we tell it to execute an ipaEuiccDataRequest */ f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccDataReq(ts_ipaEuiccDataRequest(eimTransactionId := '42'O))), tr_getEimPackageRequest); @@ -753,6 +759,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_euicc_data_req(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_euicc_data_req(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -983,17 +996,12 @@ }
/* A testcase to test the forwarding of a PSMO and the expected otherSignedNotification */ -private function f_TC_euiccPackageRequest_PSMO(charstring id) runs on IPAd_ConnHdlr { +private function f_package_euiccPackageRequest_PSMO(charstring id) runs on IPAd_ConnHdlr { template (value) EuiccPackage euiccPackage := ts_euiccPackage_setFallbackAttribute; template (value) EuiccPackageSigned euiccPackageSigned := ts_euiccPackageSigned(euiccPackage); template (value) EuiccPackageRequest euiccPackageRequest := ts_euiccPackageRequest(euiccPackageSigned); template (value) OtherSignedNotification otherSignedNotification := ts_otherSignedNotification(euiccCertificate := ts_cert_eum_nist, eumCertificate := ts_cert_eum_nist); - - f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* IPAd requests a package, we tell it to execute an euiccPackageRequest */ f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccPkgReq(euiccPackageRequest)), tr_getEimPackageRequest);
@@ -1010,6 +1018,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_euiccPackageRequest_PSMO(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_euiccPackageRequest_PSMO(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -1033,13 +1048,9 @@ }
/* A testcase to trigger an indirect profile download. This download will fail because the eUICC indicates so. */ -private function f_TC_proc_indirect_prfle_dwnld_cancel_euicc(charstring id) runs on IPAd_ConnHdlr { +private function f_package_indirect_prfle_dwnld_cancel_euicc(charstring id) runs on IPAd_ConnHdlr { var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
- f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* Prepare indirect profile download by responding with a download trigger request */ f_esipa_transceive(valueof(ts_getEimPackageResponse_dnlTrigReq(ts_profileDownloadTriggerRequest(eimTransactionId := '42'O))), tr_getEimPackageRequest); @@ -1065,6 +1076,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_indirect_prfle_dwnld_cancel_euicc(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_indirect_prfle_dwnld_cancel_euicc(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -1088,13 +1106,9 @@ }
/* A testcase to trigger an indirect profile download. This download will fail because the eIM indicates so. */ -private function f_TC_proc_indirect_prfle_dwnld_cancel_eim(charstring id) runs on IPAd_ConnHdlr { +private function f_package_indirect_prfle_dwnld_cancel_eim(charstring id) runs on IPAd_ConnHdlr { var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
- f_exec_ipad(); - f_es10x_init(); - f_http_register(); - /* Prepare indirect profile download by responding with a download trigger request */ f_esipa_transceive(valueof(ts_getEimPackageResponse_dnlTrigReq(ts_profileDownloadTriggerRequest(eimTransactionId := '42'O))), tr_getEimPackageRequest); @@ -1123,6 +1137,13 @@
/* IPAd will poll for notifications. */ f_respond_empty_notifications(); +} +private function f_TC_proc_indirect_prfle_dwnld_cancel_eim(charstring id) runs on IPAd_ConnHdlr { + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + f_package_indirect_prfle_dwnld_cancel_eim(id);
/* IPAd will poll for eIM package. */ f_terminate_poll_cycle(); @@ -1145,6 +1166,53 @@ setverdict(pass); }
+/* Test multiple packages at once. */ +private function f_TC_multi_packages(charstring id) runs on IPAd_ConnHdlr { + var integer i; + + f_exec_ipad(); + f_es10x_init(); + f_http_register(); + + for (i := 0; i < mp_tc_multi_package_rounds; i := i + 1) { + log("Test round ", i, " of ", mp_tc_multi_package_rounds); + log("Testing indirect_prfle_dwnld..."); + f_package_indirect_prfle_dwnld(id); + log("Testing euicc_pkg_dwnld_exec..."); + f_package_euicc_pkg_dwnld_exec(id); + log("Testing euicc_pkg_dwnld_exec_rollback..."); + f_package_euicc_pkg_dwnld_exec_rollback(id); + log("Testing euicc_data_req..."); + f_package_euicc_data_req(id); + log("Testing euiccPackageRequest_PSMO..."); + f_package_euiccPackageRequest_PSMO(id); + log("Testing indirect_prfle_dwnld_cancel_euicc..."); + f_package_indirect_prfle_dwnld_cancel_euicc(id); + log("Testing indirect_prfle_dwnld_cancel_eim..."); + f_package_indirect_prfle_dwnld_cancel_eim(id); + } + + /* IPAd will poll for eIM package. */ + f_terminate_poll_cycle(); + + /* Wait some time until the the last HTTP response is actually delivered */ + f_sleep(2.0); + + f_es10x_close(); + f_stop_ipad(); + + setverdict(pass); +} +testcase TC_multi_packages() runs on MTC_CT { + var charstring id := testcasename(); + var IPAd_ConnHdlrPars pars := f_init_pars(); + var IPAd_ConnHdlr vc_conn; + f_init(id, t_guard := 60.0 * int2float(mp_tc_multi_package_rounds)); + vc_conn := f_start_handler(refers(f_TC_multi_packages), pars); + vc_conn.done; + setverdict(pass); +} + control { execute ( TC_proc_indirect_prfle_dwnld() ); execute ( TC_proc_euicc_pkg_dwnld_exec() ); @@ -1161,6 +1229,7 @@ execute ( TC_euiccPackageRequest_PSMO() ); execute ( TC_proc_indirect_prfle_dwnld_cancel_euicc() ); execute ( TC_proc_indirect_prfle_dwnld_cancel_eim() ); + execute ( TC_multi_packages() ); }
}