aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-22 04:54:57 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-07-28 12:18:23 +0200
commit19bed23065e19caac62b4a6cfe565e609046da7d (patch)
tree2dbb8b89ae72974c4a9a1498b52af887898aed86 /tests
parent08d02dd5100cbff47922427e3beb31a3373bf75c (diff)
inter-BSC HO: add neighbor_ident API to manage neighbor-BSS-cells
Diffstat (limited to 'tests')
-rw-r--r--tests/bsc/Makefile.am1
-rw-r--r--tests/gsm0408/Makefile.am1
-rw-r--r--tests/handover/Makefile.am18
-rw-r--r--tests/handover/neighbor_ident_test.c278
-rw-r--r--tests/handover/neighbor_ident_test.err0
-rw-r--r--tests/handover/neighbor_ident_test.ok249
-rw-r--r--tests/neighbor_ident.vty260
-rw-r--r--tests/testsuite.at7
8 files changed, 814 insertions, 0 deletions
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index a930629fa..2e34d7995 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -45,6 +45,7 @@ bsc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/handover_cfg.o \
$(top_builddir)/src/osmo-bsc/handover_logic.o \
+ $(top_builddir)/src/osmo-bsc/neighbor_ident.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(top_builddir)/src/osmo-bsc/paging.o \
$(top_builddir)/src/osmo-bsc/pcu_sock.o \
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index 6d10b9fd9..3eb47f650 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -28,6 +28,7 @@ gsm0408_test_LDADD = \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(top_builddir)/src/osmo-bsc/rest_octets.o \
$(top_builddir)/src/osmo-bsc/system_information.o \
+ $(top_builddir)/src/osmo-bsc/neighbor_ident.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 07491d57f..140d8ff05 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -19,10 +19,13 @@ AM_LDFLAGS = \
EXTRA_DIST = \
handover_test.ok \
+ neighbor_ident_test.ok \
+ neighbor_ident_test.err \
$(NULL)
noinst_PROGRAMS = \
handover_test \
+ neighbor_ident_test \
$(NULL)
handover_test_SOURCES = \
@@ -56,6 +59,7 @@ handover_test_LDADD = \
$(top_builddir)/src/osmo-bsc/handover_decision_2.o \
$(top_builddir)/src/osmo-bsc/handover_logic.o \
$(top_builddir)/src/osmo-bsc/meas_rep.o \
+ $(top_builddir)/src/osmo-bsc/neighbor_ident.o \
$(top_builddir)/src/osmo-bsc/osmo_bsc_lcls.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(top_builddir)/src/osmo-bsc/paging.o \
@@ -69,3 +73,17 @@ handover_test_LDADD = \
$(LIBOSMOSIGTRAN_LIBS) \
$(LIBOSMOMGCPCLIENT_LIBS) \
$(NULL)
+
+neighbor_ident_test_SOURCES = \
+ neighbor_ident_test.c \
+ $(NULL)
+
+neighbor_ident_test_LDADD = \
+ $(top_builddir)/src/osmo-bsc/neighbor_ident.o \
+ $(LIBOSMOCORE_LIBS) \
+ $(LIBOSMOGSM_LIBS) \
+ $(NULL)
+
+.PHONY: update_exp
+update_exp:
+ $(builddir)/neighbor_ident_test >$(srcdir)/neighbor_ident_test.ok 2>$(srcdir)/neighbor_ident_test.err
diff --git a/tests/handover/neighbor_ident_test.c b/tests/handover/neighbor_ident_test.c
new file mode 100644
index 000000000..b67219cdf
--- /dev/null
+++ b/tests/handover/neighbor_ident_test.c
@@ -0,0 +1,278 @@
+/* Test the neighbor_ident.h API */
+/*
+ * (C) 2018 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
+ * All Rights Reserved
+ *
+ * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <talloc.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <osmocom/gsm/gsm0808.h>
+
+#include <osmocom/bsc/neighbor_ident.h>
+
+struct neighbor_ident_list *nil;
+
+static const struct neighbor_ident_key *k(int from_bts, uint16_t arfcn, enum bsic_kind kind, uint16_t bsic)
+{
+ static struct neighbor_ident_key key;
+ key = (struct neighbor_ident_key){
+ .from_bts = from_bts,
+ .arfcn = arfcn,
+ .bsic_kind = kind,
+ .bsic = bsic,
+ };
+ return &key;
+}
+
+static const struct gsm0808_cell_id_list2 cgi1 = {
+ .id_discr = CELL_IDENT_WHOLE_GLOBAL,
+ .id_list_len = 1,
+ .id_list = {
+ {
+ .global = {
+ .lai = {
+ .plmn = { .mcc = 1, .mnc = 2, .mnc_3_digits = false },
+ .lac = 3,
+ },
+ .cell_identity = 4,
+ }
+ },
+ },
+};
+
+static const struct gsm0808_cell_id_list2 cgi2 = {
+ .id_discr = CELL_IDENT_WHOLE_GLOBAL,
+ .id_list_len = 2,
+ .id_list = {
+ {
+ .global = {
+ .lai = {
+ .plmn = { .mcc = 1, .mnc = 2, .mnc_3_digits = false },
+ .lac = 3,
+ },
+ .cell_identity = 4,
+ }
+ },
+ {
+ .global = {
+ .lai = {
+ .plmn = { .mcc = 5, .mnc = 6, .mnc_3_digits = true },
+ .lac = 7,
+ },
+ .cell_identity = 8,
+ }
+ },
+ },
+};
+
+static const struct gsm0808_cell_id_list2 lac1 = {
+ .id_discr = CELL_IDENT_LAC,
+ .id_list_len = 1,
+ .id_list = {
+ {
+ .lac = 123
+ },
+ },
+};
+
+static const struct gsm0808_cell_id_list2 lac2 = {
+ .id_discr = CELL_IDENT_LAC,
+ .id_list_len = 2,
+ .id_list = {
+ {
+ .lac = 456
+ },
+ {
+ .lac = 789
+ },
+ },
+};
+
+void print_cil(const struct gsm0808_cell_id_list2 *cil)
+{
+ unsigned int i;
+ if (!cil) {
+ printf(" cell_id_list == NULL\n");
+ return;
+ }
+ switch (cil->id_discr) {
+ case CELL_IDENT_WHOLE_GLOBAL:
+ printf(" cell_id_list cgi[%u] = {\n", cil->id_list_len);
+ for (i = 0; i < cil->id_list_len; i++)
+ printf(" %2d: %s\n", i, osmo_cgi_name(&cil->id_list[i].global));
+ printf(" }\n");
+ break;
+ case CELL_IDENT_LAC:
+ printf(" cell_id_list lac[%u] = {\n", cil->id_list_len);
+ for (i = 0; i < cil->id_list_len; i++)
+ printf(" %2d: %u\n", i, cil->id_list[i].lac);
+ printf(" }\n");
+ break;
+ default:
+ printf(" Unimplemented id_disc\n");
+ }
+}
+
+static int print_nil_i;
+
+bool nil_cb(const struct neighbor_ident_key *key, const struct gsm0808_cell_id_list2 *val,
+ void *cb_data)
+{
+ printf(" %2d: %s\n", print_nil_i++, neighbor_ident_key_name(key));
+ print_cil(val);
+ return true;
+}
+
+void print_nil()
+{
+ print_nil_i = 0;
+ neighbor_ident_iter(nil, nil_cb, NULL);
+ if (!print_nil_i)
+ printf(" (empty)\n");
+}
+
+#define check_add(key, val, expect_rc) \
+ do { \
+ int rc; \
+ rc = neighbor_ident_add(nil, key, val); \
+ printf("neighbor_ident_add(" #key ", " #val ") --> expect rc=" #expect_rc ", got %d\n", rc); \
+ if (rc != expect_rc) \
+ printf("ERROR\n"); \
+ print_nil(); \
+ } while(0)
+
+#define check_del(key, expect_rc) \
+ do { \
+ bool rc; \
+ rc = neighbor_ident_del(nil, key); \
+ printf("neighbor_ident_del(" #key ") --> %s\n", rc ? "entry deleted" : "nothing deleted"); \
+ if (rc != expect_rc) \
+ printf("ERROR: expected: %s\n", expect_rc ? "entry deleted" : "nothing deleted"); \
+ print_nil(); \
+ } while(0)
+
+#define check_get(key, expect_rc) \
+ do { \
+ const struct gsm0808_cell_id_list2 *rc; \
+ rc = neighbor_ident_get(nil, key); \
+ printf("neighbor_ident_get(" #key ") --> %s\n", \
+ rc ? "entry returned" : "NULL"); \
+ if (((bool)expect_rc) != ((bool) rc)) \
+ printf("ERROR: expected %s\n", expect_rc ? "an entry" : "NULL"); \
+ if (rc) \
+ print_cil(rc); \
+ } while(0)
+
+int main(void)
+{
+ void *ctx = talloc_named_const(NULL, 0, "neighbor_ident_test");
+
+ printf("\n--- testing NULL neighbor_ident_list\n");
+ nil = NULL;
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi1, -ENOMEM);
+ check_get(k(0, 1, BSIC_6BIT, 2), false);
+ check_del(k(0, 1, BSIC_6BIT, 2), false);
+
+ printf("\n--- adding entries, test that no two identical entries are added\n");
+ nil = neighbor_ident_init(ctx);
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi1, 1);
+ check_get(k(0, 1, BSIC_6BIT, 2), true);
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi1, 1);
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi2, 2);
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi2, 2);
+ check_del(k(0, 1, BSIC_6BIT, 2), true);
+
+ printf("\n--- Cannot mix cell identifier types for one entry\n");
+ check_add(k(0, 1, BSIC_6BIT, 2), &cgi1, 1);
+ check_add(k(0, 1, BSIC_6BIT, 2), &lac1, -EINVAL);
+ check_del(k(0, 1, BSIC_6BIT, 2), true);
+ neighbor_ident_free(nil);
+
+ printf("\n--- BTS matching: specific BTS is stronger\n");
+ nil = neighbor_ident_init(ctx);
+ check_add(k(NEIGHBOR_IDENT_KEY_ANY_BTS, 1, BSIC_6BIT, 2), &lac1, 1);
+ check_add(k(3, 1, BSIC_6BIT, 2), &lac2, 2);
+ check_get(k(2, 1, BSIC_6BIT, 2), true);
+ check_get(k(3, 1, BSIC_6BIT, 2), true);
+ check_get(k(4, 1, BSIC_6BIT, 2), true);
+ check_get(k(NEIGHBOR_IDENT_KEY_ANY_BTS, 1, BSIC_6BIT, 2), true);
+ neighbor_ident_free(nil);
+
+ printf("\n--- BSIC matching: 6bit and 9bit are different realms, and wildcard match is weaker\n");
+ nil = neighbor_ident_init(ctx);
+ check_add(k(0, 1, BSIC_NONE, 0), &cgi1, 1);
+ check_add(k(0, 1, BSIC_6BIT, 2), &lac1, 1);
+ check_add(k(0, 1, BSIC_9BIT, 2), &lac2, 2);
+ check_get(k(0, 1, BSIC_6BIT, 2), true);
+ check_get(k(0, 1, BSIC_9BIT, 2), true);
+ printf("--- wildcard matches both 6bit and 9bit BSIC regardless:\n");
+ check_get(k(0, 1, BSIC_6BIT, 23), true);
+ check_get(k(0, 1, BSIC_9BIT, 23), true);
+ neighbor_ident_free(nil);
+
+ printf("\n--- Value ranges\n");
+ nil = neighbor_ident_init(ctx);
+ check_add(k(0, 6, BSIC_6BIT, 1 << 6), &lac1, -ERANGE);
+ check_add(k(0, 9, BSIC_9BIT, 1 << 9), &lac1, -ERANGE);
+ check_add(k(0, 6, BSIC_6BIT, -1), &lac1, -ERANGE);
+ check_add(k(0, 9, BSIC_9BIT, -1), &lac1, -ERANGE);
+ check_add(k(NEIGHBOR_IDENT_KEY_ANY_BTS - 1, 1, BSIC_NONE, 1), &cgi2, -ERANGE);
+ check_add(k(256, 1, BSIC_NONE, 1), &cgi2, -ERANGE);
+ check_add(k(0, 0, BSIC_NONE, 0), &cgi1, 1);
+ check_add(k(255, 65535, BSIC_NONE, 65535), &lac1, 1);
+ check_add(k(0, 0, BSIC_6BIT, 0), &cgi2, 2);
+ check_add(k(255, 65535, BSIC_6BIT, 0x3f), &lac2, 2);
+ check_add(k(0, 0, BSIC_9BIT, 0), &cgi1, 1);
+ check_add(k(255, 65535, BSIC_9BIT, 0x1ff), &cgi2, 2);
+
+ neighbor_ident_free(nil);
+
+ printf("\n--- size limits\n");
+ {
+ int i;
+ struct gsm0808_cell_id_list2 a = { .id_discr = CELL_IDENT_LAC };
+ struct gsm0808_cell_id_list2 b = {
+ .id_discr = CELL_IDENT_LAC,
+ .id_list = {
+ { .lac = 423 }
+ },
+ .id_list_len = 1,
+ };
+ for (i = 0; i < ARRAY_SIZE(a.id_list); i++) {
+ a.id_list[a.id_list_len ++].lac = i;
+ }
+
+ nil = neighbor_ident_init(ctx);
+
+ i = neighbor_ident_add(nil, k(0, 1, BSIC_6BIT, 2), &a);
+ printf("Added first cell identifier list (added %u) --> rc = %d\n", a.id_list_len, i);
+ i = neighbor_ident_add(nil, k(0, 1, BSIC_6BIT, 2), &b);
+ printf("Added second cell identifier list (tried to add %u) --> rc = %d\n", b.id_list_len, i);
+ if (i != -ENOSPC)
+ printf("ERROR: expected rc=%d\n", -ENOSPC);
+ neighbor_ident_free(nil);
+ }
+
+ OSMO_ASSERT(talloc_total_blocks(ctx) == 1);
+ talloc_free(ctx);
+
+ return 0;
+}
diff --git a/tests/handover/neighbor_ident_test.err b/tests/handover/neighbor_ident_test.err
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/handover/neighbor_ident_test.err
diff --git a/tests/handover/neighbor_ident_test.ok b/tests/handover/neighbor_ident_test.ok
new file mode 100644
index 000000000..280b6f209
--- /dev/null
+++ b/tests/handover/neighbor_ident_test.ok
@@ -0,0 +1,249 @@
+
+--- testing NULL neighbor_ident_list
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi1) --> expect rc=-ENOMEM, got -12
+ (empty)
+neighbor_ident_get(k(0, 1, BSIC_6BIT, 2)) --> NULL
+neighbor_ident_del(k(0, 1, BSIC_6BIT, 2)) --> nothing deleted
+ (empty)
+
+--- adding entries, test that no two identical entries are added
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_get(k(0, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+neighbor_ident_del(k(0, 1, BSIC_6BIT, 2)) --> entry deleted
+ (empty)
+
+--- Cannot mix cell identifier types for one entry
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &lac1) --> expect rc=-EINVAL, got -22
+ 0: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_del(k(0, 1, BSIC_6BIT, 2)) --> entry deleted
+ (empty)
+
+--- BTS matching: specific BTS is stronger
+neighbor_ident_add(k(NEIGHBOR_IDENT_KEY_ANY_BTS, 1, BSIC_6BIT, 2), &lac1) --> expect rc=1, got 1
+ 0: BTS * to ARFCN 1 BSIC 2
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_add(k(3, 1, BSIC_6BIT, 2), &lac2) --> expect rc=2, got 2
+ 0: BTS * to ARFCN 1 BSIC 2
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 1: BTS 3 to ARFCN 1 BSIC 2
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+neighbor_ident_get(k(2, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_get(k(3, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+neighbor_ident_get(k(4, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_get(k(NEIGHBOR_IDENT_KEY_ANY_BTS, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+
+--- BSIC matching: 6bit and 9bit are different realms, and wildcard match is weaker
+neighbor_ident_add(k(0, 1, BSIC_NONE, 0), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 1 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(0, 1, BSIC_6BIT, 2), &lac1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 1 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_add(k(0, 1, BSIC_9BIT, 2), &lac2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 1 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 0 to ARFCN 1 BSIC 2
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 2: BTS 0 to ARFCN 1 BSIC 2(9bit)
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+neighbor_ident_get(k(0, 1, BSIC_6BIT, 2)) --> entry returned
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_get(k(0, 1, BSIC_9BIT, 2)) --> entry returned
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+--- wildcard matches both 6bit and 9bit BSIC regardless:
+neighbor_ident_get(k(0, 1, BSIC_6BIT, 23)) --> entry returned
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_get(k(0, 1, BSIC_9BIT, 23)) --> entry returned
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+
+--- Value ranges
+neighbor_ident_add(k(0, 6, BSIC_6BIT, 1 << 6), &lac1) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(0, 9, BSIC_9BIT, 1 << 9), &lac1) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(0, 6, BSIC_6BIT, -1), &lac1) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(0, 9, BSIC_9BIT, -1), &lac1) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(NEIGHBOR_IDENT_KEY_ANY_BTS - 1, 1, BSIC_NONE, 1), &cgi2) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(256, 1, BSIC_NONE, 1), &cgi2) --> expect rc=-ERANGE, got -34
+ (empty)
+neighbor_ident_add(k(0, 0, BSIC_NONE, 0), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(255, 65535, BSIC_NONE, 65535), &lac1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 255 to ARFCN 65535 (any BSIC)
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+neighbor_ident_add(k(0, 0, BSIC_6BIT, 0), &cgi2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 255 to ARFCN 65535 (any BSIC)
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 2: BTS 0 to ARFCN 0 BSIC 0
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+neighbor_ident_add(k(255, 65535, BSIC_6BIT, 0x3f), &lac2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 255 to ARFCN 65535 (any BSIC)
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 2: BTS 0 to ARFCN 0 BSIC 0
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+ 3: BTS 255 to ARFCN 65535 BSIC 63
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+neighbor_ident_add(k(0, 0, BSIC_9BIT, 0), &cgi1) --> expect rc=1, got 1
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 255 to ARFCN 65535 (any BSIC)
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 2: BTS 0 to ARFCN 0 BSIC 0
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+ 3: BTS 255 to ARFCN 65535 BSIC 63
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+ 4: BTS 0 to ARFCN 0 BSIC 0(9bit)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+neighbor_ident_add(k(255, 65535, BSIC_9BIT, 0x1ff), &cgi2) --> expect rc=2, got 2
+ 0: BTS 0 to ARFCN 0 (any BSIC)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 1: BTS 255 to ARFCN 65535 (any BSIC)
+ cell_id_list lac[1] = {
+ 0: 123
+ }
+ 2: BTS 0 to ARFCN 0 BSIC 0
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+ 3: BTS 255 to ARFCN 65535 BSIC 63
+ cell_id_list lac[2] = {
+ 0: 456
+ 1: 789
+ }
+ 4: BTS 0 to ARFCN 0 BSIC 0(9bit)
+ cell_id_list cgi[1] = {
+ 0: 001-02-3-4
+ }
+ 5: BTS 255 to ARFCN 65535 BSIC 511(9bit)
+ cell_id_list cgi[2] = {
+ 0: 001-02-3-4
+ 1: 005-006-7-8
+ }
+
+--- size limits
+Added first cell identifier list (added 127) --> rc = 127
+Added second cell identifier list (tried to add 1) --> rc = -28
diff --git a/tests/neighbor_ident.vty b/tests/neighbor_ident.vty
new file mode 100644
index 000000000..11227ed0d
--- /dev/null
+++ b/tests/neighbor_ident.vty
@@ -0,0 +1,260 @@
+OsmoBSC> ### Neighbor-BSS Cell Identifier List config
+
+OsmoBSC> list
+...
+ show bts <0-255> neighbor arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+...
+
+OsmoBSC> enable
+OsmoBSC# list
+...
+ show bts <0-255> neighbor arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+...
+
+OsmoBSC# configure terminal
+OsmoBSC(config)# network
+
+OsmoBSC(config-net)# bts 0
+OsmoBSC(config-net-bts)# type sysmobts
+OsmoBSC(config-net-bts)# base_station_id_code 10
+OsmoBSC(config-net-bts)# location_area_code 20
+OsmoBSC(config-net-bts)# cell_identity 30
+OsmoBSC(config-net-bts)# trx 0
+OsmoBSC(config-net-bts-trx)# arfcn 40
+OsmoBSC(config-net-bts-trx)# exit
+OsmoBSC(config-net-bts)# exit
+
+OsmoBSC(config-net)# bts 1
+OsmoBSC(config-net-bts)# type sysmobts
+OsmoBSC(config-net-bts)# base_station_id_code 11
+OsmoBSC(config-net-bts)# location_area_code 21
+OsmoBSC(config-net-bts)# cell_identity 31
+OsmoBSC(config-net-bts)# trx 0
+OsmoBSC(config-net-bts-trx)# arfcn 41
+OsmoBSC(config-net-bts-trx)# exit
+OsmoBSC(config-net-bts)# exit
+
+OsmoBSC(config-net)# bts 2
+OsmoBSC(config-net-bts)# type sysmobts
+OsmoBSC(config-net-bts)# base_station_id_code 12
+OsmoBSC(config-net-bts)# location_area_code 22
+OsmoBSC(config-net-bts)# cell_identity 32
+OsmoBSC(config-net-bts)# trx 0
+OsmoBSC(config-net-bts-trx)# arfcn 42
+OsmoBSC(config-net-bts-trx)# exit
+OsmoBSC(config-net-bts)# exit
+
+OsmoBSC(config-net)# show running-config
+...
+ bts 0
+...
+ cell_identity 30
+ location_area_code 20
+ base_station_id_code 10
+...
+ trx 0
+...
+ arfcn 40
+...
+ bts 1
+...
+ cell_identity 31
+ location_area_code 21
+ base_station_id_code 11
+...
+ trx 0
+...
+ arfcn 41
+...
+ bts 2
+...
+ cell_identity 32
+ location_area_code 22
+ base_station_id_code 12
+...
+ trx 0
+...
+ arfcn 42
+...
+
+OsmoBSC(config-net)# bts 0
+OsmoBSC(config-net-bts)# list
+...
+ neighbor add bts <0-255>
+ neighbor add lac <0-65535>
+ neighbor add lac-ci <0-65535> <0-255>
+ neighbor add lac <0-65535> arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+ neighbor add lac-ci <0-65535> <0-255> arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+ neighbor add cgi <0-999> <0-999> <0-65535> <0-255> arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+ neighbor del bts <0-255>
+ neighbor del arfcn <0-1023> (bsic|bsic9) (<0-511>|any)
+...
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor add cgi 23 42 423 5 arfcn 23 bsic 64
+% Error: BSIC value surpasses 6-bit range: 64, use 'bsic9' instead
+
+OsmoBSC(config-net-bts)# neighbor add bts 0
+% Error: cannot add local BTS 0 as neighbor to BTS 0: Invalid argument
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor add bts 1
+% BTS 0 now has local neighbor BTS 1 with LAC 21 CI 31 and ARFCN 41 BSIC 11
+
+OsmoBSC(config-net-bts)# neighbor add lac 22
+% BTS 0 now has local neighbor BTS 2 with LAC 22 CI 32 and ARFCN 42 BSIC 12
+
+OsmoBSC(config-net-bts)# neighbor add cgi 23 42 423 5 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# ### adding the same entry again results in no change
+OsmoBSC(config-net-bts)# neighbor add bts 1
+% BTS 0 already had local neighbor BTS 1 with LAC 21 CI 31 and ARFCN 41 BSIC 11
+OsmoBSC(config-net-bts)# neighbor add lac-ci 21 31
+% BTS 0 already had local neighbor BTS 1 with LAC 21 CI 31 and ARFCN 41 BSIC 11
+OsmoBSC(config-net-bts)# neighbor add cgi 23 42 423 5 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 1 remote BSS Cell Identifier List entry
+OsmoBSC(config-net-bts)# neighbor add cgi 23 42 423 5 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 1 remote BSS Cell Identifier List entry
+OsmoBSC(config-net-bts)# neighbor add cgi 23 42 423 5 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# neighbor add cgi 23 042 423 6 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 2 remote BSS Cell Identifier List entries
+
+OsmoBSC(config-net-bts)# neighbor add lac 456 arfcn 123 bsic 45
+% BTS 0 to ARFCN 123 BSIC 45 now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# neighbor add cgi 23 042 234 56 arfcn 23 bsic 42
+% BTS 0 to ARFCN 23 BSIC 42 now has 3 remote BSS Cell Identifier List entries
+
+OsmoBSC(config-net-bts)# neighbor add lac-ci 789 10 arfcn 423 bsic any
+% BTS 0 to ARFCN 423 (any BSIC) now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# neighbor add lac-ci 789 10 arfcn 423 bsic9 511
+% BTS 0 to ARFCN 423 BSIC 511(9bit) now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# neighbor add lac-ci 789 10 arfcn 423 bsic9 1
+% BTS 0 to ARFCN 423 BSIC 1(9bit) now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# neighbor add lac-ci 789 10 arfcn 423 bsic 1
+% BTS 0 to ARFCN 423 BSIC 1 now has 1 remote BSS Cell Identifier List entry
+
+OsmoBSC(config-net-bts)# show running-config
+...
+network
+... !neighbor add
+ bts 0
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+ neighbor add cgi 023 42 423 5 arfcn 23 bsic 42
+ neighbor add cgi 023 042 423 6 arfcn 23 bsic 42
+ neighbor add cgi 023 042 234 56 arfcn 23 bsic 42
+ neighbor add lac 456 arfcn 123 bsic 45
+ neighbor add lac-ci 789 10 arfcn 423 bsic any
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 511
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 1
+ neighbor add lac-ci 789 10 arfcn 423 bsic 1
+... !neighbor add
+
+OsmoBSC(config-net-bts)# do show bts 0 neighbor arfcn 99 bsic any
+% No entry for BTS 0 to ARFCN 99 (any BSIC)
+
+OsmoBSC(config-net-bts)# do show bts 0 neighbor arfcn 41 bsic any
+% BTS 0 to ARFCN 41 (any BSIC) resolves to local BTS 1 lac-ci 21 31
+
+OsmoBSC(config-net-bts)# do show bts 0 neighbor arfcn 423 bsic 1
+% neighbor add lac-ci 789 10 arfcn 423 bsic 1
+
+OsmoBSC(config-net-bts)# do show bts 0 neighbor arfcn 423 bsic 23
+% neighbor add lac-ci 789 10 arfcn 423 bsic 23
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 99 bsic 7
+% Cannot remove, no such neighbor: BTS 0 to ARFCN 99 BSIC 7
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 23 bsic 42
+% Removed remote BSS neighbor BTS 0 to ARFCN 23 BSIC 42
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+ neighbor add lac 456 arfcn 123 bsic 45
+ neighbor add lac-ci 789 10 arfcn 423 bsic any
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 511
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 1
+ neighbor add lac-ci 789 10 arfcn 423 bsic 1
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 123 bsic 45
+% Removed remote BSS neighbor BTS 0 to ARFCN 123 BSIC 45
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+ neighbor add lac-ci 789 10 arfcn 423 bsic any
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 511
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 1
+ neighbor add lac-ci 789 10 arfcn 423 bsic 1
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 423 bsic any
+% Removed remote BSS neighbor BTS 0 to ARFCN 423 (any BSIC)
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 511
+ neighbor add lac-ci 789 10 arfcn 423 bsic9 1
+ neighbor add lac-ci 789 10 arfcn 423 bsic 1
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 423 bsic9 511
+% Removed remote BSS neighbor BTS 0 to ARFCN 423 BSIC 511(9bit)
+OsmoBSC(config-net-bts)# neighbor del arfcn 423 bsic9 1
+% Removed remote BSS neighbor BTS 0 to ARFCN 423 BSIC 1(9bit)
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+ neighbor add lac-ci 789 10 arfcn 423 bsic 1
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 423 bsic 1
+% Removed remote BSS neighbor BTS 0 to ARFCN 423 BSIC 1
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 21 31
+ neighbor add lac-ci 22 32
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 41 bsic any
+% Removed local neighbor bts 0 to bts 1
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 22 32
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 41 bsic any
+% Cannot remove, no such neighbor: BTS 0 to ARFCN 41 (any BSIC)
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
+ neighbor add lac-ci 22 32
+... !neighbor add
+
+OsmoBSC(config-net-bts)# neighbor del arfcn 42 bsic 12
+% Removed local neighbor bts 0 to bts 2
+
+OsmoBSC(config-net-bts)# show running-config
+... !neighbor add
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f38465554..1a190dda3 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -38,6 +38,13 @@ cat $abs_srcdir/nanobts_omlattr/nanobts_omlattr_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/nanobts_omlattr/nanobts_omlattr_test], [], [expout], [ignore])
AT_CLEANUP
+AT_SETUP([neighbor_ident])
+AT_KEYWORDS([neighbor_ident])
+cat $abs_srcdir/handover/neighbor_ident_test.ok > expout
+cat $abs_srcdir/handover/neighbor_ident_test.err > experr
+AT_CHECK([$abs_top_builddir/tests/handover/neighbor_ident_test], [], [expout], [experr])
+AT_CLEANUP
+
AT_SETUP([handover test 0])
AT_KEYWORDS([handover])
cat $abs_srcdir/handover/handover_test.ok > expout