Skip to content

Commit

Permalink
Transform locators using new host_id PID (#107)
Browse files Browse the repository at this point in the history
* Refs #22056: Typo in comment

Signed-off-by: cferreiragonz <[email protected]>

* Refs #22056: TCP-DS host_id test

Signed-off-by: cferreiragonz <[email protected]>

---------

Signed-off-by: cferreiragonz <[email protected]>
(cherry picked from commit 5777caa)

# Conflicts:
#	test/CMakeLists.txt
#	test/configuration/test_cases/test_95_tcpv4_cli.xml
#	test/configuration/test_cases/test_96_tcpv6_cli.xml
#	test/configuration/test_cases/test_97_tcpv4_env_var.xml
#	test/configuration/test_cases/test_98_tcpv6_env_var.xml
  • Loading branch information
cferreiragonz authored and mergify[bot] committed Nov 18, 2024
1 parent 26d6a82 commit b4e7132
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ list(APPEND TEST_LIST

test_60_disconnection
test_61_superclient_environment_variable
<<<<<<< HEAD
=======

test_94_tcpv4_custom_guid_transform_locators
test_95_tcpv4_cli
test_96_tcpv6_cli
test_97_tcpv4_env_var
test_98_tcpv6_env_var
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
test_99_tcp
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<!-- When a DS with a custom GUID (-i param of CLI) listens on any (0.0.0.0) and the clients use
localhost (127.0.0.1) to connect to the server, the GUID comparison is insufficient to
correctly transform the server's locator when it is received by the client. A more reliable
method is required to check if the server's locator is from the same host as the client.
This test is a regression from #22006.-->

<clients>
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
<subscriber topic="topic1"/>
</client>
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
<publisher topic="topic1"/>
</client>
</clients>

<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
<snapshot time="5">Knows all</snapshot>
</snapshots>

<profiles>

<transport_descriptors>
<transport_descriptor>
<transport_id>transport_client_1</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
<transport_descriptor>
<transport_id>transport_client_2</transport_id>
<type>TCPv4</type>
<listening_ports>
<port>0</port>
</listening_ports>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="TCPv4_client_1" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_1</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

<participant profile_name="TCPv4_client_2" is_default_profile="true">
<rtps>
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
<useBuiltinTransports>false</useBuiltinTransports>
<userTransports>
<transport_id>transport_client_2</transport_id>
</userTransports>
<builtin>
<discovery_config>
<discoveryProtocol>CLIENT</discoveryProtocol>
<discoveryServersList>
<locator>
<tcpv4>
<address>127.0.0.1</address>
<physical_port>42200</physical_port>
<port>42200</port>
</tcpv4>
</locator>
</discoveryServersList>
</discovery_config>
</builtin>
</rtps>
</participant>

<topic profile_name="topic1">
<name>topic_1</name>
<dataType>HelloWorld</dataType>
</topic>

</profiles>

</DS>
10 changes: 10 additions & 0 deletions test/configuration/test_cases/test_95_tcpv4_cli.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<<<<<<< HEAD
=======
<!-- In order to avoid extra channel connections between TCP participants
we will use the whitelist to force the clients to send their locators
with localhost. Otherwise, the server would not reuse the initial
channel created and it might cause a failure in the connection,
depending on the value of the random logical port assigned.
This could be avoided by using default GUIDs. -->

>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
<clients>
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
<subscriber topic="topic1"/>
Expand Down
10 changes: 10 additions & 0 deletions test/configuration/test_cases/test_96_tcpv6_cli.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<<<<<<< HEAD
=======
<!-- In order to avoid extra channel connections between TCP participants
we will use the whitelist to force the clients to send their locators
with localhost. Otherwise, the server would not reuse the initial
channel created and it might cause a failure in the connection,
depending on the value of the random logical port assigned.
This could be avoided by using default GUIDs. -->

>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
<clients>
<client name="client1" profile_name="TCPv6_client_1" listening_port="0">
<subscriber topic="topic1"/>
Expand Down
10 changes: 10 additions & 0 deletions test/configuration/test_cases/test_97_tcpv4_env_var.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<<<<<<< HEAD
=======
<!-- In order to avoid extra channel connections between TCP participants
we will use the whitelist to force the clients to send their locators
with localhost. Otherwise, the server would not reuse the initial
channel created and it might cause a failure in the connection,
depending on the value of the random logical port assigned.
This could be avoided by using default GUIDs. -->

>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
<servers>
<server name="server" profile_name="TCPv4_server"/>
</servers>
Expand Down
10 changes: 10 additions & 0 deletions test/configuration/test_cases/test_98_tcpv6_env_var.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">

<<<<<<< HEAD
=======
<!-- In order to avoid extra channel connections between TCP participants
we will use the whitelist to force the clients to send their locators
with localhost. Otherwise, the server would not reuse the initial
channel created and it might cause a failure in the connection,
depending on the value of the random logical port assigned.
This could be avoided by using default GUIDs. -->

>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
<servers>
<server name="server" profile_name="TCPv6_server"/>
</servers>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<DS_Snapshots xmlns="http://www.eprosima.com/XMLSchemas/ds-snapshot">
<DS_Snapshot timestamp="1701424362042" process_time="5000" last_pdp_callback_time="620" last_edp_callback_time="1067" someone="true">
<description>Knows all</description>
<ptdb guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="339"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="125">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="125"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client2" discovered_timestamp="620">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="1067"/>
</ptdi>
</ptdb>
<ptdb guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
<ptdi guid_prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41" guid_entity="0.0.1.c1" server="false" alive="true" name="eProsima Default Server number 0" discovered_timestamp="489"/>
<ptdi guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="client1" discovered_timestamp="615">
<subscriber type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.4" discovered_timestamp="1067"/>
</ptdi>
<ptdi guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1" server="false" alive="true" name="" discovered_timestamp="233">
<publisher type="HelloWorld" topic="topic_1" guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.3" discovered_timestamp="233"/>
</ptdi>
</ptdb>
</DS_Snapshot>
</DS_Snapshots>
58 changes: 58 additions & 0 deletions test/configuration/tests_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -2271,6 +2271,64 @@
}
},

"test_94_tcpv4_custom_guid_transform_locators":
{
"description": [
"Test that a TCP discovery server with a custom GUID (-i CLI param) and listening on any (0.0.0.0)\n",
"is able to communicate with a client that connects to localhost (127.0.0.1).\n",
"This test is a regression from #22006"
],

"processes":
{
"main":
{
"xml_config_file": "<CONFIG_RELATIVE_PATH>/test_cases/test_94_tcpv4_custom_guid_transform_locators.xml",
"validation":
{
"exit_code_validation":
{
"expected_exit_code": 0
},
"stderr_validation":
{
"err_expected_lines": 0
},
"count_lines_validation":
{
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
},
"ground_truth_validation":
{
"guidless": false,
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
}
}
},
"fastddstool":
{
"kill_time": 6,
"tool_config":
{
"id" : 0,
"tcp_address": "0.0.0.0",
"tcp_port": 42200
},
"validation":
{
"exit_code_validation":
{
"expected_exit_code": 0
},
"stderr_validation":
{
"err_expected_lines": 0
}
}
}
}
},

"test_95_tcpv4_cli":
{
"description": [
Expand Down

0 comments on commit b4e7132

Please sign in to comment.