dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43012?usp=email )
Change subject: eIM_Tests: add testcase to test stateChangeCause/stateChangeCause ......................................................................
eIM_Tests: add testcase to test stateChangeCause/stateChangeCause
The IPAd may pass a stateChangeCause with the getEimPackageRequest. The stateChangeCause is then recorded by the eIM and can be queried via the REST API. This patch adds a testcase to verify that functionality.
Related: SYS#8100 Change-Id: I6befc43f2dfd2178e352b9ab0a24a04d6e116fbb --- M eim/REST_Types_JSON.ttcn M eim/eIM_Tests.ttcn M library/euicc/SGP32Definitions.asn M library/euicc/SGP32Definitions_Templates.ttcn 4 files changed, 94 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/12/43012/1
diff --git a/eim/REST_Types_JSON.ttcn b/eim/REST_Types_JSON.ttcn index b82bea0..0a34939 100644 --- a/eim/REST_Types_JSON.ttcn +++ b/eim/REST_Types_JSON.ttcn @@ -74,14 +74,24 @@ octetstring tagList };
-type union JSON_REST_Euicc { + +type union JSON_REST_Euicc_State { integer counterValue, boolean consumerEuicc, integer associationToken, octetstring signAlgo, - octetstring signPubKey + octetstring signPubKey, + record of charstring stateChangeCauseList };
+type union JSON_REST_Euicc { + record of JSON_REST_Euicc_State set_, + record of charstring get +} with { + variant(set_) "JSON:name as set"; +}; + + type record JSON_REST_Resource { charstring eidValue, union { @@ -89,7 +99,7 @@ record of JSON_REST_Psmo psmo, record of JSON_REST_Eco eco, JSON_REST_Edr edr, - record of JSON_REST_Euicc euicc + JSON_REST_Euicc euicc } order };
@@ -160,7 +170,7 @@ charstring finalResult, charstring iccid optional } profileInstallationResult, - charstring euiccUpdateResult, + record of JSON_REST_Euicc_State euiccStateResult, record { charstring edrResult, record { @@ -178,11 +188,13 @@ } euiccDataResult }
+type record of JSON_REST_Result JSON_REST_Results; + type record JSON_REST_Response_long { charstring status, charstring timestamp, JSON_REST_Resource resource, - record of JSON_REST_Result outcome, + JSON_REST_Results outcome, charstring debuginfo };
@@ -219,12 +231,12 @@ }
-template (present) JSON_REST_Response tr_JSON_REST_success := { +template (present) JSON_REST_Response tr_JSON_REST_success(template JSON_REST_Results outcome := ?) := { long := { status := "done", timestamp := ?, resource := ?, - outcome := ?, + outcome := outcome, debuginfo := ? } } @@ -317,6 +329,16 @@ order := { edr := { tagList := tagList } } }
+template (value) JSON_REST_Resource ts_JSON_REST_euicc_set_order(octetstring eidValue, JSON_REST_Euicc_State setValue) := { + eidValue := oct2str(eidValue), + order := { euicc := { set_ := { setValue } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_euicc_get_order(octetstring eidValue, charstring stateName) := { + eidValue := oct2str(eidValue), + order := { euicc := { get := { stateName } } } +} + } with { encode "JSON"; } diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn index 5ed9176..8728082 100644 --- a/eim/eIM_Tests.ttcn +++ b/eim/eIM_Tests.ttcn @@ -297,7 +297,7 @@ } }
- if (not istemplatekind(expected_rest_res, "omit") and not match(rest_res, tr_JSON_REST_success)) { + if (not istemplatekind(expected_rest_res, "omit") and not match(rest_res, expected_rest_res)) { setverdict(fail, "unexpected REST lookup result from eIM"); }
@@ -892,6 +892,59 @@ setverdict(pass); }
+/* (see also above) Test enable PSMO */ +private function f_TC_proc_notifyStateChange(charstring id) runs on eIM_ConnHdlr { + var charstring resource_id; + var HTTP_Adapter_Params http_adapter_pars; + var template EsipaMessageFromEimToIpa esipa_res; + var JSON_REST_Euicc_State euiccState; + var JSON_REST_Result outcome; + + f_http_register(); + + f_init_pipe(); + http_adapter_pars := { + http_host := mp_esipa_ip, + http_port := mp_esipa_port, + use_ssl := not mp_esipa_disable_ssl + }; + f_http_init(http_adapter_pars); + + /* Ensure that the stateChangeCauseList at the eIM is empty, for that we set the stateChangeCauseList to an + * empty list. */ + euiccState.stateChangeCauseList := {}; + outcome.euiccStateResult := { euiccState }; + resource_id := f_rest_create_order("euicc", ts_JSON_REST_euicc_set_order(eID, euiccState)); + f_sleep(1.5); + f_rest_lookup_resource(resource_id, "euicc", tr_JSON_REST_success({outcome})); + f_rest_delete_resource(resource_id, "euicc"); + + /* Check the eIM for new eIM packages and set notifyStateChange/stateChangeCause. Since we haven't issued any + * orders we expect an eimPackageError (noEimPackageAvailable) */ + esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(eID, notifyStateChange := NULL, stateChangeCause := 6)), + tr_getEimPackageResponse_eimPkgErr(1)); + + /* After the getEimPackageRequest, we expect to find the stateChangeCause in the stateChangeCauseList */ + euiccState.stateChangeCauseList := { "deviceChange" }; + outcome.euiccStateResult := { euiccState }; + resource_id := f_rest_create_order("euicc", ts_JSON_REST_euicc_get_order(eID, "stateChangeCauseList")); + f_sleep(1.5); + f_rest_lookup_resource(resource_id, "euicc", tr_JSON_REST_success({outcome})); + f_rest_delete_resource(resource_id, "euicc"); + + f_sleep(2.0); + setverdict(pass); +} +testcase TC_proc_notifyStateChange() runs on MTC_CT { + var charstring id := testcasename(); + var eIM_ConnHdlrPars pars := f_init_pars(); + var eIM_ConnHdlr vc_conn; + f_init(id); + vc_conn := f_start_handler(refers(f_TC_proc_notifyStateChange), pars); + vc_conn.done; + setverdict(pass); +} + control { execute ( TC_proc_indirect_prfle_dwnld() ); execute ( TC_proc_euicc_pkg_dwnld_exec_enable_psmo() ); @@ -910,6 +963,7 @@ execute ( TC_proc_euicc_pkg_dwnld_exec_listEim_eco() ); execute ( TC_proc_euicc_data_req() ); execute ( TC_proc_euicc_data_req_err() ); + execute ( TC_proc_notifyStateChange() ); }
} diff --git a/library/euicc/SGP32Definitions.asn b/library/euicc/SGP32Definitions.asn index 69c3bf3..93b31b2 100644 --- a/library/euicc/SGP32Definitions.asn +++ b/library/euicc/SGP32Definitions.asn @@ -8,6 +8,11 @@ IMPORTS Certificate, SubjectPublicKeyInfo FROM PKIX1Explicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-explicit(18)} SubjectKeyIdentifier FROM PKIX1Implicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit(19)} CancelSessionReason, ServerSigned1, RspCapability, Iccid, TransactionId, ProfileInfoListRequest, RulesAuthorisationTable, EUICCInfo1, DeviceInfo, VersionType, UICCCapability, PprIds, CertificationDataObject, Octet1, Octet16, Octet32, PrepareDownloadResponseOk, PrepareDownloadResponseError, AuthenticateResponseError, CtxParams1, ProfileInstallationResultData, OtherSignedNotification, EuiccSignPIR, ErrorResult, NotificationMetadata, CancelSessionResponseOk, SmdpSigned2, BoundProfilePackage, NotificationEvent, VendorSpecificExtension, DpProprietaryData, OperatorId, NotificationConfigurationInformation, ProfileClass, IconType, ProfileState, OctetTo16 FROM RSPDefinitions {joint-iso-itu-t(2) international-organizations(23) gsma(146) rsp(1) asn1modules(1) sgp22v2(2)}; + +-- workaround for TTCN3, define a usable "AsnNull" type since "NULL" cannot be used as a type when defining template +-- parameters. +AsnNull ::= NULL + EuiccPackageRequest ::= [81] SEQUENCE { -- Tag ' BF51', #SupportedForPsmoV1.0.0# euiccPackageSigned EuiccPackageSigned, eimSignature [APPLICATION 55] OCTET STRING -- Tag '5F37' diff --git a/library/euicc/SGP32Definitions_Templates.ttcn b/library/euicc/SGP32Definitions_Templates.ttcn index 13110ab..bdc5fba 100644 --- a/library/euicc/SGP32Definitions_Templates.ttcn +++ b/library/euicc/SGP32Definitions_Templates.ttcn @@ -272,11 +272,13 @@ } } template (value) EsipaMessageFromIpaToEim -ts_getEimPackageRequest(template (value) octetstring eidValue) := { +ts_getEimPackageRequest(template (value) octetstring eidValue, + template (omit) AsnNull notifyStateChange := omit, + template (omit) integer stateChangeCause := omit) := { getEimPackageRequest := { eidValue := eidValue, - notifyStateChange := omit, - stateChangeCause := omit, + notifyStateChange := notifyStateChange, + stateChangeCause := stateChangeCause, rPLMN := omit } }