aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-04-02 23:16:30 +0200
committerlaforge <laforge@osmocom.org>2021-04-27 13:38:34 +0000
commit9c321b84860274a675edae307154cbd85a2dbd3e (patch)
tree5159ff938875da41fb3816153a7dfe728d5fa0a5 /src
parentdd8439f889a805da195f0a973c7c2355980cd5e2 (diff)
omldummy: add cmdline arg --features
The current usage is to make osmo-bts-omldummy indicate BTS_FEAT_VAMOS on OML, so that we can test osmo-bsc's behavior when VAMOS is enabled. Related: SYS#4895 Depends: I699cd27512887d64d824be680303e70fff3677c1 (libosmocore) Change-Id: Ib50990109f07884ef999ba5a4566f5d1d457b0ae
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-omldummy/main.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c
index 183a5e5b..9ab23c58 100644
--- a/src/osmo-bts-omldummy/main.c
+++ b/src/osmo-bts-omldummy/main.c
@@ -14,19 +14,24 @@
static void print_usage(const char *prog_name)
{
- printf("Usage: %s [-h] dst_host site_id [trx_num]\n", prog_name);
+ printf("Usage: %s [-h] [--features FOO,BAR,BAZ] dst_host site_id [trx_num]\n", prog_name);
}
static void print_help(const char *prog_name)
{
print_usage(prog_name);
printf(" -h --help This text.\n");
+ printf(" -f --features FOO,BAR,BAZ BTS features to issue on OML startup.\n"
+ " The names correspond to BTS_FEAT_* constants\n"
+ " as defined in osmocom/gsm/bts_features.h,\n"
+ " e.g. '-f VAMOS'\n");
}
struct {
char *dst_host;
int site_id;
int trx_num;
+ char *features;
} cmdline = {
.trx_num = 8,
};
@@ -37,10 +42,11 @@ void parse_cmdline(int argc, char **argv)
int option_index = 0, c;
static struct option long_options[] = {
{"help", 0, 0, 'h'},
+ {"features", 1, 0, 'f'},
{0}
};
- c = getopt_long(argc, argv, "h", long_options, &option_index);
+ c = getopt_long(argc, argv, "hf:", long_options, &option_index);
if (c == -1)
break;
@@ -48,6 +54,9 @@ void parse_cmdline(int argc, char **argv)
case 'h':
print_help(argv[0]);
exit(0);
+ case 'f':
+ cmdline.features = optarg;
+ break;
default:
/* catch unknown options *as well as* missing arguments. */
fprintf(stderr, "Error in command line options. Exiting.\n");
@@ -71,6 +80,29 @@ void parse_cmdline(int argc, char **argv)
}
}
+void set_bts_features(struct bitvec *features, char *features_str)
+{
+ char *saveptr = NULL;
+ char *token;
+
+ if (!features_str)
+ return;
+
+ while ((token = strtok_r(features_str, ",", &saveptr))) {
+ enum osmo_bts_features feat;
+ features_str = NULL;
+
+ feat = get_string_value(osmo_bts_features_names, token);
+
+ if ((int)feat < 0) {
+ fprintf(stderr, "Unknown BTS feature: '%s'\n", token);
+ exit(-1);
+ }
+
+ osmo_bts_set_feature(features, feat);
+ }
+}
+
int main(int argc, char **argv)
{
struct gsm_bts *bts;
@@ -100,6 +132,9 @@ int main(int argc, char **argv)
if (bts_init(bts) < 0)
exit(1);
+
+ set_bts_features(bts->features, cmdline.features);
+
//btsb = bts_role_bts(bts);
abis_init(bts);