Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43651?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: smf: Initial HTTP2/SBI support
......................................................................
smf: Initial HTTP2/SBI support
* New library/TS*_Templates.ttcn files are added providing several
templates for SBI interface types available from
osmo-ttcn3-openapi-generator.git.
* Split SMF_Session_CT parts which are only used during 4G tests
(Diameter interfaces, S5/S8/S2b GTPv2C interfaces) into its own file
SMF_Session_CT_4G. There's usually no need to look at both 4G and 5G
specific code at the same time, since usually tests validate one or
the other. SMF_Session_CT is left with common stuff, like lifecycle
of component and PFCP interface.
* Add a new SMF_Session_CT_5G file containing all 5G specific logic, ie.
HTTP2 SBI interface handling.
* Add a new test in SMF_Tests which makes use of the new
SMF_Session_CT_5G logic to emulate a PDU Session request from a 5G UE.
Test and infra only validates so far until UE receives the PDU session
request after UDM/PCF validation & setup. Further work will be done in
follow-up commits.
* Adapt open5gs config to use an SCP to route all HTTP2 traffic. This
way we can emulate all nodes through a single HTTP2 server, and we
emulate the SCP forwarding the messages to the proper destination.
Hence, the NRF is disabled.
Related: SYS#7073
Change-Id: I377b748d8da6e9e53a96a85f1c730505793ecea8
---
M library/HTTP2_Functions.ttcn
A library/TS29502_Nsmf_PDUSession_Templates.ttcn
A library/TS29503_Nudm_SDM_Templates.ttcn
A library/TS29512_Npcf_SMPolicyControl_Templates.ttcn
A library/TS29518_Namf_Communication_Templates.ttcn
A library/TS29571_CommonData_Templates.ttcn
M smf/README.md
M smf/SMF_Session_CT.ttcn
A smf/SMF_Session_CT_4G.ttcn
A smf/SMF_Session_CT_5G.ttcn
M smf/SMF_Tests.ttcn
M smf/expected-results.xml
M smf/gen_links.sh
M smf/open5gs-nrf.yaml
M smf/open5gs-smf.yaml
M smf/regen_makefile.sh
M smf/testenv.cfg
17 files changed, 2,008 insertions(+), 396 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/51/43651/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43651?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I377b748d8da6e9e53a96a85f1c730505793ecea8
Gerrit-Change-Number: 43651
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43655?usp=email )
Change subject: IPAd: Make existing tests work with multi eIM support
......................................................................
IPAd: Make existing tests work with multi eIM support
The test cases terminate differently. At the end, the IPAd will request
eIM configuration data from eUICC again, to check for a second eIM. If
this second eIM is not provided by eUICC, the IPAd will terminate.
Related: SYS#8101
Change-Id: Id67bb3acc3f90805b06f441c5352ba29a28698c4
---
M ipad/IPAd_Tests.ttcn
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/55/43655/1
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn
index 226c70b..310315d 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -460,8 +460,15 @@
/* After processing notifications and eIM packages, IPAd will poll again.
* Respond with no eIM package. */
private function f_terminate_poll_cycle() runs on IPAd_ConnHdlr {
+ var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
+
/* IPAd requests a package, we tell it that there is no package available */
f_esipa_transceive(valueof(ts_getEimPackageResponse_noEimPackageAvailable), tr_getEimPackageRequest);
+
+ /* Expect the IPAd to query the eIM configuration data from the eUICC.
+ * This is because the IPAd will check if there is another eIM configured, but it is not. */
+ f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))), 'BF5500'O);
+
}
/* Run IPAd once in the background.
@@ -800,8 +807,7 @@
/* A testcase to try out what happens when the eIM package request is rejected */
private function f_TC_get_eim_pkg_req_rej(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_exec_ipad();
f_es10x_init();
@@ -810,6 +816,10 @@
/* IPAd requests a package, we respond with an eimPackageError code 127 (undefined error) */
f_esipa_transceive(valueof(ts_getEimPackageResponse_eimPkgErr(127)), tr_getEimPackageRequest);
+ /* Expect the IPAd to query the eIM configuration data from the eUICC.
+ * This is because the IPAd will check if there is another eIM configured, but it is not. */
+ f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))), 'BF5500'O);
+
/* 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/+/43655?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id67bb3acc3f90805b06f441c5352ba29a28698c4
Gerrit-Change-Number: 43655
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43656?usp=email )
Change subject: IPAd: Add support for testing IPAd polling two eIMs
......................................................................
IPAd: Add support for testing IPAd polling two eIMs
A flag is used to send an EimConfigurationDataResponse to the IPAd with
two eIMs in the EimConfigurationData list. Tests can use that to verify
that both eIMs are polled correctly.
Note that both eIMs share the same FQDN. This makes the test cases
easier, because they don't require two HTTP servers at a time or need to
change the HTTP server address.
Related: SYS#8101
Change-Id: I14c3f09a4c21d5f643e6e499a095410b6c8f02ed
---
M ipad/IPAd_Tests.ttcn
M library/euicc/SGP32Definitions_Templates.ttcn
2 files changed, 33 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/56/43656/1
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn
index 310315d..81e477d 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -105,13 +105,13 @@
};
type record IPAd_ConnHdlrPars {
- /* TODO: add some useful parameters */
+ boolean second_eim
};
-private function f_init_pars()
+private function f_init_pars(boolean second_eim := false)
runs on MTC_CT return IPAd_ConnHdlrPars {
var IPAd_ConnHdlrPars pars := {
- /* TODO: fill parameters with meaninful values */
+ second_eim := second_eim
};
return pars;
}
@@ -320,7 +320,6 @@
private function f_es10x_init(boolean iot := true,
boolean eim_init := true,
OCT1 dev_capa := '00'O) runs on IPAd_ConnHdlr {
- var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
var octetstring term_capa;
/* If we decide not to use vpcd, then we must not initialize anything here */
@@ -353,14 +352,32 @@
/* Not all tests expect IPAd to query eUICC data and notfications before talking to eIM. */
if (eim_init) {
- /* Expect the IPAd to query the eIM configuration data from the eUICC */
- f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))), 'BF5500'O);
-
- /* Expect the IPAd to query the eUICC for pending notifications, we respond with an empty list */
- f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse_empty)), 'BF2B00'O);
+ f_eim_init();
}
}
+private function f_eim_init() runs on IPAd_ConnHdlr {
+ var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
+
+ template (value) GetEimConfigurationDataResponse v_getEimConfigurationDataResponse_2eim := {
+ eimConfigurationDataList := {
+ ts_eimConfigurationData(eimFqdn := eim_fqdn, eimId := "myEIM_1"),
+ ts_eimConfigurationData(eimFqdn := eim_fqdn, eimId := "myEIM_2")
+ }
+ }
+
+ /* Expect the IPAd to query the eIM configuration data from the eUICC */
+ if (g_pars.second_eim) {
+ /* Note: Both eIM configurations have thee same FQDN. No second HTTP server is required for testing. */
+ f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(v_getEimConfigurationDataResponse_2eim)), 'BF5500'O);
+ } else {
+ f_vpcd_transceive(enc_GetEimConfigurationDataResponse(valueof(ts_getEimConfigurationDataResponse(eim_fqdn))), 'BF5500'O);
+ }
+
+ /* Expect the IPAd to query the eUICC for pending notifications, we respond with an empty list */
+ f_vpcd_transceive(enc_RetrieveNotificationsListResponse(valueof(ts_retrieveNotificationsListResponse_empty)), 'BF2B00'O);
+}
+
/* Handle the closing of logical channel 1 */
private function f_es10x_close() runs on IPAd_ConnHdlr {
diff --git a/library/euicc/SGP32Definitions_Templates.ttcn b/library/euicc/SGP32Definitions_Templates.ttcn
index ab27369..31d183d 100644
--- a/library/euicc/SGP32Definitions_Templates.ttcn
+++ b/library/euicc/SGP32Definitions_Templates.ttcn
@@ -1656,8 +1656,9 @@
indirectProfileDownload := *
}
template (value) EimConfigurationData
-ts_eimConfigurationData(template (omit) charstring eimFqdn := omit) := {
- eimId := "myEIM",
+ts_eimConfigurationData(template (omit) charstring eimFqdn := omit,
+ template (value) charstring eimId := "myEIM") := {
+ eimId := eimId,
eimFqdn := eimFqdn,
eimIdType := omit,
counterValue := omit,
@@ -1673,9 +1674,11 @@
eimConfigurationDataList := ?
}
template (value) GetEimConfigurationDataResponse
-ts_getEimConfigurationDataResponse(template (value) charstring eimFqdn := "127.0.0.1") := {
+ts_getEimConfigurationDataResponse(template (value) charstring eimFqdn := "127.0.0.1",
+ template (value) charstring eimId := "myEIM") := {
eimConfigurationDataList := {
- ts_eimConfigurationData(eimFqdn)
+ ts_eimConfigurationData(eimFqdn := eimFqdn,
+ eimId := eimId)
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43656?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I14c3f09a4c21d5f643e6e499a095410b6c8f02ed
Gerrit-Change-Number: 43656
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43654?usp=email )
Change subject: esipa_asn1_handler: fix typos
......................................................................
esipa_asn1_handler: fix typos
Related: SYS#8100
Change-Id: I14416250cdb523f5c1a20d3a3e3dbe5cc6c53bcd
---
M src/esipa_asn1_handler.erl
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/54/43654/1
diff --git a/src/esipa_asn1_handler.erl b/src/esipa_asn1_handler.erl
index 2fe7603..f53b177 100644
--- a/src/esipa_asn1_handler.erl
+++ b/src/esipa_asn1_handler.erl
@@ -229,8 +229,8 @@
% Sub-procedure Profile Installation (see also GSMA SGP.22, section 3.1.3.3). The eIM uses the
% result data contained in this message to conclude the download and to make the download results
% available to the REST API user. However, in rare cases it is possible that a
- % ProfileInstallationResult is received way too late as part of the Notification Delivery to
- % Notification Receivers (see also GSMA SGP.32, section 3.7) procedure. By then the context in the
+ % ProfileInstallationResult is received way too late as part of the notification delivery to
+ % notification receivers (see also GSMA SGP.32, section 3.7) procedure. By then the context in the
% eIM may be long gone. The eIM will be unable to match the ProfileInstallationResult to any
% context but it will foward it to the SMDP+ anyway.
case mnesia_db_work:bind(Pid, TransactionId) of
--
To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43654?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: onomondo-eim
Gerrit-Branch: master
Gerrit-Change-Id: I14416250cdb523f5c1a20d3a3e3dbe5cc6c53bcd
Gerrit-Change-Number: 43654
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: jolly.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: Add index to ipa_es10b_get_eim_cfg_data_filter
......................................................................
Add index to ipa_es10b_get_eim_cfg_data_filter
In order to select a specific item from EimConfigurationData list, an
index may be given. This is needed to select list items, if no specific
eIM ID is given. Later patch use this filter to loop through all
available eIM configurations.
Related: SYS#8101
Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
---
M src/ipa/libipa/es10b_get_eim_cfg_data.c
M src/ipa/libipa/es10b_get_eim_cfg_data.h
M src/ipa/libipa/ipad.c
M src/ipa/libipa/proc_eim_pkg_retr.c
M src/ipa/libipa/proc_euicc_data_req.c
5 files changed, 28 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/52/43652/2
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
Gerrit-Change-Number: 43652
Gerrit-PatchSet: 2
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email )
Change subject: Add index to ipa_es10b_get_eim_cfg_data_filter
......................................................................
Add index to ipa_es10b_get_eim_cfg_data_filter
In order to select a specific item from EimConfigurationData list, an
index may be given. This is needed to select list items, if no specific
eIM ID is given. Later patch use this filter to loop through all
available eIM configurations.
Related: SYS#8101
Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
---
M src/ipa/libipa/es10b_get_eim_cfg_data.c
M src/ipa/libipa/es10b_get_eim_cfg_data.h
M src/ipa/libipa/ipad.c
M src/ipa/libipa/proc_eim_pkg_retr.c
M src/ipa/libipa/proc_euicc_data_req.c
5 files changed, 29 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/52/43652/1
diff --git a/src/ipa/libipa/es10b_get_eim_cfg_data.c b/src/ipa/libipa/es10b_get_eim_cfg_data.c
index 6e2f32b..a9a9ae8 100644
--- a/src/ipa/libipa/es10b_get_eim_cfg_data.c
+++ b/src/ipa/libipa/es10b_get_eim_cfg_data.c
@@ -285,37 +285,46 @@
}
/*! Filter one EimConfigurationData list item from GetEimConfigurationDataResponse.
+ * \param[out] eim_cfg_data_ite pointer to EimConfigurationData item pointer.
* \param[in] res pointer to function result that contains the GetEimConfigurationDataResponse.
* \param[in] eim_id eimId to look for. When set to NULL, the first item of the EimConfigurationData list is returned.
- * \returns pointer to EimConfigurationData item, NULL on error. */
-struct EimConfigurationData *ipa_es10b_get_eim_cfg_data_filter(struct ipa_es10b_eim_cfg_data *res, char *eim_id)
+ * \param[in] index the item of the EimConfigurationData list to be returned. (If eim_id is set, this has no effect.)
+ * \returns 0 on success, negative on failure. (-ENOENT is returned if index not 0 and out of range.) */
+int ipa_es10b_get_eim_cfg_data_filter(struct EimConfigurationData **eim_cfg_data_item,
+ struct ipa_es10b_eim_cfg_data *res, char *eim_id, int index)
{
long i;
if (!res || !res->res) {
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR,
"cannot filter non existent EimConfigurationData list\n");
- return NULL;
+ return EINVAL;
}
if (res->res->eimConfigurationDataList.list.count < 1) {
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR, "cannot filter empty EimConfigurationData list\n");
- return NULL;
+ return EINVAL;
}
- /* In case no eim_id is specified, just pick the first item from the list */
+ /* In case no eim_id is specified, just pick the item from the list that is specified by index */
if (!eim_id || eim_id[0] == '\0') {
- return res->res->eimConfigurationDataList.list.array[0];
+ /* If the index is out of range, return -ENOENT. */
+ if (index >= res->res->eimConfigurationDataList.list.count) {
+ return -ENOENT;
+ }
+ *eim_cfg_data_item = res->res->eimConfigurationDataList.list.array[index];
+ return 0;
}
for (i = 0; i < res->res->eimConfigurationDataList.list.count; i++) {
if (IPA_ASN_STR_CMP_BUF
(&res->res->eimConfigurationDataList.list.array[i]->eimId, eim_id, strlen(eim_id))) {
- return res->res->eimConfigurationDataList.list.array[i];
+ *eim_cfg_data_item = res->res->eimConfigurationDataList.list.array[i];
+ return 0;
}
}
IPA_LOGP_ES10X("GetEimConfigurationData", LERROR, "cannot find eimId %s in EimConfigurationData list\n",
eim_id);
- return NULL;
+ return EINVAL;
}
diff --git a/src/ipa/libipa/es10b_get_eim_cfg_data.h b/src/ipa/libipa/es10b_get_eim_cfg_data.h
index 5c3c3c5..0bfb776 100644
--- a/src/ipa/libipa/es10b_get_eim_cfg_data.h
+++ b/src/ipa/libipa/es10b_get_eim_cfg_data.h
@@ -43,4 +43,5 @@
struct ipa_es10b_eim_cfg_data *ipa_es10b_get_eim_cfg_data(struct ipa_context *ctx);
void ipa_es10b_get_eim_cfg_data_free(struct ipa_es10b_eim_cfg_data *res);
-struct EimConfigurationData *ipa_es10b_get_eim_cfg_data_filter(struct ipa_es10b_eim_cfg_data *res, char *eim_id);
+int ipa_es10b_get_eim_cfg_data_filter(struct EimConfigurationData **eim_cfg_data_item,
+ struct ipa_es10b_eim_cfg_data *res, char *eim_id, int index);
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 0a590ec..5092520 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -145,6 +145,7 @@
{
struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc;
eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
if (!eim_cfg_data) {
@@ -153,8 +154,8 @@
}
/* In case no preferred_eim_id is set, the first eIM configuration item will be pulled from the list */
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->cfg->preferred_eim_id);
- if (!eim_cfg_data_item) {
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, 0);
+ if (rc < 0) {
IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
goto error;
}
diff --git a/src/ipa/libipa/proc_eim_pkg_retr.c b/src/ipa/libipa/proc_eim_pkg_retr.c
index ebe8e91..f461dad 100644
--- a/src/ipa/libipa/proc_eim_pkg_retr.c
+++ b/src/ipa/libipa/proc_eim_pkg_retr.c
@@ -32,6 +32,7 @@
{
struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc;
*pkid = NULL;
@@ -41,8 +42,8 @@
goto error;
}
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->eim_id);
- if (!eim_cfg_data_item) {
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->eim_id, 0);
+ if (rc < 0) {
IPA_LOGP(SIPA, LERROR, "no EimConfigurationData item for eimId %s present!\n", ctx->eim_id);
goto error;
}
diff --git a/src/ipa/libipa/proc_euicc_data_req.c b/src/ipa/libipa/proc_euicc_data_req.c
index b867828..28174f9 100644
--- a/src/ipa/libipa/proc_euicc_data_req.c
+++ b/src/ipa/libipa/proc_euicc_data_req.c
@@ -153,8 +153,10 @@
IPA_LOGP(SIPA, LINFO, "eIM asks for Association token\n");
eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
if (eim_cfg_data && eim_cfg_data->res) {
- eim_cfg_data_item = ipa_es10b_get_eim_cfg_data_filter(eim_cfg_data, ctx->eim_id);
- if (eim_cfg_data_item)
+ int rc;
+
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->eim_id, 0);
+ if (rc >= 0)
ipa_euicc_data_response.choice.ipaEuiccData.associationToken = eim_cfg_data_item->associationToken;
}
}
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: I7a3cbbf8cd765f6da955434d897d9ffbe847f525
Gerrit-Change-Number: 43652
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43653?usp=email )
Change subject: Add support for polling multiple eIMs
......................................................................
Add support for polling multiple eIMs
If the eUICC stores multiple eIM configurations, poll all eIMs rather
than only the first one found.
The poll loop is moved from main.c to ipad.c. This poll loop is then
called for all eIMs found in the EimConfigurationData list.
To abort execution, the global "running" flag is mode from main.c to
context structure. A new function is used to clear the flag and cause
the poll loop to terminate.
Related: SYS#8101
Change-Id: Ifcad584dd04dc83c59124ce32e60254a72537d02
---
M include/onomondo/ipa/ipad.h
M src/ipa/libipa/context.h
M src/ipa/libipa/ipad.c
M src/ipa/main.c
4 files changed, 146 insertions(+), 96 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/53/43653/1
diff --git a/include/onomondo/ipa/ipad.h b/include/onomondo/ipa/ipad.h
index eafcee4..fa5ca46 100644
--- a/include/onomondo/ipa/ipad.h
+++ b/include/onomondo/ipa/ipad.h
@@ -48,6 +48,9 @@
* used.) */
char *preferred_eim_id;
+ /*! force the IPAd to process only one eUICC package (debug, use with caution) */
+ bool one_euicc_pkg_only;
+
/*! current TAC (This struct member may be updated at any time after context creation.) */
uint8_t tac[IPA_LEN_TAC];
@@ -96,7 +99,6 @@
struct ipa_context *ipa_new_ctx(struct ipa_config *cfg, struct ipa_buf *nvstate);
int ipa_init(struct ipa_context *ctx);
-int eim_init(struct ipa_context *ctx);
int ipa_add_init_eim_cfg(struct ipa_context *ctx, struct ipa_buf *cfg);
int ipa_euicc_mem_rst(struct ipa_context *ctx, bool operatnl_profiles, bool field_test_profiles, bool default_smdp_addr,
bool pre_test_profiles, bool provisioning_profiles, bool eim_cfg_data, bool immediate_enable_cfg);
@@ -106,5 +108,6 @@
int ipa_disable_emerg_prfle(struct ipa_context *ctx);
int ipa_get_connnectivity_parameters(struct ipa_context *ctx, struct ipa_buf **http_params);
int ipa_poll(struct ipa_context *ctx);
+void ipa_abort(struct ipa_context *ctx);
void ipa_close(struct ipa_context *ctx);
struct ipa_buf *ipa_free_ctx(struct ipa_context *ctx);
diff --git a/src/ipa/libipa/context.h b/src/ipa/libipa/context.h
index 2100cc2..d9c8324 100644
--- a/src/ipa/libipa/context.h
+++ b/src/ipa/libipa/context.h
@@ -67,10 +67,10 @@
} immediate_enable;
} iot_euicc_emu;
- /*! cached eimId (read from eUICC when ipa_init is called) */
+ /*! cached eimId (read from eUICC when eim_init is called) */
char *eim_id;
- /*! cached eIM address (read from eUICC when ipa_init is called) */
+ /*! cached eIM address (read from eUICC when eim_init is called) */
char *eim_fqdn;
/*! cached state of generic eUICC package download and execute procedure
@@ -86,4 +86,7 @@
/*! A canary to detect HTTP communication errors */
bool check_http;
+
+ /*! Flag to keep polling eIM(s) or terminate the loop */
+ bool poll_running;
};
diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c
index 5092520..8d209f9 100644
--- a/src/ipa/libipa/ipad.c
+++ b/src/ipa/libipa/ipad.c
@@ -138,45 +138,6 @@
nvstate_deserialize_ipa_buf(&nvstate_data, &nvstate_data_len);
}
-/*! Read eIM configuration from eUICC and pick a suitable eIM.
- * \param[inout] ctx pointer to ipa_context.
- * \returns 0 success, -EINVAL on failure. */
-int eim_init(struct ipa_context *ctx)
-{
- struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
- struct EimConfigurationData *eim_cfg_data_item = NULL;
- int rc;
-
- eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
- if (!eim_cfg_data) {
- IPA_LOGP(SIPA, LERROR, "cannot read EimConfigurationData from eUICC\n");
- goto error;
- }
-
- /* In case no preferred_eim_id is set, the first eIM configuration item will be pulled from the list */
- rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, 0);
- if (rc < 0) {
- IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
- goto error;
- }
-
- ctx->eim_id = IPA_STR_FROM_ASN(&eim_cfg_data_item->eimId);
- if (!ctx->eim_id)
- goto error;
-
- if (eim_cfg_data_item->eimFqdn)
- ctx->eim_fqdn = IPA_STR_FROM_ASN(eim_cfg_data_item->eimFqdn);
- else
- goto error;
-
- ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
- return 0;
-error:
- IPA_LOGP(SIPA, LERROR, "unable to retrieve EimConfigurationData\n");
- ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
- return -EINVAL;
-}
-
/*! Create a new ipa_context.
* \param[in] cfg IPAd configuration.
* \returns ipa_context on success, NULL on failure. */
@@ -393,13 +354,53 @@
return -EINVAL;
}
-/*! poll the IPAd (may be called in regular intervals or on purpose).
- * \param[inout] ctx pointer to ipa_context.
- * \returns positive on success, negative on error (see also enum ipa_poll_rc). */
-int ipa_poll(struct ipa_context *ctx)
+static int eim_init(struct ipa_context *ctx, int index)
+{
+ struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL;
+ struct EimConfigurationData *eim_cfg_data_item = NULL;
+ int rc = -EINVAL;
+
+ eim_cfg_data = ipa_es10b_get_eim_cfg_data(ctx);
+ if (!eim_cfg_data) {
+ IPA_LOGP(SIPA, LERROR, "cannot read EimConfigurationData from eUICC\n");
+ goto error;
+ }
+
+ /* In case no preferred_eim_id is set, the eIM configuration item of the given index will be pulled from the list */
+ rc = ipa_es10b_get_eim_cfg_data_filter(&eim_cfg_data_item, eim_cfg_data, ctx->cfg->preferred_eim_id, index);
+ if (rc) {
+ if (rc != -ENOENT)
+ IPA_LOGP(SIPA, LERROR, "no suitable EimConfigurationData item present.\n");
+ goto error;
+ }
+
+ IPA_FREE(ctx->eim_id);
+ ctx->eim_id = IPA_STR_FROM_ASN(&eim_cfg_data_item->eimId);
+ if (!ctx->eim_id) {
+ IPA_LOGP(SIPA, LERROR, "unable to allocate memory\n");
+ goto error;
+ }
+
+ IPA_FREE(ctx->eim_fqdn);
+ if (eim_cfg_data_item->eimFqdn) {
+ ctx->eim_fqdn = IPA_STR_FROM_ASN(eim_cfg_data_item->eimFqdn);
+ } else {
+ IPA_LOGP(SIPA, LERROR, "unable to allocate memory\n");
+ goto error;
+ }
+
+ rc = 0;
+error:
+ ipa_es10b_get_eim_cfg_data_free(eim_cfg_data);
+ return rc;
+}
+
+static int ipa_poll_eim_package(struct ipa_context *ctx)
{
int rc;
+ IPA_LOGP(SIPA, LINFO, "Polling eIM \"%s\"\n", ctx->eim_id);
+
/* Reset canaries */
ctx->check_scard = false;
ctx->check_http = false;
@@ -448,6 +449,94 @@
}
}
+static int ipa_poll_eim(struct ipa_context *ctx, int index)
+{
+ int rc = 0;
+
+ while (ctx->poll_running) {
+ IPA_LOGP(SIPA, LINFO, "-----------------------------8<-----------------------------\n");
+ rc = ipa_poll_eim_package(ctx);
+
+ switch (rc) {
+ case IPA_POLL_AGAIN_WHEN_ONLINE:
+ /* ipa_poll asks us to wait with the next poll cycle until we have a stable IP
+ * connection. In this example we assume that IP connectivity is always available. */
+ IPA_LOGP(SIPA, LINFO, "poll cycle continues normally (profile change)\n");
+ rc = 0;
+ break;
+ case IPA_POLL_AGAIN:
+ /* ipa_poll asks us to continue polling normally */
+ rc = 0;
+ if (ctx->cfg->one_euicc_pkg_only) {
+ IPA_LOGP(SIPA, LINFO, "forcefully stopping poll cycle upon user decision!\n");
+ goto leave;
+ } else {
+ IPA_LOGP(SIPA, LINFO, "poll cycle continues normally\n");
+ break;
+ }
+ case IPA_POLL_AGAIN_LATER:
+ /* ipa_poll tells us that we may poll less frequently, so just exit. */
+ IPA_LOGP(SIPA, LINFO, "poll cycle ends normally\n");
+ rc = 0;
+ goto leave;
+ default:
+ /* We got a negative return code from ipa_poll. This means something does not work
+ * normally. In a productive setup we would continue calling ipa_poll a few more times
+ * to see if the cause is a temporary problem. After that we would free the context
+ * using ipa_free_ctx and start over. */
+ IPA_LOGP(SIPA, LERROR, "poll cycle ends due to error (%d)\n", rc);
+ rc = -EINVAL;
+ goto leave;
+ }
+ }
+
+leave:
+ return rc;
+}
+
+/*! run the poll loop of the IPAd.
+ * \param[inout] ctx pointer to ipa_context.
+ * \returns positive on success or when polling all eIMs, negative on error (see also enum ipa_poll_rc). */
+int ipa_poll(struct ipa_context *ctx)
+{
+ int rc, index;
+
+ ctx->poll_running = true;
+
+ /* Loop through all eIM, if no preferred eIM ID is specified. */
+ for (index = 0; ; index++) {
+ IPA_LOGP(SIPA, LINFO, "-----------------------------8<-----------------------------\n");
+ rc = eim_init(ctx, index);
+ if (rc < 0) {
+ if (rc == -ENOENT) {
+ IPA_LOGP(SIPA, LINFO, "all eIMs polled!\n");
+ break;
+ }
+ IPA_LOGP(SIPA, LERROR, "eIM initialization failed!\n");
+ return rc;
+ }
+
+ rc = ipa_poll_eim(ctx, index);
+
+ if (!ctx->poll_running) {
+ IPA_LOGP(SIPA, LINFO, "polling aborted by user!\n");
+ break;
+ }
+
+ if (ctx->cfg->preferred_eim_id)
+ return rc;
+ }
+
+ return 0;
+}
+
+/*! abort IPAd polling (may be called from signal handler). */
+void ipa_abort(struct ipa_context *ctx)
+{
+ ctx->poll_running = false;
+}
+
+
/*! close connection towards the eIM.
* \param[inout] ctx pointer to ipa_context. */
void ipa_close(struct ipa_context *ctx)
diff --git a/src/ipa/main.c b/src/ipa/main.c
index bf2e386..d6902c0 100644
--- a/src/ipa/main.c
+++ b/src/ipa/main.c
@@ -35,8 +35,6 @@
OPER_GET_CONN_PARAMS,
};
-bool running = true;
-
bool prfle_inst_consent(char *sm_dp_plus_address, char *ac_token)
{
char user_input;
@@ -150,15 +148,16 @@
IPA_LOGP(SMAIN, LINFO, "saved nvstate to file %s, size: %zu\n", path, nvstate->data_len);
}
+static struct ipa_context *ctx = NULL;
+
static void sig_usr1(int signum)
{
- running = false;
+ ipa_abort(ctx);
}
int main(int argc, char **argv)
{
struct ipa_config cfg = { 0 };
- struct ipa_context *ctx = NULL;
int opt;
int rc;
enum operation operation = OPER_GET_EIM_PACKAGE;
@@ -166,7 +165,6 @@
char *getopt_nvstate_path = DEFAULT_NVSTATE_PATH;
struct ipa_buf *nvstate_load = NULL;
struct ipa_buf *nvstate_save = NULL;
- bool getopt_one_euicc_pkg_only = false;
signal(SIGUSR1, sig_usr1);
@@ -226,7 +224,7 @@
cfg.prfle_inst_consent_cb = prfle_inst_consent;
break;
case '1':
- getopt_one_euicc_pkg_only = true;
+ cfg.one_euicc_pkg_only = true;
break;
case 'D':
cfg.device_capabilities = strtoul(optarg, NULL, 0);
@@ -317,50 +315,7 @@
switch (operation) {
case OPER_GET_EIM_PACKAGE:
- IPA_LOGP(SMAIN, LINFO, "-----------------------------8<-----------------------------\n");
- rc = eim_init(ctx);
- if (rc < 0) {
- IPA_LOGP(SMAIN, LERROR, "eIM initialization failed!\n");
- rc = -EINVAL;
- goto leave;
- }
-
- while (running) {
- IPA_LOGP(SMAIN, LINFO, "-----------------------------8<-----------------------------\n");
- rc = ipa_poll(ctx);
-
- switch (rc) {
- case IPA_POLL_AGAIN_WHEN_ONLINE:
- /* ipa_poll asks us to wait with the next poll cycle until we have a stable IP
- * connection. In this example we assume that IP connectivity is always available. */
- IPA_LOGP(SMAIN, LINFO, "poll cycle continues normally (profile change)\n");
- rc = 0;
- break;
- case IPA_POLL_AGAIN:
- /* ipa_poll asks us to continue polling normally */
- rc = 0;
- if (getopt_one_euicc_pkg_only) {
- IPA_LOGP(SMAIN, LINFO, "forcefully stopping poll cycle upon user decision!\n");
- goto leave;
- } else {
- IPA_LOGP(SMAIN, LINFO, "poll cycle continues normally\n");
- break;
- }
- case IPA_POLL_AGAIN_LATER:
- /* ipa_poll tells us that we may poll less frequently, so just exit. */
- IPA_LOGP(SMAIN, LERROR, "poll cycle ends normally\n");
- rc = 0;
- goto leave;
- default:
- /* We got a negative return code from ipa_poll. This means something does not work
- * normally. In a productive setup we would continue calling ipa_poll a few more times
- * to see if the cause is a temporary problem. After that we would free the context
- * using ipa_free_ctx and start over. */
- IPA_LOGP(SMAIN, LERROR, "poll cycle ends due to error (%d)\n", rc);
- rc = -EINVAL;
- goto leave;
- }
- }
+ rc = ipa_poll(ctx);
break;
case OPER_ADD_INITIAL_EIM:
/* Load initial eIM configuration */
--
To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43653?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: onomondo-ipa
Gerrit-Branch: master
Gerrit-Change-Id: Ifcad584dd04dc83c59124ce32e60254a72537d02
Gerrit-Change-Number: 43653
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>