Skip to content

Commit

Permalink
Merge pull request #1695 from FIWARE/merge/dds
Browse files Browse the repository at this point in the history
Merge/dds
  • Loading branch information
kzangeli authored Oct 15, 2024
2 parents 659de32 + d6ad0a5 commit e6e7387
Show file tree
Hide file tree
Showing 140 changed files with 11,401 additions and 220 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#1688: Forward of idPattern URL parameter

## New Features:
* Native support for DDS (off by default - to activate use CLI: -wip dds)
* Distributed subscriptions: subordinate subscriptions are DELETED when their "father" is deleted.
* Support for the URL parameter 'csf' in GET /ngsi-ld/v1/csourceRegistrations
* Support for the URL parameter 'orderBy' (must be an attribute) in GET /ngsi-ld/v1/entities, but only if 'local' is set. (This is not NGSI-LD standard. Yet ...)
Expand Down
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ add_definitions(-DLM_ON)
add_definitions(-DORIONLD)

add_definitions(-fPIC)
add_definitions(-std=c++11)
add_definitions(-std=c++17)
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)

# Baseline compiler flags, any change here will affect all build types
Expand Down Expand Up @@ -201,6 +201,7 @@ SET (ORION_LIBS
orionld_troe
orionld_kjTree
orionld_mqtt
orionld_dds
orionld_http
orionld_context
orionld_common
Expand Down Expand Up @@ -265,11 +266,18 @@ SET (COMMON_STATIC_LIBS
mongoclient.a
kjson.a
khash.a
ktrace.a
kargs.a
kalloc.a
kbase.a
)

SET (DYNAMIC_LIBS
fastdds
fastcdr
foonathan_memory-0.7.3
ddsenabler
tinyxml2
prom
promhttp
curl
Expand Down Expand Up @@ -328,6 +336,8 @@ link_directories("${PROJECT_SOURCE_DIR}/../kjson")
link_directories("${PROJECT_SOURCE_DIR}/../kalloc")
link_directories("${PROJECT_SOURCE_DIR}/../kbase")
link_directories("${PROJECT_SOURCE_DIR}/../khash")
link_directories("${PROJECT_SOURCE_DIR}/../ktrace")
link_directories("${PROJECT_SOURCE_DIR}/../kargs")
link_directories("${PROJECT_SOURCE_DIR}/../prometheus-client-c/prom/build")
link_directories("${PROJECT_SOURCE_DIR}/../prometheus-client-c/promhttp/build")
link_directories("${LIBMONGOC_LIBRARY_DIRS}")
Expand Down Expand Up @@ -390,6 +400,7 @@ if (error EQUAL 0)
ADD_SUBDIRECTORY(src/lib/orionld/mongoc)
ADD_SUBDIRECTORY(src/lib/orionld/payloadCheck)
ADD_SUBDIRECTORY(src/lib/orionld/mqtt)
ADD_SUBDIRECTORY(src/lib/orionld/dds)
ADD_SUBDIRECTORY(src/lib/orionld/http)
ADD_SUBDIRECTORY(src/lib/orionld/prometheus)
ADD_SUBDIRECTORY(src/lib/orionld/legacyDriver)
Expand All @@ -399,6 +410,7 @@ if (error EQUAL 0)
ADD_SUBDIRECTORY(src/lib/metricsMgr)
ADD_SUBDIRECTORY(src/lib/logSummary)
ADD_SUBDIRECTORY(src/app/orionld)
ADD_SUBDIRECTORY(test/functionalTest/ftClient)
else ()
MESSAGE("cmake: NOT OK")
endif (error EQUAL 0)
28 changes: 28 additions & 0 deletions config/DDS_ENABLER_CONFIGURATION.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# DDS configuration
dds:
# Domain ID
domain: 0

# Allowed topics
allowlist:
- name: "*"

# Blocked topics
blocklist:
- name: "add_blocked_topics_list_here"

topics:
name: "*"
qos:
durability: TRANSIENT_LOCAL
history-depth: 5

# DDS Enabler configuration
ddsenabler:

#Specs configuration
specs:
threads: 12
logging:
stdout: false
verbosity: info
113 changes: 97 additions & 16 deletions docker/build-ubi/04.install-fastdds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,131 @@

dnf config-manager --set-enabled powertools

yum -y install tinyxml2-devel boost-devel
yum -y install tinyxml2-devel boost-devel yaml-cpp-devel yaml-cpp
yum -y --nogpgcheck install https://dl.fedoraproject.org/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/a/asio-devel-1.28.1-2.fc39.x86_64.rpm

# Fast-DDS
mkdir /opt/Fast-DDS
cd /opt/Fast-DDS

#
# foonathan_memory_vendor
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/foonathan_memory_vendor.git
mkdir foonathan_memory_vendor/build
cd foonathan_memory_vendor
git checkout v1.3.1
git checkout master
mkdir build
cd build

cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON
cmake --build . --target install


#
# CDR
# Fast-CDR
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/Fast-CDR.git
mkdir Fast-CDR/build
cd Fast-CDR
git checkout v2.1.3
git checkout master
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
cmake ..
cmake --build . --target install


#
# RTPS
# Fast-DDS
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/Fast-DDS.git
cd Fast-DDS
git checkout v2.13.3
git checkout master
mkdir build
cd build

## Prevent glibc bug: https://stackoverflow.com/questions/30680550/c-gettid-was-not-declared-in-this-scope
file_bug="/opt/Fast-DDS/Fast-DDS/src/cpp/utils/threading/threading_pthread.ipp"
nl=$(grep -n "namespace eprosima" $file_bug | awk -F':' '{print $1 ; exit 0}')
sed -i "${nl}i #include <unistd.h>\n#include <sys/syscall.h>\n#define gettid() syscall(SYS_gettid)\n" $file_bug
# Seems to be fixed already manually by eProsima
# file_bug="/opt/Fast-DDS/Fast-DDS/src/cpp/utils/threading/threading_pthread.ipp"
# nl=$(grep -n "namespace eprosima" $file_bug | awk -F':' '{print $1 ; exit 0}')
# sed -i "${nl}i #include <unistd.h>\n#include <sys/syscall.h>\n#define gettid() syscall(SYS_gettid)\n" $file_bug

cmake ..
cmake --build . --target install


#
# DDS Dev Utils (2 packages in one)
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/dev-utils.git
cd dev-utils
git checkout main

mkdir -p build/cmake_utils
cd build/cmake_utils
cmake ../../cmake_utils
cmake --build . --target install

cd -
mkdir -p build/cpp_utils
cd build/cpp_utils
cmake ../../cpp_utils
cmake --build . --target install


#
# DDS Pipe (3 packages in one)
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/DDS-Pipe.git
cd DDS-Pipe
git checkout main


cd ddspipe_core
mkdir build
cd build
cmake ..
cmake --build . --target install

cd ../../ddspipe_participants
mkdir build
cd build
cmake ..
cmake --build . --target install

cd ../../ddspipe_yaml
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
cmake ..
cmake --build . --target install


#
# DDS Enabler
#
cd /opt/Fast-DDS
git clone https://github.com/eProsima/FIWARE-DDS-Enabler.git
cd FIWARE-DDS-Enabler
git fetch -a
git checkout feature/json_config
yum -y install lz4-devel libzstd-devel

# ./install_dds_module.sh

mkdir -p build/ddsenabler_participants
cd build/ddsenabler_participants
cmake ../../ddsenabler_participants
cmake --build . --target install
cd ../..

mkdir -p build/ddsenabler_yaml
cd build/ddsenabler_yaml
cmake ../../ddsenabler_yaml
cmake --build . --target install
cd ../..

mkdir -p build/ddsenabler
cd build/ddsenabler
cmake ../../ddsenabler
cmake --build . --target install
19 changes: 19 additions & 0 deletions etc/config/ftClient
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of Orion Context Broker.
#
# Orion Context Broker is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Orion Context Broker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
#
# For those usages not covered by this license please contact with
# iot_support at tid dot es
Empty file added etc/init.d/ftClient.ubuntu
Empty file.
16 changes: 13 additions & 3 deletions scripts/check_files_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def ignore(root, file):
if 'BUILD_' in root or '.git' in root:
return True

if file.endswith('.yaml') or file.endswith('.hpp') or file.endswith('.cxx') or file.endswith('.ipp'):
return True

if 'ldcontext' in root:
return True

Expand Down Expand Up @@ -184,7 +187,7 @@ def ignore(root, file):
return True

# Apib files have an "inline" license, so they are ignored
extensions_to_ignore = ['apib', 'md']
extensions_to_ignore = ['apib', 'md', 'idl']
if os.path.splitext(file)[1][1:] in extensions_to_ignore:
return True

Expand All @@ -203,7 +206,7 @@ def ignore(root, file):
# Particular cases of files that are also ignored
files_names = ['.gitignore', '.valgrindrc', '.valgrindSuppressions', 'LICENSE', '.readthedocs.yml',
'ContributionPolicy.txt', 'CHANGES_NEXT_RELEASE', 'compileInfo.h',
'unittests_that_fail_sporadically.txt', 'Vagrantfile', 'contextBroker.ubuntu', 'orionld.ubuntu',
'unittests_that_fail_sporadically.txt', 'Vagrantfile', 'contextBroker.ubuntu', 'orionld.ubuntu', 'ftClient.ubuntu',
'mkdocs.yml', 'fiware-ngsiv2-reference.errata', 'ServiceRoutines.txt', '.travis.yml',
'.dockerignore', '.jmeter.json']

Expand Down Expand Up @@ -231,7 +234,7 @@ def supported_extension(root, file):
:return:
"""
extensions = ['py', 'cpp', 'c', 'h', 'xml', 'json', 'test', 'vtest', 'txt', 'sh', 'spec', 'cfg', 'DISABLED',
'xtest', 'centos', 'js', 'jmx', 'vtestx', 'feature', 'go', 'jsonld', 'supp']
'xtest', 'centos', 'js', 'jmx', 'vtestx', 'feature', 'go', 'jsonld', 'supp', 'cxx', 'ipp', 'hpp', 'idl']
names = ['makefile', 'Makefile', 'CMakeLists.txt.orion', 'CMakeLists.txt.orionld']

# Check extensions
Expand All @@ -249,6 +252,9 @@ def supported_extension(root, file):
if 'config' in root and file == 'orionld':
return True

if 'config' in root and file == 'ftClient':
return True

filename = os.path.join(root, file)
print('not supported extension: {filename}'.format(filename=filename))
return False
Expand Down Expand Up @@ -288,10 +294,14 @@ def supported_extension(root, file):
is_orionld = True
elif 'src/app/ssClient/' in filename:
is_orionld = True
elif 'test/functionalTest/ftClient/' in filename:
is_orionld = True
elif 'test/functionalTest/cases/0000_ngsild' in filename:
is_orionld = True
elif 'test/functionalTest/cases/0000_troe' in filename:
is_orionld = True
elif 'test/functionalTest/cases/0000_dds' in filename:
is_orionld = True
elif 'test/unittests/orionld' in filename:
is_orionld = True
elif 'test/stress' in filename:
Expand Down
Loading

0 comments on commit e6e7387

Please sign in to comment.