hlr: add TC_MSLookup_GSUP_proxy
Let OsmoHLR act as proxy between MSC and home HLR during Location update. Related: OS#4380 Change-Id: I945e651f1346e56dbe3c02d9d08ccd95cc8d6626
This commit is contained in:
parent
d5696eb56e
commit
b51a53fdfa
|
@ -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) */
|
||||
|
@ -578,6 +579,45 @@ runs on HLR_ConnHdlr return GSUP_PDU {
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Perform Location Update with IMSI that is unknown to OsmoHLR. Let it ask for the HLR that knows the IMSI via
|
||||
* mslookup. The TTCN-3 testsuite pretends to be the home HLR, that knows the IMSI. The proxy HLR connects to the
|
||||
* home HLR and forwards GSUP messages, until LU is complete.
|
||||
* Make sure to let a timer run while calling this function (see TC_MSLookup_GSUP_proxy). */
|
||||
function f_perform_UL_proxy(hexstring imsi, hexstring msisdn, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS)
|
||||
runs on HLR_ConnHdlr {
|
||||
var MSLookup_mDNS mdns_msg;
|
||||
var integer id;
|
||||
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 */
|
||||
|
||||
/* Testing the HLR as proxy. The MSC asking the proxy and the home HLR are both enacted by TTCN3 (TS).
|
||||
* MSC=vc_GSUP_client <---> osmo-hlr as proxy <---> vc_GSUP_server=home HLR
|
||||
* GSUP.send(..) to vc_GSUP_client ---> osmo-hlr ---> GSUP.receive(..) from vc_GSUP_server
|
||||
* GSUP.receive(..) from vc_GSUP_client <--- osmo-hlr <--- GSUP.send(..) to vc_GSUP_server */
|
||||
|
||||
/* [GSUP] TS-MSC => HLR proxy: Update Location Request with unknown IMSI */
|
||||
GSUP.send(ts_GSUP_UL_REQ(imsi, dom)) 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(ts_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;
|
||||
}
|
||||
|
||||
/* perform PurgeMS for given imsi, return the GSUP response/error */
|
||||
function f_perform_PURGE(hexstring imsi, GSUP_CnDomain cn_dom,
|
||||
template (omit) integer exp_err_cause := omit)
|
||||
|
@ -1652,6 +1692,29 @@ testcase TC_MSLookup_mDNS_service_other_home() 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 {
|
||||
f_perform_UL_proxy(g_pars.sub.imsi, g_pars.sub.msisdn, OSMO_GSUP_CN_DOMAIN_CS);
|
||||
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
|
||||
|
@ -1700,6 +1763,7 @@ control {
|
|||
|
||||
if (mp_hlr_supports_dgsm) {
|
||||
execute( TC_MSLookup_mDNS_service_other_home() );
|
||||
execute( TC_MSLookup_GSUP_proxy() );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -45,6 +45,89 @@ template MSLookup_mDNS ts_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 ts_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
|
||||
}
|
||||
|
||||
template MSLookup_mDNS tr_MSLookup_mDNS_result_IPv4(integer id, charstring domain, UInt32 ip_v4, integer port_v4) := {
|
||||
dnsMessage := {
|
||||
header := {
|
||||
|
|
Loading…
Reference in New Issue