Skip to content

Commit

Permalink
Merge branch 'develop' into issue/1427_mqtt_broker_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kzangeli authored Sep 20, 2023
2 parents 800fae7 + 63a7528 commit bf11d4a
Show file tree
Hide file tree
Showing 180 changed files with 6,278 additions and 801 deletions.
5 changes: 5 additions & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ Fixed issues:
* #280 - Changed all error codes from InvalidRequest to BadRequestData, except for JSON Parse Error that is still an InvalidRequest
* #280 - Giving errors for expiresAt in the past (for registrations and subscriptions)
* #280 - Fixed a bug in error detection of downloading errors in arrays of contexts, at lower nesting levels
* #280 - Better 501 handling of temporal operations
* #280 - Highly experimental feature for subscriptions: allowing a wildcard as value for entity type, to not filter on entity type
* #280 - Implemented Periodic Notifications (subscriptions with a 'timeInterval')
* #280 - Fixed a crash in the subscription cache for subscriptions with empty URL paths in the notification::endpoint::uri field
* #280 - New CLI (hidden) for extra field in notifications (trigger: "VERB URL PATH"): -triggerOperation
* #1427 - Disabling the keep-alive as it seems to be missing in libpaho (this is just a part of the issue)
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ SET (ORION_LIBS
orionld_troe
orionld_dbModel
orionld_apiModel
orionld_pernot
serviceRoutines
serviceRoutinesV2
ngsiNotify
Expand Down Expand Up @@ -366,6 +367,7 @@ if (error EQUAL 0)
ADD_SUBDIRECTORY(src/lib/jsonParse)
ADD_SUBDIRECTORY(src/lib/jsonParseV2)
ADD_SUBDIRECTORY(src/lib/rest)
ADD_SUBDIRECTORY(src/lib/orionld/pernot)
ADD_SUBDIRECTORY(src/lib/orionld/socketService)
ADD_SUBDIRECTORY(src/lib/orionld/notifications)
ADD_SUBDIRECTORY(src/lib/orionld/forwarding)
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile-test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ WORKDIR lcov-1.14
RUN make install
WORKDIR ${PATH_TO_SRC}

RUN yum-config-manager --disable pgdg10

RUN yum install -y gnupg

RUN yum install -y https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.4/x86_64/RPMS/mongodb-database-tools-100.4.1.x86_64.rpm
Expand Down
4 changes: 2 additions & 2 deletions docker/build-ubi/install-gnutls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ yum -y install https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packag
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/nettle-devel-3.4.1-7.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/libidn2-devel-2.2.0-1.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/libtasn1-devel-4.13-3.el8.x86_64.rpm
yum -y install https://dl.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/gnutls-c++-3.6.16-5.el8_6.x86_64.rpm
yum -y install https://dl.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/gnutls-devel-3.6.16-5.el8_6.x86_64.rpm
yum -y install https://dl.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/gnutls-c++-3.6.16-6.el8_7.x86_64.rpm
yum -y install https://dl.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/gnutls-devel-3.6.16-6.el8_7.x86_64.rpm

#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/gmp-devel-6.1.2-10.el8.x86_64.rpm
#yum -y install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/pkgconf-pkg-config-1.4.2-1.el8.x86_64.rpm
Expand Down
2 changes: 1 addition & 1 deletion docker/build-ubi/install-paho-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set -e

echo
echo -e "\e[1;32m Debian Builder: installing Paho MQTT C library \e[0m"
wget https://mirror.centos.org/centos/7/os/x86_64/Packages/doxygen-1.8.5-4.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/doxygen-1.8.5-4.el7.x86_64.rpm
yum install -y doxygen-1.8.5-4.el7.x86_64.rpm


Expand Down
2 changes: 1 addition & 1 deletion docker/build-ubi/install-postgres-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ yum -y install https://rpmfind.net/linux/centos/8-stream/PowerTools/x86_64/os/Pa
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/blas-3.8.0-8.el8.x86_64.rpm
yum -y install https://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/lapack-3.8.0-8.el8.x86_64.rpm
#yum -y install https://rpmfind.net/linux/epel/8/Everything/x86_64/Packages/a/armadillo-10.8.2-1.el8.x86_64.rpm
yum -y install http://yum.stanford.edu/mrepo/epel-EL8-x86_64/RPMS.all/armadillo-9.700.2-1.el8.x86_64.rpm
yum -y install https://archives.fedoraproject.org/pub/archive/epel/8.1/Everything/x86_64/Packages/a/armadillo-9.700.2-1.el8.x86_64.rpm

echo "Add repos"
yum update -y --nogpgcheck
Expand Down
37 changes: 28 additions & 9 deletions src/app/orionld/orionld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ extern "C"
#include "orionld/regCache/regCacheInit.h" // regCacheInit
#include "orionld/regCache/regCacheCreate.h" // regCacheCreate
#include "orionld/regCache/regCacheRelease.h" // regCacheRelease
#include "orionld/pernot/pernotSubCacheInit.h" // pernotSubCacheInit
#include "orionld/pernot/pernotLoop.h" // pernotLoopStart

#include "orionld/version.h"
#include "orionld/orionRestServices.h"
Expand Down Expand Up @@ -208,6 +210,7 @@ char reqMutexPolicy[16];
int writeConcern;
unsigned int cprForwardLimit;
int subCacheInterval;
int subCacheFlushInterval;
char notificationMode[64];
int notificationQueueSize;
int notificationThreadNum;
Expand Down Expand Up @@ -236,6 +239,7 @@ bool ngsiv1Autocast;
int contextDownloadAttempts;
int contextDownloadTimeout;
bool troe;
bool pernot;
bool disableFileLog;
bool lmtmp;
char troeHost[256];
Expand All @@ -252,8 +256,9 @@ bool noswap;
bool experimental = false;
bool mongocOnly = false;
bool debugCurl = false;
int cSubCounters;
uint32_t cSubCounters;
char coreContextVersion[64];
bool triggerOperation = false;



Expand Down Expand Up @@ -294,6 +299,7 @@ char coreContextVersion[64];
#define WRITE_CONCERN_DESC "db write concern (0:unacknowledged, 1:acknowledged)"
#define CPR_FORWARD_LIMIT_DESC "maximum number of distributed requests to Context Providers for a single client request"
#define SUB_CACHE_IVAL_DESC "interval in seconds between calls to Subscription Cache refresh (0: no refresh)"
#define SUB_CACHE_FLUSH_IVAL_DESC "interval in seconds between calls to Pernot Subscription Cache Flush to DB (0: no flush)"
#define NOTIFICATION_MODE_DESC "notification mode (persistent|transient|threadpool:q:n)"
#define NO_CACHE "disable subscription cache for lookups"
#define CONN_MEMORY_DESC "maximum memory size per connection (in kilobytes)"
Expand All @@ -317,6 +323,7 @@ char coreContextVersion[64];
#define INSECURE_NOTIF "allow HTTPS notifications to peers which certificate cannot be authenticated with known CA certificates"
#define NGSIV1_AUTOCAST "automatic cast for number, booleans and dates in NGSIv1 update/create attribute operations"
#define TROE_DESC "enable TRoE - temporal representation of entities"
#define PERNOT_DESC "enable Pernot - Periodic Notifications"
#define DISABLE_FILE_LOG "disable logging into file"
#define TMPTRACES_DESC "disable traces"
#define TROE_HOST_DESC "host for troe database db server"
Expand All @@ -331,6 +338,7 @@ char coreContextVersion[64];
#define ID_INDEX_DESC "automatic mongo index on _id.id"
#define NOSWAP_DESC "no swapping - for testing only!!!"
#define NO_NOTIFY_FALSE_UPDATE_DESC "turn off notifications on non-updates"
#define TRIGGER_OPERATION_DESC "include the operation that triggered the notification"
#define EXPERIMENTAL_DESC "enable experimental implementation - use at own risk - see release notes of Orion-LD v1.1.0"
#define MONGOCONLY_DESC "enable experimental implementation + turn off mongo legacy driver"
#define DBAUTHDB_DESC "database used for authentication"
Expand Down Expand Up @@ -365,7 +373,6 @@ PaArgument paArgs[] =
{
{ "-coreContext", coreContextVersion, "CORE_CONTEXT", PaString, PaOpt, _i ORIONLD_CORE_CONTEXT_URL_DEFAULT, PaNL, PaNL, CORE_CONTEXT_DESC },

{ "-noswap", &noswap, "NOSWAP", PaBool, PaHid, false, false, true, NOSWAP_DESC },
{ "-fg", &fg, "FOREGROUND", PaBool, PaOpt, false, false, true, FG_DESC },
{ "-localIp", bindAddress, "LOCALIP", PaString, PaOpt, IP_ALL, PaNL, PaNL, LOCALIP_DESC },
{ "-port", &port, "PORT", PaInt, PaOpt, 1026, 1024, 65535, PORT_DESC },
Expand All @@ -383,10 +390,8 @@ PaArgument paArgs[] =
{ "-dbTimeout", &dbTimeout, "MONGO_TIMEOUT", PaDouble, PaOpt, 10000, PaNL, PaNL, DB_TMO_DESC },
{ "-dbPoolSize", &dbPoolSize, "MONGO_POOL_SIZE", PaInt, PaOpt, 10, 1, 10000, DBPS_DESC },
{ "-writeConcern", &writeConcern, "MONGO_WRITE_CONCERN", PaInt, PaOpt, 1, 0, 1, WRITE_CONCERN_DESC },
{ "-idIndex", &idIndex, "MONGO_ID_INDEX", PaBool, PaHid, false, false, true, ID_INDEX_DESC },
{ "-ipv4", &useOnlyIPv4, "USEIPV4", PaBool, PaOpt, false, false, true, USEIPV4_DESC },
{ "-ipv6", &useOnlyIPv6, "USEIPV6", PaBool, PaOpt, false, false, true, USEIPV6_DESC },
{ "-harakiri", &harakiri, "HARAKIRI", PaBool, PaHid, false, false, true, HARAKIRI_DESC },
{ "-https", &https, "HTTPS", PaBool, PaOpt, false, false, true, HTTPS_DESC },
{ "-key", httpsKeyFile, "HTTPS_KEYFILE", PaString, PaOpt, _i "", PaNL, PaNL, HTTPSKEYFILE_DESC },
{ "-cert", httpsCertFile, "HTTPS_CERTFILE", PaString, PaOpt, _i "", PaNL, PaNL, HTTPSCERTFILE_DESC },
Expand All @@ -398,6 +403,7 @@ PaArgument paArgs[] =
{ "-corsMaxAge", &maxAge, "CORS_MAX_AGE", PaInt, PaOpt, 86400, -1, 86400, CORS_MAX_AGE_DESC },
{ "-cprForwardLimit", &cprForwardLimit, "CPR_FORWARD_LIMIT", PaUInt, PaOpt, 1000, 0, UINT_MAX, CPR_FORWARD_LIMIT_DESC },
{ "-subCacheIval", &subCacheInterval, "SUBCACHE_IVAL", PaInt, PaOpt, 0, 0, 3600, SUB_CACHE_IVAL_DESC },
{ "-subCacheFlushIval", &subCacheFlushInterval, "SUBCACHE_FLUSH_IVAL", PaInt, PaOpt, 10, 0, 3600, SUB_CACHE_FLUSH_IVAL_DESC },
{ "-noCache", &noCache, "NOCACHE", PaBool, PaOpt, false, false, true, NO_CACHE },
{ "-connectionMemory", &connectionMemory, "CONN_MEMORY", PaUInt, PaOpt, 64, 0, 1024, CONN_MEMORY_DESC },
{ "-maxConnections", &maxConnections, "MAX_CONN", PaUInt, PaOpt, 1020, 1, PaNL, MAX_CONN_DESC },
Expand All @@ -422,22 +428,28 @@ PaArgument paArgs[] =
{ "-ngsiv1Autocast", &ngsiv1Autocast, "NGSIV1_AUTOCAST", PaBool, PaOpt, false, false, true, NGSIV1_AUTOCAST },
{ "-ctxTimeout", &contextDownloadTimeout, "CONTEXT_DOWNLOAD_TIMEOUT", PaInt, PaOpt, 5000, 0, 20000, CTX_TMO_DESC },
{ "-ctxAttempts", &contextDownloadAttempts, "CONTEXT_DOWNLOAD_ATTEMPTS", PaInt, PaOpt, 3, 0, 100, CTX_ATT_DESC },
{ "-pernot", &pernot, "PERNOT", PaBool, PaOpt, false, false, true, PERNOT_DESC },
{ "-troe", &troe, "TROE", PaBool, PaOpt, false, false, true, TROE_DESC },
{ "-lmtmp", &lmtmp, "TMP_TRACES", PaBool, PaHid, true, false, true, TMPTRACES_DESC },
{ "-socketService", &socketService, "SOCKET_SERVICE", PaBool, PaHid, false, false, true, SOCKET_SERVICE_DESC },
{ "-troeHost", troeHost, "TROE_HOST", PaString, PaOpt, _i "localhost", PaNL, PaNL, TROE_HOST_DESC },
{ "-troePort", &troePort, "TROE_PORT", PaInt, PaOpt, 5432, PaNL, PaNL, TROE_PORT_DESC },
{ "-troeUser", troeUser, "TROE_USER", PaString, PaOpt, _i "postgres", PaNL, PaNL, TROE_HOST_USER },
{ "-troePwd", troePwd, "TROE_PWD", PaString, PaOpt, _i "password", PaNL, PaNL, TROE_HOST_PWD },
{ "-troePoolSize", &troePoolSize, "TROE_POOL_SIZE", PaInt, PaOpt, 10, 0, 1000, TROE_POOL_DESC },
{ "-ssPort", &socketServicePort, "SOCKET_SERVICE_PORT", PaUShort, PaHid, 1027, PaNL, PaNL, SOCKET_SERVICE_PORT_DESC },
{ "-forwarding", &distributed, "FORWARDING", PaBool, PaHid, false, false, true, FORWARDING_DESC },
{ "-distributed", &distributed, "DISTRIBUTED", PaBool, PaOpt, false, false, true, DISTRIBUTED_DESC },
{ "-noNotifyFalseUpdate", &noNotifyFalseUpdate, "NO_NOTIFY_FALSE_UPDATE", PaBool, PaOpt, false, false, true, NO_NOTIFY_FALSE_UPDATE_DESC },
{ "-triggerOperation", &triggerOperation, "TRIGGER_OPERATION", PaBool, PaHid, false, false, true, TRIGGER_OPERATION_DESC },
{ "-experimental", &experimental, "EXPERIMENTAL", PaBool, PaOpt, false, false, true, EXPERIMENTAL_DESC },
{ "-mongocOnly", &mongocOnly, "MONGOCONLY", PaBool, PaOpt, false, false, true, MONGOCONLY_DESC },
{ "-cSubCounters", &cSubCounters, "CSUB_COUNTERS", PaInt, PaOpt, 20, 0, PaNL, CSUBCOUNTERS_DESC },
{ "-forwarding", &distributed, "FORWARDING", PaBool, PaHid, false, false, true, FORWARDING_DESC },
{ "-socketService", &socketService, "SOCKET_SERVICE", PaBool, PaHid, false, false, true, SOCKET_SERVICE_DESC },
{ "-ssPort", &socketServicePort, "SOCKET_SERVICE_PORT", PaUShort, PaHid, 1027, PaNL, PaNL, SOCKET_SERVICE_PORT_DESC },
{ "-harakiri", &harakiri, "HARAKIRI", PaBool, PaHid, false, false, true, HARAKIRI_DESC },
{ "-idIndex", &idIndex, "MONGO_ID_INDEX", PaBool, PaHid, false, false, true, ID_INDEX_DESC },
{ "-noswap", &noswap, "NOSWAP", PaBool, PaHid, false, false, true, NOSWAP_DESC },
{ "-lmtmp", &lmtmp, "TMP_TRACES", PaBool, PaHid, true, false, true, TMPTRACES_DESC },
{ "-debugCurl", &debugCurl, "DEBUG_CURL", PaBool, PaHid, false, false, true, DEBUG_CURL_DESC },
{ "-lmtmp", &lmtmp, "TMP_TRACES", PaBool, PaHid, true, false, true, TMPTRACES_DESC },

PA_END_OF_ARGS
};
Expand Down Expand Up @@ -1193,6 +1205,9 @@ int main(int argC, char* argV[])
//
regCacheInit();

if (pernot == true)
pernotSubCacheInit();

orionldServiceInit(restServiceVV, 9);

if (mongocOnly == false)
Expand All @@ -1201,7 +1216,7 @@ int main(int argC, char* argV[])
mongoInit(dbHost, rplSet, dbName, dbUser, dbPwd, multitenancy, dbTimeout, writeConcern, dbPoolSize, statSemWait);
}

// Initialize orion libs
// Initialize libs
alarmMgr.init(relogAlarms);
metricsMgr.init(!disableMetrics, statSemWait);
logSummaryInit(&lsPeriod);
Expand Down Expand Up @@ -1342,6 +1357,10 @@ int main(int argC, char* argV[])
kaBufferReset(&orionldState.kalloc, KFALSE);


// Start the thread for periodic notifications
if (pernot == true)
pernotLoopStart();

if (socketService == true)
{
int fd;
Expand Down
Loading

0 comments on commit bf11d4a

Please sign in to comment.