laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
eIM_Tests: add a subset of SGP.33-3/SGP.23 testcases

GSMA SGP.33-3 describes a number of testcases. Let's pick a subset
of useful testcases and add those to the testsuite.

Change-Id: Ide8fdec56eca4d4577baedfacd2a6a675d9c0e6e
Related: SYS#8203
---
M eim/eIM_Tests.ttcn
M eim/prepare.sh
2 files changed, 731 insertions(+), 1 deletion(-)

diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn
index 1ad6efa..29ccfdd 100644
--- a/eim/eIM_Tests.ttcn
+++ b/eim/eIM_Tests.ttcn
@@ -129,7 +129,7 @@
return vc_conn;
}

-private function f_init(charstring id, float t_guard := 40.0) runs on MTC_CT {
+private function f_init(charstring id, float t_guard := 60.0) runs on MTC_CT {
g_Tguard.start(t_guard);
activate(as_Tguard());

@@ -207,6 +207,15 @@
HTTP_SRV[0].send(ts_http_resp(es9p_res_json));
}

+/* Send Es9p HTTP response (error) */
+private function f_es9p_send_err(template JSON_ESx_ResponseHeader json_err) runs on eIM_ConnHdlr {
+ var charstring es9p_res_json;
+ var JSON_ES9p_RemoteProfileProvisioningResponse json_pdu;
+ json_pdu.emptyResponse.header := valueof(json_err);
+ es9p_res_json := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu));
+ HTTP_SRV[0].send(ts_http_resp(es9p_res_json));
+}
+
/* Perform Es9p HTTP request/response cycle */
private function f_es9p_transceive(RemoteProfileProvisioningResponse es9p_res,
template RemoteProfileProvisioningRequest expected_es9p_req := omit)
@@ -1012,7 +1021,702 @@
setverdict(pass);
}

+/* See SGP.33-3, section 4.2.12.2.1, Test Sequence #01 and SGP.23, section 4.4.23.2.1, Test Sequence #01 */
+private function f_TC_eIM_AuthenticateClient_Nominal_without_Confirmation_Code(charstring id) runs on eIM_ConnHdlr {
+ var charstring resource_id;
+ var template EsipaMessageFromEimToIpa esipa_res;
+ var octetstring eim_transaction_id;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+ var charstring activationCode := f_SGP23_ACTIVATION_CODE_1(test_dp_address := smdpp_addr);
+
+ /* Create a new download at the eIM */
+ resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(SGP23_EID1, activationCode));
+
+ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the
+ * activationCode that we have created the download with (see above) */
+ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(SGP23_EID1)),
+ tr_getEimPackageResponse_dnlTrigReq(
+ tr_profileDownloadTriggerRequest(activationCode)));
+ eim_transaction_id := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
+
+
+ /* Step IC1/IC2: */
+ f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(euiccChallenge := SGP23_S_EUICC_CHALLENGE,
+ smdpAddress := smdpp_addr,
+ eimTransactionId := eim_transaction_id)));
+ f_es9p_receive(tr_initiateAuthenticationRequest(euiccChallenge := SGP23_S_EUICC_CHALLENGE,
+ smdpAddress := smdpp_addr));
+
+ /* Step 1a Initiate Authentication Response */
+ var template RemoteProfileProvisioningResponse INITIATE_AUTH_OK :=
+ ts_initiateAuthenticationResponse(
+ transactionId := SGP23_S_TRANSACTION_ID,
+ serverSigned1 := ts_serverSigned1(transactionId := SGP23_S_TRANSACTION_ID,
+ euiccChallenge := SGP23_S_EUICC_CHALLENGE,
+ serverAddress := smdpp_addr,
+ serverChallenge := SGP23_SMDP_CHALLENGE),
+ serverSignature1 := SGP23_SERVER_SIGNATURE1,
+ euiccCiPKIdToBeUsed := SGP23_EUICC_CI_PK_ID_TO_BE_USED,
+ serverCertificate := ts_cert_s_sm_dpauth_nist);
+ f_es9p_send(valueof(INITIATE_AUTH_OK));
+ var template EsipaMessageFromEimToIpa R_INITIATE_AUTH_OK :=
+ tr_initiateAuthenticationResponseEsipa(transactionId := SGP23_S_TRANSACTION_ID,
+ serverSigned1 := tr_serverSigned1,
+ serverSignature1 := SGP23_SERVER_SIGNATURE1,
+ euiccCiPKIdentifierToBeUsed := SGP23_EUICC_CI_PK_ID_TO_BE_USED,
+ serverCertificate := ?,
+ matchingId := omit,
+ ctxParams1 := omit)
+ f_esipa_receive(R_INITIATE_AUTH_OK);
+
+ /* Step 1b: Authenticatate Server Response */
+ var template SGP32_AuthenticateServerResponse SGP32_S_AUTH_SERVER_MATCH_ID_DEV_INFO :=
+ ts_SGP32_authenticateServerResponse(
+ euiccSigned1 := ts_SGP32_euiccSigned1(transactionId := SGP23_S_TRANSACTION_ID,
+ serverAddress := smdpp_addr,
+ serverChallenge := SGP23_SMDP_CHALLENGE,
+ ctxParams1 := ts_ctxParams1(matchingId := SGP23_MATCHING_ID_1,
+ imei := SGP23_S_IMEI,
+ tac := SGP23_S_TAC)
+ ),
+ euiccSignature1 := SGP23_EUICC_SIGNATURE1,
+ euiccCertificate := ts_cert_euicc_nist,
+ eumCertificate := ts_cert_eum_nist);
+ f_esipa_send(valueof(ts_authenticateClientRequestEsipa(authenticateServerResponse :=
+ SGP32_S_AUTH_SERVER_MATCH_ID_DEV_INFO)));
+ var template AuthenticateServerResponse R_AUTH_SERVER_MATCH_ID_DEV_INFO :=
+ tr_authenticateServerResponse(transactionId := SGP23_S_TRANSACTION_ID,
+ serverAddress := smdpp_addr,
+ serverChallenge := SGP23_SMDP_CHALLENGE,
+ ctxParams1 := tr_ctxParams1(matchingId := SGP23_MATCHING_ID_1,
+ imei := SGP23_S_IMEI, tac := SGP23_S_TAC),
+ euiccSignature1 := SGP23_EUICC_SIGNATURE1,
+ euiccCertificate := ?,
+ eumCertificate := ?);
+ f_es9p_receive(tr_authenticateClientRequest(transactionId := SGP23_S_TRANSACTION_ID,
+ authenticateServerResponse := R_AUTH_SERVER_MATCH_ID_DEV_INFO));
+
+ /* Step 2a: Download profile normally */
+ f_es9p_send(valueof(ts_authenticateClientResponseEs9));
+ f_esipa_receive(tr_authenticateClientResponseEsipa_dpe);
+ f_esipa_send(valueof(ts_getBoundProfilePackageRequestEsipa));
+ f_es9p_transceive(valueof(ts_getBoundProfilePackageResponse), tr_getBoundProfilePackageRequest);
+ f_esipa_receive(tr_getBoundProfilePackageResponseEsipa);
+
+ /* Step 2b: Remove rest resource
+ * (Even though the profile package is downloaded at this point, the transaction will still linger because
+ * the eIM is waiting for the notification that confirms the success or failure of the download. When we
+ * delete the rest resource, this lingering transaction is also removed from the eIM and the testcase
+ * should exit with a clean state) */
+ f_rest_delete_resource(resource_id, "download");
+
+ f_sleep(2.0);
+ setverdict(pass);
+}
+testcase TC_eIM_AuthenticateClient_Nominal_without_Confirmation_Code() 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_eIM_AuthenticateClient_Nominal_without_Confirmation_Code), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* Helper function to generate a common eIM related error case.
+ * See SGP.33-3, section 4.2.12.2.2, and SGP.23, section 4.4.23.2.2 */
+private function f_TC_eIM_AuthenticateClient_ErrorCases_Error_eim(
+ charstring id,
+ charstring subjectCode,
+ charstring reasonCode)
+runs on eIM_ConnHdlr {
+ var charstring resource_id;
+ var template JSON_REST_Results expected_outcome := { { authenticateClientError := "undefinedError" } };
+ var template EsipaMessageFromEimToIpa esipa_res;
+ var octetstring eim_transaction_id;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+ var charstring activation_code := f_SGP23_ACTIVATION_CODE_1(test_dp_address := smdpp_addr);
+
+ /* Create a new download at the eIM */
+ resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(SGP23_EID1, activation_code));
+
+ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the
+ * activationCode that we have created the download with (see above) */
+ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(SGP23_EID1)),
+ tr_getEimPackageResponse_dnlTrigReq(
+ tr_profileDownloadTriggerRequest(activation_code)));
+ eim_transaction_id := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
+
+ /* Step IC1/IC2: */
+ f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(smdpAddress := smdpp_addr,
+ eimTransactionId := eim_transaction_id)));
+ f_es9p_receive(tr_initiateAuthenticationRequest);
+
+ /* Step 1 Initiate Authentication Response */
+ f_es9p_send(valueof(ts_initiateAuthenticationResponse));
+ f_esipa_receive(tr_initiateAuthenticationResponseEsipa);
+ f_esipa_send(valueof(ts_authenticateClientRequestEsipa));
+ f_es9p_receive(tr_authenticateClientRequest);
+
+ /* Step 2a: SM-DP+ error response */
+ f_es9p_send_err(ts_responseHeader(status := "Failed",
+ statusCodeData := ts_statusCodeData(subjectCode := subjectCode,
+ reasonCode := reasonCode)));
+ f_esipa_receive(tr_authenticateClientResponseEsipa_err, tr_statusCodeData);
+
+ /* Step 2a: Check outcome and remove rest resource */
+ f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success(outcome := expected_outcome) );
+ f_rest_delete_resource(resource_id, "download");
+
+ f_sleep(2.0);
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.12.2.2, Test Sequence #01 and SGP.23, section 4.4.23.2.2, Test Sequence #01 */
+private function f_TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_EUM_Certificate(charstring id)
+runs on eIM_ConnHdlr {
+ f_TC_eIM_AuthenticateClient_ErrorCases_Error_eim(id, "8.1.2", "6.1");
+}
+testcase TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_EUM_Certificate() 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_eIM_AuthenticateClient_ErrorCases_Error_Invalid_EUM_Certificate), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* Helper function to generate a common IPAd related error case.
+ * See SGP.33-3, section 4.2.12.2.2, and SGP.23, section 4.4.23.2.2 */
+private function f_TC_eIM_AuthenticateClient_ErrorCases_Error_ipad(
+ template RemoteProfileProvisioningResponse invalid_authenticateClientResponseEs9)
+runs on eIM_ConnHdlr {
+ var charstring resource_id;
+ var template JSON_REST_Results expected_outcome := { { eimProcedureError := "stuckOrder" } };
+ var template EsipaMessageFromEimToIpa esipa_res;
+ var octetstring eim_transaction_id;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+ var charstring activation_code := f_SGP23_ACTIVATION_CODE_1(test_dp_address := smdpp_addr);
+
+ /* Create a new download at the eIM */
+ resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(SGP23_EID1, activation_code));
+
+ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the
+ * activationCode that we have created the download with (see above) */
+ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(SGP23_EID1)),
+ tr_getEimPackageResponse_dnlTrigReq(
+ tr_profileDownloadTriggerRequest(activation_code)));
+ eim_transaction_id := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
+
+ /* Step IC1/IC2: */
+ f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(smdpAddress := smdpp_addr,
+ eimTransactionId := eim_transaction_id)));
+ f_es9p_receive(tr_initiateAuthenticationRequest);
+
+ /* Step 1 Initiate Authentication Response */
+ f_es9p_send(valueof(ts_initiateAuthenticationResponse));
+ f_esipa_receive(tr_initiateAuthenticationResponseEsipa);
+ f_esipa_send(valueof(ts_authenticateClientRequestEsipa));
+ f_es9p_receive(tr_authenticateClientRequest);
+
+ /* Step 2a: SM-DP+ responds with invalid response */
+ f_es9p_send(valueof(invalid_authenticateClientResponseEs9));
+ f_esipa_receive(tr_authenticateClientResponseEsipa_dpe);
+
+ /* Step 2b: IPAd aborts the procedure by doing nothing. After some time (30 sec.), the eIM should detect that
+ * nothing happens anymore and mark the order as stuck. To allow this testcase to succed, the sys.config value
+ * for rest_timeout_stuck must be set low enough. A recommended setting is 15 sec. */
+ f_sleep(30.0);
+
+ /* Step 2c: Check outcome and remove rest resource, we expect that the eIM has detected a stuck order */
+ f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success(outcome := expected_outcome) );
+ f_rest_delete_resource(resource_id, "download");
+
+ f_sleep(2.0);
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.12.2.2, Test Sequence #15 and SGP.23, section 4.4.23.2.2, Test Sequence #15 */
+private function f_TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_SM_DPp_pb_certificate(charstring id)
+runs on eIM_ConnHdlr {
+ f_TC_eIM_AuthenticateClient_ErrorCases_Error_ipad(ts_authenticateClientResponseEs9);
+}
+testcase TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_SM_DPp_pb_certificate() 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_eIM_AuthenticateClient_ErrorCases_Error_Invalid_SM_DPp_pb_certificate), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* Helper function to pass a notification (IPAd/TTCN3 -> eIM -> SM-DP+/TTCN3).
+ * See SGP.33-3, section 4.2.13.2.1 and SGP.23, section 4.4.24.2.1 */
+private function f_TC_eIM_ES9p_HandleNotification_Pass_Notifications(
+ template OtherSignedNotification otherSignedNotif_esipa,
+ template OtherSignedNotification otherSignedNotif_es9p)
+runs on eIM_ConnHdlr {
+ f_esipa_send(valueof(ts_handleNotificationEsipa_pendingNotif(
+ ts_SGP32_pendingNotification_otherSignedNotif(
+ otherSignedNotification := otherSignedNotif_esipa))));
+ f_es9p_transceive_empty_response(tr_handleNotification(
+ pendingNotification := tr_pendingNotification_otherSignedNotif(
+ otherSignedNotification := otherSignedNotif_es9p)));
+}
+
+/* Helper function to generate a (nominal) profile download.
+ * See SGP.33-3, section 4.2.13.2.1 and SGP.23, section 4.4.24.2.1 */
+private function f_TC_eIM_ES9p_HandleNotification_Nominal_PIR(
+ template SGP32_ProfileInstallationResult prfleInstRslt_esipa,
+ template ProfileInstallationResult prfleInstRslt_es9p,
+ template JSON_REST_Results expected_outcome := ?)
+runs on eIM_ConnHdlr {
+ var charstring resource_id;
+ var template EsipaMessageFromEimToIpa esipa_res;
+ var octetstring eim_transaction_id;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+ var charstring activation_code := f_SGP23_ACTIVATION_CODE_1(test_dp_address := smdpp_addr);
+
+ /* Create a new download at the eIM */
+ resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(SGP23_EID1, activation_code));
+
+ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the
+ * activationCode that we have created the download with (see above) */
+ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(SGP23_EID1)),
+ tr_getEimPackageResponse_dnlTrigReq(
+ tr_profileDownloadTriggerRequest(activation_code)));
+ eim_transaction_id := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
+
+ /* Step IC1/IC2: Initiate Authentication */
+ f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(smdpAddress := smdpp_addr,
+ eimTransactionId := eim_transaction_id)));
+ f_es9p_receive(tr_initiateAuthenticationRequest);
+ f_es9p_send(valueof(ts_initiateAuthenticationResponse));
+ f_esipa_receive(tr_initiateAuthenticationResponseEsipa);
+
+ /* Step IC3: Authenticate Client */
+ f_esipa_send(valueof(ts_authenticateClientRequestEsipa));
+ f_es9p_receive(tr_authenticateClientRequest);
+ f_es9p_send(valueof(ts_authenticateClientResponseEs9));
+ f_esipa_receive(tr_authenticateClientResponseEsipa_dpe);
+
+ /* Step IC4: Get Bound Profiele Package*/
+ f_esipa_send(valueof(ts_getBoundProfilePackageRequestEsipa));
+ f_es9p_transceive(valueof(ts_getBoundProfilePackageResponse), tr_getBoundProfilePackageRequest);
+ f_esipa_receive(tr_getBoundProfilePackageResponseEsipa);
+
+ /* Step 1/2a: Handle notification (Profile Installation Result)
+ * When the Notification arrives at the eIM, the eIM will record the Profile Installation Result from the
+ * notification and mark the download as done. */
+ f_esipa_send(valueof(ts_handleNotificationEsipa_pendingNotif(
+ ts_SGP32_pendingNotification_prfleInstRslt(prfleInstRslt_esipa))));
+ f_es9p_transceive_empty_response(tr_handleNotification(
+ tr_pendingNotification_prfleInstRslt(prfleInstRslt_es9p)));
+
+ /* Step 1/2b: Check REST API result (outcome), then remove order from REST API */
+ f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success(outcome := expected_outcome));
+ f_rest_delete_resource(resource_id, "download");
+}
+
+/* See SGP.33-3, section 4.2.13.2.1, Test Sequence #01 and SGP.23, section 4.4.24.2.1, Test Sequence #01 */
+private function f_TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Install_Notifications(charstring id)
+runs on eIM_ConnHdlr {
+ var template OtherSignedNotification otherSignedNotif_esipa;
+ var template OtherSignedNotification otherSignedNotif_es9p;
+ var template SGP32_ProfileInstallationResult prfleInstRslt_esipa;
+ var template ProfileInstallationResult prfleInstRslt_es9p;
+ var template JSON_REST_Results expected_outcome;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+
+ /* Step 1-2 */
+ prfleInstRslt_esipa := ts_SGP32_profileInstallationResult(
+ profileInstallationResultData :=
+ ts_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ prfleInstRslt_es9p := tr_profileInstallationResult(
+ profileInstallationResultData :=
+ tr_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ expected_outcome := {{profileInstallationResult := {iccid := oct2str(SGP23_ICCID_OP_PROF1),
+ aid := oct2str(SGP23_SSD_AID),
+ simaResponse := oct2str(SGP23_SIMA_RESULT_OK)}}};
+ f_TC_eIM_ES9p_HandleNotification_Nominal_PIR(prfleInstRslt_esipa, prfleInstRslt_es9p, expected_outcome);
+
+ /* Step 3/4: Handle notification (Other Signed Notification) */
+ otherSignedNotif_esipa := ts_otherSignedNotification(
+ tbsOtherNotification := ts_notificationMetadata(
+ seqNumber := 123456,
+ profileManagementOperation := '1'B, /* notificationInstall */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ otherSignedNotif_es9p := tr_otherSignedNotification(
+ tbsOtherNotification := tr_notificationMetadata(
+ seqNumber := 123456,
+ profileManagementOperation := '1'B, /* notificationInstall */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ f_TC_eIM_ES9p_HandleNotification_Pass_Notifications(otherSignedNotif_esipa, otherSignedNotif_es9p);
+
+ f_sleep(2.0);
+}
+testcase TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Install_Notifications() 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_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Install_Notifications), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.13.2.1, Test Sequence #02 and SGP.23, section 4.4.24.2.1, Test Sequence #02 */
+private function f_TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Enable_Notifications(charstring id)
+runs on eIM_ConnHdlr {
+ var template OtherSignedNotification otherSignedNotif_esipa;
+ var template OtherSignedNotification otherSignedNotif_es9p;
+ var template SGP32_ProfileInstallationResult prfleInstRslt_esipa;
+ var template ProfileInstallationResult prfleInstRslt_es9p;
+ var template JSON_REST_Results expected_outcome;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+
+ /* Step 1-2 */
+ prfleInstRslt_esipa := ts_SGP32_profileInstallationResult(
+ profileInstallationResultData :=
+ ts_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ prfleInstRslt_es9p := tr_profileInstallationResult(
+ profileInstallationResultData :=
+ tr_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ expected_outcome := {{profileInstallationResult := {iccid := oct2str(SGP23_ICCID_OP_PROF1),
+ aid := oct2str(SGP23_SSD_AID),
+ simaResponse := oct2str(SGP23_SIMA_RESULT_OK)}}};
+ f_TC_eIM_ES9p_HandleNotification_Nominal_PIR(prfleInstRslt_esipa, prfleInstRslt_es9p, expected_outcome);
+
+ /* Step 4: Handle notification (Other Signed Notification) */
+ otherSignedNotif_esipa := ts_otherSignedNotification(
+ tbsOtherNotification := ts_notificationMetadata(
+ seqNumber := 789,
+ profileManagementOperation := '01'B, /* notificationEnable */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+
+ otherSignedNotif_es9p := tr_otherSignedNotification(
+ tbsOtherNotification := tr_notificationMetadata(
+ seqNumber := 789,
+ profileManagementOperation := '01'B, /* notificationEnable */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ f_TC_eIM_ES9p_HandleNotification_Pass_Notifications(otherSignedNotif_esipa, otherSignedNotif_es9p);
+
+ f_sleep(2.0);
+}
+testcase TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Enable_Notifications() 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_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Enable_Notifications), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.13.2.1, Test Sequence #03 and SGP.23, section 4.4.24.2.1, Test Sequence #03 */
+private function f_TC_eIM_ES9p_HandleNotification_Nominal_Disable_and_Delete_Notifications(charstring id)
+runs on eIM_ConnHdlr {
+ var template OtherSignedNotification otherSignedNotif_esipa;
+ var template OtherSignedNotification otherSignedNotif_es9p;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+
+ /* Pass first Notification: Disable profile */
+ otherSignedNotif_esipa := ts_otherSignedNotification(
+ tbsOtherNotification := ts_notificationMetadata(
+ seqNumber := 7890,
+ profileManagementOperation := '001'B, /* notificationDisable */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+
+ otherSignedNotif_es9p := tr_otherSignedNotification(
+ tbsOtherNotification := tr_notificationMetadata(
+ seqNumber := 7890,
+ profileManagementOperation := '001'B, /* notificationDisable*/
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ f_TC_eIM_ES9p_HandleNotification_Pass_Notifications(otherSignedNotif_esipa, otherSignedNotif_es9p);
+
+ /* Pass second Notification: Delete profile */
+ otherSignedNotif_esipa := ts_otherSignedNotification(
+ tbsOtherNotification := ts_notificationMetadata(
+ seqNumber := 7890,
+ profileManagementOperation := '0001'B, /* notificationDelete */
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ otherSignedNotif_es9p := tr_otherSignedNotification(
+ tbsOtherNotification := tr_notificationMetadata(
+ seqNumber := 7890,
+ profileManagementOperation := '0001'B, /* notificationDelete*/
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1),
+ euiccNotificationSignature := SGP23_TBS_EUICC_NOTIF_SIG);
+ f_TC_eIM_ES9p_HandleNotification_Pass_Notifications(otherSignedNotif_esipa, otherSignedNotif_es9p);
+
+ f_sleep(2.0);
+}
+testcase TC_eIM_ES9p_HandleNotification_Nominal_Disable_and_Delete_Notifications() 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_eIM_ES9p_HandleNotification_Nominal_Disable_and_Delete_Notifications), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.13.2.1, Test Sequence #06 and SGP.23, section 4.4.24.2.1, Test Sequence #06 */
+private function f_TC_eIM_ES9p_HandleNotification_Nominal_Profile_Download_with_PIR_Failed(charstring id)
+runs on eIM_ConnHdlr {
+ var template OtherSignedNotification otherSignedNotif_esipa;
+ var template OtherSignedNotification otherSignedNotif_es9p;
+ var template SGP32_ProfileInstallationResult prfleInstRslt_esipa;
+ var template ProfileInstallationResult prfleInstRslt_es9p;
+ var template JSON_REST_Results expected_outcome;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+
+ /* Step 1-2 */
+ prfleInstRslt_esipa := ts_SGP32_profileInstallationResult(
+ profileInstallationResultData :=
+ ts_profileInstallationResultData_err(
+ notificationAddress := smdpp_addr),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ prfleInstRslt_es9p := tr_profileInstallationResult(
+ profileInstallationResultData :=
+ tr_profileInstallationResultData_err(
+ notificationAddress := smdpp_addr,
+ bppCommandId := 5, /* loadProfileElements */
+ errorReason := 1, /* incorrectInputValues */
+ simaResponse := omit),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ expected_outcome := {{profileInstallationError := {bppCommandId := "loadProfileElements",
+ errorReason := "incorrectInputValues",
+ simaResponse := ""}}};
+ f_TC_eIM_ES9p_HandleNotification_Nominal_PIR(prfleInstRslt_esipa, prfleInstRslt_es9p, expected_outcome);
+
+ f_sleep(2.0);
+}
+testcase TC_eIM_ES9p_HandleNotification_Nominal_Profile_Download_with_PIR_Failed() 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_eIM_ES9p_HandleNotification_Nominal_Profile_Download_with_PIR_Failed), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.13.2.1, Test Sequence #08 and SGP.23, section 4.4.24.2.1, Test Sequence #08 */
+private function f_TC_eIM_ES9p_No_Acknowledge_for_Successful_PIR_results_in_No_Further_Notifications(charstring id)
+runs on eIM_ConnHdlr {
+ var template OtherSignedNotification otherSignedNotif_esipa;
+ var template OtherSignedNotification otherSignedNotif_es9p;
+ var template SGP32_ProfileInstallationResult prfleInstRslt_esipa;
+ var template ProfileInstallationResult prfleInstRslt_es9p;
+ var template JSON_REST_Results expected_outcome;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+
+ /* Step 1-2 */
+ prfleInstRslt_esipa := ts_SGP32_profileInstallationResult(
+ profileInstallationResultData :=
+ ts_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ prfleInstRslt_es9p := tr_profileInstallationResult(
+ profileInstallationResultData :=
+ tr_profileInstallationResultData(
+ notificationAddress := smdpp_addr,
+ iccid := SGP23_ICCID_OP_PROF1,
+ aid := SGP23_SSD_AID,
+ simaResponse := SGP23_SIMA_RESULT_OK),
+ euiccSignPIR := SGP23_EUICC_SIGN_PIR);
+ expected_outcome := {{profileInstallationResult := {iccid := oct2str(SGP23_ICCID_OP_PROF1),
+ aid := oct2str(SGP23_SSD_AID),
+ simaResponse := oct2str(SGP23_SIMA_RESULT_OK)}}};
+
+
+ f_TC_eIM_ES9p_HandleNotification_Nominal_PIR(prfleInstRslt_esipa, prfleInstRslt_es9p, expected_outcome);
+
+ f_sleep(2.0);
+}
+testcase TC_eIM_ES9p_No_Acknowledge_for_Successful_PIR_results_in_No_Further_Notifications() 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_eIM_ES9p_No_Acknowledge_for_Successful_PIR_results_in_No_Further_Notifications), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
+/* See SGP.33-3, section 4.2.14.2.1, Test Sequence #01 and SGP.23, section 4.4.25.2.1, Test Sequence #01 */
+private function f_TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed(
+ charstring id,
+ template SGP32_CancelSessionResponse cancelSessionResponse_esipa,
+ template CancelSessionResponse cancelSessionResponse_es9p,
+ template JSON_REST_Results expected_outcome := ?,
+ boolean cancel_after_bpp_download)
+runs on eIM_ConnHdlr {
+ var charstring resource_id;
+ var template EsipaMessageFromEimToIpa esipa_res;
+ var octetstring eim_transaction_id;
+ var charstring smdpp_addr := mp_es9p_ip & ":" & int2str(mp_es9p_port)
+ var charstring activation_code := f_SGP23_ACTIVATION_CODE_1(test_dp_address := smdpp_addr);
+
+ /* Create a new download at the eIM */
+ resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(SGP23_EID1, activation_code));
+
+ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the
+ * activationCode that we have created the download with (see above) */
+ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(SGP23_EID1)),
+ tr_getEimPackageResponse_dnlTrigReq(
+ tr_profileDownloadTriggerRequest(activation_code)));
+ eim_transaction_id := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
+
+ /* Step IC1/IC2: Initiate Authentication */
+ f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(smdpAddress := smdpp_addr,
+ eimTransactionId := eim_transaction_id)));
+ f_es9p_receive(tr_initiateAuthenticationRequest);
+ f_es9p_send(valueof(ts_initiateAuthenticationResponse));
+ f_esipa_receive(tr_initiateAuthenticationResponseEsipa);
+
+ /* Step IC3: Authenticate Client */
+ f_esipa_send(valueof(ts_authenticateClientRequestEsipa));
+ f_es9p_receive(tr_authenticateClientRequest);
+ f_es9p_send(valueof(ts_authenticateClientResponseEs9));
+ f_esipa_receive(tr_authenticateClientResponseEsipa_dpe);
+
+ /* Step IC4: Get Bound Profiele Package
+ * (The testcase describe two possible variantes: The CancelSessionRequest may either occur before or
+ * after the GetBoundProfilePackageRequest. This testcase implementation can test both variants.) */
+ if (cancel_after_bpp_download == true) {
+ f_esipa_send(valueof(ts_getBoundProfilePackageRequestEsipa));
+ f_es9p_transceive(valueof(ts_getBoundProfilePackageResponse), tr_getBoundProfilePackageRequest);
+ f_esipa_receive(tr_getBoundProfilePackageResponseEsipa);
+ }
+
+ /* Step 1a: Cancel session */
+ f_esipa_send(valueof(ts_cancelSessionRequestEsipa(cancelSessionResponse := cancelSessionResponse_esipa)));
+ f_es9p_transceive_empty_response(tr_cancelSessionRequestEs9(cancelSessionResponse := cancelSessionResponse_es9p));
+
+ /* Step 1b: Verify REST-API result, remove rest resource */
+ f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success(outcome := expected_outcome));
+ f_rest_delete_resource(resource_id, "download");
+
+ f_sleep(2.0);
+}
+private function f_TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_after_bpp(charstring id)
+runs on eIM_ConnHdlr {
+ var template SGP32_CancelSessionResponse cancelSessionResponse_esipa;
+ var template CancelSessionResponse cancelSessionResponse_es9p;
+ var template JSON_REST_Results expected_outcome;
+
+ cancelSessionResponse_esipa :=
+ ts_SGP32_cancelSessionResponse(
+ cancelSessionResponseOk :=
+ ts_cancelSessionResponseOk(
+ reason := 3, /* pprNotAllowed */
+ euiccCancelSessionSignature := SGP23_EUICC_CANCEL_SESSION_SIGNATURE));
+ cancelSessionResponse_es9p :=
+ tr_cancelSessionResponse(
+ cancelSessionResponseOk :=
+ tr_cancelSessionResponseOk(
+ reason := 3, /* pprNotAllowed */
+ euiccCancelSessionSignature := SGP23_EUICC_CANCEL_SESSION_SIGNATURE));
+ expected_outcome := {{cancelSessionReason := "pprNotAllowed"}};
+
+ f_TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed(
+ id, cancelSessionResponse_esipa, cancelSessionResponse_es9p, expected_outcome, true);
+}
+testcase TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_after_bpp() 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_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_after_bpp), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+private function f_TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_before_bpp(charstring id)
+runs on eIM_ConnHdlr {
+ var template SGP32_CancelSessionResponse cancelSessionResponse_esipa;
+ var template CancelSessionResponse cancelSessionResponse_es9p;
+ var template JSON_REST_Results expected_outcome;
+
+ cancelSessionResponse_esipa :=
+ ts_SGP32_cancelSessionResponse(
+ cancelSessionResponseOk :=
+ ts_cancelSessionResponseOk(
+ reason := 3, /* pprNotAllowed */
+ euiccCancelSessionSignature := SGP23_EUICC_CANCEL_SESSION_SIGNATURE));
+ cancelSessionResponse_es9p :=
+ tr_cancelSessionResponse(
+ cancelSessionResponseOk :=
+ tr_cancelSessionResponseOk(
+ reason := 3, /* pprNotAllowed */
+ euiccCancelSessionSignature := SGP23_EUICC_CANCEL_SESSION_SIGNATURE));
+ expected_outcome := {{cancelSessionReason := "pprNotAllowed"}};
+
+ f_TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed(
+ id, cancelSessionResponse_esipa, cancelSessionResponse_es9p, expected_outcome, false);
+}
+testcase TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_before_bpp() 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_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_before_bpp), pars);
+ vc_conn.done;
+ setverdict(pass);
+}
+
control {
+ /* Custom testcases:
+ * The following testcases are custom testcases, which do not follow any official test specification. The
+ * testcases are set up to verify the basic functionality of the eIM. */
execute ( TC_proc_indirect_prfle_dwnld() );
execute ( TC_proc_indirect_prfle_dwnld_cancel_session() );
execute ( TC_proc_euicc_pkg_dwnld_exec_enable_psmo() );
@@ -1032,6 +1736,23 @@
execute ( TC_proc_euicc_data_req() );
execute ( TC_proc_euicc_data_req_err() );
execute ( TC_proc_notifyStateChange() );
+
+ /* SGP.33-3 testcases:
+ * Those test cases were originally designed as an end-to-end test for testing the full chain (SM-DP+, eIM,
+ * IPAd, eUICC). However, this testsuite tests the eIM in isolation, which means that the IPAd/eUICC part is
+ * also simulated by this testsuite. In this testsuite we only implement a small (useful) subset of the test
+ * specification. We may also apply simplifications to test vectors in case those have no significant impact
+ * on the test coverage. */
+ execute ( TC_eIM_AuthenticateClient_Nominal_without_Confirmation_Code() );
+ execute ( TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_EUM_Certificate() );
+ execute ( TC_eIM_AuthenticateClient_ErrorCases_Error_Invalid_SM_DPp_pb_certificate() );
+ execute ( TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Install_Notifications() );
+ execute ( TC_eIM_ES9p_HandleNotification_Nominal_Successful_PIR_and_Enable_Notifications() );
+ execute ( TC_eIM_ES9p_HandleNotification_Nominal_Disable_and_Delete_Notifications() );
+ execute ( TC_eIM_ES9p_HandleNotification_Nominal_Profile_Download_with_PIR_Failed() );
+ execute ( TC_eIM_ES9p_No_Acknowledge_for_Successful_PIR_results_in_No_Further_Notifications() );
+ execute ( TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_after_bpp() );
+ execute ( TC_eIM_ES9p_CancelSession_Nominal_Profile_Download_with_PPR1_not_allowed_before_bpp() );
}

}
diff --git a/eim/prepare.sh b/eim/prepare.sh
index abaff47..2bf2893 100755
--- a/eim/prepare.sh
+++ b/eim/prepare.sh
@@ -9,3 +9,12 @@
-i \
"s,^eIM_Tests\.mp_restop_path := .*,eIM_Tests.mp_restop_path := \"$RESTOP\"," \
$TESTSUITE_CONFIG
+
+# Reconfigure eIM REST timeout (sys.config, rest_timeout_stuck) to a value
+# suitable for this testsuite.
+SYS_CONFIG="$TESTENV_INSTALL_DIR"/etc/osmocom/onomondo-eim.config
+cat $SYS_CONFIG
+sed \
+ -i \
+ "s/\(^[[:space:]]*{rest_timeout_stuck,[[:space:]]\)[0-9]*/\115/g" \
+ $SYS_CONFIG

To view, visit change 43904. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ide8fdec56eca4d4577baedfacd2a6a675d9c0e6e
Gerrit-Change-Number: 43904
Gerrit-PatchSet: 13
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>