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

laforge gerrit-no-reply at lists.osmocom.org
Tue Apr 27 13:38:34 UTC 2021


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

Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  dexter: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-omldummy/main.c b/src/osmo-bts-omldummy/main.c
index 183a5e5..9ab23c5 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, "h", long_options, &option_index);
+		c = getopt_long(argc, argv, "hf:", 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: 5
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210427/c83111ef/attachment.htm>


More information about the gerrit-log mailing list