aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr.h11
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c44
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c68
3 files changed, 113 insertions, 10 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
index f4058674..ac760835 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h
@@ -19,6 +19,15 @@ enum {
TEMP_ACT_BTS_SRV_OFF = 0x10,
};
+/* actions only for normal state */
+enum {
+ TEMP_ACT_NORM_PW_CONTRL = 0x1,
+ TEMP_ACT_NORM_MASTER_ON = 0x2,
+ TEMP_ACT_NORM_SLAVE_ON = 0x4,
+ TEMP_ACT_NORM_PA_ON = 0x8,
+ TEMP_ACT_NORM_BTS_SRV_ON= 0x10,
+};
+
enum sysmobts_temp_state {
STATE_NORMAL, /* Everything is fine */
STATE_WARNING_HYST, /* Go back to normal next? */
@@ -39,6 +48,7 @@ struct sysmobts_temp_limit {
enum mgr_vty_node {
MGR_NODE = _LAST_OSMOVTY_NODE + 1,
+ ACT_NORM_NODE,
ACT_WARN_NODE,
ACT_CRIT_NODE,
LIMIT_RF_NODE,
@@ -57,6 +67,7 @@ struct sysmobts_mgr_instance {
struct sysmobts_temp_limit board_limit;
struct sysmobts_temp_limit pa_limit;
+ int action_norm;
int action_warn;
int action_crit;
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
index c757f63a..39b20dca 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
@@ -77,6 +77,34 @@ static int next_state(enum sysmobts_temp_state current_state, int critical, int
return next_state;
}
+static void handle_normal_actions(int actions)
+{
+ /* switch off the PA */
+ if (actions & TEMP_ACT_NORM_PA_ON) {
+ if (!is_sbts2050()) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "PA can only be switched-on on the master\n");
+ } else if (sbts2050_uc_set_pa_power(1) != 0) {
+ LOGP(DTEMP, LOGL_ERROR,
+ "Failed to switch on the PA\n");
+ } else {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Switched on the PA as normal action.\n");
+ }
+ }
+
+ if (actions & TEMP_ACT_NORM_BTS_SRV_ON) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Going to switch on the BTS service\n");
+ /*
+ * TODO: use/create something like nspawn that serializes
+ * and used SIGCHLD/waitpid to pick up the dead processes
+ * without invoking shell.
+ */
+ system("/bin/systemctl start sysmobts.service");
+ }
+}
+
static void handle_actions(int actions)
{
/* switch off the PA */
@@ -91,12 +119,6 @@ static void handle_actions(int actions)
LOGP(DTEMP, LOGL_NOTICE,
"Switched off the PA due temperature.\n");
}
- /*
- * TODO: remember we switched off things so we could switch
- * it back on. But we would need to make sure that the BTS
- * will not transmit with full power at that time. This
- * requires the control protocol.
- */
}
if (actions & TEMP_ACT_BTS_SRV_OFF) {
@@ -112,14 +134,16 @@ static void handle_actions(int actions)
}
/**
- * Go back to normal! Undo everything we did in the other states. For
- * reducint the transmit power, the question is if we should slowly set
- * it back to normal, let the BTS slowly increase it.. or handle it here
- * as well?
+ * Go back to normal! Depending on the configuration execute the normal
+ * actions that could (start to) undo everything we did in the other
+ * states. What is still missing is the power increase/decrease depending
+ * on the state. E.g. starting from WARNING_HYST we might want to slowly
+ * ramp up the output power again.
*/
static void execute_normal_act(struct sysmobts_mgr_instance *manager)
{
LOGP(DTEMP, LOGL_NOTICE, "System is back to normal temperature.\n");
+ handle_normal_actions(manager->action_norm);
}
static void execute_warning_act(struct sysmobts_mgr_instance *manager)
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
index 5c75840e..9c7e7d30 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
@@ -54,6 +54,7 @@ static enum node_type go_to_parent(struct vty *vty)
case MGR_NODE:
vty->node = CONFIG_NODE;
break;
+ case ACT_NORM_NODE:
case ACT_WARN_NODE:
case ACT_CRIT_NODE:
case LIMIT_RF_NODE:
@@ -72,6 +73,7 @@ static int is_config_node(struct vty *vty, int node)
{
switch (node) {
case MGR_NODE:
+ case ACT_NORM_NODE:
case ACT_WARN_NODE:
case ACT_CRIT_NODE:
case LIMIT_RF_NODE:
@@ -101,6 +103,12 @@ static struct cmd_node mgr_node = {
1,
};
+static struct cmd_node act_norm_node = {
+ ACT_NORM_NODE,
+ "%s(action-normal)# ",
+ 1,
+};
+
static struct cmd_node act_warn_node = {
ACT_WARN_NODE,
"%s(action-warn)# ",
@@ -155,6 +163,15 @@ static void write_temp_limit(struct vty *vty, const char *name,
limit->thresh_crit, VTY_NEWLINE);
}
+static void write_norm_action(struct vty *vty, const char *name, int actions)
+{
+ vty_out(vty, " %s%s", name, VTY_NEWLINE);
+ vty_out(vty, " %spa-on%s",
+ (actions & TEMP_ACT_NORM_PA_ON) ? "" : "no ", VTY_NEWLINE);
+ vty_out(vty, " %sbts-service-on%s",
+ (actions & TEMP_ACT_NORM_BTS_SRV_ON) ? "" : "no ", VTY_NEWLINE);
+}
+
static void write_action(struct vty *vty, const char *name, int actions)
{
vty_out(vty, " %s%s", name, VTY_NEWLINE);
@@ -183,6 +200,7 @@ static int config_write_mgr(struct vty *vty)
write_temp_limit(vty, "limits board", &s_mgr->board_limit);
write_temp_limit(vty, "limits pa", &s_mgr->pa_limit);
+ write_norm_action(vty, "actions normal", s_mgr->action_norm);
write_action(vty, "actions warn", s_mgr->action_warn);
write_action(vty, "actions critical", s_mgr->action_crit);
@@ -237,10 +255,47 @@ DEFUN(cfg_action_##name, cfg_action_##name##_cmd, \
vty->index = &s_mgr->variable; \
return CMD_SUCCESS; \
}
+CFG_ACTION(normal, "Normal Actions\n", ACT_NORM_NODE, action_norm)
CFG_ACTION(warn, "Warning Actions\n", ACT_WARN_NODE, action_warn)
CFG_ACTION(critical, "Critical Actions\n", ACT_CRIT_NODE, action_crit)
#undef CFG_ACTION
+DEFUN(cfg_action_pa_on, cfg_action_pa_on_cmd,
+ "pa-on",
+ "Switch the Power Amplifier on\n")
+{
+ int *action = vty->index;
+ *action |= TEMP_ACT_NORM_PA_ON;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_action_pa_on, cfg_no_action_pa_on_cmd,
+ "no pa-on",
+ NO_STR "Switch the Power Amplifier on\n")
+{
+ int *action = vty->index;
+ *action &= ~TEMP_ACT_NORM_PA_ON;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd,
+ "bts-service-on",
+ "Start the systemd sysmobts.service\n")
+{
+ int *action = vty->index;
+ *action |= TEMP_ACT_NORM_BTS_SRV_ON;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd,
+ "no bts-service-on",
+ NO_STR "Start the systemd sysmobts.service\n")
+{
+ int *action = vty->index;
+ *action &= ~TEMP_ACT_NORM_BTS_SRV_ON;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_action_pa_off, cfg_action_pa_off_cmd,
"pa-off",
"Switch the Power Amplifier off\n")
@@ -333,6 +388,14 @@ static void register_limit(int limit)
install_element(limit, &cfg_thresh_crit_cmd);
}
+static void register_normal_action(int act)
+{
+ install_element(act, &cfg_action_pa_on_cmd);
+ install_element(act, &cfg_no_action_pa_on_cmd);
+ install_element(act, &cfg_action_bts_srv_on_cmd);
+ install_element(act, &cfg_no_action_bts_srv_on_cmd);
+}
+
static void register_action(int act)
{
#if 0
@@ -382,6 +445,11 @@ int sysmobts_mgr_vty_init(void)
register_limit(LIMIT_PA_NODE);
vty_install_default(LIMIT_PA_NODE);
+ /* install the normal node */
+ install_node(&act_norm_node, config_write_dummy);
+ install_element(MGR_NODE, &cfg_action_normal_cmd);
+ register_normal_action(ACT_NORM_NODE);
+
/* install the warning and critical node */
install_node(&act_warn_node, config_write_dummy);
install_element(MGR_NODE, &cfg_action_warn_cmd);