summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_ctrl_commands.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-10 23:03:25 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-10 23:03:25 +0100
commit66105fd3dc043e0f8011e1fa47864611936dd6aa (patch)
tree59f953583efdbdd0971cc5648e75b736ae2d5dba /openbsc/src/libbsc/bsc_ctrl_commands.c
parentca4151984c37fa24a97f15aaee43b6d105a43fb3 (diff)
ctrl: Implement a global result for rf_locked0.14.0
Create a one stop command to give a statement for the entire network. This can be used to check the policy and the state of the entire network.
Diffstat (limited to 'openbsc/src/libbsc/bsc_ctrl_commands.c')
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_commands.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index 30d0a524b..1d91c5fc2 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -366,8 +366,33 @@ CTRL_CMD_DEFINE_RO(bts_rf_state, "rf_state");
static int get_net_rf_lock(struct ctrl_cmd *cmd, void *data)
{
- cmd->reply = "get only works for the individual trx properties.";
- return CTRL_CMD_ERROR;
+ struct gsm_network *net = cmd->node;
+ struct gsm_bts *bts;
+ const char *policy_name;
+
+ policy_name = osmo_bsc_rf_get_policy_name(net->bsc_data->rf_ctrl->policy);
+
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ struct gsm_bts_trx *trx;
+
+ /* Exclude the BTS from the global lock */
+ if (bts->excl_from_rf_lock)
+ continue;
+
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ if (trx->mo.nm_state.availability == NM_AVSTATE_OK &&
+ trx->mo.nm_state.operational != NM_OPSTATE_DISABLED) {
+ cmd->reply = talloc_asprintf(cmd,
+ "state=on,policy=%s,bts=%u,trx=%u",
+ policy_name, bts->nr, trx->nr);
+ return CTRL_CMD_REPLY;
+ }
+ }
+ }
+
+ cmd->reply = talloc_asprintf(cmd, "state=off,policy=%s",
+ policy_name);
+ return CTRL_CMD_REPLY;
}
#define TIME_FORMAT_RFC2822 "%a, %d %b %Y %T %z"