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-sgsn/+/21883 ) Change subject: gbproxy: Add VTY command to override the node selection function ...................................................................... gbproxy: Add VTY command to override the node selection function This is mainly useful when testing SGSN pooling Change-Id: I2894320413dbd0b9aec9a9bc9b88ce7cdeed206b Related: SYS#5115, OS#4472 --- M include/osmocom/sgsn/gb_proxy.h M src/gbproxy/gb_proxy_peer.c M src/gbproxy/gb_proxy_vty.c 3 files changed, 43 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index dd45c2f..ad5bb27 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -60,6 +60,10 @@ /* NRI bitlen and usable NULL-NRI ranges */ uint8_t nri_bitlen; struct osmo_nri_ranges *null_nri_ranges; + + /* Used for testing: If not NULL then this SGSN is returned by + * gbproxy_sgsn_by_tlli() */ + struct gbproxy_sgsn *nsf_override; } pool; /* hash table of all BSS side Gb peers */ diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c index 88b71be..94f9c03 100644 --- a/src/gbproxy/gb_proxy_peer.c +++ b/src/gbproxy/gb_proxy_peer.c @@ -507,9 +507,15 @@ { uint32_t i = 0; uint32_t index, num_sgsns; - struct gbproxy_sgsn *sgsn; OSMO_ASSERT(cfg); + struct gbproxy_sgsn *sgsn = cfg->pool.nsf_override; + + if (sgsn) { + LOGPSGSN(sgsn, LOGL_DEBUG, "Node selection function is overridden by config\n"); + return sgsn; + } + // TODO: We should keep track of count in cfg num_sgsns = llist_count(&cfg->sgsns); diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c index 4d0fa3d..fb9e87a 100644 --- a/src/gbproxy/gb_proxy_vty.c +++ b/src/gbproxy/gb_proxy_vty.c @@ -648,6 +648,36 @@ return CMD_SUCCESS; } +/* Only for ttcn3 testing */ +DEFUN_HIDDEN(sgsn_pool_nsf_fixed, sgsn_pool_nsf_fixed_cmd, + "sgsn-pool nsf fixed NAME", + "SGSN pooling: load balancing across multiple SGSNs.\n" + "Customize the Network Selection Function.\n" + "Set a fixed SGSN to use (for testing).\n" + "The name of the SGSN to use.\n") +{ + const char *name = argv[0]; + struct gbproxy_sgsn *sgsn = gbproxy_sgsn_by_name(g_cfg, name); + + if (!sgsn) { + vty_out(vty, "%% Could not find SGSN with name %s%s", name, VTY_NEWLINE); + return CMD_WARNING; + } + + g_cfg->pool.nsf_override = sgsn; + return CMD_SUCCESS; +} + +DEFUN_HIDDEN(sgsn_pool_nsf_normal, sgsn_pool_nsf_normal_cmd, + "sgsn-pool nsf normal", + "SGSN pooling: load balancing across multiple SGSNs.\n" + "Customize the Network Selection Function.\n" + "Reset the NSF back to regular operation (for testing).\n") +{ + g_cfg->pool.nsf_override = NULL; + return CMD_SUCCESS; +} + int gbproxy_vty_init(void) { install_element_ve(&show_gbproxy_bvc_cmd); @@ -659,6 +689,8 @@ install_element(ENABLE_NODE, &delete_gb_bvci_cmd); install_element(ENABLE_NODE, &delete_gb_nsei_cmd); + install_element(ENABLE_NODE, &sgsn_pool_nsf_fixed_cmd); + install_element(ENABLE_NODE, &sgsn_pool_nsf_normal_cmd); install_element(CONFIG_NODE, &cfg_gbproxy_cmd); install_node(&gbproxy_node, config_write_gbproxy); -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/21883 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I2894320413dbd0b9aec9a9bc9b88ce7cdeed206b Gerrit-Change-Number: 21883 Gerrit-PatchSet: 3 Gerrit-Owner: daniel <dwillmann at sysmocom.de> 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/20210104/388eddfa/attachment.htm>