aboutsummaryrefslogtreecommitdiffstats
path: root/hlr
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-11-29 16:01:54 +0100
committerlaforge <laforge@osmocom.org>2020-02-06 16:21:47 +0000
commitdeb80a6a82044a9cc22a1643fdc72295a496b0eb (patch)
tree95e34d8d4b612dd204fba7b7d3b985aced94c402 /hlr
parent39ca7c3fe852db906880a90cde96165fbbf0385e (diff)
hlr: add TC_MSLookup_mDNS_service_other_home
Send an mslookup mDNS request to the home HLR, asking about a service that is not "gsup.hlr". Hence the "_other" in the test name, service "gsup.hlr" has different code paths, and related tests will be added in follow-up patches. This is the first test using MSLookup_mDNS_Emulation, so add related test infrastructure. Related: OS#4380 Depends: osmo-hlr I2fe453553c90e6ee527ed13a13089900efd488aa Change-Id: Ia7f92d33691f910549353b16a7b0efc18e521719
Diffstat (limited to 'hlr')
-rw-r--r--hlr/HLR_Tests.cfg1
-rw-r--r--hlr/HLR_Tests.default5
-rw-r--r--hlr/HLR_Tests.ttcn84
-rwxr-xr-xhlr/gen_links.sh9
-rwxr-xr-xhlr/regen_makefile.sh2
5 files changed, 100 insertions, 1 deletions
diff --git a/hlr/HLR_Tests.cfg b/hlr/HLR_Tests.cfg
index 7416362d..1ab6e873 100644
--- a/hlr/HLR_Tests.cfg
+++ b/hlr/HLR_Tests.cfg
@@ -12,6 +12,7 @@
[MODULE_PARAMETERS]
+HLR_Tests.mp_hlr_supports_dgsm := true
[MAIN_CONTROLLER]
diff --git a/hlr/HLR_Tests.default b/hlr/HLR_Tests.default
index 84d4ff39..2e9aac64 100644
--- a/hlr/HLR_Tests.default
+++ b/hlr/HLR_Tests.default
@@ -11,6 +11,11 @@ mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING; // | DEBUG_ENCDEC;
*.VTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
*.VTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
*.VTY.PROMPT1 := "OsmoHLR> "
+*.mDNS_UDP.debugging := "YES"
+*.mDNS_UDP.localPort := "4266"
+*.mDNS_UDP.localIPAddr := "239.192.23.42"
+*.mDNS_UDP.broadcast := "enabled"
+*.mDNS_UDP.reuseAddr := "enabled"
[MODULE_PARAMETERS]
Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoHLR";
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index b59f86ea..c1cc1293 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -31,6 +31,10 @@ import from USSD_Helpers all;
import from Osmocom_VTY_Functions all;
import from TELNETasp_PortType all;
+import from MSLookup_mDNS_Types all;
+import from MSLookup_mDNS_Emulation all;
+import from MSLookup_mDNS_Templates all;
+
type component test_CT extends CTRL_Adapter_CT {
var IPA_Emulation_CT vc_IPA;
var IPA_CCM_Parameters ccm_pars;
@@ -43,6 +47,8 @@ type component test_CT extends CTRL_Adapter_CT {
port TELNETasp_PT VTY;
+ var MSLookup_mDNS_Emulation_CT vc_MSLookup_mDNS;
+
timer g_Tguard := 10.0;
};
@@ -53,6 +59,9 @@ modulepar {
/* how many auth tuples are expected
when IE ts_GSUP_IE_NUM_VECTORS_REQ is absent */
integer mp_default_num_auth_tuples := 5;
+
+ /* drop after osmo-hlr release > 1.2.0 */
+ boolean mp_hlr_supports_dgsm := true;
};
type record HlrSubscrAud2G {
@@ -80,6 +89,7 @@ type component HLR_ConnHdlr extends GSUP_ConnHdlr {
timer g_Tguard := 10.0;
var HLR_ConnHdlrPars g_pars;
port TELNETasp_PT VTY;
+ port MSLookup_mDNS_PT mDNS;
}
type record HLR_ConnHdlrPars {
@@ -116,6 +126,9 @@ function f_init_vty() runs on test_CT {
map(self:VTY, system:VTY);
f_vty_set_prompts(VTY);
f_vty_transceive(VTY, "enable");
+ if (mp_hlr_supports_dgsm) {
+ f_vty_config(VTY, "mslookup", "no mdns bind");
+ }
}
private altstep as_Tguard() runs on test_CT {
@@ -167,6 +180,11 @@ function f_init_gsup(charstring id, boolean legacy) runs on test_CT {
}
}
+function f_init_mslookup() runs on test_CT {
+ vc_MSLookup_mDNS := MSLookup_mDNS_Emulation_CT.create;
+ vc_MSLookup_mDNS.start(MSLookup_mDNS_Emulation.f_main());
+}
+
function f_init(boolean legacy := true) runs on test_CT {
/* activate default guard timer to ensure all tests eventually terminate */
@@ -175,6 +193,7 @@ function f_init(boolean legacy := true) runs on test_CT {
f_init_gsup("HLR_Test", legacy);
f_init_vty();
+ f_init_mslookup();
f_ipa_ctrl_start(mp_hlr_ip, mp_hlr_ctrl_port);
}
@@ -186,6 +205,7 @@ function f_start_handler(void_fn fn, HLR_ConnHdlrPars pars) runs on test_CT retu
vc_conn := HLR_ConnHdlr.create(id);
connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT);
connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC);
+ connect(vc_conn:mDNS, vc_MSLookup_mDNS:mDNS);
vc_conn.start(f_handler_init(fn, id, pars));
return vc_conn;
@@ -1511,6 +1531,66 @@ testcase TC_subscr_create_on_demand_sai() runs on test_CT {
vc_conn.done;
}
+/* Send an mslookup mDNS request to the home HLR, asking about a service that is not "gsup.hlr". (Hence the "_other" in
+ * the test name, service "gsup.hlr" has different code paths, see related tests). */
+private function f_TC_MSLookup_mDNS_service_other_home() runs on HLR_ConnHdlr {
+ timer T;
+ var MSLookup_mDNS vl_rmsg;
+ var integer id := f_rnd_int(65535); /* mDNS packet ID */
+ var hexstring msisdn := '49161'H & f_rnd_hexstring(7, 9);
+ var charstring domain := "sip.voice." & hex2str(msisdn) & ".msisdn.mdns.osmocom.org";
+
+ /* Create subscriber */
+ g_pars.sub.msisdn := msisdn;
+ f_vty_subscr_create(VTY, g_pars.sub);
+
+ /* Send mDNS query, expect timeout */
+ mDNS.send(ts_MSLookup_mDNS_query(id, domain));
+ T.start(1.0);
+ alt {
+ [] mDNS.receive(tr_MSLookup_mDNS_result_IPv4(id, domain, '42424242'O, 5060)) {
+ setverdict(fail, "OsmoHLR answered to mDNS query before subscriber did LU");
+ }
+ [] mDNS.receive(MSLookup_mDNS:?) -> value vl_rmsg {
+ repeat;
+ }
+ [] T.timeout {
+ }
+ }
+
+ /* Location update */
+ f_perform_UL(g_pars.sub.imsi, msisdn, dom := OSMO_GSUP_CN_DOMAIN_CS);
+
+ /* Send mDNS query again, expect result */
+ mDNS.send(ts_MSLookup_mDNS_query(id, domain));
+ T.start(1.0);
+ alt {
+ [] mDNS.receive(tr_MSLookup_mDNS_result_IPv4(id, domain, '42424242'O, 5060)) {
+ setverdict(pass);
+ }
+ [] mDNS.receive(MSLookup_mDNS:?) -> value vl_rmsg {
+ repeat;
+ }
+ [] T.timeout {
+ setverdict(fail, "OsmoHLR did not answer to mDNS query");
+ }
+ }
+
+ f_vty_subscr_delete(VTY, g_pars.sub);
+}
+testcase TC_MSLookup_mDNS_service_other_home() runs on test_CT {
+ var hexstring imsi := f_rnd_imsi('26242'H);
+ var HLR_ConnHdlr vc_conn;
+ var HLR_ConnHdlrPars pars := valueof(t_Pars(imsi));
+
+ f_init(false);
+ f_vty_config(VTY, "mslookup", "mdns bind");
+ f_vty_config2(VTY, {"mslookup", "server"}, "service sip.voice at 66.66.66.66 5060");
+
+ vc_conn := f_start_handler(refers(f_TC_MSLookup_mDNS_service_other_home), pars);
+ vc_conn.done;
+}
+
/* TODO:
* UL with ISD error
* UL with ISD timeout
@@ -1556,6 +1636,10 @@ control {
execute( TC_subscr_create_on_demand_check_imei_early() );
execute( TC_subscr_create_on_demand_ul() );
execute( TC_subscr_create_on_demand_sai() );
+
+ if (mp_hlr_supports_dgsm) {
+ execute( TC_MSLookup_mDNS_service_other_home() );
+ }
};
};
diff --git a/hlr/gen_links.sh b/hlr/gen_links.sh
index 872820dc..14a3f8df 100755
--- a/hlr/gen_links.sh
+++ b/hlr/gen_links.sh
@@ -35,11 +35,20 @@ FILES="MobileL3_CC_Types.ttcn MobileL3_CommonIE_Types.ttcn MobileL3_GMM_SM_Types
FILES+="SS_DataTypes.asn SS_Errors.asn SS_Operations.asn SS_PDU_Defs.asn SS_Protocol.asn SS_Types.ttcn SS_EncDec.cc"
gen_links $DIR $FILES
+DIR=$BASEDIR/titan.ProtocolModules.DNS/src
+FILES="DNS_EncDec.cc DNS_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.UDPasp/src
+FILES="UDPasp_PT.cc UDPasp_PT.hh UDPasp_PortType.ttcn UDPasp_Types.ttcn"
+gen_links $DIR $FILES
+
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp GSUP_Types.ttcn GSUP_Emulation.ttcn "
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"
gen_links $DIR $FILES
diff --git a/hlr/regen_makefile.sh b/hlr/regen_makefile.sh
index 1a1d8123..14b05daa 100755
--- a/hlr/regen_makefile.sh
+++ b/hlr/regen_makefile.sh
@@ -2,7 +2,7 @@
MAIN="HLR_Tests.ttcn"
-FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc TELNETasp_PT.cc TCCEncoding.cc SS_EncDec.cc MAP_EncDec.cc *.asn"
+FILES="*.ttcn *.ttcnpp DNS_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc TELNETasp_PT.cc TCCEncoding.cc UDPasp_PT.cc SS_EncDec.cc MAP_EncDec.cc *.asn"
export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -DIPA_EMULATION_CTRL"