From e3d7d788eb1c211690c65a50625eaa0ec02504b7 Mon Sep 17 00:00:00 2001 From: Emilio Cuesta Date: Tue, 29 Jul 2025 08:50:06 +0200 Subject: [PATCH 1/4] Freezing .repos file and other 3.3.0 dependencies Signed-off-by: Emilio Cuesta --- ddsrouter.repos | 10 +++++----- .../resources/use_cases/ros_cloud/Dockerfile_ddsrouter | 2 +- .../use_cases/ros_cloud/Dockerfile_ddsrouter_logon | 2 +- .../developer_manual/installation/sources/linux.rst | 4 ++-- .../developer_manual/installation/sources/windows.rst | 4 ++-- docs/rst/use_cases/ros_cloud.rst | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ddsrouter.repos b/ddsrouter.repos index 233279a98..16fde2dd8 100644 --- a/ddsrouter.repos +++ b/ddsrouter.repos @@ -6,20 +6,20 @@ repositories: fastcdr: type: git url: https://github.com/eProsima/Fast-CDR.git - version: 2.x + version: 2.3.0 fastdds: type: git url: https://github.com/eProsima/Fast-DDS.git - version: 3.x + version: 3.3.0 dev-utils: type: git url: https://github.com/eProsima/dev-utils.git - version: 1.x + version: 1.3.0 ddspipe: type: git url: https://github.com/eProsima/DDS-Pipe.git - version: 1.x + version: 1.3.0 ddsrouter: type: git url: https://github.com/eProsima/DDS-Router.git - version: main + version: 3.3.0 diff --git a/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter b/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter index 43b70d967..2062637ff 100644 --- a/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter +++ b/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y \ # Download and build DDS-Router RUN mkdir resources && \ - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos && \ + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos && \ mkdir src && \ vcs import src < ddsrouter.repos && \ colcon build --event-handlers=console_direct+ diff --git a/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter_logon b/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter_logon index f2e4d8a75..8b0002fe4 100644 --- a/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter_logon +++ b/docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter_logon @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y \ # Download and build DDS-Router RUN mkdir resources && \ - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos && \ + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos && \ mkdir src && \ vcs import src < ddsrouter.repos && \ colcon build --event-handlers=console_direct+ --cmake-args -DLOG_INFO=ON diff --git a/docs/rst/developer_manual/installation/sources/linux.rst b/docs/rst/developer_manual/installation/sources/linux.rst index f85fdc8a1..e40c4e3a6 100644 --- a/docs/rst/developer_manual/installation/sources/linux.rst +++ b/docs/rst/developer_manual/installation/sources/linux.rst @@ -214,7 +214,7 @@ Colcon installation mkdir -p ~/DDS-Router/src cd ~/DDS-Router - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos vcs import src < ddsrouter.repos .. note:: @@ -258,7 +258,7 @@ Local installation mkdir -p ~/DDS-Router/src mkdir -p ~/DDS-Router/build cd ~/DDS-Router - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos vcs import src < ddsrouter.repos #. Compile all dependencies using CMake_. diff --git a/docs/rst/developer_manual/installation/sources/windows.rst b/docs/rst/developer_manual/installation/sources/windows.rst index 984cbe762..55caa749c 100644 --- a/docs/rst/developer_manual/installation/sources/windows.rst +++ b/docs/rst/developer_manual/installation/sources/windows.rst @@ -257,7 +257,7 @@ Colcon installation mkdir \DDS-Router cd \DDS-Router mkdir src - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos vcs import src --input ddsrouter.repos .. note:: @@ -309,7 +309,7 @@ Local installation mkdir \DDS-Router\src mkdir \DDS-Router\build cd \DDS-Router - wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos + wget https://raw.githubusercontent.com/eProsima/DDS-Router/v3.3.0/ddsrouter.repos vcs import src --input ddsrouter.repos #. Compile all dependencies using CMake_. diff --git a/docs/rst/use_cases/ros_cloud.rst b/docs/rst/use_cases/ros_cloud.rst index cc43663e1..e0eb173e8 100644 --- a/docs/rst/use_cases/ros_cloud.rst +++ b/docs/rst/use_cases/ros_cloud.rst @@ -124,7 +124,7 @@ the previously set up ConfigMap. This Docker image needs to be built and made av |ddsrouter|, which can be accomplished by providing the following :download:`Dockerfile <../../resources/use_cases/ros_cloud/Dockerfile_ddsrouter>`. If willing to see log messages in ``STDOUT``, use :download:`Dockerfile <../../resources/use_cases/ros_cloud/Dockerfile_ddsrouter_logon>` instead. -Assuming the name of the generated Docker image is ``ddsrouter:main``, the cloud router will then be deployed with the +Assuming the name of the generated Docker image is ``ddsrouter:v3.3.0``, the cloud router will then be deployed with the following settings: .. literalinclude:: ../../resources/use_cases/ros_cloud/ddsrouter.yaml From 7adaeba5583499cd0c992d2f80d57eefe3da5238 Mon Sep 17 00:00:00 2001 From: Emilio Cuesta Date: Tue, 29 Jul 2025 09:05:09 +0200 Subject: [PATCH 2/4] Adding missing v in .repos Signed-off-by: Emilio Cuesta --- ddsrouter.repos | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ddsrouter.repos b/ddsrouter.repos index 16fde2dd8..4f58ff34c 100644 --- a/ddsrouter.repos +++ b/ddsrouter.repos @@ -6,20 +6,20 @@ repositories: fastcdr: type: git url: https://github.com/eProsima/Fast-CDR.git - version: 2.3.0 + version: v2.3.0 fastdds: type: git url: https://github.com/eProsima/Fast-DDS.git - version: 3.3.0 + version: v3.3.0 dev-utils: type: git url: https://github.com/eProsima/dev-utils.git - version: 1.3.0 + version: v1.3.0 ddspipe: type: git url: https://github.com/eProsima/DDS-Pipe.git - version: 1.3.0 + version: v1.3.0 ddsrouter: type: git url: https://github.com/eProsima/DDS-Router.git - version: 3.3.0 + version: v3.3.0 From 7f00d835bd332e15a8f0be82af213a2c67404e81 Mon Sep 17 00:00:00 2001 From: Emilio Cuesta Date: Wed, 6 Aug 2025 12:51:31 +0200 Subject: [PATCH 3/4] Refs 23573 Adding tests for original writer parameter Signed-off-by: Emilio Cuesta --- .../ddsrouter_core/dds/local/DDSTestLocal.cpp | 72 +++++++++++++++++++ .../dds/types/test_participants.hpp | 27 +++++++ 2 files changed, 99 insertions(+) diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp index 7b54503f5..237f9ad83 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp @@ -206,6 +206,65 @@ void test_local_communication( router.stop(); } +template +void test_original_writer_forwarding( + DdsRouterConfiguration ddsrouter_configuration) +{ + INSTANTIATE_LOG_TESTER(eprosima::utils::Log::Kind::Error, 0, 0); + + uint32_t samples_sent = 0; + std::atomic samples_received(0); + std::atomic samples_to_receive(1); + + MsgStruct sent_msg; + MsgStruct recv_msg; + MsgStructType type; + std::string msg_str; + msg_str += "Testing DdsRouter Blackbox Local Communication ..."; + sent_msg.message(msg_str); + // Create DDS Publisher in domain 0 + TestPublisher publisher(type.is_compute_key_provided); + + ASSERT_TRUE(publisher.init(0)); + + // Create DDS Subscriber in domain 1 + TestSubscriber subscriber(type.is_compute_key_provided); + ASSERT_TRUE(subscriber.init(1, &recv_msg, &samples_received)); + + // Create DdsRouter entity + DdsRouter router(ddsrouter_configuration); + router.start(); + + // CASE 1: Send message without original_writer_param, should be set to writers guid + sent_msg.index(samples_sent); + ASSERT_EQ(publisher.publish(sent_msg), eprosima::fastdds::dds::RETCODE_OK); + // Watiting for the message to be received + while(samples_received.load() < 1){}; + ASSERT_EQ(subscriber.original_writer_guid(), publisher.original_writer_guid()); + + // CASE 2: Send message with original_writer_param set to unknown, should be set to other value + sent_msg.index(samples_sent); + eprosima::fastdds::rtps::WriteParams params; + params.original_writer_guid(eprosima::fastdds::rtps::GUID_t::unknown()); + ASSERT_EQ(publisher.publish_with_params(sent_msg, params), eprosima::fastdds::dds::RETCODE_OK); + // Watiting for the message to be received + while(samples_received.load() < 2){}; + ASSERT_EQ(subscriber.original_writer_guid(), publisher.original_writer_guid()); + + // CASE 3: Send message with original_writer_param set to some value, value must be kept + sent_msg.index(samples_sent); + eprosima::fastdds::rtps::WriteParams params_with_og_writer; + eprosima::fastdds::rtps::GUID_t guid({}, 0x12345678); + params_with_og_writer.original_writer_guid(guid); + ASSERT_EQ(publisher.publish_with_params(sent_msg, params_with_og_writer), eprosima::fastdds::dds::RETCODE_OK); + // Watiting for the message to be received + while(samples_received.load() < 2){}; + ASSERT_EQ(subscriber.original_writer_guid(), guid); + + router.stop(); +} + + } /* namespace test */ /** @@ -322,6 +381,19 @@ TEST(DDSTestLocal, end_to_end_local_communication_transient_local_disable_dynami true); } + +/** + * Test original writer forwarding in HelloWorld topic between two DDS participants created in different domains, + * by using a router with two Simple Participants at each domain. + */ +TEST(DDSTestLocal, end_to_end_local_communication_original_writer_forwarding) +{ + test::test_original_writer_forwarding( + test::dds_test_simple_configuration()); +} + + + int main( int argc, char** argv) diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp index 7a1dba444..24e818314 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp @@ -152,6 +152,17 @@ class TestPublisher return writer_->write(&hello_); } + //! Publish a sample with parameters + eprosima::fastdds::dds::ReturnCode_t publish_with_params( + MsgStruct msg, eprosima::fastdds::rtps::WriteParams params) + { + hello_.index(msg.index()); + hello_.message(msg.message()); + + + return writer_->write(&hello_, params); + } + //! Dispose instance eprosima::fastdds::dds::ReturnCode_t dispose_key( MsgStruct msg); @@ -162,6 +173,11 @@ class TestPublisher listener_.wait_discovery(n_subscribers); } + eprosima::fastdds::rtps::GUID_t original_writer_guid() const + { + return writer_->guid(); + } + private: MsgStruct hello_; @@ -213,6 +229,7 @@ class TestPublisher } } + private: //! Number of DataReaders discovered @@ -357,6 +374,11 @@ class TestSubscriber return listener_.n_key_disposed; } + eprosima::fastdds::rtps::GUID_t original_writer_guid() const + { + return listener_.original_writer_guid; + } + private: eprosima::fastdds::dds::DomainParticipant* participant_; @@ -424,6 +446,8 @@ class TestSubscriber { n_key_disposed++; } + + original_writer_guid = iHandle2GUID(info.original_publication_handle); } } @@ -445,6 +469,9 @@ class TestSubscriber //! Placeholder where received data is stored MsgStruct msg_received; + //! Placeholder where original writer GUID is stored + eprosima::fastdds::rtps::GUID_t original_writer_guid; + std::atomic n_key_disposed; //! Reference to the sample sent by the publisher From 861f27e128e0a0378876030ad96d5f91a698908e Mon Sep 17 00:00:00 2001 From: Emilio Cuesta Date: Wed, 6 Aug 2025 13:25:59 +0200 Subject: [PATCH 4/4] Uncrustify Signed-off-by: Emilio Cuesta --- .../ddsrouter_core/dds/local/DDSTestLocal.cpp | 16 +++++++++++----- .../dds/types/test_participants.hpp | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp index 237f9ad83..6333079ff 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/local/DDSTestLocal.cpp @@ -83,7 +83,8 @@ DdsRouterConfiguration dds_test_simple_configuration( topic_keyed.type_name = "HelloWorldKeyed"; topic_keyed.topic_qos.keyed = true; - conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable::make_heritable(topic)); + conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable::make_heritable( + topic)); conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable::make_heritable( topic_keyed)); } @@ -239,7 +240,9 @@ void test_original_writer_forwarding( sent_msg.index(samples_sent); ASSERT_EQ(publisher.publish(sent_msg), eprosima::fastdds::dds::RETCODE_OK); // Watiting for the message to be received - while(samples_received.load() < 1){}; + while (samples_received.load() < 1) + { + } ASSERT_EQ(subscriber.original_writer_guid(), publisher.original_writer_guid()); // CASE 2: Send message with original_writer_param set to unknown, should be set to other value @@ -248,7 +251,9 @@ void test_original_writer_forwarding( params.original_writer_guid(eprosima::fastdds::rtps::GUID_t::unknown()); ASSERT_EQ(publisher.publish_with_params(sent_msg, params), eprosima::fastdds::dds::RETCODE_OK); // Watiting for the message to be received - while(samples_received.load() < 2){}; + while (samples_received.load() < 2) + { + } ASSERT_EQ(subscriber.original_writer_guid(), publisher.original_writer_guid()); // CASE 3: Send message with original_writer_param set to some value, value must be kept @@ -258,13 +263,14 @@ void test_original_writer_forwarding( params_with_og_writer.original_writer_guid(guid); ASSERT_EQ(publisher.publish_with_params(sent_msg, params_with_og_writer), eprosima::fastdds::dds::RETCODE_OK); // Watiting for the message to be received - while(samples_received.load() < 2){}; + while (samples_received.load() < 2) + { + } ASSERT_EQ(subscriber.original_writer_guid(), guid); router.stop(); } - } /* namespace test */ /** diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp index 24e818314..267e784ed 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp @@ -154,7 +154,8 @@ class TestPublisher //! Publish a sample with parameters eprosima::fastdds::dds::ReturnCode_t publish_with_params( - MsgStruct msg, eprosima::fastdds::rtps::WriteParams params) + MsgStruct msg, + eprosima::fastdds::rtps::WriteParams params) { hello_.index(msg.index()); hello_.message(msg.message()); @@ -229,7 +230,6 @@ class TestPublisher } } - private: //! Number of DataReaders discovered