summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-12 20:51:05 +0200
committerHarald Welte <laforge@osmocom.org>2020-09-13 10:18:41 +0200
commit93331e736bbe9181ca2337bd031a525ace532f54 (patch)
tree5f4837ded92ce17532d1a2b323c2fbb676ad15a2
parent6ce47c3ea75c0bce02779de44586277795c6aae3 (diff)
BSSGP_Emulation: Make L3 (SM/GMM) decoding a compile-time option
This allows us to build low-level tests that don't require all of L3. Change-Id: I7ef7e93e2cd1d37e7e4a62947ca8dfde30d93b95
-rw-r--r--library/BSSGP_Emulation.ttcnpp (renamed from library/BSSGP_Emulation.ttcn)51
-rwxr-xr-xpcu/gen_links.sh2
-rwxr-xr-xpcu/regen_makefile.sh4
-rwxr-xr-xsgsn/gen_links.sh2
-rwxr-xr-xsgsn/regen_makefile.sh2
5 files changed, 48 insertions, 13 deletions
diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcnpp
index e3023ed..05a730b 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcnpp
@@ -18,8 +18,10 @@ import from BSSGP_Types all;
import from Osmocom_Gb_Types all;
import from IPL4asp_Types all;
+#ifdef BSSGP_EM_L3
import from MobileL3_GMM_SM_Types all;
import from MobileL3_Types all;
+#endif
import from LLC_Types all;
import from LLC_Templates all;
@@ -50,17 +52,25 @@ type enumerated BvcState {
/* port from our (internal) point of view */
type port BSSGP_SP_PT message {
in PDU_BSSGP,
- PDU_LLC,
+ PDU_LLC
+#ifdef BSSGP_EM_L3
+ ,
PDU_L3_MS_SGSN,
- PDU_L3_SGSN_MS;
+ PDU_L3_SGSN_MS
+#endif
+ ;
out PDU_BSSGP,
PDU_LLC,
PDU_SN,
NsStatusIndication,
BssgpStatusIndication,
- ASP_Event,
+ ASP_Event
+#ifdef BSSGP_EM_L3
+ ,
PDU_L3_MS_SGSN,
- PDU_L3_SGSN_MS;
+ PDU_L3_SGSN_MS
+#endif
+ ;
} with { extension "internal" };
/* port from the user point of view */
@@ -70,13 +80,21 @@ type port BSSGP_PT message {
BssgpStatusIndication,
PDU_BSSGP,
PDU_LLC,
- PDU_SN,
+ PDU_SN
+#ifdef BSSGP_EM_L3
+ ,
PDU_L3_MS_SGSN,
- PDU_L3_SGSN_MS;
+ PDU_L3_SGSN_MS
+#endif
+ ;
out PDU_BSSGP,
- PDU_LLC,
+ PDU_LLC
+#ifdef BSSGP_EM_L3
+ ,
PDU_L3_SGSN_MS,
- PDU_L3_MS_SGSN;
+ PDU_L3_MS_SGSN
+#endif
+ ;
} with { extension "internal" };
signature BSSGP_register_client(hexstring imsi, OCT4 tlli, BssgpCellId cell_id);
@@ -167,8 +185,11 @@ private template LLC_Entity t_LLC_init(boolean sgsn_role := false) := {
type enumerated BssgpDecodeDepth {
BSSGP_DECODE_DEPTH_BSSGP,
BSSGP_DECODE_DEPTH_LLC,
- BSSGP_DECODE_DEPTH_SNDCP,
+ BSSGP_DECODE_DEPTH_SNDCP
+#ifdef BSSGP_EM_L3
+ ,
BSSGP_DECODE_DEPTH_L3
+#endif
};
type record BssgpConfig {
@@ -524,8 +545,10 @@ altstep as_unblocked() runs on BSSGP_CT {
var NsUnitdataIndication udi;
var PDU_BSSGP bs_pdu;
var PDU_LLC llc;
+#ifdef BSSGP_EM_L3
var PDU_L3_MS_SGSN l3_mo;
var PDU_L3_SGSN_MS l3_mt;
+#endif
/* bogus unblock, just respond with ACK */
[] BSCP.receive(f_BnsUdInd(t_BVC_UNBLOCK(g_cfg.bvci), 0)) -> value udi {
@@ -618,6 +641,7 @@ altstep as_unblocked() runs on BSSGP_CT {
BSCP.send(f_BnsUdReq(bs_pdu, g_cfg.bvci));
}
+#ifdef BSSGP_EM_L3
/* ConnHdlr sends L3: Encode and send as UL_UD / DL_UD */
[g_cfg.sgsn_role] BSSGP_SP.receive(PDU_L3_SGSN_MS:?) -> value l3_mt sender vc_conn {
var integer idx := f_tbl_idx_by_comp(vc_conn);
@@ -635,6 +659,7 @@ altstep as_unblocked() runs on BSSGP_CT {
var octetstring llc_enc := enc_PDU_LLC(valueof(ts_LLC_UI(l3_enc, sapi, '1'B, n_u)));
BSCP.send(f_BnsUdReq(ts_BSSGP_UL_UD(ClientTable[idx].tlli, ClientTable[idx].cell_id, llc_enc), g_cfg.bvci));
}
+#endif
/* ConnHdlr sends raw LLC: Encode and send as UL_UD / DL_UD */
[not g_cfg.sgsn_role] BSSGP_SP.receive(PDU_LLC:?) -> value llc sender vc_conn {
@@ -656,6 +681,7 @@ function f_llc_get_n_u_tx(inout LLC_Entity llc) return uint9_t {
return ret;
}
+#ifdef BSSGP_EM_L3
function f_llc_sapi_by_l3_mo(PDU_L3_MS_SGSN l3_mo) return BIT4 {
if (ischosen(l3_mo.msgs.gprs_mm)) {
return c_LLC_SAPI_LLGMM;
@@ -679,6 +705,7 @@ private function f_llc_sapi_by_l3_mt(PDU_L3_SGSN_MS l3_mt) return BIT4 {
setverdict(fail, "No LLC SAPI for ", l3_mt);
mtc.stop;
}
+#endif
@@ -698,8 +725,10 @@ private function f_ScanEvents() runs on BSSGP_CT {
type record BssgpDecoded {
PDU_BSSGP bssgp,
PDU_LLC llc optional,
+#ifdef BSSGP_EM_L3
PDU_L3_MS_SGSN l3_mo optional,
PDU_L3_SGSN_MS l3_mt optional,
+#endif
PDU_SN sndcp optional
}
@@ -708,8 +737,10 @@ private function f_dec_bssgp(PDU_BSSGP bssgp) runs on BSSGP_CT return BssgpDecod
var BssgpDecoded dec := {
bssgp := bssgp,
llc := omit,
+#ifdef BSSGP_EM_L3
l3_mo := omit,
l3_mt := omit,
+#endif
sndcp := omit
};
@@ -729,6 +760,7 @@ private function f_dec_bssgp(PDU_BSSGP bssgp) runs on BSSGP_CT return BssgpDecod
}
}
+#ifdef BSSGP_EM_L3
/* Decode L3, if it is a LLC PDU containing L3 */
if (g_cfg.depth >= BSSGP_DECODE_DEPTH_L3) {
if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_L3)) {
@@ -739,6 +771,7 @@ private function f_dec_bssgp(PDU_BSSGP bssgp) runs on BSSGP_CT return BssgpDecod
}
}
}
+#endif
return dec;
}
diff --git a/pcu/gen_links.sh b/pcu/gen_links.sh
index 3a52c99..d834bd0 100755
--- a/pcu/gen_links.sh
+++ b/pcu/gen_links.sh
@@ -51,7 +51,7 @@ gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
-FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
+FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn "
gen_links $DIR $FILES
diff --git a/pcu/regen_makefile.sh b/pcu/regen_makefile.sh
index 6fd000e..b2063ac 100755
--- a/pcu/regen_makefile.sh
+++ b/pcu/regen_makefile.sh
@@ -1,5 +1,7 @@
#!/bin/sh
-FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc RLCMAC_EncDec.cc LLC_EncDec.cc TELNETasp_PT.cc Native_FunctionDefs.cc"
+FILES="*.ttcn *.ttcnpp BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc RLCMAC_EncDec.cc LLC_EncDec.cc TELNETasp_PT.cc Native_FunctionDefs.cc"
+
+export CPPFLAGS_TTCN3="-DBSSGP_EM_L3"
../regen-makefile.sh PCU_Tests.ttcn $FILES
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index 541670d..578b454 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -85,7 +85,7 @@ gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
FILES+="NS_Emulation.ttcn PCUIF_Types.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
-FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
+FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
FILES+="Osmocom_VTY_Functions.ttcn "
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
diff --git a/sgsn/regen_makefile.sh b/sgsn/regen_makefile.sh
index a239a3b..1d1411e 100755
--- a/sgsn/regen_makefile.sh
+++ b/sgsn/regen_makefile.sh
@@ -2,7 +2,7 @@
FILES="*.ttcn *.ttcnpp *.asn BSSGP_EncDec.cc LLC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc TELNETasp_PT.cc IPA_CodecPort_CtrlFunctDef.cc GTPU_EncDec.cc GTPC_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc SCCP_EncDec.cc SCTPasp_PT.cc RANAP_EncDec.cc "
-export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -DIPA_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR -DRAN_EMULATION_RANAP"
+export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -DIPA_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR -DRAN_EMULATION_RANAP -DBSSGP_EM_L3"
../regen-makefile.sh SGSN_Tests.ttcn $FILES