Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ddsrouter.repos
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ repositories:
fastcdr:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: 2.x
version: v2.3.0
fastdds:
type: git
url: https://github.com/eProsima/Fast-DDS.git
version: 3.x
version: v3.3.0
dev-utils:
type: git
url: https://github.com/eProsima/dev-utils.git
version: 1.x
version: v1.3.0
ddspipe:
type: git
url: https://github.com/eProsima/DDS-Pipe.git
version: 1.x
version: v1.3.0
ddsrouter:
type: git
url: https://github.com/eProsima/DDS-Router.git
version: main
version: v3.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -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<core::types::DdsTopic>::make_heritable(topic));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(
topic));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(
topic_keyed));
}
Expand Down Expand Up @@ -206,6 +207,70 @@ void test_local_communication(
router.stop();
}

template <class MsgStruct, class MsgStructType>
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<uint32_t> samples_received(0);
std::atomic<uint32_t> 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<MsgStruct> publisher(type.is_compute_key_provided);

ASSERT_TRUE(publisher.init(0));

// Create DDS Subscriber in domain 1
TestSubscriber<MsgStruct> 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 */

/**
Expand Down Expand Up @@ -322,6 +387,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<HelloWorld, HelloWorldPubSubType>(
test::dds_test_simple_configuration());
}



int main(
int argc,
char** argv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ 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);
Expand All @@ -162,6 +174,11 @@ class TestPublisher
listener_.wait_discovery(n_subscribers);
}

eprosima::fastdds::rtps::GUID_t original_writer_guid() const
{
return writer_->guid();
}

private:

MsgStruct hello_;
Expand Down Expand Up @@ -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_;
Expand Down Expand Up @@ -424,6 +446,8 @@ class TestSubscriber
{
n_key_disposed++;
}

original_writer_guid = iHandle2GUID(info.original_publication_handle);
}
}

Expand All @@ -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<std::uint32_t> n_key_disposed;

//! Reference to the sample sent by the publisher
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/use_cases/ros_cloud/Dockerfile_ddsrouter
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/rst/developer_manual/installation/sources/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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_.
Expand Down
4 changes: 2 additions & 2 deletions docs/rst/developer_manual/installation/sources/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Colcon installation
mkdir <path\to\user\workspace>\DDS-Router
cd <path\to\user\workspace>\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::
Expand Down Expand Up @@ -309,7 +309,7 @@ Local installation
mkdir <path\to\user\workspace>\DDS-Router\src
mkdir <path\to\user\workspace>\DDS-Router\build
cd <path\to\user\workspace>\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_.
Expand Down
2 changes: 1 addition & 1 deletion docs/rst/use_cases/ros_cloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading