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: 955aa94504 ("BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure")
Change-Id: I8f76385528c1de98c557cee451c0e0dfd182b605
This commit is contained in:
Oliver Smith 2019-09-02 08:36:36 +02:00
parent 0167c2aecf
commit aac9b9ceca
3 changed files with 38 additions and 19 deletions

View File

@ -164,11 +164,19 @@ private template LLC_Entity t_LLC_init(boolean sgsn_role := false) := {
n_u_rx_last := - 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 { type record BssgpConfig {
Nsvci nsei, Nsvci nsei,
Nsvci bvci, Nsvci bvci,
BssgpCellId cell_id, BssgpCellId cell_id,
boolean sgsn_role boolean sgsn_role,
BssgpDecodeDepth depth
}; };
function f_BnsUdReq(template PDU_BSSGP pdu, BssgpBvci bvci) 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 */ /* Decode LLC, if it is a PDU that contains LLC */
if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) { if (g_cfg.depth >= BSSGP_DECODE_DEPTH_LLC) {
dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_DL_UNITDATA.lLC_PDU.lLC_PDU); if (ischosen(bssgp.pDU_BSSGP_DL_UNITDATA)) {
} else if (ischosen(bssgp.pDU_BSSGP_UL_UNITDATA)) { dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_DL_UNITDATA.lLC_PDU.lLC_PDU);
dec.llc := dec_PDU_LLC(bssgp.pDU_BSSGP_UL_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 */ /* Decode SNDCP, if it is a LLC PDU containing user plane data */
if (isvalue(dec.llc) and match(dec.llc, tr_LLC_UI_USER)) { if (g_cfg.depth >= BSSGP_DECODE_DEPTH_SNDCP) {
dec.sndcp := dec_PDU_SN(dec.llc.pDU_LLC_UI.information_field_UI); 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; return dec;
} }

View File

@ -44,7 +44,8 @@ modulepar {
}, },
cell_id := 20960 cell_id := 20960
}, },
sgsn_role := true sgsn_role := true,
depth := BSSGP_DECODE_DEPTH_BSSGP
}; };
NSConfiguration mp_nsconfig := { NSConfiguration mp_nsconfig := {

View File

@ -286,7 +286,8 @@ function f_init(BcdMccMnc mcc_mnc := '262F42'H) runs on test_CT {
}, },
cell_id := 20960 cell_id := 20960
}, },
sgsn_role := false sgsn_role := false,
depth := BSSGP_DECODE_DEPTH_L3
}; };
g_gb[1].cfg := { g_gb[1].cfg := {
nsei := 97, nsei := 97,
@ -299,7 +300,8 @@ function f_init(BcdMccMnc mcc_mnc := '262F42'H) runs on test_CT {
}, },
cell_id := 20961 cell_id := 20961
}, },
sgsn_role := false sgsn_role := false,
depth := BSSGP_DECODE_DEPTH_L3
}; };
g_gb[2].cfg := { g_gb[2].cfg := {
nsei := 98, nsei := 98,
@ -312,7 +314,8 @@ function f_init(BcdMccMnc mcc_mnc := '262F42'H) runs on test_CT {
}, },
cell_id := 20962 cell_id := 20962
}, },
sgsn_role := false sgsn_role := false,
depth := BSSGP_DECODE_DEPTH_L3
}; };
f_init_vty(); f_init_vty();