summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-08-28 10:16:55 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-28 11:10:44 +0200
commit97e139f26790e8aadb677f846c4eba2c3d6f8323 (patch)
tree819013d410412ca04fe40b4addbafd6182653b14
parent1b894022fd168d7b9a3e8cafaef1622c3a24885b (diff)
bsc/vty: Add 'no bsc-welcome-text' command
There was no command to reset a bsc-welcome-text string, so it has been added.
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_vty.c19
-rw-r--r--openbsc/tests/vty_test_runner.py7
2 files changed, 25 insertions, 1 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index 501d9f5..8eaa55b 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -111,8 +111,11 @@ static void write_msc(struct vty *vty, struct osmo_msc_data *msc)
vty_out(vty, " ip.access rtp-base %d%s", msc->rtp_base, VTY_NEWLINE);
vty_out(vty, " timeout-ping %d%s", msc->ping_timeout, VTY_NEWLINE);
vty_out(vty, " timeout-pong %d%s", msc->pong_timeout, VTY_NEWLINE);
+
if (msc->ussd_welcome_txt)
vty_out(vty, " bsc-welcome-text %s%s", msc->ussd_welcome_txt, VTY_NEWLINE);
+ else
+ vty_out(vty, " no bsc-welcome-text%s", VTY_NEWLINE);
if (msc->ussd_msc_lost_txt && msc->ussd_msc_lost_txt[0])
vty_out(vty, " bsc-msc-lost-text %s%s", msc->ussd_msc_lost_txt, VTY_NEWLINE);
@@ -361,7 +364,7 @@ DEFUN(cfg_net_msc_pong_time,
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")
+ "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);
@@ -373,6 +376,19 @@ DEFUN(cfg_net_msc_welcome_ussd,
return CMD_SUCCESS;
}
+DEFUN(cfg_net_msc_no_welcome_ussd,
+ cfg_net_msc_no_welcome_ussd_cmd,
+ "no bsc-welcome-text",
+ NO_STR "Clear the USSD notification to be sent\n")
+{
+ struct osmo_msc_data *data = osmo_msc_data(vty);
+
+ talloc_free(data->ussd_welcome_txt);
+ data->ussd_welcome_txt = 0;
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_net_msc_lost_ussd,
cfg_net_msc_lost_ussd_cmd,
"bsc-msc-lost-text .TEXT",
@@ -612,6 +628,7 @@ int bsc_vty_init_extra(void)
install_element(MSC_NODE, &cfg_net_msc_ping_time_cmd);
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_no_welcome_ussd_cmd);
install_element(MSC_NODE, &cfg_net_msc_lost_ussd_cmd);
install_element(MSC_NODE, &cfg_net_msc_no_lost_ussd_cmd);
install_element(MSC_NODE, &cfg_net_msc_type_cmd);
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index fd200c8..87a45bb 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -104,22 +104,29 @@ class TestVTYBSC(TestVTYBase):
# Test invalid input
self.vty.verify("bsc-msc-lost-text", ['% Command incomplete.'])
+ self.vty.verify("bsc-welcome-text", ['% Command incomplete.'])
# Enable USSD notifications
self.vty.verify("bsc-msc-lost-text MSC disconnected", [''])
+ self.vty.verify("bsc-welcome-text Hello MS", [''])
# Verify settings
res = self.vty.command("write terminal")
self.assert_(res.find('bsc-msc-lost-text MSC disconnected') > 0)
self.assertEquals(res.find('no bsc-msc-lost-text'), -1)
+ self.assert_(res.find('bsc-welcome-text Hello MS') > 0)
+ self.assertEquals(res.find('no bsc-welcome-text'), -1)
# Now disable it..
self.vty.verify("no bsc-msc-lost-text", [''])
+ self.vty.verify("no bsc-welcome-text", [''])
# Verify settings
res = self.vty.command("write terminal")
self.assertEquals(res.find('bsc-msc-lost-text MSC disconnected'), -1)
self.assert_(res.find('no bsc-msc-lost-text') > 0)
+ self.assert_(res.find('no bsc-welcome-text') > 0)
+ self.assertEquals(res.find('bsc-welcome-text Hello MS'), -1)
class TestVTYNAT(TestVTYBase):