jolly has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43269?usp=email )

 (

6 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: IPAd: Add test for function ES10b.ExecuteFallbackMechanism
......................................................................

IPAd: Add test for function ES10b.ExecuteFallbackMechanism

Related: SYS#8101
Change-Id: I66745a24e227ac5c638f6dc5228f7f3fbe2deea1
---
M ipad/IPAd_Tests.ttcn
M library/euicc/SGP32Definitions_Templates.ttcn
M library/euicc/SGP32Definitions_Types.ttcn
3 files changed, 70 insertions(+), 8 deletions(-)

Approvals:
  dexter: Looks good to me, approved
  osmith: 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 d93297b..a126dd5 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -297,23 +297,27 @@

 /* Expect a pre-defined request (optional), and send a pre-defined response. 
This is a shortcut that only works in case
  * the response does not depend on the request. */
-private function f_vpcd_transceive(octetstring response, octetstring 
expected_request := ''O) runs on IPAd_ConnHdlr {
+private function f_vpcd_transceive(octetstring response,
+                                  octetstring expected_request := ''O) runs on 
IPAd_ConnHdlr return octetstring {
+       var octetstring request;

        /* In case we do not use the VPCD (because we have some other kind of 
eUICC emulation or even a real card
         * present), we just skip. */
        if (mp_use_vpcd == false) {
-               return;
+               return ''O;
        }

-       f_vpcd_store_data(expected_request);
+       request := f_vpcd_store_data(expected_request);
        f_vpcd_store_data_final_ack(lengthof(response));
        if (response != ''O) {
                f_vpcd_get_response_multi(response);
        }
+       return request;
 }

 /* Handle the opening of logical channel 1 and the selection of the ISD-R */
-private function f_es10x_init(boolean iot := true) runs on IPAd_ConnHdlr {
+private function f_es10x_init(boolean iot := true,
+                             boolean eim_init := true) runs on IPAd_ConnHdlr {
        var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);

        /* If we decide not to use vpcd, then we must not initialize anything 
here */
@@ -342,11 +346,14 @@
        /* Expect the IPAd to query the eID from the eUICC */
        
f_vpcd_transceive(enc_GetEuiccDataResponse(valueof(ts_getEuiccDataResponse)), 
'BF3E035C015A'O);

-       /* Expect the IPAd to query the eIM configuration data from the eUICC */
-       
f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))),
 'BF5500'O);
+       /* Not all tests expect IPAd to query eUICC data and notfications 
before talking to eIM. */
+       if (eim_init) {
+               /* Expect the IPAd to query the eIM configuration data from the 
eUICC */
+               
f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))),
 'BF5500'O);

-       /* Expect the IPAd to query the eUICC for pending notifications, we 
respond with an empty list */
-       
f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse_empty)),
 'BF2B00'O);
+               /* Expect the IPAd to query the eUICC for pending 
notifications, we respond with an empty list */
+               
f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse_empty)),
 'BF2B00'O);
+       }
 }

 /* Handle the closing of logical channel 1 */
@@ -761,12 +768,39 @@
        setverdict(pass);
 }

+/* A testcase to tigger the 'execute fallback mechanism' via ES10b interface */
+private function f_TC_func_exec_fallback_mech(charstring id) runs on 
IPAd_ConnHdlr {
+       f_exec_ipad("execute-fallback-mechanism");
+       f_es10x_init(eim_init := false);
+
+       var octetstring asn := 
f_vpcd_transceive(enc_ExecuteFallbackMechanismResponse(valueof(ts_executeFallbackMechanismResponse(0))),
 ''O);
+       var ExecuteFallbackMechanismRequest req := 
dec_ExecuteFallbackMechanismRequest(asn);
+       if (not match(req, tr_executeFallbackMechanismRequest())) {
+               setverdict(fail, "Unexpected ES10b request: ", req);
+       }
+
+       f_es10x_close();
+       f_stop_ipad();
+
+       setverdict(pass);
+}
+testcase TC_func_exec_fallback_mech() runs on MTC_CT {
+       var charstring id := testcasename();
+       var IPAd_ConnHdlrPars pars := f_init_pars();
+       var IPAd_ConnHdlr vc_conn;
+       f_init(id);
+       vc_conn := f_start_handler(refers(f_TC_func_exec_fallback_mech), pars);
+       vc_conn.done;
+       setverdict(pass);
+}
+
 control {
        execute ( TC_proc_indirect_prfle_dwnld() );
        execute ( TC_proc_euicc_pkg_dwnld_exec() );
        execute ( TC_proc_euicc_pkg_dwnld_exec_rollback() );
        execute ( TC_proc_euicc_data_req() );
        execute ( TC_get_eim_pkg_req_rej() );
+       execute ( TC_func_exec_fallback_mech() );
 }

 }
diff --git a/library/euicc/SGP32Definitions_Templates.ttcn 
b/library/euicc/SGP32Definitions_Templates.ttcn
index 7bd36bd..a3e5914 100644
--- a/library/euicc/SGP32Definitions_Templates.ttcn
+++ b/library/euicc/SGP32Definitions_Templates.ttcn
@@ -1631,6 +1631,24 @@
        }
 }

+/* GSMA SGP.32, section 5.9.20 */
+template (present) ExecuteFallbackMechanismRequest
+tr_executeFallbackMechanismRequest(template (present) boolean refreshFlag := 
?) := {
+       refreshFlag := refreshFlag
+}
+template (value) ExecuteFallbackMechanismRequest
+ts_executeFallbackMechanismRequest(template (value) boolean refreshFlag := 
false) := {
+       refreshFlag := refreshFlag
+}
+template (present) ExecuteFallbackMechanismResponse
+tr_executeFallbackMechanismResponse(template (present) integer errorCode := ?) 
:= {
+       executeFallbackMechanismResult := errorCode
+}
+template (value) ExecuteFallbackMechanismResponse
+ts_executeFallbackMechanismResponse(template (value) integer errorCode := 127) 
:= {
+       executeFallbackMechanismResult := errorCode
+}
+
 /* GSMA SGP.32, section 5.9.4 */
 template (present) AddInitialEimResponse
 tr_addInitialEimResponse := {
diff --git a/library/euicc/SGP32Definitions_Types.ttcn 
b/library/euicc/SGP32Definitions_Types.ttcn
index c344823..4dc53f9 100644
--- a/library/euicc/SGP32Definitions_Types.ttcn
+++ b/library/euicc/SGP32Definitions_Types.ttcn
@@ -48,4 +48,14 @@
 external function enc_ProfileRollbackResponse(in ProfileRollbackResponse msg) 
return octetstring
 with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };

+external function dec_ExecuteFallbackMechanismRequest(in octetstring stream) 
return ExecuteFallbackMechanismRequest
+with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" };
+external function enc_ExecuteFallbackMechanismRequest(in 
ExecuteFallbackMechanismRequest msg) return octetstring
+with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
+
+external function dec_ExecuteFallbackMechanismResponse(in octetstring stream) 
return ExecuteFallbackMechanismResponse
+with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" };
+external function enc_ExecuteFallbackMechanismResponse(in 
ExecuteFallbackMechanismResponse msg) return octetstring
+with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
+
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43269?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I66745a24e227ac5c638f6dc5228f7f3fbe2deea1
Gerrit-Change-Number: 43269
Gerrit-PatchSet: 7
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>

Reply via email to