Skip to content

Commit

Permalink
Refs #22627: Review - Logs
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
  • Loading branch information
cferreiragonz committed Jan 22, 2025
1 parent e64989e commit 757a1f9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion include/fastdds/rtps/attributes/BuiltinTransports.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ enum class BuiltinTransports : uint16_t
UDPv6 = 5, //< Instantiate UDPv6 transport only
LARGE_DATA = 6, //< Instantiate SHM, UDPv4 and TCPv4 transports, but UDPv4 is only used for bootstrapping discovery
LARGE_DATAv6 = 7, //< Instantiate SHM, UDPv6 and TCPv6 transports, but UDPv6 is only used for bootstrapping discovery
P2P = 8 //< Instantiate SHM, UDPv4 and TCPv4 transports, shall only be used along with EASY_MODE=<ip>
P2P = 8 //< Instantiate SHM, UDPv4 (unicast) and TCPv4 transports, shall only be used along with EASY_MODE=<ip>
};

inline std::ostream& operator <<(
Expand Down
2 changes: 1 addition & 1 deletion test/system/tools/fastdds/test_discovery_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def side_effect_rpc(self, *args, **kwargs):
assert(third_attr == self.third_attr)
for i in range(len(self.check_command)):
assert(used_cmd[i] == self.check_command[i])
return args
return 'Mocked request'

def set_env_values(self, env_var_name, value):
os.environ[env_var_name] = value
Expand Down
18 changes: 9 additions & 9 deletions test/system/tools/fds/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def test_fast_discovery_parse_XML_file_default_profile(fast_discovery_tool):

output, err, exit_code = send_command(command)

EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
print(EXPECTED_SERVER_ID)

exit_code = check_output(output, err, EXPECTED_SERVER_ID, False, False)
Expand Down Expand Up @@ -285,7 +285,7 @@ def test_fast_discovery_parse_XML_file_URI_profile(fast_discovery_tool):

output, err, exit_code = send_command(command)

EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
print(EXPECTED_SERVER_ID)

exit_code = check_output(output, err, EXPECTED_SERVER_ID, False, False)
Expand All @@ -305,7 +305,7 @@ def test_fast_discovery_prefix_override(fast_discovery_tool):
XML_file_path = 'test_xml_discovery_server_profile.xml'
default_profile = XML_parse_profile(XML_file_path, "")

EXPECTED_SERVER_ID = "Server (44.53.00.5f.45.50.52.4f.53.49.4d.41)"
EXPECTED_SERVER_ID = "GUID prefix: 44.53.00.5f.45.50.52.4f.53.49.4d.41"
EXPECTED_SERVER_ADDRESS = []
udpv4 = default_profile.getElementsByTagName('udpv4')
for elem in udpv4:
Expand Down Expand Up @@ -338,7 +338,7 @@ def test_fast_discovery_locator_address_override(fast_discovery_tool):

prefix = default_profile.getElementsByTagName('prefix')
PREFIX = prefix[0].firstChild.data
EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
EXPECTED_SERVER_ADDRESS = []
EXPECTED_SERVER_ADDRESS.append("UDPv4:[172.168.43.125]:11811")
XML_SERVER_ADDRESS = []
Expand Down Expand Up @@ -377,7 +377,7 @@ def test_fast_discovery_locator_override_same_address(fast_discovery_tool):

prefix = default_profile.getElementsByTagName('prefix')
PREFIX = prefix[0].firstChild.data
EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
EXPECTED_SERVER_ADDRESS = []
EXPECTED_SERVER_ADDRESS.append("UDPv4:[127.0.0.9]:11811")
XML_SERVER_ADDRESS = []
Expand Down Expand Up @@ -416,7 +416,7 @@ def test_fast_discovery_locator_port_override(fast_discovery_tool):

prefix = default_profile.getElementsByTagName('prefix')
PREFIX = prefix[0].firstChild.data
EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
EXPECTED_SERVER_ADDRESS = []
EXPECTED_SERVER_ADDRESS.append("UDPv4:[0.0.0.0]:1234")
XML_SERVER_ADDRESS = []
Expand Down Expand Up @@ -455,7 +455,7 @@ def test_fast_discovery_locator_override_same_port(fast_discovery_tool):

prefix = default_profile.getElementsByTagName('prefix')
PREFIX = prefix[0].firstChild.data
EXPECTED_SERVER_ID = "Server (" + PREFIX.lower() + ")"
EXPECTED_SERVER_ID = "GUID prefix: " + PREFIX.lower()
EXPECTED_SERVER_ADDRESS = []
EXPECTED_SERVER_ADDRESS.append("UDPv4:[0.0.0.0]:2811")
XML_SERVER_ADDRESS = []
Expand Down Expand Up @@ -490,7 +490,7 @@ def test_fast_discovery_backup(fast_discovery_tool):
"""Test that launches a BACKUP using CLI and XML"""

XML_file_path = "test_xml_discovery_server_profile.xml"
EXPECTED_BACKUP_ID = "Server (BACKUP) (44.53.00.5f.45.50.52.4f.53.49.4d.41)"
EXPECTED_BACKUP_ID = "#### Backup Server started ####"
EXPECTED_SERVER_ADDRESS = []
EXPECTED_SERVER_ADDRESS.append("UDPv4:[0.0.0.0]:11811")

Expand All @@ -505,7 +505,7 @@ def test_fast_discovery_backup(fast_discovery_tool):
if exit_code != 0:
sys.exit(exit_code)

EXPECTED_XML_BACKUP_ID = "Server (BACKUP) (44.53.33.5f.45.50.52.4f.53.49.4d.41)"
EXPECTED_XML_BACKUP_ID = "GUID Prefix: 44.53.33.5f.45.50.52.4f.53.49.4d.41"
EXPECTED_XML_SERVER_ADDRESS = []
EXPECTED_XML_SERVER_ADDRESS.append("UDPv4:[127.0.0.105]:11825")

Expand Down
18 changes: 12 additions & 6 deletions tools/fds/CliDiscoveryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ bool CliDiscoveryManager::add_udp_servers()
{
EPROSIMA_LOG_WARNING(CLI,
"The number of specified ports doesn't match the ip addresses provided. Locators might share their port number.");
std::cout << "Where is the warning" << std::endl;
}
auto it_p = udp_ports_.begin();
auto it_i = udp_ips_.begin();
Expand Down Expand Up @@ -878,15 +877,22 @@ int CliDiscoveryManager::fastdds_discovery_server(
#endif // ifndef _WIN32

// Print running server attributes
std::cout << "Server (";
std::cout << "#### ";
if (serverQos.wire_protocol().builtin.discovery_config.discoveryProtocol == DiscoveryProtocol::BACKUP)
{
std::cout << "BACKUP) (";
std::cout << "Backup ";
}
std::cout << pServer->guid().guidPrefix << ") is running on:" << std::endl;
for (const Locator_t& locator : serverQos.wire_protocol().builtin.metatrafficUnicastLocatorList)
std::cout << "Server started ####" << std::endl;
std::cout << " GUID prefix: " << pServer->guid().guidPrefix << std::endl;
std::cout << " Running on: ";
for (auto locator_it = serverQos.wire_protocol().builtin.metatrafficUnicastLocatorList.begin();
locator_it != serverQos.wire_protocol().builtin.metatrafficUnicastLocatorList.end();)
{
std::cout << " - " << locator << std::endl;
std::cout << *locator_it;
if (++locator_it != serverQos.wire_protocol().builtin.metatrafficUnicastLocatorList.end())
{
std::cout << std::endl << " ";
}
}
std::cout << std::endl;

Expand Down

0 comments on commit 757a1f9

Please sign in to comment.