gbproxy: Make sure all BssgpCfg have a valid create_cb

We cannot specify create_cb function references from the config file,
so let's patch them into the data structure at start-up.

Change-Id: Idac9e97dde62b61d0423fdde16e3bd700d5287c0
changes/67/21467/1
Harald Welte 2 years ago
parent 951e6a9539
commit 95339434cd
  1. 13
      gbproxy/GBProxy_Tests.ttcn

@ -289,6 +289,15 @@ private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdent
return ret;
};
private function f_fix_create_cb(inout BssgpConfig cfg)
{
for (var integer i := 0; i < lengthof(cfg.bvc); i := i + 1) {
if (not isbound(cfg.bvc[i].create_cb)) {
cfg.bvc[i].create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
}
}
}
private function f_init_gb_pcu(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
var charstring ns_id := id & "-NS(PCU[" & int2str(offset) & "])";
var charstring bssgp_id := id & "-BSSGP(PCU[" & int2str(offset) & "])";
@ -364,8 +373,10 @@ function f_init() runs on test_CT {
}
for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) {
g_pcu[i].cfg := mp_gbconfigs[i];
/* make sure all have a proper crate_cb, which cannot be specified in config file */
f_fix_create_cb(g_pcu[i].cfg);
/* concatenate all the PCU-side BVCs for the SGSN side */
g_sgsn[0].cfg.bvc := g_sgsn[0].cfg.bvc & mp_gbconfigs[i].bvc;
g_sgsn[0].cfg.bvc := g_sgsn[0].cfg.bvc & g_pcu[i].cfg.bvc;
}
f_init_vty();

Loading…
Cancel
Save