summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-08-21 13:37:13 +0200
committerneels <nhofmeyr@sysmocom.de>2021-09-14 08:31:04 +0000
commit0bc470d2066687e521f0a1069dc3d766735475ab (patch)
tree06322aacf2fa30340fbbfe180cf6794e9d1cb98f
parent9db8e0e0774a2dd765c356cd04df5195d6e98175 (diff)
bsc: add TC_stat_num_msc_connected* tests
Verify MSC connection count stats. Related: SYS#5542 Depends: Idace66b37492fe96b2f2e133a69cac7960ca279c (libosmocore) Depends: If76bbf9b3adb64c68d5c31c6b526fa71a99996ae (osmo-bsc) Change-Id: I178dcf4516606aa561d47b06061b8a416d3c40cf
-rw-r--r--bsc/BSC_Tests.ttcn53
1 files changed, 53 insertions, 0 deletions
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 00d3d3fc..cb28a20b 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -2772,6 +2772,56 @@ testcase TC_ctrl_msc0_connection_status() runs on test_CT {
f_shutdown_helper();
}
+/* Verify correct stats on the number of configured and connected MSCs */
+private function f_tc_stat_num_msc_connected_msc_connhdlr(integer expect_num_msc_connected) runs on MSC_ConnHdlr {
+ g_pars := f_gen_test_hdlr_pars();
+ var StatsDExpects expect := {
+ { name := "TTCN3.bsc.0.num_msc.connected", mtype := "g", min := expect_num_msc_connected, max := expect_num_msc_connected },
+ { name := "TTCN3.bsc.0.num_msc.total", mtype := "g", min := NUM_MSC, max := NUM_MSC }
+ };
+ f_statsd_expect(expect);
+}
+
+private function f_tc_stat_num_msc_connected_test_ct(void_fn tc_fn, integer nr_msc) runs on test_CT
+{
+ var MSC_ConnHdlr vc_conn;
+
+ f_init(nr_bts := 1, handler_mode := true, nr_msc := nr_msc);
+ f_sleep(1.0);
+ vc_conn := f_start_handler(tc_fn);
+ vc_conn.done;
+
+ /* Also verify stat exposed on CTRL interface */
+ f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:connected", int2str(nr_msc));
+ f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:total", int2str(NUM_MSC));
+
+ f_shutdown_helper();
+}
+
+/* Verify that when 1 MSC is active, that num_msc:connected reports 1. */
+private function f_tc_stat_num_msc_connected_1(charstring id) runs on MSC_ConnHdlr {
+ f_tc_stat_num_msc_connected_msc_connhdlr(1);
+}
+testcase TC_stat_num_msc_connected_1() runs on test_CT {
+ f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_1), 1);
+}
+
+/* Verify that when 2 MSCs are active, that num_msc:connected reports 2. */
+private function f_tc_stat_num_msc_connected_2(charstring id) runs on MSC_ConnHdlr {
+ f_tc_stat_num_msc_connected_msc_connhdlr(2);
+}
+testcase TC_stat_num_msc_connected_2() runs on test_CT {
+ f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_2), 2);
+}
+
+/* Verify that when 3 MSCs are active, that num_msc:connected reports 3. */
+private function f_tc_stat_num_msc_connected_3(charstring id) runs on MSC_ConnHdlr {
+ f_tc_stat_num_msc_connected_msc_connhdlr(3);
+}
+testcase TC_stat_num_msc_connected_3() runs on test_CT {
+ f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_3), 3);
+}
+
testcase TC_ctrl() runs on test_CT {
var charstring ctrl_resp;
@@ -9962,6 +10012,9 @@ control {
/* CTRL interface testing */
execute( TC_ctrl_msc_connection_status() );
execute( TC_ctrl_msc0_connection_status() );
+ execute( TC_stat_num_msc_connected_1() );
+ execute( TC_stat_num_msc_connected_2() );
+ execute( TC_stat_num_msc_connected_3() );
execute( TC_ctrl() );
if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) {
execute( TC_ctrl_location() );