This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21222 ) Change subject: gbproxy: Allow dynamic connect/disconnect of ConnHdlr at runtime ...................................................................... gbproxy: Allow dynamic connect/disconnect of ConnHdlr at runtime We want to move a virtual subscriber between BVC with one NSE, but also to other NSE/PCU at runtime. The number of BVC and NSE may be large in a given test config, and we really don't need hundreds of test ports per component; Instead, reconnect the test ports to whichever BVC we want at runtime. Change-Id: I56b088b582f2d070547ee24f2d7a175d84fb5861 --- M gbproxy/GBProxy_Tests.ttcn 1 file changed, 50 insertions(+), 23 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index 7dd2c17..242b7e9 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -219,12 +219,19 @@ }; type component BSSGP_ConnHdlr { + /* array of per-BVC ports on the PCU side */ port BSSGP_PT PCU[NUM_PCU]; port BSSGP_PT PCU_SIG[NUM_PCU]; port BSSGP_PROC_PT PCU_PROC[NUM_PCU]; + /* component reference to the component to which we're currently connected */ + var BSSGP_BVC_CT pcu_ct[NUM_PCU]; + + /* array of per-BVC ports on the SGSN side */ port BSSGP_PT SGSN[NUM_SGSN]; port BSSGP_PT SGSN_SIG[NUM_SGSN]; port BSSGP_PROC_PT SGSN_PROC[NUM_SGSN]; + /* component reference to the component to which we're currently connected */ + var BSSGP_BVC_CT sgsn_ct[NUM_PCU]; var BSSGP_ConnHdlrPars g_pars; timer g_Tguard; @@ -252,6 +259,7 @@ OCT4 tlli_old optional, RoutingAreaIdentificationV ra optional, GbInstances pcu, + GbInstances sgsn, float t_guard }; @@ -428,29 +436,50 @@ tlli_old := omit, ra := omit, pcu := g_pcu, + sgsn := g_sgsn, t_guard := t_guard }; vc_conn := BSSGP_ConnHdlr.create(id); - // PDU side - connect(vc_conn:PCU[0], pcu[0].vc_BSSGP_BVC[0]:BSSGP_SP); - connect(vc_conn:PCU_SIG[0], pcu[0].vc_BSSGP_BVC[0]:BSSGP_SP_SIG); - connect(vc_conn:PCU_PROC[0], pcu[0].vc_BSSGP_BVC[0]:BSSGP_PROC); - connect(vc_conn:PCU[1], pcu[1].vc_BSSGP_BVC[0]:BSSGP_SP); - connect(vc_conn:PCU_SIG[1], pcu[1].vc_BSSGP_BVC[0]:BSSGP_SP_SIG); - connect(vc_conn:PCU_PROC[1], pcu[1].vc_BSSGP_BVC[0]:BSSGP_PROC); - connect(vc_conn:PCU[2], pcu[2].vc_BSSGP_BVC[0]:BSSGP_SP); - connect(vc_conn:PCU_SIG[2], pcu[2].vc_BSSGP_BVC[0]:BSSGP_SP_SIG); - connect(vc_conn:PCU_PROC[2], pcu[2].vc_BSSGP_BVC[0]:BSSGP_PROC); - // SGSN side - connect(vc_conn:SGSN[0], sgsn[0].vc_BSSGP_BVC[0]:BSSGP_SP); - connect(vc_conn:SGSN_SIG[0], sgsn[0].vc_BSSGP_BVC[0]:BSSGP_SP_SIG); - connect(vc_conn:SGSN_PROC[0], sgsn[0].vc_BSSGP_BVC[0]:BSSGP_PROC); vc_conn.start(f_handler_init(fn, id, pars)); return vc_conn; } +/* Connect the PCU-side per-BVC ports (PCU/PCU_SIG/PCU_PROC) array slot 'port_idx' to specified per-BVC component */ +private function f_connect_to_pcu_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) runs on BSSGP_ConnHdlr { + if (PCU[port_idx].checkstate("Connected")) { + /* unregister + disconnect from old BVC */ + f_client_unregister(g_pars.imsi, PCU_PROC[port_idx]); + disconnect(self:PCU[port_idx], pcu_ct[port_idx]:BSSGP_SP); + disconnect(self:PCU_SIG[port_idx], pcu_ct[port_idx]:BSSGP_SP_SIG); + disconnect(self:PCU_PROC[port_idx], pcu_ct[port_idx]:BSSGP_PROC); + } + /* connect to new BVC and register us */ + connect(self:PCU[port_idx], bvc_ct:BSSGP_SP); + connect(self:PCU_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); + connect(self:PCU_PROC[port_idx], bvc_ct:BSSGP_PROC); + f_client_register(g_pars.imsi, g_pars.tlli, PCU_PROC[port_idx]); + pcu_ct[port_idx] := bvc_ct; +} + +/* Connect the SGSN-side per-BVC ports (SGSN/SGSN_SIG/SGSN_PROC) array slot 'port_idx' to specified per-BVC component */ +private function f_connect_to_sgsn_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) runs on BSSGP_ConnHdlr { + if (SGSN[port_idx].checkstate("Connected")) { + /* unregister + disconnect from old BVC */ + f_client_unregister(g_pars.imsi, SGSN_PROC[port_idx]); + disconnect(self:SGSN[port_idx], sgsn_ct[port_idx]:BSSGP_SP); + disconnect(self:SGSN_SIG[port_idx], sgsn_ct[port_idx]:BSSGP_SP_SIG); + disconnect(self:SGSN_PROC[port_idx], sgsn_ct[port_idx]:BSSGP_PROC); + } + /* connect to new BVC and register us */ + connect(self:SGSN[port_idx], bvc_ct:BSSGP_SP); + connect(self:SGSN_SIG[port_idx], bvc_ct:BSSGP_SP_SIG); + connect(self:SGSN_PROC[port_idx], bvc_ct:BSSGP_PROC); + f_client_register(g_pars.imsi, g_pars.tlli, SGSN_PROC[port_idx]); + sgsn_ct[port_idx] := bvc_ct; +} + private altstep as_Tguard() runs on BSSGP_ConnHdlr { [] g_Tguard.timeout { setverdict(fail, "Tguard timeout"); @@ -467,16 +496,14 @@ llc := f_llc_create(false); - /* register for our IMSI + TLLI */ - for (i := 0; i < sizeof(SGSN_PROC); i := i+1) { - if (SGSN_PROC[i].checkstate("Connected")) { - f_client_register(g_pars.imsi, g_pars.tlli, SGSN_PROC[i]); - } + /* default connections on PCU side: First BVC of each NSE/PCU */ + for (i := 0; i < lengthof(g_pars.pcu); i := i+1) { + f_connect_to_pcu_bvc(i, g_pars.pcu[i].vc_BSSGP_BVC[0]); } - for (i := 0; i < sizeof(PCU_PROC); i := i+1) { - if (PCU_PROC[i].checkstate("Connected")) { - f_client_register(g_pars.imsi, g_pars.tlli, PCU_PROC[i]); - } + + /* default connections on SGSN side: First BVC of each NSE/SGSN */ + for (i := 0; i < lengthof(g_pars.sgsn); i := i+1) { + f_connect_to_sgsn_bvc(i, g_pars.sgsn[i].vc_BSSGP_BVC[0]); } g_Tguard.start(pars.t_guard); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21222 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I56b088b582f2d070547ee24f2d7a175d84fb5861 Gerrit-Change-Number: 21222 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-CC: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201117/d13dcd76/attachment.htm>