Support for SBc-AP protocol as used on the MME-CBC interface
This requires a recent libfftranscode (>=0.5) with SBC-AP support.
The asn files are obtained from 3GPP TS 29.168.
Related: osmo-cbc.git Ib278bc1d1a74459814016fef7a8fe21cc29d46c9
Related: docker-playground.git 5f3c78105836d1f2c229655df3f537a73ab6e12a
Change-Id: Ia6743e0a3e7974a5f2dd3ecf74ec331f646f6bc2
Related: OS#4945
diff --git a/cbc/CBC_Tests.ttcn b/cbc/CBC_Tests.ttcn
index 06fda92..b3ef64d 100644
--- a/cbc/CBC_Tests.ttcn
+++ b/cbc/CBC_Tests.ttcn
@@ -1,6 +1,7 @@
module CBC_Tests {
import from Osmocom_Types all;
+import from Socket_API_Definitions all;
import from BSSAP_Types all;
import from BSSMAP_Templates all;
@@ -8,7 +9,15 @@
import from CBSP_Templates all;
import from CBSP_Adapter all;
import from CBSP_CodecPort all;
-import from Socket_API_Definitions all;
+
+import from SBC_AP_IEs all;
+import from SBC_AP_Constants all;
+import from SBC_AP_PDU_Contents all;
+import from SBC_AP_PDU_Descriptions all;
+import from SBC_AP_Types all;
+import from SBC_AP_Templates all;
+import from SBC_AP_CodecPort all;
+import from SBC_AP_Adapter all;
import from HTTP_Adapter all;
import from HTTPmsg_Types all;
@@ -17,11 +26,13 @@
modulepar {
charstring mp_cbc_host := "127.0.0.1";
integer mp_cbc_cbsp_port := 48049;
+ integer mp_cbc_sbcap_port := c_SBC_AP_PORT;
integer mp_cbc_ecbe_port := 12345;
integer mp_local_cbsp_port := 9999;
+ integer mp_local_sbcap_port := 9998;
};
-type component test_CT extends CBSP_Adapter_CT, http_CT {
+type component test_CT extends CBSP_Adapter_CT, SBC_AP_Adapter_CT, http_CT {
};
/*********************************************************************************
@@ -141,6 +152,7 @@
private function f_init(boolean raw := false) runs on test_CT {
f_http_init(mp_cbc_host, mp_cbc_ecbe_port);
CBSP_Adapter.f_connect(mp_cbc_host, mp_cbc_cbsp_port, "", mp_local_cbsp_port);
+ SBC_AP_Adapter.f_connect(mp_cbc_host, mp_cbc_sbcap_port, "", mp_local_sbcap_port);
if (not raw) {
var BSSMAP_FIELD_CellIdentificationList cell_list := {
@@ -299,6 +311,63 @@
}
}
+private function f_sbcap_tx_write_replace_warn_resp(CBS_Message msg, integer idx := 0)
+runs on test_CT {
+ var template (value) SBC_AP_PDU tx;
+ /* TODO: pass Unknown Tracking Area List as parameter above (omit by default) */
+ f_SBC_AP_send(tx, idx);
+}
+
+private function f_sbcap_tx_stop_warn_resp(integer idx := 0, CBS_Message msg)
+runs on test_CT {
+ var template (value) SBC_AP_PDU tx;
+ tx := ts_SBCAP_STOP_WARNING_RESP(int2bit(msg.msg_id, 16),
+ int2bit(msg.ser_nr, 16));
+ f_SBC_AP_send(tx, idx);
+}
+
+/* handle a SBc-AP Write-Replace Request and respond to it with Response or FAILURE depending on arguments */
+private function f_sbcap_handle_write_replace_warn_req(CBS_Message msg, integer idx := 0,
+ template (omit) BSSMAP_FIELD_CellIdentificationList tx_cell_list := omit)
+runs on test_CT {
+ var template (present) SBC_AP_PDU rx_templ;
+ var SBC_AP_RecvFrom rf;
+ rx_templ := tr_SBCAP_WRITE_WARNING(int2bit(msg.msg_id, 16),
+ int2bit(msg.ser_nr, 16),
+ msg.rep_period,
+ msg.num_bcast_req);
+ alt {
+ [] SBC_AP[idx].receive(tr_SBC_AP_Recv(g_cbsp_conn_id[idx], rx_templ)) -> value rf {
+ var template (value) SBC_AP_PDU tx;
+ log ("received expected req:", rf);
+ f_sbcap_tx_write_replace_warn_resp(msg, idx);
+ }
+ [] SBC_AP[idx].receive {
+ setverdict(fail, "Received unexpected SBc-AP in index ", idx);
+ }
+ }
+}
+
+/* handle a SBc-AP Stop-Warning-Request and respond to it with Response or FAILURE depending on arguments */
+private function f_sbcap_handle_stop_warn_req(integer idx := 0, CBS_Message msg)
+runs on test_CT {
+ var template (present) SBC_AP_PDU rx_templ;
+ var SBC_AP_RecvFrom rf;
+
+ rx_templ := tr_SBCAP_STOP_WARNING(int2bit(msg.msg_id, 16),
+ int2bit(msg.ser_nr, 16));
+ alt {
+ [] SBC_AP[idx].receive(tr_SBC_AP_Recv(g_cbsp_conn_id[idx], rx_templ)) -> value rf {
+ var template (value) SBC_AP_PDU tx;
+ log ("received expected req:", rf);
+ f_sbcap_tx_stop_warn_resp(idx, msg);
+ }
+ [] SBC_AP[idx].receive {
+ setverdict(fail, "Received unexpected SBc-AP in index ", idx);
+ }
+ }
+}
+
private const BSSMAP_FIELD_CellIdentificationList cil_BSS := {
cIl_allInBSS := ''O
};
@@ -396,6 +465,7 @@
var EcbeCbcMessage ecbe := f_cbs2ecbe(msg, "TTCN-3");
f_ecbe_tx_post_cbs(ecbe);
f_cbsp_handle_write(msg, 0, cell_list_success);
+ f_sbcap_handle_write_replace_warn_req(msg, 0);
f_ecbe_rx_resp(201);
f_sleep(2.0);
@@ -404,6 +474,7 @@
/* FIXME: cbc segfaults if we terminate here (if we don't wait for Connect_result? */
f_cbsp_handle_kill(0, msg.msg_id, msg.ser_nr, exp_list:=cell_list_success, tx_list:=cell_list_success,
tx_fail_list:=omit, tx_compl_list:=omit, channel_ind:=msg.channel_ind);
+ f_sbcap_handle_stop_warn_req(0, msg);
f_ecbe_rx_resp(200);
}
diff --git a/cbc/gen_links.sh b/cbc/gen_links.sh
index 8b88605..3bb9e77 100755
--- a/cbc/gen_links.sh
+++ b/cbc/gen_links.sh
@@ -34,6 +34,11 @@
FILES+="SABP_CodecPort.ttcn SABP_CodecPort_CtrlFunct.ttcn SABP_CodecPort_CtrlFunctDef.cc SABP_Adapter.ttcn "
gen_links $DIR $FILES
+DIR=../library/sbcap
+FILES="SBC_AP_CommonDataTypes.asn SBC_AP_Constants.asn SBC_AP_Containers.asn SBC_AP_IEs.asn SBC_AP_PDU_Contents.asn SBC_AP_PDU_Descriptions.asn "
+FILES+="SBC_AP_Types.ttcn SBC_AP_EncDec.cc SBC_AP_Templates.ttcn SBC_AP_CodecPort.ttcn SBC_AP_CodecPort_CtrlFunct.ttcn SBC_AP_CodecPort_CtrlFunctDef.cc SBC_AP_Adapter.ttcn "
+gen_links $DIR $FILES
+
DIR=$BASEDIR/titan.TestPorts.Common_Components.Abstract_Socket/src
FILES="Abstract_Socket.cc Abstract_Socket.hh "
gen_links $DIR $FILES
diff --git a/cbc/regen_makefile.sh b/cbc/regen_makefile.sh
index 11a93c4..96900b3 100755
--- a/cbc/regen_makefile.sh
+++ b/cbc/regen_makefile.sh
@@ -15,6 +15,8 @@
Native_FunctionDefs.cc
SABP_CodecPort_CtrlFunctDef.cc
SABP_EncDec.cc
+ SBC_AP_CodecPort_CtrlFunctDef.cc
+ SBC_AP_EncDec.cc
SCTPasp_PT.cc
TCCConversion.cc
TCCEncoding.cc