gerrit-log
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
September 2026
- 1 participants
- 1894 discussions
[S] Change in onomondo-ipa[master]: Add index to ipa_es10b_get_eim_cfg_data_filter
by jolly 16 Sep '26
by jolly 16 Sep '26
16 Sep '26
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>
1
0
[S] Change in onomondo-ipa[master]: Add index to ipa_es10b_get_eim_cfg_data_filter
by Jenkins Builder 16 Sep '26
by Jenkins Builder 16 Sep '26
16 Sep '26
Jenkins Builder has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43652?usp=email )
Change subject: Add index to ipa_es10b_get_eim_cfg_data_filter
......................................................................
Patch Set 1:
(4 comments)
File src/ipa/libipa/es10b_get_eim_cfg_data.c:
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/onomondo-ipa/+/43652/comment/a5428295_73ca952a… :
PS1, Line 301: return EINVAL;
return of an errno should typically be negative (ie: return -EINVAL)
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/onomondo-ipa/+/43652/comment/4912d5d1_3afe70c5… :
PS1, Line 306: return EINVAL;
return of an errno should typically be negative (ie: return -EINVAL)
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/onomondo-ipa/+/43652/comment/d91ec134_0328a276… :
PS1, Line 312: if (index >= res->res->eimConfigurationDataList.list.count) {
braces {} are not necessary for single statement blocks
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/onomondo-ipa/+/43652/comment/e7c0d4f4_c408849f… :
PS1, Line 329: return EINVAL;
return of an errno should typically be negative (ie: return -EINVAL)
--
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: comment
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>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Wed, 16 Sep 2026 14:14:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
1
0
[S] Change in onomondo-ipa[master]: Add index to ipa_es10b_get_eim_cfg_data_filter
by jolly 16 Sep '26
by jolly 16 Sep '26
16 Sep '26
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>
1
0
16 Sep '26
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>
1
0
[S] Change in osmo-ttcn3-hacks[master]: library/Misc_Helpers: Introduce API f_str_oct_split()
by pespin 16 Sep '26
by pespin 16 Sep '26
16 Sep '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43648?usp=email )
Change subject: library/Misc_Helpers: Introduce API f_str_oct_split()
......................................................................
library/Misc_Helpers: Introduce API f_str_oct_split()
Similar to existing f_str_split() but operating on octetstrings.
It uses the external f_strstr_oct() function to look up in an efficient
way.
This function will be used by HTTP2 code to split multipart data based
on boundary specified in the HTTP2 Header.
Change-Id: Ie26062bf00133d25be4b41424186484d34b18dce
---
M library/Misc_Helpers.ttcn
1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/48/43648/1
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn
index 967c8d1..917b718 100644
--- a/library/Misc_Helpers.ttcn
+++ b/library/Misc_Helpers.ttcn
@@ -134,4 +134,25 @@
return parts;
}
+/* Samem as f_str_split() but using octetstring */
+type record of octetstring ro_octetstring;
+function f_str_oct_split(octetstring str, octetstring delim := ''O) return ro_octetstring
+{
+ var integer pos := 0;
+ var ro_octetstring parts := {};
+ var integer delim_pos;
+ var integer end := lengthof(str);
+ while (pos < end) {
+ delim_pos := f_strstr_oct(str, delim, pos);
+ if (delim_pos < 0) {
+ delim_pos := end;
+ }
+ if (delim_pos > pos) {
+ parts := parts & { substr(str, pos, delim_pos - pos) };
+ }
+ pos := delim_pos + lengthof(delim);
+ }
+ return parts;
+}
+
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43648?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: Ie26062bf00133d25be4b41424186484d34b18dce
Gerrit-Change-Number: 43648
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1
0
[XS] Change in osmo-ttcn3-hacks[master]: deps/Makefile: Depend on osmo-ttcn3-openapi-generator.git to support ...
by pespin 16 Sep '26
by pespin 16 Sep '26
16 Sep '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43650?usp=email )
Change subject: deps/Makefile: Depend on osmo-ttcn3-openapi-generator.git to support 5G SBI types
......................................................................
deps/Makefile: Depend on osmo-ttcn3-openapi-generator.git to support 5G SBI types
The osmo-ttcn3-openapi-generator.git repository contains a set of .ttcn
files providing TTCN-3 types for 5G SBI interfaces, generated from
OpenAPI yaml descriptions of the related 3GPP specs.
The generated TTCN-3 code makes use of dependency
titan.ProtocolModules.JSON_v07_2006, so also import it.
The upcoming SMF_Tests patches testing 5G interfaces will make use of
these files, so make them already available.
Change-Id: I10753fde79fddcf1c64a2a8b6eb6a2e1af708081
---
M deps/Makefile
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/50/43650/1
diff --git a/deps/Makefile b/deps/Makefile
index 10c343c..ad0f260 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -21,6 +21,7 @@
titan.ProtocolModules.ICMPv6 \
titan.ProtocolModules.IP \
titan.ProtocolModules.ISUP_Q.762 \
+ titan.ProtocolModules.JSON_v07_2006 \
titan.ProtocolModules.L2TP \
titan.ProtocolModules.LLC_v7.1.0 \
titan.ProtocolModules.M3UA \
@@ -59,6 +60,7 @@
OSMOGERRIT_REPOS= osmo-uecups
OSMOGITEA_REPOS= nas \
+ osmo-ttcn3-openapi-generator \
titan.ProtocolModules.BSSMAP \
titan.ProtocolModules.MAP \
titan.TestPorts.AF_PACKET \
@@ -73,6 +75,7 @@
# Use tag names from 'git describe --tags' or commit hashes. This way we get
# exact commits of deps when doing regression testing.
nas_commit= 8915a3b55bf21349a116eb8b4395e10e38d72135
+osmo-ttcn3-openapi-generator_commit= 47a66af829eba96dbc4c145bd15270c3a8f9d086
titan.Libraries.TCCUsefulFunctions_commit= R.35.B-6-gb3687da
titan.ProtocolEmulations.M3UA_commit= a70095b9113b23d2ea2405a5775befec18dd0fe0
titan.ProtocolEmulations.SCCP_commit= 744f3eeb58d7b5bc372c9fd01db737a20bae069a
@@ -88,6 +91,7 @@
titan.ProtocolModules.ICMPv6_commit= 46f4d9b6e1e3c794294a92588401a81e4881dd27
titan.ProtocolModules.IP_commit= 1be86705f39ae38f3c04b2109806ee20d25e91d0
titan.ProtocolModules.ISUP_Q.762_commit= R.8.A-5-g42d428b
+titan.ProtocolModules.JSON_v07_2006_commit= R.2.A
titan.ProtocolModules.L2TP_commit= 17e76d3662bd0bb815158e8a9de1ec413f21b530
titan.ProtocolModules.LLC_v7.1.0_commit= 09817f113255d7fb56f1d45d3dd629a093d9248d
titan.ProtocolModules.MAP_commit= R.2.A-1-g79c6a3d
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43650?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: I10753fde79fddcf1c64a2a8b6eb6a2e1af708081
Gerrit-Change-Number: 43650
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1
0
[XL] Change in osmo-ttcn3-hacks[master]: library/HTTP2_*: Add initial HTTP2 client/server support
by pespin 16 Sep '26
by pespin 16 Sep '26
16 Sep '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43649?usp=email )
Change subject: library/HTTP2_*: Add initial HTTP2 client/server support
......................................................................
library/HTTP2_*: Add initial HTTP2 client/server support
An HTTP2 client is implemented through the HTTP2_Adapter module, while
an HTTP2 server is implemented throught the HTTP2_Server_Emulation
module.
This is just an initial working solution (already being used
clientand server side upcoming SMF_Tests 5G SBI patches), the interface
may be changes and extended in the future (eg. we may want to add some
intermediate layer using HTTP2_Message in the HTTP2_Adapter instead of
writing raw HTTP2_Send/HTTP2_Recv records.)
Change-Id: I3ab440517e925a7c402dd4055c223ef568405adc
---
M deps/Makefile
A library/HTTP2_Adapter.ttcn
A library/HTTP2_CodecPort.ttcn
A library/HTTP2_CodecPort_CtrlFunct.ttcn
A library/HTTP2_CodecPort_CtrlFunctDef.cc
A library/HTTP2_Functions.ttcn
A library/HTTP2_Server_Emulation.ttcn
A library/HTTP2_Templates.ttcn
8 files changed, 1,123 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/49/43649/1
diff --git a/deps/Makefile b/deps/Makefile
index f230577..10c343c 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -16,6 +16,7 @@
titan.ProtocolModules.GRE \
titan.ProtocolModules.GTP_v13.5.0 \
titan.ProtocolModules.GTPv2_v13.7.0 \
+ titan.ProtocolModules.HTTP2 \
titan.ProtocolModules.ICMP \
titan.ProtocolModules.ICMPv6 \
titan.ProtocolModules.IP \
@@ -82,6 +83,7 @@
titan.ProtocolModules.GRE_commit= R.2.A-5-g654c446
titan.ProtocolModules.GTP_v13.5.0_commit= 6b769f985eb91bf5a4332f29faa4a043b23ce62e
titan.ProtocolModules.GTPv2_v13.7.0_commit= R.2.A-5-g85cb124
+titan.ProtocolModules.HTTP2_commit= 297ac60099b567c8819ad349e22f185ec89a9c58
titan.ProtocolModules.ICMP_commit= e49d9fb9f7de637b4bf4803dc6b6e911a8661640
titan.ProtocolModules.ICMPv6_commit= 46f4d9b6e1e3c794294a92588401a81e4881dd27
titan.ProtocolModules.IP_commit= 1be86705f39ae38f3c04b2109806ee20d25e91d0
diff --git a/library/HTTP2_Adapter.ttcn b/library/HTTP2_Adapter.ttcn
new file mode 100644
index 0000000..7892618
--- /dev/null
+++ b/library/HTTP2_Adapter.ttcn
@@ -0,0 +1,101 @@
+module HTTP2_Adapter {
+
+/* HTTP2 Adapter component
+ * (C) 2019 by Harald Welte <laforge(a)gnumonks.org>
+ * (C) 2026 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de>
+ * All rights reserved.
+ *
+ * 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
+ *
+ */
+
+import from HTTP2_Types all;
+import from HTTP2_CodecPort all;
+import from HTTP2_CodecPort_CtrlFunct all;
+import from IPL4asp_Types all;
+import from IPL4asp_PortType all;
+import from Socket_API_Definitions all;
+
+import from HTTP2_Templates all;
+
+import from Native_Functions all;
+import from Misc_Helpers all;
+
+type component HTTP2_CT {
+ port HTTP2_CODEC_PT HTTP2;
+ /* double underscore to have "g_pars" available on components extending this one: */
+ var template (omit) HTTP2_Adapter_Params g_http2_pars;
+
+ /* Connection identifier of the client / server itself */
+ var IPL4asp_Types.ConnectionId g_self_conn_id := -1;
+};
+
+type record HTTP2_Adapter_Params {
+ charstring local_host,
+ integer local_port,
+ charstring remote_host,
+ integer remote_port,
+ boolean use_ssl
+};
+
+template (value) HTTP2_Adapter_Params
+ts_HTTP2_Adapter_Params(template (value) charstring local_host,
+ template (value) integer local_port,
+ template (value) charstring remote_host,
+ template (value) integer remote_port,
+ template (value) boolean use_ssl) := {
+ local_host := local_host,
+ local_port := local_port,
+ remote_host := remote_host,
+ remote_port := remote_port,
+ use_ssl := use_ssl
+}
+
+function f_http2_adapter_init() runs on HTTP2_CT {
+ map(self:HTTP2, system:HTTP2_CODEC_PT);
+}
+
+private function f_http2_adapter_getMsgLen(in octetstring pl_stream,
+ inout Socket_API_Definitions.ro_integer args)
+return integer {
+ var HTTP2_ro_integer args_unused := {};
+ return f_HTTP2_msglen(pl_stream, args_unused);
+}
+
+
+private function f_set_tcp_segmentation()
+runs on HTTP2_CT {
+ /* Set function for dissecting the binary stream into packets */
+ var f_IPL4_getMsgLen vl_f := refers(f_http2_adapter_getMsgLen);
+ HTTP2_CodecPort_CtrlFunct.f_IPL4_setGetMsgLen(HTTP2, g_self_conn_id, vl_f, {});
+}
+
+/* Function to use to connect as client to a remote IPA Server */
+function f_http2_adapter_connect(charstring remote_host, IPL4asp_Types.PortNumber remote_port,
+ charstring local_host, IPL4asp_Types.PortNumber local_port, boolean use_ssl := false)
+runs on HTTP2_CT {
+ var IPL4asp_Types.Result res;
+ res := HTTP2_CodecPort_CtrlFunct.f_IPL4_connect(HTTP2, remote_host, remote_port,
+ local_host, local_port, 0, { tcp:={} });
+ if (not ispresent(res.connId)) {
+ setverdict(fail, "Could not connect HTTP2 socket from ", local_host, " port ", local_port,
+ " to ", remote_host, " port ", remote_port, "; check your configuration");
+ mtc.stop;
+ }
+ g_self_conn_id := res.connId;
+ g_http2_pars := ts_HTTP2_Adapter_Params(remote_host, remote_port, local_host, local_port, use_ssl);
+
+ f_set_tcp_segmentation();
+ HTTP2.send(ts_HTTP2_Send_magic(g_self_conn_id));
+}
+
+function f_http2_adapter_send(template (value) HTTP2_Frame http2_frame)
+runs on HTTP2_CT
+{
+ HTTP2.send(ts_HTTP2_Send(g_self_conn_id, http2_frame));
+}
+
+}
diff --git a/library/HTTP2_CodecPort.ttcn b/library/HTTP2_CodecPort.ttcn
new file mode 100644
index 0000000..d36ff96
--- /dev/null
+++ b/library/HTTP2_CodecPort.ttcn
@@ -0,0 +1,108 @@
+module HTTP2_CodecPort {
+
+/* Simple HTTP2 Codec Port, translating between raw TCP octetstring payload
+ * towards the IPL4asp port provider, and HTTP2 primitives
+ * which carry the decoded HTTP2 data types as payload.
+ *
+ * (C) 2017-2018 by Harald Welte <laforge(a)gnumonks.org>
+ * All rights reserved.
+ *
+ * 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
+ */
+
+ import from IPL4asp_PortType all;
+ import from IPL4asp_Types all;
+ import from HTTP2_Types all;
+
+ type record HTTP2_Recv {
+ ConnectionId connId,
+ HTTP2_Frame frame optional,
+ HTTP2_decoder_error_descr pl_error_descr optional
+ }
+
+ template (present) HTTP2_Recv tr_HTTP2_Recv(template (present) ConnectionId connId := ?,
+ template HTTP2_Frame frame := *,
+ template HTTP2_decoder_error_descr pl_error_descr := *) := {
+ connId := connId,
+ frame := frame,
+ pl_error_descr := pl_error_descr
+ }
+
+ type record HTTP2_Send {
+ ConnectionId connId,
+ HTTP2_Frame frame
+ };
+
+ template (value) HTTP2_Send
+ ts_HTTP2_Send(template (value) ConnectionId connId,
+ template (value) HTTP2_Frame frame) := {
+ connId := connId,
+ frame := frame
+ }
+
+
+ type record HTTP2_Send_charstring {
+ ConnectionId connId,
+ charstring data
+ };
+
+ template (value) HTTP2_Send_charstring
+ ts_HTTP2_Send_charstring(template (value) ConnectionId connId,
+ template (value) charstring data) := {
+ connId := connId,
+ data := data
+ }
+
+ const charstring c_HTTP2_magic := "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
+
+ template (value) HTTP2_Send_charstring
+ ts_HTTP2_Send_magic(template (value) ConnectionId connId) :=
+ ts_HTTP2_Send_charstring(connId, c_HTTP2_magic);
+
+ private function IPL4_to_HTTP2_Recv(in ASP_RecvFrom pin, out HTTP2_Recv pout) {
+ var integer rc;
+ pout.connId := pin.connId;
+ if (lengthof(pin.msg) == lengthof(HTTP2_connection_preface) and
+ pin.msg == HTTP2_connection_preface) {
+ log(pin.connId, ": Rx HTTP2 preface");
+ pout.pl_error_descr := omit;
+ pout.frame := omit;
+ } else {
+ rc := f_HTTP2_decode_frame(pin.msg, pout.frame, pout.pl_error_descr);
+ if (rc == 0) {
+ pout.pl_error_descr := omit;
+ } else {
+ pout.frame := omit;
+ }
+ log(pin.connId, ": f_HTTP2_decode_frame(", pin.msg, ") returned ", rc);
+ }
+ } with { extension "prototype(fast)" }
+
+ private function HTTP2_to_IPL4_Send(in HTTP2_Send pin, out ASP_Send pout) {
+ pout.connId := pin.connId;
+ pout.proto := { tcp := {} };
+ pout.msg := f_HTTP2_encode_frame(pin.frame);
+ } with { extension "prototype(fast)" }
+
+ private function HTTP2_Send_charstring_to_IPL4_Send(in HTTP2_Send_charstring pin, out ASP_Send pout) {
+ pout.connId := pin.connId;
+ pout.proto := { tcp := {} };
+ pout.msg := char2oct(pin.data);
+ } with { extension "prototype(fast)" }
+
+ type port HTTP2_CODEC_PT message {
+ out HTTP2_Send, HTTP2_Send_charstring;
+ in HTTP2_Recv,
+ ASP_ConnId_ReadyToRelease,
+ ASP_Event;
+ } with { extension "user IPL4asp_PT
+ out(HTTP2_Send -> ASP_Send: function(HTTP2_to_IPL4_Send);
+ HTTP2_Send_charstring -> ASP_Send: function(HTTP2_Send_charstring_to_IPL4_Send))
+ in(ASP_RecvFrom -> HTTP2_Recv: function(IPL4_to_HTTP2_Recv);
+ ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
+ ASP_Event -> ASP_Event: simple)"
+ }
+}
diff --git a/library/HTTP2_CodecPort_CtrlFunct.ttcn b/library/HTTP2_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 0000000..c4eb3a9
--- /dev/null
+++ b/library/HTTP2_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,52 @@
+module HTTP2_CodecPort_CtrlFunct {
+
+ import from HTTP2_CodecPort all;
+ import from IPL4asp_Types all;
+
+ external function f_IPL4_listen(
+ inout HTTP2_CODEC_PT portRef,
+ in HostName locName,
+ in PortNumber locPort,
+ in ProtoTuple proto,
+ in OptionList options := {}
+ ) return Result;
+
+ external function f_IPL4_connect(
+ inout HTTP2_CODEC_PT portRef,
+ in HostName remName,
+ in PortNumber remPort,
+ in HostName locName,
+ in PortNumber locPort,
+ in ConnectionId connId,
+ in ProtoTuple proto,
+ in OptionList options := {}
+ ) return Result;
+
+ external function f_IPL4_close(
+ inout HTTP2_CODEC_PT portRef,
+ in ConnectionId id,
+ in ProtoTuple proto := { unspecified := {} }
+ ) return Result;
+
+ external function f_IPL4_setUserData(
+ inout HTTP2_CODEC_PT portRef,
+ in ConnectionId id,
+ in UserData userData
+ ) return Result;
+
+ external function f_IPL4_getUserData(
+ inout HTTP2_CODEC_PT portRef,
+ in ConnectionId id,
+ out UserData userData
+ ) return Result;
+
+ external function f_IPL4_setGetMsgLen(
+ inout HTTP2_CODEC_PT portRef,
+ in ConnectionId id,
+ inout f_IPL4_getMsgLen f,
+ in ro_integer msgLenArgs
+ );
+
+
+}
+
diff --git a/library/HTTP2_CodecPort_CtrlFunctDef.cc b/library/HTTP2_CodecPort_CtrlFunctDef.cc
new file mode 100644
index 0000000..9d35fbd
--- /dev/null
+++ b/library/HTTP2_CodecPort_CtrlFunctDef.cc
@@ -0,0 +1,66 @@
+#include "IPL4asp_PortType.hh"
+#include "HTTP2_CodecPort.hh"
+#include "IPL4asp_PT.hh"
+
+namespace HTTP2__CodecPort__CtrlFunct {
+
+ IPL4asp__Types::Result f__IPL4__listen(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::HostName& locName,
+ const IPL4asp__Types::PortNumber& locPort,
+ const IPL4asp__Types::ProtoTuple& proto,
+ const IPL4asp__Types::OptionList& options)
+ {
+ return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
+ }
+
+ IPL4asp__Types::Result f__IPL4__connect(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::HostName& remName,
+ const IPL4asp__Types::PortNumber& remPort,
+ const IPL4asp__Types::HostName& locName,
+ const IPL4asp__Types::PortNumber& locPort,
+ const IPL4asp__Types::ConnectionId& connId,
+ const IPL4asp__Types::ProtoTuple& proto,
+ const IPL4asp__Types::OptionList& options)
+ {
+ return f__IPL4__PROVIDER__connect(portRef, remName, remPort,
+ locName, locPort, connId, proto, options);
+ }
+
+ IPL4asp__Types::Result f__IPL4__close(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ const IPL4asp__Types::ProtoTuple& proto)
+ {
+ return f__IPL4__PROVIDER__close(portRef, connId, proto);
+ }
+
+ IPL4asp__Types::Result f__IPL4__setUserData(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ const IPL4asp__Types::UserData& userData)
+ {
+ return f__IPL4__PROVIDER__setUserData(portRef, connId, userData);
+ }
+
+ IPL4asp__Types::Result f__IPL4__getUserData(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ IPL4asp__Types::UserData& userData)
+ {
+ return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
+ }
+
+ void f__IPL4__setGetMsgLen(
+ HTTP2__CodecPort::HTTP2__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ Socket__API__Definitions::f__getMsgLen& f,
+ const Socket__API__Definitions::ro__integer& msgLenArgs)
+ {
+ return f__IPL4__PROVIDER__setGetMsgLen(portRef, connId, f, msgLenArgs);
+ }
+
+
+}
+
diff --git a/library/HTTP2_Functions.ttcn b/library/HTTP2_Functions.ttcn
new file mode 100644
index 0000000..95e5ea1
--- /dev/null
+++ b/library/HTTP2_Functions.ttcn
@@ -0,0 +1,32 @@
+module HTTP2_Functions {
+
+import from HTTP2_Types all;
+import from HTTP2_Templates all;
+
+import from TCCConversion_Functions all; //f_strstr()
+
+function f_HTTP2_header_list_find_header(HTTP2_header_list headers, charstring header_name)
+return template (omit) charstring {
+ for (var integer i := 0; i < lengthof(headers); i := i + 1) {
+ if (headers[i].header_name == header_name) {
+ return headers[i].header_value;
+ }
+ }
+ return omit;
+}
+
+function f_HTTP2_header_content_type_multipart_val_get_boundary(charstring content_type_val)
+return charstring {
+ var charstring boundary;
+ var integer pos := f_strstr(content_type_val, "boundary=\"", 0);
+ if (pos < 0) {
+ return "";
+ }
+ pos := pos + lengthof("boundary=\"");
+ // -1: Remove trailing "\""
+ boundary := substr(content_type_val, pos, lengthof(content_type_val) - pos - 1);
+ return boundary;
+}
+
+
+}
diff --git a/library/HTTP2_Server_Emulation.ttcn b/library/HTTP2_Server_Emulation.ttcn
new file mode 100644
index 0000000..779d7f3
--- /dev/null
+++ b/library/HTTP2_Server_Emulation.ttcn
@@ -0,0 +1,526 @@
+/* HTTP2 Emulation in TTCN-3
+ *
+ * (C) 2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ *
+ * 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
+ *
+ * This module implements a HTTP/HTTPs 2.0 server,
+ */
+
+module HTTP2_Server_Emulation {
+
+import from HTTP2_Types all;
+import from HTTP2_CodecPort all;
+import from HTTP2_CodecPort_CtrlFunct all;
+import from IPL4asp_Types all;
+import from IPL4asp_PortType all;
+import from Socket_API_Definitions all;
+
+import from HTTP2_Templates all;
+
+import from Native_Functions all;
+import from Misc_Helpers all;
+
+
+/***************
+ * HTTP2_Msg
+ **************/
+
+type record HTTP2_Msg {
+ IPL4asp_Types.ConnectionId conn_id,
+ integer stream_id,
+ HTTP2_header_block hb,
+ HTTP2_Data_frame body optional
+}
+
+template (present) HTTP2_Msg
+tr_HTTP2_Msg(template (present) IPL4asp_Types.ConnectionId conn_id := ?,
+ template (present) integer stream_id := ?,
+ template (present) HTTP2_header_block hb := ?,
+ template HTTP2_Data_frame body := *) := {
+ conn_id := conn_id,
+ stream_id := stream_id,
+ hb := hb,
+ body := body
+}
+
+template (value) HTTP2_Msg
+ts_HTTP2_Msg(template (value) IPL4asp_Types.ConnectionId conn_id,
+ template (value) integer stream_id,
+ template (value) HTTP2_header_block hb,
+ template (omit) HTTP2_Data_frame body := omit) := {
+ conn_id := conn_id,
+ stream_id := stream_id,
+ hb := hb,
+ body := body
+}
+
+template (value) HTTP2_Msg
+ts_HTTP2_Msg_Status(template (value) IPL4asp_Types.ConnectionId conn_id,
+ template (value) integer stream_id,
+ template (value) integer status,
+ template (omit) HTTP2_header_list headers := omit,
+ template (omit) HTTP2_Data_frame body := omit) :=
+ts_HTTP2_Msg(conn_id,
+ stream_id,
+ hb := ts_HTTP2_header_block(pseudo_headers := ts_HTTP2_pseudo_headers(status := status),
+ headers := headers),
+ body := body
+ );
+
+template (value) HTTP2_Msg
+ts_HTTP2_Msg_200_OK(template (value) IPL4asp_Types.ConnectionId conn_id,
+ template (value) integer stream_id,
+ template (omit) HTTP2_header_list headers := omit,
+ template (omit) HTTP2_Data_frame body := omit) :=
+ts_HTTP2_Msg_Status(conn_id, stream_id, 200, headers, body);
+
+template (value) HTTP2_Msg
+ts_HTTP2_Msg_201_Created(template (value) IPL4asp_Types.ConnectionId conn_id,
+ template (value) integer stream_id,
+ template (omit) HTTP2_header_list headers := omit,
+ template (omit) HTTP2_Data_frame body := omit) :=
+ts_HTTP2_Msg_Status(conn_id, stream_id, 201, headers, body);
+
+
+function f_HTTP2_Msg_append_hdr_content_length(inout HTTP2_Msg http2_msg)
+{
+ if (not ispresent(http2_msg.body)) {
+ return;
+ }
+ var integer content_length := lengthof(http2_msg.body.data); /* TODO: http2_msg.body.padding ? */
+ http2_msg.hb.headers := http2_msg.hb.headers &
+ { valueof(ts_HTTP2_Hdr_content_length(int2str(content_length))) };
+}
+
+/*********************
+ * HTTP2_Server_Conn
+ ********************/
+type enumerated HTTP2_Server_Conn_State {
+ HTTP2_SERVER_CONN_ST_UNUSED,
+ HTTP2_SERVER_CONN_ST_WAIT_PREFACE,
+ HTTP2_SERVER_CONN_ST_WAIT_SETTINGS,
+ HTTP2_SERVER_CONN_ST_WAIT_HEADER,
+ HTTP2_SERVER_CONN_ST_WAIT_BODY
+}
+
+/* An HTTP2 connection established against the HTTP2 Server */
+type record HTTP2_Server_Conn {
+ IPL4asp_Types.ConnectionId conn_id,
+ HTTP2_Server_Conn_State state,
+ HTTP2_header_block rx_hb optional /* Contains received header while in HTTP2_SERVER_CONN_ST_WAIT_BODY */
+}
+
+private function f_HTTP2_Server_Conn_init(inout HTTP2_Server_Conn conn)
+{
+ conn := {
+ conn_id := -1,
+ state := HTTP2_SERVER_CONN_ST_UNUSED,
+ rx_hb := omit
+ };
+}
+
+private function f_HTTP2_Server_Conn_str(in HTTP2_Server_Conn conn) return charstring {
+ return "HTTP2_Server_Conn(" & int2str(conn.conn_id) & "," & log2str(conn.state) & ")";
+}
+
+private function f_HTTP2_Server_Conn_st_change(inout HTTP2_Server_Conn conn, HTTP2_Server_Conn_State state)
+{
+ log(f_HTTP2_Server_Conn_str(conn), ": state change to ", state);
+ conn.state := state
+}
+
+private function f_HTTP2_Server_Conn_comp_decode(inout HTTP2_Server_Conn conn, octetstring header_block_fragment)
+return HTTP2_header_block
+{
+ var HTTP2_header_block pl_hblock;
+ var HTTP2_comp_context ctx;
+ var integer rc;
+
+ ctx := HTTP2_comp_context_init();
+ rc := HTTP2_comp_context_decode(ctx, pl_hblock, header_block_fragment);
+ HTTP2_comp_context_free(ctx);
+ if (rc != 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn),
+ ": HTTP2_comp_context_decode returned ", rc));
+ }
+
+ return pl_hblock;
+}
+
+private function f_HTTP2_Server_Conn_comp_encode(inout HTTP2_Server_Conn conn, HTTP2_header_block hb)
+return octetstring
+{
+ var octetstring pl_frame_data;
+ var HTTP2_comp_context ctx;
+ var integer rc;
+
+ ctx := HTTP2_comp_context_init();
+ rc := HTTP2_comp_context_encode(ctx, hb, pl_frame_data);
+ HTTP2_comp_context_free(ctx);
+ if (rc != 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn),
+ ": HTTP2_comp_context_encode returned ", rc));
+ }
+
+ return pl_frame_data;
+}
+
+/***********************************************************************
+ * Main Emulation Component (HTTP2 Server)
+ ***********************************************************************/
+
+type record Http2ServerEmulationCfg {
+ charstring http2_bind_ip,
+ integer http2_bind_port
+};
+
+type component HTTP2_Server_Emulation_CT {
+ /* Communication with underlying HTTP2 CodecPort */
+ port HTTP2_CODEC_PT HTTP2;
+
+ /* Communication with Clients */
+ port HTTP2_CONN_PT CONN;
+ port HTTP2_CONN_PROC_PT CONN_PROC;
+
+ /* Configuration by the user */
+ var Http2ServerEmulationCfg g_http2_cfg;
+
+ /* Connection identifier of the server itself */
+ var IPL4asp_Types.ConnectionId g_self_conn_id := -1;
+ var HTTP2_Server_Conn conn_table[16];
+ var HTTP2_ConnHdlr vc_ConnHdlr_table[16];
+};
+
+private function f_conn_table_init()
+runs on HTTP2_Server_Emulation_CT {
+ var integer i;
+ for (i := 0; i < sizeof(conn_table); i := i + 1) {
+ f_HTTP2_Server_Conn_init(conn_table[i]);
+ }
+}
+
+private function f_conn_table_find_by_conn_id(IPL4asp_Types.ConnectionId conn_id)
+runs on HTTP2_Server_Emulation_CT return integer {
+ var integer i;
+ for (i := 0; i < sizeof(conn_table); i := i + 1) {
+ if (conn_table[i].conn_id == conn_id) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+private function f_conn_table_find_free()
+runs on HTTP2_Server_Emulation_CT return integer {
+ return f_conn_table_find_by_conn_id(-1);
+}
+
+private function f_vc_ConnHdlr_table_add(HTTP2_ConnHdlr vc_conn)
+runs on HTTP2_Server_Emulation_CT {
+ var integer i;
+ for (i := 0; i < sizeof(vc_ConnHdlr_table); i := i + 1) {
+ if (not isbound(vc_ConnHdlr_table[i])) {
+ vc_ConnHdlr_table[i] := vc_conn;
+ return;
+ }
+ }
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("No Space in vc_ConnHdlr_table[i] for ", vc_conn));
+}
+
+private function f_http2_adapter_getMsgLen(in octetstring pl_stream,
+ inout Socket_API_Definitions.ro_integer args)
+return integer {
+ var HTTP2_ro_integer args_unused := {};
+ return f_HTTP2_msglen(pl_stream, args_unused);
+}
+
+
+private function f_set_tcp_segmentation()
+runs on HTTP2_Server_Emulation_CT {
+ /* Set function for dissecting the binary stream into packets */
+ var f_IPL4_getMsgLen vl_f := refers(f_http2_adapter_getMsgLen);
+ HTTP2_CodecPort_CtrlFunct.f_IPL4_setGetMsgLen(HTTP2, g_self_conn_id, vl_f, {});
+}
+
+/* Function to use to connect as client to a remote HTTP2 Server */
+function f_bind(charstring local_host, IPL4asp_Types.PortNumber local_port)
+runs on HTTP2_Server_Emulation_CT {
+ var IPL4asp_Types.Result res;
+ res := HTTP2_CodecPort_CtrlFunct.f_IPL4_listen(HTTP2, local_host, local_port, { tcp:={} });
+ if (not ispresent(res.connId)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Could not listen HTTP2 socket ",
+ local_host, ":", local_port,
+ ", check your configuration"));
+ }
+ g_self_conn_id := res.connId;
+}
+
+private function f_init(Http2ServerEmulationCfg cfg)
+runs on HTTP2_Server_Emulation_CT {
+
+ g_http2_cfg := cfg;
+
+ f_conn_table_init();
+
+ /* Start HTTP2 server */
+ map(self:HTTP2, system:HTTP2_CODEC_PT);
+ f_bind(g_http2_cfg.http2_bind_ip, g_http2_cfg.http2_bind_port);
+
+ f_set_tcp_segmentation();
+}
+
+/* Forward request to all registered clients */
+private function forward_http2_msg(HTTP2_Msg http2_msg)
+runs on HTTP2_Server_Emulation_CT {
+
+ for (var integer i := 0; i < sizeof(vc_ConnHdlr_table); i := i + 1) {
+ if (isbound(vc_ConnHdlr_table[i])) {
+ CONN.send(http2_msg) to vc_ConnHdlr_table[i];
+ }
+ }
+}
+
+private function f_HTTP2_Server_Conn_tx(inout HTTP2_Server_Conn conn, template (value) HTTP2_Frame http2_frame)
+runs on HTTP2_Server_Emulation_CT {
+ var HTTP2_Send http2_tx;
+ http2_tx := valueof(ts_HTTP2_Send(conn.conn_id, valueof(http2_frame)));
+ HTTP2.send(http2_tx);
+}
+
+private function f_HTTP2_Server_Conn_rx_http2(inout HTTP2_Server_Conn conn, HTTP2_Recv http2_rx)
+runs on HTTP2_Server_Emulation_CT {
+ var template (value) HTTP2_Msg http2_msg;
+ var template (value) HTTP2_Frame http2_frame;
+
+ if (ispresent(http2_rx.pl_error_descr)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx HTTP2 decode error: ", http2_rx));
+ }
+
+ select (conn.state) {
+ case (HTTP2_SERVER_CONN_ST_UNUSED) { // created
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx in unexpected state: ", http2_rx));
+ }
+ case (HTTP2_SERVER_CONN_ST_WAIT_PREFACE) {
+ /* We expect to receive an empty frame, signalled by HTTP2_Codec_port meaning the magic/preface was received. */
+ if (ispresent(http2_rx.frame) or ispresent(http2_rx.pl_error_descr)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(conn, ": Rx in unexpected state: ", http2_rx));
+ }
+ var template (value) HTTP2_Setting_list settings := {
+ ts_HTTP2_Setting_MAX_FRAME_SIZE(1048576),
+ ts_HTTP2_Setting_MAX_CONCURRENT_STREAMS(250),
+ ts_HTTP2_Setting_MAX_HEADER_LIST_SIZE(10485760),
+ ts_HTTP2_Setting_INITIAL_WINDOW_SIZE(1048576)
+ };
+ http2_frame := ts_HTTP2_Frame_Settings(settings := settings);
+ f_HTTP2_Server_Conn_tx(conn, http2_frame);
+ f_HTTP2_Server_Conn_st_change(conn, HTTP2_SERVER_CONN_ST_WAIT_SETTINGS);
+ return;
+ }
+ case (HTTP2_SERVER_CONN_ST_WAIT_SETTINGS) {
+ if (not ispresent(http2_rx.frame)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx unexpected: ", http2_rx));
+ }
+ if (not match(http2_rx.frame, tr_HTTP2_Frame_Settings())) {
+ return; /* TODO: we should only allow WINDOW_UPDATE here? */
+ }
+ /* Tx Settings ACK and Window Update: */
+ f_HTTP2_Server_Conn_tx(conn, ts_HTTP2_Frame_Settings(ack_flag := true));
+ f_HTTP2_Server_Conn_tx(conn, ts_HTTP2_Frame_Window_Update(0, 1073741824));
+ f_HTTP2_Server_Conn_st_change(conn, HTTP2_SERVER_CONN_ST_WAIT_HEADER);
+ return;
+ }
+ case (HTTP2_SERVER_CONN_ST_WAIT_HEADER) {
+ if (not ispresent(http2_rx.frame)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx unexpected: ", http2_rx));
+ }
+ if (not match(http2_rx.frame, tr_HTTP2_Frame_Header())) {
+
+ return; /* TODO: we should only allow WINDOW_UPDATE and SETTINGS here... */
+ }
+
+ var HTTP2_header_block hb;
+ hb := f_HTTP2_Server_Conn_comp_decode(conn, http2_rx.frame.header_frame.header_block_fragment);
+ /* TODO: store header in Conn or send to ConNHdlr? */
+ log(f_HTTP2_Server_Conn_str(conn), ": Decompressed header: ", hb);
+ if (not http2_rx.frame.header_frame.end_stream_flag) {
+ conn.rx_hb := hb;
+ f_HTTP2_Server_Conn_st_change(conn, HTTP2_SERVER_CONN_ST_WAIT_BODY);
+ return;
+ }
+
+ http2_msg := ts_HTTP2_Msg(conn.conn_id, http2_rx.frame.header_frame.stream_id, hb, omit);
+ forward_http2_msg(valueof(http2_msg));
+ return;
+ }
+ case (HTTP2_SERVER_CONN_ST_WAIT_BODY) {
+ if (not ispresent(http2_rx.frame)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx unexpected: ", http2_rx));
+ }
+ if (not match(http2_rx.frame, tr_HTTP2_Frame_Data())) {
+ return; /* TODO: we should only allow WINDOW_UPDATE and SETTINGS here... */
+ }
+ if (not http2_rx.frame.data_frame.end_stream_flag) {
+ log("FIXME: Multiple DATA blocks not supported! requires updating HTTP2_Msg.body to be a list!");
+ setverdict(fail);
+ }
+ http2_msg := ts_HTTP2_Msg(conn.conn_id,
+ http2_rx.frame.data_frame.stream_id,
+ conn.rx_hb,
+ http2_rx.frame.data_frame);
+ forward_http2_msg(valueof(http2_msg));
+ return;
+ }
+ case else {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str(f_HTTP2_Server_Conn_str(conn), ": Rx in unexpected state: ", http2_rx));
+ }
+ }
+}
+
+function main(Http2ServerEmulationCfg cfg)
+runs on HTTP2_Server_Emulation_CT {
+
+ var HTTP2_ConnHdlr vc_conn;
+ var ASP_Event asp_evt;
+ var HTTP2_Recv http2_rx;
+ var HTTP2_Send http2_tx;
+ var HTTP2_Msg http2_msg;
+ var template (value) HTTP2_Frame http2_frame;
+ var integer idx;
+
+ f_init(cfg);
+
+ while(true) {
+ alt {
+
+ /* server only */
+ [] HTTP2.receive(ASP_Event:{connOpened:=?}) -> value asp_evt {
+ //log("HTTP2_Server: Rx ", asp_evt);
+ log("HTTP2_Server: Established a new connection (conn_id=", asp_evt.connOpened.connId, ")");
+ idx := f_conn_table_find_by_conn_id(asp_evt.connOpened.connId);
+ if (idx >= 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Rx connOpened for already existing conn_id ",
+ asp_evt.connOpened.connId));
+ }
+ idx := f_conn_table_find_free();
+ if (idx < 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No more space in conn_table!");
+ }
+ conn_table[idx].conn_id := asp_evt.connOpened.connId;
+ f_HTTP2_Server_Conn_st_change(conn_table[idx], HTTP2_SERVER_CONN_ST_WAIT_PREFACE);
+ }
+
+ [] HTTP2.receive(ASP_Event:{connClosed:=?}) -> value asp_evt {
+ //log("HTTP2_Server: Rx ", asp_evt);
+ idx := f_conn_table_find_by_conn_id(asp_evt.connClosed.connId);
+ if (idx < 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Rx connClosed for unknown conn_id ",
+ asp_evt.connClosed.connId));
+ }
+ // TODO: Notify/Remove ConnHdlrs?
+ f_HTTP2_Server_Conn_init(conn_table[idx]);
+ }
+
+ [] HTTP2.receive(HTTP2_Recv:?) -> value http2_rx {
+ //log("HTTP2_Server: Rx ", http2_rx);
+ idx := f_conn_table_find_by_conn_id(http2_rx.connId);
+ if (idx < 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Rx HTTP2_Recv ", http2_rx, " for unknown conn_id ",
+ asp_evt.connClosed.connId));
+ }
+ f_HTTP2_Server_Conn_rx_http2(conn_table[idx], http2_rx);
+ }
+
+ [] CONN.receive(HTTP2_Msg:?) -> value http2_msg sender vc_conn {
+ //log("HTTP2_Server: Tx ", http2_msg);
+ var integer last_stream_id := http2_msg.stream_id;
+
+ idx := f_conn_table_find_by_conn_id(http2_msg.conn_id);
+ if (idx < 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Rx HTTP2_Msg ", http2_rx, " for unknown conn_id ",
+ http2_msg.conn_id));
+ }
+
+ /* Send Header: */
+ f_HTTP2_Msg_append_hdr_content_length(http2_msg);
+ var octetstring hdr_enc := f_HTTP2_Server_Conn_comp_encode(conn_table[idx], http2_msg.hb);
+ http2_frame := ts_HTTP2_Frame_Header(http2_msg.stream_id,
+ end_stream_flag := not ispresent(http2_msg.body),
+ end_header_flag := true,
+ header_block_fragment := hdr_enc);
+ f_HTTP2_Server_Conn_tx(conn_table[idx], http2_frame);
+
+ /* Send body: */
+ if (ispresent(http2_msg.body)) {
+ http2_frame := ts_HTTP2_Frame_Data(http2_msg.body.stream_id,
+ http2_msg.body.end_stream_flag,
+ http2_msg.body.data,
+ http2_msg.body.padding);
+ f_HTTP2_Server_Conn_tx(conn_table[idx], http2_frame);
+ }
+ /* Send GOAWAY since we are finished: */
+ f_HTTP2_Server_Conn_tx(conn_table[idx], ts_HTTP2_Frame_Goaway(last_stream_id, 0 /* NO_ERROR */));
+ }
+ [] CONN_PROC.getcall(HTTP2EM_register:{}) -> sender vc_conn {
+ //log("HTTP2_Server: Register ", vc_conn);
+ f_vc_ConnHdlr_table_add(vc_conn);
+ CONN_PROC.reply(HTTP2EM_register:{}) to vc_conn;
+ }
+ }
+ }
+
+}
+
+
+/***********************************************************************
+ * Interaction between Main and Client Components
+ ***********************************************************************/
+
+type port HTTP2_CONN_PT message {
+ inout HTTP2_Msg;
+} with { extension "internal" };
+
+signature HTTP2EM_register();
+
+type port HTTP2_CONN_PROC_PT procedure {
+ inout HTTP2EM_register;
+} with { extension "internal" };
+
+
+/***********************************************************************
+ * Client Component
+ ***********************************************************************/
+
+type component HTTP2_ConnHdlr {
+ /* These ports are not connected to anything in this component, they
+ * serve as connection points for the component that extends this
+ * coponent. */
+ port HTTP2_CONN_PT HTTP2_CONN[16];
+ port HTTP2_CONN_PROC_PT HTTP2_CONN_PROC[16];
+};
+
+function f_http2_server_emu_register(integer id := 0) runs on HTTP2_ConnHdlr {
+ HTTP2_CONN_PROC[id].call(HTTP2EM_register:{}) {
+ [] HTTP2_CONN_PROC[id].getreply(HTTP2EM_register:{});
+ }
+}
+
+}
diff --git a/library/HTTP2_Templates.ttcn b/library/HTTP2_Templates.ttcn
new file mode 100644
index 0000000..d6d8296
--- /dev/null
+++ b/library/HTTP2_Templates.ttcn
@@ -0,0 +1,236 @@
+module HTTP2_Templates {
+
+import from HTTP2_Types all;
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_data(template (value) integer setting_id,
+ template (value) integer setting_value) := {
+ setting_id := setting_id,
+ setting_value := setting_value
+}
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_HEADER_TABLE_SIZE(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_HEADER_TABLE_SIZE, setting_value);
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_ENABLE_PUSH(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_ENABLE_PUSH, setting_value);
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_MAX_CONCURRENT_STREAMS(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_MAX_CONCURRENT_STREAMS, setting_value);
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_INITIAL_WINDOW_SIZE(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_INITIAL_WINDOW_SIZE, setting_value);
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_MAX_FRAME_SIZE(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_MAX_FRAME_SIZE, setting_value);
+
+template (value) HTTP2_Setting_data
+ts_HTTP2_Setting_MAX_HEADER_LIST_SIZE(template (value) integer setting_value) :=
+ts_HTTP2_Setting_data(c_SETTINGS_MAX_HEADER_LIST_SIZE, setting_value);
+
+template (present) HTTP2_Data_frame
+tr_HTTP2_Data_frame(template (present) integer stream_id := ?,
+ template (present) boolean end_stream_flag := ?,
+ template (present) octetstring data := ?,
+ template octetstring padding := *) := {
+ stream_id := stream_id,
+ end_stream_flag := end_stream_flag,
+ data := data,
+ padding := padding
+}
+
+template (value) HTTP2_Data_frame
+ts_HTTP2_Data_frame(template (value) integer stream_id := 0,
+ template (value) boolean end_stream_flag := false,
+ template (value) octetstring data,
+ template (omit) octetstring padding := omit) := {
+ stream_id := stream_id,
+ end_stream_flag := end_stream_flag,
+ data := data,
+ padding := padding
+}
+
+
+template (present) HTTP2_Frame
+tr_HTTP2_Frame_Settings(template (present) boolean ack_flag := ?,
+ template HTTP2_Setting_list settings := *) := {
+ settings_frame := {
+ ack_flag := ack_flag,
+ settings := settings
+ }
+}
+
+template (value) HTTP2_Frame
+ts_HTTP2_Frame_Settings(template (value) boolean ack_flag := false,
+ template (omit) HTTP2_Setting_list settings := omit) := {
+ settings_frame := {
+ ack_flag := ack_flag,
+ settings := settings
+ }
+}
+
+template (value) HTTP2_Frame
+ts_HTTP2_Frame_Goaway(template (value) integer last_stream_id,
+ template (value) integer error_code,
+ template (omit) octetstring debug_data := omit) := {
+ goaway_frame := {
+ last_stream_id := last_stream_id,
+ error_code := error_code,
+ debug_data := debug_data
+ }
+}
+
+template (value) HTTP2_Frame
+ts_HTTP2_Frame_Window_Update(template (value) integer stream_id := 0,
+ template (value) integer window_size_increment) := {
+ window_update_frame := {
+ stream_id := stream_id,
+ window_size_increment := window_size_increment
+ }
+}
+
+template (present) HTTP2_Frame
+tr_HTTP2_Frame_Data(template (present) integer stream_id := ?,
+ template (present) boolean end_stream_flag := ?,
+ template (present) octetstring data := ?,
+ template octetstring padding := *) := {
+ data_frame := tr_HTTP2_Data_frame(stream_id,
+ end_stream_flag,
+ data,
+ padding)
+}
+
+template (value) HTTP2_Frame
+ts_HTTP2_Frame_Data(template (value) integer stream_id := 0,
+ template (value) boolean end_stream_flag := false,
+ template (value) octetstring data,
+ template (omit) octetstring padding := omit) := {
+ data_frame := ts_HTTP2_Data_frame(stream_id,
+ end_stream_flag,
+ data,
+ padding)
+}
+
+template (present) HTTP2_Frame
+tr_HTTP2_Frame_Header(template (present) integer stream_id := ?,
+ template (present) boolean end_stream_flag := ?,
+ template (present) boolean end_header_flag := ?,
+ template HTTP2_Priority_data priority_data := *,
+ template (present) octetstring header_block_fragment := ?,
+ template octetstring padding := *) := {
+ header_frame := {
+ stream_id := stream_id,
+ end_stream_flag := end_stream_flag,
+ end_header_flag := end_header_flag,
+ priority_data := priority_data,
+ header_block_fragment := header_block_fragment,
+ padding := padding
+ }
+}
+
+template (value) HTTP2_Frame
+ts_HTTP2_Frame_Header(template (value) integer stream_id := 0,
+ template (value) boolean end_stream_flag := false,
+ template (value) boolean end_header_flag := false,
+ template (omit) HTTP2_Priority_data priority_data := omit,
+ template (value) octetstring header_block_fragment := ''O,
+ template (omit) octetstring padding := omit) := {
+ header_frame := {
+ stream_id := stream_id,
+ end_stream_flag := end_stream_flag,
+ end_header_flag := end_header_flag,
+ priority_data := priority_data,
+ header_block_fragment := header_block_fragment,
+ padding := padding
+ }
+}
+
+template (present) HTTP2_pseudo_headers
+tr_HTTP2_pseudo_headers(template charstring method := *,
+ template charstring scheme := *,
+ template charstring authority := *,
+ template charstring path := *,
+ template integer status := *) := {
+ method := method,
+ scheme := scheme,
+ authority := authority,
+ path := path,
+ status := status
+}
+
+template (value) HTTP2_pseudo_headers
+ts_HTTP2_pseudo_headers(template (omit) charstring method := omit,
+ template (omit) charstring scheme := omit,
+ template (omit) charstring authority := omit,
+ template (omit) charstring path := omit,
+ template (omit) integer status := omit) := {
+ method := method,
+ scheme := scheme,
+ authority := authority,
+ path := path,
+ status := status
+}
+
+template (value) HTTP2_header_field
+ts_HTTP2_header_field(template (value) charstring header_name,
+ template (omit) charstring header_value := omit) := {
+ header_name := header_name,
+ header_value := header_value
+}
+
+const charstring c_HTTP2_HDR_content_type := "content-type";
+const charstring c_HTTP2_HDR_accept := "accept";
+const charstring c_HTTP2_HDR_user_agent := "user-agent";
+const charstring c_HTTP2_HDR_content_length := "content-length";
+const charstring c_HTTP2_HDR_accept_encoding := "accept-encoding";
+const charstring c_HTTP2_HDR_status := "status";
+const charstring c_HTTP2_HDR_location := "location";
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_content_type(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_content_type, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_accept(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_accept, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_user_agent(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_user_agent, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_content_length(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_content_length, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_accept_encoding(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_accept_encoding, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_status(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_status, header_value);
+
+template (value) HTTP2_header_field
+ts_HTTP2_Hdr_location(template (omit) charstring header_value := omit)
+:= ts_HTTP2_header_field(c_HTTP2_HDR_location, header_value);
+
+
+template (present) HTTP2_header_block
+tr_HTTP2_header_block(template HTTP2_pseudo_headers pseudo_headers := *,
+ template HTTP2_header_list headers := *) := {
+ pseudo_headers := pseudo_headers,
+ headers := headers
+}
+template (value) HTTP2_header_block
+ts_HTTP2_header_block(template (omit) HTTP2_pseudo_headers pseudo_headers := omit,
+ template (omit) HTTP2_header_list headers := omit) := {
+ pseudo_headers := pseudo_headers,
+ headers := headers
+}
+
+}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43649?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: I3ab440517e925a7c402dd4055c223ef568405adc
Gerrit-Change-Number: 43649
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1
0
16 Sep '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43651?usp=email )
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
---
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
16 files changed, 1,950 insertions(+), 394 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/51/43651/1
diff --git a/library/TS29502_Nsmf_PDUSession_Templates.ttcn b/library/TS29502_Nsmf_PDUSession_Templates.ttcn
new file mode 100644
index 0000000..e34cd10
--- /dev/null
+++ b/library/TS29502_Nsmf_PDUSession_Templates.ttcn
@@ -0,0 +1,348 @@
+module TS29502_Nsmf_PDUSession_Templates {
+
+import from TS29502_Nsmf_PDUSession all;
+
+type TS29502_Nsmf_PDUSession.SmContextCreateData.additionalHsmfSetIdList AdditionalHsmfSetIdList;
+type TS29502_Nsmf_PDUSession.SmContextCreateData.additionalSmfSetIdList AdditionalSmfSetIdList;
+type TS29502_Nsmf_PDUSession.SmContextCreateData.nrfOauth2Required NrfOauth2Required;
+
+template (value) SmContextCreateData
+ts_SmContextCreateData(
+ template (omit) TS29502_Nsmf_PDUSession.Supi supi := omit,
+ template (omit) boolean unauthenticatedSupi := omit,
+ template (omit) boolean roamingUeInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Pei pei := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Gpsi gpsi := omit,
+ template (omit) TS29502_Nsmf_PDUSession.PduSessionId pduSessionId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Dnn dnn := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Dnn selectedDnn := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Snssai sNssai := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Snssai altSnssai := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Snssai hplmnSnssai := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Snssai altHplmnSnssai := omit,
+ template (value) TS29502_Nsmf_PDUSession.NfInstanceId servingNfId,
+ template (omit) TS29502_Nsmf_PDUSession.Guami guami := omit,
+ template (omit) TS29502_Nsmf_PDUSession.ServiceName serviceName := omit,
+ template (value) TS29502_Nsmf_PDUSession.PlmnIdNid servingNetwork,
+ template (omit) RequestType requestType := omit,
+ template (omit) TS29502_Nsmf_PDUSession.RefToBinaryData n1SmMsg := omit,
+ template (value) TS29502_Nsmf_PDUSession.AccessType anType,
+ template (omit) TS29502_Nsmf_PDUSession.AccessType additionalAnType := omit,
+ template (omit) TS29502_Nsmf_PDUSession.RatType ratType := omit,
+ template (omit) TS29502_Nsmf_PDUSession.PresenceState presenceInLadn := omit,
+ template (omit) boolean perLadnDnnSnssaiInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.UserLocation ueLocation := omit,
+ template (omit) TS29502_Nsmf_PDUSession.TimeZone ueTimeZone := omit,
+ template (omit) TS29502_Nsmf_PDUSession.UserLocation addUeLocation := omit,
+ template (value) TS29502_Nsmf_PDUSession.Uri smContextStatusUri,
+ template (omit) TS29502_Nsmf_PDUSession.Uri hSmfUri := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfInstanceId hSmfId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfSetId hSmfSetId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri smfUri := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfInstanceId smfId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfSetId smfSetId := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.Uri additionalHsmfUri := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.NfInstanceId additionalHsmfId := omit,
+ template (omit) AdditionalHsmfSetIdList additionalHsmfSetIdList := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.Uri additionalSmfUri := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.NfInstanceId additionalSmfId := omit,
+ template (omit) AdditionalSmfSetIdList additionalSmfSetIdList := omit,
+ template (omit) TS29502_Nsmf_PDUSession.PduSessionId oldPduSessionId := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.PduSessionId pduSessionsActivateList := omit,
+ template (omit) EpsPdnCnxContainer ueEpsPdnConnection := omit,
+ template (omit) HoState hoState := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfInstanceId pcfId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfGroupId pcfGroupId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfSetId pcfSetId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri nrfUri := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SupportedFeatures supportedFeatures := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SupportedFeatures anchorSmfFeatures := omit,
+ template (omit) record of TS29502_Nsmf_PDUSession.SupportedFeatures additionalAnchorSmfFeatures := omit,
+ template (omit) DnnSelectionMode selMode := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SmContextCreateData.backupAmfInfo backupAmfInfo := omit,
+ template (omit) TS29502_Nsmf_PDUSession.TraceData traceData := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfGroupId udmGroupId := omit,
+ template (omit) charstring routingIndicator := omit,
+ template (omit) integer hNwPubKeyId := omit,
+ template (omit) EpsInterworkingIndication epsInterworkingInd := omit,
+ template (omit) boolean indirectForwardingFlag := omit,
+ template (omit) boolean directForwardingFlag := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NgRanTargetId targetId := omit,
+ template (omit) EpsBearerContextStatus epsBearerCtxStatus := omit,
+ template (omit) boolean cpCiotEnabled := omit,
+ template (omit) boolean cpOnlyInd := omit,
+ template (omit) boolean invokeNef := omit,
+ template (omit) boolean maRequestInd := omit,
+ template (omit) boolean maNwUpgradeInd := omit,
+ template (omit) boolean n3gPathSwitchSupportInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.RefToBinaryData n2SmInfo := omit,
+ template (omit) N2SmInfoType n2SmInfoType := omit,
+ template (omit) TS29502_Nsmf_PDUSession.RefToBinaryData n2SmInfoExt1 := omit,
+ template (omit) N2SmInfoType n2SmInfoTypeExt1 := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri smContextRef := omit,
+ template (omit) TS29502_Nsmf_PDUSession.PlmnIdNid smContextSmfPlmnId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfInstanceId smContextSmfId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfSetId smContextSmfSetId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfServiceSetId smContextSmfServiceSetId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SbiBindingLevel smContextSmfBinding := omit,
+ template (omit) UpCnxState upCnxState := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SmallDataRateStatus smallDataRateStatus := omit,
+ template (omit) TS29502_Nsmf_PDUSession.ApnRateStatus apnRateStatus := omit,
+ template (omit) boolean extendedNasSmTimerInd := omit,
+ template (omit) boolean dlDataWaitingInd := omit,
+ template (omit) DdnFailureSubs ddnFailureSubs := omit,
+ template (omit) boolean smfTransferInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.NfInstanceId oldSmfId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri oldSmContextRef := omit,
+ template (omit) TS29502_Nsmf_PDUSession.WAgfInfo wAgfInfo := omit,
+ template (omit) TS29502_Nsmf_PDUSession.TngfInfo tngfInfo := omit,
+ template (omit) TS29502_Nsmf_PDUSession.TwifInfo twifInfo := omit,
+ template (omit) boolean ranUnchangedInd := omit,
+ template (omit) boolean samePcfSelectionInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Dnai targetDnai := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri nrfManagementUri := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri nrfDiscoveryUri := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri nrfAccessTokenUri := omit,
+ template (omit) NrfOauth2Required nrfOauth2Required := omit,
+ template (omit) charstring smfBindingInfo := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SmContextCreateData.pvsInfo pvsInfo := omit,
+ template (omit) boolean onboardingInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.Uri oldPduSessionRef := omit,
+ template (omit) boolean smPolicyNotifyInd := omit,
+ template (omit) TS29502_Nsmf_PDUSession.PcfUeCallbackInfo pcfUeCallbackInfo := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SatelliteBackhaulCategory satelliteBackhaulCat := omit,
+ template (omit) boolean upipSupported := omit,
+ template (omit) boolean disasterRoamingInd := omit,
+ template (omit) boolean anchorSmfOauth2Required := omit,
+ template (omit) boolean smContextSmfOauth2Required := omit,
+ template (omit) TS29502_Nsmf_PDUSession.GeoSatelliteId geoSatelliteId := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SatelliteId servingSatelliteId := omit,
+ template (omit) boolean hrsboAllowedInd := omit,
+ template (omit) boolean estabRejectionInd := omit,
+ template (omit) EstablishmentRejectionCause estabRejectionCause := omit,
+ template (omit) boolean sliceAreaRestrictInd := omit,
+ template (omit) QosMonitoringPdSupported qosMonitoringPdSupported := omit,
+ template (omit) TS29502_Nsmf_PDUSession.SmContextCreateData.qosMonitoringPdMethods qosMonitoringPdMethods := omit,
+ template (omit) QosMonitoringCongestionSupported qosMonitoringCongestionSupported := omit,
+ template (omit) AvailBitRateMonSupported availBitRateMonSupported := omit,
+ template (omit) TS29502_Nsmf_PDUSession.UeLevelMeasurementsConfiguration ueLevelMeasConfig := omit,
+ template (omit) boolean pgwChangeInd := omit,
+ template (omit) boolean localOffloadingMgtAllowedInd := omit,
+ template (omit) boolean priorityUserInd := omit
+) := {
+ supi := supi,
+ unauthenticatedSupi := unauthenticatedSupi,
+ roamingUeInd := roamingUeInd,
+ pei := pei,
+ gpsi := gpsi,
+ pduSessionId := pduSessionId,
+ dnn := dnn,
+ selectedDnn := selectedDnn,
+ sNssai := sNssai,
+ altSnssai := altSnssai,
+ hplmnSnssai := hplmnSnssai,
+ altHplmnSnssai := altHplmnSnssai,
+ servingNfId := servingNfId,
+ guami := guami,
+ serviceName := serviceName,
+ servingNetwork := servingNetwork,
+ requestType := requestType,
+ n1SmMsg := n1SmMsg,
+ anType := anType,
+ additionalAnType := additionalAnType,
+ ratType := ratType,
+ presenceInLadn := presenceInLadn,
+ perLadnDnnSnssaiInd := perLadnDnnSnssaiInd,
+ ueLocation := ueLocation,
+ ueTimeZone := ueTimeZone,
+ addUeLocation := addUeLocation,
+ smContextStatusUri := smContextStatusUri,
+ hSmfUri := hSmfUri,
+ hSmfId := hSmfId,
+ hSmfSetId := hSmfSetId,
+ smfUri := smfUri,
+ smfId := smfId,
+ smfSetId := smfSetId,
+ additionalHsmfUri := additionalHsmfUri,
+ additionalHsmfId := additionalHsmfId,
+ additionalHsmfSetIdList := additionalHsmfSetIdList,
+ additionalSmfUri := additionalSmfUri,
+ additionalSmfId := additionalSmfId,
+ additionalSmfSetIdList := additionalSmfSetIdList,
+ oldPduSessionId := oldPduSessionId,
+ pduSessionsActivateList := pduSessionsActivateList,
+ ueEpsPdnConnection := ueEpsPdnConnection,
+ hoState := hoState,
+ pcfId := pcfId,
+ pcfGroupId := pcfGroupId,
+ pcfSetId := pcfSetId,
+ nrfUri := nrfUri,
+ supportedFeatures := supportedFeatures,
+ anchorSmfFeatures := anchorSmfFeatures,
+ additionalAnchorSmfFeatures := additionalAnchorSmfFeatures,
+ selMode := selMode,
+ backupAmfInfo := backupAmfInfo,
+ traceData := traceData,
+ udmGroupId := udmGroupId,
+ routingIndicator := routingIndicator,
+ hNwPubKeyId := hNwPubKeyId,
+ epsInterworkingInd := epsInterworkingInd,
+ indirectForwardingFlag := indirectForwardingFlag,
+ directForwardingFlag := directForwardingFlag,
+ targetId := targetId,
+ epsBearerCtxStatus := epsBearerCtxStatus,
+ cpCiotEnabled := cpCiotEnabled,
+ cpOnlyInd := cpOnlyInd,
+ invokeNef := invokeNef,
+ maRequestInd := maRequestInd,
+ maNwUpgradeInd := maNwUpgradeInd,
+ n3gPathSwitchSupportInd := n3gPathSwitchSupportInd,
+ n2SmInfo := n2SmInfo,
+ n2SmInfoType := n2SmInfoType,
+ n2SmInfoExt1 := n2SmInfoExt1,
+ n2SmInfoTypeExt1 := n2SmInfoTypeExt1,
+ smContextRef := smContextRef,
+ smContextSmfPlmnId := smContextSmfPlmnId,
+ smContextSmfId := smContextSmfId,
+ smContextSmfSetId := smContextSmfSetId,
+ smContextSmfServiceSetId := smContextSmfServiceSetId,
+ smContextSmfBinding := smContextSmfBinding,
+ upCnxState := upCnxState,
+ smallDataRateStatus := smallDataRateStatus,
+ apnRateStatus := apnRateStatus,
+ extendedNasSmTimerInd := extendedNasSmTimerInd,
+ dlDataWaitingInd := dlDataWaitingInd,
+ ddnFailureSubs := ddnFailureSubs,
+ smfTransferInd := smfTransferInd,
+ oldSmfId := oldSmfId,
+ oldSmContextRef := oldSmContextRef,
+ wAgfInfo := wAgfInfo,
+ tngfInfo := tngfInfo,
+ twifInfo := twifInfo,
+ ranUnchangedInd := ranUnchangedInd,
+ samePcfSelectionInd := samePcfSelectionInd,
+ targetDnai := targetDnai,
+ nrfManagementUri := nrfManagementUri,
+ nrfDiscoveryUri := nrfDiscoveryUri,
+ nrfAccessTokenUri := nrfAccessTokenUri,
+ nrfOauth2Required := nrfOauth2Required,
+ smfBindingInfo := smfBindingInfo,
+ pvsInfo := pvsInfo,
+ onboardingInd := onboardingInd,
+ oldPduSessionRef := oldPduSessionRef,
+ smPolicyNotifyInd := smPolicyNotifyInd,
+ pcfUeCallbackInfo := pcfUeCallbackInfo,
+ satelliteBackhaulCat := satelliteBackhaulCat,
+ upipSupported := upipSupported,
+ disasterRoamingInd := disasterRoamingInd,
+ anchorSmfOauth2Required := anchorSmfOauth2Required,
+ smContextSmfOauth2Required := smContextSmfOauth2Required,
+ geoSatelliteId := geoSatelliteId,
+ servingSatelliteId := servingSatelliteId,
+ hrsboAllowedInd := hrsboAllowedInd,
+ estabRejectionInd := estabRejectionInd,
+ estabRejectionCause := estabRejectionCause,
+ sliceAreaRestrictInd := sliceAreaRestrictInd,
+ qosMonitoringPdSupported := qosMonitoringPdSupported,
+ qosMonitoringPdMethods := qosMonitoringPdMethods,
+ qosMonitoringCongestionSupported := qosMonitoringCongestionSupported,
+ availBitRateMonSupported := availBitRateMonSupported,
+ ueLevelMeasConfig := ueLevelMeasConfig,
+ pgwChangeInd := pgwChangeInd,
+ localOffloadingMgtAllowedInd := localOffloadingMgtAllowedInd,
+ priorityUserInd := priorityUserInd
+}
+
+template (value) RefToBinaryData
+ts_RefToBinaryData(template (value) charstring contentId) := {
+ contentId := contentId
+}
+
+template (value) Snssai
+ts_Snssai(template (value) integer sst,
+ template (omit) charstring sd := omit) := {
+ sst := sst,
+ sd := sd
+}
+
+template (value) Guami
+ts_Guami(template (value) PlmnIdNid plmnId,
+ template (value) AmfId amfId) := {
+ plmnId := plmnId,
+ amfId := amfId
+}
+
+template (value) PlmnId
+ts_PlmnId(template (value) Mcc mcc,
+ template (value) Mnc mnc) := {
+ mcc := mcc,
+ mnc := mnc
+}
+
+template (value) PlmnIdNid
+ts_PlmnIdNid(template (value) Mcc mcc,
+ template (value) Mnc mnc,
+ template (omit) Nid nid := omit) := {
+ mcc := mcc,
+ mnc := mnc,
+ nid := nid
+}
+
+template (value) RatType
+ts_RatType(template (value) RatType_enum enum_val) := {
+ enum_val := enum_val
+}
+
+template (value) UserLocation
+ts_UserLocation(template (omit) EutraLocation eutraLocation := omit,
+ template (omit) NrLocation nrLocation := omit,
+ template (omit) N3gaLocation n3gaLocation := omit,
+ template (omit) UtraLocation utraLocation := omit,
+ template (omit) GeraLocation geraLocation := omit) := {
+ eutraLocation := eutraLocation,
+ nrLocation := nrLocation,
+ n3gaLocation := n3gaLocation,
+ utraLocation := utraLocation,
+ geraLocation := geraLocation
+}
+
+template (value) NrLocation
+ts_NrLocation(template (value) Tai tai,
+ template (value) Ncgi ncgi,
+ template (omit) boolean ignoreNcgi := omit,
+ template (omit) integer ageOfLocationInformation := omit,
+ template (omit) DateTime ueLocationTimestamp := omit,
+ template (omit) charstring geographicalInformation := omit,
+ template (omit) charstring geodeticInformation := omit,
+ template (omit) GlobalRanNodeId globalGnbId := omit,
+ template (omit) NtnTaiInfo ntnTaiInfo := omit) := {
+ tai := tai,
+ ncgi := ncgi,
+ ignoreNcgi := ignoreNcgi,
+ ageOfLocationInformation := ageOfLocationInformation,
+ ueLocationTimestamp := ueLocationTimestamp,
+ geographicalInformation := geographicalInformation,
+ geodeticInformation := geodeticInformation,
+ globalGnbId := globalGnbId,
+ ntnTaiInfo := ntnTaiInfo
+}
+
+template (value) Tai
+ts_Tai(template (value) PlmnId plmnId,
+ template (value) Tac tac,
+ template (omit) Nid nid := omit) := {
+ plmnId := plmnId,
+ tac := tac,
+ nid := nid
+}
+
+template (value) Ncgi
+ts_Ncgi(template (value) PlmnId plmnId,
+ template (value) NrCellId nrCellId,
+ template (omit) Nid nid := omit) := {
+ plmnId := plmnId,
+ nrCellId := nrCellId,
+ nid := nid
+}
+
+}
diff --git a/library/TS29503_Nudm_SDM_Templates.ttcn b/library/TS29503_Nudm_SDM_Templates.ttcn
new file mode 100644
index 0000000..43c85e0
--- /dev/null
+++ b/library/TS29503_Nudm_SDM_Templates.ttcn
@@ -0,0 +1,326 @@
+module TS29503_Nudm_SDM_Templates {
+
+import from TS29503_Nudm_SDM all;
+
+template (value) PduSessionType1
+ts_PduSessionType1(template (value) PduSessionType1_enum enum_val) := {
+ enum_val := enum_val
+}
+
+type TS29503_Nudm_SDM.PduSessionTypes1.allowedSessionTypes PduSessionType1List;
+template (value) PduSessionTypes1
+ts_PduSessionTypes1(template (omit) PduSessionType1 defaultSessionType := omit,
+ template (omit) PduSessionType1List allowedSessionTypes := omit) := {
+ defaultSessionType := defaultSessionType,
+ allowedSessionTypes := allowedSessionTypes
+}
+
+template (value) SscMode1
+ts_SscMode1(template (value) SscMode1_enum enum_val) := {
+ enum_val := enum_val
+}
+
+type TS29503_Nudm_SDM.SscModes1.allowedSscModes SscMode1List;
+template (value) SscModes1
+ts_SscModes1(template (value) SscMode1 defaultSscMode,
+ template (omit) SscMode1List allowedSscModes := omit) := {
+ defaultSscMode := defaultSscMode,
+ allowedSscModes := allowedSscModes
+}
+
+template (value) ArpPriorityLevel
+ts_ArpPriorityLevel(template (value) integer val) := {
+ val := val
+}
+
+template (value) PreemptionCapability
+ts_PreemptionCapability(template (value) PreemptionCapability_enum enum_val) := {
+ enum_val := enum_val
+}
+
+template (value) PreemptionVulnerability
+ts_PreemptionVulnerability(template (value) PreemptionVulnerability_enum enum_val) := {
+ enum_val := enum_val
+}
+
+template (value) Arp
+ts_Arp(template (value) ArpPriorityLevel priorityLevel,
+ template (value) PreemptionCapability preemptCap,
+ template (value) PreemptionVulnerability preemptVuln) := {
+ priorityLevel := priorityLevel,
+ preemptCap := preemptCap,
+ preemptVuln := preemptVuln
+}
+
+template (value) SubscribedDefaultQos1
+ts_SubscribedDefaultQos1(template (value) FiveQi fiveqi,
+ template (value) Arp arp,
+ template (omit) FiveQiPriorityLevel priorityLevel := omit) := {
+fiveqi := fiveqi,
+arp := arp,
+priorityLevel := priorityLevel
+}
+
+template (value) Ambr1
+ts_Ambr1(template (value) BitRate uplink,
+ template (value) BitRate downlink) := {
+ uplink := uplink,
+ downlink := downlink
+}
+
+template (value) DnnConfiguration1
+ts_DnnConfiguration1(template (value) PduSessionTypes1 pduSessionTypes,
+ template (value) SscModes1 sscModes,
+ template (omit) IwkEpsInd1 iwkEpsInd := omit,
+ template (omit) SubscribedDefaultQos1 fivegQosProfile := omit,
+ template (omit) Ambr1 sessionAmbr := omit,
+ template (omit) ThreeGppChargingCharacteristics1 threegppChargingCharacteristics := omit,
+ template (omit) DnnConfiguration1.staticIpAddress staticIpAddress := omit,
+ template (omit) UpSecurity1 upSecurity := omit,
+ template (omit) PduSessionContinuityInd1 pduSessionContinuityInd := omit,
+ template (omit) NefId1 niddNefId := omit,
+ template (omit) NiddInformation1 niddInfo := omit,
+ template (omit) boolean redundantSessionAllowed := omit,
+ template (omit) AcsInfo1 acsInfo := omit,
+ template (omit) DnnConfiguration1.ipv4FrameRouteList ipv4FrameRouteList := omit,
+ template (omit) DnnConfiguration1.ipv6FrameRouteList ipv6FrameRouteList := omit,
+ template (omit) boolean atsssAllowed := omit,
+ template (omit) boolean secondaryAuth := omit,
+ template (omit) boolean uavSecondaryAuth := omit,
+ template (omit) boolean dnAaaIpAddressAllocation := omit,
+ template (omit) IpAddress1 dnAaaAddress := omit,
+ template (omit) DnnConfiguration1.additionalDnAaaAddresses additionalDnAaaAddresses := omit,
+ template (omit) Fqdn1 dnAaaFqdn := omit,
+ template (omit) charstring iptvAccCtrlInfo := omit,
+ template (omit) IpIndex1 ipv4Index := omit,
+ template (omit) IpIndex1 ipv6Index := omit,
+ template (omit) EcsAddrConfigInfo1 ecsAddrConfigInfo := omit,
+ template (omit) DnnConfiguration1.additionalEcsAddrConfigInfos additionalEcsAddrConfigInfos := omit,
+ template (omit) SharedDataId1 sharedEcsAddrConfigInfo := omit,
+ template (omit) DnnConfiguration1.additionalSharedEcsAddrConfigInfoIds additionalSharedEcsAddrConfigInfoIds := omit,
+ template (omit) boolean easDiscoveryAuthorized := omit,
+ template (omit) boolean onboardingInd := omit,
+ template (omit) AerialUeIndication1 aerialUeInd := omit,
+ template (omit) integer subscribedMaxIpv6PrefixSize := omit,
+ template (omit) boolean hrSboAuthorized := omit,
+ template (omit) DnnConfiguration1.requiredUpfFunctionList requiredUpfFunctionList := omit,
+ template (omit) DnnConfiguration1.prefUpfFunctionList prefUpfFunctionList := omit,
+ template (omit) DnnConfiguration1.vlanTagAllowed vlanTagAllowed := omit,
+ template (omit) DnnConfiguration1.vlanTagHandlingInfo vlanTagHandlingInfo := omit,
+ template (omit) boolean localOffloadingMngtInd := omit
+) := {
+ pduSessionTypes := pduSessionTypes,
+ sscModes := sscModes,
+ iwkEpsInd := iwkEpsInd,
+ fivegQosProfile := fivegQosProfile,
+ sessionAmbr := sessionAmbr,
+ threegppChargingCharacteristics := threegppChargingCharacteristics,
+ staticIpAddress := staticIpAddress,
+ upSecurity := upSecurity,
+ pduSessionContinuityInd := pduSessionContinuityInd,
+ niddNefId := niddNefId,
+ niddInfo := niddInfo,
+ redundantSessionAllowed := redundantSessionAllowed,
+ acsInfo := acsInfo,
+ ipv4FrameRouteList := ipv4FrameRouteList,
+ ipv6FrameRouteList := ipv6FrameRouteList,
+ atsssAllowed := atsssAllowed,
+ secondaryAuth := secondaryAuth,
+ uavSecondaryAuth := uavSecondaryAuth,
+ dnAaaIpAddressAllocation := dnAaaIpAddressAllocation,
+ dnAaaAddress := dnAaaAddress,
+ additionalDnAaaAddresses := additionalDnAaaAddresses,
+ dnAaaFqdn := dnAaaFqdn,
+ iptvAccCtrlInfo := iptvAccCtrlInfo,
+ ipv4Index := ipv4Index,
+ ipv6Index := ipv6Index,
+ ecsAddrConfigInfo := ecsAddrConfigInfo,
+ additionalEcsAddrConfigInfos := additionalEcsAddrConfigInfos,
+ sharedEcsAddrConfigInfo := sharedEcsAddrConfigInfo,
+ additionalSharedEcsAddrConfigInfoIds := additionalSharedEcsAddrConfigInfoIds,
+ easDiscoveryAuthorized := easDiscoveryAuthorized,
+ onboardingInd := onboardingInd,
+ aerialUeInd := aerialUeInd,
+ subscribedMaxIpv6PrefixSize := subscribedMaxIpv6PrefixSize,
+ hrSboAuthorized := hrSboAuthorized,
+ requiredUpfFunctionList := requiredUpfFunctionList,
+ prefUpfFunctionList := prefUpfFunctionList,
+ vlanTagAllowed := vlanTagAllowed,
+ vlanTagHandlingInfo := vlanTagHandlingInfo,
+ localOffloadingMngtInd := localOffloadingMngtInd
+}
+
+
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.dnnConfigurations DnnConfigurationMap;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.sharedVnGroupDataIds SharedVnGroupDataIdMap;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.odbExemptedDnnData OdbExemptedDnnDataMap;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.expectedUeBehavioursList ExpectedUeBehavioursMap;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.expectedUeBehaviourData ExpectedUeBehaviourDataMap;
+//type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.expectedUeBehaviourData.additionalProperties ExpectedUeBehaviourData1Map;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.appSpecificExpectedUeBehaviourData AppSpecificExpectedUeBehaviourDataMap;
+//type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.appSpecificExpectedUeBehaviourData.additionalProperties AppSpecificExpectedUeBehaviourData1Map;
+type TS29503_Nudm_SDM.SessionManagementSubscriptionData1.suggestedPacketNumDlList SuggestedPacketNumDlMap;
+
+template (value) SessionManagementSubscriptionData1
+ts_SessionManagementSubscriptionData1(template (value) Snssai1 singleNssai,
+ template (omit) DnnConfigurationMap dnnConfigurations := omit,
+ template (omit) record of GroupId1 internalGroupIds := omit,
+ template (omit) SharedVnGroupDataIdMap sharedVnGroupDataIds := omit,
+ template (omit) SharedDataId1 sharedDnnConfigurationsId := omit,
+ template (omit) OdbPacketServices1 odbPacketServices := omit,
+ template (omit) OdbExemptedDnnDataMap odbExemptedDnnData := omit,
+ template (omit) TraceData1 traceData := omit,
+ template (omit) SharedDataId1 sharedTraceDataId := omit,
+ template (omit) ExpectedUeBehavioursMap expectedUeBehavioursList := omit,
+ template (omit) ExpectedUeBehaviourDataMap expectedUeBehaviourData := omit,
+ template (omit) AppSpecificExpectedUeBehaviourDataMap appSpecificExpectedUeBehaviourData := omit,
+ template (omit) SuggestedPacketNumDlMap suggestedPacketNumDlList := omit,
+ template (omit) ThreeGppChargingCharacteristics1 threegppChargingCharacteristics := omit,
+ template (omit) NfGroupId1 chfGroupId := omit,
+ template (omit) NsacAdmissionMode1 nsacMode := omit,
+ template (omit) DurationSec1 sessInactTimer := omit,
+ template (omit) SupportedFeatures1 supportedFeatures := omit,
+ template (omit) record of SharedDataId1 additionalSharedDnnConfigurationsIds := omit,
+ template (omit) UeLevelMeasurementsConfiguration1 ueLevelMeasConfig := omit) := {
+ singleNssai := singleNssai,
+ dnnConfigurations := dnnConfigurations,
+ internalGroupIds := internalGroupIds,
+ sharedVnGroupDataIds := sharedVnGroupDataIds,
+ sharedDnnConfigurationsId := sharedDnnConfigurationsId,
+ odbPacketServices := odbPacketServices,
+ odbExemptedDnnData := odbExemptedDnnData,
+ traceData := traceData,
+ sharedTraceDataId := sharedTraceDataId,
+ expectedUeBehavioursList := expectedUeBehavioursList,
+ expectedUeBehaviourData := expectedUeBehaviourData,
+ appSpecificExpectedUeBehaviourData := appSpecificExpectedUeBehaviourData,
+ suggestedPacketNumDlList := suggestedPacketNumDlList,
+ threegppChargingCharacteristics := threegppChargingCharacteristics,
+ chfGroupId := chfGroupId,
+ nsacMode := nsacMode,
+ sessInactTimer := sessInactTimer,
+ supportedFeatures := supportedFeatures,
+ additionalSharedDnnConfigurationsIds := additionalSharedDnnConfigurationsIds,
+ ueLevelMeasConfig := ueLevelMeasConfig
+}
+
+type TS29503_Nudm_SDM.SmSubsData1.field1 SessionManagementSubscriptionData1List;
+template (value) SmSubsData1
+ts_SmSubsData1(template (value) SessionManagementSubscriptionData1List field1) := {
+ field1 := field1
+}
+
+type TS29503_Nudm_SDM.SdmSubscription1.expectedUeBehaviourThresholds ExpectedUeBehaviourThresholdsMap;
+template (present) SdmSubscription1
+tr_SdmSubscription1(template (present) NfInstanceId1 nfInstanceId := ?,
+ template boolean implicitUnsubscribe := *,
+ template DateTime1 expires := *,
+ template (present) Uri1 callbackReference := ?,
+ template ServiceName1 amfServiceName := *,
+ template (present) SdmSubscription1.monitoredResourceUris monitoredResourceUris := ?,
+ template Snssai1 singleNssai := *,
+ template Dnn1 dnn := *,
+ template charstring subscriptionId := *,
+ template PlmnId1 plmnId := *,
+ template boolean immediateReport := *,
+ template ImmediateReport1 report := *,
+ template SupportedFeatures1 supportedFeatures := *,
+ template ContextInfo1 contextInfo := *,
+ template boolean nfChangeFilter := *,
+ template boolean uniqueSubscription := *,
+ template SdmSubscription1.resetIds resetIds := *,
+ template UeContextInSmfDataSubFilter1 ueConSmfDataSubFilter := *,
+ template SdmSubscription1.adjacentPlmns adjacentPlmns := *,
+ template boolean disasterRoamingInd := *,
+ template Uri1 dataRestorationCallbackUri := *,
+ template boolean udrRestartInd := *,
+ template DateTime1 lastSynchronizationTime := *,
+ template ExpectedUeBehaviourThresholdsMap expectedUeBehaviourThresholds := *,
+ template Guami1 guami := *) := {
+ nfInstanceId := nfInstanceId,
+ implicitUnsubscribe := implicitUnsubscribe,
+ expires := expires,
+ callbackReference := callbackReference,
+ amfServiceName := amfServiceName,
+ monitoredResourceUris := monitoredResourceUris,
+ singleNssai := singleNssai,
+ dnn := dnn,
+ subscriptionId := subscriptionId,
+ plmnId := plmnId,
+ immediateReport := immediateReport,
+ report := report,
+ supportedFeatures := supportedFeatures,
+ contextInfo := contextInfo,
+ nfChangeFilter := nfChangeFilter,
+ uniqueSubscription := uniqueSubscription,
+ resetIds := resetIds,
+ ueConSmfDataSubFilter := ueConSmfDataSubFilter,
+ adjacentPlmns := adjacentPlmns,
+ disasterRoamingInd := disasterRoamingInd,
+ dataRestorationCallbackUri := dataRestorationCallbackUri,
+ udrRestartInd := udrRestartInd,
+ lastSynchronizationTime := lastSynchronizationTime,
+ expectedUeBehaviourThresholds := expectedUeBehaviourThresholds,
+ guami := guami
+}
+template (value) SdmSubscription1
+ts_SdmSubscription1(template (value) NfInstanceId1 nfInstanceId,
+ template (omit) boolean implicitUnsubscribe := omit,
+ template (omit) DateTime1 expires := omit,
+ template (value) Uri1 callbackReference,
+ template (omit) ServiceName1 amfServiceName := omit,
+ template (value) SdmSubscription1.monitoredResourceUris monitoredResourceUris,
+ template (omit) Snssai1 singleNssai := omit,
+ template (omit) Dnn1 dnn := omit,
+ template (omit) charstring subscriptionId := omit,
+ template (omit) PlmnId1 plmnId := omit,
+ template (omit) boolean immediateReport := omit,
+ template (omit) ImmediateReport1 report := omit,
+ template (omit) SupportedFeatures1 supportedFeatures := omit,
+ template (omit) ContextInfo1 contextInfo := omit,
+ template (omit) boolean nfChangeFilter := omit,
+ template (omit) boolean uniqueSubscription := omit,
+ template (omit) SdmSubscription1.resetIds resetIds := omit,
+ template (omit) UeContextInSmfDataSubFilter1 ueConSmfDataSubFilter := omit,
+ template (omit) SdmSubscription1.adjacentPlmns adjacentPlmns := omit,
+ template (omit) boolean disasterRoamingInd := omit,
+ template (omit) Uri1 dataRestorationCallbackUri := omit,
+ template (omit) boolean udrRestartInd := omit,
+ template (omit) DateTime1 lastSynchronizationTime := omit,
+ template (omit) ExpectedUeBehaviourThresholdsMap expectedUeBehaviourThresholds := omit,
+ template (omit) Guami1 guami := omit) := {
+ nfInstanceId := nfInstanceId,
+ implicitUnsubscribe := implicitUnsubscribe,
+ expires := expires,
+ callbackReference := callbackReference,
+ amfServiceName := amfServiceName,
+ monitoredResourceUris := monitoredResourceUris,
+ singleNssai := singleNssai,
+ dnn := dnn,
+ subscriptionId := subscriptionId,
+ plmnId := plmnId,
+ immediateReport := immediateReport,
+ report := report,
+ supportedFeatures := supportedFeatures,
+ contextInfo := contextInfo,
+ nfChangeFilter := nfChangeFilter,
+ uniqueSubscription := uniqueSubscription,
+ resetIds := resetIds,
+ ueConSmfDataSubFilter := ueConSmfDataSubFilter,
+ adjacentPlmns := adjacentPlmns,
+ disasterRoamingInd := disasterRoamingInd,
+ dataRestorationCallbackUri := dataRestorationCallbackUri,
+ udrRestartInd := udrRestartInd,
+ lastSynchronizationTime := lastSynchronizationTime,
+ expectedUeBehaviourThresholds := expectedUeBehaviourThresholds,
+ guami := guami
+}
+
+template (value) Snssai1
+ts_Snssai1(template (value) integer sst,
+ template (omit) charstring sd := omit) := {
+ sst := sst,
+ sd := sd
+}
+
+}
diff --git a/library/TS29512_Npcf_SMPolicyControl_Templates.ttcn b/library/TS29512_Npcf_SMPolicyControl_Templates.ttcn
new file mode 100644
index 0000000..4e12839
--- /dev/null
+++ b/library/TS29512_Npcf_SMPolicyControl_Templates.ttcn
@@ -0,0 +1,223 @@
+module TS29512_Npcf_SMPolicyControl_Templates {
+
+import from TS29512_Npcf_SMPolicyControl all;
+
+template (present) SmPolicyContextData1
+tr_SmPolicyContextData1(template AccNetChId1 accNetChId := *,
+ template AccNetChargingAddress1 chargEntityAddr := *,
+ template Gpsi1 gpsi := *,
+ template (present) Supi1 supi := ?,
+ template boolean invalidSupi := *,
+ template record of GroupId1 interGrpIds := *,
+ template (present) PduSessionId1 pduSessionId := ?,
+ template (present) PduSessionType1 pduSessionType := ?,
+ template charstring chargingcharacteristics := *,
+ template (present) Dnn1 dnn := ?,
+ template DnnSelectionMode1 dnnSelMode := *,
+ template (present) Uri1 notificationUri := ?,
+ template AccessType1 accessType := *,
+ template RatType1 ratType := *,
+ template AdditionalAccessInfo1 addAccessInfo := *,
+ template PlmnIdNid1 servingNetwork := *,
+ template UserLocation1 userLocationInfo := *,
+ template TimeZone1 ueTimeZone := *,
+ template Pei1 pei := *,
+ template Ipv4Addr1 ipv4Address := *,
+ template Ipv6Prefix1 ipv6AddressPrefix := *,
+ template charstring ipDomain := *,
+ template Ambr1 subsSessAmbr := *,
+ template charstring authProfIndex := *,
+ template SubscribedDefaultQos1 subsDefQos := *,
+ template VplmnQos1 vplmnQos := *,
+ template integer numOfPackFilter := *,
+ template boolean online := *,
+ template boolean offline := *,
+ template boolean threegppPsDataOffStatus := *,
+ template boolean refQosIndication := *,
+ template TraceData1 traceReq := *,
+ template (present) Snssai1 sliceInfo := ?,
+ template Snssai1 altSliceInfo := *,
+ template QosFlowUsage1 qosFlowUsage := *,
+ template ServingNfIdentity1 servNfId := *,
+ template SupportedFeatures1 suppFeat := *,
+ template NfInstanceId1 smfId := *,
+ template DateTime1 recoveryTime := *,
+ template MaPduIndication1 maPduInd := *,
+ template AtsssCapability1 atsssCapab := *,
+ template SmPolicyContextData1.atsssCapabs atsssCapabs := *,
+ template SmPolicyContextData1.ipv4FrameRouteList ipv4FrameRouteList := *,
+ template SmPolicyContextData1.ipv6FrameRouteList ipv6FrameRouteList := *,
+ template SatelliteBackhaulCategory1 satBackhaulCategory := *,
+ template PcfUeCallbackInfo1 pcfUeInfo := *,
+ template SmPolicyContextData1.pvsInfo pvsInfo := *,
+ template boolean onboardInd := *,
+ template SmPolicyContextData1.nwdafDatas nwdafDatas := *,
+ template UrspEnforcementInfo1 urspEnfInfo := *,
+ template SscMode1 sscMode := *,
+ template Dnn1 ueReqDnn := *,
+ template PduSessionType1 ueReqPduSessionType := *,
+ template boolean hrsboInd := *,
+ template boolean locOffloadInd := *,
+ template UePolicyTransferFailureCause1 uePolFailReport := *,
+ template boolean urspProvSuppInd := *,
+ template boolean mpxMediaInd := *,
+ template SmPolicyContextData1.trafficDescriptors trafficDescriptors := *
+) := {
+ accNetChId := accNetChId,
+ chargEntityAddr := chargEntityAddr,
+ gpsi := gpsi,
+ supi := supi,
+ invalidSupi := invalidSupi,
+ interGrpIds := interGrpIds,
+ pduSessionId := pduSessionId,
+ pduSessionType := pduSessionType,
+ chargingcharacteristics := chargingcharacteristics,
+ dnn := dnn,
+ dnnSelMode := dnnSelMode,
+ notificationUri := notificationUri,
+ accessType := accessType,
+ ratType := ratType,
+ addAccessInfo := addAccessInfo,
+ servingNetwork := servingNetwork,
+ userLocationInfo := userLocationInfo,
+ ueTimeZone := ueTimeZone,
+ pei := pei,
+ ipv4Address := ipv4Address,
+ ipv6AddressPrefix := ipv6AddressPrefix,
+ ipDomain := ipDomain,
+ subsSessAmbr := subsSessAmbr,
+ authProfIndex := authProfIndex,
+ subsDefQos := subsDefQos,
+ vplmnQos := vplmnQos,
+ numOfPackFilter := numOfPackFilter,
+ online := online,
+ offline := offline,
+ threegppPsDataOffStatus := threegppPsDataOffStatus,
+ refQosIndication := refQosIndication,
+ traceReq := traceReq,
+ sliceInfo := sliceInfo,
+ altSliceInfo := altSliceInfo,
+ qosFlowUsage := qosFlowUsage,
+ servNfId := servNfId,
+ suppFeat := suppFeat,
+ smfId := smfId,
+ recoveryTime := recoveryTime,
+ maPduInd := maPduInd,
+ atsssCapab := atsssCapab,
+ atsssCapabs := atsssCapabs,
+ ipv4FrameRouteList := ipv4FrameRouteList,
+ ipv6FrameRouteList := ipv6FrameRouteList,
+ satBackhaulCategory := satBackhaulCategory,
+ pcfUeInfo := pcfUeInfo,
+ pvsInfo := pvsInfo,
+ onboardInd := onboardInd,
+ nwdafDatas := nwdafDatas,
+ urspEnfInfo := urspEnfInfo,
+ sscMode := sscMode,
+ ueReqDnn := ueReqDnn,
+ ueReqPduSessionType := ueReqPduSessionType,
+ hrsboInd := hrsboInd,
+ locOffloadInd := locOffloadInd,
+ uePolFailReport := uePolFailReport,
+ urspProvSuppInd := urspProvSuppInd,
+ mpxMediaInd := mpxMediaInd,
+ trafficDescriptors := trafficDescriptors
+}
+
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.sessRules SessRulesMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.pccRules PccRulesNullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.qosDecs QosDecsMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.chgDecs ChgDecsNullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.traffContDecs TraffContDecsMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.umDecs UmDecsNullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.qosChars QosCharsMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.qosMonDecs QosMonDecsNullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.conds ConditionData1NullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.policyCtrlReqTriggers PolicyCtrlReqTriggersMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.praInfos PresenceInfoRm1NullableMap;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.vplmnOffloadInfos VplmnOffloadingInfo1Map;
+type TS29512_Npcf_SMPolicyControl.SmPolicyDecision1.locOffloadInfos LocalOffloadingManagementInfo1Map;
+
+template (value) SmPolicyDecision1
+ts_SmPolicyDecision1(template (omit) SessRulesMap sessRules := omit,
+ template (omit) PccRulesNullableMap pccRules := omit,
+ template (omit) boolean pcscfRestIndication := omit,
+ template (omit) QosDecsMap qosDecs := omit,
+ template (omit) ChgDecsNullableMap chgDecs := omit,
+ template (omit) ChargingInformation1 chargingInfo := omit,
+ template (omit) NfGroupId1 chfGroupId := omit,
+ template (omit) TraffContDecsMap traffContDecs := omit,
+ template (omit) UmDecsNullableMap umDecs := omit,
+ template (omit) QosCharsMap qosChars := omit,
+ template (omit) QosMonDecsNullableMap qosMonDecs := omit,
+ template (omit) DurationSec1 reflectiveQoSTimer := omit,
+ template (omit) ConditionData1NullableMap conds := omit,
+ template (omit) DateTime1 revalidationTime := omit,
+ template (omit) boolean offline := omit,
+ template (omit) boolean online := omit,
+ template (omit) boolean offlineChOnly := omit,
+ template (omit) PolicyCtrlReqTriggersMap policyCtrlReqTriggers := omit,
+ template (omit) SmPolicyDecision1.lastReqRuleData lastReqRuleData := omit,
+ template (omit) RequestedUsageData1 lastReqUsageData := omit,
+ template (omit) PresenceInfoRm1NullableMap praInfos := omit,
+ template (omit) IpIndex1 ipv4Index := omit,
+ template (omit) IpIndex1 ipv6Index := omit,
+ template (omit) QosFlowUsage1 qosFlowUsage := omit,
+ template (omit) SmPolicyDecision1.qosMonCapRepoTypes qosMonCapRepoTypes := omit,
+ template (omit) SmPolicyAssociationReleaseCause1 relCause := omit,
+ template (omit) SupportedFeatures1 suppFeat := omit,
+ template (omit) BridgeManagementContainer1 tsnBridgeManCont := omit,
+ template (omit) PortManagementContainer1 tsnPortManContDstt := omit,
+ template (omit) SmPolicyDecision1.tsnPortManContNwtts tsnPortManContNwtts := omit,
+ template (omit) Uri1 tscNotifUri := omit,
+ template (omit) charstring tscNotifCorreId := omit,
+ template (omit) boolean redSessIndication := omit,
+ template (omit) UePolicyContainer1 uePolCont := omit,
+ template (omit) SliceUsgCtrlInfo1 sliceUsgCtrlInfo := omit,
+ template (omit) VplmnOffloadingInfo1Map vplmnOffloadInfos := omit,
+ template (omit) LocalOffloadingManagementInfo1Map locOffloadInfos := omit,
+ template (omit) VplmnDlAmbr1 vplmnDlAmbr := omit,
+ template (omit) PcSessionRecoveryStatus1 sessionRecovStatus:= omit
+) := {
+ sessRules := sessRules,
+ pccRules := pccRules,
+ pcscfRestIndication := pcscfRestIndication,
+ qosDecs := qosDecs,
+ chgDecs := chgDecs,
+ chargingInfo := chargingInfo,
+ chfGroupId := chfGroupId,
+ traffContDecs := traffContDecs,
+ umDecs := umDecs,
+ qosChars := qosChars,
+ qosMonDecs := qosMonDecs,
+ reflectiveQoSTimer := reflectiveQoSTimer,
+ conds := conds,
+ revalidationTime := revalidationTime,
+ offline := offline,
+ online := online,
+ offlineChOnly := offlineChOnly,
+ policyCtrlReqTriggers := policyCtrlReqTriggers,
+ lastReqRuleData := lastReqRuleData,
+ lastReqUsageData := lastReqUsageData,
+ praInfos := praInfos,
+ ipv4Index := ipv4Index,
+ ipv6Index := ipv6Index,
+ qosFlowUsage := qosFlowUsage,
+ qosMonCapRepoTypes := qosMonCapRepoTypes,
+ relCause := relCause,
+ suppFeat := suppFeat,
+ tsnBridgeManCont := tsnBridgeManCont,
+ tsnPortManContDstt := tsnPortManContDstt,
+ tsnPortManContNwtts := tsnPortManContNwtts,
+ tscNotifUri := tscNotifUri,
+ tscNotifCorreId := tscNotifCorreId,
+ redSessIndication := redSessIndication,
+ uePolCont := uePolCont,
+ sliceUsgCtrlInfo := sliceUsgCtrlInfo,
+ vplmnOffloadInfos := vplmnOffloadInfos,
+ locOffloadInfos := locOffloadInfos,
+ vplmnDlAmbr := vplmnDlAmbr,
+ sessionRecovStatus := sessionRecovStatus
+ }
+
+}
diff --git a/library/TS29518_Namf_Communication_Templates.ttcn b/library/TS29518_Namf_Communication_Templates.ttcn
new file mode 100644
index 0000000..acba933
--- /dev/null
+++ b/library/TS29518_Namf_Communication_Templates.ttcn
@@ -0,0 +1,65 @@
+module TS29518_Namf_Communication_Templates {
+
+import from TS29518_Namf_Communication all;
+
+
+template (present) N1N2MessageTransferReqData
+tr_N1N2MessageTransferReqData(template (omit) N1MessageContainer n1MessageContainer := omit,
+ template (omit) N2InfoContainer n2InfoContainer := omit,
+ template (omit) RefToBinaryData mtData := omit,
+ template (omit) boolean skipInd := omit,
+ template (omit) boolean lastMsgIndication := omit,
+ template (omit) PduSessionId pduSessionId := omit,
+ template (omit) CorrelationID lcsCorrelationId := omit,
+ template (omit) LMFIdentification servingLMFIdentification := omit,
+ template (omit) Ppi ppi := omit,
+ template (omit) Arp arp := omit,
+ template (omit) FiveQi fiveqi := omit,
+ template (omit) Uri n1n2FailureTxfNotifURI := omit,
+ template (omit) boolean smfReallocationInd := omit,
+ template (omit) AreaOfValidity areaOfValidity := omit,
+ template (omit) SupportedFeatures supportedFeatures := omit,
+ template (omit) Guami oldGuami := omit,
+ template (omit) boolean maAcceptedInd := omit,
+ template (omit) boolean extBufSupport := omit,
+ template (omit) AccessType targetAccess := omit,
+ template (omit) NfInstanceId nfId := omit,
+ template (omit) boolean pruInd := omit,
+ template (omit) PduSessionPriority pduSessionPrio := omit) := {
+ n1MessageContainer := n1MessageContainer,
+ n2InfoContainer := n2InfoContainer,
+ mtData := mtData,
+ skipInd := skipInd,
+ lastMsgIndication := lastMsgIndication,
+ pduSessionId := pduSessionId,
+ lcsCorrelationId := lcsCorrelationId,
+ servingLMFIdentification := servingLMFIdentification,
+ ppi := ppi,
+ arp := arp,
+ fiveqi := fiveqi,
+ n1n2FailureTxfNotifURI := n1n2FailureTxfNotifURI,
+ smfReallocationInd := smfReallocationInd,
+ areaOfValidity := areaOfValidity,
+ supportedFeatures := supportedFeatures,
+ oldGuami := oldGuami,
+ maAcceptedInd := maAcceptedInd,
+ extBufSupport := extBufSupport,
+ targetAccess := targetAccess,
+ nfId := nfId,
+ pruInd := pruInd,
+ pduSessionPrio:= pduSessionPrio
+}
+
+template (value) N1N2MessageTransferCause
+ts_N1N2MessageTransferCause(N1N2MessageTransferCause_enum enum_val) := {
+ enum_val := enum_val
+}
+
+template (value) N1N2MessageTransferRspData
+ts_N1N2MessageTransferRspData(template (value) N1N2MessageTransferCause cause,
+ template (omit) SupportedFeatures supportedFeatures := omit) := {
+ cause := cause,
+ supportedFeatures := supportedFeatures
+}
+
+}
diff --git a/library/TS29571_CommonData_Templates.ttcn b/library/TS29571_CommonData_Templates.ttcn
new file mode 100644
index 0000000..7accd38
--- /dev/null
+++ b/library/TS29571_CommonData_Templates.ttcn
@@ -0,0 +1,14 @@
+module TS29571_CommonData_Templates {
+
+import from TS29571_CommonData all;
+
+template (value) PlmnIdNid
+ts_PlmnIdNid(template (value) Mcc mcc,
+ template (value) Mnc mnc,
+ template (omit) Nid nid := omit) := {
+ mcc := mcc,
+ mnc := mnc,
+ nid := nid
+}
+
+}
diff --git a/smf/README.md b/smf/README.md
index 716c38e..0dfee3a 100644
--- a/smf/README.md
+++ b/smf/README.md
@@ -13,13 +13,18 @@
rankdir=LR;
ATS [label="ATS\nSMF_Tests.ttcn"];
SMF [label="AMF\open5gs-smfd",shape="box"];
- NRF [label="SMF\nopen5gs-nrfd"];
- ATS -> SMF [label="N11"];
- ATS -> SMF [label="N4"];
- ATS -> SMF [label="Gx"];
- ATS -> SMF [label="Gy"];
- ATS -> SMF [label="S6b"];
- SMF -> NRF [label="SBI"];
+ ATS -> SMF [dir="both",label="N4 (PFCP)"];
+ ATS -> SMF [dir="both",label="Gx (Diameter)"];
+ ATS -> SMF [dir="both",label="Gy (Diameter)"];
+ ATS -> SMF [dir="both",label="S6b (Diameter)"];
+ #4G:
+ ATS -> SMF [label="S5/S8 (GTPv2C)"];
+ ATS -> SMF [label="S2b (GTPv2C)"];
+ # 5G:
+ ATS -> SMF [label="Nsmf (SBI)"];
+ SMF -> ATS [label="Namf (SBI, over SCP)"];
+ SMF -> ATS [label="Nudm (SBI, over SCP)"];
+ SMF -> ATS [label="Npcf (SBI, over SCP)"];
}
%}
diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn
index 6114167..11e9f3a 100644
--- a/smf/SMF_Session_CT.ttcn
+++ b/smf/SMF_Session_CT.ttcn
@@ -9,19 +9,12 @@
import from Misc_Helpers all;
import from GTPv1U_Emulation all;
-
import from GTPv2_Types all;
import from GTPv2_Templates all;
import from GTPv2_Emulation all;
-import from DNS_Helpers all;
-
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
-import from DIAMETER_ts29_212_Templates all;
-import from DIAMETER_ts29_272_Templates all;
-import from DIAMETER_ts29_273_Templates all;
-import from DIAMETER_ts32_299_Templates all;
import from DIAMETER_Emulation all;
import from PFCP_Types all;
@@ -31,18 +24,20 @@
import from NTP_Functions all;
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
import from Mutex all;
+import from SMF_Session_CT_4G all;
+import from SMF_Session_CT_5G all;
import from SMF_Tests all;
-const integer DIA_Gx := 0;
-const integer DIA_Gy := 1;
-const integer DIA_S6b := 2;
-
const OCT8 c_SEID0 := '0000000000000000'O;
/* per-session component; we typically have 1..N per testcase */
-type component SMF_Session_CT extends GTP2_ConnHdlr, GTP1U_ConnHdlr, DIAMETER_ConnHdlr, PFCP_ConnHdlr, MutexCT {
+type component SMF_Session_CT extends GTP2_ConnHdlr, GTP1U_ConnHdlr, DIAMETER_ConnHdlr,
+ PFCP_ConnHdlr, MutexCT, HTTP2_CT, HTTP2_ConnHdlr {
var SessionPars g_pars;
/* GTP-U IPv4 address remote sie */
@@ -58,6 +53,14 @@
var PDU_DIAMETER g_rx_gy;
}
+type record SessionParsGy {
+ /* In seconds. 0 => disabled, !0 => grant over CC-Time period */
+ integer validity_time,
+
+ /* Result-Code to use when sending Gy CCA, usually DIAMETER_SUCCESS */
+ DIAMETER_Resultcode cca_res_code
+};
+
type record BearerConfig {
/* EPS Bearer ID */
uint4_t ebi optional,
@@ -67,14 +70,6 @@
OCT4 teid_remote optional
};
-type record SessionParsGy {
- /* In seconds. 0 => disabled, !0 => grant over CC-Time period */
- integer validity_time,
-
- /* Result-Code to use when sending Gy CCA, usually DIAMETER_SUCCESS */
- DIAMETER_Resultcode cca_res_code
-};
-
type record FTeids {
F_TEID local,
F_TEID remote optional
@@ -160,6 +155,7 @@
/* configuration data for a given Session */
type record SessionPars {
hexstring imsi,
+ charstring imsi_str,
hexstring msisdn optional,
// serving network
GTP2C_RAT_Type rat_type,
@@ -195,6 +191,7 @@
GTP2C_PDN_Type pdn_type := GTP2C_PDN_IPv4,
template (value) PfcpParameters pfcp_pars := f_t_PfcpParams(1)) := {
imsi := imsi,
+ imsi_str := f_dec_TBCD(imsi_hex2oct(imsi)),
msisdn := msisdn,
rat_type := rat_type,
apn := apn,
@@ -223,364 +220,12 @@
runs on SMF_Session_CT {
g_pars := valueof(pars);
- if (DIAMETER_PROC[DIA_Gx].checkstate("Connected")) {
- f_diameter_expect_imsi(g_pars.imsi, idx := DIA_Gx);
- }
+ f_handler_init_4G();
+ f_handler_init_5G();
- if (DIAMETER_PROC[DIA_Gy].checkstate("Connected")) {
- f_diameter_expect_imsi(g_pars.imsi, idx := DIA_Gy);
- }
-
- if (DIAMETER_PROC[DIA_S6b].checkstate("Connected")) {
- f_diameter_expect_imsi(g_pars.imsi, idx := DIA_S6b);
- }
-
- /* allocate + register TEI{C,D} on local side */
- g_pars.teic_local := f_gtp2_allocate_teic();
- g_pars.bearer.teid_local := f_gtp1u_allocate_teid();
fn.apply();
}
-/* S6b emulation (AAA-Server) */
-private altstep as_DIA_S6b_AAR() runs on SMF_Session_CT {
- var PDU_DIAMETER rx_dia;
- [] DIAMETER[DIA_S6b].receive(tr_DIA_S6b_AAR()) -> value rx_dia {
- var template (value) PDU_DIAMETER tx_dia;
- tx_dia := f_ts_DIA_S6b_AAA(rx_dia,
- "aaa." & mp_diam_realm,
- mp_diam_realm,
- mp_diam_realm);
- DIAMETER[DIA_S6b].send(tx_dia);
- setverdict(pass);
- }
- [] DIAMETER[DIA_S6b].receive(PDU_DIAMETER:?) -> value rx_dia {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Received unexpected DIAMETER ", rx_dia));
- }
-}
-
-/* Gx emulation (PCRF)*/
-altstep as_DIA_Gx_CCR(DCC_NONE_CC_Request_Type req_type) runs on SMF_Session_CT {
- var PDU_DIAMETER rx_dia;
- [] DIAMETER[DIA_Gx].receive(tr_DIA_Gx_CCR(req_type := req_type)) -> value rx_dia {
- var template (value) PDU_DIAMETER tx_dia := f_ts_DIA_Gx_CCA(rx_dia);
- DIAMETER[DIA_Gx].send(tx_dia);
- }
- [] DIAMETER[DIA_Gx].receive(PDU_DIAMETER:?) -> value rx_dia {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Received unexpected DIAMETER ", rx_dia));
- }
-}
-
-/* Gy emulation (OCS) */
-private function f_tr_DIA_Gy_CCR_sess(DCC_NONE_CC_Request_Type req_type)
-runs on SMF_Session_CT return template (present) PDU_DIAMETER
-{
- var octetstring imsi := char2oct(f_dec_TBCD(imsi_hex2oct(g_pars.imsi)));
- var octetstring rat_type := int2oct(enum2int(g_pars.rat_type), 1);
- var OCT1 nsapi := int2oct(g_pars.bearer.ebi, 1);
- var OCT4 charging_char := char2oct(oct2str('0000'O)); // f_s5s8_create_session() uses hardcoded chg_car := '0000'O
- var template (present) octetstring msisdn := ?;
- var charstring smf_origin_host := "smf." & mp_diam_realm;
- var octetstring sgsn_addr := f_inet_addr(mp_pcrf_local_ip);
- var octetstring ggsn_addr := f_inet_addr(mp_smf_hostname);
-
- return DIAMETER_ts32_299_Templates.f_tr_DIA_Gy_CCR(req_type,
- imsi,
- msisdn,
- rat_type,
- nsapi,
- charging_char,
- smf_origin_host,
- mp_diam_realm,
- sgsn_addr,
- ggsn_addr);
-
-}
-
-altstep as_DIA_Gy_CCR(DCC_NONE_CC_Request_Type req_type)
-runs on SMF_Session_CT {
- [] DIAMETER[DIA_Gy].receive(f_tr_DIA_Gy_CCR_sess(req_type := req_type)) -> value g_rx_gy {
- var template (value) PDU_DIAMETER tx_dia;
- var template (omit) integer validity_time := omit;
- if (g_pars.gy.validity_time > 0) {
- validity_time := g_pars.gy.validity_time;
- }
- tx_dia := DIAMETER_ts32_299_Templates.f_ts_DIA_Gy_CCA(g_rx_gy, g_pars.gy.cca_res_code, validity_time);
- DIAMETER[DIA_Gy].send(tx_dia);
- }
- [] DIAMETER[DIA_Gy].receive(PDU_DIAMETER:?) -> value g_rx_gy {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Received unexpected DIAMETER Gy", g_rx_gy));
- }
-}
-
-/* GTPv2C */
-private function is_s2b_iface() runs on SMF_Session_CT return boolean {
- return (g_pars.rat_type == GTP2C_RAT_WLAN or g_pars.rat_type == GTP2C_RAT_Virtual);
-}
-
-private function f_perform_ipv6_slaac() runs on SMF_Session_CT
-{
- //var UECUPS_IPv6SLAACInd ipv6slaac_ind;
- //var template (value) UECUPS_IPv6SLAAC ipv6slaac;
- //ipv6slaac := ts_UECUPS_IPv6SLAAC(
- // local_gtp_ep := ts_UECUPS_SockAddr(f_inet_addr(mp_local_hostname_u)),
- // rx_teid := oct2int(g_pars.bearer.teid_local)
- //);
- //f_gtp1u_ipv6_slaac(ipv6slaac);
- //GTP1U[0].receive(UECUPS_IPv6SLAACInd:?) -> value ipv6slaac_ind;
- //log("5GC assigned IPv6 global prefix: ", ipv6slaac_ind.ipv6_prefix, " -> ", f_inet6_ntoa(ipv6slaac_ind.ipv6_prefix & '0000000000000000'O));
-
- ///* Use the first global IPv6 address in the IPv6 prefix picked by osmo-uecups: */
- //g_ip6_addr := ipv6slaac_ind.ipv6_user_addr;
- //log("Using IPv6 global address: ", g_ip6_addr);
-}
-
-/* process one to-be-created bearer context */
-private function process_bctx_create(BearerContextGrouped bctx) runs on SMF_Session_CT
-{
- g_pars.bearer.ebi := bctx.bearerContextIEs.ePS_Bearer_ID.ePS_Bearer_ID_Value;
- /* FIXME: Cause */
-
- var integer exp_fteid_if_type;
- var BIT4 exp_fteid_instance;
- if (is_s2b_iface()) {
- exp_fteid_if_type := 33;
- exp_fteid_instance := '0100'B;
- } else {
- exp_fteid_if_type := 5;
- exp_fteid_instance := '0010'B;
- }
-
- /* find F-TEID of the P-GW U side */
- var FullyQualifiedTEID rx_fteid;
- rx_fteid := valueof(f_GTP2C_find_teid(bctx.bearerContextIEs.fullyQualifiedTEID,
- exp_fteid_if_type, exp_fteid_instance));
- g_pars.bearer.teid_remote := rx_fteid.tEID_GRE_Key;
- if (rx_fteid.v4_Flag == '1'B) {
- g_gtpu4_remote := rx_fteid.iPv4_Address;
- }
- if (rx_fteid.v6_Flag == '1'B) {
- g_gtpu6_remote := rx_fteid.iPv6_Address;
- }
-
- if (g_pars.pdn_type == GTP2C_PDN_IPv6 or
- g_pars.pdn_type == GTP2C_PDN_IPv4v6) {
- f_perform_ipv6_slaac();
- }
-}
-
-/* create a session on the SMF */
-private function f_create_session(template (value) FullyQualifiedTEID fteid_c_ie,
- template (value) FullyQualifiedTEID fteid_u_ie,
- template (omit) UserLocationInfo uli_ie := omit,
- template (omit) APCO apco := omit,
- template APCO exp_apco := *) runs on SMF_Session_CT {
- var PDU_GTPCv2 rx;
-
- /* Defaults used for s5/s8: */
- var boolean do_s6b := false;
- var template APN_Restriction apn_restriction := ?;
- /* Change behavior when on S2b: */
- if (is_s2b_iface()) {
- do_s6b := true;
- apn_restriction := omit;
- }
-
- var template (value) PDU_GTPCv2 g2c :=
- ts_GTP2C_CreateSessionReq(imsi := g_pars.imsi,
- msisdn := g_pars.msisdn,
- rat_type := enum2int(g_pars.rat_type),
- sender_fteid := fteid_c_ie,
- apn := f_enc_dns_hostname(g_pars.apn),
- pdn_type := int2bit(enum2int(g_pars.pdn_type), 3),
- teid_list := { fteid_u_ie },
- chg_car := '0000'O,
- bearer_id := g_pars.bearer.ebi,
- uli := uli_ie,
- apco := apco);
- g2c.gtpcv2_pdu.createSessionRequest.servingNetwork := ts_GTP2C_ServingNetwork('001'H, '01F'H);
-
- /////////// START MUTUAL EXCLUSION ZONE ////////////
- /* This code block cannot be executed by more than one component at a time because
- * the RANAP RAB Ass Request triggers the IUT to send PFCP Session Establishment
- * Request PDU(s), which needs to be routed to the respective ConnHdlr component (us).
- * As per 3GPP TS 29.244, section 7.2.2.4.2, these PFCP PDUs shall all have SEID=0,
- * so that the PFCPEM component cannot route them unambiguously. This is why we
- * need to ensure that only one ConnHdlr is triggering PFCP session establishment
- * at the given moment of time. */
- f_Mutex_lock(__BFILE__, __LINE__);
- /* Subscribe for PFCP Session Establishment Request PDU(s), which are
- * expected to have SEID set to 0, as per 3GPP TS 29.244, section 7.2.2.4.2. */
- f_PFCPEM_subscribe_seid(c_SEID0);
-
- GTP2.send(g2c);
- if (do_s6b and DIAMETER[DIA_S6b].checkstate("Connected")) {
- as_DIA_S6b_AAR();
- }
- if (DIAMETER[DIA_Gx].checkstate("Connected")) {
- as_DIA_Gx_CCR(INITIAL_REQUEST);
- }
- /* FIXME: When on S2b interface, SMF is not using the Gy interface, unknown reason. */
- if (DIAMETER[DIA_Gy].checkstate("Connected")) {
- as_DIA_Gy_CCR(INITIAL_REQUEST);
- }
-
- /* Expect PFCP Session Establishment Request. */
- as_pfcp_sess_est_req();
- /* Ask PFCPEM to route PDUs with to be indicated F-SEID to us. */
- f_PFCPEM_subscribe_seid(g_pars.pfcp_pars.local_f_seid.seid);
- /* We're done establishing PFCP sessions, so at this point we no longer expect to
- * receive Session Establishment Request PDUs with SEID=0. Unregister and unlock
- * the mutex, enabling other components to establish PFCP sessions after us. */
- f_PFCPEM_unsubscribe_seid(c_SEID0);
- f_Mutex_unlock(__BFILE__, __LINE__);
- /////////// END MUTUAL EXCLUSION ZONE ////////////
-
- alt {
- [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid := g_pars.teic_local,
- cause := Request_accepted,
- apn_restriction := apn_restriction,
- exp_apco := exp_apco)) -> value rx {
- /* extract TEIDs */
- var CreateSessionResponse resp := rx.gtpcv2_pdu.createSessionResponse;
- g_pars.teic_remote := resp.fullyQualifiedTEID[0].tEID_GRE_Key;
-
- /* extract allocated address[es] */
- var PDN_Address_and_Prefix paa := resp.pDN_AddressAllocation.pDN_Address_and_Prefix;
- if (ischosen(paa.iPv4_Address)) {
- g_ip4_addr := paa.iPv4_Address;
- log("SMF assigned UE IPv4 address: ", f_inet_ntoa(g_ip4_addr));
- } else if (ischosen(paa.iPv6_Address)) {
- if (paa.iPv6_Address.prefixLength != 64) {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Got IPv6 Prefix Length ",
- paa.iPv6_Address.prefixLength, " vs exp 64"));
- }
- g_ip6_interface_id := substr(paa.iPv6_Address.iPv6_Address, 8, 8);
- log("SMF assigned IPv6 Interface Id: ", g_ip6_interface_id);
- g_ip6_addr := 'FE80000000000000'O & g_ip6_interface_id;
- log("SMF assigned IPv6 link-local Address: ", f_inet6_ntoa(g_ip6_addr));
- } else if (ischosen(paa.iPv4_IPv6)) {
- if (paa.iPv4_IPv6.prefixLength != 64) {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Got IPv6 Prefix Length ",
- paa.iPv4_IPv6.prefixLength, " vs exp 64"));
- }
- g_ip4_addr := paa.iPv4_IPv6.iPv4_Address;
- log("SMF assigned UE IPv4 address: ", f_inet_ntoa(g_ip4_addr));
- g_ip6_interface_id := substr(paa.iPv4_IPv6.iPv6_Address, 8, 8);
- log("SMF assigned IPv6 Interface Id: ", g_ip6_interface_id);
- g_ip6_addr := 'FE80000000000000'O & g_ip6_interface_id;
- log("SMF assigned IPv6 link-local Address: ", f_inet6_ntoa(g_ip6_addr));
- }
- var integer i;
- for (i := 0; i < lengthof(resp.bearerContextGrouped); i := i+1) {
- var BearerContextGrouped bctx := resp.bearerContextGrouped[i];
- select (bctx.instance) {
- case ('0000'B) { // created
- process_bctx_create(bctx);
- }
- case ('0001'B) { // removed
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- "We don't expect removed bearer contexts yet");
- }
- }
- }
- }
- [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_pars.teic_local, cause:=?)) -> value rx {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- log2str("Unexpected CreateSessionResp(cause=",
- rx.gtpcv2_pdu.createSessionResponse.cause.causeValue, ")"));
- }
- [] GTP2.receive {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- "Unexpected GTPv2 while waiting for CreateSessionResp");
- }
- }
-
-}
-
-/* create a session on the SMF on a S5/S8 interface (from SGW )*/
-function f_s5s8_create_session() runs on SMF_Session_CT {
- var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
- var template (value) UserLocationInfo uli_ie;
-
- fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0,
- f_inet_addr(mp_local_hostname_c), omit);
- fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPU, g_pars.bearer.teid_local, 2,
- f_inet_addr(mp_local_hostname_u), omit);
-
-
- /* open5gs up to 1.2.3 won't accept it without ULI, despite not mandatory */
- var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O };
- var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 };
- uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi);
-
- f_create_session(fteid_c_ie, fteid_u_ie, uli_ie);
-
-}
-
-/* create a session on the SMF on a S2b interface (from ePDG)*/
-function f_s2b_create_session(template (omit) APCO apco := omit,
- template APCO exp_apco := *) runs on SMF_Session_CT {
- var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
- var template (value) UserLocationInfo uli_ie;
-
- fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S2b_ePDG_GTPC, g_pars.teic_local, 0,
- f_inet_addr(mp_local_hostname_c), omit);
- fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S2bU_ePDG_GTPU, g_pars.bearer.teid_local, 5,
- f_inet_addr(mp_local_hostname_u), omit);
-
- var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O };
- var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 };
- uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi);
-
- f_create_session(fteid_c_ie, fteid_u_ie, uli_ie := uli_ie, apco := apco, exp_apco := exp_apco);
-
-}
-
-/* delete the session from the SMF */
-function f_delete_session(template (omit) GTP2C_Cause tx_cause := omit,
- template (present) GTP2C_Cause exp_cause,
- boolean expect_pfcp := true,
- boolean expect_diameter := true) runs on SMF_Session_CT {
- var template (value) FullyQualifiedTEID fteid_c_ie
- fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0,
- f_inet_addr(mp_local_hostname_c), omit);
- var template PDU_GTPCv2 g2c :=
- ts_GTP2C_DeleteSessionReq(d_teid := g_pars.teic_remote, cause := tx_cause,
- sender_fteid := fteid_c_ie,
- teid_list := {}, bearer_id := g_pars.bearer.ebi);
-
- GTP2.send(g2c);
-
- if (expect_pfcp) {
- as_pfcp_sess_del_req();
- }
-
- if (DIAMETER[DIA_Gx].checkstate("Connected") and expect_diameter) {
- as_DIA_Gx_CCR(TERMINATION_REQUEST);
- }
- if (DIAMETER[DIA_Gy].checkstate("Connected") and expect_diameter) {
- as_DIA_Gy_CCR(TERMINATION_REQUEST);
- }
- alt {
- [] GTP2.receive(tr_GTP2C_DeleteSessionResp(d_teid := g_pars.teic_local, cause := exp_cause)) {
- setverdict(pass);
- }
- [] GTP2.receive(tr_GTP2C_DeleteSessionResp(?, ?)) {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- "Unexpected DeleteSessionResp");
- }
- [] GTP2.receive {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
- "Unexpected GTPv2 while waiting for DeleteSessionResp");
- }
- }
-}
-
/*******
* PFCP
*******/
@@ -674,7 +319,7 @@
return tr_PFCP_Session_Est_Req(create_urr := create_urr);
}
-private altstep as_pfcp_sess_est_req()
+altstep as_pfcp_sess_est_req()
runs on SMF_Session_CT {
var template (present) PDU_PFCP exp_req := f_Session_tr_PFCP_Session_Est_Req();
var PDU_PFCP req;
diff --git a/smf/SMF_Session_CT_4G.ttcn b/smf/SMF_Session_CT_4G.ttcn
new file mode 100644
index 0000000..06a7e37
--- /dev/null
+++ b/smf/SMF_Session_CT_4G.ttcn
@@ -0,0 +1,399 @@
+module SMF_Session_CT_4G {
+
+import from TCCEncoding_Functions all;
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from Native_Functions all;
+import from Misc_Helpers all;
+
+import from GTPv1U_Emulation all;
+
+import from GTPv2_Types all;
+import from GTPv2_Templates all;
+import from GTPv2_Emulation all;
+
+import from DNS_Helpers all;
+
+import from DIAMETER_Types all;
+import from DIAMETER_Templates all;
+import from DIAMETER_ts29_212_Templates all;
+import from DIAMETER_ts29_272_Templates all;
+import from DIAMETER_ts29_273_Templates all;
+import from DIAMETER_ts32_299_Templates all;
+import from DIAMETER_Emulation all;
+
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
+import from PFCP_Emulation all;
+import from Mutex all;
+
+import from SMF_Session_CT all;
+import from SMF_Tests all;
+
+const integer DIA_Gx := 0;
+const integer DIA_Gy := 1;
+const integer DIA_S6b := 2;
+
+function f_handler_init_4G()
+runs on SMF_Session_CT {
+
+ if (DIAMETER_PROC[DIA_Gx].checkstate("Connected")) {
+ f_diameter_expect_imsi(g_pars.imsi, idx := DIA_Gx);
+ }
+
+ if (DIAMETER_PROC[DIA_Gy].checkstate("Connected")) {
+ f_diameter_expect_imsi(g_pars.imsi, idx := DIA_Gy);
+ }
+
+ if (DIAMETER_PROC[DIA_S6b].checkstate("Connected")) {
+ f_diameter_expect_imsi(g_pars.imsi, idx := DIA_S6b);
+ }
+
+ /* allocate + register TEI{C,D} on local side */
+ g_pars.teic_local := f_gtp2_allocate_teic();
+ g_pars.bearer.teid_local := f_gtp1u_allocate_teid();
+}
+
+/* S6b emulation (AAA-Server) */
+private altstep as_DIA_S6b_AAR() runs on SMF_Session_CT {
+ var PDU_DIAMETER rx_dia;
+ [] DIAMETER[DIA_S6b].receive(tr_DIA_S6b_AAR()) -> value rx_dia {
+ var template (value) PDU_DIAMETER tx_dia;
+ tx_dia := f_ts_DIA_S6b_AAA(rx_dia,
+ "aaa." & mp_diam_realm,
+ mp_diam_realm,
+ mp_diam_realm);
+ DIAMETER[DIA_S6b].send(tx_dia);
+ setverdict(pass);
+ }
+ [] DIAMETER[DIA_S6b].receive(PDU_DIAMETER:?) -> value rx_dia {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Received unexpected DIAMETER ", rx_dia));
+ }
+}
+
+/* Gx emulation (PCRF)*/
+altstep as_DIA_Gx_CCR(DCC_NONE_CC_Request_Type req_type) runs on SMF_Session_CT {
+ var PDU_DIAMETER rx_dia;
+ [] DIAMETER[DIA_Gx].receive(tr_DIA_Gx_CCR(req_type := req_type)) -> value rx_dia {
+ var template (value) PDU_DIAMETER tx_dia := f_ts_DIA_Gx_CCA(rx_dia);
+ DIAMETER[DIA_Gx].send(tx_dia);
+ }
+ [] DIAMETER[DIA_Gx].receive(PDU_DIAMETER:?) -> value rx_dia {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Received unexpected DIAMETER ", rx_dia));
+ }
+}
+
+/* Gy emulation (OCS) */
+private function f_tr_DIA_Gy_CCR_sess(DCC_NONE_CC_Request_Type req_type)
+runs on SMF_Session_CT return template (present) PDU_DIAMETER
+{
+ var octetstring imsi := char2oct(f_dec_TBCD(imsi_hex2oct(g_pars.imsi)));
+ var octetstring rat_type := int2oct(enum2int(g_pars.rat_type), 1);
+ var OCT1 nsapi := int2oct(g_pars.bearer.ebi, 1);
+ var OCT4 charging_char := char2oct(oct2str('0000'O)); // f_s5s8_create_session() uses hardcoded chg_car := '0000'O
+ var template (present) octetstring msisdn := ?;
+ var charstring smf_origin_host := "smf." & mp_diam_realm;
+ var octetstring sgsn_addr := f_inet_addr(mp_pcrf_local_ip);
+ var octetstring ggsn_addr := f_inet_addr(mp_smf_hostname);
+
+ return DIAMETER_ts32_299_Templates.f_tr_DIA_Gy_CCR(req_type,
+ imsi,
+ msisdn,
+ rat_type,
+ nsapi,
+ charging_char,
+ smf_origin_host,
+ mp_diam_realm,
+ sgsn_addr,
+ ggsn_addr);
+
+}
+
+altstep as_DIA_Gy_CCR(DCC_NONE_CC_Request_Type req_type)
+runs on SMF_Session_CT {
+ [] DIAMETER[DIA_Gy].receive(f_tr_DIA_Gy_CCR_sess(req_type := req_type)) -> value g_rx_gy {
+ var template (value) PDU_DIAMETER tx_dia;
+ var template (omit) integer validity_time := omit;
+ if (g_pars.gy.validity_time > 0) {
+ validity_time := g_pars.gy.validity_time;
+ }
+ tx_dia := DIAMETER_ts32_299_Templates.f_ts_DIA_Gy_CCA(g_rx_gy, g_pars.gy.cca_res_code, validity_time);
+ DIAMETER[DIA_Gy].send(tx_dia);
+ }
+ [] DIAMETER[DIA_Gy].receive(PDU_DIAMETER:?) -> value g_rx_gy {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Received unexpected DIAMETER Gy", g_rx_gy));
+ }
+}
+
+/* GTPv2C */
+private function is_s2b_iface() runs on SMF_Session_CT return boolean {
+ return (g_pars.rat_type == GTP2C_RAT_WLAN or g_pars.rat_type == GTP2C_RAT_Virtual);
+}
+
+private function f_perform_ipv6_slaac() runs on SMF_Session_CT
+{
+ //var UECUPS_IPv6SLAACInd ipv6slaac_ind;
+ //var template (value) UECUPS_IPv6SLAAC ipv6slaac;
+ //ipv6slaac := ts_UECUPS_IPv6SLAAC(
+ // local_gtp_ep := ts_UECUPS_SockAddr(f_inet_addr(mp_local_hostname_u)),
+ // rx_teid := oct2int(g_pars.bearer.teid_local)
+ //);
+ //f_gtp1u_ipv6_slaac(ipv6slaac);
+ //GTP1U[0].receive(UECUPS_IPv6SLAACInd:?) -> value ipv6slaac_ind;
+ //log("5GC assigned IPv6 global prefix: ", ipv6slaac_ind.ipv6_prefix, " -> ", f_inet6_ntoa(ipv6slaac_ind.ipv6_prefix & '0000000000000000'O));
+
+ ///* Use the first global IPv6 address in the IPv6 prefix picked by osmo-uecups: */
+ //g_ip6_addr := ipv6slaac_ind.ipv6_user_addr;
+ //log("Using IPv6 global address: ", g_ip6_addr);
+}
+
+/* process one to-be-created bearer context */
+private function process_bctx_create(BearerContextGrouped bctx) runs on SMF_Session_CT
+{
+ g_pars.bearer.ebi := bctx.bearerContextIEs.ePS_Bearer_ID.ePS_Bearer_ID_Value;
+ /* FIXME: Cause */
+
+ var integer exp_fteid_if_type;
+ var BIT4 exp_fteid_instance;
+ if (is_s2b_iface()) {
+ exp_fteid_if_type := 33;
+ exp_fteid_instance := '0100'B;
+ } else {
+ exp_fteid_if_type := 5;
+ exp_fteid_instance := '0010'B;
+ }
+
+ /* find F-TEID of the P-GW U side */
+ var FullyQualifiedTEID rx_fteid;
+ rx_fteid := valueof(f_GTP2C_find_teid(bctx.bearerContextIEs.fullyQualifiedTEID,
+ exp_fteid_if_type, exp_fteid_instance));
+ g_pars.bearer.teid_remote := rx_fteid.tEID_GRE_Key;
+ if (rx_fteid.v4_Flag == '1'B) {
+ g_gtpu4_remote := rx_fteid.iPv4_Address;
+ }
+ if (rx_fteid.v6_Flag == '1'B) {
+ g_gtpu6_remote := rx_fteid.iPv6_Address;
+ }
+
+ if (g_pars.pdn_type == GTP2C_PDN_IPv6 or
+ g_pars.pdn_type == GTP2C_PDN_IPv4v6) {
+ f_perform_ipv6_slaac();
+ }
+}
+
+/* create a session on the SMF */
+private function f_create_session(template (value) FullyQualifiedTEID fteid_c_ie,
+ template (value) FullyQualifiedTEID fteid_u_ie,
+ template (omit) UserLocationInfo uli_ie := omit,
+ template (omit) APCO apco := omit,
+ template APCO exp_apco := *) runs on SMF_Session_CT {
+ var PDU_GTPCv2 rx;
+
+ /* Defaults used for s5/s8: */
+ var boolean do_s6b := false;
+ var template APN_Restriction apn_restriction := ?;
+ /* Change behavior when on S2b: */
+ if (is_s2b_iface()) {
+ do_s6b := true;
+ apn_restriction := omit;
+ }
+
+ var template (value) PDU_GTPCv2 g2c :=
+ ts_GTP2C_CreateSessionReq(imsi := g_pars.imsi,
+ msisdn := g_pars.msisdn,
+ rat_type := enum2int(g_pars.rat_type),
+ sender_fteid := fteid_c_ie,
+ apn := f_enc_dns_hostname(g_pars.apn),
+ pdn_type := int2bit(enum2int(g_pars.pdn_type), 3),
+ teid_list := { fteid_u_ie },
+ chg_car := '0000'O,
+ bearer_id := g_pars.bearer.ebi,
+ uli := uli_ie,
+ apco := apco);
+ g2c.gtpcv2_pdu.createSessionRequest.servingNetwork := ts_GTP2C_ServingNetwork('001'H, '01F'H);
+
+ /////////// START MUTUAL EXCLUSION ZONE ////////////
+ /* This code block cannot be executed by more than one component at a time because
+ * the RANAP RAB Ass Request triggers the IUT to send PFCP Session Establishment
+ * Request PDU(s), which needs to be routed to the respective ConnHdlr component (us).
+ * As per 3GPP TS 29.244, section 7.2.2.4.2, these PFCP PDUs shall all have SEID=0,
+ * so that the PFCPEM component cannot route them unambiguously. This is why we
+ * need to ensure that only one ConnHdlr is triggering PFCP session establishment
+ * at the given moment of time. */
+ f_Mutex_lock(__BFILE__, __LINE__);
+ /* Subscribe for PFCP Session Establishment Request PDU(s), which are
+ * expected to have SEID set to 0, as per 3GPP TS 29.244, section 7.2.2.4.2. */
+ f_PFCPEM_subscribe_seid(c_SEID0);
+
+ GTP2.send(g2c);
+ if (do_s6b and DIAMETER[DIA_S6b].checkstate("Connected")) {
+ as_DIA_S6b_AAR();
+ }
+ if (DIAMETER[DIA_Gx].checkstate("Connected")) {
+ as_DIA_Gx_CCR(INITIAL_REQUEST);
+ }
+ /* FIXME: When on S2b interface, SMF is not using the Gy interface, unknown reason. */
+ if (DIAMETER[DIA_Gy].checkstate("Connected")) {
+ as_DIA_Gy_CCR(INITIAL_REQUEST);
+ }
+
+ /* Expect PFCP Session Establishment Request. */
+ as_pfcp_sess_est_req();
+ /* Ask PFCPEM to route PDUs with to be indicated F-SEID to us. */
+ f_PFCPEM_subscribe_seid(g_pars.pfcp_pars.local_f_seid.seid);
+ /* We're done establishing PFCP sessions, so at this point we no longer expect to
+ * receive Session Establishment Request PDUs with SEID=0. Unregister and unlock
+ * the mutex, enabling other components to establish PFCP sessions after us. */
+ f_PFCPEM_unsubscribe_seid(c_SEID0);
+ f_Mutex_unlock(__BFILE__, __LINE__);
+ /////////// END MUTUAL EXCLUSION ZONE ////////////
+
+ alt {
+ [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid := g_pars.teic_local,
+ cause := Request_accepted,
+ apn_restriction := apn_restriction,
+ exp_apco := exp_apco)) -> value rx {
+ /* extract TEIDs */
+ var CreateSessionResponse resp := rx.gtpcv2_pdu.createSessionResponse;
+ g_pars.teic_remote := resp.fullyQualifiedTEID[0].tEID_GRE_Key;
+
+ /* extract allocated address[es] */
+ var PDN_Address_and_Prefix paa := resp.pDN_AddressAllocation.pDN_Address_and_Prefix;
+ if (ischosen(paa.iPv4_Address)) {
+ g_ip4_addr := paa.iPv4_Address;
+ log("SMF assigned UE IPv4 address: ", f_inet_ntoa(g_ip4_addr));
+ } else if (ischosen(paa.iPv6_Address)) {
+ if (paa.iPv6_Address.prefixLength != 64) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Got IPv6 Prefix Length ",
+ paa.iPv6_Address.prefixLength, " vs exp 64"));
+ }
+ g_ip6_interface_id := substr(paa.iPv6_Address.iPv6_Address, 8, 8);
+ log("SMF assigned IPv6 Interface Id: ", g_ip6_interface_id);
+ g_ip6_addr := 'FE80000000000000'O & g_ip6_interface_id;
+ log("SMF assigned IPv6 link-local Address: ", f_inet6_ntoa(g_ip6_addr));
+ } else if (ischosen(paa.iPv4_IPv6)) {
+ if (paa.iPv4_IPv6.prefixLength != 64) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Got IPv6 Prefix Length ",
+ paa.iPv4_IPv6.prefixLength, " vs exp 64"));
+ }
+ g_ip4_addr := paa.iPv4_IPv6.iPv4_Address;
+ log("SMF assigned UE IPv4 address: ", f_inet_ntoa(g_ip4_addr));
+ g_ip6_interface_id := substr(paa.iPv4_IPv6.iPv6_Address, 8, 8);
+ log("SMF assigned IPv6 Interface Id: ", g_ip6_interface_id);
+ g_ip6_addr := 'FE80000000000000'O & g_ip6_interface_id;
+ log("SMF assigned IPv6 link-local Address: ", f_inet6_ntoa(g_ip6_addr));
+ }
+ var integer i;
+ for (i := 0; i < lengthof(resp.bearerContextGrouped); i := i+1) {
+ var BearerContextGrouped bctx := resp.bearerContextGrouped[i];
+ select (bctx.instance) {
+ case ('0000'B) { // created
+ process_bctx_create(bctx);
+ }
+ case ('0001'B) { // removed
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "We don't expect removed bearer contexts yet");
+ }
+ }
+ }
+ }
+ [] GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid:=g_pars.teic_local, cause:=?)) -> value rx {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Unexpected CreateSessionResp(cause=",
+ rx.gtpcv2_pdu.createSessionResponse.cause.causeValue, ")"));
+ }
+ [] GTP2.receive {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Unexpected GTPv2 while waiting for CreateSessionResp");
+ }
+ }
+
+}
+
+/* create a session on the SMF on a S5/S8 interface (from SGW )*/
+function f_s5s8_create_session() runs on SMF_Session_CT {
+ var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
+ var template (value) UserLocationInfo uli_ie;
+
+ fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0,
+ f_inet_addr(mp_local_hostname_c), omit);
+ fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPU, g_pars.bearer.teid_local, 2,
+ f_inet_addr(mp_local_hostname_u), omit);
+
+
+ /* open5gs up to 1.2.3 won't accept it without ULI, despite not mandatory */
+ var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O };
+ var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 };
+ uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi);
+
+ f_create_session(fteid_c_ie, fteid_u_ie, uli_ie);
+
+}
+
+/* create a session on the SMF on a S2b interface (from ePDG)*/
+function f_s2b_create_session(template (omit) APCO apco := omit,
+ template APCO exp_apco := *) runs on SMF_Session_CT {
+ var template (value) FullyQualifiedTEID fteid_c_ie, fteid_u_ie;
+ var template (value) UserLocationInfo uli_ie;
+
+ fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S2b_ePDG_GTPC, g_pars.teic_local, 0,
+ f_inet_addr(mp_local_hostname_c), omit);
+ fteid_u_ie := ts_GTP2C_FTEID(FTEID_IF_S2bU_ePDG_GTPU, g_pars.bearer.teid_local, 5,
+ f_inet_addr(mp_local_hostname_u), omit);
+
+ var template (value) TAI tai := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0001'O };
+ var template (value) ECGI ecgi := { '0'H, '0'H, '1'H, 'F'H, '0'H, '1'H, '0'H, 23 };
+ uli_ie := ts_GTP2C_UserLocInfo(tai := tai, ecgi := ecgi);
+
+ f_create_session(fteid_c_ie, fteid_u_ie, uli_ie := uli_ie, apco := apco, exp_apco := exp_apco);
+
+}
+
+/* delete the session from the SMF */
+function f_delete_session(template (omit) GTP2C_Cause tx_cause := omit,
+ template (present) GTP2C_Cause exp_cause,
+ boolean expect_pfcp := true,
+ boolean expect_diameter := true) runs on SMF_Session_CT {
+ var template (value) FullyQualifiedTEID fteid_c_ie
+ fteid_c_ie := ts_GTP2C_FTEID(FTEID_IF_S5S8_SGW_GTPC, g_pars.teic_local, 0,
+ f_inet_addr(mp_local_hostname_c), omit);
+ var template PDU_GTPCv2 g2c :=
+ ts_GTP2C_DeleteSessionReq(d_teid := g_pars.teic_remote, cause := tx_cause,
+ sender_fteid := fteid_c_ie,
+ teid_list := {}, bearer_id := g_pars.bearer.ebi);
+
+ GTP2.send(g2c);
+
+ if (expect_pfcp) {
+ as_pfcp_sess_del_req();
+ }
+
+ if (DIAMETER[DIA_Gx].checkstate("Connected") and expect_diameter) {
+ as_DIA_Gx_CCR(TERMINATION_REQUEST);
+ }
+ if (DIAMETER[DIA_Gy].checkstate("Connected") and expect_diameter) {
+ as_DIA_Gy_CCR(TERMINATION_REQUEST);
+ }
+ alt {
+ [] GTP2.receive(tr_GTP2C_DeleteSessionResp(d_teid := g_pars.teic_local, cause := exp_cause)) {
+ setverdict(pass);
+ }
+ [] GTP2.receive(tr_GTP2C_DeleteSessionResp(?, ?)) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Unexpected DeleteSessionResp");
+ }
+ [] GTP2.receive {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Unexpected GTPv2 while waiting for DeleteSessionResp");
+ }
+ }
+}
+
+}
diff --git a/smf/SMF_Session_CT_5G.ttcn b/smf/SMF_Session_CT_5G.ttcn
new file mode 100644
index 0000000..4ec73d4
--- /dev/null
+++ b/smf/SMF_Session_CT_5G.ttcn
@@ -0,0 +1,457 @@
+module SMF_Session_CT_5G {
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from Native_Functions all;
+import from Misc_Helpers all;
+
+import from HTTP2_Types all;
+import from HTTP2_Templates all;
+import from HTTP2_Functions all;
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
+import from TS29518_Namf_Communication all;
+import from TS29503_Nudm_SDM all;
+import from TS29502_Nsmf_PDUSession all;
+import from TS29512_Npcf_SMPolicyControl all;
+
+import from TS29518_Namf_Communication_Templates all;
+import from TS29503_Nudm_SDM_Templates all;
+import from TS29502_Nsmf_PDUSession_Templates all;
+import from TS29512_Npcf_SMPolicyControl_Templates all;
+
+import from PFCP_Emulation all;
+import from Mutex all;
+
+import from SMF_Session_CT all;
+import from SMF_Tests all;
+
+/* Index in SMF_Session_CT inherited HTTP2_ConnHdlr ports HTTP2_CONN[] and HTTP2_CONN_PROC[] */
+const integer HTTP2_CONN_SCP := 0;
+
+function f_handler_init_5G()
+runs on SMF_Session_CT {
+ /* Create SCP HTTP2 sever, where IUT will send all SBI requests: */
+ f_http2_server_emu_register();
+}
+
+/********************************************
+ * N11 Nsmf (SBI): Requests towards IUT SMF
+ ********************************************/
+
+function f_n11_init() runs on SMF_Session_CT {
+ f_http2_adapter_init();
+ f_http2_adapter_connect(mp_smf_hostname, mp_smf_sbi_port, mp_amf_local_ip, -1);
+
+ var template (value) HTTP2_Setting_list settings := {
+ ts_HTTP2_Setting_ENABLE_PUSH(0),
+ ts_HTTP2_Setting_INITIAL_WINDOW_SIZE(4194304),
+ ts_HTTP2_Setting_MAX_HEADER_LIST_SIZE(10485760)
+ }
+ f_http2_adapter_send(ts_HTTP2_Frame_Settings(settings := settings));
+
+ f_http2_adapter_send(ts_HTTP2_Frame_Window_Update(0, 1073741824));
+}
+
+function f_http2_header_block_encode(HTTP2_header_block hb) return octetstring
+{
+ var HTTP2_comp_context ctx := HTTP2_comp_context_init();
+ var integer rc;
+ var octetstring data := ''O;
+
+ rc := HTTP2_comp_context_encode(ctx, hb, data);
+ if (rc != 0) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("HTTP2_comp_context_encode returned ", rc));
+ }
+ HTTP2_comp_context_free(ctx);
+ return data;
+}
+
+function f_http2_encode_body_multipart_json_5gnas(octetstring json_encoded,
+ octetstring nas_ecnoded,
+ charstring boundary := "=-0EVVjxcWWFYNd1JXh1OQEg==") return octetstring
+{
+ var charstring boundary_ext := "\r\n--" & boundary & "\r\n";
+ var octetstring boundary_enc := char2oct(boundary_ext);
+
+ return boundary_enc &
+ char2oct("Content-Type: application/json\r\n\r\n") &
+ json_encoded &
+ boundary_enc &
+ char2oct("Content-Id: 5gnas-sm\r\n") &
+ char2oct("Content-Type: application/vnd.3gpp.5gnas\r\n\r\n") &
+ nas_ecnoded &
+ boundary_enc;
+}
+
+/* Nsmf_PDUSession_CreateSMContext Request/response
+ * 3GPP TS 23.502 Figure 4.3.2.2.1-1
+ * 3GPP TS 29.502 6.1.3.2 */
+function f_n11_create_session()
+runs on SMF_Session_CT {
+ var octetstring hdr_enc;
+ var template (value) HTTP2_pseudo_headers pseudo_hdr;
+ var template (value) HTTP2_header_list hdr_li;
+ var template (value) HTTP2_header_block hb;
+ var template (value) octetstring body;
+ var template (value) TS29502_Nsmf_PDUSession.PlmnId plmn_id := TS29502_Nsmf_PDUSession_Templates.ts_PlmnId("001", "001");
+ var template (value) TS29502_Nsmf_PDUSession.PlmnIdNid plmn_id_nid := TS29502_Nsmf_PDUSession_Templates.ts_PlmnIdNid(plmn_id.mcc, plmn_id.mnc);
+ var integer pduSessionId := 1;
+
+ var template (value) SmContextCreateData sm_contexts;
+ var octetstring sm_contexts_enc;
+ sm_contexts := ts_SmContextCreateData(supi := "imsi-" & g_pars.imsi_str,
+ pei := "imeisv-0790219824011594",
+ pduSessionId := pduSessionId,
+ dnn := "internet",
+ sNssai := TS29502_Nsmf_PDUSession_Templates.ts_Snssai(1),
+ servingNfId := "foobar",
+ guami := ts_Guami(plmnId := plmn_id_nid,
+ amfId := "020040"),
+ servingNetwork := plmn_id_nid,
+ n1SmMsg := TS29502_Nsmf_PDUSession_Templates.ts_RefToBinaryData("5gnas-sm"),
+ anType := ThreeGPP_ACCESS,
+ ratType := ts_RatType(NR),
+ ueLocation := ts_UserLocation(nrLocation := ts_NrLocation(tai := ts_Tai(plmn_id, "000001"),
+ ncgi := ts_Ncgi(plmn_id, "000000000"))),
+ smContextStatusUri := f_amf_callback_uri(g_pars.imsi_str, "sm-context-status", pduSessionId));
+ sm_contexts_enc := f_enc_SmContextCreateData(valueof(sm_contexts));
+
+ var charstring boundary := "=-0EVVjxcWWFYNd1JXh1OQEg=="
+ var octetstring nas_enc := '2e0101c1ffff91a1'O;
+ body := f_http2_encode_body_multipart_json_5gnas(sm_contexts_enc, nas_enc, boundary);
+
+ pseudo_hdr := ts_HTTP2_pseudo_headers("POST",
+ "http",
+ mp_smf_hostname & ":" & int2str(mp_smf_sbi_port),
+ "/nsmf-pdusession/v1/sm-contexts");
+ hdr_li := {
+ ts_HTTP2_Hdr_content_type("multipart/related; boundary=\"" & boundary & "\""),
+ ts_HTTP2_Hdr_accept("application/json,application/vnd.3gpp.ngap,application/problem+json"),
+ ts_HTTP2_Hdr_user_agent("ttcn3-amf"),
+ ts_HTTP2_Hdr_content_length(int2str(lengthof(body))),
+ ts_HTTP2_Hdr_accept_encoding("gzip")
+ };
+ hb := ts_HTTP2_header_block(pseudo_hdr, hdr_li);
+ hdr_enc := f_http2_header_block_encode(valueof(hb));
+ f_http2_adapter_send(ts_HTTP2_Frame_Header(3,
+ end_stream_flag := false,
+ end_header_flag := true,
+ header_block_fragment := hdr_enc
+ ));
+
+
+ /////////// START MUTUAL EXCLUSION ZONE ////////////
+ /* This code block cannot be executed by more than one component at a time because
+ * the RANAP RAB Ass Request triggers the IUT to send PFCP Session Establishment
+ * Request PDU(s), which needs to be routed to the respective ConnHdlr component (us).
+ * As per 3GPP TS 29.244, section 7.2.2.4.2, these PFCP PDUs shall all have SEID=0,
+ * so that the PFCPEM component cannot route them unambiguously. This is why we
+ * need to ensure that only one ConnHdlr is triggering PFCP session establishment
+ * at the given moment of time. */
+ f_Mutex_lock(__BFILE__, __LINE__);
+ /* Subscribe for PFCP Session Establishment Request PDU(s), which are
+ * expected to have SEID set to 0, as per 3GPP TS 29.244, section 7.2.2.4.2. */
+ f_PFCPEM_subscribe_seid(c_SEID0);
+
+ f_http2_adapter_send(ts_HTTP2_Frame_Data(3,
+ end_stream_flag := true,
+ data := body));
+
+ /* Expect UDM to receive GET sm-data: */
+ as_nudm_sdm_get_sm_data();
+ /* Expect UDM to receive POST sdm-subscriptions: */
+ as_nudm_sdm_post_sdm_subscriptions();
+ /* Expect PCF to receive POST sm-policies: */
+ as_npcf_smpolicycontrol_post_sm_policies();
+
+ /* Expect PFCP Session Establishment Request. */
+ as_pfcp_sess_est_req();
+ /* Ask PFCPEM to route PDUs with to be indicated F-SEID to us. */
+ f_PFCPEM_subscribe_seid(g_pars.pfcp_pars.local_f_seid.seid);
+ /* We're done establishing PFCP sessions, so at this point we no longer expect to
+ * receive Session Establishment Request PDUs with SEID=0. Unregister and unlock
+ * the mutex, enabling other components to establish PFCP sessions after us. */
+ f_PFCPEM_unsubscribe_seid(c_SEID0);
+ f_Mutex_unlock(__BFILE__, __LINE__);
+ /////////// END MUTUAL EXCLUSION ZONE ////////////
+
+ as_namf_comm_post_n1n2_messages();
+ setverdict(pass);
+ f_sleep(3.0);
+}
+
+function f_n11_delete_session()
+runs on SMF_Session_CT {
+ log("f_n11_delete_session(): TODO");
+}
+
+/**************************************
+ * N11 Namf (SBI): Emulated AMF
+ **************************************/
+
+const charstring Namf_Communication_API_PREFIX := "/namf-comm/v1"
+
+function f_namf_comm_uri_imsi_prefix(charstring imsi)
+return charstring {
+ return Namf_Communication_API_PREFIX & "/ue-contexts" & "/imsi-" & imsi
+}
+
+/* 3GPP TS 29.518:
+ * 6.1.3.5 Resource: N1N2 Messages Collection */
+function f_tr_Namf_Communication_post_n1n2_messages()
+runs on SMF_Session_CT return template (present) HTTP2_Msg {
+ var template (present) HTTP2_Msg http2_msg;
+ var template (present) HTTP2_header_block hb;
+ var template (present) HTTP2_pseudo_headers pseudo_headers;
+ var template HTTP2_header_list headers := *;
+
+ pseudo_headers := tr_HTTP2_pseudo_headers(method := "POST",
+ path := f_namf_comm_uri_imsi_prefix(g_pars.imsi_str) & "/n1-n2-messages");
+ hb := tr_HTTP2_header_block(pseudo_headers, headers);
+ http2_msg := tr_HTTP2_Msg(?, ?,
+ hb := hb,
+ body := tr_HTTP2_Data_frame(data := ? /* multipart */));
+ return http2_msg;
+}
+
+private function f_multipart_content_json_get_value(charstring part)
+return charstring {
+ var ro_charstring sp := f_str_split(part, "\r\n");
+ for (var integer i := 0; i < lengthof(sp); i := i + 1) {
+ if (sp[i] == "") {
+ continue;
+ }
+ if (f_str_startswith(sp[i], "Content-Type:")) {
+ continue;
+ }
+ return sp[i];
+ }
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Unable to finf JSON part in multipart value ", part));
+ return "";
+}
+
+/* 5.2.2.3.1 N1N2MessageTransfer */
+private altstep as_namf_comm_post_n1n2_messages()
+runs on SMF_Session_CT {
+ var HTTP2_Msg http2_rx;
+ [] HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Namf_Communication_post_n1n2_messages()) -> value http2_rx {
+ var N1N2MessageTransferReqData n1n2msg_req;
+ var template (value) N1N2MessageTransferRspData n1n2msg_rsp;
+ var template (value) HTTP2_Msg http2_tx;
+ var octetstring body_enc;
+ log("PESPIN: rx http2! ", http2_rx);
+
+ /* Split http2_rx.body.data into chunks since it is a multipart message: */
+ var charstring content_type_val := valueof(f_HTTP2_header_list_find_header(http2_rx.hb.headers, c_HTTP2_HDR_content_type));
+ var charstring boundary := f_HTTP2_header_content_type_multipart_val_get_boundary(content_type_val)
+ var ro_octetstring parts := f_str_oct_split(http2_rx.body.data, char2oct("--" & boundary))
+ var charstring json_str := f_multipart_content_json_get_value(oct2char(parts[0]))
+
+ f_dec_N1N2MessageTransferReqData(char2oct(json_str), n1n2msg_req); // TODO: check returned integer.
+ log("PESPIN: N1N2MessageTransferReqData:", n1n2msg_req);
+
+ n1n2msg_rsp := ts_N1N2MessageTransferRspData(cause := ts_N1N2MessageTransferCause(N1_N2_TRANSFER_INITIATED))
+ body_enc := f_enc_N1N2MessageTransferRspData(valueof(n1n2msg_rsp));
+
+ http2_tx := ts_HTTP2_Msg_200_OK(http2_rx.conn_id,
+ http2_rx.stream_id,
+ headers := {
+ ts_HTTP2_Hdr_content_type("application/json; charset=utf-8")
+ },
+ body := ts_HTTP2_Data_frame(http2_rx.stream_id,
+ end_stream_flag := true,
+ data := body_enc));
+ HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+ setverdict(pass);
+ }
+}
+
+/*************************************
+ * N10 Nudm (SBI): Emulated UDM
+ *************************************/
+
+const charstring Nudm_SDM_API_PREFIX := "/nudm-sdm/v2"
+
+function f_nudm_sdm_uri_imsi_prefix(charstring imsi)
+return charstring {
+ return Nudm_SDM_API_PREFIX & "/imsi-" & imsi
+}
+
+function f_nudm_sdm_uri_imsi_subscr_prefix(charstring imsi, charstring opcode, integer pduSessionId)
+return charstring {
+ return f_nudm_sdm_uri_imsi_prefix(imsi) & "/" & opcode & "/" & int2str(pduSessionId);
+}
+
+/* 3GPP TS 29.503:
+ * 5.2.2.2.5 Session Management Subscription Data Retrieval
+ * 6.1.3.8 Resource: SessionManagementSubscriptionData (Document) */
+function f_tr_Nudm_SDM_get_sm_data()
+runs on SMF_Session_CT return template (present) HTTP2_Msg {
+ var template (present) HTTP2_Msg http2_msg;
+ var template (present) HTTP2_header_block hb;
+ var template (present) HTTP2_pseudo_headers pseudo_headers;
+ var template HTTP2_header_list headers := *;
+
+ pseudo_headers := tr_HTTP2_pseudo_headers(method := "GET",
+ path := pattern Nudm_SDM_API_PREFIX & "/imsi-" & g_pars.imsi_str & "/sm-data*");
+ hb := tr_HTTP2_header_block(pseudo_headers, headers);
+ http2_msg := tr_HTTP2_Msg(?, ?, hb := hb, body := omit);
+ return http2_msg;
+}
+
+/* 3GPP TS 29.503 5.2.2.2.5 Session Management Subscription Data Retrieval */
+private altstep as_nudm_sdm_get_sm_data()
+runs on SMF_Session_CT {
+ var HTTP2_Msg http2_rx;
+ [] HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Nudm_SDM_get_sm_data()) -> value http2_rx {
+ var template (value) SessionManagementSubscriptionData1 sm_sub_data;
+ var template (value) DnnConfiguration1 dnn_cfg;
+ var octetstring body_enc;
+ var template (value) HTTP2_Msg http2_tx;
+
+ dnn_cfg := ts_DnnConfiguration1(pduSessionTypes := ts_PduSessionTypes1(defaultSessionType := ts_PduSessionType1(IPV4),
+ allowedSessionTypes := { ts_PduSessionType1(IPV4) }),
+ sscModes := ts_SscModes1(defaultSscMode := ts_SscMode1(SSC_MODE_1),
+ allowedSscModes := { ts_SscMode1(SSC_MODE_1),
+ ts_SscMode1(SSC_MODE_2),
+ ts_SscMode1(SSC_MODE_3)}),
+ fivegQosProfile := ts_SubscribedDefaultQos1(fiveqi := 9,
+ arp := ts_Arp(priorityLevel := ts_ArpPriorityLevel(8),
+ preemptCap := ts_PreemptionCapability(NOT_PREEMPT),
+ preemptVuln := ts_PreemptionVulnerability(NOT_PREEMPTABLE)),
+ priorityLevel := 8),
+ sessionAmbr := ts_Ambr1(uplink := "1000 Kbps",
+ downlink := "1000 Kbps")
+ );
+
+ sm_sub_data := ts_SessionManagementSubscriptionData1(
+ singleNssai := TS29503_Nudm_SDM_Templates.ts_Snssai1(1),
+ dnnConfigurations := {{"internet", dnn_cfg}}
+ );
+ body_enc := f_enc_SmSubsData1(valueof(ts_SmSubsData1({sm_sub_data})));
+
+ http2_tx := ts_HTTP2_Msg_200_OK(http2_rx.conn_id,
+ http2_rx.stream_id,
+ headers := {
+ ts_HTTP2_Hdr_content_type("application/json; charset=utf-8")
+ },
+ body := ts_HTTP2_Data_frame(http2_rx.stream_id,
+ end_stream_flag := true,
+ data := body_enc));
+ HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+ setverdict(pass);
+ }
+}
+
+
+/* 3GPP TS 29.503:
+ * 6.1.3.3 Resource: SdmSubscriptions (Collection)*/
+function f_tr_Nudm_SDM_post_sdm_subscriptions()
+runs on SMF_Session_CT return template (present) HTTP2_Msg {
+ var template (present) HTTP2_Msg http2_msg;
+ var template (present) HTTP2_header_block hb;
+ var template (present) HTTP2_pseudo_headers pseudo_headers;
+ var template HTTP2_header_list headers := *;
+
+ pseudo_headers := tr_HTTP2_pseudo_headers(method := "POST",
+ path := f_nudm_sdm_uri_imsi_prefix(g_pars.imsi_str) & "/sdm-subscriptions");
+ hb := tr_HTTP2_header_block(pseudo_headers, headers);
+ http2_msg := tr_HTTP2_Msg(?, ?,
+ hb := hb,
+ body := tr_HTTP2_Data_frame(data := decmatch tr_SdmSubscription1));
+ return http2_msg;
+}
+
+/* 3GPP TS 29.503 5.2.2.3.2 Subscription to notifications of data change */
+private altstep as_nudm_sdm_post_sdm_subscriptions()
+runs on SMF_Session_CT {
+ var HTTP2_Msg http2_rx;
+ [] HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Nudm_SDM_post_sdm_subscriptions()) -> value http2_rx {
+ var SdmSubscription1 sdm_subscription;
+ var template (value) HTTP2_Msg http2_tx;
+ var octetstring body_enc;
+
+ f_dec_SdmSubscription1(http2_rx.body.data, sdm_subscription); // TODO: check returned integer.
+
+ /* Add subscriptionId to received object and transmit it back: */
+ sdm_subscription.subscriptionId := "1";
+ body_enc := f_enc_SdmSubscription1(sdm_subscription);
+
+ http2_tx := ts_HTTP2_Msg_201_Created(http2_rx.conn_id,
+ http2_rx.stream_id,
+ headers := {
+ ts_HTTP2_Hdr_content_type("application/json; charset=utf-8"),
+ ts_HTTP2_Hdr_location(f_scp_uri_prefix() & f_nudm_sdm_uri_imsi_subscr_prefix(g_pars.imsi_str, "sdm-subscriptions", 1))
+ },
+ body := ts_HTTP2_Data_frame(http2_rx.stream_id,
+ end_stream_flag := true,
+ data := body_enc));
+ HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+ setverdict(pass);
+ }
+}
+
+/*************************************
+ * N8 NPcf (SBI): Emulated PCF
+ *************************************/
+
+const charstring Npcf_SMPolicyControl_API_PREFIX := "/npcf-smpolicycontrol/v1"
+
+function f_npcf_smpolicycontrol_uri_imsi_prefix(charstring imsi)
+return charstring {
+ return Npcf_SMPolicyControl_API_PREFIX & "/imsi-" & imsi
+}
+
+/* 3GPP TS 29.512:
+ * 5.3.2 Resource: SM Policies */
+function f_tr_Npcf_SMPolicyControl_post_sm_policies()
+runs on SMF_Session_CT return template (present) HTTP2_Msg {
+ var template (present) HTTP2_Msg http2_msg;
+ var template (present) HTTP2_header_block hb;
+ var template (present) HTTP2_pseudo_headers pseudo_headers;
+ var template HTTP2_header_list headers := *;
+
+ pseudo_headers := tr_HTTP2_pseudo_headers(method := "POST",
+ path := Npcf_SMPolicyControl_API_PREFIX & "/sm-policies");
+ hb := tr_HTTP2_header_block(pseudo_headers, headers);
+ http2_msg := tr_HTTP2_Msg(?, ?,
+ hb := hb,
+ body := tr_HTTP2_Data_frame(data := decmatch tr_SmPolicyContextData1));
+ return http2_msg;
+}
+
+/* 3GPP TS 29.512 4.2.2.2 SM Policy Association establishment */
+private altstep as_npcf_smpolicycontrol_post_sm_policies()
+runs on SMF_Session_CT {
+ var HTTP2_Msg http2_rx;
+ [] HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Npcf_SMPolicyControl_post_sm_policies()) -> value http2_rx {
+ var SmPolicyContextData1 smpol_ctx_data;
+ var template (value) SmPolicyDecision1 smpol_decision;
+ var template (value) HTTP2_Msg http2_tx;
+ var octetstring body_enc;
+ var integer sessRuleId := 1;
+
+ f_dec_SmPolicyContextData1(http2_rx.body.data, smpol_ctx_data); // TODO: check returned integer.
+
+ smpol_decision := ts_SmPolicyDecision1();
+ body_enc := f_enc_SmPolicyDecision1(valueof(smpol_decision));
+
+ http2_tx := ts_HTTP2_Msg_201_Created(http2_rx.conn_id,
+ http2_rx.stream_id,
+ headers := {
+ ts_HTTP2_Hdr_content_type("application/json; charset=utf-8"),
+ ts_HTTP2_Hdr_location(f_scp_uri_prefix() & Npcf_SMPolicyControl_API_PREFIX & "/sm-policies/imsi-" & g_pars.imsi_str & "-" & int2str(sessRuleId))
+ },
+ body := ts_HTTP2_Data_frame(http2_rx.stream_id,
+ end_stream_flag := true,
+ data := body_enc));
+ HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+ setverdict(pass);
+ }
+}
+
+}
diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn
index b452bd9..2becc57 100644
--- a/smf/SMF_Tests.ttcn
+++ b/smf/SMF_Tests.ttcn
@@ -28,11 +28,19 @@
import from PFCP_Templates all;
import from PFCP_CodecPort all;
+import from HTTP2_Types all;
+import from HTTP2_Templates all;
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
import from Mutex all;
import from SMF_Session_CT all;
+import from SMF_Session_CT_4G all;
+import from SMF_Session_CT_5G all;
modulepar {
charstring mp_smf_hostname := "127.0.0.4";
+ integer mp_smf_sbi_port := 7777;
charstring mp_local_hostname_c := "127.0.0.1";
charstring mp_local_hostname_u := "127.0.0.1";
@@ -50,10 +58,17 @@
/* IP address at which we listen for PFCP to emulate a UPF in ttcn3 */
charstring mp_pfcp_ip_local := "127.0.0.7";
charstring mp_pfcp_upf_node_id := "\07osmocom\03org";
+
+
+ /* IP address at which we listen for HTTP2/SBI to emulate a AMF in ttcn3 */
+ charstring mp_amf_local_ip := "127.0.0.4";
+ charstring mp_scp_local_ip := "127.0.1.10";
+ integer mp_scp_local_port := 7777;
}
+
/* main component, we typically have one per testcase */
-type component SMF_Test_CT extends GTP2_ConnHdlr, PFCP_ConnHdlr {
+type component SMF_Test_CT extends GTP2_ConnHdlr, PFCP_ConnHdlr, HTTP2_CT {
var GTPv2_Emulation_CT vc_GTP2;
port GTP2EM_PT TEIC0;
var GTPv1U_Emulation_CT vc_GTP1U;
@@ -77,6 +92,9 @@
var MutexDispCT vc_mutex_disp;
var boolean g_pfcp_answer_heartbeat_req := true;
+ /* emulated SCP */
+ var HTTP2_Server_Emulation_CT vc_HTTP2_SRV_SCP;
+
/* global test case guard timer (actual timeout value is set in f_init()) */
timer T_guard;
}
@@ -223,6 +241,18 @@
}
+private function f_init_http2_srv(charstring id) runs on SMF_Test_CT {
+ id := id & "-PFCP";
+
+ var Http2ServerEmulationCfg http2_srv_cfg := {
+ http2_bind_ip := mp_scp_local_ip,
+ http2_bind_port := mp_scp_local_port
+ };
+
+ vc_HTTP2_SRV_SCP := HTTP2_Server_Emulation_CT.create(id) alive;
+ vc_HTTP2_SRV_SCP.start(HTTP2_Server_Emulation.main(http2_srv_cfg));
+}
+
private function f_init(float guard_timeout := 60.0) runs on SMF_Test_CT {
T_guard.start(guard_timeout);
activate(as_Tguard());
@@ -232,6 +262,7 @@
f_init_gtp1u();
f_init_pfcp(id);
+ f_init_http2_srv(id);
if (mp_pcrf_local_ip != "") {
f_init_diameter(testcasename());
@@ -260,6 +291,11 @@
connect(vc_conn:PFCP_PROC, vc_PFCP:CLIENT_PROC);
f_MutexDisp_connect(vc_mutex_disp, vc_conn);
+ if (isbound(vc_HTTP2_SRV_SCP)) {
+ connect(vc_conn:HTTP2_CONN[HTTP2_CONN_SCP], vc_HTTP2_SRV_SCP:CONN);
+ connect(vc_conn:HTTP2_CONN_PROC[HTTP2_CONN_SCP], vc_HTTP2_SRV_SCP:CONN_PROC);
+ }
+
if (isbound(vc_Gx)) {
connect(vc_conn:DIAMETER_PROC[DIA_Gx], vc_Gx:DIAMETER_PROC);
connect(vc_conn:DIAMETER[DIA_Gx], vc_Gx:DIAMETER_CLIENT);
@@ -279,6 +315,16 @@
return vc_conn;
}
+function f_scp_uri_prefix() return charstring
+{
+ return "http://" & mp_scp_local_ip & ":" & int2str(mp_scp_local_port);
+}
+function f_amf_callback_uri(charstring imsi, charstring opcode, integer pduSessionId) return charstring
+{
+ return f_scp_uri_prefix() &
+ "/namf-callback/v1/imsi-" & imsi & "/" & opcode & "/" & int2str(pduSessionId);
+}
+
/* send echo request; expect response */
testcase TC_tx_echo() runs on SMF_Test_CT {
timer T := 5.0;
@@ -452,6 +498,21 @@
vc_conn.done;
}
+private function f_TC_n11_createSession_deleteSession() runs on SMF_Session_CT {
+ f_n11_init();
+ f_n11_create_session();
+ f_n11_delete_session();
+ setverdict(pass);
+}
+testcase TC_n11_createSession_deleteSession() runs on SMF_Test_CT {
+ var SMF_Session_CT vc_conn;
+ var SessionPars pars := valueof(t_SessionPars('001010123456789'H,
+ rat_type := GTP2C_RAT_NR));
+ f_init();
+ vc_conn := f_start_handler(refers(f_TC_n11_createSession_deleteSession), pars);
+ vc_conn.done;
+}
+
control {
execute( TC_tx_echo() );
execute( TC_createSession_deleteSession() );
@@ -460,6 +521,8 @@
execute( TC_gy_ccr_update_rejected() );
execute( TC_s2b_createSession_v4_noapco() );
execute( TC_s2b_createSession_v4_apco() );
+
+ execute( TC_n11_createSession_deleteSession() );
}
diff --git a/smf/expected-results.xml b/smf/expected-results.xml
index eba5484..a167103 100644
--- a/smf/expected-results.xml
+++ b/smf/expected-results.xml
@@ -7,4 +7,5 @@
<testcase classname='SMF_Tests' name='TC_gy_ccr_update_rejected' time='MASKED'/>
<testcase classname='SMF_Tests' name='TC_s2b_createSession_v4_noapco' time='MASKED'/>
<testcase classname='SMF_Tests' name='TC_s2b_createSession_v4_apco' time='MASKED'/>
+ <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession' time='MASKED'/>
</testsuite>
diff --git a/smf/gen_links.sh b/smf/gen_links.sh
index f8a3166..d1b3394 100755
--- a/smf/gen_links.sh
+++ b/smf/gen_links.sh
@@ -58,6 +58,18 @@
FILES="DIAMETER_EncDec.cc"
gen_links $DIR $FILES
+DIR=$BASEDIR/titan.ProtocolModules.HTTP2/src
+FILES="HTTP2_EncDec.cc HTTP2_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.JSON_v07_2006/src
+FILES="JSON_Generic_Null_Def.asn JSON_Generic.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/osmo-ttcn3-openapi-generator/openapi-specs/3GPP_5GC_Rel19/ttcn3
+FILES="TS29571_CommonData.ttcn TS29502_Nsmf_PDUSession.ttcn TS29503_Nudm_SDM.ttcn TS29512_Npcf_SMPolicyControl.ttcn TS29518_Namf_Communication.ttcn "
+gen_links $DIR $FILES
+
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn PAP_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
@@ -70,6 +82,8 @@
FILES+="SCTP_Templates.ttcn "
FILES+="NTP_Functions.ttcn PFCP_Templates.ttcn PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn "
FILES+="Mutex.ttcn "
+FILES+="HTTP2_CodecPort.ttcn HTTP2_CodecPort_CtrlFunct.ttcn HTTP2_CodecPort_CtrlFunctDef.cc HTTP2_Templates.ttcn HTTP2_Functions.ttcn HTTP2_Adapter.ttcn HTTP2_Server_Emulation.ttcn "
+FILES+="TS29503_Nudm_SDM_Templates.ttcn TS29502_Nsmf_PDUSession_Templates.ttcn TS29512_Npcf_SMPolicyControl_Templates.ttcn TS29518_Namf_Communication_Templates.ttcn"
gen_links $DIR $FILES
gen_links_finish
diff --git a/smf/open5gs-nrf.yaml b/smf/open5gs-nrf.yaml
index 0979be0..57f5b45 100644
--- a/smf/open5gs-nrf.yaml
+++ b/smf/open5gs-nrf.yaml
@@ -3,7 +3,7 @@
db_uri: mongodb://localhost/open5gs
logger:
- level: info
+ level: debug
global:
max:
diff --git a/smf/open5gs-smf.yaml b/smf/open5gs-smf.yaml
index 34aabc3..f37de82 100644
--- a/smf/open5gs-smf.yaml
+++ b/smf/open5gs-smf.yaml
@@ -1,7 +1,7 @@
# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/smf.yaml.in
logger:
- level: info
+ level: debug
global:
max:
@@ -25,8 +25,8 @@
- address: 127.0.0.4
port: 7777
client:
- nrf:
- - uri: http://127.0.0.10:7777
+ #nrf:
+ # - uri: http://127.0.0.10:7777
scp:
- uri: http://127.0.1.10:7777
pfcp:
diff --git a/smf/regen_makefile.sh b/smf/regen_makefile.sh
index a2cb4bc..ad9ebd0 100755
--- a/smf/regen_makefile.sh
+++ b/smf/regen_makefile.sh
@@ -2,7 +2,7 @@
NAME=SMF_Tests
-FILES="
+FILES=" *.asn
*.ttcn
*.ttcnpp
BSSGP_EncDec.cc
@@ -13,6 +13,8 @@
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
GTPv2_CodecPort_CtrlFunctDef.cc
+ HTTP2_EncDec.cc
+ HTTP2_CodecPort_CtrlFunctDef.cc
ICMP_EncDec.cc
ICMPv6_EncDec.cc
IPL4asp_PT.cc
diff --git a/smf/testenv.cfg b/smf/testenv.cfg
index b6cbb10..837073a 100644
--- a/smf/testenv.cfg
+++ b/smf/testenv.cfg
@@ -2,12 +2,6 @@
program=SMF_Tests
config=SMF_Tests.cfg
-[nrf]
-program=open5gs-nrfd -c open5gs-nrf.yaml
-make=open5gs
-package=open5gs-nrf
-copy=open5gs-nrf.yaml
-
[smf]
program=open5gs-smfd -c open5gs-smf.yaml
make=open5gs
--
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: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I377b748d8da6e9e53a96a85f1c730505793ecea8
Gerrit-Change-Number: 43651
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1
0
[S] Change in onomondo-eim[master]: crypto_utils: log EID instead of the entire EUM certificate
by dexter 16 Sep '26
by dexter 16 Sep '26
16 Sep '26
Attention is currently required from: dexter.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/onomondo-eim/+/43647?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: crypto_utils: log EID instead of the entire EUM certificate
......................................................................
crypto_utils: log EID instead of the entire EUM certificate
When a profile download happens, the eIM automatically tries to check
the EUM and the eUICC certificate. This is done in order to cache the
public key of the eUICC certificate. For the check, a suitable root
certificate is required. If none is found, an error is logged with the
entire EUM certificate as context. Let's instead log the EID of the
eUICC that caused the problem, which is much more helpful then just
a certificate dump that is barely readable.
Related: SYS#8100
Change-Id: I33c19fee0bec31b4c6b3c8052976625f3213aac1
---
M src/crypto_utils.erl
1 file changed, 8 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/47/43647/2
--
To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43647?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: onomondo-eim
Gerrit-Branch: master
Gerrit-Change-Id: I33c19fee0bec31b4c6b3c8052976625f3213aac1
Gerrit-Change-Number: 43647
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1
0
[S] Change in onomondo-eim[master]: crypto_utils: log EID instead of entire EUM certificate
by dexter 16 Sep '26
by dexter 16 Sep '26
16 Sep '26
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43647?usp=email )
Change subject: crypto_utils: log EID instead of entire EUM certificate
......................................................................
crypto_utils: log EID instead of entire EUM certificate
When a profile download happens, the eIM automatically tries to check
the EUM and the eUICC certificate. This is done in order to cache the
public key of the eUICC certificate. For the check, a suitable root
certificate is required. If none is found, an error is logged with the
entire EUM certificate as context. Let's instead log the EID of the
eUICC that caused the problem, which is much more helpful then just
a certificate dump that is barely readable.
Related: SYS#8100
Change-Id: I33c19fee0bec31b4c6b3c8052976625f3213aac1
---
M src/crypto_utils.erl
1 file changed, 7 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/47/43647/1
diff --git a/src/crypto_utils.erl b/src/crypto_utils.erl
index 49f5a25..0097074 100644
--- a/src/crypto_utils.erl
+++ b/src/crypto_utils.erl
@@ -205,14 +205,12 @@
error
end.
-get_root_cert(EumCertificate, []) ->
+get_root_cert(_, EidValue, []) ->
logger:error(
- "Certificate verification failed, no root certificate found,~nEumCertificate=~p~n", [
- EumCertificate
- ]
+ "unable to verify eUICC/EUM certificate, no suitable root certificate found,~nEidValue=~p~n", [EidValue]
),
error;
-get_root_cert(EumCertificate, RootCiCerts) ->
+get_root_cert(EumCertificate, EidValue, RootCiCerts) ->
[RootCiCert | RootCiCertsTail] = RootCiCerts,
{ok, RootCiCertPath} = utils:get_priv_file_path(onomondo_eim, RootCiCert),
{ok, RootCiCertPem} = file:read_file(RootCiCertPath),
@@ -222,12 +220,12 @@
true ->
{ok, RootCiCertPem};
_ ->
- get_root_cert(EumCertificate, RootCiCertsTail)
+ get_root_cert(EumCertificate, EidValue, RootCiCertsTail)
end.
-verify_euicc_cert(EumCertificate, EuiccCertificate) ->
+verify_euicc_cert(EumCertificate, EuiccCertificate, EidValue) ->
{ok, RootCiCerts} = application:get_env(onomondo_eim, root_ci_certs),
- case get_root_cert(EumCertificate, RootCiCerts) of
+ case get_root_cert(EumCertificate, EidValue, RootCiCerts) of
{ok, RootCiCertPem} ->
[{'Certificate', RootCiCertBer, not_encrypted}] = public_key:pem_decode(RootCiCertPem),
{ok, RootCiCert} = 'PKIX1Explicit88':decode('Certificate', RootCiCertBer),
@@ -264,7 +262,7 @@
end.
store_euicc_pubkey(EumCertificate, EuiccCertificate, EidValue) ->
- case verify_euicc_cert(EumCertificate, EuiccCertificate) of
+ case verify_euicc_cert(EumCertificate, EuiccCertificate, EidValue) of
ok ->
{{'ECPoint', SignPubKey}, {namedCurve, NamedCurve}} = pubkey_from_cert(
EuiccCertificate
--
To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43647?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: I33c19fee0bec31b4c6b3c8052976625f3213aac1
Gerrit-Change-Number: 43647
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1
0