vty: add cmd subscriber ID sms delete-all

In ttcn3-msc-tests, so far we leave an intentionally failed MT SMS in the SMS
queue, which may cause it to re-appear in subsequent tests.

Allow removing all SMS for a given subscriber from the SMS database for good.

(I dimly remember a user report where the SMS queue spams failed SMS attempts,
and the only way to get rid of SMS for a given subscriber is to tamper with the
sms.db file directly. This should no longer be necessary with this command.)

Related: I7dce12942a65eaaf97f78ca69401c7f93faacb9e (osmo-ttcn3-hacks)
Change-Id: I637cbd7adc075a192f49752b38779391472ff06d
This commit is contained in:
Neels Hofmeyr 2019-03-06 16:19:50 +01:00
parent 34a36da3ef
commit f90496f577
1 changed files with 25 additions and 0 deletions

View File

@ -959,6 +959,30 @@ DEFUN(subscriber_send_pending_sms,
return CMD_SUCCESS;
}
DEFUN(subscriber_sms_delete_all,
subscriber_sms_delete_all_cmd,
"subscriber " SUBSCR_TYPES " ID sms delete-all",
SUBSCR_HELP "SMS Operations\n"
"Delete all SMS to be delivered to this subscriber"
" -- WARNING: the SMS data for all unsent SMS for this subscriber"
" WILL BE LOST.\n")
{
struct vlr_subscr *vsub;
vsub = get_vsub_by_argv(gsmnet, argv[0], argv[1]);
if (!vsub) {
vty_out(vty, "%% No subscriber found for %s %s%s",
argv[0], argv[1], VTY_NEWLINE);
return CMD_WARNING;
}
db_sms_delete_by_msisdn(vsub->msisdn);
vlr_subscr_put(vsub);
return CMD_SUCCESS;
}
DEFUN(subscriber_send_sms,
subscriber_send_sms_cmd,
"subscriber " SUBSCR_TYPES " ID sms sender " SUBSCR_TYPES " SENDER_ID send .LINE",
@ -1651,6 +1675,7 @@ void msc_vty_init(struct gsm_network *msc_network)
install_element(ENABLE_NODE, &smsqueue_clear_cmd);
install_element(ENABLE_NODE, &smsqueue_fail_cmd);
install_element(ENABLE_NODE, &subscriber_send_pending_sms_cmd);
install_element(ENABLE_NODE, &subscriber_sms_delete_all_cmd);
install_element(CONFIG_NODE, &cfg_mncc_int_cmd);
install_node(&mncc_int_node, config_write_mncc_int);