Skip to content

Commit b4e7132

Browse files
cferreiragonzmergify[bot]
authored andcommitted
Transform locators using new host_id PID (#107)
* 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
1 parent 26d6a82 commit b4e7132

8 files changed

+228
-0
lines changed

test/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ list(APPEND TEST_LIST
9696

9797
test_60_disconnection
9898
test_61_superclient_environment_variable
99+
<<<<<<< HEAD
100+
=======
101+
102+
test_94_tcpv4_custom_guid_transform_locators
103+
test_95_tcpv4_cli
104+
test_96_tcpv6_cli
105+
test_97_tcpv4_env_var
106+
test_98_tcpv6_env_var
107+
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
99108
test_99_tcp
100109
)
101110

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
3+
4+
<!-- When a DS with a custom GUID (-i param of CLI) listens on any (0.0.0.0) and the clients use
5+
localhost (127.0.0.1) to connect to the server, the GUID comparison is insufficient to
6+
correctly transform the server's locator when it is received by the client. A more reliable
7+
method is required to check if the server's locator is from the same host as the client.
8+
This test is a regression from #22006.-->
9+
10+
<clients>
11+
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
12+
<subscriber topic="topic1"/>
13+
</client>
14+
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
15+
<publisher topic="topic1"/>
16+
</client>
17+
</clients>
18+
19+
<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
20+
<snapshot time="5">Knows all</snapshot>
21+
</snapshots>
22+
23+
<profiles>
24+
25+
<transport_descriptors>
26+
<transport_descriptor>
27+
<transport_id>transport_client_1</transport_id>
28+
<type>TCPv4</type>
29+
<listening_ports>
30+
<port>0</port>
31+
</listening_ports>
32+
</transport_descriptor>
33+
<transport_descriptor>
34+
<transport_id>transport_client_2</transport_id>
35+
<type>TCPv4</type>
36+
<listening_ports>
37+
<port>0</port>
38+
</listening_ports>
39+
</transport_descriptor>
40+
</transport_descriptors>
41+
42+
<participant profile_name="TCPv4_client_1" is_default_profile="true">
43+
<rtps>
44+
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
45+
<useBuiltinTransports>false</useBuiltinTransports>
46+
<userTransports>
47+
<transport_id>transport_client_1</transport_id>
48+
</userTransports>
49+
<builtin>
50+
<discovery_config>
51+
<discoveryProtocol>CLIENT</discoveryProtocol>
52+
<discoveryServersList>
53+
<locator>
54+
<tcpv4>
55+
<address>127.0.0.1</address>
56+
<physical_port>42200</physical_port>
57+
<port>42200</port>
58+
</tcpv4>
59+
</locator>
60+
</discoveryServersList>
61+
</discovery_config>
62+
</builtin>
63+
</rtps>
64+
</participant>
65+
66+
<participant profile_name="TCPv4_client_2" is_default_profile="true">
67+
<rtps>
68+
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
69+
<useBuiltinTransports>false</useBuiltinTransports>
70+
<userTransports>
71+
<transport_id>transport_client_2</transport_id>
72+
</userTransports>
73+
<builtin>
74+
<discovery_config>
75+
<discoveryProtocol>CLIENT</discoveryProtocol>
76+
<discoveryServersList>
77+
<locator>
78+
<tcpv4>
79+
<address>127.0.0.1</address>
80+
<physical_port>42200</physical_port>
81+
<port>42200</port>
82+
</tcpv4>
83+
</locator>
84+
</discoveryServersList>
85+
</discovery_config>
86+
</builtin>
87+
</rtps>
88+
</participant>
89+
90+
<topic profile_name="topic1">
91+
<name>topic_1</name>
92+
<dataType>HelloWorld</dataType>
93+
</topic>
94+
95+
</profiles>
96+
97+
</DS>

test/configuration/test_cases/test_95_tcpv4_cli.xml

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

4+
<<<<<<< HEAD
5+
=======
6+
<!-- In order to avoid extra channel connections between TCP participants
7+
we will use the whitelist to force the clients to send their locators
8+
with localhost. Otherwise, the server would not reuse the initial
9+
channel created and it might cause a failure in the connection,
10+
depending on the value of the random logical port assigned.
11+
This could be avoided by using default GUIDs. -->
12+
13+
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
414
<clients>
515
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
616
<subscriber topic="topic1"/>

test/configuration/test_cases/test_96_tcpv6_cli.xml

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

4+
<<<<<<< HEAD
5+
=======
6+
<!-- In order to avoid extra channel connections between TCP participants
7+
we will use the whitelist to force the clients to send their locators
8+
with localhost. Otherwise, the server would not reuse the initial
9+
channel created and it might cause a failure in the connection,
10+
depending on the value of the random logical port assigned.
11+
This could be avoided by using default GUIDs. -->
12+
13+
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
414
<clients>
515
<client name="client1" profile_name="TCPv6_client_1" listening_port="0">
616
<subscriber topic="topic1"/>

test/configuration/test_cases/test_97_tcpv4_env_var.xml

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

4+
<<<<<<< HEAD
5+
=======
6+
<!-- In order to avoid extra channel connections between TCP participants
7+
we will use the whitelist to force the clients to send their locators
8+
with localhost. Otherwise, the server would not reuse the initial
9+
channel created and it might cause a failure in the connection,
10+
depending on the value of the random logical port assigned.
11+
This could be avoided by using default GUIDs. -->
12+
13+
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
414
<servers>
515
<server name="server" profile_name="TCPv4_server"/>
616
</servers>

test/configuration/test_cases/test_98_tcpv6_env_var.xml

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

4+
<<<<<<< HEAD
5+
=======
6+
<!-- In order to avoid extra channel connections between TCP participants
7+
we will use the whitelist to force the clients to send their locators
8+
with localhost. Otherwise, the server would not reuse the initial
9+
channel created and it might cause a failure in the connection,
10+
depending on the value of the random logical port assigned.
11+
This could be avoided by using default GUIDs. -->
12+
13+
>>>>>>> 5777caa (Transform locators using new host_id PID (#107))
414
<servers>
515
<server name="server" profile_name="TCPv6_server"/>
616
</servers>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<DS_Snapshots xmlns="http://www.eprosima.com/XMLSchemas/ds-snapshot">
3+
<DS_Snapshot timestamp="1701424362042" process_time="5000" last_pdp_callback_time="620" last_edp_callback_time="1067" someone="true">
4+
<description>Knows all</description>
5+
<ptdb guid_prefix="63.6c.69.65.6e.74.31.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
6+
<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"/>
7+
<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">
8+
<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"/>
9+
</ptdi>
10+
<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">
11+
<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"/>
12+
</ptdi>
13+
</ptdb>
14+
<ptdb guid_prefix="63.6c.69.65.6e.74.32.5f.73.31.5f.5f" guid_entity="0.0.1.c1">
15+
<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"/>
16+
<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">
17+
<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"/>
18+
</ptdi>
19+
<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">
20+
<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"/>
21+
</ptdi>
22+
</ptdb>
23+
</DS_Snapshot>
24+
</DS_Snapshots>

test/configuration/tests_params.json

+58
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,64 @@
22712271
}
22722272
},
22732273

2274+
"test_94_tcpv4_custom_guid_transform_locators":
2275+
{
2276+
"description": [
2277+
"Test that a TCP discovery server with a custom GUID (-i CLI param) and listening on any (0.0.0.0)\n",
2278+
"is able to communicate with a client that connects to localhost (127.0.0.1).\n",
2279+
"This test is a regression from #22006"
2280+
],
2281+
2282+
"processes":
2283+
{
2284+
"main":
2285+
{
2286+
"xml_config_file": "<CONFIG_RELATIVE_PATH>/test_cases/test_94_tcpv4_custom_guid_transform_locators.xml",
2287+
"validation":
2288+
{
2289+
"exit_code_validation":
2290+
{
2291+
"expected_exit_code": 0
2292+
},
2293+
"stderr_validation":
2294+
{
2295+
"err_expected_lines": 0
2296+
},
2297+
"count_lines_validation":
2298+
{
2299+
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
2300+
},
2301+
"ground_truth_validation":
2302+
{
2303+
"guidless": false,
2304+
"file_path": "<CONFIG_RELATIVE_PATH>/test_solutions/test_94_tcpv4_custom_guid_transform_locators.snapshot"
2305+
}
2306+
}
2307+
},
2308+
"fastddstool":
2309+
{
2310+
"kill_time": 6,
2311+
"tool_config":
2312+
{
2313+
"id" : 0,
2314+
"tcp_address": "0.0.0.0",
2315+
"tcp_port": 42200
2316+
},
2317+
"validation":
2318+
{
2319+
"exit_code_validation":
2320+
{
2321+
"expected_exit_code": 0
2322+
},
2323+
"stderr_validation":
2324+
{
2325+
"err_expected_lines": 0
2326+
}
2327+
}
2328+
}
2329+
}
2330+
},
2331+
22742332
"test_95_tcpv4_cli":
22752333
{
22762334
"description": [

0 commit comments

Comments
 (0)