From 95339434cde41926b5c7e3734cee8b415468f927 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 2 Dec 2020 18:50:52 +0100 Subject: [PATCH] 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 --- gbproxy/GBProxy_Tests.ttcn | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index 5bb77d325..30a019e1d 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/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();