pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43297?usp=email )
Change subject: pgw: Move generic helper find_teid to library/ ......................................................................
pgw: Move generic helper find_teid to library/
Change-Id: I7dc56e2462436edc058da72dff3dded6569a5e95 --- M library/GTPv2_Templates.ttcn M pgw/PGW_Session_CT.ttcn 2 files changed, 18 insertions(+), 18 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn index d318ace..31ec999 100644 --- a/library/GTPv2_Templates.ttcn +++ b/library/GTPv2_Templates.ttcn @@ -607,6 +607,22 @@ additionalOctets := omit }
+/* find TEID of given interface type (and optionally instance) */ +function f_GTP2C_find_teid(FullyQualifiedTEID_List list, + template (present) integer if_type, + template (present) BIT4 instance := ?) +return template (omit) FullyQualifiedTEID +{ + var integer i; + for (i := 0; i < lengthof(list); i := i+1) { + if (match(list[i].interfaceType, if_type) and + match(list[i].instance, instance)) { + return list[i]; + } + } + return omit; +} + /* 8.28 */ template (value) BearerContextIEs ts_GTP2C_BcContextIE(template (value) uint4_t ebi, diff --git a/pgw/PGW_Session_CT.ttcn b/pgw/PGW_Session_CT.ttcn index d45cad2..3de8d54 100644 --- a/pgw/PGW_Session_CT.ttcn +++ b/pgw/PGW_Session_CT.ttcn @@ -234,22 +234,6 @@ return (g_pars.rat_type == GTP2C_RAT_WLAN or g_pars.rat_type == GTP2C_RAT_Virtual); }
-/* find TEID of given interface type (and optionally instance) */ -private function f_find_teid(FullyQualifiedTEID_List list, - template (present) integer if_type, - template (present) BIT4 instance := ?) -return template (omit) FullyQualifiedTEID -{ - var integer i; - for (i := 0; i < lengthof(list); i := i+1) { - if (match(list[i].interfaceType, if_type) and - match(list[i].instance, instance)) { - return list[i]; - } - } - return omit; -} - private function f_create_sess_tun() runs on PGW_Session_CT { var template (value) UECUPS_AddrType user_addr_type; @@ -320,8 +304,8 @@
/* find F-TEID of the P-GW U side */ var FullyQualifiedTEID rx_fteid; - rx_fteid := valueof(f_find_teid(bctx.bearerContextIEs.fullyQualifiedTEID, - exp_fteid_if_type, exp_fteid_instance)); + 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;