diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-09-02 08:36:36 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-09-02 09:15:33 +0200 |
commit | aac9b9cecaaf3f6e93bf888c195416cf32a99987 (patch) | |
tree | a66b0e58a29bd9bac11799d064ef9fb1006cfb89 /library/BSSGP_Emulation.ttcn | |
parent | 0167c2aecf5fbef31ae255d0d3848e30a5c5622a (diff) |
BSSGP_Emulation: add BssgpDecodeDepth
Make the decoding level (BSSGP, LLC, SNDCP, L3) configurable, so the
existing PCU tests, that expect messages only decoded to the BSSGP
level, can pass again. Move the SNDCP decoding in f_dec_bssgp above the
L3 decoding, so f_dec_bssgp goes through the layers in the reverse order
of f_send_bssgp_dec.
I have verified, that all testsuites using the BSSGP Emulation (SGSN,
PCU, PCU-SNS) are still working with this patch.
Related: OS#4180
Fixes: 955aa94504510139a12d223071cf49ef90788a3d ("BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure")
Change-Id: I8f76385528c1de98c557cee451c0e0dfd182b605
Diffstat (limited to 'library/BSSGP_Emulation.ttcn')
-rw-r--r-- | library/BSSGP_Emulation.ttcn | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn index 44946c11..e3023edf 100644 --- a/library/BSSGP_Emulation.ttcn +++ b/library/BSSGP_Emulation.ttcn @@ -164,11 +164,19 @@ private template LLC_Entity t_LLC_init(boolean sgsn_role := false) := { n_u_rx_last := - } +type enumerated BssgpDecodeDepth { + BSSGP_DECODE_DEPTH_BSSGP, + BSSGP_DECODE_DEPTH_LLC, + BSSGP_DECODE_DEPTH_SNDCP, + BSSGP_DECODE_DEPTH_L3 +}; + type record BssgpConfig { Nsvci nsei, Nsvci bvci, BssgpCellId cell_id, - boolean sgsn_role + boolean sgsn_role, + BssgpDecodeDepth depth }; function f_BnsUdReq(template PDU_BSSGP pdu, BssgpBvci bvci) @@ -706,25 +714,32 @@ private function f_dec_bssgp(PDU_BSSGP bssgp) runs on BSSGP_CT return BssgpDecod }; /* Decode LLC, if it is a PDU that contains LLC */ - if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) { - dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_DL_UNITDATA.lLC_PDU.lLC_PDU); - } else if (ischosen(bssgp.pDU_BSSGP_UL_UNITDATA)) { - dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_UL_UNITDATA.lLC_PDU.lLC_PDU); + if (g_cfg.depth >= BSSGP_DECODE_DEPTH_LLC) { + if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) { + dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_DL_UNITDATA.lLC_PDU.lLC_PDU); + } else if (ischosen(bssgp.pDU_BSSGP_UL_UNITDATA)) { + dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_UL_UNITDATA.lLC_PDU.lLC_PDU); + } } - /* Decode L3, if it is a LLC PDU containing L3 */ - if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_L3)) { - if (g_cfg.sgsn_role) { - dec.l3_mo := dec_PDU_L3_MS_SGSN(dec.llc.pDU_LLC_UI.information_field_UI); - } else { - dec.l3_mt := dec_PDU_L3_SGSN_MS(dec.llc.pDU_LLC_UI.information_field_UI); + /* Decode SNDCP, if it is a LLC PDU containing user plane data */ + if (g_cfg.depth >= BSSGP_DECODE_DEPTH_SNDCP) { + if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_USER)) { + dec.sndcp := dec_PDU_SN(dec.llc.pDU_LLC_UI.information_field_UI); } } - /* Decode SNDCP, if it is a LLC PDU containing user plane data */ - if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_USER)) { - dec.sndcp := dec_PDU_SN(dec.llc.pDU_LLC_UI.information_field_UI); + /* 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)) { + if (g_cfg.sgsn_role) { + dec.l3_mo := dec_PDU_L3_MS_SGSN(dec.llc.pDU_LLC_UI.information_field_UI); + } else { + dec.l3_mt := dec_PDU_L3_SGSN_MS(dec.llc.pDU_LLC_UI.information_field_UI); + } + } } + return dec; } |