[MERGED] osmo-trx[master]: config: Remove OpenBTS style sqlite configuration

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Apr 10 06:54:40 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: config: Remove OpenBTS style sqlite configuration
......................................................................


config: Remove OpenBTS style sqlite configuration

OpenBTS relies on reading in configuration values from the OpenBTS.config
sqlite3 database. This configuration method is not maintained and not
recommended for Osmocom or OpenBTS use. Command line setup is the
recommended approach.

Note that when the osmo-trx logging mechanism is replaced, the sqlite
dependency will be removed.

Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd
---
M Transceiver52M/osmo-trx.cpp
1 file changed, 4 insertions(+), 80 deletions(-)

Approvals:
  Tom Tsou: Looks good to me, approved
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index b36c081..b07ffe8 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -49,16 +49,9 @@
  */
 #define DEFAULT_RX_SPS		1
 
-/* Default configuration parameters
- *     Note that these values are only used if the particular key does not
- *     exist in the configuration database. IP port and address values will
- *     typically be overwritten by the OpenBTS.db values. Other values will
- *     not be in the database by default.
- */
+/* Default configuration parameters */
 #define DEFAULT_TRX_PORT	5700
 #define DEFAULT_TRX_IP		"127.0.0.1"
-#define DEFAULT_EXTREF		false
-#define DEFAULT_DIVERSITY	false
 #define DEFAULT_CHANS		1
 
 struct trx_config {
@@ -86,40 +79,6 @@
 
 volatile bool gshutdown = false;
 
-/* Run sanity check on configuration table
- *     The global table constructor cannot provide notification in the
- *     event of failure. Make sure that we can access the database,
- *     write to it, and that it contains the bare minimum required keys.
- */
-bool testConfig()
-{
-	int val = 9999;
-	std::string test = "asldfkjsaldkf";
-	const char *key = "Log.Level";
-
-	/* Attempt to query */
-	try {
-		gConfig.getStr(key);
-	} catch (...) {
-		std::cerr << std::endl;
-		std::cerr << "Config: Failed query required key " << key
-			  << std::endl;
-		return false;
-	}
-
-	/* Attempt to set a test value in the global config */
-	if (!gConfig.set(test, val)) {
-		std::cerr << std::endl;
-		std::cerr << "Config: Failed to set test key" << std::endl;
-		return false;
-	} else {
-		gConfig.remove(test);
-	}
-
-	return true;
-}
-
-
 /* Setup configuration values
  *     Don't query the existence of the Log.Level because it's a
  *     mandatory value. That is, if it doesn't exist, the configuration
@@ -130,43 +89,6 @@
 bool trx_setup_config(struct trx_config *config)
 {
 	std::string refstr, fillstr, divstr, mcstr, edgestr;
-
-	if (!testConfig())
-		return false;
-
-	if (config->log_level == "")
-		config->log_level = gConfig.getStr("Log.Level");
-
-	if (!config->port) {
-		if (gConfig.defines("TRX.Port"))
-			config->port = gConfig.getNum("TRX.Port");
-		else
-			config->port = DEFAULT_TRX_PORT;
-	}
-
-	if (config->addr == "") {
-		if (gConfig.defines("TRX.IP"))
-			config->addr = gConfig.getStr("TRX.IP");
-		else
-			config->addr = DEFAULT_TRX_IP;
-	}
-
-	if (!config->extref) {
-		if (gConfig.defines("TRX.Reference"))
-			config->extref = gConfig.getNum("TRX.Reference");
-		else
-			config->extref = DEFAULT_EXTREF;
-	}
-
-	if (!config->diversity) {
-		if (gConfig.defines("TRX.Diversity"))
-			config->diversity = gConfig.getNum("TRX.Diversity");
-		else
-			config->diversity = DEFAULT_DIVERSITY;
-	}
-
-	if (!config->chans)
-		config->chans = DEFAULT_CHANS;
 
 	if (config->mcbts && config->chans > 5) {
 		std::cout << "Unsupported number of channels" << std::endl;
@@ -350,7 +272,9 @@
 {
 	int option;
 
-	config->port = 0;
+	config->log_level = "NOTICE";
+	config->addr = DEFAULT_TRX_IP;
+	config->port = DEFAULT_TRX_PORT;
 	config->tx_sps = DEFAULT_TX_SPS;
 	config->rx_sps = DEFAULT_RX_SPS;
 	config->chans = DEFAULT_CHANS;

-- 
To view, visit https://gerrit.osmocom.org/2185
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95d7b771fde976818bee76f89163e72c3a44ecdd
Gerrit-PatchSet: 4
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list