summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-06-21 19:42:15 +0200
committerlaforge <laforge@osmocom.org>2020-06-23 20:08:58 +0000
commiteddf0e9e10fe2064052c7ca1670c68b5ff1ae03c (patch)
tree812119a0c58262fae865887cbc4d7eb92f3d8042
parent709650980a1a0ab6cf55074a044f8373adf231bb (diff)
bsc: Add CommonID Test: Send CommonID from MSC and check it is processed
-rw-r--r--bsc/BSC_Tests.ttcn28
-rw-r--r--bsc/MSC_ConnectionHandler.ttcn10
-rw-r--r--library/BSSMAP_Templates.ttcn25
3 files changed, 60 insertions, 3 deletions
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 84f8eaf..9cb15f2 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -2777,6 +2777,33 @@ testcase TC_classmark() runs on test_CT {
vc_conn.done;
}
+/* Send a CommonID from the simulated MSC and verify that the information is used to
+ * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */
+private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr {
+ g_pars := f_gen_test_hdlr_pars();
+ f_MscConnHdlr_init_vty();
+
+ f_create_chan_and_exp();
+ /* we should now have a COMPL_L3 at the MSC */
+ BSSAP.receive(tr_BSSMAP_ComplL3);
+
+ /* Send CommonID */
+ BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi));
+
+ /* Use VTY to verify that the IMSI of the subscr_conn is set */
+ var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*";
+ f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0);
+
+ setverdict(pass);
+}
+testcase TC_common_id() runs on test_CT {
+ var MSC_ConnHdlr vc_conn;
+ f_init(1, true);
+ f_sleep(1.0);
+ vc_conn := f_start_handler(refers(f_tc_common_id));
+ vc_conn.done;
+}
+
private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr {
g_pars := f_gen_test_hdlr_pars();
f_create_chan_and_exp();
@@ -5206,6 +5233,7 @@ control {
execute( TC_oml_unknown_unit_id() );
execute( TC_classmark() );
+ execute( TC_common_id() );
execute( TC_unsol_ass_fail() );
execute( TC_unsol_ass_compl() );
execute( TC_unsol_ho_fail() );
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 0d4c81b..7d8fce1 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -431,9 +431,7 @@ type component MSC_ConnHdlr extends RAN_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr {
var boolean g_vty_initialized := false;
}
-/* initialize all parameters */
-function f_MscConnHdlr_init(integer i, HostName bts, HostName mgw, BSSMAP_FIELD_CodecType codecType) runs on MSC_ConnHdlr {
- f_MediaState_init(g_media, i, bts, mgw, codecType);
+function f_MscConnHdlr_init_vty() runs on MSC_ConnHdlr {
if (not g_vty_initialized) {
map(self:BSCVTY, system:BSCVTY);
f_vty_set_prompts(BSCVTY);
@@ -442,6 +440,12 @@ function f_MscConnHdlr_init(integer i, HostName bts, HostName mgw, BSSMAP_FIELD_
}
}
+/* initialize all parameters */
+function f_MscConnHdlr_init(integer i, HostName bts, HostName mgw, BSSMAP_FIELD_CodecType codecType) runs on MSC_ConnHdlr {
+ f_MediaState_init(g_media, i, bts, mgw, codecType);
+ f_MscConnHdlr_init_vty();
+}
+
private function get_next_trans_id() runs on MSC_ConnHdlr return MgcpTransId {
var MgcpTransId tid := int2str(g_trans_id);
g_trans_id := g_trans_id + 1;
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index 406dfc5..776e8be 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -1599,6 +1599,31 @@ modifies tr_BSSAP_BSSMAP := {
}
}
+template PDU_BSSAP ts_BSSMAP_CommonId(hexstring imsi_digits)
+modifies ts_BSSAP_BSSMAP := {
+ pdu := {
+ bssmap := {
+ commonID := {
+ messageType := '2F'O,
+ iMSI := ts_BSSMAP_Imsi(imsi_digits),
+ sNAAccessInformation := omit
+ }
+ }
+ }
+}
+
+template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits)
+modifies tr_BSSAP_BSSMAP := {
+ pdu := {
+ bssmap := {
+ commonID := {
+ messageType := '2F'O,
+ iMSI := tr_BSSMAP_Imsi(imsi_digits),
+ sNAAccessInformation := *
+ }
+ }
+ }
+}