aboutsummaryrefslogtreecommitdiffstats
path: root/tests/nanobts_omlattr/nanobts_omlattr_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/nanobts_omlattr/nanobts_omlattr_test.c')
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c213
1 files changed, 71 insertions, 142 deletions
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index da220c1f4..ba58e45ad 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -25,6 +25,7 @@
#include <osmocom/bsc/bts.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/tdef.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/application.h>
#include <osmocom/core/sockaddr_str.h>
@@ -32,153 +33,84 @@
#include <stdio.h>
#include <string.h>
-struct gsm_bts_model bts_model_nanobts = {
- .type = GSM_BTS_TYPE_NANOBTS,
- .name = "nanobts",
- .start = NULL,
- .oml_rcvmsg = NULL,
- .e1line_bind_ops = NULL,
- .nm_att_tlvdef = {
- .def = {
- /* ip.access specifics */
- [NM_ATT_IPACC_DST_IP] = {TLV_TYPE_FIXED, 4},
- [NM_ATT_IPACC_DST_IP_PORT] =
- {TLV_TYPE_FIXED, 2},
- [NM_ATT_IPACC_STREAM_ID] = {TLV_TYPE_TV,},
- [NM_ATT_IPACC_SEC_OML_CFG] =
- {TLV_TYPE_FIXED, 6},
- [NM_ATT_IPACC_IP_IF_CFG] =
- {TLV_TYPE_FIXED, 8},
- [NM_ATT_IPACC_IP_GW_CFG] =
- {TLV_TYPE_FIXED, 12},
- [NM_ATT_IPACC_IN_SERV_TIME] =
- {TLV_TYPE_FIXED, 4},
- [NM_ATT_IPACC_LOCATION] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_PAGING_CFG] =
- {TLV_TYPE_FIXED, 2},
- [NM_ATT_IPACC_UNIT_ID] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_UNIT_NAME] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_SNMP_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_PRIM_OML_CFG_LIST] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_NV_FLAGS] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_FREQ_CTRL] =
- {TLV_TYPE_FIXED, 2},
- [NM_ATT_IPACC_PRIM_OML_FB_TOUT] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_CUR_SW_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_TIMING_BUS] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_CGI] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_RAC] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_OBJ_VERSION] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_GPRS_PAGING_CFG] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_NSEI] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_BVCI] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_NSVCI] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_NS_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_BSSGP_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_NS_LINK_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_RLC_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_ALM_THRESH_LIST] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_MONIT_VAL_LIST] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_TIB_CONTROL] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_SUPP_FEATURES] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_CODING_SCHEMES] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_RLC_CFG_2] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_HEARTB_TOUT] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_UPTIME] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_RLC_CFG_3] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_SSL_CFG] = {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_SEC_POSSIBLE] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_IML_SSL_STATE] =
- {TLV_TYPE_TL16V},
- [NM_ATT_IPACC_REVOC_DATE] = {TLV_TYPE_TL16V},
- },
- },
-};
+extern struct gsm_bts_model bts_model_nanobts;
-static void test_nanobts_attr_bts_get(struct gsm_bts *bts, uint8_t *expected)
+static void test_nanobts_gen_set_bts_attr(struct gsm_bts *bts, uint8_t *expected)
{
struct msgb *msgb;
- printf("Testing nanobts_attr_bts_get()...\n");
+ printf("Testing nanobts_gen_set_bts_attr()...\n");
- msgb = nanobts_attr_bts_get(bts);
+ msgb = nanobts_gen_set_bts_attr(bts);
printf("result= %s\n", osmo_hexdump_nospc(msgb->data, msgb->len));
printf("expected=%s\n", osmo_hexdump_nospc(expected, msgb->len));
- OSMO_ASSERT(memcmp(msgb->data, expected, msgb->len) == 0);
+ OSMO_ASSERT(msgb_eq_data_print(msgb, expected, msgb->len));
msgb_free(msgb);
printf("ok.\n");
printf("\n");
}
-static void test_nanobts_attr_nse_get(struct gsm_bts *bts, uint8_t *expected)
+static void test_nanobts_gen_set_nse_attr(struct gsm_bts *bts, uint8_t *expected)
{
struct msgb *msgb;
- printf("Testing nanobts_attr_nse_get()...\n");
+ printf("Testing nanobts_gen_set_nse_attr()...\n");
- msgb = nanobts_attr_nse_get(bts);
+ msgb = nanobts_gen_set_nse_attr(bts->site_mgr);
printf("result= %s\n", osmo_hexdump_nospc(msgb->data, msgb->len));
printf("expected=%s\n", osmo_hexdump_nospc(expected, msgb->len));
- OSMO_ASSERT(memcmp(msgb->data, expected, msgb->len) == 0);
+ OSMO_ASSERT(msgb_eq_data_print(msgb, expected, msgb->len));
msgb_free(msgb);
printf("ok.\n");
printf("\n");
}
-static void test_nanobts_attr_cell_get(struct gsm_bts *bts, uint8_t *expected)
+static void test_nanobts_gen_set_cell_attr(struct gsm_bts *bts, uint8_t *expected)
{
struct msgb *msgb;
- printf("Testing nanobts_attr_cell_get()...\n");
+ printf("Testing nanobts_gen_set_cell_attr()...\n");
- msgb = nanobts_attr_cell_get(bts);
+ msgb = nanobts_gen_set_cell_attr(bts);
printf("result= %s\n", osmo_hexdump_nospc(msgb->data, msgb->len));
printf("expected=%s\n", osmo_hexdump_nospc(expected, msgb->len));
- OSMO_ASSERT(memcmp(msgb->data, expected, msgb->len) == 0);
+ OSMO_ASSERT(msgb_eq_data_print(msgb, expected, msgb->len));
msgb_free(msgb);
printf("ok.\n");
printf("\n");
}
-static void test_nanobts_attr_nscv_get(struct gsm_bts *bts, uint8_t *expected)
+static void test_nanobts_gen_set_nsvc_attr(struct gsm_bts *bts, uint8_t *expected)
{
struct msgb *msgb;
- printf("Testing nanobts_attr_nscv_get()...\n");
+ printf("Testing nanobts_gen_set_nsvc_attr()...\n");
- msgb = nanobts_attr_nscv_get(bts);
+ msgb = nanobts_gen_set_nsvc_attr(&bts->site_mgr->gprs.nsvc[0]);
printf("result= %s\n", osmo_hexdump_nospc(msgb->data, msgb->len));
printf("expected=%s\n", osmo_hexdump_nospc(expected, msgb->len));
- OSMO_ASSERT(memcmp(msgb->data, expected, msgb->len) == 0);
+ OSMO_ASSERT(msgb_eq_data_print(msgb, expected, msgb->len));
msgb_free(msgb);
printf("ok.\n");
printf("\n");
}
-static void test_nanobts_attr_radio_get(struct gsm_bts *bts,
+static void test_nanobts_gen_set_radio_attr(struct gsm_bts *bts,
struct gsm_bts_trx *trx,
uint8_t *expected)
{
struct msgb *msgb;
- printf("Testing nanobts_attr_nscv_get()...\n");
+ printf("Testing nanobts_gen_set_nsvc_attr()...\n");
- msgb = nanobts_attr_radio_get(bts, trx);
+ msgb = nanobts_gen_set_radio_attr(bts, trx);
printf("result= %s\n", osmo_hexdump_nospc(msgb->data, msgb->len));
printf("expected=%s\n", osmo_hexdump_nospc(expected, msgb->len));
- OSMO_ASSERT(memcmp(msgb->data, expected, msgb->len) == 0);
+ OSMO_ASSERT(msgb_eq_data_print(msgb, expected, msgb->len));
msgb_free(msgb);
printf("ok.\n");
@@ -194,9 +126,11 @@ static const struct log_info log_info = {
};
static struct osmo_tdef gsm_network_T_defs[] = {
- { .T=3105, .default_val=100, .val=13, .unit=OSMO_TDEF_MS, .desc="Physical Information" },
- { .T=3212, .default_val=5, .unit=OSMO_TDEF_CUSTOM,
- .desc="Periodic Location Update timer, sent to MS (1 = 6 minutes)" },
+ { .T = 3105, .default_val = GSM_T3105_DEFAULT, .val = GSM_T3105_DEFAULT, .min_val = 0, .max_val = UINT8_MAX, .unit = OSMO_TDEF_MS, .desc = "Physical Information" },
+ { .T = 3212, .default_val = 5, .unit = OSMO_TDEF_CUSTOM, .min_val = 0, .max_val = UINT8_MAX,
+ .desc = "Periodic Location Update timer, sent to MS (1 = 6 minutes)" },
+ { .T = -3105, .default_val = GSM_NY1_DEFAULT, .val = GSM_NY1_DEFAULT, .min_val = 0, .max_val = UINT8_MAX, .unit = OSMO_TDEF_CUSTOM,
+ .desc = "Ny1: Maximum number of Physical Information (re)transmissions" },
{}
};
@@ -223,27 +157,44 @@ int main(int argc, char **argv)
bts->network = net;
trx = talloc_zero(ctx, struct gsm_bts_trx);
- /* Parameters needed by nanobts_attr_bts_get() */
+ /* Parameters needed by nanobts_gen_set_bts_attr() */
bts->rach_b_thresh = -1;
bts->rach_ldavg_slots = -1;
bts->c0->arfcn = 866;
bts->cell_identity = 1337;
bts->network->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 };
- bts->location_area_code = 1;
+ bts->location_area_code = 0x0001;
bts->gprs.rac = 0;
uint8_t attr_bts_expected[] =
- { 0x19, 0x55, 0x5b, 0x61, 0x67, 0x6d, 0x73, 0x18, 0x06, 0x0e, 0x00,
- 0x02, 0x01, 0x20, 0x33, 0x1e, 0x24, 0x24, 0xa8, 0x34, 0x21,
- 0xa8, 0x1f, 0x3f, 0x25,
- 0x00, 0x01, 0x0a, 0x0c, 0x0a, 0x0b, 0x01, 0x2a, 0x5a, 0x2b,
- 0x03, 0xe8, 0x0a, 0x0d,
- 0x23, 0x0a, 0x08, 0x03, 0x62, 0x09, 0x3f, 0x99, 0x00, 0x07,
- 0x00, 0xf1, 0x10, 0x00,
- 0x01, 0x05, 0x39
+ { 0x19, 0x73, 0x6d, 0x67, 0x61, 0x5b, 0x55,
+ /* 0x18 Intave Parameter */
+ 0x18, 0x06,
+ /* 0x0e: Connection Failure Criterion, rlt == 0x20 */
+ 0x0e, 0x00, 0x02, 0x01, 0x20,
+ /* 0x33: T200 */
+ 0x33, 0x1e, 0x24, 0x24, 0xa8, 0x34, 0x21, 0xa8,
+ /* 0x1f: Max Timing Advance */
+ 0x1f, 0x3f,
+ /* 0x25: Overload Period */
+ 0x25, 0x00, 0x01, 0x0a,
+ /* 0x0c CCCH Load Threshold */
+ 0x0c, 0x0a,
+ /* 0x0b CCCH Load Indication Period */
+ 0x0b, 0x01,
+ /* 0x2a: RACH Busy Threshold */
+ 0x2a, 0x5a,
+ /* 0x2b: RACH Load Averaging Slots */
+ 0x2b, 0x03, 0xe8,
+ /* 0x0a: BTS Air Timer */
+ 0x0a, 0x0a,
+ /* Ny1 */
+ 0x23, 0x11,
+ 0x08, 0x03, 0x62, 0x09, 0x3f, 0x99, 0x00, 0x07,
+ 0x00, 0xf1, 0x10, 0x00, 0x01, 0x05, 0x39
};
- /* Parameters needed to test nanobts_attr_nse_get() */
- bts->gprs.nse.nsei = 101;
+ /* Parameters needed to test nanobts_gen_set_nse_attr() */
+ bts->site_mgr->gprs.nse.nsei = 101;
uint8_t attr_nse_expected[] =
{ 0x9d, 0x00, 0x02, 0x00, 0x65, 0xa0, 0x00, 0x07, 0x03, 0x03, 0x03,
0x03, 0x1e, 0x03, 0x0a, 0xa1, 0x00, 0x0b, 0x03, 0x03, 0x03,
@@ -251,7 +202,7 @@ int main(int argc, char **argv)
0x0a, 0x03, 0x0a, 0x03
};
- /* Parameters needed to test nanobts_attr_cell_get() */
+ /* Parameters needed to test nanobts_gen_set_cell_attr() */
bts->gprs.rac = 0x00;
bts->gprs.cell.bvci = 2;
bts->gprs.mode = BTS_GPRS_GPRS;
@@ -263,18 +214,18 @@ int main(int argc, char **argv)
0xfa, 0x00, 0xfa, 0x02
};
- /* Parameters needed to test nanobts_attr_nscv_get() */
+ /* Parameters needed to test nanobts_gen_set_nsvc_attr() */
struct osmo_sockaddr_str addr;
osmo_sockaddr_str_from_str(&addr, "10.9.1.101", 23000);
- osmo_sockaddr_str_to_sockaddr(&addr, &bts->gprs.nsvc[0].remote.u.sas);
- bts->gprs.nsvc[0].nsvci = 0x65;
- bts->gprs.nsvc[0].local_port = 0x5a3c;
+ osmo_sockaddr_str_to_sockaddr(&addr, &bts->site_mgr->gprs.nsvc[0].remote.u.sas);
+ bts->site_mgr->gprs.nsvc[0].nsvci = 0x65;
+ bts->site_mgr->gprs.nsvc[0].local_port = 0x5a3c;
uint8_t attr_nscv_expected[] =
{ 0x9f, 0x00, 0x02, 0x00, 0x65, 0xa2, 0x00, 0x08, 0x59, 0xd8, 0x0a,
0x09, 0x01, 0x65, 0x5a, 0x3c
};
- /* Parameters needed to test nanobts_attr_radio_get() */
+ /* Parameters needed to test nanobts_gen_set_radio_attr() */
trx->arfcn = 866;
trx->max_power_red = 22;
bts->c0->max_power_red = 22;
@@ -282,18 +233,18 @@ int main(int argc, char **argv)
{ 0x2d, 0x0b, 0x05, 0x00, 0x02, 0x03, 0x62 };
/* Run tests */
- test_nanobts_attr_bts_get(bts, attr_bts_expected);
- test_nanobts_attr_nse_get(bts, attr_nse_expected);
- test_nanobts_attr_cell_get(bts, attr_cell_expected);
- test_nanobts_attr_nscv_get(bts, attr_nscv_expected);
- test_nanobts_attr_radio_get(bts, trx, attr_radio_expected);
+ test_nanobts_gen_set_bts_attr(bts, attr_bts_expected);
+ test_nanobts_gen_set_nse_attr(bts, attr_nse_expected);
+ test_nanobts_gen_set_cell_attr(bts, attr_cell_expected);
+ test_nanobts_gen_set_nsvc_attr(bts, attr_nscv_expected);
+ test_nanobts_gen_set_radio_attr(bts, trx, attr_radio_expected);
/* NSVC IPv6 test */
struct osmo_sockaddr_str addr6;
osmo_sockaddr_str_from_str(&addr6, "fd00:5678:9012:3456:7890:1234:5678:9012", 23010);
- osmo_sockaddr_str_to_sockaddr(&addr6, &bts->gprs.nsvc[0].remote.u.sas);
- bts->gprs.nsvc[0].nsvci = 0x65;
- bts->gprs.nsvc[0].local_port = 0x5a3c;
+ osmo_sockaddr_str_to_sockaddr(&addr6, &bts->site_mgr->gprs.nsvc[0].remote.u.sas);
+ bts->site_mgr->gprs.nsvc[0].nsvci = 0x65;
+ bts->site_mgr->gprs.nsvc[0].local_port = 0x5a3c;
uint8_t attr_nscv6_expected[] =
/* |- oml attr |-16bit length */
{ 0x9f, 0x00, 0x02, 0x00, 0x65, 0xfd, 0x00, 0x16,
@@ -303,7 +254,7 @@ int main(int argc, char **argv)
0xfd, 0x00, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
};
- test_nanobts_attr_nscv_get(bts, attr_nscv6_expected);
+ test_nanobts_gen_set_nsvc_attr(bts, attr_nscv6_expected);
printf("Done\n");
@@ -323,25 +274,3 @@ int main(int argc, char **argv)
talloc_free(ctx);
return 0;
}
-
-/* stubs */
-struct osmo_prim_hdr;
-int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
-{
- abort();
-}
-
-struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net) {
- OSMO_ASSERT(0);
-}
-
-bool on_gsm_ts_init(struct gsm_bts_trx_ts *ts)
-{ return true; }
-
-void ts_fsm_alloc(struct gsm_bts_trx_ts *ts) {}
-int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan) { return 0; }
-void pcu_info_update(struct gsm_bts *bts) {};
-int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, const uint8_t *data, int len) { return 0; }
-int rsl_bcch_info(const struct gsm_bts_trx *trx, enum osmo_sysinfo_type si_type, const uint8_t *data, int len)
-{ return 0; }
-int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type si_type) { return 0; }