neels has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130 )
Change subject: cnpool: make NRI mappings VTY configurable
......................................................................
cnpool: make NRI mappings VTY configurable
Implement only the VTY configuration part, applying NRI to select CN
links follows in I66fba27cfbe6e2b27ee3443718846ecfbbd8a974.
Use the osmo_nri_ranges API to manage each cnlink's NRI ranges by VTY
configuration.
Analogous to osmo-bsc
MSC pooling: make NRI mappings VTY configurable
4099f1db504c401e3d7211d9761b034d62d15f7c
I6c251f2744d7be26fc4ad74adefc96a6a3fe08b0
plus
vty: fix doc: default value for 'nri bitlen'
f15d236e3eee8e7cbdc184d401f33b062d1b1aac
I8af840a4589f47eaca6bf10e37e0859f9ae53dfa
Related: SYS#6412
Change-Id: Ifb87e01e5971962e5cfe5e127871af4a67806de1
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_cn.c
M src/osmo-hnbgw/hnbgw_vty.c
M tests/Makefile.am
M tests/cnpool.vty
A tests/nri_cfg.vty
7 files changed, 786 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/30/33130/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 14552fb..cc32f93 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -101,9 +101,8 @@
/* User provided configuration for struct hnbgw_cnpool. */
struct hnbgw_cnpool_cfg {
- /* FUTURE: This will be added here shortly:
- * - global NRI config: bitlen and NULL-NRI.
- */
+ uint8_t nri_bitlen;
+ struct osmo_nri_ranges *null_nri_ranges;
};
/* User provided configuration for struct hnbgw_cnlink. */
@@ -112,9 +111,7 @@
* use. */
char *remote_addr_name;
- /* FUTURE: This will be added here shortly:
- * - per peer NRI config: NRI ranges assigned to this peer.
- */
+ struct osmo_nri_ranges *nri_ranges;
};
/* Collection of CN peers to distribute UE connections across. MSCs for DOMAIN_CS, SGSNs
for DOMAIN_PS. */
@@ -134,9 +131,10 @@
/* List of struct hnbgw_cnlink */
struct llist_head cnlinks;
- /* FUTURE: This will be added here shortly:
- * - round robin state for new conns
- */
+ unsigned int round_robin_next_nr;
+ /* Emergency calls potentially select a different set of MSCs, so to not mess up the
normal round-robin
+ * behavior, emergency calls need a separate round-robin counter. */
+ unsigned int round_robin_next_emerg_nr;
};
/* A CN peer, like 'msc 0' or 'sgsn 23' */
@@ -163,6 +161,9 @@
/* linked list of hnbgw_context_map */
struct llist_head map_list;
+
+ bool allow_attach;
+ bool allow_emerg;
};
#define LOG_CNLINK(CNLINK, SUBSYS, LEVEL, FMT, ARGS...) \
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 205c683..0d64adf 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -24,6 +24,8 @@
#include <osmocom/vty/vty.h>
+#include <osmocom/gsm/gsm23236.h>
+
#include <osmocom/netif/stream.h>
#include "config.h"
@@ -67,9 +69,8 @@
.peer_name = "msc",
.default_remote_pc = DEFAULT_PC_MSC,
.vty = {
- /* FUTURE: This will be added here shortly:
- * - defaults for global NRI config: bitlen and NULL-NRI.
- */
+ .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT,
+ .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw),
},
};
INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iucs.cnlinks);
@@ -80,9 +81,8 @@
.peer_name = "sgsn",
.default_remote_pc = DEFAULT_PC_SGSN,
.vty = {
- /* FUTURE: This will be added here shortly:
- * - defaults for global NRI config: bitlen and NULL-NRI.
- */
+ .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT,
+ .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw),
},
};
INIT_LLIST_HEAD(&g_hnbgw->sccp.cnpool_iups.cnlinks);
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index d829718..9dc2016 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -27,6 +27,8 @@
#include <osmocom/core/utils.h>
#include <osmocom/core/timer.h>
+#include <osmocom/gsm/gsm23236.h>
+
#include <osmocom/sigtran/protocol/m3ua.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/sccp_helpers.h>
@@ -453,12 +455,26 @@
void hnbgw_cnpool_apply_cfg(struct hnbgw_cnpool *cnpool)
{
- cnpool->use = cnpool->vty;
+ struct osmo_nri_range *r;
+
+ cnpool->use.nri_bitlen = cnpool->vty.nri_bitlen;
+
+ osmo_nri_ranges_free(cnpool->use.null_nri_ranges);
+ cnpool->use.null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw);
+ llist_for_each_entry(r, &cnpool->vty.null_nri_ranges->entries, entry)
+ osmo_nri_ranges_add(cnpool->use.null_nri_ranges, r);
}
static void hnbgw_cnlink_cfg_copy(struct hnbgw_cnlink *cnlink)
{
+ struct osmo_nri_range *r;
+
osmo_talloc_replace_string(cnlink, &cnlink->use.remote_addr_name,
cnlink->vty.remote_addr_name);
+
+ osmo_nri_ranges_free(cnlink->use.nri_ranges);
+ cnlink->use.nri_ranges = osmo_nri_ranges_alloc(cnlink);
+ llist_for_each_entry(r, &cnlink->vty.nri_ranges->entries, entry)
+ osmo_nri_ranges_add(cnlink->use.nri_ranges, r);
}
static bool hnbgw_cnlink_sccp_cfg_changed(struct hnbgw_cnlink *cnlink)
@@ -636,7 +652,9 @@
.nr = nr,
.vty = {
/* VTY config defaults for the new cnlink */
+ .nri_ranges = osmo_nri_ranges_alloc(cnlink),
},
+ .allow_attach = true,
};
INIT_LLIST_HEAD(&cnlink->map_list);
diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c
index 206db4f..3404a3f 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -26,6 +26,8 @@
#include <osmocom/vty/command.h>
#include <osmocom/vty/tdef_vty.h>
+#include <osmocom/gsm/gsm23236.h>
+
#include <osmocom/hnbgw/vty.h>
#include <osmocom/hnbgw/hnbgw.h>
@@ -346,6 +348,69 @@
return CMD_WARNING;
}
+#define NRI_STR "Mapping of Network Resource Indicators to this CN peer, for CN
pooling\n"
+#define NULL_NRI_STR "Define NULL-NRI values that cause re-assignment of an MS to a
different CN peer, for CN 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(CNLINK, FORMAT, args...) do { \
+ vty_out(vty, "%% Warning: %s %d: " FORMAT "%s",
CNLINK->pool->peer_name, CNLINK->nr, ##args, \
+ VTY_NEWLINE); \
+ LOGP(DCN, LOGL_ERROR, "%s %d: " FORMAT "\n",
CNLINK->pool->peer_name, CNLINK->nr, ##args); \
+ } while (0)
+
+
+/* hnbgw/iucs/nri ... AND hnbgw/iups/nri ... */
+DEFUN(cfg_hnbgw_cnpool_nri_bitlen,
+ cfg_hnbgw_cnpool_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")
+{
+ struct hnbgw_cnpool *cnpool = vty->index;
+ cnpool->vty.nri_bitlen = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+/* hnbgw/iucs/nri ... AND hnbgw/iups/nri ... */
+DEFUN(cfg_hnbgw_cnpool_nri_null_add, cfg_hnbgw_cnpool_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)
+{
+ int rc;
+ const char *message;
+ struct hnbgw_cnpool *cnpool = vty->index;
+ rc = osmo_nri_ranges_vty_add(&message, NULL, cnpool->vty.null_nri_ranges, argc,
argv, cnpool->vty.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;
+}
+
+/* hnbgw/iucs/nri ... AND hnbgw/iups/nri ... */
+DEFUN(cfg_hnbgw_cnpool_nri_null_del, cfg_hnbgw_cnpool_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 for this
CN link\n"
+ NRI_FIRST_LAST_STR)
+{
+ int rc;
+ const char *message;
+ struct hnbgw_cnpool *cnpool = vty->index;
+ rc = osmo_nri_ranges_vty_del(&message, NULL, cnpool->vty.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;
+}
+
/* Legacy from when there was only one IuCS and one IuPS peer. Instead, there are now
'msc 123' / 'sgsn 123' sub nodes.
* To yield legacy behavior, set the first cnlink config in this pool ('msc 0' /
'sgsn 0'). */
DEFUN_DEPRECATED(cfg_hnbgw_cnpool_remote_addr,
@@ -436,6 +501,217 @@
return CMD_SUCCESS;
}
+DEFUN_ATTR(cfg_cnlink_nri_add, cfg_cnlink_nri_add_cmd,
+ "nri add <0-32767> [<0-32767>]",
+ NRI_STR "Add NRI value or range to the NRI mapping for this CN link\n"
+ NRI_FIRST_LAST_STR,
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ struct hnbgw_cnlink *other_cnlink;
+ bool before;
+ int rc;
+ const char *message;
+ struct osmo_nri_range added_range;
+
+ rc = osmo_nri_ranges_vty_add(&message, &added_range, cnlink->vty.nri_ranges,
argc, argv, cnlink->pool->vty.nri_bitlen);
+ if (message) {
+ NRI_WARN(cnlink, "%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 CN link comes fist in the llist,
+ * which is not necessarily in the order of increasing cnlink->nr. */
+ before = true;
+ llist_for_each_entry(other_cnlink, &cnlink->pool->cnlinks, entry) {
+ if (other_cnlink == cnlink) {
+ before = false;
+ continue;
+ }
+ if (osmo_nri_range_overlaps_ranges(&added_range, other_cnlink->vty.nri_ranges))
{
+ NRI_WARN(cnlink, "NRI range [%d..%d] overlaps between %s %d and %s %d."
+ " For overlaps, %s %d has higher priority than %s %d",
+ added_range.first, added_range.last, cnlink->pool->peer_name, cnlink->nr,
+ other_cnlink->pool->peer_name, other_cnlink->nr,
+ (before ? other_cnlink : cnlink)->pool->peer_name,
+ (before ? other_cnlink : cnlink)->nr,
+ (before ? cnlink : other_cnlink)->pool->peer_name,
+ (before ? cnlink : other_cnlink)->nr);
+ }
+ }
+ return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_cnlink_nri_del, cfg_cnlink_nri_del_cmd,
+ "nri del <0-32767> [<0-32767>]",
+ NRI_STR "Remove NRI value or range from the NRI mapping for this CN
link\n"
+ NRI_FIRST_LAST_STR,
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ int rc;
+ const char *message;
+
+ rc = osmo_nri_ranges_vty_del(&message, NULL, cnlink->vty.nri_ranges, argc,
argv);
+ if (message) {
+ NRI_WARN(cnlink, "%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_cnlink_allow_attach, cfg_cnlink_allow_attach_cmd,
+ "allow-attach",
+ "Allow this CN link to attach new subscribers (default).\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ cnlink->allow_attach = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_cnlink_no_allow_attach, cfg_cnlink_no_allow_attach_cmd,
+ "no allow-attach",
+ NO_STR
+ "Do not assign new subscribers to this CN link."
+ " Useful if an CN link in an CN link pool is configured to off-load
subscribers."
+ " The CN link will still be operational for already IMSI-Attached
subscribers,"
+ " but the NAS node selection function will skip this CN link for new
subscribers\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ cnlink->allow_attach = false;
+ return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_cnlink_allow_emerg,
+ cfg_cnlink_allow_emerg_cmd,
+ "allow-emergency",
+ "Allow CM ServiceRequests with type emergency on this CN link\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ cnlink->allow_emerg = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN_ATTR(cfg_cnlink_no_allow_emerg,
+ cfg_cnlink_no_allow_emerg_cmd,
+ "no allow-emergency",
+ NO_STR
+ "Do not serve CM ServiceRequests with type emergency on this CN link\n",
+ CMD_ATTR_IMMEDIATE)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ cnlink->allow_emerg = false;
+ return CMD_SUCCESS;
+}
+
+static void cnlink_write_nri(struct vty *vty, struct hnbgw_cnlink *cnlink, bool verbose)
+{
+ struct osmo_nri_range *r;
+
+ if (verbose) {
+ vty_out(vty, "%s %d%s", cnlink->pool->peer_name, cnlink->nr,
VTY_NEWLINE);
+ if (llist_empty(&cnlink->vty.nri_ranges->entries)) {
+ vty_out(vty, " %% no NRI mappings%s", VTY_NEWLINE);
+ return;
+ }
+ }
+
+ llist_for_each_entry(r, &cnlink->vty.nri_ranges->entries, entry) {
+ 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);
+ }
+
+ if (!cnlink->allow_attach)
+ vty_out(vty, " no allow-attach%s", VTY_NEWLINE);
+ if (cnlink->allow_emerg)
+ vty_out(vty, " allow-emergency%s", VTY_NEWLINE);
+}
+
+DEFUN(cfg_cnlink_show_nri, cfg_cnlink_show_nri_cmd,
+ "show nri",
+ SHOW_STR NRI_STR)
+{
+ struct hnbgw_cnlink *cnlink = vty->index;
+ cnlink_write_nri(vty, cnlink, true);
+ return CMD_SUCCESS;
+}
+
+void cnlinks_write_nri(struct vty *vty, struct hnbgw_cnpool *cnpool, bool verbose)
+{
+ struct hnbgw_cnlink *cnlink;
+ llist_for_each_entry(cnlink, &cnpool->cnlinks, entry)
+ cnlink_write_nri(vty, cnlink, verbose);
+}
+
+void cnpool_write_nri(struct vty *vty, struct hnbgw_cnpool *cnpool, bool verbose)
+{
+ struct osmo_nri_range *r;
+
+ if (verbose)
+ vty_out(vty, " %s%s", cnpool->pool_name, VTY_NEWLINE);
+
+ if (verbose || cnpool->vty.nri_bitlen != OSMO_NRI_BITLEN_DEFAULT)
+ vty_out(vty, " nri bitlen %u%s", cnpool->vty.nri_bitlen, VTY_NEWLINE);
+
+ llist_for_each_entry(r, &cnpool->vty.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);
+ }
+ if (verbose && llist_empty(&cnpool->vty.null_nri_ranges->entries))
+ vty_out(vty, " %% No NULL-NRI entries%s", VTY_NEWLINE);
+}
+
+DEFUN(show_nri, show_nri_cmd,
+ "show nri",
+ SHOW_STR NRI_STR)
+{
+ /* hnbgw
+ * iucs
+ * nri null add ...
+ */
+ vty_out(vty, "hnbgw%s", VTY_NEWLINE);
+ cnpool_write_nri(vty, &g_hnbgw->sccp.cnpool_iucs, true);
+ cnpool_write_nri(vty, &g_hnbgw->sccp.cnpool_iups, true);
+
+ /* msc 0
+ * nri add ...
+ */
+ cnlinks_write_nri(vty, &g_hnbgw->sccp.cnpool_iucs, true);
+ cnlinks_write_nri(vty, &g_hnbgw->sccp.cnpool_iups, true);
+ return CMD_SUCCESS;
+}
+
+/* Hidden since it exists only for use by ttcn3 tests */
+DEFUN_HIDDEN(cnpool_roundrobin_next, cnpool_roundrobin_next_cmd,
+ "cnpool roundrobin next (msc|sgsn) " CNLINK_NR_RANGE,
+ "CN pooling: load balancing across multiple CN links.\n"
+ "Adjust current state of the CN link round-robin algorithm (for
testing).\n"
+ "Set the CN link nr to direct the next new subscriber to (for
testing).\n"
+ "Set next MSC or next SGSN number\n"
+ "CN link number, as in the config file; if the number does not exist,"
+ " the round-robin continues to the next valid number.\n")
+{
+ struct hnbgw_cnpool *cnpool;
+ if (!strcmp("msc", argv[0]))
+ cnpool = &g_hnbgw->sccp.cnpool_iucs;
+ else
+ cnpool = &g_hnbgw->sccp.cnpool_iups;
+ cnpool->round_robin_next_nr = atoi(argv[1]);
+ return CMD_SUCCESS;
+}
+
#define APPLY_STR "Immediately use configuration modified via telnet VTY, and
restart components as needed.\n"
#define SCCP_RESTART_STR \
" If 'remote-addr' changed, related SCCP links will be restarted,
possibly dropping active UE contexts."
@@ -518,6 +794,21 @@
#endif /* ENABLE_PFCP */
+/* hnbgw
+ * iucs } this part
+ * foo }
+ */
+static void _config_write_cnpool(struct vty *vty, struct hnbgw_cnpool *cnpool)
+{
+ if (cnpool->vty.nri_bitlen == OSMO_NRI_BITLEN_DEFAULT
+ && llist_empty(&cnpool->vty.null_nri_ranges->entries))
+ return;
+
+ vty_out(vty, " %s%s", cnpool->pool_name, VTY_NEWLINE);
+
+ cnpool_write_nri(vty, cnpool, false);
+}
+
static int config_write_hnbgw(struct vty *vty)
{
vty_out(vty, "hnbgw%s", VTY_NEWLINE);
@@ -528,6 +819,9 @@
VTY_NEWLINE);
osmo_tdef_vty_groups_write(vty, " ");
+ _config_write_cnpool(vty, &g_hnbgw->sccp.cnpool_iucs);
+ _config_write_cnpool(vty, &g_hnbgw->sccp.cnpool_iups);
+
return CMD_SUCCESS;
}
@@ -565,7 +859,7 @@
vty_out(vty, "%s %d%s", cnpool->peer_name, cnlink->nr, VTY_NEWLINE);
if (cnlink->vty.remote_addr_name)
vty_out(vty, " remote-addr %s%s", cnlink->vty.remote_addr_name,
VTY_NEWLINE);
- /* FUTURE: NRI config */
+ cnlink_write_nri(vty, cnlink, false);
}
}
@@ -597,7 +891,14 @@
static void install_cnlink_elements(int node)
{
install_element(node, &cfg_cnlink_remote_addr_cmd);
+ install_element(node, &cfg_cnlink_nri_add_cmd);
+ install_element(node, &cfg_cnlink_nri_del_cmd);
+ install_element(node, &cfg_cnlink_show_nri_cmd);
install_element(node, &cfg_cnlink_apply_sccp_cmd);
+ install_element(node, &cfg_cnlink_allow_attach_cmd);
+ install_element(node, &cfg_cnlink_no_allow_attach_cmd);
+ install_element(node, &cfg_cnlink_allow_emerg_cmd);
+ install_element(node, &cfg_cnlink_no_allow_emerg_cmd);
}
void hnbgw_vty_init(void)
@@ -618,9 +919,15 @@
install_element(HNBGW_NODE, &cfg_hnbgw_iucs_cmd);
install_node(&iucs_node, NULL);
+ install_element(IUCS_NODE, &cfg_hnbgw_cnpool_nri_bitlen_cmd);
+ install_element(IUCS_NODE, &cfg_hnbgw_cnpool_nri_null_add_cmd);
+ install_element(IUCS_NODE, &cfg_hnbgw_cnpool_nri_null_del_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_iups_cmd);
install_node(&iups_node, NULL);
+ install_element(IUPS_NODE, &cfg_hnbgw_cnpool_nri_bitlen_cmd);
+ install_element(IUPS_NODE, &cfg_hnbgw_cnpool_nri_null_add_cmd);
+ install_element(IUPS_NODE, &cfg_hnbgw_cnpool_nri_null_del_cmd);
/* deprecated: 'remote-addr' outside of 'msc 123' redirects to 'msc
0' / same for 'sgsn' */
install_element(IUCS_NODE, &cfg_hnbgw_cnpool_remote_addr_cmd);
@@ -647,6 +954,8 @@
install_element(PFCP_NODE, &cfg_pfcp_remote_addr_cmd);
#endif
+ osmo_tdef_vty_groups_init(HNBGW_NODE, hnbgw_tdef_group);
+
install_element(CONFIG_NODE, &cfg_msc_nr_cmd);
install_node(&msc_node, config_write_msc);
install_cnlink_elements(MSC_NODE);
@@ -658,5 +967,6 @@
/* global 'apply sccp' command. There are two more on MSC_NODE and SGSN_NODE
from install_cnlink_elements(). */
install_element(CONFIG_NODE, &cfg_config_apply_sccp_cmd);
- osmo_tdef_vty_groups_init(HNBGW_NODE, hnbgw_tdef_group);
+ install_element_ve(&show_nri_cmd);
+ install_element(ENABLE_NODE, &cnpool_roundrobin_next_cmd);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 62fb6c6..f34d9a0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,7 +25,7 @@
$(srcdir)/package.m4 \
$(TESTSUITE) \
osmo-hnbgw-vty-test.cfg \
- osmo-hnbgw.vty \
+ $(srcdir)/*.vty \
$(srcdir)/config/*.cfg \
$(srcdir)/config/*.vty \
$(srcdir)/config/run_tests.sh \
diff --git a/tests/cnpool.vty b/tests/cnpool.vty
index 6b57122..9745306 100644
--- a/tests/cnpool.vty
+++ b/tests/cnpool.vty
@@ -2,6 +2,17 @@
OsmoHNBGW# configure terminal
OsmoHNBGW(config)# ### cnpool doc strings
+OsmoHNBGW(config)# list
+...
+ apply sccp
+...
+
+OsmoHNBGW(config)# apply?
+ apply Immediately use configuration modified via telnet VTY, and restart components as
needed.
+
+OsmoHNBGW(config)# apply ?
+ sccp For telnet VTY: apply all SCCP and NRI config changes made to any CN pools and CN
links in the running osmo-hnbgw process. If 'remote-addr' changed, related SCCP
links will be restarted, possibly dropping active UE contexts. This is run implicitly on
program startup, only useful to apply changes made later via telnet VTY.
+
OsmoHNBGW(config)# hnbgw
OsmoHNBGW(config-hnbgw)# list
...
@@ -13,6 +24,79 @@
OsmoHNBGW(config-hnbgw)# iups?
iups Configure IuPS options
+OsmoHNBGW(config-hnbgw)# iucs
+
+OsmoHNBGW(config-hnbgw-iucs)# list
+...
+ nri bitlen <1-15>
+ nri null add <0-32767> [<0-32767>]
+ nri null del <0-32767> [<0-32767>]
+...
+
+OsmoHNBGW(config-hnbgw-iucs)# nri?
+ nri Mapping of Network Resource Indicators to this CN peer, for CN pooling
+
+OsmoHNBGW(config-hnbgw-iucs)# nri ?
+ bitlen Set number of bits that an NRI has, to extract from TMSI identities (always
starting just after the TMSI's most significant octet).
+ null Define NULL-NRI values that cause re-assignment of an MS to a different CN
peer, for CN pooling.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri bitlen ?
+ <1-15> bit count (default: 10)
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null ?
+ add Add NULL-NRI value (or range)
+ del Remove NRI value or range from the NRI mapping for this CN link
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null add ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null add 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null del ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null del 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iucs)# exit
+
+OsmoHNBGW(config-hnbgw)# iups
+
+OsmoHNBGW(config-hnbgw-iups)# list
+...
+ nri bitlen <1-15>
+ nri null add <0-32767> [<0-32767>]
+ nri null del <0-32767> [<0-32767>]
+...
+
+OsmoHNBGW(config-hnbgw-iups)# nri?
+ nri Mapping of Network Resource Indicators to this CN peer, for CN pooling
+
+OsmoHNBGW(config-hnbgw-iups)# nri ?
+ bitlen Set number of bits that an NRI has, to extract from TMSI identities (always
starting just after the TMSI's most significant octet).
+ null Define NULL-NRI values that cause re-assignment of an MS to a different CN
peer, for CN pooling.
+
+OsmoHNBGW(config-hnbgw-iups)# nri bitlen ?
+ <1-15> bit count (default: 10)
+
+OsmoHNBGW(config-hnbgw-iups)# nri null ?
+ add Add NULL-NRI value (or range)
+ del Remove NRI value or range from the NRI mapping for this CN link
+
+OsmoHNBGW(config-hnbgw-iups)# nri null add ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+
+OsmoHNBGW(config-hnbgw-iups)# nri null add 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iups)# nri null del ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+
+OsmoHNBGW(config-hnbgw-iups)# nri null del 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iups)# exit
OsmoHNBGW(config-hnbgw)# exit
OsmoHNBGW(config)# msc?
@@ -37,7 +121,14 @@
OsmoHNBGW(config-msc)# list
...
remote-addr NAME
+ nri add <0-32767> [<0-32767>]
+ nri del <0-32767> [<0-32767>]
+ show nri
apply sccp
+ allow-attach
+ no allow-attach
+ allow-emergency
+ no allow-emergency
...
OsmoHNBGW(config-msc)# remote-addr?
@@ -45,11 +136,25 @@
OsmoHNBGW(config-msc)# remote-addr ?
NAME SCCP address book entry name (see 'cs7 instance' /
'sccp-address')
+OsmoHNBGW(config-msc)# show nri?
+ nri Mapping of Network Resource Indicators to this CN peer, for CN pooling
+
OsmoHNBGW(config-msc)# apply?
apply Immediately use configuration modified via telnet VTY, and restart components as
needed.
+
OsmoHNBGW(config-msc)# apply ?
sccp For telnet VTY: apply SCCP and NRI config changes made to this CN link in the
running osmo-hnbgw process. If 'remote-addr' changed, related SCCP links will be
restarted, possibly dropping active UE contexts. This is run implicitly on program
startup, only useful to apply changes made later via telnet VTY.
+OsmoHNBGW(config-msc)# allow-attach?
+ allow-attach Allow this CN link to attach new subscribers (default).
+
+OsmoHNBGW(config-msc)# allow-emergency?
+ allow-emergency Allow CM ServiceRequests with type emergency on this CN link
+
+OsmoHNBGW(config-msc)# no ?
+ allow-attach Do not assign new subscribers to this CN link. Useful if an CN link in
an CN link pool is configured to off-load subscribers. The CN link will still be
operational for already IMSI-Attached subscribers, but the NAS node selection function
will skip this CN link for new subscribers
+ allow-emergency Do not serve CM ServiceRequests with type emergency on this CN link
+
OsmoHNBGW(config-msc)# exit
OsmoHNBGW(config)# sgsn 1
@@ -57,7 +162,14 @@
OsmoHNBGW(config-sgsn)# list
...
remote-addr NAME
+ nri add <0-32767> [<0-32767>]
+ nri del <0-32767> [<0-32767>]
+ show nri
apply sccp
+ allow-attach
+ no allow-attach
+ allow-emergency
+ no allow-emergency
...
OsmoHNBGW(config-sgsn)# remote-addr?
@@ -65,11 +177,25 @@
OsmoHNBGW(config-sgsn)# remote-addr ?
NAME SCCP address book entry name (see 'cs7 instance' /
'sccp-address')
+OsmoHNBGW(config-sgsn)# show nri?
+ nri Mapping of Network Resource Indicators to this CN peer, for CN pooling
+
OsmoHNBGW(config-sgsn)# apply?
apply Immediately use configuration modified via telnet VTY, and restart components as
needed.
+
OsmoHNBGW(config-sgsn)# apply ?
sccp For telnet VTY: apply SCCP and NRI config changes made to this CN link in the
running osmo-hnbgw process. If 'remote-addr' changed, related SCCP links will be
restarted, possibly dropping active UE contexts. This is run implicitly on program
startup, only useful to apply changes made later via telnet VTY.
+OsmoHNBGW(config-sgsn)# allow-attach?
+ allow-attach Allow this CN link to attach new subscribers (default).
+
+OsmoHNBGW(config-sgsn)# allow-emergency?
+ allow-emergency Allow CM ServiceRequests with type emergency on this CN link
+
+OsmoHNBGW(config-sgsn)# no ?
+ allow-attach Do not assign new subscribers to this CN link. Useful if an CN link in
an CN link pool is configured to off-load subscribers. The CN link will still be
operational for already IMSI-Attached subscribers, but the NAS node selection function
will skip this CN link for new subscribers
+ allow-emergency Do not serve CM ServiceRequests with type emergency on this CN link
+
OsmoHNBGW(config-sgsn)# exit
OsmoHNBGW(config)# ### Just by entering the nodes above, 'msc 1' and 'sgsn
1' now exist
@@ -85,10 +211,12 @@
OsmoHNBGW(config)# msc 2
OsmoHNBGW(config-msc)# remote-addr addr-msc2
+OsmoHNBGW(config-msc)# no allow-attach
OsmoHNBGW(config-msc)# exit
OsmoHNBGW(config)# msc 3
OsmoHNBGW(config-msc)# remote-addr addr-msc3
+OsmoHNBGW(config-msc)# allow-emergency
OsmoHNBGW(config-msc)# exit
OsmoHNBGW(config)# sgsn 2
@@ -105,8 +233,10 @@
msc 1
msc 2
remote-addr addr-msc2
+ no allow-attach
msc 3
remote-addr addr-msc3
+ allow-emergency
sgsn 0
sgsn 1
sgsn 2
@@ -116,8 +246,12 @@
...
OsmoHNBGW(config)# ### Re-entering existing nodes works (does not create new ones)
+OsmoHNBGW(config)# msc 2
+OsmoHNBGW(config-msc)# allow-attach
+OsmoHNBGW(config-msc)# exit
OsmoHNBGW(config)# msc 3
OsmoHNBGW(config-msc)# remote-addr addr-msc4
+OsmoHNBGW(config-msc)# no allow-emergency
OsmoHNBGW(config-msc)# exit
OsmoHNBGW(config)# sgsn 2
OsmoHNBGW(config-sgsn)# remote-addr addr-sgsn4
diff --git a/tests/nri_cfg.vty b/tests/nri_cfg.vty
new file mode 100644
index 0000000..e8a820b
--- /dev/null
+++ b/tests/nri_cfg.vty
@@ -0,0 +1,279 @@
+OsmoHNBGW> show nri
+hnbgw
+ iucs
+ nri bitlen 10
+ % No NULL-NRI entries
+ iups
+ nri bitlen 10
+ % No NULL-NRI entries
+msc 0
+ % no NRI mappings
+sgsn 0
+ % no NRI mappings
+
+OsmoHNBGW> enable
+OsmoHNBGW# configure terminal
+
+OsmoHNBGW(config)# msc 0
+
+OsmoHNBGW(config-msc)# list
+...
+ nri add <0-32767> [<0-32767>]
+ nri del <0-32767> [<0-32767>]
+ show nri
+...
+OsmoHNBGW(config-msc)# nri ?
+ add Add NRI value or range to the NRI mapping for this CN link
+ del Remove NRI value or range from the NRI mapping for this CN link
+OsmoHNBGW(config-msc)# nri add ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+OsmoHNBGW(config-msc)# nri add 23 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-msc)# nri add 23
+OsmoHNBGW(config-msc)# nri add 256 511
+OsmoHNBGW(config-msc)# nri add 100 200
+OsmoHNBGW(config-msc)# nri add 1024 1024
+% Warning: msc 0: Warning: NRI range surpasses current NRI bitlen: 1024..1024
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 23
+ nri add 100 200
+ nri add 256 511
+ nri add 1024
+OsmoHNBGW(config-msc)# exit
+
+OsmoHNBGW(config)# ### Do msc 2 first, to see that the order of mscs in the internal list
is not determined by the msc->nr,
+OsmoHNBGW(config)# ### and whichever was configured first gets higher priority for
overlaps.
+
+OsmoHNBGW(config)# msc 2
+OsmoHNBGW(config-msc)# nri add 200 300
+% Warning: msc 2: NRI range [200..300] overlaps between msc 2 and msc 0. For overlaps,
msc 0 has higher priority than msc 2
+OsmoHNBGW(config-msc)# nri add 1024 1025
+% Warning: msc 2: Warning: NRI range surpasses current NRI bitlen: 1024..1025
+% Warning: msc 2: NRI range [1024..1025] overlaps between msc 2 and msc 0. For overlaps,
msc 0 has higher priority than msc 2
+OsmoHNBGW(config-msc)# exit
+
+OsmoHNBGW(config)# msc 1
+OsmoHNBGW(config-msc)# nri add 42
+OsmoHNBGW(config-msc)# nri add 512 767
+OsmoHNBGW(config-msc)# nri add 200 300
+% Warning: msc 1: NRI range [200..300] overlaps between msc 1 and msc 0. For overlaps,
msc 0 has higher priority than msc 1
+% Warning: msc 1: NRI range [200..300] overlaps between msc 1 and msc 2. For overlaps,
msc 2 has higher priority than msc 1
+OsmoHNBGW(config-msc)# nri add 1024 1025
+% Warning: msc 1: Warning: NRI range surpasses current NRI bitlen: 1024..1025
+% Warning: msc 1: NRI range [1024..1025] overlaps between msc 1 and msc 0. For overlaps,
msc 0 has higher priority than msc 1
+% Warning: msc 1: NRI range [1024..1025] overlaps between msc 1 and msc 2. For overlaps,
msc 2 has higher priority than msc 1
+OsmoHNBGW(config-msc)# show nri
+msc 1
+ nri add 42
+ nri add 200 300
+ nri add 512 767
+ nri add 1024 1025
+OsmoHNBGW(config-msc)# exit
+
+OsmoHNBGW(config)# do show nri
+hnbgw
+ iucs
+ nri bitlen 10
+ % No NULL-NRI entries
+ iups
+ nri bitlen 10
+ % No NULL-NRI entries
+msc 0
+ nri add 23
+ nri add 100 200
+ nri add 256 511
+ nri add 1024
+msc 2
+ nri add 200 300
+ nri add 1024 1025
+msc 1
+ nri add 42
+ nri add 200 300
+ nri add 512 767
+ nri add 1024 1025
+sgsn 0
+ % no NRI mappings
+
+OsmoHNBGW(config)# ### msc and sgsn have separate scopes of NRI, i.e. overlaps are no
problem
+OsmoHNBGW(config)# sgsn 0
+OsmoHNBGW(config-sgsn)# nri add 0 1023
+OsmoHNBGW(config-sgsn)# show nri
+sgsn 0
+ nri add 0 1023
+OsmoHNBGW(config-sgsn)# exit
+
+OsmoHNBGW(config)# ### NULL-NRI config
+OsmoHNBGW(config)# hnbgw
+OsmoHNBGW(config-hnbgw)# iucs
+
+OsmoHNBGW(config-hnbgw-iucs)# list
+...
+ nri bitlen <1-15>
+ nri null add <0-32767> [<0-32767>]
+ nri null del <0-32767> [<0-32767>]
+...
+
+OsmoHNBGW(config-hnbgw-iucs)# nri ?
+ bitlen Set number of bits that an NRI has, to extract from TMSI identities (always
starting just after the TMSI's most significant octet).
+ null Define NULL-NRI values that cause re-assignment of an MS to a different CN
peer, for CN pooling.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri bitlen ?
+ <1-15> bit count (default: 10)
+
+OsmoHNBGW(config-hnbgw-iucs)# nri bitlen 11
+OsmoHNBGW(config-hnbgw-iucs)# show running-config
+...
+hnbgw
+...
+ iucs
+...
+ nri bitlen 11
+...
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null ?
+ add Add NULL-NRI value (or range)
+ del Remove NRI value or range from the NRI mapping for this CN link
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null add ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+OsmoHNBGW(config-hnbgw-iucs)# nri null add 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iucs)# nri null del ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+OsmoHNBGW(config-hnbgw-iucs)# nri null del 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iucs)# exit
+
+OsmoHNBGW(config-hnbgw)# iups
+
+OsmoHNBGW(config-hnbgw-iups)# list
+...
+ nri bitlen <1-15>
+ nri null add <0-32767> [<0-32767>]
+ nri null del <0-32767> [<0-32767>]
+...
+
+OsmoHNBGW(config-hnbgw-iups)# nri ?
+ bitlen Set number of bits that an NRI has, to extract from TMSI identities (always
starting just after the TMSI's most significant octet).
+ null Define NULL-NRI values that cause re-assignment of an MS to a different CN
peer, for CN pooling.
+
+OsmoHNBGW(config-hnbgw-iups)# nri bitlen ?
+ <1-15> bit count (default: 10)
+
+OsmoHNBGW(config-hnbgw-iups)# nri bitlen 9
+OsmoHNBGW(config-hnbgw-iups)# show running-config
+...
+hnbgw
+...
+ iups
+...
+ nri bitlen 9
+...
+
+OsmoHNBGW(config-hnbgw-iups)# nri null ?
+ add Add NULL-NRI value (or range)
+ del Remove NRI value or range from the NRI mapping for this CN link
+
+OsmoHNBGW(config-hnbgw-iups)# nri null add ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+OsmoHNBGW(config-hnbgw-iups)# nri null add 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iups)# nri null del ?
+ <0-32767> First value of the NRI value range, should not surpass the configured
'nri bitlen'.
+OsmoHNBGW(config-hnbgw-iups)# nri null del 0 ?
+ [<0-32767>] 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.
+
+OsmoHNBGW(config-hnbgw-iups)# exit
+
+OsmoHNBGW(config-hnbgw)# exit
+
+OsmoHNBGW(config)# msc 0
+OsmoHNBGW(config-msc)# nri del 0 10000
+OsmoHNBGW(config-msc)# exit
+OsmoHNBGW(config)# msc 1
+OsmoHNBGW(config-msc)# nri del 0 10000
+OsmoHNBGW(config-msc)# exit
+OsmoHNBGW(config)# msc 2
+OsmoHNBGW(config-msc)# nri del 0 10000
+OsmoHNBGW(config-msc)# exit
+OsmoHNBGW(config)# do show nri
+hnbgw
+ iucs
+ nri bitlen 11
+ % No NULL-NRI entries
+ iups
+ nri bitlen 9
+ % No NULL-NRI entries
+msc 0
+ % no NRI mappings
+msc 2
+ % no NRI mappings
+msc 1
+ % no NRI mappings
+sgsn 0
+ nri add 0 1023
+
+OsmoHNBGW(config)# msc 0
+OsmoHNBGW(config-msc)# nri add 0 1000
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 0 1000
+OsmoHNBGW(config-msc)# nri del 23
+OsmoHNBGW(config-msc)# nri del 200 300
+OsmoHNBGW(config-msc)# nri del 1000 2000
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 0 22
+ nri add 24 199
+ nri add 301 999
+OsmoHNBGW(config-msc)# nri add 23
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 0 199
+ nri add 301 999
+OsmoHNBGW(config-msc)# nri add 200 300
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 0 999
+OsmoHNBGW(config-msc)# nri add 1000
+OsmoHNBGW(config-msc)# show nri
+msc 0
+ nri add 0 1000
+
+OsmoHNBGW(config-msc)# show running-config
+... ! no allow-attach
+OsmoHNBGW(config-msc)# no allow-attach
+OsmoHNBGW(config-msc)# show running-config
+...
+msc 0
+...
+ nri add 0 1000
+ no allow-attach
+... ! no allow-attach
+OsmoHNBGW(config-msc)# exit
+OsmoHNBGW(config)# sgsn 1
+OsmoHNBGW(config-sgsn)# no allow-attach
+OsmoHNBGW(config-sgsn)# show running-config
+...
+msc 0
+...
+ nri add 0 1000
+ no allow-attach
+... ! no allow-attach
+sgsn 1
+...
+ no allow-attach
+...
+
+OsmoHNBGW(config-sgsn)# allow-attach
+OsmoHNBGW(config-sgsn)# exit
+OsmoHNBGW(config)# msc 0
+OsmoHNBGW(config-msc)# allow-attach
+OsmoHNBGW(config-msc)# show running-config
+... ! no allow-attach
+OsmoHNBGW(config-msc)# exit
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/33130
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ifb87e01e5971962e5cfe5e127871af4a67806de1
Gerrit-Change-Number: 33130
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange