lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

July 2024

  • 1 participants
  • 1379 discussions
[S] Change in ...osmo-s1gw[master]: sctp_proxy: add type hints for public API
by laforge 12 Jul '24

12 Jul '24
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37458?usp=email ) Change subject: sctp_proxy: add type hints for public API ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37458?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-s1gw Gerrit-Branch: master Gerrit-Change-Id: I307e51f1130f08c219c6817629b856764ef7df59 Gerrit-Change-Number: 37458 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 12 Jul 2024 15:21:46 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in ...osmo-s1gw[master]: sctp_client: add type hints
by laforge 12 Jul '24

12 Jul '24
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37457?usp=email ) Change subject: sctp_client: add type hints ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37457?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-s1gw Gerrit-Branch: master Gerrit-Change-Id: I89f237706dfbd6004e7644b3b68446fab7f31c7c Gerrit-Change-Number: 37457 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 12 Jul 2024 15:21:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: asterisk: TC_ims_call_mo_2nd_mo_rejected
by laforge 12 Jul '24

12 Jul '24
Attention is currently required from: Hoernchen, jolly, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37476?usp=email ) Change subject: asterisk: TC_ims_call_mo_2nd_mo_rejected ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37476?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I7764e29e8df11ad65366642f83ebe922488bf128 Gerrit-Change-Number: 37476 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 12 Jul 2024 15:20:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[XL] Change in osmo-ttcn3-hacks[master]: eIM_Tests: add testsuite for an eIM
by laforge 12 Jul '24

12 Jul '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37300?usp=email ) Change subject: eIM_Tests: add testsuite for an eIM ...................................................................... eIM_Tests: add testsuite for an eIM This patch adds a testsuite for an eIM server component. It simulates the SM-DP+ server backend and the IPAd client while it operates the REST API of the eIM server. Change-Id: Iba72ee00d10aba7831feedadacd943bf943de53e Related: SYS#6824 --- M Makefile A eim/REST_Types_JSON.ttcn A eim/eIM_Tests.cfg A eim/eIM_Tests.default A eim/eIM_Tests.ttcn A eim/es9p_Types_JSON.ttcn A eim/gen_links.sh A eim/regen_makefile.sh A eim/server.crt A eim/server.key 10 files changed, 1,513 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve diff --git a/Makefile b/Makefile index cbb8083..64ebba6 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ cbc \ ccid \ dia2gsup \ + eim \ fr \ fr-net \ epdg \ diff --git a/eim/REST_Types_JSON.ttcn b/eim/REST_Types_JSON.ttcn new file mode 100644 index 0000000..dee54c9 --- /dev/null +++ b/eim/REST_Types_JSON.ttcn @@ -0,0 +1,299 @@ +/* REST message definitions for eIM REST API + * + * Author: Philipp Maier <pmaier(a)sysmocom.de> / sysmocom - s.f.m.c. GmbH + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module REST_Types_JSON { + +type record JSON_REST_download { + charstring activationCode +}; + +type union JSON_REST_Psmo { + record { + octetstring iccid, + boolean rollback + } enable, + record { + octetstring iccid + } disable, + record { + octetstring iccid + } delete, + record { + union { + octetstring isdpAid, + octetstring iccid, + integer profileClass + } searchCriteria optional, + octetstring tagList optional + } listProfileInfo, + record { + } getRAT, + record { + boolean autoEnableFlag, + objid smdpOid optional, + charstring smdpAddress optional + } configureAutoEnable +}; + +type union JSON_REST_Eco { + record { + /* ASN.1 encoded EimConfigurationData */ + octetstring eimConfigurationData + } addEim, + record { + charstring eimId + } deleteEim, + record { + /* ASN.1 encoded EimConfigurationData */ + octetstring eimConfigurationData + } updateEim, + record { + } listEim +}; + +type record JSON_REST_Edr { + octetstring tagList +}; + +type union JSON_REST_Euicc { + integer counterValue, + boolean consumerEuicc, + integer associationToken, + octetstring signAlgo, + octetstring signPubKey +}; + +type record JSON_REST_Resource { + charstring eidValue, + union { + JSON_REST_download download, + record of JSON_REST_Psmo psmo, + record of JSON_REST_Eco eco, + JSON_REST_Edr edr, + record of JSON_REST_Euicc euicc + } order +}; + +type record JSON_REST_ProfileInfo { + charstring iccid optional, + charstring isdpAid optional, + charstring profileState optional, + charstring profileNickname optional, + charstring serviceProviderName optional, + charstring profileName optional, + charstring iconType optional, + charstring icon optional, + charstring profileClass optional + //TODO: notificationConfigurationInfo + //TODO: profileOwner + //TODO: dpProprietaryData + //TODO: profilePolicyRules + //TODO: serviceSpecificDataStoredInEuicc +}; + +type record JSON_REST_EimIdList { + charstring eimId, + charstring eimIdType optional +} + +type record JSON_REST_OperatorId { + octetstring mccMnc, + octetstring gid1 optional, + octetstring gid2 optional +} + +type record JSON_REST_ProfilePolicyAuthorisationRule { + boolean pprUpdateControl, + boolean ppr1, + boolean ppr2, + record of JSON_REST_OperatorId allowedOperators, + boolean consentRequired +} + +type union JSON_REST_Result { + charstring enableResult, + charstring disableResult, + charstring deleteResult, + record { + charstring finalResult, + record of JSON_REST_ProfileInfo profileInfoList optional + } listProfileInfoResult, + record of JSON_REST_ProfilePolicyAuthorisationRule getRATResult, + charstring configureAutoEnableResult, + record { + charstring addEimResultCode, + integer associationToken optional + } addEimResult, + charstring deleteEimResult, + charstring updateEimResult, + record { + charstring finalResult, + record of JSON_REST_EimIdList eimIdList optional + } listEimResult, + charstring rollbackResult, + charstring processingTerminated, + charstring notificationResult, + charstring cancelSessionResult, + record { + charstring finalResult, + charstring iccid optional + } profileInstallationResult, + charstring euiccUpdateResult, + record { + charstring edrResult, + record { + charstring defaultSmdpAddress optional, + octetstring euiccInfo1 optional, + octetstring euiccInfo2 optional, + charstring rootSmdsAddress optional, + integer associationToken optional, + octetstring eumCertificate optional, + octetstring euiccCertificate optional, + octetstring ipaCapabilities optional, + octetstring deviceInfo optional, + octetstring notificationsList optional + } euiccData optional + } euiccDataResult +} + +type record JSON_REST_Response_long { + charstring status, + charstring timestamp, + JSON_REST_Resource resource, + record of JSON_REST_Result outcome, + charstring debuginfo +}; + +type record JSON_REST_Response_short { + charstring status +}; + +/* Definition for JSON REST responses */ +type union JSON_REST_Response { + JSON_REST_Response_long long, + JSON_REST_Response_short short +} with { + variant "JSON : as value" +} + +external function enc_JSON_REST_Response(in JSON_REST_Response msg) +return octetstring with { + extension "prototype (convert) encode(JSON)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_REST_Response(in octetstring stream) return JSON_REST_Response with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +external function enc_JSON_REST_Resource(in JSON_REST_Resource msg) +return octetstring with { + extension "prototype (convert) encode(JSON)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_REST_Resource(in octetstring stream) return JSON_REST_Resource with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + + +template (present) JSON_REST_Response tr_JSON_REST_success := { + long := { + status := "done", + timestamp := ?, + resource := ?, + outcome := ?, + debuginfo := ? + } +} + +template (present) JSON_REST_Response tr_JSON_REST_deleted := { + short := { status := "deleted" } +} + +template (present) JSON_REST_Response tr_JSON_REST_absent := { + short := { status := "absent" } +} + +template (value) JSON_REST_Resource ts_JSON_REST_download_order(octetstring eidValue, charstring activationCode) := { + eidValue := oct2str(eidValue), + order := { download := { activationCode := activationCode } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_enable(octetstring eidValue, octetstring iccid, boolean rollback) := { + eidValue := oct2str(eidValue), + order := { psmo := { { enable := { iccid := iccid, rollback := rollback } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_disable(octetstring eidValue, octetstring iccid) := { + eidValue := oct2str(eidValue), + order := { psmo := { { disable := { iccid := iccid } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_delete(octetstring eidValue, octetstring iccid) := { + eidValue := oct2str(eidValue), + order := { psmo := { { delete := { iccid := iccid } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_disable_and_delete(octetstring eidValue, octetstring iccid) := { + eidValue := oct2str(eidValue), + order := { psmo := { { disable := { iccid := iccid } }, { delete := { iccid := iccid } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_listProfileInfo(octetstring eidValue, octetstring iccid) := { + eidValue := oct2str(eidValue), + order := { psmo := { { listProfileInfo := {searchCriteria := {iccid := iccid}, tagList := '92'O /* profileName */} } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_getRAT(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { psmo := { { getRAT := {} } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_psmo_order_configureAutoEnable(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { psmo := { { configureAutoEnable := { autoEnableFlag := true, smdpOid := objid {1 2 3}, smdpAddress := "smdp.example.com" } } } } +} + +const octetstring eimConfigurationData := +'3079800465494D32810E3132372E302E302E313A383030308301018401FF +A55BA059301306072A8648CE3D020106082A8648CE3D03010703420004FE +584A6F450459574AECA195D0299737F74C89BA2D36DF9286EC25D973037A +0FBA70D14DF3E1F7D0A305E57B95B731C4DE218D2D7F9F22113ED5D18C2E +3DDF1C'O + +template (value) JSON_REST_Resource ts_JSON_REST_eco_order_addEim(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { eco := { { addEim := { eimConfigurationData := eimConfigurationData } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_eco_order_deleteEim(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { eco := { { deleteEim := { eimId := "eIM" } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_eco_order_updateEim(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { eco := { { updateEim := { eimConfigurationData := eimConfigurationData } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_eco_order_listEim(octetstring eidValue) := { + eidValue := oct2str(eidValue), + order := { eco := { { listEim := { } } } } +} + +template (value) JSON_REST_Resource ts_JSON_REST_edr_order(octetstring eidValue, octetstring tagList) := { + eidValue := oct2str(eidValue), + order := { edr := { tagList := tagList } } +} + +} with { + encode "JSON"; +} diff --git a/eim/eIM_Tests.cfg b/eim/eIM_Tests.cfg new file mode 100644 index 0000000..f442022 --- /dev/null +++ b/eim/eIM_Tests.cfg @@ -0,0 +1,21 @@ +[ORDERED_INCLUDE] +# Common configuration, shared between test suites +"../Common.cfg" +# testsuite specific configuration, not expected to change +"./eIM_Tests.default" + +# Local configuration below + +[LOGGING] + +[TESTPORT_PARAMETERS] +system.HTTP_server_port.KEYFILE := "../ipad/example_ca/pki/private/alttest.key" +system.HTTP_server_port.CERTIFICATEFILE := "../ipad/example_ca/pki/issued/alttest.crt" + +[MODULE_PARAMETERS] +eIM_Tests.mp_restop_path := "/path/to/my/eim/restop.py" + +[MAIN_CONTROLLER] + +[EXECUTE] +eIM_Tests.control diff --git a/eim/eIM_Tests.default b/eim/eIM_Tests.default new file mode 100644 index 0000000..8dad77b --- /dev/null +++ b/eim/eIM_Tests.default @@ -0,0 +1,13 @@ +[LOGGING] +mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING; // | DEBUG_ENCDEC; + +[TESTPORT_PARAMETERS] +system.HTTP.http_debugging := "yes" +system.HTTP_server_port.http_debugging := "yes" +system.HTTP.use_notification_ASPs := "yes" +system.HTTP_server_port.use_notification_ASPs := "no" +system.HTTP_server_port.PASSWORD := "katinka1" + +[MODULE_PARAMETERS] + +[EXECUTE] diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn new file mode 100644 index 0000000..7930e4f --- /dev/null +++ b/eim/eIM_Tests.ttcn @@ -0,0 +1,809 @@ +/* eIM testsuite in TTCN-3 + * + * Author: Philipp Maier <pmaier(a)sysmocom.de> / sysmocom - s.f.m.c. GmbH + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module eIM_Tests { + +import from Misc_Helpers all; +import from General_Types all; +import from Osmocom_Types all; + +import from SGP32Definitions all; +import from SGP32Definitions_Types all; +import from SGP32Definitions_Templates all; + +import from RSPDefinitions all; +import from RSPDefinitions_Types all; +import from RSPDefinitions_Templates all; + +import from PKIX1Explicit88 all; +import from PKIX1Explicit88_Templates all; +import from PKIX1Explicit88_Types all; + +import from PKIX1Implicit88 all; +import from PKIX1Implicit88_Templates all; +import from PKIX1Implicit88_Types all; + +import from HTTP_Server_Emulation all; +import from HTTPmsg_Types all; + +import from HTTPmsg_PortType all; +import from HTTP_Adapter all; + +import from es9p_Types_JSON all; +import from REST_Types_JSON all; + +/* the PIPEasp port allows us to interact with restop.py via stdin/stdout */ +import from PIPEasp_PortType all; +import from PIPEasp_Types all; + +const octetstring eID := '89882119900000000000000000000005'O; +const octetstring iccid := '123456789ABCDEFFAAAA'O; + +type component MTC_CT { + timer g_Tguard; + + /* HTTP server */ + var HTTP_Server_Emulation_CT vc_HTTP; +}; + +type component eIM_ConnHdlr extends HTTP_ConnHdlr, http_CT { + port PIPEasp_PT PIPE; + var eIM_ConnHdlrPars g_pars_EIM; + var template integer g_http_client_id := omit; /* ESipa client */ +}; + +type record eIM_ConnHdlrPars { + /* add parameters here when necessary */ +}; + +private function f_init_pars() +runs on MTC_CT return eIM_ConnHdlrPars { + var eIM_ConnHdlrPars pars := { + /* add parameters here when necessary */ + }; + return pars; +} + +modulepar { + /* emulated ES9+ SMDP+ server */ + charstring mp_es9p_ip := "127.0.0.1"; + integer mp_es9p_port := 8090; + boolean mp_es9p_disable_ssl := false; + + /* emulated ESipa IPAd HTTPs client */ + charstring mp_esipa_ip := "127.0.0.1"; + integer mp_esipa_port := 8000; + boolean mp_esipa_disable_ssl := false; + + /* REST API tool */ + charstring mp_restop_path; +} + +private altstep as_Tguard() runs on MTC_CT { + [] g_Tguard.timeout { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout"); + } +} + +private type function void_fn(charstring id) runs on eIM_ConnHdlr; + +private function f_init_handler(void_fn fn, charstring id, eIM_ConnHdlrPars pars) runs on eIM_ConnHdlr { + g_pars_EIM := pars; + fn.apply(id); +} + +private function f_start_handler(void_fn fn, eIM_ConnHdlrPars pars) +runs on MTC_CT return eIM_ConnHdlr { + var eIM_ConnHdlr vc_conn; + var charstring id := testcasename(); + + vc_conn := eIM_ConnHdlr.create(id); + + /* connect ES9+/HTTP-server ports */ + if (isbound(vc_HTTP)) { + connect(vc_conn:HTTP_SRV, vc_HTTP:CLIENT); + connect(vc_conn:HTTP_SRV_PROC, vc_HTTP:CLIENT_PROC); + } + + vc_conn.start(f_init_handler(fn, id, pars)); + return vc_conn; +} + +private function f_init(charstring id, float t_guard := 40.0) runs on MTC_CT { + g_Tguard.start(t_guard); + activate(as_Tguard()); + + /* start ES9+/HTTP-server */ + var HttpServerEmulationCfg http_cfg := { + http_bind_ip := mp_es9p_ip, + http_bind_port := mp_es9p_port, + use_ssl := not mp_es9p_disable_ssl + }; + vc_HTTP := HTTP_Server_Emulation_CT.create(id); + vc_HTTP.start(HTTP_Server_Emulation.main(http_cfg)); +} + + + +/* ********************************************* */ +/* ************* ES9+/HTTP-server ************** */ +/* ********************************************* */ + +/* Helper function to send HTTP responses (ES9+) */ +template (value) HTTPMessage ts_http_resp(charstring resp) := { + response := { + client_id := omit, + version_major := 1, + version_minor := 1, + statuscode := 200, + statustext := "OK", + /* See also SGP.32, section 6.1.1 */ + header := { + { + header_name := "X-Admin-Protocol", + header_value := "gsma/rsp/v1.0.0" + }, + { + header_name := "Content-Type", + header_value := "application/json" + }, + { + header_name := "Content-Length", + header_value := int2str(lengthof(resp)) + } + }, + body := resp + } +} + + +/* Receive one Es9p HTTP request */ +private function f_es9p_receive() runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest { + var HTTPMessage es9p_req; + timer T := 10.0; + var RemoteProfileProvisioningRequest request; + + T.start; + alt { + [] HTTP_SRV.receive({ request := ? }) -> value es9p_req { + dec_RemoteProfileProvisioningRequest_from_JSON(es9p_req.request.body, request); + } + [] T.timeout { + setverdict(fail, "no HTTP request received?"); + } + } + + return request; +} + +/* Send Es9p HTTP response */ +private function f_es9p_send(RemoteProfileProvisioningResponse es9p_res) runs on eIM_ConnHdlr { + var charstring es9p_res_json; + enc_RemoteProfileProvisioningResponse_to_JSON(es9p_res, es9p_res_json); + HTTP_SRV.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) +runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest { + var RemoteProfileProvisioningRequest es9p_req; + es9p_req := f_es9p_receive(); + f_es9p_send(es9p_res); + if (not istemplatekind(expected_es9p_req, "omit")) { + if (not match(valueof(es9p_req), expected_es9p_req)) { + setverdict(fail, "unexpected request from eIM on ES9p"); + } + } + return es9p_req; +} + +/* Perform Es9p HTTP request/response cycle but with an empty response */ +private function f_es9p_transceive_empty_response(template RemoteProfileProvisioningRequest expected_es9p_req := omit) +runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest { + var RemoteProfileProvisioningResponse es9p_res; /* Intentionally left unbound */ + return f_es9p_transceive(es9p_res, expected_es9p_req); +} + + + +/* ********************************************* */ +/* ************ PIPEasp (REST API) ************* */ +/* ********************************************* */ + +template (value) ASP_PExecute ts_Exec(charstring cmd) := { + command := cmd, + stdin := "" +} + +template (present) ASP_PResult tr_Result(template (present) charstring stdout, + template (present) charstring stderr, + template (present) integer code) := { + stdout := stdout, + stderr := stderr, + code := code +} + +private function f_init_pipe() runs on eIM_ConnHdlr { + map(self:PIPE, system:PIPE); +} + +/* Create a new rest resource (generic) */ +private function f_rest_create(charstring cmdline) +runs on eIM_ConnHdlr return charstring { + var ASP_PResult result; + + PIPE.send(ts_Exec(cmdline)); + timer T := 4.0; + T.start; + alt { + [] PIPE.receive(tr_Result(?,?,0)) -> value result { + /* On success, stdout should contain an URL to a resource */ + if (substr(result.stdout, 0, 7) != "http://") { + setverdict(fail, "got malformed resource URL from REST API while creating resource"); + } + return regexp(result.stdout, "(?+)(lookup/)(?+)", 2); + } + [] PIPE.receive { + setverdict(fail, "unexpected response from REST API while creating resource"); + } + [] T.timeout { + setverdict(fail, "no response from REST API while creating resource"); + } + } + + setverdict(fail, "got no resource URL from REST API while creating resource"); + return "no resource"; +} + +/* Create a new rest resource (facility/order) */ +private function f_rest_create_order(charstring facility, template JSON_REST_Resource order) +runs on eIM_ConnHdlr return charstring { + var charstring cmdline; + cmdline := mp_restop_path & " -c -f " & facility & " -j " & + oct2char(enc_JSON_REST_Resource(valueof(order))); + return f_rest_create(cmdline); +} + +/* Lookup an existing REST resource */ +private function f_rest_lookup_resource(charstring resource_id, charstring facility, + template JSON_REST_Response expected_rest_res := omit) +runs on eIM_ConnHdlr return JSON_REST_Response { + var charstring cmdline; + var ASP_PResult result; + var JSON_REST_Response rest_res; + + cmdline := mp_restop_path & " -l -f " & facility & " -r " & resource_id; + + PIPE.send(ts_Exec(cmdline)); + timer T := 4.0; + T.start; + alt { + [] PIPE.receive(tr_Result(?,?,0)) -> value result { + rest_res := dec_JSON_REST_Response(char2oct(result.stdout)); + } + [] PIPE.receive { + setverdict(fail, "unexpected response from REST API while looking up resource"); + } + [] T.timeout { + setverdict(fail, "no response from REST API while looking up resource"); + } + } + + if (not istemplatekind(expected_rest_res, "omit") and not match(rest_res, tr_JSON_REST_success)) { + setverdict(fail, "unexpected REST lookup result from eIM"); + } + + return rest_res; +} + +/* Delete REST resource */ +private function f_rest_delete_resource(charstring resource_id, charstring facility) +runs on eIM_ConnHdlr { + var charstring cmdline; + var ASP_PResult result; + var JSON_REST_Response rest_res; + cmdline := mp_restop_path & " -d -f " & facility & " -r " & resource_id; + + PIPE.send(ts_Exec(cmdline)); + timer T := 4.0; + T.start; + alt { + [] PIPE.receive(tr_Result(?,?,0)) -> value result { + /* Verify that the resource has been deleted */ + rest_res := dec_JSON_REST_Response(char2oct(result.stdout)); + if (not match(rest_res, tr_JSON_REST_deleted)) { + setverdict(fail, "unexpected REST delete result from eIM"); + } + + /* Make sure that the resource has really been deleted */ + if (not match(f_rest_lookup_resource(resource_id, facility), tr_JSON_REST_absent)) { + setverdict(fail, "unexpected REST result from eIM while checking resource deletion"); + } + + } + [] PIPE.receive { + setverdict(fail, "unexpected response from REST API while deleting resource"); + } + [] T.timeout { + setverdict(fail, "no response from REST API while deleting resource"); + } + } +} + + + +/* ********************************************* */ +/* ************* ESipa/HTTP-client ************* */ +/* ********************************************* */ + +private function f_enc_http_req(in RemoteProfileProvisioningResponse es9p_res, out HTTPMessage http_res) { + var charstring json_body; + var HTTPResponse resp_body; + + enc_RemoteProfileProvisioningResponse_to_JSON(es9p_res, json_body); + resp_body := { + client_id := omit, + version_major := 1, + version_minor := 1, + statuscode := 200, + statustext := "OK", + /* See also SGP.32, section 6.1.1 */ + header := { + { + header_name := "X-Admin-Protocol", + header_value := "gsma/rsp/v1.0.0" + }, + { + header_name := "Content-Type", + header_value := "application/x-gsma-rsp-asn1" + }, + { + header_name := "Content-Length", + header_value := int2str(lengthof(json_body)) + } + }, + body := json_body + }; + + http_res := { response := resp_body }; +} with { extension "prototype(fast)" } + +template (value) HeaderLines ts_esipa_HTTP_Header := { + { header_name := "User-Agent", header_value := "TTCN3 eIM testsuite" }, + { header_name := "X-Admin-Protocol", header_value := "gsma/rsp/v2.5.0" }, + { header_name := "Content-Type", header_value := "application/x-gsma-rsp-asn1" } +}; + +/* Send ESipa HTTP request */ +private function f_esipa_send(EsipaMessageFromIpaToEim esipa_req) runs on eIM_ConnHdlr { + var octetstring esipa_req_enc; + esipa_req_enc := enc_EsipaMessageFromIpaToEim(esipa_req); + f_http_tx_request(url := "/gsma/rsp2/asn1", + method := "POST", + binary_body:= esipa_req_enc, + custom_hdr := valueof(ts_esipa_HTTP_Header), + client_id := g_http_client_id); +} + +/* Receive ESipa HTTP response */ +private function f_esipa_receive(template EsipaMessageFromEimToIpa expected_esipa_res := omit) +runs on eIM_ConnHdlr return template EsipaMessageFromEimToIpa { + var template EsipaMessageFromEimToIpa esipa_res; + var HTTPMessage response_http; + response_http := f_http_rx_response(exp := ?, + client_id := g_http_client_id, + keep_connection := true); + + if (istemplatekind(g_http_client_id, "omit")) { + /* Memorize client_id of the first request. The client_id will identify the HTTP connection + * in all consecutive requests. */ + g_http_client_id := f_http_client_id_from_http_response(response_http); + } else if (valueof(g_http_client_id) != valueof(f_http_client_id_from_http_response(response_http))) { + /* The client_id must not change. A sudden change of the client_id may indicate an interrupted + * HTTP connection. This must not happen unexpectetly. */ + setverdict(fail, "unexpected ESipa HTTP connection"); + } + + if (ispresent(response_http.response_binary)) { + esipa_res := dec_EsipaMessageFromEimToIpa(response_http.response_binary.body); + if (not istemplatekind(expected_esipa_res, "omit")) { + if (not match(valueof(esipa_res), expected_esipa_res)) { + setverdict(fail, "unexpected response from eIM on ESipa"); + } + } + return esipa_res; + } else { + setverdict(fail, + "unexpected ESipa response, the HTTP body did either contain no or a non binary response"); + return omit; + } +} + +/* Perform one ESipa HTTP request/response cycle */ +private function f_esipa_transceive(EsipaMessageFromIpaToEim esipa_req, + template EsipaMessageFromEimToIpa expected_esipa_res := omit) +runs on eIM_ConnHdlr return template EsipaMessageFromEimToIpa { + var template EsipaMessageFromEimToIpa esipa_res + f_esipa_send(esipa_req); + esipa_res := f_esipa_receive(); + if (not istemplatekind(expected_esipa_res, "omit")) { + if (not match(valueof(esipa_res), expected_esipa_res)) { + setverdict(fail, "unexpected response from eIM on ESipa"); + } + } + return esipa_res; +} + + + +/* ********************************************* */ +/* ********** BELOW ONLY TESTCASES! ************ */ +/* ********************************************* */ + +/* Common Mutual Authentication Procedure, see also: GSMA SGP.22, section 3.0.1 */ +private function f_proc_cmn_mtl_auth() runs on eIM_ConnHdlr { + var charstring smdpAddress := mp_es9p_ip & ":" & int2str(mp_es9p_port); + + /* InitiateAuthentication cycle */ + f_esipa_send(valueof(ts_initiateAuthenticationRequestEsipa(smdpAddress := smdpAddress))); + f_es9p_transceive(valueof(ts_initiateAuthenticationResponse), tr_initiateAuthenticationRequest); + f_esipa_receive(tr_initiateAuthenticationResponseEsipa); + + /* AuthenticateClient cycle */ + f_esipa_send(valueof(ts_authenticateClientRequestEsipa)); + f_es9p_transceive(valueof(ts_authenticateClientResponseEs9), tr_authenticateClientRequest); + f_esipa_receive(tr_authenticateClientResponseEsipa_dpe); +} + +/* 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 eIM_ConnHdlr { + var charstring resource_id; + var HTTP_Adapter_Params http_adapter_pars; + var charstring activationCode := "1$" & mp_es9p_ip & ":" & int2str(mp_es9p_port) & "$MyMatchingId" + + 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); + + /* Create a new download at the eIM */ + resource_id := f_rest_create_order("download", ts_JSON_REST_download_order(eID, 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) */ + f_esipa_transceive(valueof(ts_getEimPackageRequest(eID)), tr_getEimPackageResponse_dnlTrigReq(activationCode)); + + /* Perform common mutial authentication procedure */ + f_proc_cmn_mtl_auth(); + + /* Request/download bound profile package */ + f_esipa_send(valueof(ts_getBoundProfilePackageRequestEsipa)); + f_es9p_transceive(valueof(ts_getBoundProfilePackageResponse), tr_getBoundProfilePackageRequest); + f_esipa_receive(tr_getBoundProfilePackageResponseEsipa); + + /* Handle notification */ + f_esipa_send(valueof(ts_handleNotificationEsipa_prfleInstRslt)); + f_es9p_transceive_empty_response(tr_handleNotification); + + f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success); + f_rest_delete_resource(resource_id, "download"); + + f_sleep(2.0); + setverdict(pass); +} +testcase TC_proc_indirect_prfle_dwnld() 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_indirect_prfle_dwnld), pars); + vc_conn.done; + setverdict(pass); +} + +/* A testcase to try out an the Generic eUICC Package Download and Execution Procedure (PSMO), + * See also: GSMA SGP.32, section 3.3.1: Generic eUICC Package Download and Execution */ +private function f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco(charstring facility, charstring id, + JSON_REST_Resource order, + template (present) EuiccPackage euiccPackage, + template (present) EuiccPackageResult euiccPackageResult) +runs on eIM_ConnHdlr { + var charstring resource_id; + var HTTP_Adapter_Params http_adapter_pars; + var template EsipaMessageFromEimToIpa esipa_res; + + 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); + + /* Create a new download at the eIM */ + resource_id := f_rest_create_order(facility, order); + + /* Check the eIM for new eIM packages, we expect to get an euiccPackageRequest that contains the PSMO + * that we have created (see above) */ + esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(str2oct(order.eidValue))), + tr_getEimPackageResponse_euiccPkgReq(euiccPackage)); + + /* The eIM will generate a counterValue and a transactionId, both must be echoed in the + * response. */ + euiccPackageResult.euiccPackageResultSigned.euiccPackageResultDataSigned.counterValue := + esipa_res.getEimPackageResponse.euiccPackageRequest.euiccPackageSigned.counterValue; + euiccPackageResult.euiccPackageResultSigned.euiccPackageResultDataSigned.transactionId := + esipa_res.getEimPackageResponse.euiccPackageRequest.euiccPackageSigned.transactionId; + + /* Respond with a plausible EimPackage result */ + f_esipa_transceive(valueof(ts_provideEimPackageResult_ePRAndNotif(euiccPackageResult)), + tr_provideEimPackageResultResponse_eimAck); + + f_rest_lookup_resource(resource_id, facility, tr_JSON_REST_success); + f_rest_delete_resource(resource_id, facility); + + f_sleep(2.0); + setverdict(pass); +} + +/* (see also above) Test enable PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_enable_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_enable(eID, iccid, false)); + var template EuiccPackage euiccPackage := tr_euiccPackage_enablePsmo; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_enablePsmo); +} +testcase TC_proc_euicc_pkg_dwnld_exec_enable_psmo() 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_euicc_pkg_dwnld_exec_enable_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test disable PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_disable_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_disable(eID, iccid)); + var template EuiccPackage euiccPackage := tr_euiccPackage_disablePsmo; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_disablePsmo); +} +testcase TC_proc_euicc_pkg_dwnld_exec_disable_psmo() 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_euicc_pkg_dwnld_exec_disable_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test delete PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_delete_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_delete(eID, iccid)); + var template EuiccPackage euiccPackage := tr_euiccPackage_deletePsmo; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_deletePsmo); +} +testcase TC_proc_euicc_pkg_dwnld_exec_delete_psmo() 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_euicc_pkg_dwnld_exec_delete_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test disable and delete PSMO at the same time to make sure that eUICC packages with multiple PSMOs + * are also accepted and processed correctly. */ +private function f_TC_proc_euicc_pkg_dwnld_exec_disable_and_delete_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_disable_and_delete(eID, iccid)); + var template EuiccPackage euiccPackage := tr_euiccPackage_disableAndDeletePsmo; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_disableAndDeletePsmo); +} +testcase TC_proc_euicc_pkg_dwnld_exec_disable_and_delete_psmo() 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_euicc_pkg_dwnld_exec_disable_and_delete_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test listProfileInfo PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_listProfileInfo_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_listProfileInfo(eID, iccid)); + var template EuiccPackage euiccPackage := tr_euiccPackage_listProfileInfo; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_listProfileInfo); +} +testcase TC_proc_euicc_pkg_dwnld_exec_listProfileInfo_psmo() 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_euicc_pkg_dwnld_exec_listProfileInfo_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test getRAT PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_getRAT_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_getRAT(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_getRAT; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_getRAT); +} +testcase TC_proc_euicc_pkg_dwnld_exec_getRAT_psmo() 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_euicc_pkg_dwnld_exec_getRAT_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test configureAutoEnable PSMO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_configureAutoEnable_psmo(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource psmo_order := valueof(ts_JSON_REST_psmo_order_configureAutoEnable(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_configureAutoEnable; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("psmo", id, psmo_order, euiccPackage, + ts_euiccPackageResultSigned_configureAutoEnable); +} +testcase TC_proc_euicc_pkg_dwnld_exec_configureAutoEnable_psmo() 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_euicc_pkg_dwnld_exec_configureAutoEnable_psmo), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test addEim eCO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_addEim_eco(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource eco_order := valueof(ts_JSON_REST_eco_order_addEim(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_addEim; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("eco", id, eco_order, euiccPackage, + ts_euiccPackageResultSigned_addEim); +} +testcase TC_proc_euicc_pkg_dwnld_exec_addEim_eco() 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_euicc_pkg_dwnld_exec_addEim_eco), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test deleteEim eCO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_deleteEim_eco(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource eco_order := valueof(ts_JSON_REST_eco_order_deleteEim(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_deleteEim; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("eco", id, eco_order, euiccPackage, + ts_euiccPackageResultSigned_deleteEim); +} +testcase TC_proc_euicc_pkg_dwnld_exec_deleteEim_eco() 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_euicc_pkg_dwnld_exec_deleteEim_eco), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test updateEim eCO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_updateEim_eco(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource eco_order := valueof(ts_JSON_REST_eco_order_updateEim(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_updateEim; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("eco", id, eco_order, euiccPackage, + ts_euiccPackageResultSigned_updateEim); +} +testcase TC_proc_euicc_pkg_dwnld_exec_updateEim_eco() 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_euicc_pkg_dwnld_exec_updateEim_eco), pars); + vc_conn.done; + setverdict(pass); +} + +/* (see also above) Test listEim eCO */ +private function f_TC_proc_euicc_pkg_dwnld_exec_listEim_eco(charstring id) runs on eIM_ConnHdlr { + var JSON_REST_Resource eco_order := valueof(ts_JSON_REST_eco_order_listEim(eID)); + var template EuiccPackage euiccPackage := tr_euiccPackage_listEim; + f_TC_proc_euicc_pkg_dwnld_exec_psmo_or_eco("eco", id, eco_order, euiccPackage, + ts_euiccPackageResultSigned_listEim); +} +testcase TC_proc_euicc_pkg_dwnld_exec_listEim_eco() 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_euicc_pkg_dwnld_exec_updateEim_eco), pars); + vc_conn.done; + setverdict(pass); +} + +/* A testcase to try out an eUICC data request, + * See also: GSMA SGP.32, section 2.11.1.2: IpaEuiccDataRequest */ +private function f_TC_proc_euicc_data_req(charstring id) runs on eIM_ConnHdlr { + var charstring resource_id; + var HTTP_Adapter_Params http_adapter_pars; + + 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); + + /* Create a new download at the eIM */ + resource_id := f_rest_create_order("edr", ts_JSON_REST_edr_order(eID, '80BF20BF228384A5A688A9BF2B'O)); + + /* Check the eIM for new eIM packages, we expect to get a getEimPackageResponse that contains an + * ipaEuiccDataRequest */ + f_esipa_transceive(valueof(ts_getEimPackageRequest(eID)), tr_getEimPackageResponse_euiccDataReq); + + /* Provide a plausible ipaEuiccDataResponse to the eIM */ + f_esipa_transceive(valueof(ts_provideEimPackageResult_euiccDataResp), + tr_provideEimPackageResultResponse_eimAck); + + f_rest_lookup_resource(resource_id, "edr", tr_JSON_REST_success); + f_rest_delete_resource(resource_id, "edr"); +} +testcase TC_proc_euicc_data_req() 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_euicc_data_req), pars); + vc_conn.done; + setverdict(pass); +} + +control { + execute ( TC_proc_indirect_prfle_dwnld() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_enable_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_disable_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_delete_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_disable_and_delete_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_listProfileInfo_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_getRAT_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_configureAutoEnable_psmo() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_addEim_eco() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_deleteEim_eco() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_updateEim_eco() ); + execute ( TC_proc_euicc_pkg_dwnld_exec_listEim_eco() ); + execute ( TC_proc_euicc_data_req() ); +} + +} \ No newline at end of file diff --git a/eim/es9p_Types_JSON.ttcn b/eim/es9p_Types_JSON.ttcn new file mode 100644 index 0000000..5a8587b --- /dev/null +++ b/eim/es9p_Types_JSON.ttcn @@ -0,0 +1,235 @@ +/* JSON message definitions for ES9+ + * + * Author: Philipp Maier <pmaier(a)sysmocom.de> / sysmocom - s.f.m.c. GmbH + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module es9p_Types_JSON { + +import from RSPDefinitions all; +import from RSPDefinitions_Types all; +import from RSPDefinitions_Templates all; + +import from PKIX1Explicit88 all; +import from PKIX1Explicit88_Templates all; +import from PKIX1Explicit88_Types all; + +import from PKIX1Implicit88 all; +import from PKIX1Implicit88_Templates all; +import from PKIX1Implicit88_Types all; + + +/* GSMA SGP.22, section 6.5.1.3 */ +type record JSON_ES9p_RequestHeader { + charstring functionRequesterIdentifier, + charstring functionCallIdentifier +}; + +/* GSMA SGP.22, section 6.5.1.4 */ +type record JSON_ES9p_FunctionExecutionStatus { + charstring status +}; +type record JSON_ES9p_ResponseHeader { + JSON_ES9p_FunctionExecutionStatus functionExecutionStatus +}; + +/* GSMA SGP.22, section 6.5.2.6 */ +type record JSON_ES9p_InitiateAuthenticationRequest { + JSON_ES9p_RequestHeader header, + charstring euiccChallenge, + charstring euiccInfo1, + charstring smdpAddress +}; +type record JSON_ES9p_InitiateAuthenticationResponse { + JSON_ES9p_ResponseHeader header, + charstring transactionId, + charstring serverSigned1, + charstring serverSignature1, + charstring euiccCiPKIdToBeUsed, + charstring serverCertificate +}; + +/* GSMA SGP.22, section 6.5.2.7 */ +type record JSON_ES9p_GetBoundProfilePackageRequest { + JSON_ES9p_RequestHeader header, + charstring transactionId, + charstring prepareDownloadResponse +}; +type record JSON_ES9p_GetBoundProfilePackageResponse { + JSON_ES9p_ResponseHeader header, + charstring transactionId, + charstring boundProfilePackage +}; + +/* GSMA SGP.22, section 6.5.2.8 */ +type record JSON_ES9p_AuthenticateClientRequest { + JSON_ES9p_RequestHeader header, + charstring transactionId, + charstring authenticateServerResponse +}; +type record JSON_ES9p_AuthenticateClientResponseEs9 { + JSON_ES9p_ResponseHeader header, + charstring transactionId, + charstring profileMetadata, + charstring smdpSigned2, + charstring smdpSignature2, + charstring smdpCertificate +}; + +/* GSMA SGP.22, section 6.5.2.9 */ +type record JSON_ES9p_HandleNotification { + JSON_ES9p_RequestHeader header, + charstring pendingNotification +}; + +/* GSMA SGP.22, section 6.5.2.10 */ +type record JSON_ES9p_CancelSessionRequestEs9 { + JSON_ES9p_RequestHeader header, + charstring transactionId, + charstring cancelSessionResponse +}; + +/* An empty response that is used when the response only consists of a JSON header */ +type record JSON_ES9p_EmptyResponse { + JSON_ES9p_ResponseHeader header +}; + + +/* Definition for JSON ES9+ requests */ +type union JSON_ES9p_RemoteProfileProvisioningRequest { + JSON_ES9p_InitiateAuthenticationRequest initiateAuthenticationRequest, + JSON_ES9p_GetBoundProfilePackageRequest getBoundProfilePackageRequest, + JSON_ES9p_AuthenticateClientRequest authenticateClientRequest, + JSON_ES9p_HandleNotification handleNotification, + JSON_ES9p_CancelSessionRequestEs9 cancelSessionRequestEs9 +} with { + variant "JSON : as value" +} + +external function enc_JSON_ES9p_RemoteProfileProvisioningRequest(in JSON_ES9p_RemoteProfileProvisioningRequest msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ES9p_RemoteProfileProvisioningRequest(in octetstring stream) return JSON_ES9p_RemoteProfileProvisioningRequest +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + + +/* Definition for JSON ES9+ responses */ +type union JSON_ES9p_RemoteProfileProvisioningResponse +{ + JSON_ES9p_InitiateAuthenticationResponse initiateAuthenticationResponse, + JSON_ES9p_GetBoundProfilePackageResponse getBoundProfilePackageResponse, + JSON_ES9p_AuthenticateClientResponseEs9 authenticateClientResponseEs9, + JSON_ES9p_EmptyResponse emptyResponse +} with { + variant "JSON : as value" +} + +external function enc_JSON_ES9p_RemoteProfileProvisioningResponse(in JSON_ES9p_RemoteProfileProvisioningResponse msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ES9p_RemoteProfileProvisioningResponse(in octetstring stream) return JSON_ES9p_RemoteProfileProvisioningResponse +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +/* Converter function to decode a JSON formatted ES9+ request to its ASN.1 ES9+ record representation */ +function dec_RemoteProfileProvisioningRequest_from_JSON(in charstring json_pdu_enc, out RemoteProfileProvisioningRequest asn1_pdu_dec) { + var JSON_ES9p_RemoteProfileProvisioningRequest json_pdu; + json_pdu := dec_JSON_ES9p_RemoteProfileProvisioningRequest(char2oct(json_pdu_enc)); + + if (ispresent(json_pdu.initiateAuthenticationRequest)) { + asn1_pdu_dec := valueof(ts_initiateAuthenticationRequest( + decode_base64(json_pdu.initiateAuthenticationRequest.euiccChallenge), + json_pdu.initiateAuthenticationRequest.smdpAddress, + dec_EUICCInfo1(decode_base64(json_pdu.initiateAuthenticationRequest.euiccInfo1)))); + } else if (ispresent(json_pdu.getBoundProfilePackageRequest)) { + asn1_pdu_dec := valueof(ts_getBoundProfilePackageRequest( + str2oct(json_pdu.getBoundProfilePackageRequest.transactionId), + dec_PrepareDownloadResponse(decode_base64(json_pdu.getBoundProfilePackageRequest.prepareDownloadResponse)))); + } else if (ispresent(json_pdu.authenticateClientRequest)) { + asn1_pdu_dec := valueof(ts_authenticateClientRequest( + str2oct(json_pdu.authenticateClientRequest.transactionId), + dec_AuthenticateServerResponse(decode_base64(json_pdu.authenticateClientRequest.authenticateServerResponse)))); + } else if (ispresent(json_pdu.handleNotification)) { + asn1_pdu_dec := valueof(ts_handleNotification( + dec_PendingNotification(decode_base64(json_pdu.handleNotification.pendingNotification)))); + } else if (ispresent(json_pdu.cancelSessionRequestEs9)) { + asn1_pdu_dec := valueof(ts_cancelSessionRequestEs9( + str2oct(json_pdu.cancelSessionRequestEs9.transactionId), + dec_CancelSessionResponse(decode_base64(json_pdu.cancelSessionRequestEs9.cancelSessionResponse)))); + } else { + setverdict(fail, "decoder path not implemented for JSON ES9+ message"); + } +} with { extension "prototype(fast)" } + +/* Converter function to encode an ASN.1 ES9+ response record to its JSON formatted ES9+ representation */ +function enc_RemoteProfileProvisioningResponse_to_JSON(in RemoteProfileProvisioningResponse asn1_pdu_dec, out charstring json_pdu_enc) { + var JSON_ES9p_RemoteProfileProvisioningResponse json_pdu; + + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponse)) { + json_pdu.initiateAuthenticationResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.initiateAuthenticationResponse.transactionId := + oct2str(asn1_pdu_dec.initiateAuthenticationResponse.initiateAuthenticationOk.transactionId); + json_pdu.initiateAuthenticationResponse.serverSigned1 := + encode_base64(enc_ServerSigned1(asn1_pdu_dec.initiateAuthenticationResponse.initiateAuthenticationOk.serverSigned1)); + json_pdu.initiateAuthenticationResponse.serverSignature1 := + encode_base64(asn1_pdu_dec.initiateAuthenticationResponse.initiateAuthenticationOk.serverSignature1); + json_pdu.initiateAuthenticationResponse.euiccCiPKIdToBeUsed := + encode_base64(enc_SubjectKeyIdentifier(asn1_pdu_dec.initiateAuthenticationResponse.initiateAuthenticationOk.euiccCiPKIdToBeUsed)); + json_pdu.initiateAuthenticationResponse.serverCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.initiateAuthenticationResponse.initiateAuthenticationOk.serverCertificate)); + json_pdu_enc := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getBoundProfilePackageResponse)) { + json_pdu.getBoundProfilePackageResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getBoundProfilePackageResponse.transactionId := + oct2str(asn1_pdu_dec.getBoundProfilePackageResponse.getBoundProfilePackageOk.transactionId); + json_pdu.getBoundProfilePackageResponse.boundProfilePackage := + encode_base64(enc_BoundProfilePackage(asn1_pdu_dec.getBoundProfilePackageResponse.getBoundProfilePackageOk.boundProfilePackage)); + json_pdu_enc := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientResponseEs9)) { + json_pdu.authenticateClientResponseEs9.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.authenticateClientResponseEs9.transactionId := + oct2str(asn1_pdu_dec.authenticateClientResponseEs9.authenticateClientOk.transactionId); + json_pdu.authenticateClientResponseEs9.profileMetadata := + encode_base64(enc_StoreMetadataRequest(asn1_pdu_dec.authenticateClientResponseEs9.authenticateClientOk.profileMetaData)); + json_pdu.authenticateClientResponseEs9.smdpSigned2 := + encode_base64(enc_SmdpSigned2(asn1_pdu_dec.authenticateClientResponseEs9.authenticateClientOk.smdpSigned2)); + json_pdu.authenticateClientResponseEs9.smdpSignature2 := + encode_base64(asn1_pdu_dec.authenticateClientResponseEs9.authenticateClientOk.smdpSignature2); + json_pdu.authenticateClientResponseEs9.smdpCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.authenticateClientResponseEs9.authenticateClientOk.smdpCertificate)); + json_pdu_enc := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu)); + } else if (ispresent(asn1_pdu_dec.cancelSessionResponseEs9)) { + /* This message has no JSON body, see also GSMA SGP.22, section 6.5.2.10 */ + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientResponseEs11)) { + setverdict(fail, "encoder path not implemented for JSON ES9+ message AuthenticateClientResponseEs11"); + } else { + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ES9p_RemoteProfileProvisioningResponse(json_pdu)); + } +} with { extension "prototype(fast)" } + +} with { + encode "JSON"; +} + + + + + diff --git a/eim/gen_links.sh b/eim/gen_links.sh new file mode 100755 index 0000000..4bb1ea8 --- /dev/null +++ b/eim/gen_links.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +BASEDIR=../deps + +. ../gen_links.sh.inc + +DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src +FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.Common_Components.Abstract_Socket/src +FILES="Abstract_Socket.cc Abstract_Socket.hh " +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.HTTPmsg/src +FILES="HTTPmsg_MessageLen.ttcn HTTPmsg_MessageLen_Function.cc HTTPmsg_PT.cc HTTPmsg_PT.hh HTTPmsg_PortType.ttcn " +FILES+="HTTPmsg_Types.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src +FILES="Socket_API_Definitions.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.IPL4asp/src +FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn " +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 " +FILES+="PKIX1Implicit88_Types.ttcn RSPDefinitions_Templates.ttcn RSPDefinitions_Types.ttcn " +FILES+="SGP32Definitions_Templates.ttcn SGP32Definitions_Types.ttcn " +FILES+="PKIX1Explicit88_EncDec.cc PKIX1Implicit88_EncDec.cc RSPDefinitions_EncDec.cc SGP32Definitions_EncDec.cc" +gen_links $DIR $FILES + +DIR=../library +FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc " +FILES+="HTTP_Server_Emulation.ttcn HTTP_Adapter.ttcn" +gen_links $DIR $FILES + +ignore_pp_results diff --git a/eim/regen_makefile.sh b/eim/regen_makefile.sh new file mode 100755 index 0000000..cc0fd8e --- /dev/null +++ b/eim/regen_makefile.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +NAME=eIM_Tests + +FILES=" + *.ttcn + *.asn + Abstract_Socket.cc + HTTPmsg_MessageLen_Function.cc + HTTPmsg_PT.cc + IPL4asp_PT.cc + IPL4asp_discovery.cc + Native_FunctionDefs.cc + TCCConversion.cc + TCCInterface.cc + SGP32Definitions_EncDec.cc + RSPDefinitions_EncDec.cc + PKIX1Explicit88_EncDec.cc + PKIX1Implicit88_EncDec.cc + PIPEasp_PT.cc +" +../regen-makefile.sh eIM_Tests.ttcn $FILES + +# required for forkpty(3) used by PIPEasp +sed -i -e '/^LINUX_LIBS/ s/$/ -lutil/' Makefile diff --git a/eim/server.crt b/eim/server.crt new file mode 100644 index 0000000..c113a77 --- /dev/null +++ b/eim/server.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDyTCCArECFEz9Tzs8MSJUbUSExuS62RPPnfhjMA0GCSqGSIb3DQEBCwUAMIGg +MQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVybGluMQ8wDQYDVQQHDAZCZXJsaW4x +HTAbBgNVBAoMFElQQWQgdGVzdCBpbmR1c3RyaWVzMRswGQYDVQQLDBJ0ZXN0aW5n +IGRlcGFydG1lbnQxEjAQBgNVBAMMCTEyNy4wLjAuMTEfMB0GCSqGSIb3DQEJARYQ +dGVzdEBleGFtcGxlLm5ldDAeFw0yNDAxMTUxMDMxMTJaFw0yNTAxMTQxMDMxMTJa +MIGgMQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVybGluMQ8wDQYDVQQHDAZCZXJs +aW4xHTAbBgNVBAoMFElQQWQgdGVzdCBpbmR1c3RyaWVzMRswGQYDVQQLDBJ0ZXN0 +aW5nIGRlcGFydG1lbnQxEjAQBgNVBAMMCTEyNy4wLjAuMTEfMB0GCSqGSIb3DQEJ +ARYQdGVzdEBleGFtcGxlLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAK7dI15D1/n+axIimHQvQdhwzpFGNu/PQc+WimVNT4yX5PEbLgiX+OzJMhum +TMU2a/rdNSWAKAa/fK8X8cyFdsJ0hOvTta+1aNzwvVpqjHRwgzKgwjSQ625dujkr +ztERZcM7jrv4+rbU6kFc6W8hb4z4d66RJsDe0cwtsAvP9aipwtOIW4+6IdcduH0g +ANsPadebUz7Cc1l8LUQdfbwU/8VVtlr2RHPMviSidWYworclYYVzM3zvHM1bObo/ +PNCBsq8z9l8KJJqcZhsI9J+Z/5PzGSNGSvI7B55AUZHzt/E86CaRpGrUr+KctV6j +z6CDwdZHVsxRuMvWKsAL5Bw65LsCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAnPK4 +dyWCA9mYm5swYEcavhtyJvNwZ1zEp/MHJ40egZFpSnGqNbpEYgjCmqCrpHQxU1Qc +CtgXKgQMuUbvzJio5Mdp1JeSWJD18cBEhWcuufVMvN/HqMw/yJBCmizarUKjRNrE +o2C1P9287fUWdzGxXYPtevMV0E1DQ6v+xTnt1/gyiCtElctYO3f7tkioTmWXGzJY +AyelLfp0F/+lX3Ep1uUIvO7Dofzu+tKilbqqZjBO+gqPQFPRXrbXO90p7bvBieb5 +dBG2segL2hmzYzfKXnKaXU42CgyJgJ2DFChz3RwD41Y8q53wrZjjqM5e8rLNwJEI +dBbKBUSZVr0r9mY7dA== +-----END CERTIFICATE----- diff --git a/eim/server.key b/eim/server.key new file mode 100644 index 0000000..936d603 --- /dev/null +++ b/eim/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEArt0jXkPX+f5rEiKYdC9B2HDOkUY2789Bz5aKZU1PjJfk8Rsu +CJf47MkyG6ZMxTZr+t01JYAoBr98rxfxzIV2wnSE69O1r7Vo3PC9WmqMdHCDMqDC +NJDrbl26OSvO0RFlwzuOu/j6ttTqQVzpbyFvjPh3rpEmwN7RzC2wC8/1qKnC04hb +j7oh1x24fSAA2w9p15tTPsJzWXwtRB19vBT/xVW2WvZEc8y+JKJ1ZjCityVhhXMz +fO8czVs5uj880IGyrzP2XwokmpxmGwj0n5n/k/MZI0ZK8jsHnkBRkfO38TzoJpGk +atSv4py1XqPPoIPB1kdWzFG4y9YqwAvkHDrkuwIDAQABAoIBAQCN/JQ+c7pIjTSl +uh+un7zIofipb6kmGlWm2OcxkJAaajAFMvuzEKuYoVolp2hI7oLJZZtFAwX9TLlS +d4/ocSrYhMJ1tyedMCGg3X3zj/bSiZWOo4huJIp2yHZw+8hobMcDuzWQHoB9uu8n ++ei2SyEIB60uu0ALdiJGt4ZuYQNpWm55+TwC7j33+8dnPQQof+2vlxMhKoQmZV68 +2VK01o+P1184CqYisecjmKK1zqEvvHFr0QV5hjznZwJXA3eshJe2hydAI3aDamAz +ZD3j54nKtGkwSB4W82SCHEzANTwF5QQYEUiKiGu8EjeTNpSlQ1P4Szf9tjx3rc2m +gcot2YXRAoGBAOQyGQWazJ8EjNDwguc6qeOkSgnWq6HyxcATY9lB2QsPGDs6h6bM +wfnrqEMD8DWyzCuFNtAHcV+KZaNWnGPSQT8pEGGFPgIuH0xSIKbuzu8bE1lv88jU +nPrR+2+N0bd98ilVLQHRb3IlT9FswBF3c2wAm9+c7LoNJ/7pMUM7YQizAoGBAMQr +geewxNjNd8p5NdAi3wp7W8e5XzoJ4iK6y8fnCm2XsVTROtP8xxc6dI4I3OcUzYIa +woN0+RZ1PudC5oGmkPsXzoyORqjAuCOfrYZ62pg7pwRemGGq2Mk+eHfo09d1PrMT +HpkzNRNOk/+pcyKfWUm81NTILPRm/XbIhB6d2+fZAoGBANsg9IA6T2YgQ2zcmIed +AMk12VcrSrOAYr74n7hgECEbhKRTpzHYjCkHUBPSc1fNc1wTVzha/VbGmqVIJXOB +0t/o+e77uTj0u19ZujszNYnMUT9gTxS6fmgpPi64W/u9OM7SGR8W09Mj20r7CFF9 +iFvdFdGcaoKa4Z5apdCu85YbAoGAW3EAY9S1XW4hecMYf4XRvBwWgzn4lqBGxfOW +y/75kG5WXfgN2QUKdNxtukuNVTYQOaZpp0deWMacZMZ9lk/jYvgM8t3bOAxliU2E +YJxhyvZ7ewDxPQ2bcetp0lM4dEWVzXmLGNSS2AYX3OPK5Ies4j9gYjNRKTfczILZ +e0AQYrkCgYEAjJk1an5S6JQMMcdU1KX0uAUJOVu1xkkTvUBYOaC3VzeyYhMJXdOC +g8z/xrFDm7spyCbQPfsA3RHb40ZiGpb2oYhdunEI3f3ZW7RVJSdVeeZAP+IXZOCd +v4+rGNjjXLfpK+TOGkeSNkOivAvpw0mzskCRDfKcsndtwC28OElzCPc= +-----END RSA PRIVATE KEY----- -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37300?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Iba72ee00d10aba7831feedadacd943bf943de53e Gerrit-Change-Number: 37300 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: IPAd_Tests: move static test configuration to IPAd_Tests.default
by laforge 12 Jul '24

12 Jul '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37478?usp=email ) Change subject: IPAd_Tests: move static test configuration to IPAd_Tests.default ...................................................................... IPAd_Tests: move static test configuration to IPAd_Tests.default In IPAd_Tests.cfg we find some configuration parameters that never change. Those can be moved to IPAd_Tests.default. Change-Id: I14d6c7b617ed4c95a24e2ce96bf0d86c24288324 Related: SYS#6563 --- M ipad/IPAd_Tests.cfg M ipad/IPAd_Tests.default 2 files changed, 16 insertions(+), 3 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/ipad/IPAd_Tests.cfg b/ipad/IPAd_Tests.cfg index ae44ac5..2255611 100644 --- a/ipad/IPAd_Tests.cfg +++ b/ipad/IPAd_Tests.cfg @@ -9,11 +9,8 @@ [LOGGING] [TESTPORT_PARAMETERS] -system.HTTP_server_port.use_notification_ASPs := "no" system.HTTP_server_port.KEYFILE := "./example_ca/pki/private/alttest.key" system.HTTP_server_port.CERTIFICATEFILE := "./example_ca/pki/issued/alttest.crt" -system.HTTP_server_port.PASSWORD := "katinka1" -system.HTTP_server_port.http_debugging := "yes" [MODULE_PARAMETERS] diff --git a/ipad/IPAd_Tests.default b/ipad/IPAd_Tests.default index 95b42e9..ddf5f4b 100644 --- a/ipad/IPAd_Tests.default +++ b/ipad/IPAd_Tests.default @@ -2,6 +2,9 @@ mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING; // | DEBUG_ENCDEC; [TESTPORT_PARAMETERS] +system.HTTP_server_port.use_notification_ASPs := "no" +system.HTTP_server_port.PASSWORD := "katinka1" +system.HTTP_server_port.http_debugging := "yes" [MODULE_PARAMETERS] -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37478?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I14d6c7b617ed4c95a24e2ce96bf0d86c24288324 Gerrit-Change-Number: 37478 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: SGP32Definitions_Templates: add template for IpaEuiccDataResponse
by laforge 12 Jul '24

12 Jul '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37469?usp=email ) Change subject: SGP32Definitions_Templates: add template for IpaEuiccDataResponse ...................................................................... SGP32Definitions_Templates: add template for IpaEuiccDataResponse Related: SYS#6824 Change-Id: I93125dfedb2c1742efdc98e5f1f4d07ed5ed715c --- M library/euicc/SGP32Definitions_Templates.ttcn 1 file changed, 109 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/library/euicc/SGP32Definitions_Templates.ttcn b/library/euicc/SGP32Definitions_Templates.ttcn index 26003ad..d602d8e 100644 --- a/library/euicc/SGP32Definitions_Templates.ttcn +++ b/library/euicc/SGP32Definitions_Templates.ttcn @@ -21,6 +21,66 @@ import from PKIX1Explicit88_Templates all; import from PKIX1Explicit88_Types all; +/* GSMA SGP.32, section 5.9.2 (ES10x) */ +template (present) SGP32_EUICCInfo2 +tr_SGP32_EUICCInfo2 := { + profileVersion := ?, + svn := ?, + euiccFirmwareVer := ?, + extCardResource := ?, + uiccCapability := ?, + ts102241Version := *, + globalplatformVersion := *, + rspCapability := ?, + euiccCiPKIdListForVerification := ?, + euiccCiPKIdListForSigning := ?, + euiccCategory := *, + forbiddenProfilePolicyRules := *, + ppVersion := ?, + sasAcreditationNumber := ?, + certificationDataObject := *, + treProperties := *, + treProductReference := *, + additionalEuiccProfilePackageVersions := *, + ipaMode := *, + rfu2 := *, + rfu3 := *, + rfu4 := *, + iotSpecificInfo:= * +} +template (value) SGP32_EUICCInfo2 +ts_SGP32_EUICCInfo2 := { + profileVersion := '414243'O, + svn := '02000C'O, + euiccFirmwareVer := '414243'O, + extCardResource := '414243'O, + uiccCapability := '1111111111111111111'B, + ts102241Version := omit, + globalplatformVersion := omit, + rspCapability := '1111'B, + euiccCiPKIdListForVerification := { + 'C0BC70BA36929D43B467FF57570530E57AB8FCD8'O, + 'F54172BDF98A95D65CBEB88A38A1C11D800A85C3'O + }, + euiccCiPKIdListForSigning := { + 'C0BC70BA36929D43B467FF57570530E57AB8FCD8'O, + 'F54172BDF98A95D65CBEB88A38A1C11D800A85C3'O + }, + euiccCategory := omit, + forbiddenProfilePolicyRules := omit, + ppVersion := '414243'O, + sasAcreditationNumber := "123456", + certificationDataObject := omit, + treProperties := omit, + treProductReference := omit, + additionalEuiccProfilePackageVersions := omit, + ipaMode := omit, + rfu2 := omit, + rfu3 := omit, + rfu4 := omit, + iotSpecificInfo:= omit +} + /* GSMA SGP.32, section 6.3.2.1 */ template (present) EsipaMessageFromEimToIpa tr_initiateAuthenticationResponseEsipa(template (present) octetstring euiccChallenge := ?, @@ -1100,6 +1160,45 @@ } } +template (present) EsipaMessageFromIpaToEim +tr_provideEimPackageResult_euiccDataResp := { + provideEimPackageResult := { + ipaEuiccDataResponse := { + ipaEuiccData := { + defaultSmdpAddress := *, + euiccInfo1 := *, + euiccInfo2 := *, + rootSmdsAddress := *, + associationToken := *, + eumCertificate := *, + euiccCertificate := *, + ipaCapabilities := *, + deviceInfo := *, + notificationsList := * + } + } + } +} +template (value) EsipaMessageFromIpaToEim +ts_provideEimPackageResult_euiccDataResp := { + provideEimPackageResult := { + ipaEuiccDataResponse := { + ipaEuiccData := { + defaultSmdpAddress := "smdp.example.com", + euiccInfo1 := ts_EUICCInfo1, + euiccInfo2 := ts_SGP32_EUICCInfo2, + rootSmdsAddress := "smds.example.com", + associationToken := 1, + eumCertificate := ts_cert_eum_nist, + euiccCertificate := ts_cert_euicc_nist, + ipaCapabilities := omit, + deviceInfo := omit, + notificationsList := omit + } + } + } +} + template (present) EsipaMessageFromEimToIpa tr_provideEimPackageResultResponse_eimAck := { provideEimPackageResultResponse := { -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37469?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I93125dfedb2c1742efdc98e5f1f4d07ed5ed715c Gerrit-Change-Number: 37469 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: IPAd_Tests: rework verification of ESipa responses from IPAd
by laforge 12 Jul '24

12 Jul '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37470?usp=email ) Change subject: IPAd_Tests: rework verification of ESipa responses from IPAd ...................................................................... IPAd_Tests: rework verification of ESipa responses from IPAd The verification of the ESipa requests is done separately in each test case after calling f_esipa_transceive or f_esipa_receive. Let's do the verification directly in those functions. Related: SYS#6563 Change-Id: I0150fe5c98d5a5db9f1931c72ef6e015f74055bd --- M ipad/IPAd_Tests.ttcn 1 file changed, 59 insertions(+), 81 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn index 1ede0b3..3ea2e4b 100644 --- a/ipad/IPAd_Tests.ttcn +++ b/ipad/IPAd_Tests.ttcn @@ -341,48 +341,56 @@ } /* Receive ESipa HTTP request */ -private function f_esipa_receive() runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { - var HTTPMessage esipa_req; +private function f_esipa_receive(template EsipaMessageFromIpaToEim expected_esipa_req := omit) +runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { + var HTTPMessage esipa_req_encoded; timer T := 10.0; - var EsipaMessageFromIpaToEim request; + var EsipaMessageFromIpaToEim esipa_req; T.start; alt { - [] HTTP_SRV.receive({ request_binary := ? }) -> value esipa_req { - request := dec_EsipaMessageFromIpaToEim(esipa_req.request_binary.body); + [] HTTP_SRV.receive({ request_binary := ? }) -> value esipa_req_encoded { + esipa_req := dec_EsipaMessageFromIpaToEim(esipa_req_encoded.request_binary.body); + if (not istemplatekind(expected_esipa_req, "omit")) { + if (not match(valueof(esipa_req), expected_esipa_req)) { + setverdict(fail, "unexpected message from IPAd"); + } + } } [] T.timeout { setverdict(fail, "no HTTP request received?"); } } - return request; + return esipa_req; } /* Send ESipa HTTP response */ -private function f_esipa_send(EsipaMessageFromEimToIpa response) runs on IPAd_ConnHdlr { - var octetstring esipa_res; - esipa_res := enc_EsipaMessageFromEimToIpa(response); - HTTP_SRV.send(ts_http_resp(esipa_res)); +private function f_esipa_send(EsipaMessageFromEimToIpa esipa_res) runs on IPAd_ConnHdlr { + var octetstring esipa_res_encoded; + esipa_res_encoded := enc_EsipaMessageFromEimToIpa(esipa_res); + HTTP_SRV.send(ts_http_resp(esipa_res_encoded)); } /* Perform one ESipa HTTP request/response cycle */ -private function f_esipa_transceive(EsipaMessageFromEimToIpa response) runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { - var EsipaMessageFromIpaToEim request; +private function f_esipa_transceive(EsipaMessageFromEimToIpa esipa_res, + template EsipaMessageFromIpaToEim expected_esipa_req := omit) +runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { + var EsipaMessageFromIpaToEim esipa_req; - request := f_esipa_receive(); - f_esipa_send(response); - - return request; + esipa_req := f_esipa_receive(expected_esipa_req); + f_esipa_send(esipa_res); + return esipa_req; } /* Perform one ESipa HTTP request/response cycle but with an empty response */ -private function f_esipa_transceive_empty_response() runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { - var EsipaMessageFromIpaToEim request; +private function f_esipa_transceive_empty_response(template EsipaMessageFromIpaToEim expected_esipa_req := omit) +runs on IPAd_ConnHdlr return EsipaMessageFromIpaToEim { + var EsipaMessageFromIpaToEim esipa_req; - request := f_esipa_receive(); + esipa_req := f_esipa_receive(expected_esipa_req); HTTP_SRV.send(ts_http_resp(''O)); - return request; + return esipa_req; } /* Common Mutual Authentication Procedure, see also: GSMA SGP.22, section 3.0.1 */ @@ -397,10 +405,7 @@ f_vpcd_transceive(enc_GetEuiccChallengeResponse(valueof(ts_GetEuiccChallengeResponse)), 'bf2e00'O); /* Step #5-#10 */ - esipa_req := f_esipa_receive(); - if (not match(esipa_req, tr_initiateAuthenticationRequestEsipa)) { - setverdict(fail, "unexpected message from IPAd"); - } + esipa_req := f_esipa_receive(tr_initiateAuthenticationRequestEsipa); esipa_res := valueof(ts_initiateAuthenticationResponseEsipa(euiccChallenge := esipa_req.initiateAuthenticationRequestEsipa.euiccChallenge)); f_esipa_send(esipa_res); @@ -408,10 +413,7 @@ f_vpcd_transceive(enc_AuthenticateServerResponse(valueof(ts_authenticateServerResponse))); /* Step #15-#17 */ - esipa_req := f_esipa_transceive(valueof(ts_authenticateClientResponseEsipa_dpe)); - if (not match(esipa_req, tr_authenticateClientRequestEsipa)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_authenticateClientResponseEsipa_dpe), tr_authenticateClientRequestEsipa); } /* ********************************************* */ @@ -422,8 +424,6 @@ /* 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 { - var EsipaMessageFromIpaToEim esipa_req; - var EsipaMessageFromEimToIpa esipa_res; var integer i; var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port); var BoundProfilePackage boundProfilePackage; @@ -432,11 +432,7 @@ f_http_register(); /* Prepare indirect profile download by responding with a download trigger request */ - esipa_res := valueof(ts_getEimPackageResponse_dnlTrigReq); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_getEimPackageRequest)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_getEimPackageResponse_dnlTrigReq), tr_getEimPackageRequest); /* Expect the IPAd to query the eIM configuration data from the eUICC */ f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))), 'BF5500'O); @@ -444,11 +440,10 @@ f_proc_cmn_mtl_auth(); f_vpcd_transceive(enc_PrepareDownloadResponse(valueof(ts_prepareDownloadResponse))); + f_esipa_transceive(valueof(ts_getBoundProfilePackageResponseEsipa), + tr_getBoundProfilePackageRequestEsipa); - esipa_res := valueof(ts_getBoundProfilePackageResponseEsipa); - esipa_req := f_esipa_transceive(esipa_res); - boundProfilePackage := esipa_res.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.boundProfilePackage; - /* TODO: match response (we do not have a template yet) */ + boundProfilePackage := valueof(ts_boundProfilePackage); /* initialiseSecureChannelRequest */ f_vpcd_transceive(''O); @@ -484,8 +479,7 @@ f_vpcd_transceive(enc_EnableUsingDDResponse(valueof(ts_enableUsingDDResponse))); /* Receive ProfileInstallationResult from iPAD->eIM */ - esipa_req := f_esipa_transceive_empty_response(); - /* TODO: match response (we do not have a template yet) */ + f_esipa_transceive_empty_response(tr_handleNotificationEsipa_prfleInstRslt); /* Receive RemoveNotificationFromList from iPAD->eUICC */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -511,18 +505,11 @@ /* 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 { - var EsipaMessageFromIpaToEim esipa_req; - var EsipaMessageFromEimToIpa esipa_res; - f_es10x_init(); f_http_register(); /* Step #1-#2 */ - esipa_res := valueof(ts_getEimPackageResponse_euiccPkgReq); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_getEimPackageRequest)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccPkgReq), tr_getEimPackageRequest); /* Step #3-#8 */ f_vpcd_transceive(enc_EuiccPackageResult(valueof(ts_euiccPackageResult))); @@ -531,11 +518,8 @@ f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse))); /* Step #10-14 */ - esipa_res := valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_provideEimPackageResult_ePRAndNotif)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), + tr_provideEimPackageResult_ePRAndNotif); /* Step #15-17 */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -566,18 +550,11 @@ /* 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 { - var EsipaMessageFromIpaToEim esipa_req; - var EsipaMessageFromEimToIpa esipa_res; - f_es10x_init(); f_http_register(); /* Step #1-#2 */ - esipa_res := valueof(ts_getEimPackageResponse_euiccPkgReq); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_getEimPackageRequest)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccPkgReq), tr_getEimPackageRequest); /* Step #3-#8 */ f_vpcd_transceive(enc_EuiccPackageResult(valueof(ts_euiccPackageResult))); @@ -599,11 +576,8 @@ f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse))); /* Step #10-14 */ - esipa_res := valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_provideEimPackageResult_ePRAndNotif(euiccPackageResult := ?))) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), + tr_provideEimPackageResult_ePRAndNotif(euiccPackageResult := ?)); /* Step #15-17 */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -633,19 +607,13 @@ /* A testcase to try out an IpaEuiccDataRequest */ private function f_TC_proc_euicc_data_req(charstring id) runs on IPAd_ConnHdlr { - var EsipaMessageFromIpaToEim esipa_req; - var EsipaMessageFromEimToIpa esipa_res; var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port); f_es10x_init(); f_http_register(); /* IPAd requests a package, we tell it to execute an ipaEuiccDataRequest */ - esipa_res := valueof(ts_getEimPackageResponse_euiccDataReq); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_getEimPackageRequest)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_getEimPackageResponse_euiccDataReq), tr_getEimPackageRequest); /* IPAd will obtain the data from the eUICC */ f_vpcd_transceive(enc_EuiccConfiguredAddressesResponse(valueof(ts_euiccConfiguredAddressesResponse))); @@ -656,8 +624,8 @@ f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse))); /* IPAd will return the data to us */ - esipa_res := valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})); - esipa_req := f_esipa_transceive(esipa_res); + f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), + tr_provideEimPackageResult_euiccDataResp); /* Wait some time until the the last HTTP response is actually delivered */ f_sleep(2.0); @@ -685,11 +653,7 @@ f_http_register(); /* IPAd requests a package, we respond with an eimPackageError code 127 (undefined error) */ - esipa_res := valueof(ts_getEimPackageResponse_eimPkgErrUndef); - esipa_req := f_esipa_transceive(esipa_res); - if (not match(esipa_req, tr_getEimPackageRequest)) { - setverdict(fail, "unexpected message from IPAd"); - } + f_esipa_transceive(valueof(ts_getEimPackageResponse_eimPkgErrUndef), tr_getEimPackageRequest); /* Wait some time until the the last HTTP response is actually delivered */ f_sleep(2.0); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37470?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I0150fe5c98d5a5db9f1931c72ef6e015f74055bd Gerrit-Change-Number: 37470 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: SGP32Definitions_Templates: add template for IpaEuiccDataResponse
by laforge 12 Jul '24

12 Jul '24
Attention is currently required from: dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37469?usp=email ) Change subject: SGP32Definitions_Templates: add template for IpaEuiccDataResponse ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37469?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I93125dfedb2c1742efdc98e5f1f4d07ed5ed715c Gerrit-Change-Number: 37469 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 12 Jul 2024 15:20:41 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in pysim[master]: pySim.tlv: Add COMPACT_TLV_IE TLV variant
by laforge 12 Jul '24

12 Jul '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37435?usp=email ) Change subject: pySim.tlv: Add COMPACT_TLV_IE TLV variant ...................................................................... pySim.tlv: Add COMPACT_TLV_IE TLV variant the COMPACT-TLV variant is a TLV variant that ISO7816 uses for encoding tag and length into a single octet. This is used (for example) in ATR historical bytes. Let's add support for this to our pySim TLV encoder/decoder. Change-Id: I9e98d150b97317ae0c6be2366bdaaeaeddf8031c --- M pySim/tlv.py M tests/test_tlv.py 2 files changed, 69 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pySim/tlv.py b/pySim/tlv.py index d7c6876..6dc5301 100644 --- a/pySim/tlv.py +++ b/pySim/tlv.py @@ -246,6 +246,35 @@ return dec, remainder +class COMPACT_TLV_IE(TLV_IE): + """TLV_IE formatted as COMPACT-TLV described in ISO 7816""" + + @classmethod + def _parse_tag_raw(cls, do: bytes) -> Tuple[int, bytes]: + return do[0] >> 4, do + + @classmethod + def _decode_tag(cls, do: bytes) -> Tuple[dict, bytes]: + rawtag, remainder = cls._parse_tag_raw(do) + return {'tag': rawtag}, remainder + + @classmethod + def _parse_len(cls, do: bytes) -> Tuple[int, bytes]: + return do[0] & 0xf, do[1:] + + def _encode_tag(self) -> bytes: + """Not needed as we override the to_tlv() method to encode tag+length into one byte.""" + raise NotImplementedError + + def _encode_len(self): + """Not needed as we override the to_tlv() method to encode tag+length into one byte.""" + raise NotImplementedError + + def to_tlv(self, context: dict = {}): + val = self.to_bytes(context=context) + return bytes([(self.tag << 4) | (len(val) & 0xF)]) + val + + class BER_TLV_IE(TLV_IE): """TLV_IE formatted as ASN.1 BER described in ITU-T X.690 8.1.2.""" diff --git a/tests/test_tlv.py b/tests/test_tlv.py index 0e73ab1..3b05f19 100644 --- a/tests/test_tlv.py +++ b/tests/test_tlv.py @@ -17,8 +17,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import unittest -from construct import Int8ub +from construct import Int8ub, GreedyBytes from pySim.tlv import * +from pySim.utils import h2b class TestUtils(unittest.TestCase): def test_camel_to_snake(self): @@ -117,5 +118,28 @@ self.assertEqual(ie.to_bytes(), b'\x42') self.assertEqual(ie.to_ie(), b'\x42') +class TestCompact(unittest.TestCase): + class IE_3(COMPACT_TLV_IE, tag=0x3): + _construct = GreedyBytes + class IE_7(COMPACT_TLV_IE, tag=0x7): + _construct = GreedyBytes + class IE_5(COMPACT_TLV_IE, tag=0x5): + _construct = GreedyBytes + # pylint: disable=undefined-variable + class IE_Coll(TLV_IE_Collection, nested=[IE_3, IE_7, IE_5]): + _construct = GreedyBytes + def test_ATR(self): + atr = h2b("31E073FE211F5745437531301365") + c = self.IE_Coll() + c.from_tlv(atr) + self.assertEqual(c.children[0].tag, 3) + self.assertEqual(c.children[0].to_bytes(), b'\xe0') + self.assertEqual(c.children[1].tag, 7) + self.assertEqual(c.children[1].to_bytes(), b'\xfe\x21\x1f') + self.assertEqual(c.children[2].tag, 5) + self.assertEqual(c.children[2].to_bytes(), b'\x45\x43\x75\x31\x30\x13\x65') + self.assertEqual(c.to_tlv(), atr) + + if __name__ == "__main__": unittest.main() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37435?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I9e98d150b97317ae0c6be2366bdaaeaeddf8031c Gerrit-Change-Number: 37435 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[M] Change in pysim[master]: pySim.tlv: Add COMPACT_TLV_IE TLV variant
by laforge 12 Jul '24

12 Jul '24
Attention is currently required from: dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/37435?usp=email ) Change subject: pySim.tlv: Add COMPACT_TLV_IE TLV variant ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37435?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I9e98d150b97317ae0c6be2366bdaaeaeddf8031c Gerrit-Change-Number: 37435 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 12 Jul 2024 15:20:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • ...
  • 138
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.