aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-09-07 14:43:25 +0200
committerneels <nhofmeyr@sysmocom.de>2021-09-14 08:44:45 +0000
commit763f8ed7713077d9c1d8383aa2ac39cf21a7e8a0 (patch)
tree09e9478cb102f4d4539e55ea47c19423c65af80e
parent0559bd977572a2c14189db3dda2f0cac30448e26 (diff)
add CTRL bts.N.trx.M.rf_locked (RW)
Add per-TRX command to lock/unlock single TRX. (Besides the global root-node rf_locked command setting the global RF policy.) Corresponds to VTY command: 'bts N' / 'trx N' / 'rf_locked (0|1)'. Related: SYS#5542 Related: I2bb5096732f75a7341c7e83951e63c5a2038b469 (osmo-ttcn3-hacks) Depends: I4dac826aab00bc1780a5258b6b55d34ce7d50c60 (libosmocore) Change-Id: Ie46fd730797b64fb185d705c3507e36f5f23ef4b
-rw-r--r--TODO-RELEASE1
-rw-r--r--src/osmo-bsc/bsc_ctrl_commands.c32
2 files changed, 33 insertions, 0 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 8585c7bbc..90ec16bba 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -14,3 +14,4 @@ libosmo-mgcp-client >1.8.0 need osmo_mgcpc_ep_ci_get_remote_rtp_info()
libosmovty >1.5.1 needs vty_read_config_filep()
libosmosgsm >1.5.1 needs GSM_PCHAN_OSMO_DYN
libosmocore >1.5.1 RSL_IPAC_EIE_OSMO*, struct osmo_preproc_*
+libosmocore >1.5.1 needs osmo_str_to_int()
diff --git a/src/osmo-bsc/bsc_ctrl_commands.c b/src/osmo-bsc/bsc_ctrl_commands.c
index 3b8125a78..c7547b0ff 100644
--- a/src/osmo-bsc/bsc_ctrl_commands.c
+++ b/src/osmo-bsc/bsc_ctrl_commands.c
@@ -536,6 +536,37 @@ static int verify_net_rf_lock(struct ctrl_cmd *cmd, const char *value, void *dat
}
CTRL_CMD_DEFINE(net_rf_lock, "rf_locked");
+static int get_trx_rf_locked(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_bts_trx *trx = cmd->node;
+ /* Return rf_locked = 1 only if it is explicitly locked. If it is in shutdown or null state, do not "trick" the
+ * caller into thinking that sending "rf_locked 0" is necessary to bring the TRX up. */
+ cmd->reply = (trx->mo.nm_state.administrative == NM_STATE_LOCKED) ? "1" : "0";
+ return CTRL_CMD_REPLY;
+}
+
+static int set_trx_rf_locked(struct ctrl_cmd *cmd, void *data)
+{
+ struct gsm_bts_trx *trx = cmd->node;
+ int locked;
+ if (osmo_str_to_int(&locked, cmd->value, 10, 0, 1)) {
+ cmd->reply = "Invalid value";
+ return CTRL_CMD_ERROR;
+ }
+
+ gsm_trx_lock_rf(trx, locked, "ctrl");
+
+ /* Let's not assume the nm FSM has already switched its state, just return the intended rf_locked value. */
+ cmd->reply = locked ? "1" : "0";
+ return CTRL_CMD_REPLY;
+}
+
+static int verify_trx_rf_locked(struct ctrl_cmd *cmd, const char *value, void *data)
+{
+ return osmo_str_to_int(NULL, value, 10, 0, 1);
+}
+CTRL_CMD_DEFINE(trx_rf_locked, "rf_locked");
+
static int get_net_bts_num(struct ctrl_cmd *cmd, void *data)
{
struct gsm_network *net = cmd->node;
@@ -661,6 +692,7 @@ int bsc_base_ctrl_cmds_install(void)
rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_max_power);
rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_arfcn);
+ rc |= ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_rf_locked);
return rc;
}