summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-01-29 15:06:54 +0100
committerOliver Smith <osmith@sysmocom.de>2020-01-29 15:39:37 +0100
commit33da2def50b7f456aa9896fcbb005dc1adc66f74 (patch)
tree67a33f414fa4e907bc63c4aba3e53e2898132a24
parent043a73ac3e31e47eb8a1041743d423d3162da8e3 (diff)
hlr: new test: TC_MSLookup_GSUP_proxyosmith/dgsm
Let OsmoHLR act as proxy between MSC and another HLR during Location Update. Related: OS#4380 Change-Id: I945e651f1346e56dbe3c02d9d08ccd95cc8d6626
-rw-r--r--hlr/HLR_Tests.ttcn53
-rwxr-xr-xhlr/gen_links.sh2
-rw-r--r--library/MSLookup_mDNS_Templates.ttcn83
3 files changed, 137 insertions, 1 deletions
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 2becad8..e01e0fa 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -34,6 +34,7 @@ import from TELNETasp_PortType all;
import from MSLookup_mDNS_Types all;
import from MSLookup_mDNS_Emulation all;
import from MSLookup_mDNS_Templates all;
+import from DNS_Helpers all;
type component test_CT extends CTRL_Adapter_CT {
/* emulated GSUP client (MSC/SGSN) */
@@ -1651,6 +1652,57 @@ testcase TC_MSLookup_mDNS_server() runs on test_CT {
vc_conn.done;
}
+/* Let OsmoHLR act as proxy between MSC and another HLR during UL */
+private function f_TC_MSLookup_GSUP_proxy() runs on HLR_ConnHdlr {
+ var MSLookup_mDNS mdns_msg;
+ var integer id;
+ var hexstring imsi := g_pars.sub.imsi;
+ var hexstring msisdn := g_pars.sub.msisdn;
+ var charstring domain := "gsup.hlr." & hex2str(imsi) & ".imsi.mdns.osmocom.org";
+ var octetstring destination_name := char2oct(ccm_pars_client.ser_nr) & '00'O; /* TS-MSC IPA name */
+
+ /* [GSUP] TS-MSC => HLR proxy: Update Location Request with unknown IMSI */
+ GSUP.send(ts_GSUP_UL_REQ(imsi, OSMO_GSUP_CN_DOMAIN_CS)) to vc_GSUP_client;
+
+ /* [GSUP] TS-HLR: expect GSUP messages with that IMSI */
+ f_create_gsup_expect_explicit(hex2str(imsi), vc_GSUP_server);
+
+ /* [mDNS] TS-HLR <= HLR proxy: query for GSUP server who knows the IMSI */
+ mDNS.receive(tr_MSLookup_mDNS_query(domain)) -> value mdns_msg;
+
+ /* [mDNS] TS-HLR => HLR proxy: result with IP/port of TS GSUP server */
+ id := mdns_msg.dnsMessage.header.id;
+ mDNS.send(t_MSLookup_mDNS_result_IPv4(id, domain, f_enc_IPv4(mp_hlr_ts_ip), mp_hlr_ts_port));
+
+ /* [GSUP] TS-HLR <=> HLR proxy <=> TS-MSC: finish up UL */
+ 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.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;
+
+ setverdict(pass);
+}
+testcase TC_MSLookup_GSUP_proxy() runs on test_CT {
+ var hexstring imsi := f_rnd_imsi('26242'H);
+ var hexstring msisdn := '49161'H & f_rnd_hexstring(7, 9);
+ var HLR_ConnHdlr vc_conn;
+ var HLR_ConnHdlrPars pars := valueof(t_Pars(imsi, msisdn));
+
+ f_init(false, true);
+ f_vty_config(VTY, "mslookup", "mdns bind");
+ vc_conn := f_start_handler(refers(f_TC_MSLookup_GSUP_proxy), pars, true);
+
+ timer T := 3.0;
+ T.start;
+ alt {
+ [] vc_conn.done {}
+ [] T.timeout { setverdict(fail, "Timeout"); mtc.stop; };
+ }
+}
+
/* TODO:
* UL with ISD error
* UL with ISD timeout
@@ -1699,6 +1751,7 @@ control {
if (mp_hlr_supports_dgsm) {
execute( TC_MSLookup_mDNS_server() );
+ execute( TC_MSLookup_GSUP_proxy() );
}
};
diff --git a/hlr/gen_links.sh b/hlr/gen_links.sh
index 14a3f8d..c77920d 100755
--- a/hlr/gen_links.sh
+++ b/hlr/gen_links.sh
@@ -48,7 +48,7 @@ FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IP
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
FILES+="Osmocom_VTY_Functions.ttcn "
FILES+="SS_Templates.ttcn USSD_Helpers.ttcn "
-FILES+="MSLookup_mDNS_Types.ttcn MSLookup_mDNS_Emulation.ttcn MSLookup_mDNS_Templates.ttcn"
+FILES+="MSLookup_mDNS_Types.ttcn MSLookup_mDNS_Emulation.ttcn MSLookup_mDNS_Templates.ttcn DNS_Helpers.ttcn "
gen_links $DIR $FILES
diff --git a/library/MSLookup_mDNS_Templates.ttcn b/library/MSLookup_mDNS_Templates.ttcn
index e2426fa..e8158eb 100644
--- a/library/MSLookup_mDNS_Templates.ttcn
+++ b/library/MSLookup_mDNS_Templates.ttcn
@@ -45,6 +45,38 @@ template MSLookup_mDNS t_MSLookup_mDNS_query(integer id, charstring domain) := {
udpPort := 4266
}
+template MSLookup_mDNS tr_MSLookup_mDNS_query(charstring domain) := {
+ dnsMessage := {
+ header := {
+ id := ?,
+ qr := DNS_QUERY,
+ opCode := 0,
+ aa := false,
+ tc := false,
+ rd := false,
+ ra := false,
+ z := '000'B,
+ rCode := DNS_NO_ERROR,
+ qdCount := 1,
+ anCount := 0,
+ nsCount := 0,
+ arCount := 0
+ },
+ queries := {
+ {
+ qName := domain,
+ qType := 255,
+ qClass := DNS_IN
+ }
+ },
+ answers := {},
+ nameServerRecords := {},
+ additionalRecords := {}
+ },
+ udpAddress := ?,
+ udpPort := ?
+}
+
template MSLookup_mDNS tr_MSLookup_mDNS_result_IPv4(integer id, charstring domain, UInt32 ip_v4, integer port_v4) := {
dnsMessage := {
header := {
@@ -96,4 +128,55 @@ template MSLookup_mDNS tr_MSLookup_mDNS_result_IPv4(integer id, charstring domai
udpPort := ?
}
+template MSLookup_mDNS t_MSLookup_mDNS_result_IPv4(integer id, charstring domain, UInt32 ip_v4, integer port_v4) := {
+ dnsMessage := {
+ header := {
+ id := id,
+ qr := DNS_RESPONSE,
+ opCode := DNS_OP_QUERY,
+ aa := false,
+ tc := false,
+ rd := false,
+ ra := false,
+ z := '000'B,
+ rCode := DNS_NO_ERROR,
+ qdCount := 0,
+ anCount := 3,
+ nsCount := 0,
+ arCount := 0
+ },
+ queries := {},
+ answers := {
+ {
+ name := domain,
+ rrType := DNS_TXT,
+ rrClass := DNS_IN,
+ ttl := '00000000'O,
+ rdLength := 6,
+ rData := {txt := {"age=0"}}
+ },
+ {
+ name := domain,
+ rrType := DNS_A,
+ rrClass := DNS_IN,
+ ttl := '00000000'O,
+ rdLength := 4,
+ rData := {a := ip_v4}
+ },
+ {
+ name := domain,
+ rrType := DNS_TXT,
+ rrClass := DNS_IN,
+ ttl := '00000000'O,
+ rdLength := 1 + lengthof("port=" & int2str(port_v4)),
+ rData := {txt := {"port=" & int2str(port_v4)}}
+ }
+ },
+ nameServerRecords := {},
+ additionalRecords := {}
+ },
+ udpAddress := "239.192.23.42",
+ udpPort := 4266
+}
+
}