nitb: Make the last change configurable

Introduce a NITB node and add the subscriber creation as
config name in there.
This commit is contained in:
Holger Hans Peter Freyther 2015-01-27 10:58:29 +01:00
parent 1ba0730a71
commit 925c57fb54
3 changed files with 49 additions and 0 deletions

View File

@ -32,6 +32,7 @@ enum bsc_vty_node {
TRUNK_NODE,
PGROUP_NODE,
MNCC_INT_NODE,
NITB_NODE,
BSC_NODE,
SMPP_NODE,
SMPP_ESME_NODE,

View File

@ -106,6 +106,7 @@ enum node_type bsc_vty_go_parent(struct vty *vty)
case BSC_NODE:
case MSC_NODE:
case MNCC_INT_NODE:
case NITB_NODE:
default:
if (bsc_vty_is_config_node(vty, vty->node))
vty->node = CONFIG_NODE;

View File

@ -1053,6 +1053,47 @@ DEFUN(logging_fltr_imsi,
log_set_imsi_filter(tgt, subscr);
return CMD_SUCCESS;
}
static struct cmd_node nitb_node = {
NITB_NODE,
"%s(config-nitb)# ",
1,
};
DEFUN(cfg_nitb, cfg_nitb_cmd,
"nitb", "Configure NITB options")
{
vty->node = NITB_NODE;
return CMD_SUCCESS;
}
DEFUN(cfg_nitb_subscr_create, cfg_nitb_subscr_create_cmd,
"subscriber-create-on-demand",
"Make a new record when a subscriber is first seen.\n")
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
gsmnet->create_subscriber = 1;
return CMD_SUCCESS;
}
DEFUN(cfg_nitb_no_subscr_create, cfg_nitb_no_subscr_create_cmd,
"no subscriber-create-on-demand",
NO_STR "Make a new record when a subscriber is first seen.\n")
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
gsmnet->create_subscriber = 0;
return CMD_SUCCESS;
}
static int config_write_nitb(struct vty *vty)
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
vty_out(vty, "nitb%s", VTY_NEWLINE);
vty_out(vty, " %ssubscriber-create-on-demand%s",
gsmnet->create_subscriber ? "" : "no ", VTY_NEWLINE);
return CMD_SUCCESS;
}
int bsc_vty_init_extra(void)
{
osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL);
@ -1100,5 +1141,11 @@ int bsc_vty_init_extra(void)
install_element(CFG_LOG_NODE, &log_level_sms_cmd);
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
install_element(CONFIG_NODE, &cfg_nitb_cmd);
install_node(&nitb_node, config_write_nitb);
install_element(NITB_NODE, &cfg_nitb_subscr_create_cmd);
install_element(NITB_NODE, &cfg_nitb_no_subscr_create_cmd);
return 0;
}