jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43268?usp=email )
Change subject: IPA: Start (and stop) IPAd from test cases ......................................................................
IPA: Start (and stop) IPAd from test cases
Start IPAd from test case, rather than running it in a shell loop during all tests. The IPAd is started for every test case. If it does not terminate for some reason, it is killed at the end.
Command line options can be added for later tests. This allows to test functions that are triggered/enabled/disabled via command line.
Related: SYS#8101 Change-Id: I178f8e8750bcd8e1ddbe9a16c615be4bb3e64c1c --- M ipad/IPAd_Tests.ttcn M ipad/gen_links.sh D ipad/ipad/nvstate.bin M ipad/regen_makefile.sh M ipad/testenv.cfg 5 files changed, 36 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/68/43268/1
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn index 95f6b06..31cc164 100644 --- a/ipad/IPAd_Tests.ttcn +++ b/ipad/IPAd_Tests.ttcn @@ -33,6 +33,10 @@ import from VPCD_CodecPort all; import from VPCD_Adapter all;
+import from PIPEasp_PortType all; +import from PIPEasp_Types all; +import from PIPEasp_Templates all; + modulepar { /* emulated eIM HTTPs server */ charstring mp_esipa_ip := "127.0.0.1"; @@ -92,6 +96,7 @@
type component IPAd_ConnHdlr extends HTTP_ConnHdlr, VPCD_Adapter_CT { var IPAd_ConnHdlrPars g_pars; + port PIPEasp_PT PIPE; };
type record IPAd_ConnHdlrPars { @@ -440,6 +445,19 @@ f_esipa_transceive(valueof(ts_getEimPackageResponse_noEimPackageAvailable), tr_getEimPackageRequest); }
+/* Run IPAd once in the background. + * Do a delayed start, so that the test case is ready to handle requests from IPAd. */ +private function f_exec_ipad(charstring parameters := "") runs on IPAd_ConnHdlr { + map(self:PIPE, system:PIPE); + f_PIPEasp_exec_async_start(PIPE, "sh", "sleep 1 ; onomondo-ipa -C example_ca/pki/issued/alttest.cabundle " & parameters & " 2>&1 | tee -i /tmp/single_log >> onomondo-ipa.log"); +} + +/* Stop IPAd, if still running. */ +private function f_stop_ipad(charstring parameters := "") runs on IPAd_ConnHdlr { + f_PIPEasp_exec_async_stop(PIPE, "onomondo-ipa"); + unmap(self:PIPE, system:PIPE); +} + /* ********************************************* */ /* ********** BELOW ONLY TESTCASES! ************ */ /* ********************************************* */ @@ -452,6 +470,7 @@ var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port); var BoundProfilePackage boundProfilePackage;
+ f_exec_ipad(); f_es10x_init(); f_http_register();
@@ -515,6 +534,7 @@ f_sleep(2.0);
f_es10x_close(); + f_stop_ipad();
setverdict(pass); } @@ -532,6 +552,7 @@ /* 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 { + f_exec_ipad(); f_es10x_init(); f_http_register();
@@ -562,6 +583,7 @@ f_sleep(2.0);
f_es10x_close(); + f_stop_ipad();
setverdict(pass); } @@ -580,6 +602,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();
@@ -633,6 +656,7 @@ f_sleep(2.0);
f_es10x_close(); + f_stop_ipad();
setverdict(pass); } @@ -652,6 +676,7 @@ private function f_TC_proc_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();
@@ -677,6 +702,7 @@ f_sleep(2.0);
f_es10x_close(); + f_stop_ipad();
setverdict(pass); } @@ -695,6 +721,7 @@ var EsipaMessageFromIpaToEim esipa_req; var EsipaMessageFromEimToIpa esipa_res;
+ f_exec_ipad(); f_es10x_init(); f_http_register();
@@ -705,6 +732,7 @@ f_sleep(2.0);
f_es10x_close(); + f_stop_ipad();
setverdict(pass); } diff --git a/ipad/gen_links.sh b/ipad/gen_links.sh index a0b8197..29bda02 100755 --- a/ipad/gen_links.sh +++ b/ipad/gen_links.sh @@ -26,6 +26,10 @@ FILES+="IPL4asp_discovery.cc IPL4asp_protocol_L234.hh" gen_links $DIR $FILES
+DIR=$BASEDIR/titan.TestPorts.PIPEasp/src +FILES="PIPEasp_PT.cc PIPEasp_PT.hh PIPEasp_Types.ttcn PIPEasp_PortType.ttcn " +gen_links $DIR $FILES + DIR=../library/euicc FILES="PEDefinitions.asn PKIX1Explicit88.asn PKIX1Implicit88.asn RSPDefinitions.asn SGP32Definitions.asn " FILES+="PKIX1Explicit88_Templates.ttcn PKIX1Explicit88_Types.ttcn PKIX1Implicit88_Templates.ttcn " @@ -36,7 +40,8 @@ DIR=../library FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc " FILES+="VPCD_Types.ttcn VPCD_CodecPort.ttcn VPCD_CodecPort_CtrlFunct.ttcn VPCD_CodecPort_CtrlFunctDef.cc " -FILES+="VPCD_Adapter.ttcn HTTP_Server_Emulation.ttcn" +FILES+="VPCD_Adapter.ttcn HTTP_Server_Emulation.ttcn " +FILES+="PIPEasp_Templates.ttcn " gen_links $DIR $FILES
gen_links_finish diff --git a/ipad/ipad/nvstate.bin b/ipad/ipad/nvstate.bin deleted file mode 100644 index 1832175..0000000 --- a/ipad/ipad/nvstate.bin +++ /dev/null Binary files differ diff --git a/ipad/regen_makefile.sh b/ipad/regen_makefile.sh index 021de52..c57199c 100755 --- a/ipad/regen_makefile.sh +++ b/ipad/regen_makefile.sh @@ -14,6 +14,7 @@ TCCConversion.cc TCCInterface.cc VPCD_CodecPort_CtrlFunctDef.cc + PIPEasp_PT.cc " . ../_buildsystem/regen_makefile.inc.sh
diff --git a/ipad/testenv.cfg b/ipad/testenv.cfg index 9d09b70..8fe7620 100644 --- a/ipad/testenv.cfg +++ b/ipad/testenv.cfg @@ -9,7 +9,6 @@ make=no
[ipad] -program=sh -c 'while true; do onomondo-ipa -I; echo "Restart IPAd in one second..."; sleep 1; done' +#program=no make=onomondo-ipa package=onomondo-ipa -copy=ipad/nvstate.bin