Change in osmo-bsc[master]: handover_test prep: allow arbitrary timeslots in create_bts() code

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue Nov 17 01:56:09 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/21191 )


Change subject: handover_test prep: allow arbitrary timeslots in create_bts() code
......................................................................

handover_test prep: allow arbitrary timeslots in create_bts() code

Allow passing timeslot config to create_bts().

Preparation for Ic645cea671aa4798804666b8886f11bab5351e11 to allow arbitrary
timeslot configurations in the tests.

Change-Id: I3ae898be4a503060c6bf30ae89115a75461ffc27
---
M tests/handover/handover_test.c
1 file changed, 32 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/91/21191/1

diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index cc53386..19a8798 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -174,12 +174,27 @@
 	abis_rsl_rcvmsg(msg);
 }
 
-static struct gsm_bts *create_bts()
+enum gsm_phys_chan_config pchan_from_str(const char *str)
+{
+	enum gsm_phys_chan_config pchan = gsm_pchan_parse(str);
+	if (pchan < 0) {
+		fprintf(stderr, "Invalid timeslot pchan type: %s\n", str);
+		exit(1);
+	}
+	return pchan;
+}
+
+const char * const bts_default_ts[] = {
+	"CCCH+SDCCH4", "TCH/F", "TCH/F", "TCH/F", "TCH/F", "TCH/H", "TCH/H", "NONE",
+};
+
+static struct gsm_bts *create_bts(const char * const *ts_args)
 {
 	static int arfcn = 870;
 	struct gsm_bts *bts;
 	struct e1inp_sign_link *rsl_link;
 	int i;
+	struct gsm_bts_trx *trx;
 
 	bts = bsc_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_UNKNOWN, 0x3f);
 	if (!bts) {
@@ -198,19 +213,23 @@
 	rsl_link->trx = bts->c0;
 	bts->c0->rsl_link = rsl_link;
 
-	bts->c0->mo.nm_state.operational = NM_OPSTATE_ENABLED;
-	bts->c0->mo.nm_state.availability = NM_AVSTATE_OK;
-	bts->c0->mo.nm_state.administrative = NM_STATE_UNLOCKED;
-	bts->c0->bb_transc.mo.nm_state.operational = NM_OPSTATE_ENABLED;
-	bts->c0->bb_transc.mo.nm_state.availability = NM_AVSTATE_OK;
-	bts->c0->bb_transc.mo.nm_state.administrative = NM_STATE_UNLOCKED;
+	trx = gsm_bts_trx_num(bts, 0);
+
+	trx->mo.nm_state.operational = NM_OPSTATE_ENABLED;
+	trx->mo.nm_state.availability = NM_AVSTATE_OK;
+	trx->mo.nm_state.administrative = NM_STATE_UNLOCKED;
+	trx->bb_transc.mo.nm_state.operational = NM_OPSTATE_ENABLED;
+	trx->bb_transc.mo.nm_state.availability = NM_AVSTATE_OK;
+	trx->bb_transc.mo.nm_state.administrative = NM_STATE_UNLOCKED;
 
 	/* 4 full rate and 4 half rate channels */
-	for (i = 1; i <= 6; i++) {
-		bts->c0->ts[i].pchan_from_config = (i < 5) ? GSM_PCHAN_TCH_F : GSM_PCHAN_TCH_H;
-		bts->c0->ts[i].mo.nm_state.operational = NM_OPSTATE_ENABLED;
-		bts->c0->ts[i].mo.nm_state.availability = NM_AVSTATE_OK;
-		bts->c0->ts[i].mo.nm_state.administrative = NM_STATE_UNLOCKED;
+	for (i = 0; i < 8; i++) {
+		trx->ts[i].pchan_from_config = pchan_from_str(ts_args[i]);
+		if (trx->ts[i].pchan_from_config == GSM_PCHAN_NONE)
+			continue;
+		trx->ts[i].mo.nm_state.operational = NM_OPSTATE_ENABLED;
+		trx->ts[i].mo.nm_state.availability = NM_AVSTATE_OK;
+		trx->ts[i].mo.nm_state.administrative = NM_STATE_UNLOCKED;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(bts->c0->ts); i++) {
@@ -1505,7 +1524,7 @@
 			fprintf(stderr, "- Creating %d BTS (one TRX each, "
 				"TS(1-4) are TCH/F, TS(5-6) are TCH/H)\n", n);
 			for (i = 0; i < n; i++)
-				bts[bts_num + i] = create_bts();
+				bts[bts_num + i] = create_bts(bts_default_ts);
 			bts_num += n;
 			test_case += 2;
 		} else

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/21191
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3ae898be4a503060c6bf30ae89115a75461ffc27
Gerrit-Change-Number: 21191
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201117/2f164077/attachment.htm>


More information about the gerrit-log mailing list