summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-06-04 20:22:49 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-05-02 19:24:29 +0200
commit02b48652a59b41bb6a8c38f9e0b15cd8e8c0c617 (patch)
treedea3ef20f501ef5f6f19d4f6991f6bd44c202b18
parent522676b9a8eb56d235b5a66f641bd1b0a918b676 (diff)
bsc: Allow to configure more than one MSC in the VTY
-rw-r--r--openbsc/include/openbsc/vty.h1
-rw-r--r--openbsc/src/libcommon/common_vty.c2
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_vty.c79
3 files changed, 56 insertions, 26 deletions
diff --git a/openbsc/include/openbsc/vty.h b/openbsc/include/openbsc/vty.h
index 663589671..63f16698c 100644
--- a/openbsc/include/openbsc/vty.h
+++ b/openbsc/include/openbsc/vty.h
@@ -36,6 +36,7 @@ enum bsc_vty_node {
OM2K_NODE,
TRUNK_NODE,
PGROUP_NODE,
+ BSC_NODE,
};
extern int bsc_vty_is_config_node(struct vty *vty, int node);
diff --git a/openbsc/src/libcommon/common_vty.c b/openbsc/src/libcommon/common_vty.c
index 5b4b296cb..7e585080f 100644
--- a/openbsc/src/libcommon/common_vty.c
+++ b/openbsc/src/libcommon/common_vty.c
@@ -151,6 +151,7 @@ gDEFUN(ournode_exit,
case NS_NODE:
case BSSGP_NODE:
case NAT_NODE:
+ case BSC_NODE:
vty->node = CONFIG_NODE;
vty->index = NULL;
break;
@@ -197,6 +198,7 @@ gDEFUN(ournode_end,
case NAT_BSC_NODE:
case PGROUP_NODE:
case MSC_NODE:
+ case BSC_NODE:
vty_config_unlock(vty);
vty->node = ENABLE_NODE;
vty->index = NULL;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index 8cf5a1438..dfbdaa22a 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -39,6 +39,12 @@ static struct osmo_msc_data *osmo_msc_data(struct vty *vty)
return osmo_msc_data_find(bsc_gsmnet, (int) vty->index);
}
+static struct cmd_node bsc_node = {
+ BSC_NODE,
+ "%s(bsc)#",
+ 1,
+};
+
static struct cmd_node msc_node = {
MSC_NODE,
"%s(msc)#",
@@ -46,9 +52,9 @@ static struct cmd_node msc_node = {
};
DEFUN(cfg_net_msc, cfg_net_msc_cmd,
- "msc", "Configure MSC details")
+ "msc [<0-1000>]", "Configure MSC details\n" "MSC connection to configure\n")
{
- int index = 0;
+ int index = argc == 1 ? atoi(argv[0]) : 0;
struct osmo_msc_data *msc;
msc = osmo_msc_data_alloc(bsc_gsmnet, index);
@@ -62,11 +68,18 @@ DEFUN(cfg_net_msc, cfg_net_msc_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_net_bsc, cfg_net_bsc_cmd,
+ "bsc", "Configure BSC\n")
+{
+ vty->node = BSC_NODE;
+ return CMD_SUCCESS;
+}
+
static void write_msc(struct vty *vty, struct osmo_msc_data *msc)
{
struct bsc_msc_dest *dest;
- vty_out(vty, "msc%s", VTY_NEWLINE);
+ vty_out(vty, "msc %d%s", msc->nr, VTY_NEWLINE);
if (msc->bsc_token)
vty_out(vty, " token %s%s", msc->bsc_token, VTY_NEWLINE);
if (msc->core_ncc != -1)
@@ -111,6 +124,14 @@ static int config_write_msc(struct vty *vty)
llist_for_each_entry(msc, &bsc->mscs, entry)
write_msc(vty, msc);
+ return CMD_SUCCESS;
+}
+
+static int config_write_bsc(struct vty *vty)
+{
+ struct osmo_bsc_data *bsc = osmo_bsc_data(vty);
+
+ vty_out(vty, "bsc%s", VTY_NEWLINE);
if (bsc->mid_call_txt)
vty_out(vty, " mid-call-text %s%s", bsc->mid_call_txt, VTY_NEWLINE);
vty_out(vty, " mid-call-timeout %d%s", bsc->mid_call_timeout, VTY_NEWLINE);
@@ -296,8 +317,23 @@ DEFUN(cfg_net_msc_pong_time,
return CMD_SUCCESS;
}
-DEFUN(cfg_net_msc_mid_call_text,
- cfg_net_msc_mid_call_text_cmd,
+DEFUN(cfg_net_msc_welcome_ussd,
+ cfg_net_msc_welcome_ussd_cmd,
+ "bsc-welcome-text .TEXT",
+ "Set the USSD notification to be sent.\n" "Text to be sent\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+ char *str = argv_concat(argv, argc, 0);
+ if (!str)
+ return CMD_WARNING;
+
+ bsc_replace_string(osmo_bsc_data(vty), &data->ussd_welcome_txt, str);
+ talloc_free(str);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_bsc_mid_call_text,
+ cfg_net_bsc_mid_call_text_cmd,
"mid-call-text .TEXT",
"Set the USSD notifcation to be send.\n" "Text to be sent\n")
{
@@ -311,8 +347,8 @@ DEFUN(cfg_net_msc_mid_call_text,
return CMD_SUCCESS;
}
-DEFUN(cfg_net_msc_mid_call_timeout,
- cfg_net_msc_mid_call_timeout_cmd,
+DEFUN(cfg_net_bsc_mid_call_timeout,
+ cfg_net_bsc_mid_call_timeout_cmd,
"mid-call-timeout NR",
"Switch from Grace to Off in NR seconds.\n" "Timeout in seconds\n")
{
@@ -321,21 +357,6 @@ DEFUN(cfg_net_msc_mid_call_timeout,
return CMD_SUCCESS;
}
-DEFUN(cfg_net_msc_welcome_ussd,
- cfg_net_msc_welcome_ussd_cmd,
- "bsc-welcome-text .TEXT",
- "Set the USSD notification to be sent.\n" "Text to be sent\n")
-{
- struct osmo_msc_data *data = osmo_msc_data(vty);
- char *str = argv_concat(argv, argc, 0);
- if (!str)
- return CMD_WARNING;
-
- bsc_replace_string(osmo_bsc_data(vty), &data->ussd_welcome_txt, str);
- talloc_free(str);
- return CMD_SUCCESS;
-}
-
DEFUN(cfg_net_rf_socket,
cfg_net_rf_socket_cmd,
"bsc-rf-socket PATH",
@@ -359,6 +380,16 @@ DEFUN(show_statistics,
int bsc_vty_init_extra(void)
{
install_element(CONFIG_NODE, &cfg_net_msc_cmd);
+ install_element(CONFIG_NODE, &cfg_net_bsc_cmd);
+
+ install_node(&bsc_node, config_write_bsc);
+ install_default(BSC_NODE);
+ install_element(BSC_NODE, &cfg_net_bsc_mid_call_text_cmd);
+ install_element(BSC_NODE, &cfg_net_bsc_mid_call_timeout_cmd);
+ install_element(BSC_NODE, &cfg_net_rf_socket_cmd);
+
+
+
install_node(&msc_node, config_write_msc);
install_default(MSC_NODE);
install_element(MSC_NODE, &cfg_net_bsc_token_cmd);
@@ -372,10 +403,6 @@ int bsc_vty_init_extra(void)
install_element(MSC_NODE, &cfg_net_msc_pong_time_cmd);
install_element(MSC_NODE, &cfg_net_msc_welcome_ussd_cmd);
- install_element(MSC_NODE, &cfg_net_msc_mid_call_text_cmd);
- install_element(MSC_NODE, &cfg_net_msc_mid_call_timeout_cmd);
- install_element(MSC_NODE, &cfg_net_rf_socket_cmd);
-
install_element_ve(&show_statistics_cmd);
return 0;