aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-11-11 03:40:26 +0100
committerlaforge <laforge@osmocom.org>2020-05-11 17:31:57 +0000
commitb2168516f34be9bed449850420dbda391cf893c7 (patch)
tree7e4b980d953ca2611717bc90462004c1a3e1e5b2
parentb3fc898c2d605c0fa27a119d7c08d7c3c43652cc (diff)
hlr: add tests for GSUP proxy routing
GSUP proxy routing, as it is implemented in an upcoming osmo-hlr patch, requires that osmo-hlr returns a received Source Name IE back as Destination Name IE. Add tests for these, for various situations. These tests pass since GSUP request handling with request->response association was introduced to osmo-hlr in I179ebb0385b5b355f4740e14d43be97bf93622e3. Implement this by adding a source_name to the g_pars, which should be sent out in ts_GSUP_* to osmo-hlr, and expected back as destination_name in returned messages. Add source_name and destination_name to various templates, with default := omit. Add f_gen_ts_ies() and f_gen_tr_ies() to compose expected IEs more generically. Change-Id: I3728776d862c5e5fa7628ca28d74c1ef247459fa
-rw-r--r--hlr/HLR_Tests.ttcn162
-rw-r--r--library/GSUP_Types.ttcn152
2 files changed, 245 insertions, 69 deletions
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 0dd3cadf..06354b9e 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -110,26 +110,38 @@ type component HLR_ConnHdlr extends GSUP_ConnHdlr {
type record HLR_ConnHdlrPars {
HlrSubscriber sub,
- HLR_ConnHdlrParsUssd ussd optional
+ HLR_ConnHdlrParsUssd ussd optional,
+ octetstring source_name optional
}
type record HLR_ConnHdlrParsUssd {
OCT4 sid
}
-template (value) HLR_ConnHdlrPars t_Pars(hexstring imsi, hexstring msisdn := ''H) := {
+template (value) HLR_ConnHdlrPars t_Pars(hexstring imsi, hexstring msisdn := ''H,
+ template (omit) octetstring source_name := omit) := {
sub := {
imsi := imsi,
msisdn := msisdn,
aud2g := omit,
aud3g := omit
},
- ussd := omit
+ ussd := omit,
+ source_name := source_name
}
+template (value) HLR_ConnHdlrPars t_Pars_via_proxy(hexstring imsi, hexstring msisdn := ''H) :=
+ t_Pars(imsi, msisdn, source_name := char2oct("the-source\n"));
template (value) HLR_ConnHdlrPars t_Pars_sub(HlrSubscriber sub) := {
sub := sub,
- ussd := omit
+ ussd := omit,
+ source_name := omit
+}
+
+template (value) HLR_ConnHdlrPars t_Pars_sub_via_proxy(HlrSubscriber sub) := {
+ sub := sub,
+ ussd := omit,
+ source_name := char2oct("the-source\n")
}
type function void_fn() runs on HLR_ConnHdlr;
@@ -530,7 +542,8 @@ runs on HLR_ConnHdlr return GSUP_PDU {
function f_perform_UL(hexstring imsi, template hexstring msisdn,
template (omit) integer exp_err_cause := omit,
- GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS)
+ GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS,
+ template (omit) octetstring source_name := omit)
runs on HLR_ConnHdlr return GSUP_PDU {
var GSUP_PDU ret;
timer T := 3.0;
@@ -540,34 +553,34 @@ runs on HLR_ConnHdlr return GSUP_PDU {
exp_fail := true;
}
- GSUP.send(valueof(ts_GSUP_UL_REQ(imsi, dom)));
+ GSUP.send(valueof(ts_GSUP_UL_REQ(imsi, dom, source_name := source_name)));
T.start;
alt {
- [exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, exp_err_cause)) -> value ret {
+ [exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, exp_err_cause, destination_name := source_name)) -> value ret {
setverdict(pass);
}
- [exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, ?)) -> value ret {
+ [exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, ?, destination_name := source_name)) -> value ret {
setverdict(fail, "Unexpected UL ERROR Cause");
mtc.stop;
}
- [exp_fail] GSUP.receive(tr_GSUP_UL_RES(imsi)) -> value ret {
+ [exp_fail] GSUP.receive(tr_GSUP_UL_RES(imsi, destination_name := source_name)) -> value ret {
setverdict(fail, "Unexpected UL.res for unknown IMSI");
mtc.stop;
}
- [exp_fail] GSUP.receive(tr_GSUP_ISD_REQ(imsi)) -> value ret {
+ [exp_fail] GSUP.receive(tr_GSUP_ISD_REQ(imsi, destination_name := source_name)) -> value ret {
setverdict(fail, "Unexpected ISD.req in error case");
mtc.stop;
}
- [not exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, ?)) -> value ret {
+ [not exp_fail] GSUP.receive(tr_GSUP_UL_ERR(imsi, ?, destination_name := source_name)) -> value ret {
setverdict(fail, "Unexpected UL ERROR");
mtc.stop;
}
- [not exp_fail and not isd_done] GSUP.receive(tr_GSUP_ISD_REQ(imsi, msisdn)) -> value ret {
- GSUP.send(ts_GSUP_ISD_RES(imsi));
+ [not exp_fail and not isd_done] GSUP.receive(tr_GSUP_ISD_REQ(imsi, msisdn, destination_name := source_name)) -> value ret {
+ GSUP.send(ts_GSUP_ISD_RES(imsi, source_name := source_name));
isd_done := true;
repeat;
}
- [not exp_fail and isd_done] GSUP.receive(tr_GSUP_UL_RES(imsi)) -> value ret {
+ [not exp_fail and isd_done] GSUP.receive(tr_GSUP_UL_RES(imsi, destination_name := source_name)) -> value ret {
setverdict(pass);
}
[] GSUP.receive { repeat; }
@@ -612,7 +625,7 @@ runs on HLR_ConnHdlr {
GSUP.receive(tr_GSUP_UL_REQ(imsi)) from vc_GSUP_server;
GSUP.send(ts_GSUP_ISD_REQ(imsi, msisdn, destination_name)) to vc_GSUP_server;
GSUP.receive(tr_GSUP_ISD_REQ(imsi, g_pars.sub.msisdn)) from vc_GSUP_client;
- GSUP.send(ts_GSUP_ISD_RES(imsi, destination_name)) to vc_GSUP_server;
+ GSUP.send(ts_GSUP_ISD_RES(imsi, destination_name := destination_name)) to vc_GSUP_server;
GSUP.receive(tr_GSUP_ISD_RES(imsi)) from vc_GSUP_client;
GSUP.send(ts_GSUP_UL_RES(imsi, destination_name)) to vc_GSUP_server;
GSUP.receive(tr_GSUP_UL_RES(imsi)) from vc_GSUP_client;
@@ -694,7 +707,8 @@ runs on HLR_ConnHdlr return GSUP_PDU {
}
private function f_SS_expect(hexstring imsi, OCT4 sid, GSUP_SessionState state,
- template SS_FacilityInformation facility := *)
+ template SS_FacilityInformation facility := *,
+ template octetstring destination_name := omit)
runs on HLR_ConnHdlr return GSUP_PDU {
var GSUP_PDU ret;
timer T := 3.0;
@@ -708,7 +722,7 @@ runs on HLR_ConnHdlr return GSUP_PDU {
setverdict(fail, "Unexpected PROC_SS ERROR Cause");
mtc.stop;
}
- [not exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, omit)) -> value ret {
+ [not exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, omit, destination_name := destination_name)) -> value ret {
setverdict(pass);
}
[exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, omit)) -> value ret {
@@ -716,12 +730,12 @@ runs on HLR_ConnHdlr return GSUP_PDU {
mtc.stop;
}
/*
- [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, decmatch facility)) -> value ret {
+ [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, decmatch facility, destination_name := destination_name)) -> value ret {
setverdict(pass);
}
*/
- [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, ?)) -> value ret {
+ [exp_ss] GSUP.receive(tr_GSUP_PROC_SS_RES(imsi, sid, state, ?, destination_name := destination_name)) -> value ret {
var GSUP_IeValue ss_ie;
f_gsup_find_ie(ret, OSMO_GSUP_SS_INFO_IE, ss_ie);
var SS_FacilityInformation dec_fac := dec_SS_FacilityInformation(ss_ie.ss_info);
@@ -748,7 +762,8 @@ runs on HLR_ConnHdlr return GSUP_PDU {
function f_perform_CHECK_IMEI(hexstring imsi, hexstring imei,
template (omit) integer exp_err_cause := omit,
- template (omit) GSUP_IMEIResult result := omit)
+ template (omit) GSUP_IMEIResult result := omit,
+ template (omit) octetstring source_name := omit)
runs on HLR_ConnHdlr {
var GSUP_PDU pdu;
timer T := 3.0;
@@ -757,28 +772,28 @@ runs on HLR_ConnHdlr {
exp_fail := true;
}
- GSUP.send(valueof(ts_GSUP_CHECK_IMEI_REQ(imsi, imei)));
+ GSUP.send(valueof(ts_GSUP_CHECK_IMEI_REQ(imsi, imei, source_name := source_name)));
T.start;
alt {
- [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, exp_err_cause)) -> value pdu {
+ [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, exp_err_cause, destination_name := source_name)) -> value pdu {
setverdict(pass);
}
- [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, ?)) -> value pdu {
+ [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, ?, destination_name := source_name)) -> value pdu {
setverdict(fail, "Unexpected CHECK IMEI ERROR Cause: ", pdu);
mtc.stop;
}
- [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, ?)) -> value pdu {
+ [exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, ?, destination_name := source_name)) -> value pdu {
setverdict(fail, "Unexpected CHECK IMEI RES instead of ERR");
mtc.stop;
}
- [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, ?)) -> value pdu {
+ [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_ERR(imsi, ?, destination_name := source_name)) -> value pdu {
setverdict(fail, "Unexpected CHECK IMEI ERROR");
mtc.stop;
}
- [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, result)) -> value pdu {
+ [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, result, destination_name := source_name)) -> value pdu {
setverdict(pass);
}
- [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, ?)) -> value pdu {
+ [not exp_fail] GSUP.receive(tr_GSUP_CHECK_IMEI_RES(imsi, ?, destination_name := source_name)) -> value pdu {
setverdict(fail, "Unexpected CHECK IMEI RES");
mtc.stop;
}
@@ -827,10 +842,15 @@ testcase TC_gsup_sai_err_unknown_imsi() runs on test_CT {
vc_conn.done;
}
-function f_start_handler_per_sub(void_fn fn, HlrSubscriberList sl) runs on test_CT {
+function f_start_handler_per_sub(void_fn fn, HlrSubscriberList sl, boolean via_proxy := false) runs on test_CT {
for (var integer i := 0; i < sizeof(sl); i := i+1) {
var HlrSubscriber sub := sl[i];
- var HLR_ConnHdlrPars pars := valueof(t_Pars_sub(sub));
+ var HLR_ConnHdlrPars pars;
+ if (via_proxy) {
+ pars := valueof(t_Pars_sub_via_proxy(sub));
+ } else {
+ pars := valueof(t_Pars_sub(sub));
+ }
var HLR_ConnHdlr vc_conn;
f_vty_subscr_create(VTY, sub);
@@ -951,8 +971,7 @@ testcase TC_gsup_sai_eps() runs on test_CT {
/* test UL for unknown IMSI */
private function f_TC_ul_unknown_imsi() runs on HLR_ConnHdlr {
- var GSUP_PDU res;
- res := f_perform_UL(g_pars.sub.imsi, ?, 2);
+ f_perform_UL(g_pars.sub.imsi, ?, 2, source_name := g_pars.source_name);
setverdict(pass);
}
testcase TC_gsup_ul_unknown_imsi() runs on test_CT {
@@ -964,11 +983,20 @@ testcase TC_gsup_ul_unknown_imsi() runs on test_CT {
vc_conn := f_start_handler(refers(f_TC_ul_unknown_imsi), pars);
vc_conn.done;
}
+testcase TC_gsup_ul_unknown_imsi_via_proxy() runs on test_CT {
+ var hexstring imsi := f_rnd_imsi('26242'H);
+ var HLR_ConnHdlrPars pars := valueof(t_Pars_via_proxy(imsi));
+ var HLR_ConnHdlr vc_conn;
+
+ f_init(false);
+ vc_conn := f_start_handler(refers(f_TC_ul_unknown_imsi), pars);
+ vc_conn.done;
+}
/* test UL for a number of different subscriber cases (algo, 2g/3g, ...) */
private function f_TC_gsup_ul() runs on HLR_ConnHdlr {
var GSUP_PDU res;
- res := f_perform_UL(g_pars.sub.imsi, g_pars.sub.msisdn);
+ res := f_perform_UL(g_pars.sub.imsi, g_pars.sub.msisdn, source_name := g_pars.source_name);
setverdict(pass);
}
testcase TC_gsup_ul() runs on test_CT {
@@ -981,6 +1009,16 @@ testcase TC_gsup_ul() runs on test_CT {
setverdict(pass);
}
+testcase TC_gsup_ul_via_proxy() runs on test_CT {
+ var HlrSubscriberList sl;
+ var GSUP_PDU res;
+
+ f_init(false);
+ sl := f_gen_subs();
+ f_start_handler_per_sub(refers(f_TC_gsup_ul), sl, via_proxy := true);
+
+ setverdict(pass);
+}
/* Test only the VTY commands */
testcase TC_vty() runs on test_CT {
@@ -1171,12 +1209,14 @@ private function f_TC_mo_ussd_iuse_imsi() runs on HLR_ConnHdlr {
op_code := SS_OP_CODE_PROCESS_USS_REQ,
ussd_string := "*#101#");
GSUP.send(valueof(ts_GSUP_PROC_SS_REQ(g_pars.sub.imsi, g_pars.ussd.sid,
- OSMO_GSUP_SESSION_STATE_BEGIN, ss)));
+ OSMO_GSUP_SESSION_STATE_BEGIN, ss,
+ source_name := g_pars.source_name)));
resp_str := "Your IMSI is " & hex2str(g_pars.sub.imsi);
res := f_SS_expect(g_pars.sub.imsi, g_pars.ussd.sid,
OSMO_GSUP_SESSION_STATE_END,
tr_SS_USSD_FACILITY_RETURN_RESULT(1, 59, SS_USSD_DEFAULT_DCS,
- f_encGSM7bit(resp_str)));
+ f_encGSM7bit(resp_str)),
+ destination_name := g_pars.source_name);
}
testcase TC_mo_ussd_iuse_imsi() runs on test_CT {
var HlrSubscriberList sl;
@@ -1192,6 +1232,20 @@ testcase TC_mo_ussd_iuse_imsi() runs on test_CT {
vc_conn.done;
}
}
+testcase TC_mo_ussd_iuse_imsi_via_proxy() runs on test_CT {
+ var HlrSubscriberList sl;
+ var HLR_ConnHdlr vc_conn;
+
+ f_init(false);
+ sl := f_gen_subs();
+ for (var integer i := 0; i < sizeof(sl); i := i+1) {
+ var HLR_ConnHdlrPars pars := valueof(t_Pars_sub_via_proxy(sl[i]));
+ pars.ussd.sid := f_rnd_octstring(4);
+ f_vty_subscr_create(VTY, pars.sub);
+ vc_conn := f_start_handler(refers(f_TC_mo_ussd_iuse_imsi), pars);
+ vc_conn.done;
+ }
+}
/* Test for USSD request to internal own-msisdn IUSE. */
private function f_TC_mo_ussd_iuse_msisdn() runs on HLR_ConnHdlr {
@@ -1201,12 +1255,14 @@ private function f_TC_mo_ussd_iuse_msisdn() runs on HLR_ConnHdlr {
op_code := SS_OP_CODE_PROCESS_USS_REQ,
ussd_string := "*#100#");
GSUP.send(valueof(ts_GSUP_PROC_SS_REQ(g_pars.sub.imsi, g_pars.ussd.sid,
- OSMO_GSUP_SESSION_STATE_BEGIN, ss)));
+ OSMO_GSUP_SESSION_STATE_BEGIN, ss,
+ source_name := g_pars.source_name)));
resp_str := "Your extension is " & hex2str(g_pars.sub.msisdn);
res := f_SS_expect(g_pars.sub.imsi, g_pars.ussd.sid,
OSMO_GSUP_SESSION_STATE_END,
tr_SS_USSD_FACILITY_RETURN_RESULT(1, 59, SS_USSD_DEFAULT_DCS,
- f_encGSM7bit(resp_str)));
+ f_encGSM7bit(resp_str)),
+ destination_name := g_pars.source_name);
}
testcase TC_mo_ussd_iuse_msisdn() runs on test_CT {
var HlrSubscriberList sl;
@@ -1222,6 +1278,20 @@ testcase TC_mo_ussd_iuse_msisdn() runs on test_CT {
vc_conn.done;
}
}
+testcase TC_mo_ussd_iuse_msisdn_via_proxy() runs on test_CT {
+ var HlrSubscriberList sl;
+ var HLR_ConnHdlr vc_conn;
+
+ f_init(false);
+ sl := f_gen_subs();
+ for (var integer i := 0; i < sizeof(sl); i := i+1) {
+ var HLR_ConnHdlrPars pars := valueof(t_Pars_sub_via_proxy(sl[i]));
+ pars.ussd.sid := f_rnd_octstring(4);
+ f_vty_subscr_create(VTY, pars.sub);
+ vc_conn := f_start_handler(refers(f_TC_mo_ussd_iuse_msisdn), pars);
+ vc_conn.done;
+ }
+}
/* Test routing of USSD to EUSE by a specific route */
private function f_TC_mo_ussd_100() runs on HLR_ConnHdlr {
@@ -1402,12 +1472,14 @@ testcase TC_mo_sss_reject() runs on test_CT {
private function f_TC_gsup_check_imei() runs on HLR_ConnHdlr {
/* store-imei disabled */
f_vty_config(VTY, "hlr", "no store-imei");
- f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+ f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK,
+ source_name := g_pars.source_name);
f_vty_subscr_show_nomatch(VTY, g_pars.sub, pattern "*IMEI: *12345678901234*");
/* store-imei enabled */
f_vty_config(VTY, "hlr", "store-imei");
- f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK);
+ f_perform_CHECK_IMEI(g_pars.sub.imsi, '12345678901234'H, result := OSMO_GSUP_IMEI_RESULT_ACK,
+ source_name := g_pars.source_name);
f_vty_subscr_show(VTY, g_pars.sub, pattern "*IMEI: *12345678901234*");
}
testcase TC_gsup_check_imei() runs on test_CT {
@@ -1419,6 +1491,15 @@ testcase TC_gsup_check_imei() runs on test_CT {
setverdict(pass);
}
+testcase TC_gsup_check_imei_via_proxy() runs on test_CT {
+ var HlrSubscriberList sl;
+
+ f_init(false);
+ sl := f_gen_subs();
+ f_start_handler_per_sub(refers(f_TC_gsup_check_imei), sl, via_proxy := true);
+
+ setverdict(pass);
+}
/* Test Check IMEI with invalid IMEI length */
private function f_TC_gsup_check_imei_invalid_len() runs on HLR_ConnHdlr {
@@ -1861,8 +1942,10 @@ control {
execute( TC_gsup_sai_num_auth_vectors() );
execute( TC_gsup_sai_eps() );
execute( TC_gsup_ul_unknown_imsi() );
+ execute( TC_gsup_ul_unknown_imsi_via_proxy() );
execute( TC_gsup_sai_err_unknown_imsi() );
execute( TC_gsup_ul() );
+ execute( TC_gsup_ul_via_proxy() );
execute( TC_vty() );
execute( TC_vty_msisdn_isd() );
execute( TC_gsup_purge_cs() );
@@ -1872,7 +1955,9 @@ control {
execute( TC_mo_ussd_unknown() );
execute( TC_mo_ussd_euse_disc() );
execute( TC_mo_ussd_iuse_imsi() );
+ execute( TC_mo_ussd_iuse_imsi_via_proxy() );
execute( TC_mo_ussd_iuse_msisdn() );
+ execute( TC_mo_ussd_iuse_msisdn_via_proxy() );
execute( TC_mo_ussd_euse() );
execute( TC_mo_ussd_euse_continue() );
execute( TC_mo_ussd_euse_defaultroute() );
@@ -1881,6 +1966,7 @@ control {
execute( TC_mo_sss_reject() );
execute( TC_gsup_check_imei() );
+ execute( TC_gsup_check_imei_via_proxy() );
execute( TC_gsup_check_imei_invalid_len() );
execute( TC_gsup_check_imei_unknown_imsi() );
execute( TC_subscr_create_on_demand_check_imei_early() );
diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index fa912c1c..41181e8a 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -495,9 +495,10 @@ template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) :=
tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * });
-template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS) :=
- ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, {
- valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) });
+template GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS,
+ template octetstring source_name := omit) :=
+ ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, f_gen_ts_ies(imsi, dom := dom,
+ source_name := source_name));
template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) :=
tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi);
@@ -506,30 +507,34 @@ template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi, octetstring destination
ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)),
valueof(ts_GSUP_IE_Destination_Name(destination_name))});
-template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) :=
- tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi);
+template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi, template octetstring destination_name := omit) :=
+ tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, f_gen_tr_ies(imsi, destination_name := destination_name));
template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) :=
ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
-template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) :=
- tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
- tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
+template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?,
+ template octetstring destination_name := omit) :=
+ tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR,
+ f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name));
template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn, octetstring destination_name := ''O) :=
ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)),
valueof(ts_GSUP_IE_Destination_Name(destination_name))});
-template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) :=
- tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
- tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * });
+template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?,
+ template octetstring destination_name := omit) :=
+ tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST,
+ f_gen_tr_ies(imsi, msisdn := msisdn, destination_name := destination_name));
-template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi, octetstring destination_name := ''O) :=
- ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, {
- valueof(ts_GSUP_IE_IMSI(imsi)),
- valueof(ts_GSUP_IE_Destination_Name(destination_name))});
+template GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi,
+ template octetstring source_name := omit,
+ template octetstring destination_name := omit) :=
+ ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT,
+ f_gen_ts_ies(imsi, source_name := source_name,
+ destination_name := destination_name));
template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) :=
tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi);
@@ -568,9 +573,9 @@ template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer
tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, {
tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
-template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei) :=
- ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, {
- valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI(imei)) });
+template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei,
+ template (omit) octetstring source_name := omit) :=
+ ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, f_gen_ts_ies(imsi, imei := imei, source_name := source_name));
template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ(
template hexstring imsi,
@@ -588,17 +593,18 @@ template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult
ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) });
-template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) :=
- tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
- tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) });
+template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result,
+ template octetstring destination_name := omit) :=
+ tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT,
+ f_gen_tr_ies(imsi, imei_result := result, destination_name := destination_name));
template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) :=
ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
-template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) :=
- tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
- tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
+template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause,
+ template octetstring destination_name := omit) :=
+ tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name));
template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
@@ -758,7 +764,7 @@ template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
}
}
-template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := {
+template GSUP_IE ts_GSUP_IE_CnDomain(template GSUP_CnDomain dom) := {
tag := OSMO_GSUP_CN_DOMAIN_IE,
len := 0, /* overwritten */
val := {
@@ -1217,13 +1223,85 @@ template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := {
}
}
+private function f_gen_ts_ies(hexstring imsi,
+ template hexstring imei := omit,
+ template GSUP_CnDomain dom := omit,
+ template octetstring source_name := omit,
+ template octetstring destination_name := omit
+ ) return GSUP_IEs {
+ var GSUP_IEs ies := {
+ valueof(ts_GSUP_IE_IMSI(imsi))
+ };
+
+ if (isvalue(dom)) {
+ ies := ies & { valueof(ts_GSUP_IE_CnDomain(dom)) };
+ }
+
+ if (isvalue(imei)) {
+ ies := ies & { valueof(ts_GSUP_IE_IMEI(valueof(imei))) };
+ }
+
+ if (isvalue(source_name)) {
+ ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) };
+ }
+
+ if (isvalue(destination_name)) {
+ ies := ies & { valueof(ts_GSUP_IE_Destination_Name(valueof(destination_name))) };
+ }
+
+ return ies;
+}
+
+private function f_gen_tr_ies(template hexstring imsi,
+ template integer cause := omit,
+ template hexstring msisdn := omit,
+ template GSUP_IMEIResult imei_result := omit,
+ template octetstring source_name := omit,
+ template octetstring destination_name := omit
+ ) return template GSUP_IEs {
+ var template GSUP_IEs ies := {
+ tr_GSUP_IE_IMSI(imsi)
+ };
+ var integer idx := 1;
+
+ if (isvalue(cause)) {
+ ies[idx] := tr_GSUP_IE_Cause(cause);
+ idx := idx + 1;
+ }
+
+ if (isvalue(msisdn)) {
+ ies[idx] := tr_GSUP_IE_MSISDN(msisdn);
+ idx := idx + 1;
+ }
+
+ if (isvalue(imei_result)) {
+ ies[idx] := tr_GSUP_IE_IMEI_Result(imei_result);
+ idx := idx + 1;
+ }
+
+ if (isvalue(source_name)) {
+ ies[idx] := tr_GSUP_IE_Source_Name(source_name);
+ idx := idx + 1;
+ }
+
+ ies[idx] := *;
+ idx := idx + 1;
+
+ if (isvalue(destination_name)) {
+ ies[idx] := tr_GSUP_IE_Destination_Name(destination_name);
+ idx := idx + 1;
+ }
+
+ return ies;
+}
private function f_gen_ts_ss_ies(
hexstring imsi,
OCT4 sid,
GSUP_SessionState state,
template (omit) octetstring ss := omit,
- template (omit) integer cause := omit
+ template (omit) integer cause := omit,
+ template octetstring source_name := omit
) return GSUP_IEs {
/* Mandatory IEs */
var GSUP_IEs ies := {
@@ -1244,6 +1322,10 @@ private function f_gen_ts_ss_ies(
ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
}
+ if (isvalue(source_name)) {
+ ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) };
+ }
+
return ies;
}
private function f_gen_tr_ss_ies(
@@ -1251,7 +1333,8 @@ private function f_gen_tr_ss_ies(
template OCT4 sid := ?,
template GSUP_SessionState state := ?,
template octetstring ss := omit,
- template integer cause := omit
+ template integer cause := omit,
+ template octetstring destination_name := omit
) return template GSUP_IEs {
/* Mandatory IEs */
var template GSUP_IEs ies := {
@@ -1282,6 +1365,11 @@ private function f_gen_tr_ss_ies(
idx := idx + 1;
}
+ if (isvalue(destination_name)) {
+ ies[idx] := tr_GSUP_IE_Destination_Name(destination_name);
+ idx := idx + 1;
+ }
+
/* the GSUP Message Class IE is optional, as old implementations don't have it yet */
var template GSUP_IEs ies2 := ies;
ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
@@ -1294,10 +1382,11 @@ template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
hexstring imsi,
OCT4 sid,
GSUP_SessionState state,
- template (omit) octetstring ss := omit
+ template (omit) octetstring ss := omit,
+ template (omit) octetstring source_name := omit
) := ts_GSUP(
OSMO_GSUP_MSGT_PROC_SS_REQUEST,
- f_gen_ts_ss_ies(imsi, sid, state, ss)
+ f_gen_ts_ss_ies(imsi, sid, state, ss, source_name := source_name)
);
template GSUP_PDU tr_GSUP_PROC_SS_REQ(
template hexstring imsi,
@@ -1322,10 +1411,11 @@ template GSUP_PDU tr_GSUP_PROC_SS_RES(
template hexstring imsi,
template OCT4 sid := ?,
template GSUP_SessionState state := ?,
- template octetstring ss := *
+ template octetstring ss := *,
+ template octetstring destination_name := omit
) := tr_GSUP(
OSMO_GSUP_MSGT_PROC_SS_RESULT,
- f_gen_tr_ss_ies(imsi, sid, state, ss)
+ f_gen_tr_ss_ies(imsi, sid, state, ss, destination_name := destination_name)
);
template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(