nitb: Add "subscriber create" VTY command.
It may be useful in production, but it's really required for VTY testing of subscriber related commands.
This commit is contained in:
parent
4ad593c8f6
commit
bd6d40f1fb
|
@ -218,6 +218,32 @@ DEFUN(show_subscr,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(subscriber_create,
|
||||||
|
subscriber_create_cmd,
|
||||||
|
"subscriber create imsi ID",
|
||||||
|
"Operations on a Subscriber\n" \
|
||||||
|
"Create new subscriber\n" \
|
||||||
|
"Identify the subscriber by his IMSI\n" \
|
||||||
|
"Identifier for the subscriber\n")
|
||||||
|
{
|
||||||
|
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||||
|
struct gsm_subscriber *subscr;
|
||||||
|
|
||||||
|
subscr = db_create_subscriber(gsmnet, argv[0]);
|
||||||
|
if (!subscr) {
|
||||||
|
vty_out(vty, "%% No subscriber created for IMSI %s%s",
|
||||||
|
argv[0], VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show info about the created subscriber. */
|
||||||
|
subscr_dump_full_vty(vty, subscr, 0);
|
||||||
|
|
||||||
|
subscr_put(subscr);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN(subscriber_send_pending_sms,
|
DEFUN(subscriber_send_pending_sms,
|
||||||
subscriber_send_pending_sms_cmd,
|
subscriber_send_pending_sms_cmd,
|
||||||
"subscriber " SUBSCR_TYPES " ID sms pending-send",
|
"subscriber " SUBSCR_TYPES " ID sms pending-send",
|
||||||
|
@ -949,6 +975,7 @@ int bsc_vty_init_extra(void)
|
||||||
|
|
||||||
install_element_ve(&sms_send_pend_cmd);
|
install_element_ve(&sms_send_pend_cmd);
|
||||||
|
|
||||||
|
install_element_ve(&subscriber_create_cmd);
|
||||||
install_element_ve(&subscriber_send_sms_cmd);
|
install_element_ve(&subscriber_send_sms_cmd);
|
||||||
install_element_ve(&subscriber_silent_sms_cmd);
|
install_element_ve(&subscriber_silent_sms_cmd);
|
||||||
install_element_ve(&subscriber_silent_call_start_cmd);
|
install_element_ve(&subscriber_silent_call_start_cmd);
|
||||||
|
|
|
@ -215,6 +215,22 @@ class TestVTYNITB(TestVTYGenericBSC):
|
||||||
if classNum != 10:
|
if classNum != 10:
|
||||||
self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1)
|
self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1)
|
||||||
|
|
||||||
|
def testSubscriberCreate(self):
|
||||||
|
self.vty.enable()
|
||||||
|
|
||||||
|
imsi = "204300854013739"
|
||||||
|
|
||||||
|
# Initially we don't have this subscriber
|
||||||
|
self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi])
|
||||||
|
|
||||||
|
# Lets create one
|
||||||
|
res = self.vty.command('subscriber create imsi '+imsi)
|
||||||
|
self.assert_(res.find(" IMSI: "+imsi) > 0)
|
||||||
|
|
||||||
|
# Now we have it
|
||||||
|
res = self.vty.command('show subscriber imsi '+imsi)
|
||||||
|
self.assert_(res.find(" IMSI: "+imsi) > 0)
|
||||||
|
|
||||||
class TestVTYBSC(TestVTYGenericBSC):
|
class TestVTYBSC(TestVTYGenericBSC):
|
||||||
|
|
||||||
def vty_command(self):
|
def vty_command(self):
|
||||||
|
|
Loading…
Reference in New Issue