From 82941cc6b6868a452ff8cc674260936d5a0b2a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 29 Feb 2024 12:24:30 +0100 Subject: [PATCH 1/5] REMOVE deprecated db related CLIs --- CHANGES_NEXT_RELEASE | 1 + doc/manuals/deprecated.md | 4 +- src/app/contextBroker/contextBroker.cpp | 24 +---- src/lib/mongoBackend/MongoGlobal.cpp | 16 ---- src/lib/mongoBackend/MongoGlobal.h | 8 -- src/lib/mongoDriver/mongoConnectionPool.cpp | 100 ++------------------ src/lib/mongoDriver/mongoConnectionPool.h | 8 -- test/unittests/main_UnitTest.cpp | 18 +--- 8 files changed, 16 insertions(+), 163 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb2..59f9251202 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Remove: `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` CLI parameters along with associated env vars, already deprecated in Orion 3.12.0 (use `-dbURI` instead`) \ No newline at end of file diff --git a/doc/manuals/deprecated.md b/doc/manuals/deprecated.md index 9b289331b4..5ed729988b 100644 --- a/doc/manuals/deprecated.md +++ b/doc/manuals/deprecated.md @@ -17,7 +17,7 @@ A list of deprecated features and the version in which they were deprecated foll * CLI parameters (and associated env vars): `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` in Orion 3.12.0. Use `dbURI` instead, - checking [this section](#mapping-to-mongouri-from-old-cli-parameters) if you need to know hot to build the MongoDB URI. + checking [this section](#mapping-to-mongouri-from-old-cli-parameters) if you need to know hot to build the MongoDB URI (removed in Orion 3.13.0). * `geo:point`, `geo:line`, `geo:box` and `geo:polygon` attribute types in Orion 3.10.0. Use `geo:json` instead. * `GET /v2` operation in Orion 3.8.0. This operation is pretty useless and not actually used. * Initial notification in subscriptions (along with `skipInitialNotification` option) in Orion 3.1.0. @@ -134,12 +134,12 @@ The following table provides information about the last Orion version supporting | **Removed feature** | **Last Orion version supporting feature** | **That version release date** | |----------------------------------------------------------------------------|-------------------------------------------|---------------------------------| -| CLI `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` (and associated env vars) | Not yet defined | Not yet defined | | `attributes` field in `POST /v2/entities` operation | Not yet defined | Not yet defined | | `APPEND`, `UPDATE`, etc. action types in `POST /v2/op/update` | Not yet defined | Not yet defined | | `dateCreated` and `dateModified` in `options` URI parameter | Not yet defined | Not yet defined | | `GET /v2` operation | Not yet defined | Not yet defined | | `geo:point`, `geo:line`, `geo:box` and `geo:polygon` attribute types | Not yet defined | Not yet defined | +| CLI `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` (and associated env vars) | 3.12.0 | February 29th, 2024 | | `location` metadata to specify entity location | 3.10.1 | June 12th, 2023 | | NGSIv1 API (along with CLI: `-strictNgsiv1Ids` and `-ngsiv1Autocast`) | 3.9.0 (*) | June 2nd, 2023 | | `/ngsi10` and `/ngsi9` URL prefixes | 3.7.0 (*) | May 26th, 2022 | diff --git a/src/app/contextBroker/contextBroker.cpp b/src/app/contextBroker/contextBroker.cpp index d1cc8a57b2..b8ede361f5 100644 --- a/src/app/contextBroker/contextBroker.cpp +++ b/src/app/contextBroker/contextBroker.cpp @@ -139,15 +139,8 @@ static bool isFatherProcess = false; bool fg; char bindAddress[MAX_LEN_IP]; int port; -char dbHost[256]; -char rplSet[64]; char dbName[64]; -char user[256]; char pwd[256]; -char authMech[64]; -char authDb[64]; -bool dbSSL; -bool dbDisableRetryWrites; char dbURI[1024]; char pidPath[256]; bool harakiri; @@ -159,7 +152,6 @@ bool https; bool mtenant; char allowedOrigin[64]; int maxAge; -long dbTimeout; long httpTimeout; long mqttTimeout; int dbPoolSize; @@ -298,18 +290,9 @@ PaArgument paArgs[] = { "-pidpath", pidPath, "PID_PATH", PaString, PaOpt, PIDPATH, PaNL, PaNL, PIDPATH_DESC }, { "-dbURI", dbURI, "MONGO_URI", PaString, PaOpt, _i "", PaNL, PaNL, DBURI_DESC }, - { "-dbhost", dbHost, "MONGO_HOST", PaString, PaOpt, LOCALHOST, PaNL, PaNL, DBHOST_DESC }, - { "-rplSet", rplSet, "MONGO_REPLICA_SET", PaString, PaOpt, _i "", PaNL, PaNL, RPLSET_DESC }, - { "-dbuser", user, "MONGO_USER", PaString, PaOpt, _i "", PaNL, PaNL, DBUSER_DESC }, { "-dbpwd", pwd, "MONGO_PASSWORD", PaString, PaOpt, _i "", PaNL, PaNL, DBPASSWORD_DESC }, - { "-dbAuthMech", authMech, "MONGO_AUTH_MECH", PaString, PaOpt, _i "", PaNL, PaNL, DBAUTHMECH_DESC }, - { "-dbAuthDb", authDb, "MONGO_AUTH_SOURCE", PaString, PaOpt, _i "", PaNL, PaNL, DBAUTHDB_DESC }, - { "-dbSSL", &dbSSL, "MONGO_SSL", PaBool, PaOpt, false, false, true, DBSSL_DESC }, - { "-dbDisableRetryWrites", &dbDisableRetryWrites, "MONGO_DISABLE_RETRY_WRITES", PaBool, PaOpt, false, false, true, DBDISABLERETRYWRITES_DESC }, - { "-db", dbName, "MONGO_DB", PaString, PaOpt, _i "orion", PaNL, PaNL, DB_DESC }, - { "-dbTimeout", &dbTimeout, "MONGO_TIMEOUT", PaULong, PaOpt, 0, 0, UINT_MAX, DB_TMO_DESC }, { "-dbPoolSize", &dbPoolSize, "MONGO_POOL_SIZE", PaInt, PaOpt, 10, 1, 10000, DBPS_DESC }, { "-ipv4", &useOnlyIPv4, "USEIPV4", PaBool, PaOpt, false, false, true, USEIPV4_DESC }, @@ -1133,11 +1116,6 @@ int main(int argC, char* argV[]) LM_X(1, ("dbName too long (max %d characters)", DB_NAME_MAX_LEN)); } - if ((strlen(authMech) > 0) && (strncmp(authMech, "SCRAM-SHA-1", strlen("SCRAM-SHA-1")) != 0) && (strncmp(authMech, "SCRAM-SHA-256", strlen("SCRAM-SHA-256")) != 0)) - { - LM_X(1, ("Fatal Error (-dbAuthMech must be either SCRAM-SHA-1 or SCRAM-SHA-256")); - } - if (useOnlyIPv6 && useOnlyIPv4) { LM_X(1, ("Fatal Error (-ipv4 and -ipv6 can not be activated at the same time. They are incompatible)")); @@ -1220,7 +1198,7 @@ int main(int argC, char* argV[]) alarmMgr.init(relogAlarms); mqttMgr.init(mqttTimeout); orionInit(orionExit, ORION_VERSION, policy, statCounters, statSemWait, statTiming, statNotifQueue, strictIdv1); - mongoInit(dbURI, dbHost, rplSet, dbName, user, pwd, authMech, authDb, dbSSL, dbDisableRetryWrites, mtenant, dbTimeout, writeConcern, dbPoolSize, statSemWait); + mongoInit(dbURI, dbName, pwd, mtenant, writeConcern, dbPoolSize, statSemWait); metricsMgr.init(!disableMetrics, statSemWait); logSummaryInit(&lsPeriod); diff --git a/src/lib/mongoBackend/MongoGlobal.cpp b/src/lib/mongoBackend/MongoGlobal.cpp index 85308f228b..ed1c979ca5 100644 --- a/src/lib/mongoBackend/MongoGlobal.cpp +++ b/src/lib/mongoBackend/MongoGlobal.cpp @@ -105,17 +105,9 @@ bool mongoMultitenant(void) void mongoInit ( const char* dbURI, - const char* dbHost, - const char* rplSet, std::string dbName, - const char* user, const char* pwd, - const char* mechanism, - const char* authDb, - bool dbSSL, - bool dbDisableRetryWrites, bool mtenant, - int64_t timeout, int writeConcern, int dbPoolSize, bool mutexTimeStat @@ -125,17 +117,9 @@ void mongoInit multitenant = mtenant; if (orion::mongoConnectionPoolInit(dbURI, - dbHost, dbName.c_str(), - rplSet, - user, pwd, - mechanism, - authDb, - dbSSL, - dbDisableRetryWrites, mtenant, - timeout, writeConcern, dbPoolSize, mutexTimeStat) != 0) diff --git a/src/lib/mongoBackend/MongoGlobal.h b/src/lib/mongoBackend/MongoGlobal.h index caa6058e8f..7b951c0784 100644 --- a/src/lib/mongoBackend/MongoGlobal.h +++ b/src/lib/mongoBackend/MongoGlobal.h @@ -72,17 +72,9 @@ extern bool mongoMultitenant(void); void mongoInit ( const char* dbURI, - const char* dbHost, - const char* rplSet, std::string dbName, - const char* user, const char* pwd, - const char* mechanism, - const char* authDb, - bool dbSSL, - bool dbDisableRetryWrites, bool mtenant, - int64_t timeout, int writeConcern, int dbPoolSize, bool mutexTimeStat diff --git a/src/lib/mongoDriver/mongoConnectionPool.cpp b/src/lib/mongoDriver/mongoConnectionPool.cpp index 855896753e..bcde607889 100644 --- a/src/lib/mongoDriver/mongoConnectionPool.cpp +++ b/src/lib/mongoDriver/mongoConnectionPool.cpp @@ -312,100 +312,28 @@ static void mongoDriverLogger /* **************************************************************************** * -* mongoConnectionPoolInit - +* composeMongoUri - */ -static std::string composeMongoUri -( - const char* dbURI, - const char* host, - const char* rplSet, - const char* username, - const char* passwd, - const char* mechanism, - const char* authDb, - bool dbSSL, - bool dbDisableRetryWrites, - int64_t timeout -) +static std::string composeMongoUri(const char* dbURI, const char* passwd) { // Compose the mongoUri, taking into account all information std::string uri; - if (strlen(dbURI) != 0) + const char* pwd = strstr(dbURI, "${PWD}"); + if (pwd != NULL) { - if (strlen(username) != 0 || strlen(authDb) != 0 || strlen(rplSet) != 0 || strlen(mechanism) != 0 || dbSSL || dbDisableRetryWrites || timeout > 0) + if (strlen(passwd) == 0) { - LM_X(1, ("Invalid Command Line Options: -dbURI cannot be combined with -dbhost, -rplSet, -dbTimeout, -dbuser, -dbAuthMech, -dbAuthDb, -dbSSL and -dbDisableRetryWrites")); + LM_X(1, ("Invalid Command Line Options: -dbURI is used with a password substitution, but no password (-dbpwd) is supplied")); } - const char* pwd = strstr(dbURI, "${PWD}"); - if (pwd != NULL) - { - if (strlen(passwd) == 0) - { - LM_X(1, ("Invalid Command Line Options: -dbURI is used with a password substitution, but no password (-dbpwd) is supplied")); - } - - // +6 is the length of the "${PWD}" - uri = std::string(dbURI, pwd - dbURI) + passwd + (pwd + 6); - } - else - { - uri = dbURI; - } + // +6 is the length of the "${PWD}" + uri = std::string(dbURI, pwd - dbURI) + passwd + (pwd + 6); } else { - uri = "mongodb://"; - - // Add auth parameter if included - if (strlen(username) != 0 && strlen(passwd) != 0) - { - uri += username + std::string(":") + passwd + "@"; - } - - uri += host + std::string("/"); - - if (strlen(authDb) != 0) - { - uri += authDb; - } - - // First option prefix is '?' symbol - std::string optionPrefix = "?"; - - if (strlen(rplSet) != 0) - { - uri += optionPrefix + "replicaSet=" + rplSet; - optionPrefix = "&"; - } - - if (strlen(mechanism) != 0) - { - uri += optionPrefix + "authMechanism=" + mechanism; - optionPrefix = "&"; - } - - if (dbSSL) - { - uri += optionPrefix + "tls=true&tlsAllowInvalidCertificates=true"; - optionPrefix = "&"; - } - - if (dbDisableRetryWrites) - { - uri += optionPrefix + "retryWrites=false"; - optionPrefix = "&"; - } - - if (timeout > 0) - { - char buf[STRING_SIZE_FOR_LONG]; - i2s(timeout, buf, sizeof(buf)); - uri += optionPrefix + "connectTimeoutMS=" + buf; - optionPrefix = "&"; - } + uri = dbURI; } LM_T(LmtMongo, ("MongoDB connection URI: '%s'", offuscatePassword(uri, passwd).c_str())); @@ -422,17 +350,9 @@ static std::string composeMongoUri int orion::mongoConnectionPoolInit ( const char* dbURI, - const char* host, const char* db, - const char* rplSet, - const char* username, const char* passwd, - const char* mechanism, - const char* authDb, - bool dbSSL, - bool dbDisableRetryWrites, bool mtenant, - int64_t timeout, int writeConcern, int poolSize, bool semTimeStat @@ -451,7 +371,7 @@ int orion::mongoConnectionPoolInit atexit(shutdownClient); // Set mongo Uri to connect - std::string uri = composeMongoUri(dbURI, host, rplSet, username, passwd, mechanism, authDb, dbSSL, dbDisableRetryWrites, timeout); + std::string uri = composeMongoUri(dbURI, passwd); #ifdef UNIT_TEST /* Basically, we are mocking all the DB pool with a single connection. The getMongoConnection() and mongoReleaseConnection() methods diff --git a/src/lib/mongoDriver/mongoConnectionPool.h b/src/lib/mongoDriver/mongoConnectionPool.h index 0dddc183ae..e5991eb55b 100644 --- a/src/lib/mongoDriver/mongoConnectionPool.h +++ b/src/lib/mongoDriver/mongoConnectionPool.h @@ -47,17 +47,9 @@ extern void mongoVersionGet(int* mayor, int* minor); extern int mongoConnectionPoolInit ( const char* dbURI, - const char* host, const char* db, - const char* rplSet, - const char* username, const char* passwd, - const char* mechanism, - const char* authDb, - bool dbSSL, - bool dbDisableRetryWrites, bool mtenant, - int64_t timeout, int writeConcern = 1, int poolSize = 10, bool semTimeStat = false diff --git a/test/unittests/main_UnitTest.cpp b/test/unittests/main_UnitTest.cpp index 3b7718b0c1..8e1b5c1d8f 100644 --- a/test/unittests/main_UnitTest.cpp +++ b/test/unittests/main_UnitTest.cpp @@ -81,15 +81,8 @@ unsigned long logLineMaxSize = 32 * 1024; bool logDeprecate = false; char dbURI[1024]; -char dbHost[256]; -char rplSet[64]; char dbName[64]; -char user[64]; char pwd[64]; -char authMech[64]; -char authDb[64]; -bool dbSSL; -int64_t dbTimeout; int dbPoolSize; int writeConcern; char gtest_filter[1024]; @@ -109,15 +102,8 @@ unsigned long fcMaxInterval = 0; PaArgument paArgs[] = { { "-dbURI", dbURI, "DB_URI", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, - { "-dbhost", dbHost, "DB_HOST", PaString, PaOpt, (int64_t) "localhost", PaNL, PaNL, "" }, - { "-rplSet", rplSet, "RPL_SET", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, - { "-dbuser", user, "DB_USER", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, { "-dbpwd", pwd, "DB_PASSWORD", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, - { "-dbAuthMech", authMech, "DB_AUTH_MECH", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, - { "-dbAuthDb", authDb, "DB_AUTH_DB", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, - { "-dbSSL", &dbSSL, "DB_AUTH_SSL", PaBool, PaOpt, false, false, true, "" }, { "-db", dbName, "DB", PaString, PaOpt, (int64_t) "orion", PaNL, PaNL, "" }, - { "-dbTimeout", &dbTimeout, "DB_TIMEOUT", PaInt64, PaOpt, 0, PaNL, PaNL, "" }, { "-dbPoolSize", &dbPoolSize, "DB_POOL_SIZE", PaInt, PaOpt, 10, 1, 10000, "" }, { "-writeConcern", &writeConcern, "WRITE_CONCERN", PaInt, PaOpt, 1, 0, 1, "" }, { "--gtest_filter=", gtest_filter, "", PaString, PaOpt, (int64_t) "", PaNL, PaNL, "" }, @@ -159,8 +145,8 @@ int main(int argC, char** argV) LM_M(("Init tests")); orionInit(exitFunction, orionUnitTestVersion, SemReadWriteOp, false, false, false, false, false); - // Note that disableRetryTries, multitenancy and mutex time stats are disabled for unit test mongo init - mongoInit(dbURI, dbHost, rplSet, dbName, user, pwd, authMech, authDb, dbSSL, false, false, dbTimeout, writeConcern, dbPoolSize, false); + // Note that multitenancy and mutex time stats are disabled for unit test mongo init + mongoInit(dbURI, dbName, pwd, false, writeConcern, dbPoolSize, false); alarmMgr.init(false); logSummaryInit(&lsPeriod); // setupDatabase(); FIXME #3775: pending on mongo unit test re-enabling From 9558ac9487913e2dde2b43fa0a3bd73b4aa6d83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 1 Mar 2024 09:50:55 +0100 Subject: [PATCH 2/5] FIX ftest --- .../cases/0000_cli/bool_option_with_value.test | 8 -------- .../cases/0000_cli/command_line_options.test | 8 -------- .../0000_cli/tracelevel_without_logLevel_as_DEBUG.test | 8 -------- test/functionalTest/cases/3658_env_vars/env_vars.test | 8 -------- 4 files changed, 32 deletions(-) diff --git a/test/functionalTest/cases/0000_cli/bool_option_with_value.test b/test/functionalTest/cases/0000_cli/bool_option_with_value.test index 157a33b97a..111fb8dde8 100644 --- a/test/functionalTest/cases/0000_cli/bool_option_with_value.test +++ b/test/functionalTest/cases/0000_cli/bool_option_with_value.test @@ -51,16 +51,8 @@ Usage: contextBroker [option '-U' (extended usage)] [option '-port' ] [option '-pidpath' ] [option '-dbURI' ] - [option '-dbhost' ] - [option '-rplSet' ] - [option '-dbuser' ] [option '-dbpwd' ] - [option '-dbAuthMech' ] - [option '-dbAuthDb' ] - [option '-dbSSL' (enable SSL connection to DB)] - [option '-dbDisableRetryWrites' (set retryWrite parameter to false in DB connections)] [option '-db' ] - [option '-dbTimeout' ] [option '-dbPoolSize' ] [option '-ipv4' (use ip v4 only)] [option '-ipv6' (use ip v6 only)] diff --git a/test/functionalTest/cases/0000_cli/command_line_options.test b/test/functionalTest/cases/0000_cli/command_line_options.test index 20a639175b..f97b786889 100644 --- a/test/functionalTest/cases/0000_cli/command_line_options.test +++ b/test/functionalTest/cases/0000_cli/command_line_options.test @@ -40,16 +40,8 @@ Usage: contextBroker [option '-U' (extended usage)] [option '-port' ] [option '-pidpath' ] [option '-dbURI' ] - [option '-dbhost' ] - [option '-rplSet' ] - [option '-dbuser' ] [option '-dbpwd' ] - [option '-dbAuthMech' ] - [option '-dbAuthDb' ] - [option '-dbSSL' (enable SSL connection to DB)] - [option '-dbDisableRetryWrites' (set retryWrite parameter to false in DB connections)] [option '-db' ] - [option '-dbTimeout' ] [option '-dbPoolSize' ] [option '-ipv4' (use ip v4 only)] [option '-ipv6' (use ip v6 only)] diff --git a/test/functionalTest/cases/0000_cli/tracelevel_without_logLevel_as_DEBUG.test b/test/functionalTest/cases/0000_cli/tracelevel_without_logLevel_as_DEBUG.test index cf566803ce..8c92e4fffc 100644 --- a/test/functionalTest/cases/0000_cli/tracelevel_without_logLevel_as_DEBUG.test +++ b/test/functionalTest/cases/0000_cli/tracelevel_without_logLevel_as_DEBUG.test @@ -41,16 +41,8 @@ Usage: contextBroker [option '-U' (extended usage)] [option '-port' ] [option '-pidpath' ] [option '-dbURI' ] - [option '-dbhost' ] - [option '-rplSet' ] - [option '-dbuser' ] [option '-dbpwd' ] - [option '-dbAuthMech' ] - [option '-dbAuthDb' ] - [option '-dbSSL' (enable SSL connection to DB)] - [option '-dbDisableRetryWrites' (set retryWrite parameter to false in DB connections)] [option '-db' ] - [option '-dbTimeout' ] [option '-dbPoolSize' ] [option '-ipv4' (use ip v4 only)] [option '-ipv6' (use ip v6 only)] diff --git a/test/functionalTest/cases/3658_env_vars/env_vars.test b/test/functionalTest/cases/3658_env_vars/env_vars.test index 2ede8f83af..4c8d70bc64 100644 --- a/test/functionalTest/cases/3658_env_vars/env_vars.test +++ b/test/functionalTest/cases/3658_env_vars/env_vars.test @@ -86,16 +86,8 @@ Extended Usage: contextBroker [option '-U' (extended usage)] [option '-port' ] ORION_PORT 1 <= 1026 /1026/ <= 65535 [option '-pidpath' ] ORION_PID_PATH '/tmp/contextBroker.pid' /'/tmp/contextBroker/ [option '-dbURI' ] ORION_MONGO_URI '' /''/ - [option '-dbhost' ] ORION_MONGO_HOST 'localhost' /'localhost'/ - [option '-rplSet' ] ORION_MONGO_REPLICA_SET '' /''/ - [option '-dbuser' ] ORION_MONGO_USER '' /''/ [option '-dbpwd' ] ORION_MONGO_PASSWORD '' /''/ - [option '-dbAuthMech' ] ORION_MONGO_AUTH_SOURCE '' /''/ - [option '-dbSSL' (enable SSL connection to DB)] ORION_MONGO_SSL FALSE /FALSE/ - [option '-dbDisableRetryWrites' (set retryWrite parameter to false in DB connect] ORION_MONGO_DISABLE_RETRY_WRITES FALSE /FALSE/ [option '-db' ] ORION_MONGO_DB 'orion' /'orion'/ - [option '-dbTimeout' ] ORION_MONGO_POOL_SIZE 1 <= 10 /10/ <= 10000 [option '-ipv4' (use ip v4 only)] ORION_USEIPV4 FALSE /FALSE/ [option '-ipv6' (use ip v6 only)] ORION_USEIPV6 FALSE /FALSE/ From 2312fc43c0649f912ae7b3b599e6ae8ec3c1ba31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 1 Mar 2024 16:50:18 +0100 Subject: [PATCH 3/5] FIX default dbURI --- src/app/contextBroker/contextBroker.cpp | 3 +- .../cases/3658_env_vars/env_vars.test | 116 +++++++++--------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/src/app/contextBroker/contextBroker.cpp b/src/app/contextBroker/contextBroker.cpp index b8ede361f5..1bd88da146 100644 --- a/src/app/contextBroker/contextBroker.cpp +++ b/src/app/contextBroker/contextBroker.cpp @@ -208,7 +208,6 @@ bool logDeprecate; */ #define PIDPATH _i "/tmp/contextBroker.pid" #define IP_ALL _i "0.0.0.0" -#define LOCALHOST _i "localhost" #define ONE_MONTH_PERIOD (3600 * 24 * 31) #define FG_DESC "don't start as daemon" @@ -289,7 +288,7 @@ PaArgument paArgs[] = { "-port", &port, "PORT", PaInt, PaOpt, 1026, 1, 65535, PORT_DESC }, { "-pidpath", pidPath, "PID_PATH", PaString, PaOpt, PIDPATH, PaNL, PaNL, PIDPATH_DESC }, - { "-dbURI", dbURI, "MONGO_URI", PaString, PaOpt, _i "", PaNL, PaNL, DBURI_DESC }, + { "-dbURI", dbURI, "MONGO_URI", PaString, PaOpt, _i "mongodb://localhost:27017", PaNL, PaNL, DBURI_DESC }, { "-dbpwd", pwd, "MONGO_PASSWORD", PaString, PaOpt, _i "", PaNL, PaNL, DBPASSWORD_DESC }, { "-db", dbName, "MONGO_DB", PaString, PaOpt, _i "orion", PaNL, PaNL, DB_DESC }, diff --git a/test/functionalTest/cases/3658_env_vars/env_vars.test b/test/functionalTest/cases/3658_env_vars/env_vars.test index 4c8d70bc64..60222b9c14 100644 --- a/test/functionalTest/cases/3658_env_vars/env_vars.test +++ b/test/functionalTest/cases/3658_env_vars/env_vars.test @@ -73,64 +73,64 @@ echo --REGEXPECT-- 01. Get the extended usage from the broker withut any alterations - see default state ===================================================================================== -Extended Usage: contextBroker [option '-U' (extended usage)] TRUE /FALSE/ - [option '-u' (usage)] FALSE /FALSE/ - [option '--help' (show help)] FALSE /FALSE/ - [option '--version' (show version)] FALSE /FALSE/ - [option '-logDir' ] ORION_LOG_DIR '/tmp/' - [option '-t' ] ORION_TRACE '' /'(null)'/ - [option '-logLevel' ] ORION_LOG_LEVEL 'WARN' /'WARN'/ - [option '-logAppend' (append to log-file)] ORION_LOG_APPEND FALSE /FALSE/ - [option '-fg' (don't start as daemon)] ORION_FOREGROUND FALSE /FALSE/ - [option '-localIp' ] ORION_LOCALIP '0.0.0.0' /'0.0.0.0'/ - [option '-port' ] ORION_PORT 1 <= 1026 /1026/ <= 65535 - [option '-pidpath' ] ORION_PID_PATH '/tmp/contextBroker.pid' /'/tmp/contextBroker/ - [option '-dbURI' ] ORION_MONGO_URI '' /''/ - [option '-dbpwd' ] ORION_MONGO_PASSWORD '' /''/ - [option '-db' ] ORION_MONGO_DB 'orion' /'orion'/ - [option '-dbPoolSize' ] ORION_MONGO_POOL_SIZE 1 <= 10 /10/ <= 10000 - [option '-ipv4' (use ip v4 only)] ORION_USEIPV4 FALSE /FALSE/ - [option '-ipv6' (use ip v6 only)] ORION_USEIPV6 FALSE /FALSE/ - [option '-https' (use the https 'protocol')] ORION_HTTPS FALSE /FALSE/ - [option '-key' ] ORION_HTTPS_KEYFILE '' /''/ - [option '-cert' ] ORION_HTTPS_CERTFILE '' /''/ - [option '-multiservice' (service multi tenancy mode)] ORION_MULTI_SERVICE FALSE /FALSE/ - [option '-httpTimeout' ] ORION_REQ_TIMEOUT 0 /0/ >= 0 - [option '-reqMutexPolicy' ] ORION_MUTEX_POLICY 'all' /'all'/ - [option '-writeConcern' ] ORION_MONGO_WRITE_CONCERN 0 <= 1 /1/ <= 1 - [option '-corsOrigin' ] ORION_CONN_MEMORY 0 <= 64 /64/ <= 1024 - [option '-maxConnections' ] ORION_MAX_CONN 1020 /1020/ >= 1 - [option '-reqPoolSize' ] ORION_TRQ_POOL_SIZE 0 <= 0 /0/ <= 1024 - [option '-inReqPayloadMaxSize' = 0 - [option '-outReqMsgMaxSize' = 0 - [option '-notificationMode' ] ORION_LOG_LINE_MAX_SIZE 32768 /32768/ >= 100 - [option '-logInfoPayloadMaxSize' = 0 - [option '-disableMetrics' (turn off the 'metrics' feature)] ORION_DISABLE_METRICS FALSE /FALSE/ - [option '-disableNgsiv1' (turn off NGSIv1 request endpoints)] ORION_DISABLE_NGSIV1 FALSE /FALSE/ - [option '-insecureNotif' (allow HTTPS notifications to peers which certificate c] ORION_INSECURE_NOTIF FALSE /FALSE/ - [option '-ngsiv1Autocast' (automatic cast for number, booleans and dates in NGSI] ORION_NGSIV1_AUTOCAST FALSE /FALSE/ - [option '-mqttMaxAge' ] ORION_LOG_DIR '/tmp/' + [option '-t' ] ORION_TRACE '' /'(null)'/ + [option '-logLevel' ] ORION_LOG_LEVEL 'WARN' /'WARN'/ + [option '-logAppend' (append to log-file)] ORION_LOG_APPEND FALSE /FALSE/ + [option '-fg' (don't start as daemon)] ORION_FOREGROUND FALSE /FALSE/ + [option '-localIp' ] ORION_LOCALIP '0.0.0.0' /'0.0.0.0'/ + [option '-port' ] ORION_PORT 1 <= 1026 /1026/ <= 65535 + [option '-pidpath' ] ORION_PID_PATH '/tmp/contextBroker.pid' /'/tmp/contextBroker/ + [option '-dbURI' ] ORION_MONGO_URI 'mongodb://localhost:27017' /'mongodb://localhos/ + [option '-dbpwd' ] ORION_MONGO_PASSWORD '' /''/ + [option '-db' ] ORION_MONGO_DB 'orion' /'orion'/ + [option '-dbPoolSize' ] ORION_MONGO_POOL_SIZE 1 <= 10 /10/ <= 10000 + [option '-ipv4' (use ip v4 only)] ORION_USEIPV4 FALSE /FALSE/ + [option '-ipv6' (use ip v6 only)] ORION_USEIPV6 FALSE /FALSE/ + [option '-https' (use the https 'protocol')] ORION_HTTPS FALSE /FALSE/ + [option '-key' ] ORION_HTTPS_KEYFILE '' /''/ + [option '-cert' ] ORION_HTTPS_CERTFILE '' /''/ + [option '-multiservice' (service multi tenancy mode)] ORION_MULTI_SERVICE FALSE /FALSE/ + [option '-httpTimeout' ] ORION_REQ_TIMEOUT 0 /0/ >= 0 + [option '-reqMutexPolicy' ] ORION_MUTEX_POLICY 'all' /'all'/ + [option '-writeConcern' ] ORION_MONGO_WRITE_CONCERN 0 <= 1 /1/ <= 1 + [option '-corsOrigin' ] ORION_CONN_MEMORY 0 <= 64 /64/ <= 1024 + [option '-maxConnections' ] ORION_MAX_CONN 1020 /1020/ >= 1 + [option '-reqPoolSize' ] ORION_TRQ_POOL_SIZE 0 <= 0 /0/ <= 1024 + [option '-inReqPayloadMaxSize' = 0 + [option '-outReqMsgMaxSize' = 0 + [option '-notificationMode' ] ORION_LOG_LINE_MAX_SIZE 32768 /32768/ >= 100 + [option '-logInfoPayloadMaxSize' = 0 + [option '-disableMetrics' (turn off the 'metrics' feature)] ORION_DISABLE_METRICS FALSE /FALSE/ + [option '-disableNgsiv1' (turn off NGSIv1 request endpoints)] ORION_DISABLE_NGSIV1 FALSE /FALSE/ + [option '-insecureNotif' (allow HTTPS notifications to peers which certificate c] ORION_INSECURE_NOTIF FALSE /FALSE/ + [option '-ngsiv1Autocast' (automatic cast for number, booleans and dates in NGSI] ORION_NGSIV1_AUTOCAST FALSE /FALSE/ + [option '-mqttMaxAge' Date: Sat, 2 Mar 2024 07:56:58 +0900 Subject: [PATCH 4/5] (JP) REMOVE deprecated db related CLIs (#4527) --- doc/manuals.jp/deprecated.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manuals.jp/deprecated.md b/doc/manuals.jp/deprecated.md index a515871299..535ebbf998 100644 --- a/doc/manuals.jp/deprecated.md +++ b/doc/manuals.jp/deprecated.md @@ -8,7 +8,7 @@ 推奨されなくなった機能のリストと、廃止された機能のバージョンは次のとおりです : -* Orion 3.12.0 での CLI パラメータ (および関連する環境変数): `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites`。MongoDB URI を構築するために必要な情報が必要な場合は、[このセクション](#mapping-to-mongouri-from-old-cli-parameters) をチェックして、代わりに `dbURI` を使用してください +* Orion 3.12.0 での CLI パラメータ (および関連する環境変数): `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites`。MongoDB URI を構築するために必要な情報が必要な場合は、[このセクション](#mapping-to-mongouri-from-old-cli-parameters) をチェックして、代わりに `dbURI` を使用してください (Orion 3.13.0 で削除されました) * Orion 3.10.0 での `geo:point`, `geo:line`, `geo:box` および `geo:polygon` 属性タイプ。代わりに `geo:json` を使用してください * Orion 3.8.0 での `GET /v2` 操作。この操作はかなり役に立たず、実際には使用されません。 * Orion 3.1.0 のサブスクリプションでの初期通知 (`skipInitialNotification` オプションと共に)。(Orion 3.2.0 で削除)。初期通知の @@ -103,13 +103,13 @@ Notes: | **削除された機能** | **機能をサポートする Orion ラスト・バージョン** | **バージョンのリリース日** | |--------------------------------------------------------------------------------------|-------------------------------------------------|----------------------------| -| CLI `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites` (および関連する環境変数) | まだ定義されていません | まだ定義されていません | | `POST /v2/entities` オペレーションの `attributes` フィールド | まだ定義されていません | まだ定義されていません | | `APPEND`, `UPDATE`, など。`POST /v2/op/update` でのアクション・タイプ | まだ定義されていません | まだ定義されていません | | URI パラメータでの `dateCreated` および `dateModified` | まだ定義されていません | まだ定義されていません | | エンティティのロケーションを指定する `location` メタデータ | まだ定義されていません | まだ定義されていません | | `GET /v2` 操作 | まだ定義されていません | まだ定義されていません | | `geo:point`, `geo:line`, `geo:box` および `geo:polygon` 属性タイプ | まだ定義されていません | まだ定義されていません | +| CLI `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites` (および関連する環境変数) | 3.12.0 | 2024年2月29日 | | エンティティの場所を指定するための `location` メタデータ | 3.10.1 | 2023年6月12日 | | NGSIv1 (関連する CLI パラメータ : `-strictNgsiv1Ids`, `-ngsiv1Autocast`) | 3.9.0 (*) | 2023年6月2日 | | `/ngsi10` および `/ngsi9` URL プレフィックス | 3.7.0 (*) | 2022年5月26日 | From 8a43ab04303ef18e124bf0b4151abb3a67e74b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Tue, 4 Jun 2024 15:58:10 +0200 Subject: [PATCH 5/5] FIX orion version date --- doc/manuals.jp/deprecated.md | 2 +- doc/manuals/deprecated.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manuals.jp/deprecated.md b/doc/manuals.jp/deprecated.md index 535ebbf998..d535d129c7 100644 --- a/doc/manuals.jp/deprecated.md +++ b/doc/manuals.jp/deprecated.md @@ -8,7 +8,7 @@ 推奨されなくなった機能のリストと、廃止された機能のバージョンは次のとおりです : -* Orion 3.12.0 での CLI パラメータ (および関連する環境変数): `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites`。MongoDB URI を構築するために必要な情報が必要な場合は、[このセクション](#mapping-to-mongouri-from-old-cli-parameters) をチェックして、代わりに `dbURI` を使用してください (Orion 3.13.0 で削除されました) +* Orion 3.12.0 での CLI パラメータ (および関連する環境変数): `-dbhost`、`-rplSet`、`-dbTimeout`、`-dbuser`、`-dbAuthMech`、`-dbAuthDb`、`-dbSSL`、および `-dbDisableRetryWrites`。MongoDB URI を構築するために必要な情報が必要な場合は、[このセクション](#mapping-to-mongouri-from-old-cli-parameters) をチェックして、代わりに `dbURI` を使用してください (Orion 4.0.0 で削除されました) * Orion 3.10.0 での `geo:point`, `geo:line`, `geo:box` および `geo:polygon` 属性タイプ。代わりに `geo:json` を使用してください * Orion 3.8.0 での `GET /v2` 操作。この操作はかなり役に立たず、実際には使用されません。 * Orion 3.1.0 のサブスクリプションでの初期通知 (`skipInitialNotification` オプションと共に)。(Orion 3.2.0 で削除)。初期通知の diff --git a/doc/manuals/deprecated.md b/doc/manuals/deprecated.md index 5ed729988b..cef27a61bf 100644 --- a/doc/manuals/deprecated.md +++ b/doc/manuals/deprecated.md @@ -17,7 +17,7 @@ A list of deprecated features and the version in which they were deprecated foll * CLI parameters (and associated env vars): `-dbhost`, `-rplSet`, `-dbTimeout`, `-dbuser`, `-dbAuthMech`, `-dbAuthDb`, `-dbSSL` and `-dbDisableRetryWrites` in Orion 3.12.0. Use `dbURI` instead, - checking [this section](#mapping-to-mongouri-from-old-cli-parameters) if you need to know hot to build the MongoDB URI (removed in Orion 3.13.0). + checking [this section](#mapping-to-mongouri-from-old-cli-parameters) if you need to know hot to build the MongoDB URI (removed in Orion 4.0.0). * `geo:point`, `geo:line`, `geo:box` and `geo:polygon` attribute types in Orion 3.10.0. Use `geo:json` instead. * `GET /v2` operation in Orion 3.8.0. This operation is pretty useless and not actually used. * Initial notification in subscriptions (along with `skipInitialNotification` option) in Orion 3.1.0.