neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33488 )
Change subject: hnbgw: add mscpool paging tests
......................................................................
hnbgw: add mscpool paging tests
Change-Id: If4bbd5c970108b01e8556fa7744ff627db75fb13
---
M hnbgw/HNBGW_Tests.ttcn
M library/RAN_Emulation.ttcnpp
M library/ranap/RANAP_Templates.ttcn
3 files changed, 180 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/88/33488/1
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index ac8991a..a649bf6 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -46,6 +46,7 @@
import from RANAP_PDU_Contents all;
import from RANAP_IEs all;
import from RANAP_Templates all;
+import from RANAP_CodecPort all;
import from RAN_Adapter all;
import from RAN_Emulation all;
@@ -68,6 +69,8 @@
import from L3_Templates all;
import from L3_Common all;
+import from SCCPasp_Types all;
+
const integer NUM_MSC := 4;
const integer NUM_SGSN := 4;
@@ -271,7 +274,10 @@
boolean expect_separate_sccp_cr,
integer tx_sccp_cr_data_len,
charstring pfcp_local_addr,
- octetstring nas_pdu optional
+ octetstring nas_pdu optional,
+ /* local and remote SCCP addresses, used in TC_mscpool_paging_* */
+ SCCP_PAR_Address sccp_addr_msc optional,
+ SCCP_PAR_Address sccp_addr_hnbgw optional
}
/* We extend:
@@ -973,7 +979,9 @@
expect_separate_sccp_cr := expect_separate_sccp_cr,
tx_sccp_cr_data_len := tx_sccp_cr_data_len,
pfcp_local_addr := mp_pfcp_ip_local,
- nas_pdu := omit
+ nas_pdu := omit,
+ sccp_addr_msc := omit,
+ sccp_addr_hnbgw := omit
}
/* Create an Iuh connection; send InitialUE; expect it to appear on new SCCP conenction */
@@ -2269,6 +2277,117 @@
f_shutdown_helper();
}
+/* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be
+ * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_imsi(charstring id, TestHdlrParams pars) runs on ConnHdlr {
+ f_init_handler(pars);
+
+ var hexstring imsi := '001010000000123'H;
+ var RANAP_IEs.CN_DomainIndicator domain_ind;
+ if (pars.ps_domain) {
+ domain_ind := ps_domain;
+ } else {
+ domain_ind := cs_domain;
+ }
+ var template (value) RANAP_PDU paging := ts_RANAP_Paging(domain_ind, imsi_hex2oct(imsi));
+ BSSAP.send(ts_RANAP_UNITDATA_req(pars.sccp_addr_hnbgw, pars.sccp_addr_msc, paging));
+ /* TODO: Expect RUA ConnectionlessTransfer Paging (on all HNB).
+ * We sent a Paging from CN to osmo-hnbgw, and osmo-hnbgw forwarded the Paging to RUA.
+ * In this ttcn3 code, so far, RUA Emulation forwards those RUA Unitdata only to the ranap_unitdata_cb.
+ * Instead, we may add RUA procedures so that we can RUA.receive(tr_Paging) here.
+ * In result, we would have to expect a RUA Paging to every HNB here.
+ *
+ * But, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received*
+ * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging.
+ */
+
+ f_sleep(1.0);
+
+ /* Despite the round robin pointing at the second MSC ('roundrobin next msc 1'), the earlier Paging for the same IMSI
+ * causes this Paging Response to go to the first MSC ('msc 0'). */
+ f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi)));
+ f_sleep(1.0);
+}
+
+testcase TC_mscpool_paging_imsi() runs on test_CT {
+ f_init(nr_msc := 3);
+ f_sleep(1.0);
+
+ var boolean ps_domain := false;
+
+ /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the
+ * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */
+ f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ConnHdlr vc_conn1;
+ var template (value) TestHdlrParams pars1 := t_pars(0, ps_domain := ps_domain, cn_nr := 0);
+ pars1.sccp_addr_hnbgw := g_cn[valueof(pars1.cn_idx)].sccp_addr_peer;
+ pars1.sccp_addr_msc := g_cn[valueof(pars1.cn_idx)].sccp_addr_own;
+ vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi), pars1);
+ vc_conn1.done;
+ f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+ f_shutdown_helper();
+}
+
+/* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value
+ * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */
+friend function f_tc_mscpool_paging_tmsi(charstring id, TestHdlrParams pars) runs on ConnHdlr {
+ f_init_handler(pars);
+
+ var hexstring imsi := '001010000000124'H;
+ var integer nri_v := 300; /* <-- second MSC's NRI */
+ var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v);
+
+ var RANAP_IEs.CN_DomainIndicator domain_ind;
+ if (pars.ps_domain) {
+ domain_ind := ps_domain;
+ } else {
+ domain_ind := cs_domain;
+ }
+ var template (value) RANAP_PDU paging := ts_RANAP_Paging_temp_id(domain_ind, imsi_hex2oct(imsi),
+ ts_RANAP_TemporaryUE_ID_TMSI(tmsi));
+ BSSAP.send(ts_RANAP_UNITDATA_req(pars.sccp_addr_hnbgw, pars.sccp_addr_msc, paging));
+ /* TODO: Expect RUA ConnectionlessTransfer Paging (on all HNB).
+ * We sent a Paging from CN to osmo-hnbgw, and osmo-hnbgw forwarded the Paging to RUA.
+ * In this ttcn3 code, so far, RUA Emulation forwards those RUA Unitdata only to the ranap_unitdata_cb.
+ * Instead, we may add RUA procedures so that we can RUA.receive(tr_Paging) here.
+ * In result, we would have to expect a RUA Paging to every HNB here.
+ *
+ * But, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received*
+ * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging.
+ */
+
+ f_sleep(1.0);
+
+ /* Despite the round robin pointing at the third MSC ('roundrobin next msc 2'), the earlier Paging for the same
+ * TMSI causes this Paging Response to go to the first MSC ('msc 0'). */
+ f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_TMSI_NRI_LV(nri_v)));
+ f_sleep(1.0);
+}
+testcase TC_mscpool_paging_tmsi() runs on test_CT {
+ f_init(nr_msc := 3);
+ f_sleep(1.0);
+
+ var boolean ps_domain := false;
+
+ /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the
+ * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */
+ f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ConnHdlr vc_conn1;
+ var template (value) TestHdlrParams pars1 := t_pars(0, ps_domain := ps_domain, cn_nr := 0);
+ pars1.sccp_addr_hnbgw := g_cn[valueof(pars1.cn_idx)].sccp_addr_peer;
+ pars1.sccp_addr_msc := g_cn[valueof(pars1.cn_idx)].sccp_addr_own;
+ vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_tmsi), pars1);
+ vc_conn1.done;
+ f_ctrs_cn_expect(0, "cnpool:subscr:paged");
+ f_shutdown_helper();
+}
+
/* For round-robin, skip a CN link that has 'no allow-attach' set. */
testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT {
@@ -2432,6 +2551,8 @@
execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() );
execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() );
execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() );
+ execute( TC_mscpool_paging_imsi() );
+ execute( TC_mscpool_paging_tmsi() );
execute( TC_mscpool_no_allow_attach_round_robin() );
execute( TC_mscpool_no_allow_attach_valid_nri() );
execute( TC_mscpool_sccp_n_pcstate_detaches_cnlink() );
diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp
index 6a1f784..49ca891 100644
--- a/library/RAN_Emulation.ttcnpp
+++ b/library/RAN_Emulation.ttcnpp
@@ -168,6 +168,7 @@
#endif
#ifdef RAN_EMULATION_RANAP
RANAP_PDU,
+ RANAP_N_UNITDATA_req,
/* Client requests us to create SCCP Connection */
RANAP_Conn_Req,
#endif
@@ -968,6 +969,7 @@
var RANAP_N_DISCONNECT_ind rdisc_ind;
var RANAP_Conn_Req creq;
var RANAP_PDU ranap;
+ var RANAP_N_UNITDATA_req ranap_ud;
var RAN_ConnHdlr vc_conn;
var PDU_DTAP_PS_MO ps_mo;
var PDU_DTAP_PS_MT ps_mt;
@@ -1033,6 +1035,11 @@
RANAP.send(ts_RANAP_DATA_req(conn_id, ranap));
}
+ /* e.g. for Paging from virtual MSC/SGSN to SUT osmo-hnbgw */
+ [] CLIENT.receive(RANAP_N_UNITDATA_req:?) -> value ranap_ud sender vc_conn {
+ RANAP.send(ranap_ud);
+ }
+
/* Disconnect request client -> SCCP */
[] CLIENT.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ) -> sender vc_conn {
var integer conn_id := f_conn_id_by_comp(vc_conn);
diff --git a/library/ranap/RANAP_Templates.ttcn b/library/ranap/RANAP_Templates.ttcn
index bc56bdb..051195f 100644
--- a/library/ranap/RANAP_Templates.ttcn
+++ b/library/ranap/RANAP_Templates.ttcn
@@ -720,6 +720,47 @@
}
}
+template (value) TemporaryUE_ID ts_RANAP_TemporaryUE_ID_TMSI(octetstring tmsi) := {
+ tMSI := tmsi
+}
+
+template (value) RANAP_PDU
+ts_RANAP_Paging_temp_id(template (value) CN_DomainIndicator dom, template (value) IMSI imsi,
+ template (value) TemporaryUE_ID temp_id,
+ template (omit) Paging.protocolExtensions exts := omit) := {
+ initiatingMessage := {
+ procedureCode := id_Paging,
+ criticality := ignore,
+ value_ := {
+ paging := {
+ protocolIEs := {
+ {
+ id := id_CN_DomainIndicator,
+ criticality := ignore,
+ value_ := {
+ cN_DomainIndicator := dom
+ }
+ }, {
+ id := id_PermanentNAS_UE_ID,
+ criticality := ignore,
+ value_ := {
+ permanentNAS_UE_ID := {
+ iMSI := imsi
+ }
+ }
+ }, {
+ id := id_TemporaryUE_ID,
+ criticality := ignore,
+ value_ := {
+ temporaryUE_ID := temp_id
+ }
+ }
+ },
+ protocolExtensions := exts
+ }
+ }
+ }
+}
/*****************************************************************************************************
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33488
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If4bbd5c970108b01e8556fa7744ff627db75fb13
Gerrit-Change-Number: 33488
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33489 )
Change subject: rua: RUA_Disc_Ind only when CLIENT is connected
......................................................................
rua: RUA_Disc_Ind only when CLIENT is connected
Only dispatch RUA_Disc_Ind to CLIENT when CLIENT is connected.
Reason:
If a test does not care much about conn cleanup, it may cause a
situation where the CLIENT has already disconnected when osmo-hnbgw
sends a RUA Disconnect. A disconnected CLIENT port will cause the final
verdict to become 'error'. Instead, if the CLIENT is already
disconnected, just don't bother, and allow tests to still pass.
This will become necessary, because:
So far a RUA Disconnect without any RANAP payload is not detected by the
RUA emulation. But patch Ia0b89e9198794d196a88040ee89bdf24f3b08ae0 will
fix it, so that *every* RUA Disconnect causes a RUA_Disc_Ind sent to the
CLIENT. From then on, we will see a bunch more RUA_Disc_Ind at the end
of tests. Some of those happen *after* the client already disconnected,
causing tests to error that have been passing for a long time.
Change-Id: Ia1403f39cfdc75139922292a3eace7a69a64a576
---
M library/rua/RUA_Emulation.ttcn
1 file changed, 31 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/89/33489/1
diff --git a/library/rua/RUA_Emulation.ttcn b/library/rua/RUA_Emulation.ttcn
index 40eb3b7..af4b8b3 100644
--- a/library/rua/RUA_Emulation.ttcn
+++ b/library/rua/RUA_Emulation.ttcn
@@ -309,7 +309,9 @@
ranap_enc := rua.initiatingMessage.value_.disconnect_.protocolIEs[3].value_.rANAP_Message;
f_handle_userData_RANAP(vc_conn, dec_RANAP_PDU(ranap_enc));
/* notify user of disconnect */
- CLIENT.send(RUA_Disc_Ind:{cause});
+ if (CLIENT.checkstate("Connected")) {
+ CLIENT.send(RUA_Disc_Ind:{cause});
+ }
f_conn_table_del(context_id);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33489
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia1403f39cfdc75139922292a3eace7a69a64a576
Gerrit-Change-Number: 33489
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33490 )
Change subject: rua: also match on RUA Disconnect without RANAP payload
......................................................................
rua: also match on RUA Disconnect without RANAP payload
Add tr_RUA_Disconnect_opt_ranap that matches RUA Disconnect with and
without RANAP payload.
Use this in RUA_Emulation as_main_rua(), to trigger a RUA_Disc_Ind to
the CLIENT also for Disconnect without RANAP data.
Rationale:
In upcoming new HNBGW_Tests.ttcn, I want to test for an ungraceful RUA
Disconnect, which is sent without a RANAP payload. But tr_RUA_Disconnect
only matches when a RANAP Message IE is present. In consequence,
RUA_Emulation ignores "empty" RUA Disconnect, and my test case cannot
verify that the RUA Disconnect occurred. Fix that.
Change-Id: Ia0b89e9198794d196a88040ee89bdf24f3b08ae0
---
M library/rua/RUA_Emulation.ttcn
M library/rua/RUA_Templates.ttcn
2 files changed, 60 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/33490/1
diff --git a/library/rua/RUA_Emulation.ttcn b/library/rua/RUA_Emulation.ttcn
index af4b8b3..a9c445e 100644
--- a/library/rua/RUA_Emulation.ttcn
+++ b/library/rua/RUA_Emulation.ttcn
@@ -301,13 +301,15 @@
}
/* RUA -> Client: disconnect of an existing connection */
- [] RUA.receive(tr_RUA_Disconnect) -> value rua {
+ [] RUA.receive(tr_RUA_Disconnect_opt_ranap) -> value rua {
cause := rua.initiatingMessage.value_.disconnect_.protocolIEs[2].value_.cause;
context_id := rua.initiatingMessage.value_.disconnect_.protocolIEs[1].value_.context_ID;
vc_conn := f_comp_by_context_id(context_id);
/* send contained RANAP message to user */
- ranap_enc := rua.initiatingMessage.value_.disconnect_.protocolIEs[3].value_.rANAP_Message;
- f_handle_userData_RANAP(vc_conn, dec_RANAP_PDU(ranap_enc));
+ if (lengthof(rua.initiatingMessage.value_.disconnect_.protocolIEs) > 3) {
+ ranap_enc := rua.initiatingMessage.value_.disconnect_.protocolIEs[3].value_.rANAP_Message;
+ f_handle_userData_RANAP(vc_conn, dec_RANAP_PDU(ranap_enc));
+ }
/* notify user of disconnect */
if (CLIENT.checkstate("Connected")) {
CLIENT.send(RUA_Disc_Ind:{cause});
diff --git a/library/rua/RUA_Templates.ttcn b/library/rua/RUA_Templates.ttcn
index ee65412..738042e 100644
--- a/library/rua/RUA_Templates.ttcn
+++ b/library/rua/RUA_Templates.ttcn
@@ -231,6 +231,38 @@
}
}
+/* Same as tr_RUA_Disconnect() but without a ranap arg: match also a RUA Disconnect without any RANAP payload. */
+template (present) RUA_PDU
+tr_RUA_Disconnect_opt_ranap(template (present) CN_DomainIndicator domain := ?,
+ template (present) bitstring context_id := ?,
+ template (present) Cause cause := ?) := {
+ initiatingMessage := {
+ procedureCode := 3,
+ criticality := reject,
+ value_ := {
+ disconnect_ := {
+ protocolIEs := {
+ {
+ id := 7,
+ criticality := reject,
+ value_ := { cN_DomainIndicator := domain }
+ }, {
+ id := 3,
+ criticality := reject,
+ value_ := { context_ID := context_id }
+ }, {
+ id := 1,
+ criticality := reject,
+ value_ := { cause := cause }
+ },
+ *
+ },
+ protocolExtensions := omit
+ }
+ }
+ }
+}
+
/* 9.1.6 CONNECTIONLESS TRANSFER */
template (value) RUA_PDU
ts_RUA_ConnectionlessTransfer(template (value) octetstring ranap_msg) := {
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/33490
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia0b89e9198794d196a88040ee89bdf24f3b08ae0
Gerrit-Change-Number: 33490
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange