Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13945] Modify remote server locators tests #52

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions src/DSManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,14 +1025,14 @@ void DiscoveryServerManager::loadServer(
tinyxml2::XMLElement* pub = server->FirstChildElement(DSxmlparser::PUBLISHER);
while (pub != nullptr)
{
loadPublisher(guid, pub);
loadPublisher(guid, pub, &event);
pub = pub->NextSiblingElement(DSxmlparser::PUBLISHER);
}

tinyxml2::XMLElement* sub = server->FirstChildElement(DSxmlparser::SUBSCRIBER);
while (sub != nullptr)
{
loadSubscriber(guid, sub);
loadSubscriber(guid, sub, &event);
sub = sub->NextSiblingElement(DSxmlparser::SUBSCRIBER);
}
}
Expand Down Expand Up @@ -1735,6 +1735,10 @@ void DiscoveryServerManager::loadEnvironmentChange(
return;
}
const char* value = change->GetText();
if (nullptr == value)
{
value = "";
}

// Add the event
events.push_back(new DelayedEnvironmentModification(time, key, value));
Expand Down
10 changes: 10 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ if(fastrtps_VERSION VERSION_GREATER_EQUAL "2.4.0")
)
endif()

# Modifying remote server locator list was introduced in Fast DDS v2.6.0
if (fastrtps_VERSION VERSION_GREATER_EQUAL "2.6.0")
list(APPEND TEST_LIST
test_51_remote_server_locator_client_modification
test_52_remote_server_locator_client_modification_complex
test_53_remote_server_locator_server_client_modification
test_54_remote_server_locator_modification_interconnected_servers
)
endif()

# The above TEST_LIST has tests that spawn multiple test cases, we need a new variable to enumerate them
set(TEST_CASE_LIST)

Expand Down
3 changes: 3 additions & 0 deletions test/configuration/environment_files/DS_client_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ROS_DISCOVERY_SERVER": "localhost:11811"
}
3 changes: 3 additions & 0 deletions test/configuration/environment_files/DS_client_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ROS_DISCOVERY_SERVER": "localhost:11811"
}
3 changes: 3 additions & 0 deletions test/configuration/environment_files/DS_client_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ROS_DISCOVERY_SERVER": "localhost:11812"
}
3 changes: 3 additions & 0 deletions test/configuration/environment_files/DS_server_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ROS_DISCOVERY_SERVER": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
</simples>


<snapshots file="./test_39_environment_modification~">
<snapshot time="4">test_39_environment_modification_initial</snapshot>
<snapshot time="7">test_39_environment_modification_add_server2</snapshot>
<snapshot time="12">test_39_environment_modification_add_server1</snapshot>
<snapshot time="16">test_39_environment_modification_final</snapshot>
<snapshots file="./test_50_environment_modification~">
<snapshot time="4">test_50_environment_modification_initial</snapshot>
<snapshot time="7">test_50_environment_modification_add_server2</snapshot>
<snapshot time="12">test_50_environment_modification_add_server1</snapshot>
<snapshot time="16">test_50_environment_modification_final</snapshot>
</snapshots>

<environment>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<!--
Promoted SIMPLE Participant to Client using environment file
-->
<simples>
<simple name="client_1" profile_name="client_1" creation_time="1">
<publisher topic="topic_2" />
<subscriber topic="topic_1" />
</simple>
</simples>

<snapshots file="./test_51_remote_server_locator_client_modification_C1~">
<snapshot time="2">Initial, C1 knows Server_1 (S1_1)</snapshot>
<snapshot time="10">Remote server locator modified, C1 has dropped S1_1</snapshot>
<snapshot time="13">S1_1 has been shutdown</snapshot>
<snapshot time="18">Reconnection, C1 knows Server_1 (S1_2)</snapshot>
</snapshots>

<!--
The tool does not save the initial environment file.
Therefore, the participant is launched after modifying the file setting the correct initial value.
-->
<environment>
<change time="0" key="ROS_DISCOVERY_SERVER">localhost:11811</change>
<change time="3" key="ROS_DISCOVERY_SERVER">localhost:11812</change>
</environment>

<profiles>
<participant profile_name="client_1">
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<topic profile_name="topic_2">
<name>topic_2</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<servers>
<server removal_time="11" name="server_1" profile_name="server_1" creation_time="0">
<publisher topic="topic_1" />
<subscriber topic="topic_2" />
</server>
</servers>

<snapshots file="./test_51_remote_server_locator_client_modification_S1~">
<snapshot time="2">Initial, S1 knows C1</snapshot>
<snapshot time="10">C1 has modified remote locator</snapshot>
</snapshots>

<profiles>
<participant profile_name="server_1">
<rtps>
<prefix>44.53.00.5f.45.50.52.4f.53.49.4d.41</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>11811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<topic profile_name="topic_2">
<name>topic_2</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<servers>
<server removal_time="2" name="server_1" profile_name="server_1" creation_time="0">
<publisher topic="topic_1" />
<subscriber topic="topic_2" />
</server>
</servers>

<profiles>
<participant profile_name="server_1">
<rtps>
<prefix>44.53.00.5f.45.50.52.4f.53.49.4d.41</prefix>
<builtin>
<discovery_config>
<discoveryProtocol>SERVER</discoveryProtocol>
</discovery_config>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>127.0.0.1</address>
<port>11812</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</builtin>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<topic profile_name="topic_2">
<name>topic_2</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<!--
Promoted SIMPLE Participant to Client using environment file
-->
<simples>
<simple name="client_1" profile_name="client_1" creation_time="1">
<publisher topic="topic_1" />
<subscriber topic="topic_1" />
</simple>
</simples>

<snapshots file="./test_52_remote_server_locator_client_modification_complex_C1~">
<snapshot time="3">Initial, C1 knows C2 through Server_1 (S1_1)</snapshot>
<snapshot time="11">C1 has changes its remote locator but keeps knowing C2</snapshot>
<snapshot time="16">C1 knows C3 through Server_1 (S1_2) and still knows C2</snapshot>
<snapshot time="24">Nothing has changed with respect to the previous snapshot</snapshot>
</snapshots>

<!--
The tool does not save the initial environment file.
Therefore, the participant is launched after modifying the file setting the correct initial value.
This allows to use the same file in all tests without concerning with the initial values.
-->
<environment>
<change time="0" key="ROS_DISCOVERY_SERVER">localhost:11811</change>
<change time="4" key="ROS_DISCOVERY_SERVER">localhost:11812</change>
</environment>

<profiles>
<participant profile_name="client_1">
<rtps>
<prefix>63.6c.69.65.6e.74.31.5f.73.31.5f.5f</prefix>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<!--
Promoted SIMPLE Participant to Client using environment file
-->
<simples>
<simple name="client_2" profile_name="client_2" creation_time="1">
<publisher topic="topic_1" />
<subscriber topic="topic_1" />
</simple>
</simples>

<snapshots file="./test_52_remote_server_locator_client_modification_complex_C2~">
<snapshot time="3">Initial, C2 knows C1 through Server_1 (S1_1)</snapshot>
<snapshot time="11">C2 keeps knowing C1 even though C1 has changed its locators</snapshot>
<snapshot time="16">Same situation as the previous snapshot</snapshot>
<snapshot time="24">C2 discovers C3 through S1_2 after modifying its remote server locator</snapshot>
</snapshots>

<!--
The tool does not save the initial environment file.
Therefore, the participant is launched after modifying the file setting the correct initial value.
This allows to use the same file in all tests without concerning with the initial values.
-->
<environment>
<change time="0" key="ROS_DISCOVERY_SERVER">localhost:11811</change>
<change time="17" key="ROS_DISCOVERY_SERVER">localhost:11812</change>
</environment>

<profiles>
<participant profile_name="client_2">
<rtps>
<prefix>63.6c.69.65.6e.74.32.5f.73.31.5f.5f</prefix>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<DS xmlns="http://www.eprosima.com/XMLSchemas/discovery-server" user_shutdown="false">
<!--
Promoted SIMPLE Participant to Client using environment file
-->
<simples>
<simple name="client_3" profile_name="client_3" creation_time="1">
<publisher topic="topic_1" />
<subscriber topic="topic_1" />
</simple>
</simples>

<snapshots file="./test_52_remote_server_locator_client_modification_complex_C3~">
<snapshot time="3">C3 knows only itself</snapshot>
<snapshot time="11">Same situation as the previous snapshot</snapshot>
<snapshot time="16">C3 knows C1 thorugh S1_2</snapshot>
<snapshot time="24">C3 knows C2 through S1_2</snapshot>
</snapshots>

<!--
The tool does not save the initial environment file.
Therefore, the participant is launched after modifying the file setting the correct initial value.
This allows to use the same file in all tests without concerning with the initial values.
-->
<environment>
<change time="0" key="ROS_DISCOVERY_SERVER">localhost:11812</change>
</environment>

<profiles>
<participant profile_name="client_3">
<rtps>
<prefix>63.6c.69.65.6e.74.33.5f.73.31.5f.5f</prefix>
</rtps>
</participant>

<topic profile_name="topic_1">
<name>topic_1</name>
<dataType>sample_type_1</dataType>
</topic>

<types>
<type>
<struct name="sample_type_1">
<member name="index" type="uint32" />
<member name="message" type="string" />
</struct>
</type>
</types>
</profiles>
</DS>
Loading