aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bsc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bsc')
-rw-r--r--tests/bsc/bsc_test.c62
-rw-r--r--tests/bsc/bsc_test.ok51
2 files changed, 113 insertions, 0 deletions
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 4a97b9f5d..62757b4c4 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -29,6 +29,12 @@
#include <osmocom/bsc/osmo_bsc.h>
#include <osmocom/bsc/bsc_msc_data.h>
+#include <osmocom/bsc/bss.h>
+#include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/timeslot_fsm.h>
+#include <osmocom/bsc/lchan_fsm.h>
+#include <osmocom/bsc/assignment_fsm.h>
+#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
#include <osmocom/gsm/gad.h>
#include <osmocom/core/application.h>
@@ -180,6 +186,61 @@ out:
bsc_gsmnet = NULL;
}
+static void test_fsm_ids_with_pchan_names(void)
+{
+ struct gsm_network *net;
+ struct gsm_bts *bts;
+ struct gsm_bts_trx *trx;
+ struct gsm_bts_trx_ts *ts;
+ struct gsm_lchan *lchan;
+ enum gsm_phys_chan_config pchan;
+ struct gsm_subscriber_connection *conn;
+
+ rate_ctr_init(ctx);
+ tall_bsc_ctx = ctx;
+ bsc_network_alloc();
+ net = bsc_gsmnet;
+
+ /* Have a BTS so that we have trx, timeslots, lchans that have FSMs to check the id of */
+ bts = bsc_bts_alloc_register(net, GSM_BTS_TYPE_UNKNOWN, HARDCODED_BSIC);
+ trx = gsm_bts_trx_alloc(bts);
+
+ printf("\nTesting FSM ids that contain pchan names\n");
+ ts = &trx->ts[0];
+ lchan = &ts->lchan[0];
+
+ conn = bsc_subscr_con_allocate(net);
+ conn->lchan = lchan;
+ conn->assignment.new_lchan = lchan;
+ conn->sccp.conn_id = 123;
+ conn->bsub = bsc_subscr_find_or_create_by_tmsi(net->bsc_subscribers, 0x423, "test");
+ gscon_update_id(conn);
+
+ /* dirty dirty hack, to just point at some fi so we can update the id */
+ conn->assignment.fi = trx->ts[1].fi;
+
+ for (pchan = 0; pchan < _GSM_PCHAN_MAX; pchan++) {
+ ts->pchan_from_config = pchan;
+ /* trigger ID update in ts and lchan */
+ osmo_fsm_inst_dispatch(ts->fi, TS_EV_OML_READY, NULL);
+
+ if (lchan->fi)
+ assignment_fsm_update_id(conn);
+
+ printf("pchan=%s:\n ts->fi->id = %s\n lchan->fi->id = %s\n assignment.fi->id = %s\n",
+ gsm_pchan_name(pchan),
+ ts->fi->id,
+ lchan->fi ? lchan->fi->id : "null",
+ lchan->fi ? conn->assignment.fi->id : "null");
+
+ osmo_fsm_inst_dispatch(ts->fi, TS_EV_OML_DOWN, NULL);
+ }
+
+ talloc_free(net);
+ bsc_gsmnet = NULL;
+ printf("\n");
+}
+
static const struct log_info_cat log_categories[] = {
[DNM] = {
.name = "DNM",
@@ -216,6 +277,7 @@ int main(int argc, char **argv)
osmo_init_logging2(ctx, &log_info);
test_scan();
+ test_fsm_ids_with_pchan_names();
printf("Testing execution completed.\n");
talloc_free(ctx);
diff --git a/tests/bsc/bsc_test.ok b/tests/bsc/bsc_test.ok
index 0564bf0cd..fbfc49ace 100644
--- a/tests/bsc/bsc_test.ok
+++ b/tests/bsc/bsc_test.ok
@@ -1,4 +1,55 @@
Testing BTS<->MSC message scan.
Going to test item: 0
Going to test item: 1
+
+Testing FSM ids that contain pchan names
+pchan=NONE:
+ ts->fi->id = 0-1-0-NONE
+ lchan->fi->id = null
+ assignment.fi->id = null
+pchan=CCCH:
+ ts->fi->id = 0-1-0-CCCH
+ lchan->fi->id = null
+ assignment.fi->id = null
+pchan=CCCH+SDCCH4:
+ ts->fi->id = 0-1-0-CCCH_SDCCH4
+ lchan->fi->id = 0-1-0-CCCH_SDCCH4-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-CCCH_SDCCH4-0
+pchan=TCH/F:
+ ts->fi->id = 0-1-0-TCH_F
+ lchan->fi->id = 0-1-0-TCH_F-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-TCH_F-0
+pchan=TCH/H:
+ ts->fi->id = 0-1-0-TCH_H
+ lchan->fi->id = 0-1-0-TCH_H-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-TCH_H-0
+pchan=SDCCH8:
+ ts->fi->id = 0-1-0-SDCCH8
+ lchan->fi->id = 0-1-0-SDCCH8-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-SDCCH8-0
+pchan=PDCH:
+ ts->fi->id = 0-1-0-PDCH
+ lchan->fi->id = null
+ assignment.fi->id = null
+pchan=DYNAMIC/IPACCESS:
+ ts->fi->id = 0-1-0-TCH_F_PDCH
+ lchan->fi->id = 0-1-0-TCH_F_PDCH-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-TCH_F_PDCHasTCH_F-0
+pchan=UNKNOWN:
+ ts->fi->id = 0-1-0-UNKNOWN
+ lchan->fi->id = null
+ assignment.fi->id = null
+pchan=CCCH+SDCCH4+CBCH:
+ ts->fi->id = 0-1-0-CCCH_SDCCH4_CBCH
+ lchan->fi->id = 0-1-0-CCCH_SDCCH4_CBCH-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-CCCH_SDCCH4_CBCH-0
+pchan=SDCCH8+CBCH:
+ ts->fi->id = 0-1-0-SDCCH8_CBCH
+ lchan->fi->id = 0-1-0-SDCCH8_CBCH-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-SDCCH8_CBCH-0
+pchan=DYNAMIC/OSMOCOM:
+ ts->fi->id = 0-1-0-OSMO_DYN
+ lchan->fi->id = 0-1-0-OSMO_DYN-0
+ assignment.fi->id = msc4294967295-conn123_subscr-TMSI-0x00000423_0-1-0-OSMO_DYNasNONE-0
+
Testing execution completed.