WIP: Add MSC pooling

Change-Id: I7a328895cd2517d95b28125357361be52c6b807d
This commit is contained in:
Oliver Smith 2022-06-09 15:52:15 +02:00
parent f812f3c0d4
commit 3dc0ca61d0
9 changed files with 489 additions and 32 deletions

View File

@ -3,7 +3,7 @@ cs7 instance 0
asp asp-clnt-OsmoBSCNAT-CN 2905 0 m3ua
remote-ip 127.0.0.1
local-ip 127.0.0.3
sccp-address msc
sccp-address msc0
routing-indicator PC
point-code 0.23.1
subsystem-number 254
@ -24,3 +24,6 @@ mgw 0
mgw local-ip 127.0.0.15
mgw local-port 2427
mgw endpoint-domain bscnat
msc 0
msc-addr msc0

View File

@ -46,6 +46,9 @@ struct bsc_nat {
struct osmo_tdef *tdefs;
struct llist_head subscr_conns; /* list of struct subscr_conn */
uint8_t nri_bitlen;
struct osmo_nri_ranges *null_nri_ranges;
struct {
struct mgcp_client_pool *pool;
uint32_t call_id_next;
@ -55,6 +58,7 @@ struct bsc_nat {
struct bsc_nat_sccp_inst *sccp_inst;
uint32_t subscr_conn_id_next;
struct llist_head mscs; /* list of struct msc */
uint16_t msc_id_next;
} cn;
struct {

View File

@ -24,14 +24,16 @@
struct msc {
struct llist_head list;
struct osmo_sccp_addr addr;
uint16_t id;
struct osmo_sccp_addr *addr;
struct osmo_fsm_inst *fi;
struct osmo_nri_ranges *nri_ranges;
bool allow_attach;
};
struct msc *msc_alloc(struct osmo_sccp_addr *addr);
int msc_alloc_from_addr_book(void);
struct msc *msc_alloc(uint16_t id);
struct msc *msc_get(void);
struct msc *msc_get_by_id(uint16_t id);
void msc_tx_reset(struct msc *msc);
void msc_rx_reset_ack(struct msc *msc);

View File

@ -171,6 +171,7 @@ static int sccp_sap_up_ran(struct osmo_prim_hdr *oph, void *scu)
struct bsc_nat_sccp_inst *sccp_inst = osmo_sccp_user_get_priv(scu);
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
struct osmo_sccp_addr *addr; /* BSC's address */
struct osmo_mobile_identity mi = {};
struct subscr_conn *subscr_conn;
struct msc *msc;
struct bsc *bsc;
@ -178,12 +179,6 @@ static int sccp_sap_up_ran(struct osmo_prim_hdr *oph, void *scu)
LOGP(DMAIN, LOGL_DEBUG, "Rx %s from RAN\n", osmo_scu_prim_name(oph));
msc = msc_get();
if (!msc_is_connected(msc)) {
LOGP(DMAIN, LOGL_DEBUG, "Ignoring message from RAN, MSC is not connected yet\n");
goto error;
}
switch (OSMO_PRIM_HDR(oph)) {
case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_INDICATION):
/* indication of new inbound connection request */
@ -200,11 +195,27 @@ static int sccp_sap_up_ran(struct osmo_prim_hdr *oph, void *scu)
goto error;
}
if (bssap_get_mi_from_cr(&mi, oph->msg, msgb_l2len(oph->msg)) < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to extract mobile identifier in conn req from %s\n",
talloc_get_name(bsc));
/* msc_get_by_mi() will use round-robin to choose the
* MSC when the type is none */
mi.type = GSM_MI_TYPE_NONE;
}
msc = msc_get_by_mi(&mi);
if (!msc) {
LOGP(DMAIN, LOGL_ERROR, "Failed to find an MSC to handle conn req from %s\n",
talloc_get_name(bsc));
goto error;
}
rc = subscr_conn_get_next_id_ran();
if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to get next_id_ran\n");
goto error;
}
subscr_conn = subscr_conn_alloc(msc, bsc, rc, prim->u.connect.conn_id);
LOGP(DMAIN, LOGL_DEBUG, "Fwd via %s\n", talloc_get_name(subscr_conn));

View File

@ -313,3 +313,66 @@ int bssap_handle_dt(enum bsc_nat_net net, struct subscr_conn *subscr_conn, struc
return rc;
}
static int bssmap_get_mi(struct osmo_mobile_identity *mi, struct msgb *msgb, unsigned int length)
{
struct tlv_parsed tp;
struct tlv_p_entry *e;
struct msgb *dtap;
unsigned char *pos;
int rc;
if (length < 1) {
LOGP(DMAIN, LOGL_ERROR, "Not enough room: %u\n", length);
return -1;
}
if (msg->l3h[0] != BSS_MAP_MSG_COMPLETE_LAYER_3) {
LOGP(DMAIN, LOGL_ERROR, "%s(%s) is not implemented!\n", __func__, gsm0808_bssmap_name(msgb->l3h[0]));
return -1;
}
tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, length - 1, 0, 0);
if (!(e = TLVP_GET(&tp, GSM0808_IE_LAYER_3_INFORMATION))) {
LOGP(DMAIN, LOGL_ERROR, "Missing IE: Layer 3 Information\n");
return -1;
}
e->val
dtap = msgb_alloc(len, "DTAP from Complete Layer 3 Information");
pos = msgb_put(dtap, e->len);
memcpy(pos, e->val, e->len);
dtap->l3h = pos;
rc = osmo_mobile_identity_decode_from_l3(&mi, msg, false);
msgb_free(dtap);
return rc;
}
int bssap_get_mi_from_cr(struct osmo_mobile_identity *mi, struct msgb *msgb, unsigned int length)
{
struct bssmap_header *bs;
LOGP(DMAIN, LOGL_DEBUG, "Rx CR: %s\n", osmo_hexdump(msgb->l2h, length));
if (length < sizeof(*bs)) {
LOGP(DMAIN, LOGL_ERROR, "The header is too short\n");
return -1;
}
switch (msgb->l2h[0]) {
case BSSAP_MSG_BSS_MANAGEMENT:
bs = (struct bssmap_header *)msgb->l2h;
if (bs->length < length - sizeof(*bs)) {
LOGP(DMAIN, LOGL_ERROR, "Failed to parse BSSMAP header\n");
return -1;
}
msgb->l3h = &msgb->l2h[sizeof(*bs)];
return bssmap_get_mi(mi, msgb, length - sizeof(*bs));
default:
LOGP(DMAIN, LOGL_ERROR, "%s(%s) is not implemented!\n", __func__, gsm0808_bssap_name(msgb->l2h[0]));
}
return -1;
}

View File

@ -202,9 +202,6 @@ int main(int argc, char **argv)
if (bsc_nat_fsm_start(g_bsc_nat) < 0)
exit(1);
if (msc_alloc_from_addr_book() < 0)
exit(1);
while (!osmo_select_shutdown_done())
osmo_select_main_ctx(0);

View File

@ -26,17 +26,15 @@
extern struct osmo_fsm msc_fsm;
struct msc *msc_alloc(struct osmo_sccp_addr *addr)
struct msc *msc_alloc(uint16_t id)
{
struct msc *msc = talloc_zero(g_bsc_nat, struct msc);
OSMO_ASSERT(msc);
talloc_set_name(msc, "MSC(PC=%s)", osmo_ss7_pointcode_print(NULL, addr->pc));
talloc_set_name(msc, "MSC(ID=%" PRIu16 ")", id);
LOGP(DMAIN, LOGL_DEBUG, "Add %s\n", talloc_get_name(msc));
msc->addr = *addr;
INIT_LLIST_HEAD(&msc->list);
llist_add(&msc->list, &g_bsc_nat->cn.mscs);
@ -48,27 +46,98 @@ struct msc *msc_alloc(struct osmo_sccp_addr *addr)
return msc;
}
int msc_alloc_from_addr_book(void)
struct msc *msc_get_by_id(uint16_t id)
{
struct osmo_sccp_addr addr;
struct msc *msc;
/* For now only one MSC is supported */
if (osmo_sccp_addr_by_name_local(&addr, "msc", g_bsc_nat->cn.sccp_inst->ss7_inst) < 0) {
LOGP(DMAIN, LOGL_ERROR, "Configuration error, MSC not found in address book\n");
return -ENOENT;
llist_for_each_entry(msc, &g_bsc_nat->cn.mscs, list) {
if (msc->id == id)
return msc;
}
msc_alloc(&addr);
return 0;
return NULL;
}
struct msc *msc_get(void)
struct msc *msc_get_by_mi(const struct osmo_mobile_identity *mi)
{
/* For now only one MSC is supported */
struct msc *msc;
struct msc *msc_target = NULL;
struct msc *msc_round_robin_next = NULL;
struct msc *msc_round_robin_first = NULL;
uint8_t round_robin_id_next;
int16_t nri_v = -1;
bool is_null_nri = false;
OSMO_ASSERT(!llist_empty(&g_bsc_nat->cn.mscs));
#define LOG_NRI(LOGLEVEL, FORMAT, ARGS...) \
LOGP(DMSC, LOGLEVEL, "%s NRI(%d)=0x%x=%d: " FORMAT, osmo_mobile_identity_to_str_c(OTC_SELECT, mi), \
net->nri_bitlen, nri_v, nri_v, ##ARGS)
return llist_first_entry(&g_bsc_nat->cn.mscs, struct msc, list);
/* Extract NRI bits from TMSI, possibly indicating which MSC is
* responsible */
if (mi->type == GSM_MI_TYPE_TMSI) {
if (osmo_tmsi_nri_v_get(&nri_v, mi->tmsi, net->nri_bitlen)) {
LOGP(DMSC, LOGL_ERROR, "Unable to retrieve NRI from TMSI, nri_bitlen == %u\n", net->nri_bitlen);
nri_v = -1;
} else {
is_null_nri = osmo_nri_v_matches_ranges(nri_v, net->null_nri_ranges);
if (is_null_nri)
LOG_NRI(LOGL_DEBUG, "this is a NULL-NRI\n");
}
}
/* Iterate MSCs to find one that matches the extracted NRI, and the
* next round-robin target for the case no NRI match is found. */
round_robin_id_next = g_bsc_nat->cn.msc_id_next;
llist_for_each_entry(msc, &g_bsc_nat->mscs, list) {
bool nri_matches_msc = (nri_v >= 0 && osmo_nri_v_matches_ranges(nri_v, msc->nri_ranges));
if (!msc_is_connected(msc)) {
if (nri_matches_msc) {
LOG_NRI(LOGL_DEBUG, "matches %s, but this MSC is currently not connected\n",
talloc_get_name(msc));
}
continue;
}
/* Return MSC if it matches this NRI, with debug logging. */
if (nri_matches_msc) {
if (is_null_nri) {
LOG_NRI(LOGL_DEBUG, "matches %s, but this NRI is also configured as NULL-NRI\n",
talloc_get_name(msc));
} else {
LOG_NRI(LOGL_DEBUG, "matches %s\n", talloc_get_name(msc));
return msc;
}
}
/* Figure out the next round-robin MSC, same logic as in
* osmo-bsc.git bsc_find_msc() (see lenghty comment there). */
if (!msc->allow_attach)
continue;
if (!msc_round_robin_first || msc->id < msc_round_robin_first->id)
msc_round_robin_first = msc;
if (msc->id >= round_robin_id_next
&& (!msc_round_robin_next || msc->id < msc_round_robin_next->id))
msc_round_robin_next = msc;
}
if (nri_v >= 0 && !is_null_nri)
LOG_NRI(LOGL_DEBUG, "No MSC found for this NRI, doing round-robin\n");
/* No dedicated MSC found. Choose by round-robin. If
* msc_round_robin_next is NULL, there are either no more MSCs at/after
* msc_id_next, or none of them are usable -- wrap to the start. */
msc_target = msc_round_robin_next ? : msc_round_robin_first;
if (!msc_target)
return NULL;
LOGP(DMSC, LOGL_DEBUG, "New subscriber %s: MSC round-robin selects %s\n",
osmo_mobile_identity_to_str_c(OTC_SELECT, mi), talloc_get_name(msc_target));
/* An MSC was picked by round-robin, so update the next id to pick */
g_bsc_nat->cn.msc_id_next = msc_target->id + 1;
return msc_target;
#undef LOG_NRI
}
void msc_free_subscr_conn_all(struct msc *msc)

View File

@ -72,11 +72,14 @@ static void st_disconnected(struct osmo_fsm_inst *fi, uint32_t event, void *data
case MSC_FSM_EV_TX_RESET:
LOGP(DMAIN, LOGL_DEBUG, "Tx RESET to %s\n", talloc_get_name(msc));
if (bssmap_tx_reset(g_bsc_nat->cn.sccp_inst, &msc->addr) < 0) {
if (!msc->addr) {
LOGP(DMAIN, LOGL_NOTICE, "MSC addr is not configured yet\n");
} else if (bssmap_tx_reset(g_bsc_nat->cn.sccp_inst, msc->addr) < 0) {
LOGP(DMAIN, LOGL_NOTICE, "Could not send RESET to MSC (SCCP not up yet?)\n");
}
/* Retry if RESET ACK was not received from MSC */
/* Retry with timeout if RESET could not be sent or RESET ACK
* was not received from MSC */
msc_fsm_state_chg(fi, MSC_FSM_ST_CONNECTING);
break;

View File

@ -19,6 +19,7 @@
#include "config.h"
#include <unistd.h>
#include <osmocom/gsm/gsm23236.h>
#include <osmocom/mgcp_client/mgcp_client_pool.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.h>
@ -44,12 +45,29 @@ DEFUN(cfg_bsc_nat,
return CMD_SUCCESS;
}
void config_write_bsc_nat_nri(struct vty *vty)
{
struct osmo_nri_range *r;
if (g_bsc_nat->nri_bitlen != OSMO_NRI_BITLEN_DEFAULT)
vty_out(vty, " nri bitlen %u%s", g_bsc_nat->nri_bitlen, VTY_NEWLINE);
llist_for_each_entry(r, &g_bsc_nat->null_nri_ranges->entries, entry) {
vty_out(vty, " nri null add %d", r->first);
if (r->first != r->last)
vty_out(vty, " %d", r->last);
vty_out(vty, "%s", VTY_NEWLINE);
}
}
static int config_write_bsc_nat(struct vty *vty)
{
vty_out(vty, "bsc-nat%s", VTY_NEWLINE);
vty_out(vty, " cs7-instance-cn %u%s", g_bsc_nat->cn.sccp_inst->ss7_id, VTY_NEWLINE);
vty_out(vty, " cs7-instance-ran %u%s", g_bsc_nat->ran.sccp_inst->ss7_id, VTY_NEWLINE);
config_write_bsc_nat_nri(vty);
return CMD_SUCCESS;
}
@ -73,12 +91,299 @@ DEFUN(cfg_cs7_instance_ran,
return CMD_SUCCESS;
}
#define NRI_STR "Mapping of Network Resource Indicators for MSC pooling\n"
#define NULL_NRI_STR "Define NULL-NRI values that cause re-assignment of an MS to a different MSC, for MSC pooling.\n"
#define NRI_FIRST_LAST_STR "First value of the NRI value range, should not surpass the configured 'nri bitlen'.\n" \
"Last value of the NRI value range, should not surpass the configured 'nri bitlen' and be larger than the" \
" first value; if omitted, apply only the first value.\n"
#define NRI_ARGS_TO_STR_FMT "%s%s%s"
#define NRI_ARGS_TO_STR_ARGS(ARGC, ARGV) ARGV[0], (ARGC > 1) ? ".." : "", (ARGC > 1) ? ARGV[1] : ""
#define NRI_WARN(MSC, FORMAT, args...) do { \
vty_out(vty, "%% Warning: msc %d: " FORMAT "%s", MSC->nr, ##args, VTY_NEWLINE); \
LOGP(DMSC, LOGL_ERROR, "msc %d: " FORMAT "\n", MSC->nr, ##args); \
} while (0)
DEFUN_ATTR(cfg_nri_bitlen,
cfg_nri_bitlen_cmd,
"nri bitlen <1-15>",
NRI_STR
"Set number of bits that an NRI has, to extract from TMSI identities (always starting just after the TMSI's most significant octet).\n"
"bit count (default: " OSMO_STRINGIFY_VAL(OSMO_NRI_BITLEN_DEFAULT) ")\n",
CMD_ATTR_IMMEDIATE)
{
g_bsc_nat->nri_bitlen = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_nri_null_add,
cfg_nri_null_add_cmd,
"nri null add <0-32767> [<0-32767>]",
NRI_STR NULL_NRI_STR "Add NULL-NRI value (or range)\n"
NRI_FIRST_LAST_STR,
CMD_ATTR_IMMEDIATE)
{
int rc;
const char *message;
rc = osmo_nri_ranges_vty_add(&message, NULL, g_bsc_nat->null_nri_ranges, argc, argv,
g_bsc_nat->nri_bitlen);
if (message) {
vty_out(vty, "%% %s: " NRI_ARGS_TO_STR_FMT, message, NRI_ARGS_TO_STR_ARGS(argc, argv));
}
if (rc < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_nri_null_del,
cfg_nri_null_del_cmd,
"nri null del <0-32767> [<0-32767>]",
NRI_STR NULL_NRI_STR "Remove NRI value or range from the NRI mapping\n"
NRI_FIRST_LAST_STR,
CMD_ATTR_IMMEDIATE)
{
int rc;
const char *message;
rc = osmo_nri_ranges_vty_del(&message, NULL, g_bsc_nat->null_nri_ranges, argc, argv);
if (message) {
vty_out(vty, "%% %s: " NRI_ARGS_TO_STR_FMT "%s", message, NRI_ARGS_TO_STR_ARGS(argc, argv),
VTY_NEWLINE);
}
if (rc < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
DEFUN(show_nri, show_nri_cmd,
"show nri [" MSC_NR_RANGE "]",
SHOW_STR NRI_STR "Optional MSC number to limit to\n")
{
struct msc *msc;
if (argc > 0) {
uint16_t msc_id = atoi(argv[0]);
msc = msc_get_by_id(msc_id);
if (!msc) {
vty_out(vty, "%% No such MSC%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
msc_write_nri(vty, msc, true);
return CMD_SUCCESS;
}
llist_for_each_entry(msc, &g_bsc_nat->cn.mscs, list) {
msc_write_nri(vty, msc, true);
}
return CMD_SUCCESS;
}
static struct cmd_node msc_node = {
MSC_NODE,
"%s(config-msc)# ",
1,
};
#define MSC_NR_RANGE "<0-1000>"
DEFUN_ATTR(cfg_msc,
cfg_msc_cmd,
"msc [" MSC_NR_RANGE "]", "Configure MSC details\n" "MSC connection to configure\n",
CMD_ATTR_IMMEDIATE)
{
int index = argc == 1 ? atoi(argv[0]) : 0;
struct msc *msc;
msc = msc_alloc(index);
if (!msc) {
vty_out(vty, "%% Failed to allocate MSC data.%s", VTY_NEWLINE);
return CMD_WARNING;
}
vty->index = msc;
vty->node = MSC_NODE;
return CMD_SUCCESS;
}
static void config_write_msc_nri(struct vty *vty, struct msc *msc, bool verbose)
{
struct osmo_nri_range *r;
if (verbose) {
vty_out(vty, "msc " PRIu16 "%s", msc->id, VTY_NEWLINE);
if (llist_empty(&msc->nri_ranges->list)) {
vty_out(vty, " %% no NRI mappings%s", VTY_NEWLINE);
return;
}
}
llist_for_each_entry(r, &msc->nri_ranges->entries, list) {
if (osmo_nri_range_validate(r, 255))
vty_out(vty, " %% INVALID RANGE:");
vty_out(vty, " nri add %d", r->first);
if (r->first != r->last)
vty_out(vty, " %d", r->last);
vty_out(vty, "%s", VTY_NEWLINE);
}
}
static int config_write_msc(struct vty *vty)
{
struct msc *msc;
llist_for_each_entry(msc, &g_bsc_nat->mscs, list) {
vty_out(vty, "msc " PRIu16 "%s", msc->id, VTY_NEWLINE);
if (msc->addr_name)
vty_out(vty, " msc-addr %s%s", msc->addr_name, VTY_NEWLINE);
config_write_msc_nri(vty, msc, false);
if (!msc->allow_attach)
vty_out(vty, " no allow-attach%s", VTY_NEWLINE);
}
return CMD_SUCCESS;
}
DEFUN(cfg_msc_cs7_msc_addr,
cfg_msc_cs7_msc_addr_cmd,
"msc-addr NAME",
"Called Address (remote address of the MSC)\n" "SCCP address name\n")
{
struct msc *msc = vty->index;
const char *addr_name = argv[0];
struct osmo_sccp_addr addr;
if (osmo_sccp_addr_by_name_local(&addr, addr_name, g_bsc_nat->cn.sccp_inst->ss7_inst) < 0) {
vty_out(vty, "Error: No such SCCP addressbook entry: '%s'%s", addr_name, VTY_NEWLINE);
return CMD_ERR_INCOMPLETE;
}
if (msc->addr)
talloc_free(msc->addr);
msc->addr = talloc_memdup(msc, &addr, sizeof(addr));
OSMO_ASSERT(msc->addr);
if (msc->addr_name)
talloc_free(msc->addr_name);
msc->addr_name = talloc_strdup(msc, addr_name);
OSMO_ASSERT(msc->addr_name);
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_msc_nri_add, cfg_msc_nri_add_cmd,
"nri add <0-32767> [<0-32767>]",
NRI_STR "Add NRI value or range to the NRI mapping for this MSC\n"
NRI_FIRST_LAST_STR,
CMD_ATTR_IMMEDIATE)
{
struct msc *msc = vty->index;
struct msc *other_msc;
bool before;
int rc;
const char *message;
struct osmo_nri_range add_range;
rc = osmo_nri_ranges_vty_add(&message, &add_range, msc->nri_ranges, argc, argv, g_bsc_nat->nri_bitlen);
if (message) {
NRI_WARN(msc, "%s: " NRI_ARGS_TO_STR_FMT, message, NRI_ARGS_TO_STR_ARGS(argc, argv));
}
if (rc < 0)
return CMD_WARNING;
/* Issue a warning about NRI range overlaps (but still allow them).
* Overlapping ranges will map to whichever MSC comes fist in the g_bsc_nat->cn.mscs llist,
* which is not necessarily in the order of increasing msc->nr. */
before = true;
llist_for_each_entry(other_msc, &g_bsc_nat->cn.mscs, entry) {
if (other_msc == msc) {
before = false;
continue;
}
if (osmo_nri_range_overlaps_ranges(&add_range, other_msc->nri_ranges)) {
NRI_WARN(msc, "NRI range [%d..%d] overlaps between msc %d and msc %d."
" For overlaps, msc %d has higher priority than msc %d",
add_range.first, add_range.last, msc->nr, other_msc->nr,
before ? other_msc->nr : msc->nr, before ? msc->nr : other_msc->nr);
}
}
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_msc_nri_del, cfg_msc_nri_del_cmd,
"nri del <0-32767> [<0-32767>]",
NRI_STR "Remove NRI value or range from the NRI mapping for this MSC\n"
NRI_FIRST_LAST_STR,
CMD_ATTR_IMMEDIATE)
{
struct msc *msc = vty->index;
int rc;
const char *message;
rc = osmo_nri_ranges_vty_del(&message, NULL, msc->nri_ranges, argc, argv);
if (message) {
NRI_WARN(msc, "%s: " NRI_ARGS_TO_STR_FMT, message, NRI_ARGS_TO_STR_ARGS(argc, argv));
}
if (rc < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
DEFUN(cfg_msc_show_nri, cfg_msc_show_nri_cmd,
"show nri",
SHOW_STR NRI_STR)
{
struct msc *msc = vty->index;
msc_write_nri(vty, msc, true);
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_msc_allow_attach, cfg_msc_allow_attach_cmd,
"allow-attach",
"Allow this MSC to attach new subscribers (default).\n",
CMD_ATTR_IMMEDIATE)
{
struct msc *msc = vty->index;
msc->allow_attach = true;
return CMD_SUCCESS;
}
DEFUN_ATTR(cfg_msc_no_allow_attach, cfg_msc_no_allow_attach_cmd,
"no allow-attach",
NO_STR
"Do not assign new subscribers to this MSC."
" Useful if an MSC in an MSC pool is configured to off-load subscribers."
" The MSC will still be operational for already IMSI-Attached subscribers,"
" but the NAS node selection function will skip this MSC for new subscribers\n",
CMD_ATTR_IMMEDIATE)
{
struct msc *msc = vty->index;
msc->allow_attach = false;
return CMD_SUCCESS;
}
void bsc_nat_vty_init(void)
{
install_element(CONFIG_NODE, &cfg_bsc_nat_cmd);
install_element(CONFIG_NODE, &cfg_msc_cmd);
install_node(&bsc_nat_node, config_write_bsc_nat);
install_element(BSC_NAT_NODE, &cfg_cs7_instance_cn_cmd);
install_element(BSC_NAT_NODE, &cfg_cs7_instance_ran_cmd);
install_element(BSC_NAT_NODE, &cfg_nri_bitlen_cmd);
install_element(BSC_NAT_NODE, &cfg_nri_null_add_cmd);
install_element(BSC_NAT_NODE, &cfg_nri_null_del_cmd);
install_node(&msc_node, config_write_msc);
install_element(MSC_NODE, &cfg_msc_cs7_bsc_nat_addr_cmd);
install_element(MSC_NODE, &cfg_msc_cs7_msc_addr_cmd);
install_element(MSC_NODE, &cfg_msc_nri_add_cmd);
install_element(MSC_NODE, &cfg_msc_nri_del_cmd);
install_element(MSC_NODE, &cfg_msc_show_nri_cmd);
install_element(MSC_NODE, &cfg_msc_allow_attach_cmd);
install_element(MSC_NODE, &cfg_msc_no_allow_attach_cmd);
install_element_ve(&show_nri_cmd);
osmo_tdef_vty_groups_init(CONFIG_NODE, g_bsc_nat_tdef_group);