Skip to content

Commit 67785d5

Browse files
Transform locators using new host_id PID (backport #107) (#108) & Add TCP tests
* Bp #107: TCP tests Signed-off-by: cferreiragonz <[email protected]> * Fix TCP tests in 1.2.x Signed-off-by: cferreiragonz <[email protected]> --------- Signed-off-by: cferreiragonz <[email protected]> Co-authored-by: cferreiragonz <[email protected]>
1 parent a3da263 commit 67785d5

11 files changed

+245
-56
lines changed

test/CMakeLists.txt

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

9797
test_60_disconnection
9898
test_61_superclient_environment_variable
99+
100+
test_94_tcpv4_custom_guid_transform_locators
101+
test_95_tcpv4_cli
102+
test_96_tcpv6_cli
103+
test_97_tcpv4_env_var
104+
test_98_tcpv6_env_var
99105
test_99_tcp
100106
)
101107

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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. If a local interface
7+
is received, a new entry to the channel_resources_ map will be created to redirect all TCP
8+
traffic in the same machine through the same channel.
9+
This test is a regression from #22006.-->
10+
11+
<clients>
12+
<client name="client1" profile_name="TCPv4_client_1">
13+
<subscriber topic="topic1"/>
14+
</client>
15+
<client name="client2" profile_name="TCPv4_client_2">
16+
<publisher topic="topic1"/>
17+
</client>
18+
</clients>
19+
20+
<snapshots file="./test_94_tcpv4_custom_guid_transform_locators.snapshot">
21+
<snapshot time="5">Knows all</snapshot>
22+
</snapshots>
23+
24+
<profiles>
25+
26+
<transport_descriptors>
27+
<transport_descriptor>
28+
<transport_id>transport_client_1</transport_id>
29+
<type>TCPv4</type>
30+
<listening_ports>
31+
<port>0</port>
32+
</listening_ports>
33+
</transport_descriptor>
34+
<transport_descriptor>
35+
<transport_id>transport_client_2</transport_id>
36+
<type>TCPv4</type>
37+
<listening_ports>
38+
<port>0</port>
39+
</listening_ports>
40+
</transport_descriptor>
41+
</transport_descriptors>
42+
43+
<participant profile_name="TCPv4_client_1" is_default_profile="true">
44+
<rtps>
45+
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
46+
<useBuiltinTransports>false</useBuiltinTransports>
47+
<userTransports>
48+
<transport_id>transport_client_1</transport_id>
49+
</userTransports>
50+
<builtin>
51+
<discovery_config>
52+
<discoveryProtocol>CLIENT</discoveryProtocol>
53+
<discoveryServersList>
54+
<RemoteServer prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41">
55+
<metatrafficUnicastLocatorList>
56+
<locator>
57+
<tcpv4>
58+
<address>127.0.0.1</address>
59+
<physical_port>42200</physical_port>
60+
<port>42200</port>
61+
</tcpv4>
62+
</locator>
63+
</metatrafficUnicastLocatorList>
64+
</RemoteServer>
65+
</discoveryServersList>
66+
</discovery_config>
67+
</builtin>
68+
</rtps>
69+
</participant>
70+
71+
<participant profile_name="TCPv4_client_2" is_default_profile="true">
72+
<rtps>
73+
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
74+
<useBuiltinTransports>false</useBuiltinTransports>
75+
<userTransports>
76+
<transport_id>transport_client_2</transport_id>
77+
</userTransports>
78+
<builtin>
79+
<discovery_config>
80+
<discoveryProtocol>CLIENT</discoveryProtocol>
81+
<discoveryServersList>
82+
<RemoteServer prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41">
83+
<metatrafficUnicastLocatorList>
84+
<locator>
85+
<tcpv4>
86+
<address>127.0.0.1</address>
87+
<physical_port>42200</physical_port>
88+
<port>42200</port>
89+
</tcpv4>
90+
</locator>
91+
</metatrafficUnicastLocatorList>
92+
</RemoteServer>
93+
</discoveryServersList>
94+
</discovery_config>
95+
</builtin>
96+
</rtps>
97+
</participant>
98+
99+
<topic profile_name="topic1">
100+
<name>topic_1</name>
101+
<dataType>HelloWorld</dataType>
102+
</topic>
103+
104+
</profiles>
105+
106+
</DS>

test/configuration/test_cases/test_95_tcpv4_cli.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

44
<clients>
5-
<client name="client1" profile_name="TCPv4_client_1" listening_port="0">
5+
<client name="client1" profile_name="TCPv4_client_1">
66
<subscriber topic="topic1"/>
77
</client>
8-
<client name="client2" profile_name="TCPv4_client_2" listening_port="0">
8+
<client name="client2" profile_name="TCPv4_client_2">
99
<publisher topic="topic1"/>
1010
</client>
1111
</clients>

test/configuration/test_cases/test_96_tcpv6_cli.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
33

44
<clients>
5-
<client name="client1" profile_name="TCPv6_client_1" listening_port="0">
5+
<client name="client1" profile_name="TCPv6_client_1">
66
<subscriber topic="topic1"/>
77
</client>
8-
<client name="client2" profile_name="TCPv6_client_2" listening_port="0">
8+
<client name="client2" profile_name="TCPv6_client_2">
99
<publisher topic="topic1"/>
1010
</client>
1111
</clients>
@@ -23,13 +23,19 @@
2323
<listening_ports>
2424
<port>0</port>
2525
</listening_ports>
26+
<interfaceWhiteList>
27+
<address>::1</address>
28+
</interfaceWhiteList>
2629
</transport_descriptor>
2730
<transport_descriptor>
2831
<transport_id>transport_client_2</transport_id>
2932
<type>TCPv6</type>
3033
<listening_ports>
3134
<port>0</port>
3235
</listening_ports>
36+
<interfaceWhiteList>
37+
<address>::1</address>
38+
</interfaceWhiteList>
3339
</transport_descriptor>
3440
</transport_descriptors>
3541

test/configuration/test_cases/test_97_tcpv4_env_var.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</servers>
77

88
<simples>
9-
<simple name="client1" profile_name="TCPv4_client_1" listening_port="0">
9+
<simple name="client1" profile_name="TCPv4_client_1">
1010
<subscriber topic="topic1"/>
1111
</simple>
12-
<simple name="client2" profile_name="TCPv4_client_2" listening_port="0">
12+
<simple name="client2" profile_name="TCPv4_client_2">
1313
<publisher topic="topic1"/>
1414
</simple>
1515
</simples>

test/configuration/test_cases/test_98_tcpv6_env_var.xml

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</servers>
77

88
<simples>
9-
<simple name="client1" profile_name="TCPv6_client_1" listening_port="0">
9+
<simple name="client1" profile_name="TCPv6_client_1">
1010
<subscriber topic="topic1"/>
1111
</simple>
12-
<simple name="client2" profile_name="TCPv6_client_2" listening_port="0">
12+
<simple name="client2" profile_name="TCPv6_client_2">
1313
<publisher topic="topic1"/>
1414
</simple>
1515
</simples>
@@ -27,20 +27,29 @@
2727
<listening_ports>
2828
<port>42100</port>
2929
</listening_ports>
30+
<interfaceWhiteList>
31+
<address>::1</address>
32+
</interfaceWhiteList>
3033
</transport_descriptor>
3134
<transport_descriptor>
3235
<transport_id>transport_client_1</transport_id>
3336
<type>TCPv6</type>
3437
<listening_ports>
3538
<port>0</port>
3639
</listening_ports>
40+
<interfaceWhiteList>
41+
<address>::1</address>
42+
</interfaceWhiteList>
3743
</transport_descriptor>
3844
<transport_descriptor>
3945
<transport_id>transport_client_2</transport_id>
4046
<type>TCPv6</type>
4147
<listening_ports>
4248
<port>0</port>
4349
</listening_ports>
50+
<interfaceWhiteList>
51+
<address>::1</address>
52+
</interfaceWhiteList>
4453
</transport_descriptor>
4554
</transport_descriptors>
4655

test/configuration/test_cases/test_99_tcp.xml

+10-30
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818

1919
<clients>
2020
<client name="client1" profile_name="TCP_client_1" listening_port="27812">
21-
<subscriber /> <!-- defaults to helloworld type -->
21+
<subscriber topic="HelloWorldTopic"/>
2222
<subscriber topic="topic_1" />
2323
<subscriber topic="topic_2" />
2424
<publisher topic="topic_2" />
2525
</client>
2626
<client name="client2" profile_name="TCP_client_2" listening_port="27813">
27-
<publisher /> <!-- defaults to helloworld type -->
27+
<publisher topic="HelloWorldTopic"/>
2828
<publisher topic="topic_1" />
2929
<publisher topic="topic_1" />
3030
<subscriber topic="topic_2" />
3131
</client>
3232
</clients>
3333

34-
<snapshots file="./test_27_tcp.snapshot~">
35-
<snapshot time="10">test_27_tcp_snapshot_1</snapshot>
34+
<snapshots file="./test_99_tcp.snapshot~">
35+
<snapshot time="10">test_99_tcp_snapshot_1</snapshot>
3636
</snapshots>
3737

3838
<profiles>
@@ -44,8 +44,6 @@
4444
<listening_ports>
4545
<port>27811</port>
4646
</listening_ports>
47-
<calculate_crc>false</calculate_crc>
48-
<check_crc>false</check_crc>
4947
</transport_descriptor>
5048
</transport_descriptors>
5149

@@ -129,31 +127,13 @@
129127

130128
<topic profile_name="topic_2">
131129
<name>topic_2</name>
132-
<dataType>sample_type_2</dataType>
130+
<dataType>HelloWorld</dataType>
133131
</topic>
134-
</profiles>
135-
136-
<types>
137-
<type>
138-
<struct name="HelloWorld">
139-
<member name="index" type="uint32" />
140-
<member name="message" type="string" />
141-
</struct>
142-
</type>
143132

144-
<type>
145-
<union name="sample_type_2">
146-
<discriminator type="byte" />
147-
<case>
148-
<caseDiscriminator value="0" />
149-
<member name="index" type="uint32" />
150-
</case>
151-
<case>
152-
<caseDiscriminator value="1" />
153-
<member name="message" type="string" />
154-
</case>
155-
</union>
156-
</type>
157-
</types>
133+
<topic profile_name="HelloWorldTopic">
134+
<name>HelloWorldTopic</name>
135+
<dataType>HelloWorld</dataType>
136+
</topic>
137+
</profiles>
158138

159139
</DS>
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>

0 commit comments

Comments
 (0)