From a9a7120c82f571554e6c1417eec0803f15e6c7bb Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Jan 2016 23:34:43 +0100 Subject: make PCU socket and telnet port configurable In some cases we'd like to run multiple instances of osmo-bts on a single machine. This is the case where we a multi-TRX PHY is to be used for several BTSs, or in case osmo-bts-trx has multple SDRs attached. This wa currently prevented by having a hard-coded PCU socket path and telnet port, which are now configurable via VTY / config file itself. --- src/common/vty.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/common/vty.c') diff --git a/src/common/vty.c b/src/common/vty.c index 383fa3c3..bba6af14 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -47,10 +48,15 @@ #include #include #include +#include #include #include #include +#define VTY_STR "Configure the VTY\n" + +int g_vty_port_num = OSMO_VTY_PORT_BTS; + struct phy_instance *vty_get_phy_instance(struct vty *vty, int phy_nr, int inst_nr) { struct phy_link *plink = phy_link_by_num(phy_nr); @@ -298,6 +304,8 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) VTY_NEWLINE); vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f, VTY_NEWLINE); + if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT)) + vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, VTY_NEWLINE); bts_model_config_write_bts(vty, bts); @@ -370,6 +378,15 @@ static int config_write_dummy(struct vty *vty) return CMD_SUCCESS; } +DEFUN(cfg_vty_telnet_port, cfg_vty_telnet_port_cmd, + "vty telnet-port <0-65535>", + VTY_STR "Set the VTY telnet port\n" + "TCP Port number\n") +{ + g_vty_port_num = atoi(argv[0]); + return CMD_SUCCESS; +} + /* per-BTS configuration */ DEFUN(cfg_bts, cfg_bts_cmd, @@ -586,6 +603,23 @@ DEFUN(cfg_bts_min_qual_norm, cfg_bts_min_qual_norm_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd, + "pcu-socket PATH", + "Configure the PCU socket file/path name\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + if (btsb->pcu.sock_path) { + /* FIXME: close the interface? */ + talloc_free(btsb->pcu.sock_path); + } + btsb->pcu.sock_path = talloc_strdup(btsb, argv[0]); + /* FIXME: re-open the interface? */ + + return CMD_SUCCESS; +} + #define DB_DBM_STR \ "Unit is dB (decibels)\n" \ @@ -1043,6 +1077,7 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat) install_node(&bts_node, config_write_bts); install_element(CONFIG_NODE, &cfg_bts_cmd); + install_element(CONFIG_NODE, &cfg_vty_telnet_port_cmd); install_default(BTS_NODE); install_element(BTS_NODE, &cfg_bts_unit_id_cmd); install_element(BTS_NODE, &cfg_bts_oml_ip_cmd); @@ -1058,6 +1093,7 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat) install_element(BTS_NODE, &cfg_bts_ul_power_target_cmd); install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd); install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd); + install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd); install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd); install_element(BTS_NODE, &cfg_trx_no_gsmtap_sapi_cmd); -- cgit v1.2.3