neels has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32217 )

Change subject: bsc: add TC_mscpool_sccp_n_pcstate_attaches_msc
......................................................................

bsc: add TC_mscpool_sccp_n_pcstate_attaches_msc

Related: I3a0869598b8395601a16d78dbc46eec400c0ea84 (osmo-bsc)
Change-Id: Ib4a5330df30a73e744c316898817b2fa3271d75e
---
M bsc/BSC_Tests.ttcn
1 file changed, 84 insertions(+), 16 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  neels: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 39c82ab..dccfdc3 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -646,6 +646,8 @@
        /* are we initialized yet */
        var boolean g_initialized := false;

+       var boolean g_handler_mode := false;
+
        /* Osmux is enabled through VTY */
        var boolean g_osmux_enabled_cn := false;
        var boolean g_osmux_enabled_bts := false;
@@ -1210,6 +1212,27 @@
        }
 }

+private function f_bssap_idx_init(integer bssap_idx) runs on test_CT {
+       /* Call a function of our 'parent component' RAN_Adapter_CT to start the
+        * MSC-side BSSAP emulation */
+       if (g_handler_mode) {
+               var RanOps ranops := MSC_RanOps;
+               ranops.use_osmux := g_osmux_enabled_cn;
+               f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], 
"VirtMSC", ranops);
+               connect(self:SCCPLITE_IPA_CTRL, 
g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT);
+               f_ran_adapter_start(g_bssap[bssap_idx]);
+       } else {
+               f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], 
"VirtMSC", omit);
+               connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT);
+               f_ran_adapter_start(g_bssap[bssap_idx]);
+               f_legacy_bssap_reset();
+       }
+}
+
+private function f_bssap_idx_disconnect(integer bssap_idx) runs on test_CT {
+       f_ran_adapter_cleanup(g_bssap[bssap_idx]);
+}
+
 /* global initialization function
  * \param nr_bts Number of BTSs we should start/bring up
  * \param handler_mode Start an RSL_Emulation_CT component (true) or not 
(false).
@@ -1238,22 +1261,10 @@
                f_vty_transceive(BSCVTY, "msc " & int2str(bssap_idx) & " bssmap 
reset", strict := false);
        }

+       g_handler_mode := handler_mode;
        for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) {
                allow_attach[bssap_idx] := true;
-               /* Call a function of our 'parent component' RAN_Adapter_CT to 
start the
-                * MSC-side BSSAP emulation */
-               if (handler_mode) {
-                       var RanOps ranops := MSC_RanOps;
-                       ranops.use_osmux := g_osmux_enabled_cn;
-                       f_ran_adapter_init(g_bssap[bssap_idx], 
mp_bssap_cfg[bssap_idx], "VirtMSC", ranops);
-                       connect(self:SCCPLITE_IPA_CTRL, 
g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT);
-                       f_ran_adapter_start(g_bssap[bssap_idx]);
-               } else {
-                       f_ran_adapter_init(g_bssap[bssap_idx], 
mp_bssap_cfg[bssap_idx], "VirtMSC", omit);
-                       connect(self:BSSAP, 
g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT);
-                       f_ran_adapter_start(g_bssap[bssap_idx]);
-                       f_legacy_bssap_reset();
-               }
+               f_bssap_idx_init(bssap_idx);
        }

        if (mp_enable_lcs_tests) {
@@ -9190,8 +9201,7 @@
        f_ctrs_msc_expect(1, "mscpool:subscr:new");

        f_logp(BSCVTY, "disconnecting msc0");
-       /* Disconnect the first MSC */
-       f_ran_adapter_cleanup(g_bssap[0]);
+       f_bssap_idx_disconnect(0);
 
        /* Now round-robin would wrap to the first MSC, but since the first MSC 
is disconnected, it wraps around to msc
         * 2 again. */
@@ -9205,6 +9215,53 @@
        f_shutdown_helper();
 }

+/* When an MSC point-code gets an SCCP N-PCSTATE saying it is now reachable, 
immediately trigger RESET and bring up the
+ * MSC. */
+testcase TC_mscpool_sccp_n_pcstate_attaches_msc() runs on test_CT {
+
+       f_init(nr_bts := 3, handler_mode := true, nr_msc := 1);
+       f_sleep(1.0);
+
+       /* Control which MSC gets chosen next by the round-robin, otherwise
+        * would be randomly affected by which other tests ran before this. */
+       f_vty_transceive(BSCVTY, "mscpool roundrobin next 0");
+
+       f_ctrs_msc_init();
+
+       /* There is only one MSC, round robin stays on msc0 */
+       var MSC_ConnHdlr vc_conn1;
+       var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0);
+       pars1.mscpool.rsl_idx := 0;
+       pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, 
valueof(ts_MI_IMSI_LV('0010100230000001'H)), '00F110'O));
+       vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1);
+       vc_conn1.done;
+       f_ctrs_msc_expect(0, "mscpool:subscr:new");
+
+       var MSC_ConnHdlr vc_conn2;
+       var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0);
+       pars2.mscpool.rsl_idx := 1;
+       pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, 
valueof(ts_MI_IMSI_LV('001010023000002'H))));
+       vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2);
+       vc_conn2.done;
+       f_ctrs_msc_expect(0, "mscpool:subscr:new");
+
+       f_logp(BSCVTY, "connecting msc1");
+       f_vty_msc_allow_attach(BSCVTY, { true, true });
+       f_bssap_idx_init(1);
+       f_sleep(1.0);
+
+       /* This time round-robin wraps to the second MSC, because it is now 
online. */
+       var MSC_ConnHdlr vc_conn4;
+       var TestHdlrParams pars4 := f_gen_test_hdlr_pars(bssap_idx := 1);
+       pars4.mscpool.rsl_idx := 2;
+       pars4.mscpool.l3_info := 
valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010023000003'H))));
+       vc_conn4 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars4);
+       vc_conn4.done;
+       f_ctrs_msc_expect(1, "mscpool:subscr:new");
+
+       f_shutdown_helper();
+}
+
 /* Allow/Deny emergency calls globally via VTY */
 private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT {
        f_vty_enter_cfg_msc(BSCVTY, 0);
@@ -12509,6 +12566,7 @@
                execute( TC_mscpool_no_allow_attach_valid_nri() );

                execute( TC_mscpool_sccp_n_pcstate_detaches_msc() );
+               execute( TC_mscpool_sccp_n_pcstate_attaches_msc() );
        }

        execute( TC_early_conn_fail() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32217
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: Ib4a5330df30a73e744c316898817b2fa3271d75e
Gerrit-Change-Number: 32217
Gerrit-PatchSet: 4
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-CC: fixeria <[email protected]>
Gerrit-MessageType: merged

Reply via email to