CTRL: Introduce support to run osmocom CTRL server

Change-Id: I37db9962f51baf2c63bd58ec47ec89f773d7a255
changes/12/22012/2
Pau Espin 2 years ago
parent ec2ee466b7
commit 9a5b8ffc5b
  1. 2
      bsc-nat/BSCNAT_Tests.ttcn
  2. 4
      bsc/BSC_Tests.ttcn
  3. 4
      bts/BTS_Tests.ttcn
  4. 2
      hlr/HLR_Tests.ttcn
  5. 44
      library/Osmocom_CTRL_Adapter.ttcn
  6. 20
      library/Osmocom_CTRL_Functions.ttcn
  7. 2
      msc/BSC_ConnectionHandler.ttcn
  8. 2
      msc/MSC_Tests.ttcn
  9. 2
      sip/SIP_Tests.ttcn

@ -151,7 +151,7 @@ function f_init(void_fn_bsc_ms fn_bsc_ms, void_fn_bsc fn_bsc, BssmapCreateCallba
f_init_vty("VirtBSCNAT");
f_vty_allow_osmux(use_osmux);
f_ipa_ctrl_start(mp_nat_ip, mp_nat_ctrl_port);
f_ipa_ctrl_start_client(mp_nat_ip, mp_nat_ctrl_port);
for (i := 0; i < NUM_MSC; i := i+1) {
f_init_MscState(msc[i], mp_msc_pc +i, mp_bsc_pc, mp_msc_ssn, mp_bsc_ssn);

@ -1103,7 +1103,7 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolea
/* start the test with exactly all enabled MSCs allowed to attach */
f_vty_msc_allow_attach(BSCVTY, allow_attach);
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port);
f_init_mgcp("VirtMSC");
@ -3080,7 +3080,7 @@ function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return b
bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
bts[0].rsl.ccm_pars.unit_id := "99/0/0"; /* value which is unknown at BTS */
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port);
f_init_mgcp("VirtMSC");

@ -547,7 +547,7 @@ runs on test_CT
f_init_rsl(id);
f_sleep(0.5); /* workaround for OS#3000 */
f_init_vty(id);
f_ipa_ctrl_start(mp_ctrl_ip, mp_ctrl_port);
f_ipa_ctrl_start_client(mp_ctrl_ip, mp_ctrl_port);
/* Send SI3 to the BTS, it is needed for various computations */
f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default);
@ -5376,7 +5376,7 @@ testcase TC_pcu_oml_alert() runs on test_CT {
/* re-connect CTRL port from BTS to BSC */
f_ipa_ctrl_stop();
f_ipa_ctrl_start(mp_bsc_ctrl_ip, mp_bsc_ctrl_port);
f_ipa_ctrl_start_client(mp_bsc_ctrl_ip, mp_bsc_ctrl_port);
/* Send that OML Alert */
PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_OML_ALERT, testcasename())));

@ -245,7 +245,7 @@ function f_init(boolean legacy := true, boolean gsup_server := false) runs on te
f_init_gsup_server("HLR_Test");
}
f_ipa_ctrl_start(mp_hlr_ip, mp_hlr_ctrl_port);
f_ipa_ctrl_start_client(mp_hlr_ip, mp_hlr_ctrl_port);
}
/*! Start HLR_ConnHdlr from testCT in a separate thread.

@ -26,12 +26,24 @@ type component CTRL_Adapter_CT {
port IPA_CTRL_PT IPA_CTRL;
}
/*! Start the CTRL connection to the specified BSC IP+Port */
function f_ipa_ctrl_start(charstring bsc_host, PortNumber bsc_port)
/* wait for IPA CTRL link to connect and send UP */
function f_ipa_ctrl_wait_link_up()
runs on CTRL_Adapter_CT {
var charstring id := "IPA-CTRL"
timer T := 10.0;
T.start;
alt {
[] IPA_CTRL.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_UP)) { }
[] T.timeout {
setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
mtc.stop;
}
}
}
/*! Start the CTRL client connection to the specified CTRL IP+Port server*/
function f_ipa_ctrl_start_client(charstring bsc_host, PortNumber bsc_port)
runs on CTRL_Adapter_CT {
var charstring id := "IPA-CTRL-CLI"
vc_CTRL_IPA := IPA_Emulation_CT.create(id & "-IPA");
@ -41,15 +53,21 @@ runs on CTRL_Adapter_CT {
vc_CTRL_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 0,
c_IPA_default_ccm_pars, false));
/* wait for IPA CTRL link to connect and send UP */
T.start;
alt {
[] IPA_CTRL.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_UP)) { }
[] T.timeout {
setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
mtc.stop;
}
}
f_ipa_ctrl_wait_link_up();
}
/*! Start the CTRL server on the specified CTRL IP+Port */
function f_ipa_ctrl_start_server(charstring listen_host, PortNumber listen_port)
runs on CTRL_Adapter_CT {
var charstring id := "IPA-CTRL-SRV"
timer T := 10.0;
vc_CTRL_IPA := IPA_Emulation_CT.create(id & "-IPA");
map(vc_CTRL_IPA:IPA_PORT, system:IPA_CODEC_PT);
connect(vc_CTRL_IPA:IPA_CTRL_PORT, self:IPA_CTRL);
vc_CTRL_IPA.start(IPA_Emulation.main_server(listen_host, listen_port, false));
}
function f_ipa_ctrl_stop() runs on CTRL_Adapter_CT {

@ -117,6 +117,26 @@ module Osmocom_CTRL_Functions {
return rx.cmd.val;
}
/* Expect a matching SET, optionally answer */
function f_ctrl_exp_get(IPA_CTRL_PT pt, template CtrlVariable variable,
template (omit) CtrlValue rsp := omit,
float timeout_val := 2.0) {
timer T := timeout_val;
var CtrlMessage rx;
T.start;
alt {
[] pt.receive(tr_CtrlMsgGet(?, variable)) -> value rx {
if (ispresent(rsp)) {
pt.send(ts_CtrlMsgGetRepl(rx.cmd.id, valueof(variable), valueof(rsp)));
}
}
[] T.timeout {
setverdict(fail, "Timeout waiting for GET ", variable);
mtc.stop;
}
}
}
/* Expect a matching GET result */
function f_ctrl_get_exp(IPA_CTRL_PT pt, CtrlVariable variable, template CtrlValue exp) {
var charstring ctrl_resp;

@ -182,7 +182,7 @@ function f_init_handler(BSC_ConnHdlrPars pars, float t_guard := 60.0) runs on BS
}
if (g_pars.ipa_ctrl_enable == true) {
f_ipa_ctrl_start(g_pars.ipa_ctrl_ip, g_pars.ipa_ctrl_port);
f_ipa_ctrl_start_client(g_pars.ipa_ctrl_ip, g_pars.ipa_ctrl_port);
}
map(self:MSCVTY, system:MSCVTY);

@ -318,7 +318,7 @@ function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := tr
}
}
f_ipa_ctrl_start(mp_msc_ip, mp_msc_ctrl_port);
f_ipa_ctrl_start_client(mp_msc_ip, mp_msc_ctrl_port);
f_init_mncc("MSC_Test");
f_init_mgcp("MSC_Test");

@ -134,7 +134,7 @@ function f_init_mncc(charstring id) runs on test_CT {
}
function f_init() runs on test_CT {
//f_ipa_ctrl_start(mp_osmosip_host, mp_osmosip_port_ctrl);
//f_ipa_ctrl_start_client(mp_osmosip_host, mp_osmosip_port_ctrl);
f_init_mncc("SIP_Test");
log("end of f_init_mncc");
f_init_sip(vc_SIP, "SIP_Test");

Loading…
Cancel
Save