aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-11-12 12:50:23 +0100
committerHarald Welte <laforge@gnumonks.org>2018-11-18 20:29:40 +0000
commiteebb6a4216f136132400831ca35ed70e7502e92a (patch)
tree0b987086e93e19d08360cd4d647af4f15d11688f /tests
parente5f4654ee34c5a346a0b85805c706115464e96e1 (diff)
bts: Allocate TRX for BTS dynamically, deprecate -t
No need to pass -t num_trx anymore to specify number of TRX to use. It is calculated based on dynamic allocation from VTY config. Using parameter -t is flagged as deprecated and is transformed into a NOOP por backward compatibility. As a result, TRX now are allocated after the BTS is allocated and initial config (pre-VTY) is applied. A new function bts_trx_init() is added, to set default config on each TRX during allocation and before setting VTY config on it. A new per BTS model function bts_model_trx_init() is added, to allow per model specific default configuration of each TRX. Change-Id: Iab1a754ab12a626759f9f90aa66f87bdce65ac9c
Diffstat (limited to 'tests')
-rw-r--r--tests/handover/handover_test.c13
-rw-r--r--tests/meas/meas_test.c17
-rw-r--r--tests/stubs.c2
-rw-r--r--tests/sysmobts/sysmobts_test.c2
4 files changed, 26 insertions, 8 deletions
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index c7bd8f8d..407ed95d 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -75,14 +75,18 @@ int main(int argc, char **argv)
fprintf(stderr, "Failed to create BTS structure\n");
exit(1);
}
+ if (bts_init(bts) < 0) {
+ fprintf(stderr, "unable to init BTS\n");
+ exit(1);
+ }
+
trx = gsm_bts_trx_alloc(bts);
if (!trx) {
- fprintf(stderr, "Failed to TRX structure\n");
+ fprintf(stderr, "Failed to alloc TRX structure\n");
exit(1);
}
-
- if (bts_init(bts) < 0) {
- fprintf(stderr, "unable to to open bts\n");
+ if (bts_trx_init(trx) < 0) {
+ fprintf(stderr, "unable to init TRX\n");
exit(1);
}
@@ -268,6 +272,7 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg, struct tlv_parsed
int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj) { return 0; }
int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj, uint8_t adm_state) { return 0; }
int bts_model_init(struct gsm_bts *bts) { return 0; }
+int bts_model_trx_init(struct gsm_bts_trx *trx) { return 0; }
int bts_model_trx_deact_rf(struct gsm_bts_trx *trx) { return 0; }
int bts_model_trx_close(struct gsm_bts_trx *trx) { return 0; }
void trx_get_hlayer1(void) {}
diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index d4f3fe68..f5803743 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -519,14 +519,18 @@ int main(int argc, char **argv)
fprintf(stderr, "Failed to create BTS structure\n");
exit(1);
}
+ if (bts_init(bts) < 0) {
+ fprintf(stderr, "unable to init BTS\n");
+ exit(1);
+ }
+
trx = gsm_bts_trx_alloc(bts);
if (!trx) {
- fprintf(stderr, "Failed to TRX structure\n");
+ fprintf(stderr, "Failed to alloc TRX structure\n");
exit(1);
}
-
- if (bts_init(bts) < 0) {
- fprintf(stderr, "unable to to open bts\n");
+ if (bts_trx_init(trx) < 0) {
+ fprintf(stderr, "unable to init TRX\n");
exit(1);
}
@@ -626,6 +630,11 @@ int bts_model_init(struct gsm_bts *bts)
return 0;
}
+int bts_model_trx_init(struct gsm_bts_trx *trx)
+{
+ return 0;
+}
+
int bts_model_trx_deact_rf(struct gsm_bts_trx *trx)
{
return 0;
diff --git a/tests/stubs.c b/tests/stubs.c
index f969cb3c..d6f4d3d8 100644
--- a/tests/stubs.c
+++ b/tests/stubs.c
@@ -13,6 +13,8 @@ int bts_model_chg_adm_state(struct gsm_bts *bts, struct gsm_abis_mo *mo,
{ return 0; }
int bts_model_init(struct gsm_bts *bts)
{ return 0; }
+int bts_model_trx_init(struct gsm_bts_trx *trx)
+{ return 0; }
int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
struct tlv_parsed *new_attr, int kind, void *obj)
{ return 0; }
diff --git a/tests/sysmobts/sysmobts_test.c b/tests/sysmobts/sysmobts_test.c
index 02490bef..4b01ed7a 100644
--- a/tests/sysmobts/sysmobts_test.c
+++ b/tests/sysmobts/sysmobts_test.c
@@ -198,6 +198,8 @@ void bts_update_status(enum bts_global_status which, int on)
int bts_model_init(struct gsm_bts *bts)
{ return 0; }
+int bts_model_trx_init(struct gsm_bts_trx *trx)
+{ return 0; }
int bts_model_oml_estab(struct gsm_bts *bts)
{ return 0; }
void bts_model_abis_close(struct gsm_bts *bts)