Change in osmo-bts[master]: omldummy: add cmdline arg --features

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
Fri Apr 2 21:38:33 UTC 2021


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


Change subject: omldummy: add cmdline arg --features
......................................................................

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
Change-Id: Ib50990109f07884ef999ba5a4566f5d1d457b0ae
---
M src/osmo-bts-omldummy/main.c
1 file changed, 37 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/89/23589/1

diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c
index fe28b05..fdb6f8e 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 @@
 		int option_index = 0, c;
 		static struct option long_options[] = {
 			{"help", 0, 0, 'h'},
+			{"features", 1, 0, 'f'},
 			{0}
 		};
 
-		c = getopt_long(argc, argv, "hd", long_options, &option_index);
+		c = getopt_long(argc, argv, "hdf:", long_options, &option_index);
 		if (c == -1)
 			break;
 
@@ -48,6 +54,9 @@
 		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 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 @@
 
 	if (bts_init(bts) < 0)
 		exit(1);
+
+	set_bts_features(bts->features, cmdline.features);
+
 	//btsb = bts_role_bts(bts);
 	abis_init(bts);
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ib50990109f07884ef999ba5a4566f5d1d457b0ae
Gerrit-Change-Number: 23589
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/20210402/47604c60/attachment.htm>


More information about the gerrit-log mailing list