bsc/vty: Add 'no bsc-welcome-text' command

There was no command to reset a bsc-welcome-text string, so it has
been added.
This commit is contained in:
Jacob Erlbeck 2013-08-28 10:16:55 +02:00 committed by Holger Hans Peter Freyther
parent 058b1e5df7
commit b62092a56d
2 changed files with 25 additions and 1 deletions

View File

@ -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);

View File

@ -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):