aboutsummaryrefslogtreecommitdiffstats
path: root/src/gbproxy/gb_proxy_vty.c
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-12-27 18:14:39 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-12-28 19:27:08 +0100
commit8585bbfb9c0bb325f282481e29374a8ef3bd2440 (patch)
tree43e6390b23308a8441f2cd62887d9f4129fbf5bd /src/gbproxy/gb_proxy_vty.c
parent182412d37146c6b0bf7f111d3b35397820996528 (diff)
gbproxy: Add VTY command to override the node selection functiondaniel/gbproxy
This is mainly useful when testing SGSN pooling Change-Id: I2894320413dbd0b9aec9a9bc9b88ce7cdeed206b Related: SYS#5115, OS#4472
Diffstat (limited to 'src/gbproxy/gb_proxy_vty.c')
-rw-r--r--src/gbproxy/gb_proxy_vty.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c
index adcdf7069..bdf85e74d 100644
--- a/src/gbproxy/gb_proxy_vty.c
+++ b/src/gbproxy/gb_proxy_vty.c
@@ -649,6 +649,36 @@ DEFUN(delete_gb_nsei, delete_gb_nsei_cmd,
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);
@@ -660,6 +690,8 @@ int gbproxy_vty_init(void)
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);