From f99a999afadb6f88865204c1027e926f7829892e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Dom=C3=ADnguez=20L=C3=B3pez?= <116071334+Mario-DL@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:48:33 +0200 Subject: [PATCH] Add XML configuration for FlowControllerDescriptor to 2.x (#4893) * Refs #21136: Replace const char* with string Signed-off-by: Mario Dominguez * Refs #21136: Update fastRTPS_profiles.xsd Signed-off-by: Mario Dominguez * Refs #21136: Implement flow controller descriptor list in XML related source files Signed-off-by: Mario Dominguez * Refs #21136: Update tests Signed-off-by: Mario Dominguez * Refs #21136: versions.md Signed-off-by: Mario Dominguez * Refs #21136: Linter Signed-off-by: Mario Dominguez * Refs #21136: Apply rev Signed-off-by: Mario Dominguez --------- Signed-off-by: Mario Dominguez (cherry picked from commit e6044e01172525295733737e574e69f74ff507ca) # Conflicts: # include/fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp # resources/xsd/fastRTPS_profiles.xsd # test/unittest/dds/profiles/test_xml_profiles.xml # test/unittest/dds/profiles/test_xml_profiles_for_string.xml # test/unittest/xmlparser/XMLParserTests.cpp # test/unittest/xmlparser/XMLProfileParserTests.cpp # test/unittest/xmlparser/test_xml_profile.xml # test/unittest/xmlparser/test_xml_profile_env_var.xml # versions.md --- .../fastdds/dds/core/policy/QosPolicies.hpp | 4 +- .../rtps/attributes/WriterAttributes.h | 2 +- .../flowcontrol/FlowControllerDescriptor.hpp | 9 +- include/fastrtps/xmlparser/XMLParser.h | 7 + include/fastrtps/xmlparser/XMLParserCommon.h | 12 + resources/xsd/fastRTPS_profiles.xsd | 203 ++++++ .../rtps/participant/RTPSParticipantImpl.cpp | 2 +- src/cpp/rtps/xmlparser/XMLElementParser.cpp | 149 +++++ src/cpp/rtps/xmlparser/XMLParser.cpp | 11 + src/cpp/rtps/xmlparser/XMLParserCommon.cpp | 11 + .../dds/profiles/test_xml_profiles.xml | 71 +++ .../profiles/test_xml_profiles_for_string.xml | 35 + .../unittest/dds/publisher/PublisherTests.cpp | 2 +- .../xmlparser/XMLElementParserTests.cpp | 172 +++++ test/unittest/xmlparser/XMLParserTests.cpp | 209 ++++++ .../xmlparser/XMLProfileParserTests.cpp | 603 ++++++++++++++++++ test/unittest/xmlparser/test_xml_profile.xml | 454 +++++++++++++ .../xmlparser/test_xml_profile_env_var.xml | 456 +++++++++++++ test/unittest/xmlparser/test_xml_profiles.xml | 15 + .../xmlparser/test_xml_profiles_rooted.xml | 14 + .../xmlparser/wrapper/XMLParserTest.hpp | 8 + versions.md | 7 + 22 files changed, 2450 insertions(+), 6 deletions(-) create mode 100644 test/unittest/xmlparser/test_xml_profile.xml create mode 100644 test/unittest/xmlparser/test_xml_profile_env_var.xml diff --git a/include/fastdds/dds/core/policy/QosPolicies.hpp b/include/fastdds/dds/core/policy/QosPolicies.hpp index d2813b0b0bb..1ddac178eec 100644 --- a/include/fastdds/dds/core/policy/QosPolicies.hpp +++ b/include/fastdds/dds/core/policy/QosPolicies.hpp @@ -2044,7 +2044,7 @@ class PublishModeQosPolicy : public QosPolicy * * @since 2.4.0 */ - const char* flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT; + std::string flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT; inline void clear() override { @@ -2056,7 +2056,7 @@ class PublishModeQosPolicy : public QosPolicy const PublishModeQosPolicy& b) const { return (this->kind == b.kind) && - 0 == strcmp(flow_controller_name, b.flow_controller_name) && + flow_controller_name == b.flow_controller_name.c_str() && QosPolicy::operator ==(b); } diff --git a/include/fastdds/rtps/attributes/WriterAttributes.h b/include/fastdds/rtps/attributes/WriterAttributes.h index 7c9dd2d5ac1..3e1d4f33cf9 100644 --- a/include/fastdds/rtps/attributes/WriterAttributes.h +++ b/include/fastdds/rtps/attributes/WriterAttributes.h @@ -143,7 +143,7 @@ class WriterAttributes Duration_t keep_duration; //! Flow controller name. Default: fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT. - const char* flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT; + std::string flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT; }; } /* namespace rtps */ diff --git a/include/fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp b/include/fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp index 8e5c489eb74..247af1001fd 100644 --- a/include/fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp +++ b/include/fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp @@ -15,6 +15,13 @@ #ifndef FASTDDS_RTPS_FLOWCONTROL_FLOWCONTROLLERDESCRIPTOR_HPP #define FASTDDS_RTPS_FLOWCONTROL_FLOWCONTROLLERDESCRIPTOR_HPP +<<<<<<< HEAD +======= +#include + +#include + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) #include "FlowControllerConsts.hpp" #include "FlowControllerSchedulerPolicy.hpp" @@ -31,7 +38,7 @@ namespace rtps { struct FlowControllerDescriptor { //! Name of the flow controller. - const char* name = nullptr; + std::string name = FASTDDS_FLOW_CONTROLLER_DEFAULT; //! Scheduler policy used by the flow controller. //! diff --git a/include/fastrtps/xmlparser/XMLParser.h b/include/fastrtps/xmlparser/XMLParser.h index 5683765c1f9..98eb1196f7c 100644 --- a/include/fastrtps/xmlparser/XMLParser.h +++ b/include/fastrtps/xmlparser/XMLParser.h @@ -91,6 +91,8 @@ class XMLParser public: + using FlowControllerDescriptorList = std::vector>; + /** * Load the default XML file. * @return XMLP_ret::XML_OK on success, XMLP_ret::XML_ERROR in other case. @@ -496,6 +498,11 @@ class XMLParser rtps::ThroughputControllerDescriptor& throughputController, uint8_t ident); + RTPS_DllAPI static XMLP_ret getXMLFlowControllerDescriptorList( + tinyxml2::XMLElement* elem, + FlowControllerDescriptorList& flow_controller_descriptor_list, + uint8_t ident); + RTPS_DllAPI static XMLP_ret getXMLPortParameters( tinyxml2::XMLElement* elem, rtps::PortParameters& port, diff --git a/include/fastrtps/xmlparser/XMLParserCommon.h b/include/fastrtps/xmlparser/XMLParserCommon.h index 7ffd2e9133a..4b49ff7666d 100644 --- a/include/fastrtps/xmlparser/XMLParserCommon.h +++ b/include/fastrtps/xmlparser/XMLParserCommon.h @@ -114,6 +114,7 @@ extern const char* PART_ID; extern const char* IP4_TO_SEND; extern const char* IP6_TO_SEND; extern const char* THROUGHPUT_CONT; +extern const char* FLOW_CONTROLLER_DESCRIPTOR_LIST; extern const char* USER_TRANS; extern const char* USE_BUILTIN_TRANS; extern const char* BUILTIN_TRANS; @@ -257,6 +258,17 @@ extern const char* ALLOCATED_SAMPLES; extern const char* EXTRA_SAMPLES; extern const char* BYTES_PER_SECOND; extern const char* PERIOD_MILLISECS; +extern const char* FLOW_CONTROLLER_DESCRIPTOR; +extern const char* SCHEDULER; +extern const char* SENDER_THREAD; +extern const char* MAX_BYTES_PER_PERIOD; +extern const char* PERIOD_MS; +extern const char* FLOW_CONTROLLER_NAME; +extern const char* FIFO; +extern const char* HIGH_PRIORITY; +extern const char* ROUND_ROBIN; +extern const char* PRIORITY_WITH_RESERVATION; +extern const char* FLOW_CONTROLLER_NAME; extern const char* PORT_BASE; extern const char* DOMAIN_ID_GAIN; extern const char* PARTICIPANT_ID_GAIN; diff --git a/resources/xsd/fastRTPS_profiles.xsd b/resources/xsd/fastRTPS_profiles.xsd index dc36d33a52c..581f2b3e5b3 100644 --- a/resources/xsd/fastRTPS_profiles.xsd +++ b/resources/xsd/fastRTPS_profiles.xsd @@ -37,9 +37,95 @@ +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) @@ -527,6 +613,72 @@ +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) @@ -619,10 +771,61 @@ +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 21dba7ca80c..471d3256d0f 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -679,7 +679,7 @@ bool RTPSParticipantImpl::create_writer( GUID_t guid(m_guid.guidPrefix, entId); fastdds::rtps::FlowController* flow_controller = nullptr; - const char* flow_controller_name = param.flow_controller_name; + std::string flow_controller_name = param.flow_controller_name; // Support of old flow controller style. if (param.throughputController.bytesPerPeriod != UINT32_MAX && param.throughputController.periodMillisecs != 0) diff --git a/src/cpp/rtps/xmlparser/XMLElementParser.cpp b/src/cpp/rtps/xmlparser/XMLElementParser.cpp index e58b99ec8c0..25ea47760be 100644 --- a/src/cpp/rtps/xmlparser/XMLElementParser.cpp +++ b/src/cpp/rtps/xmlparser/XMLElementParser.cpp @@ -754,6 +754,145 @@ XMLP_ret XMLParser::getXMLThroughputController( return XMLP_ret::XML_OK; } +XMLP_ret XMLParser::getXMLFlowControllerDescriptorList( + tinyxml2::XMLElement* elem, + FlowControllerDescriptorList& flow_controller_descriptor_list, + uint8_t ident) +{ + /* + + + + + + */ + + tinyxml2::XMLElement* p_aux0 = nullptr; + p_aux0 = elem->FirstChildElement(FLOW_CONTROLLER_DESCRIPTOR); + if (nullptr == p_aux0) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << elem->Value() << "' without content"); + return XMLP_ret::XML_ERROR; + } + + while (nullptr != p_aux0) + { + /* + + + + + + + + + + + + + + + + + + */ + + tinyxml2::XMLElement* p_aux1; + bool name_defined = false; + std::set tags_present; + + auto flow_controller_descriptor = std::make_shared(); + + for (p_aux1 = p_aux0->FirstChildElement(); p_aux1 != NULL; p_aux1 = p_aux1->NextSiblingElement()) + { + const char* name = p_aux1->Name(); + + if (tags_present.count(name) != 0) + { + EPROSIMA_LOG_ERROR(XMLPARSER, + "Duplicated element found in 'flowControllerDescriptorType'. Name: " << name); + return XMLP_ret::XML_ERROR; + } + else + { + tags_present.emplace(name); + } + + if (strcmp(name, NAME) == 0) + { + // name - stringType + flow_controller_descriptor->name = get_element_text(p_aux1); + if (flow_controller_descriptor->name.empty()) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "<" << p_aux1->Value() << "> getXMLString XML_ERROR!"); + return XMLP_ret::XML_ERROR; + } + name_defined = true; + } + else if (strcmp(name, SCHEDULER) == 0) + { + std::string text = get_element_text(p_aux1); + if (text.empty()) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << SCHEDULER << "' without content"); + return XMLP_ret::XML_ERROR; + } + + // scheduler - flowControllerSchedulerPolicy + if (!get_element_enum_value(text.c_str(), flow_controller_descriptor->scheduler, + FIFO, fastdds::rtps::FlowControllerSchedulerPolicy::FIFO, + HIGH_PRIORITY, fastdds::rtps::FlowControllerSchedulerPolicy::HIGH_PRIORITY, + ROUND_ROBIN, fastdds::rtps::FlowControllerSchedulerPolicy::ROUND_ROBIN, + PRIORITY_WITH_RESERVATION, + fastdds::rtps::FlowControllerSchedulerPolicy::PRIORITY_WITH_RESERVATION)) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << SCHEDULER << "' with bad content"); + return XMLP_ret::XML_ERROR; + } + } + else if (strcmp(name, MAX_BYTES_PER_PERIOD) == 0) + { + // max_bytes_per_period - int32Type + if (XMLP_ret::XML_OK != getXMLInt(p_aux1, &flow_controller_descriptor->max_bytes_per_period, ident)) + { + return XMLP_ret::XML_ERROR; + } + } + else if (strcmp(name, PERIOD_MS) == 0) + { + // period_ms - uint64Type + if (XMLP_ret::XML_OK != getXMLUint(p_aux1, &flow_controller_descriptor->period_ms, ident)) + { + return XMLP_ret::XML_ERROR; + } + } + else if (strcmp(name, SENDER_THREAD) == 0) + { + // sender_thread - threadSettingsType + getXMLThreadSettings(*p_aux1, flow_controller_descriptor->sender_thread); + } + else + { + EPROSIMA_LOG_ERROR(XMLPARSER, + "Invalid element found into 'flowControllerDescriptorType'. Name: " << name); + return XMLP_ret::XML_ERROR; + } + } + + if (!name_defined) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "Flow Controller Descriptor requires a 'name'"); + return XMLP_ret::XML_ERROR; + } + + flow_controller_descriptor_list.push_back(flow_controller_descriptor); + p_aux0 = p_aux0->NextSiblingElement(FLOW_CONTROLLER_DESCRIPTOR); + + } + + return XMLP_ret::XML_OK; +} + XMLP_ret XMLParser::getXMLTopicAttributes( tinyxml2::XMLElement* elem, TopicAttributes& topic, @@ -2480,6 +2619,16 @@ XMLP_ret XMLParser::getXMLPublishModeQos( return XMLP_ret::XML_ERROR; } } + else if (strcmp(name, FLOW_CONTROLLER_NAME) == 0) + { + + publishMode.flow_controller_name = get_element_text(p_aux0); + if (publishMode.flow_controller_name.empty()) + { + EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << FLOW_CONTROLLER_NAME << "' without content"); + return XMLP_ret::XML_ERROR; + } + } else { logError(XMLPARSER, "Invalid element found into 'publishModeQosPolicyType'. Name: " << name); diff --git a/src/cpp/rtps/xmlparser/XMLParser.cpp b/src/cpp/rtps/xmlparser/XMLParser.cpp index 3be03efe479..5b21e7f8d82 100644 --- a/src/cpp/rtps/xmlparser/XMLParser.cpp +++ b/src/cpp/rtps/xmlparser/XMLParser.cpp @@ -1794,6 +1794,7 @@ XMLP_ret XMLParser::fillDataNode( + @@ -1963,6 +1964,16 @@ XMLP_ret XMLParser::fillDataNode( } logWarning(XML_PARSER, THROUGHPUT_CONT << " XML tag is deprecated"); } + else if (strcmp(name, FLOW_CONTROLLER_DESCRIPTOR_LIST) == 0) + { + // flow_controller_descriptors + if (XMLP_ret::XML_OK != + getXMLFlowControllerDescriptorList(p_aux0, + participant_node.get()->rtps.flow_controllers, ident)) + { + return XMLP_ret::XML_ERROR; + } + } else if (strcmp(name, USER_TRANS) == 0) { // userTransports diff --git a/src/cpp/rtps/xmlparser/XMLParserCommon.cpp b/src/cpp/rtps/xmlparser/XMLParserCommon.cpp index d4339a436bc..5229f19ebc1 100644 --- a/src/cpp/rtps/xmlparser/XMLParserCommon.cpp +++ b/src/cpp/rtps/xmlparser/XMLParserCommon.cpp @@ -98,6 +98,7 @@ const char* PHYSICAL_PORT = "physical_port"; const char* USER_DATA = "userData"; const char* PART_ID = "participantID"; const char* THROUGHPUT_CONT = "throughputController"; +const char* FLOW_CONTROLLER_DESCRIPTOR_LIST = "flow_controller_descriptor_list"; const char* USER_TRANS = "userTransports"; const char* USE_BUILTIN_TRANS = "useBuiltinTransports"; const char* BUILTIN_TRANS = "builtinTransports"; @@ -244,6 +245,16 @@ const char* ALLOCATED_SAMPLES = "allocated_samples"; const char* EXTRA_SAMPLES = "extra_samples"; const char* BYTES_PER_SECOND = "bytesPerPeriod"; const char* PERIOD_MILLISECS = "periodMillisecs"; +const char* FLOW_CONTROLLER_DESCRIPTOR = "flow_controller_descriptor"; +const char* SCHEDULER = "scheduler"; +const char* SENDER_THREAD = "sender_thread"; +const char* MAX_BYTES_PER_PERIOD = "max_bytes_per_period"; +const char* PERIOD_MS = "period_ms"; +const char* FLOW_CONTROLLER_NAME = "flow_controller_name"; +const char* FIFO = "FIFO"; +const char* HIGH_PRIORITY = "HIGH_PRIORITY"; +const char* ROUND_ROBIN = "ROUND_ROBIN"; +const char* PRIORITY_WITH_RESERVATION = "PRIORITY_WITH_RESERVATION"; const char* PORT_BASE = "portBase"; const char* DOMAIN_ID_GAIN = "domainIDGain"; const char* PARTICIPANT_ID_GAIN = "participantIDGain"; diff --git a/test/unittest/dds/profiles/test_xml_profiles.xml b/test/unittest/dds/profiles/test_xml_profiles.xml index b2a56011742..559dfb4d7e4 100644 --- a/test/unittest/dds/profiles/test_xml_profiles.xml +++ b/test/unittest/dds/profiles/test_xml_profiles.xml @@ -130,6 +130,41 @@ true test_name +<<<<<<< HEAD:test/unittest/dds/profiles/test_xml_profiles.xml +======= + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + + test_flow_controller + 2048 + 45 + FIFO + + 15 + 1048576 + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)):test/unittest/dds/profiles/test_xml_profile.xml @@ -259,6 +294,41 @@ true default_name +<<<<<<< HEAD:test/unittest/dds/profiles/test_xml_profiles.xml +======= + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + + test_default_flow_controller + 2048 + 45 + FIFO + + 15 + 1048576 + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)):test/unittest/dds/profiles/test_xml_profile.xml @@ -418,6 +488,7 @@ ASYNCHRONOUS + test_default_flow_controller diff --git a/test/unittest/dds/profiles/test_xml_profiles_for_string.xml b/test/unittest/dds/profiles/test_xml_profiles_for_string.xml index eebe02e99fc..94fd2a0ac71 100644 --- a/test/unittest/dds/profiles/test_xml_profiles_for_string.xml +++ b/test/unittest/dds/profiles/test_xml_profiles_for_string.xml @@ -130,6 +130,41 @@ true test_name +<<<<<<< HEAD:test/unittest/dds/profiles/test_xml_profiles_for_string.xml +======= + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + 15 + 1048576 + + + + test_flow_controller + 2048 + 45 + FIFO + + 15 + 1048576 + + + +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)):test/unittest/dds/profiles/test_xml_for_string_profile.xml diff --git a/test/unittest/dds/publisher/PublisherTests.cpp b/test/unittest/dds/publisher/PublisherTests.cpp index a49be675da4..57cf68d5f0b 100644 --- a/test/unittest/dds/publisher/PublisherTests.cpp +++ b/test/unittest/dds/publisher/PublisherTests.cpp @@ -358,7 +358,7 @@ TEST(PublisherTests, ChangeDefaultDataWriterQos) EXPECT_FALSE(wqos.writer_data_lifecycle().autodispose_unregistered_instances); // .publish_mode EXPECT_EQ(eprosima::fastdds::dds::ASYNCHRONOUS_PUBLISH_MODE, wqos.publish_mode().kind); - EXPECT_EQ(0, strcmp(wqos.publish_mode().flow_controller_name, "Prueba")); + EXPECT_EQ(true, wqos.publish_mode().flow_controller_name == "Prueba"); count = 1; for (auto prop : wqos.properties().properties()) { diff --git a/test/unittest/xmlparser/XMLElementParserTests.cpp b/test/unittest/xmlparser/XMLElementParserTests.cpp index 7c3cf6ffd49..5e3fa2f7682 100644 --- a/test/unittest/xmlparser/XMLElementParserTests.cpp +++ b/test/unittest/xmlparser/XMLElementParserTests.cpp @@ -1957,6 +1957,122 @@ TEST_F(XMLParserTests, getXMLBuiltinAttributes_NegativeClauses) EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParserTest::getXMLBuiltinAttributes_wrapper(titleElement, builtin, ident)); } +/* + * This test checks parsing of flow_controller_descriptor_list elements. + */ +TEST_F(XMLParserTests, getXMLFlowControllerDescriptorList) +{ + uint8_t ident = 1; + + /* + * Aux mapping for FlowControllerSchedulerPolicy + */ + + auto scheduler_policy_map = std::map + { + {"FIFO", eprosima::fastdds::rtps::FlowControllerSchedulerPolicy::FIFO}, + {"ROUND_ROBIN", eprosima::fastdds::rtps::FlowControllerSchedulerPolicy::ROUND_ROBIN}, + {"HIGH_PRIORITY", eprosima::fastdds::rtps::FlowControllerSchedulerPolicy::HIGH_PRIORITY}, + {"PRIORITY_WITH_RESERVATION", eprosima::fastdds::rtps::FlowControllerSchedulerPolicy::PRIORITY_WITH_RESERVATION} + }; + + /* Define the test cases */ + std::vector, XMLP_ret>> test_cases = + { + /* + * name, scheduler, max_bytes_per_period, period_ms, + * sender_thread_scheduling_policy, sender_thread_priority, + * sender_thread_affinity, sender_thread_stack_size, extra_xml_tag + */ + {{"test_flow_controller", "FIFO", "120", "50", \ + "12", "12", "12", "12", "" }, XMLP_ret::XML_OK}, + {{"test_flow_controller", "ROUND_ROBIN", "2500", "100", \ + "15", "12", "12", "12", "" }, XMLP_ret::XML_OK}, + {{"test_flow_controller", "HIGH_PRIORITY", "2500", "100", \ + "15", "12", "12", "12", "" }, XMLP_ret::XML_OK}, + {{"test_flow_controller", "PRIORITY_WITH_RESERVATION", "2500", "100", \ + "15", "12", "12", "12", "" }, XMLP_ret::XML_OK}, + {{"test_flow_controller", "INVALID", "120", "50", \ + "12", "12", "12", "12", "" }, XMLP_ret::XML_ERROR}, // Invalid scheduler + {{"test_flow_controller", "HIGH_PRIORITY", "120", "-10", \ + "12", "12", "12", "12", "" }, XMLP_ret::XML_ERROR}, // negative period_ms + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "" }, XMLP_ret::XML_ERROR}, // Invalid tag + {{"", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "" }, XMLP_ret::XML_ERROR}, // empty name + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "another_name" }, XMLP_ret::XML_ERROR}, // duplicated name tag + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "FIFO" }, XMLP_ret::XML_ERROR}, // duplicated scheduler tag + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "96" }, XMLP_ret::XML_ERROR}, // duplicated max_bytes_per_period tag + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "96" }, XMLP_ret::XML_ERROR}, // duplicated period_ms tag + {{"test_flow_controller", "HIGH_PRIORITY", "120", "50", \ + "12", "12", "12", "12", "12" }, + XMLP_ret::XML_ERROR}, // duplicated sender_thread tag + {{"", "HIGH_PRIORITY", "120", "50", \ + "12345", "12", "12", "a", "" }, XMLP_ret::XML_ERROR}, // invalid thread settings + }; + + /* Run the tests */ + for (auto test_case : test_cases) + { + std::vector& params = test_case.first; + XMLP_ret& expectation = test_case.second; + + using namespace eprosima::fastdds::rtps; + XMLParserTest::FlowControllerDescriptorList flow_controller_descriptor_list; + tinyxml2::XMLDocument xml_doc; + tinyxml2::XMLElement* titleElement; + + // Create XML snippet + std::string xml = + "" + " " + " " + params[0] + "" + " " + params[1] + "" + " " + params[2] + "" + " " + params[3] + "" + " " + " " + params[4] + "" + " " + params[5] + "" + " " + params[6] + "" + " " + params[7] + "" + " " + + params[8] + + " " + ""; + + // Parse the XML snippet + ASSERT_EQ(tinyxml2::XMLError::XML_SUCCESS, xml_doc.Parse(xml.c_str())) << xml; + + // Extract FlowControllersDescriptors + titleElement = xml_doc.RootElement(); + ASSERT_EQ(expectation, + XMLParserTest::getXMLFlowControllerDescriptorList_wrapper(titleElement, flow_controller_descriptor_list, + ident)); + + // Validate in the OK cases + if (expectation == XMLP_ret::XML_OK) + { + ASSERT_EQ(flow_controller_descriptor_list.at(0)->name, params[0]); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->scheduler, scheduler_policy_map[params[1]]); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->max_bytes_per_period, + static_cast(std::stoi(params[2]))); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->period_ms, static_cast(std::stoi(params[3]))); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->sender_thread.scheduling_policy, + static_cast(std::stoi(params[4]))); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->sender_thread.priority, + static_cast(std::stoi(params[5]))); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->sender_thread.affinity, + static_cast(std::stoi(params[6]))); + ASSERT_EQ(flow_controller_descriptor_list.at(0)->sender_thread.stack_size, + static_cast(std::stoi(params[7]))); + } + } +} + /* * This test checks the negative cases in the xml child element of * 1. Check an invalid tag of: @@ -2014,6 +2130,62 @@ TEST_F(XMLParserTests, getXMLThroughputController_NegativeClauses) XMLParserTest::getXMLThroughputController_wrapper(titleElement, throughputController, ident)); } +/* + * This test checks the negative cases in the xml child element of + * 1. Check an invalid tag of: + * + * 2. Check invalid element + */ +TEST_F(XMLParserTests, getXMLFlowControllerDescriptorList_NegativeClauses) +{ + uint8_t ident = 1; + XMLParserTest::FlowControllerDescriptorList flow_controller_descriptor_list; + tinyxml2::XMLDocument xml_doc; + tinyxml2::XMLElement* titleElement; + + // Parametrized XML + const char* xml_p = + "\ + \ + %s\ + \ + "; + constexpr size_t xml_len {1000}; + char xml[xml_len]; + const char* field_p = + "\ + <%s>\ + \ + \ + "; + constexpr size_t field_len {500}; + char field[field_len]; + + std::vector field_vec = + { + "flow_controller_descriptor" + }; + + for (std::string tag : field_vec) + { + snprintf(field, field_len, field_p, tag.c_str(), tag.c_str()); + snprintf(xml, xml_len, xml_p, field); + ASSERT_EQ(tinyxml2::XMLError::XML_SUCCESS, xml_doc.Parse(xml)); + titleElement = xml_doc.RootElement(); + EXPECT_EQ(XMLP_ret::XML_ERROR, + XMLParserTest::getXMLFlowControllerDescriptorList_wrapper(titleElement, flow_controller_descriptor_list, + ident)); + } + + // Invalid element + snprintf(xml, xml_len, xml_p, " "); + ASSERT_EQ(tinyxml2::XMLError::XML_SUCCESS, xml_doc.Parse(xml)); + titleElement = xml_doc.RootElement(); + EXPECT_EQ(XMLP_ret::XML_ERROR, + XMLParserTest::getXMLFlowControllerDescriptorList_wrapper(titleElement, flow_controller_descriptor_list, + ident)); +} + /* * This test checks the negative cases in the xml child element of * 1. Check an invalid tag of: diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index 9ffcae1bd84..be5d5145e36 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -343,7 +343,109 @@ TEST_F(XMLParserTests, Data) const std::string name_attribute{"profile_name"}; const std::string profile_name{"test_participant_profile"}; +<<<<<<< HEAD ASSERT_EQ(XMLParser::loadXML("test_xml_profiles.xml", root), XMLP_ret::XML_OK); +======= + ASSERT_EQ(XMLParser::loadXML("test_xml_profile.xml", root), XMLP_ret::XML_OK); + + BaseNode* profiles(root->getChild(0)); + ASSERT_TRUE(profiles); + ASSERT_EQ(profiles->getType(), xmlparser::NodeType::PROFILES); + + ParticipantAttributes participant_atts; + bool participant_profile = false; + for (const auto& profile : profiles->getChildren()) + { + if (profile->getType() == NodeType::PARTICIPANT) + { + auto data_node = dynamic_cast*>(profile.get()); + auto search = data_node->getAttributes().find(name_attribute); + if ((search != data_node->getAttributes().end()) && (search->second == profile_name)) + { + participant_atts = *data_node->get(); + participant_profile = true; + } + } + } + + ASSERT_TRUE(participant_profile); + EXPECT_EQ(participant_atts.domainId, 123u); + RTPSParticipantAttributes& rtps_atts = participant_atts.rtps; + BuiltinAttributes& builtin = rtps_atts.builtin; + Locator_t locator; + LocatorListIterator loc_list_it; + PortParameters& port = rtps_atts.port; + IPLocator::setIPv4(locator, 192, 168, 1, 2); + locator.port = 2019; + EXPECT_EQ(*rtps_atts.defaultUnicastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2021; + EXPECT_EQ(*rtps_atts.defaultMulticastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 1); + locator.port = 1979; + EXPECT_EQ(rtps_atts.sendSocketBufferSize, 32u); + EXPECT_EQ(rtps_atts.listenSocketBufferSize, 1000u); + EXPECT_EQ(builtin.discovery_config.discoveryProtocol, eprosima::fastrtps::rtps::DiscoveryProtocol::SIMPLE); + EXPECT_EQ(builtin.use_WriterLivelinessProtocol, false); + EXPECT_EQ(builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol, true); + EXPECT_EQ(builtin.discovery_config.use_STATIC_EndpointDiscoveryProtocol, false); + EXPECT_EQ(builtin.discovery_config.leaseDuration, c_TimeInfinite); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.seconds, 10); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.nanosec, 333u); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader, false); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter, true); + IPLocator::setIPv4(locator, 192, 168, 1, 5); + locator.port = 9999; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficUnicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 6); + locator.port = 6666; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 2); + locator.port = 32; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficMulticastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 3); + locator.port = 2112; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 21120; + EXPECT_EQ(*(loc_list_it = builtin.initialPeersList.begin()), locator); + EXPECT_EQ(builtin.readerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.writerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.readerPayloadSize, 1000u); + EXPECT_EQ(builtin.writerPayloadSize, 2000u); + EXPECT_EQ(builtin.mutation_tries, 55u); + EXPECT_TRUE(builtin.typelookup_config.use_client); + EXPECT_TRUE(builtin.typelookup_config.use_server); + EXPECT_EQ(port.portBase, 12); + EXPECT_EQ(port.domainIDGain, 34); + EXPECT_EQ(port.participantIDGain, 56); + EXPECT_EQ(port.offsetd0, 78); + EXPECT_EQ(port.offsetd1, 90); + EXPECT_EQ(port.offsetd2, 123); + EXPECT_EQ(port.offsetd3, 456); + EXPECT_EQ(rtps_atts.participantID, 9898); + //EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); + //EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); + EXPECT_EQ(rtps_atts.useBuiltinTransports, true); + EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); + EXPECT_EQ(rtps_atts.userData, std::vector({0x56, 0x30, 0x0, 0xce})); +} + +/* + * Checks the data parsing (with deprecated but supported elements) + */ +TEST_F(XMLParserTests, DataDeprecated) +{ + std::unique_ptr root; + const std::string name_attribute{"profile_name"}; + const std::string profile_name{"test_participant_profile"}; + + ASSERT_EQ(XMLParser::loadXML("test_xml_deprecated.xml", root), XMLP_ret::XML_OK); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) BaseNode* profiles(root->getChild(0)); ASSERT_TRUE(profiles); @@ -423,6 +525,8 @@ TEST_F(XMLParserTests, Data) EXPECT_EQ(rtps_atts.participantID, 9898); EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); EXPECT_EQ(rtps_atts.useBuiltinTransports, true); EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); EXPECT_EQ(rtps_atts.userData, std::vector({0x56, 0x30, 0x0, 0xce})); @@ -433,7 +537,109 @@ TEST_F(XMLParserTests, DataBuffer) const std::string name_attribute{"profile_name"}; const std::string profile_name{"test_participant_profile"}; std::ifstream inFile; +<<<<<<< HEAD inFile.open("test_xml_profiles.xml"); +======= + inFile.open("test_xml_profile.xml"); + std::stringstream strStream; + strStream << inFile.rdbuf(); + std::unique_ptr root; + ASSERT_EQ(XMLParser::loadXML(strStream.str().data(), strStream.str().size(), root), XMLP_ret::XML_OK); + + BaseNode* profiles(root->getChild(0)); + ASSERT_TRUE(profiles); + ASSERT_EQ(profiles->getType(), xmlparser::NodeType::PROFILES); + + ParticipantAttributes participant_atts; + bool participant_profile = false; + for (const auto& profile : profiles->getChildren()) + { + if (profile->getType() == NodeType::PARTICIPANT) + { + auto data_node = dynamic_cast*>(profile.get()); + auto search = data_node->getAttributes().find(name_attribute); + if ((search != data_node->getAttributes().end()) && (search->second == profile_name)) + { + participant_atts = *data_node->get(); + participant_profile = true; + } + } + } + + ASSERT_TRUE(participant_profile); + EXPECT_EQ(participant_atts.domainId, 123u); + RTPSParticipantAttributes& rtps_atts = participant_atts.rtps; + BuiltinAttributes& builtin = rtps_atts.builtin; + Locator_t locator; + LocatorListIterator loc_list_it; + PortParameters& port = rtps_atts.port; + IPLocator::setIPv4(locator, 192, 168, 1, 2); + locator.port = 2019; + EXPECT_EQ(*rtps_atts.defaultUnicastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2021; + EXPECT_EQ(*rtps_atts.defaultMulticastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 1); + locator.port = 1979; + EXPECT_EQ(rtps_atts.sendSocketBufferSize, 32u); + EXPECT_EQ(rtps_atts.listenSocketBufferSize, 1000u); + EXPECT_EQ(builtin.discovery_config.discoveryProtocol, eprosima::fastrtps::rtps::DiscoveryProtocol::SIMPLE); + EXPECT_EQ(builtin.use_WriterLivelinessProtocol, false); + EXPECT_EQ(builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol, true); + EXPECT_EQ(builtin.discovery_config.use_STATIC_EndpointDiscoveryProtocol, false); + EXPECT_EQ(builtin.discovery_config.leaseDuration, c_TimeInfinite); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.seconds, 10); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.nanosec, 333u); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader, false); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter, true); + IPLocator::setIPv4(locator, 192, 168, 1, 5); + locator.port = 9999; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficUnicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 6); + locator.port = 6666; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 2); + locator.port = 32; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficMulticastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 3); + locator.port = 2112; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 21120; + EXPECT_EQ(*(loc_list_it = builtin.initialPeersList.begin()), locator); + EXPECT_EQ(builtin.readerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.writerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.readerPayloadSize, 1000u); + EXPECT_EQ(builtin.writerPayloadSize, 2000u); + EXPECT_EQ(builtin.mutation_tries, 55u); + EXPECT_TRUE(builtin.typelookup_config.use_client); + EXPECT_TRUE(builtin.typelookup_config.use_server); + EXPECT_EQ(port.portBase, 12); + EXPECT_EQ(port.domainIDGain, 34); + EXPECT_EQ(port.participantIDGain, 56); + EXPECT_EQ(port.offsetd0, 78); + EXPECT_EQ(port.offsetd1, 90); + EXPECT_EQ(port.offsetd2, 123); + EXPECT_EQ(port.offsetd3, 456); + EXPECT_EQ(rtps_atts.participantID, 9898); + //EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); + //EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); + EXPECT_EQ(rtps_atts.useBuiltinTransports, true); + EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); + EXPECT_EQ(rtps_atts.userData, std::vector({0x56, 0x30, 0x0, 0xce})); +} + +TEST_F(XMLParserTests, DataBufferDeprecated) +{ + const std::string name_attribute{"profile_name"}; + const std::string profile_name{"test_participant_profile"}; + std::ifstream inFile; + inFile.open("test_xml_deprecated.xml"); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) std::stringstream strStream; strStream << inFile.rdbuf(); std::unique_ptr root; @@ -517,6 +723,8 @@ TEST_F(XMLParserTests, DataBuffer) EXPECT_EQ(rtps_atts.participantID, 9898); EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); EXPECT_EQ(rtps_atts.useBuiltinTransports, true); EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); EXPECT_EQ(rtps_atts.userData, std::vector({0x56, 0x30, 0x0, 0xce})); @@ -1386,6 +1594,7 @@ TEST_F(XMLParserTests, fillDataNodeParticipantNegativeClauses) "", "", "", + "", "", "", "", diff --git a/test/unittest/xmlparser/XMLProfileParserTests.cpp b/test/unittest/xmlparser/XMLProfileParserTests.cpp index 54e5a864540..e0dc6c8a3e7 100644 --- a/test/unittest/xmlparser/XMLProfileParserTests.cpp +++ b/test/unittest/xmlparser/XMLProfileParserTests.cpp @@ -78,7 +78,247 @@ class XMLProfileParserTests : public ::testing::Test }; +<<<<<<< HEAD TEST_F(XMLProfileParserTests, XMLParserRootLibrarySettings) +======= +class XMLProfileParserTests : public XMLProfileParserBasicTests, public testing::WithParamInterface +{ +protected: + + void SetUp() override + { + XMLProfileParserBasicTests::SetUp(); + + // Use plain file by default + xml_filename_ = "test_xml_profile.xml"; + + // Check if loading from environment variables should be tested + if (GetParam()) + { + // Use different file + xml_filename_ = "test_xml_profile_env_var.xml"; + + // Set environment variables values + for (const std::pair& value : c_environment_values_) + { + set_environment_variable(value.first.c_str(), value.second.c_str()); + } + } + } + + void TearDown() override + { + if (GetParam()) + { + for (const std::pair& value : c_environment_values_) + { + clear_environment_variable(value.first.c_str()); + } + } + } + + std::string xml_filename_ = "test_xml_profile.xml"; + + const std::pair c_environment_values_[167] + { + {"XML_PROFILES_ENV_VAR_1", "123"}, + {"XML_PROFILES_ENV_VAR_2", "4"}, + {"XML_PROFILES_ENV_VAR_3", "1"}, + {"XML_PROFILES_ENV_VAR_4", "10"}, + {"XML_PROFILES_ENV_VAR_5", "20"}, + {"XML_PROFILES_ENV_VAR_6", "2"}, + {"XML_PROFILES_ENV_VAR_7", "10"}, + {"XML_PROFILES_ENV_VAR_8", "20"}, + {"XML_PROFILES_ENV_VAR_9", "2"}, + {"XML_PROFILES_ENV_VAR_10", "10"}, + {"XML_PROFILES_ENV_VAR_11", "20"}, + {"XML_PROFILES_ENV_VAR_12", "2"}, + {"XML_PROFILES_ENV_VAR_13", "127"}, + {"XML_PROFILES_ENV_VAR_14", "true"}, + {"XML_PROFILES_ENV_VAR_15", "192.168.1.2"}, + {"XML_PROFILES_ENV_VAR_16", "2019"}, + {"XML_PROFILES_ENV_VAR_17", "239.255.0.1"}, + {"XML_PROFILES_ENV_VAR_18", "2021"}, + {"XML_PROFILES_ENV_VAR_19", "true"}, + {"XML_PROFILES_ENV_VAR_20", "10.10.10.10"}, + {"XML_PROFILES_ENV_VAR_21", "2001"}, + {"XML_PROFILES_ENV_VAR_22", "32"}, + {"XML_PROFILES_ENV_VAR_23", "1000"}, + {"XML_PROFILES_ENV_VAR_24", "SIMPLE"}, + {"XML_PROFILES_ENV_VAR_25", "SIMPLE"}, + {"XML_PROFILES_ENV_VAR_26", "FILTER_SAME_PROCESS | FILTER_DIFFERENT_HOST"}, + {"XML_PROFILES_ENV_VAR_27", "10"}, + {"XML_PROFILES_ENV_VAR_28", "333"}, + {"XML_PROFILES_ENV_VAR_29", "DURATION_INFINITY"}, + {"XML_PROFILES_ENV_VAR_30", "2"}, + {"XML_PROFILES_ENV_VAR_31", "1"}, + {"XML_PROFILES_ENV_VAR_32", "827"}, + {"XML_PROFILES_ENV_VAR_33", "false"}, + {"XML_PROFILES_ENV_VAR_34", "true"}, + {"XML_PROFILES_ENV_VAR_35", "false"}, + {"XML_PROFILES_ENV_VAR_36", "false"}, + {"XML_PROFILES_ENV_VAR_37", "192.168.1.5"}, + {"XML_PROFILES_ENV_VAR_38", "9999"}, + {"XML_PROFILES_ENV_VAR_39", "192.168.1.6"}, + {"XML_PROFILES_ENV_VAR_40", "6666"}, + {"XML_PROFILES_ENV_VAR_41", "239.255.0.2"}, + {"XML_PROFILES_ENV_VAR_42", "32"}, + {"XML_PROFILES_ENV_VAR_43", "239.255.0.3"}, + {"XML_PROFILES_ENV_VAR_44", "2112"}, + {"XML_PROFILES_ENV_VAR_45", "10.10.10.10"}, + {"XML_PROFILES_ENV_VAR_46", "2002"}, + {"XML_PROFILES_ENV_VAR_47", "239.255.0.1"}, + {"XML_PROFILES_ENV_VAR_48", "21120"}, + {"XML_PROFILES_ENV_VAR_49", "PREALLOCATED"}, + {"XML_PROFILES_ENV_VAR_50", "PREALLOCATED"}, + {"XML_PROFILES_ENV_VAR_51", "1000"}, + {"XML_PROFILES_ENV_VAR_52", "2000"}, + {"XML_PROFILES_ENV_VAR_53", "55"}, + {"XML_PROFILES_ENV_VAR_54", "true"}, + {"XML_PROFILES_ENV_VAR_55", "true"}, + {"XML_PROFILES_ENV_VAR_56", "12"}, + {"XML_PROFILES_ENV_VAR_57", "34"}, + {"XML_PROFILES_ENV_VAR_58", "56"}, + {"XML_PROFILES_ENV_VAR_59", "78"}, + {"XML_PROFILES_ENV_VAR_60", "90"}, + {"XML_PROFILES_ENV_VAR_61", "123"}, + {"XML_PROFILES_ENV_VAR_62", "456"}, + {"XML_PROFILES_ENV_VAR_63", "9898"}, + {"XML_PROFILES_ENV_VAR_64", "true"}, + {"XML_PROFILES_ENV_VAR_65", "test_name"}, + {"XML_PROFILES_ENV_VAR_66", "56.30.0.ce"}, + {"XML_PROFILES_ENV_VAR_67", "KEEP_LAST"}, + {"XML_PROFILES_ENV_VAR_68", "50"}, + {"XML_PROFILES_ENV_VAR_69", "432"}, + {"XML_PROFILES_ENV_VAR_70", "1"}, + {"XML_PROFILES_ENV_VAR_71", "100"}, + {"XML_PROFILES_ENV_VAR_72", "123"}, + {"XML_PROFILES_ENV_VAR_73", "TRANSIENT_LOCAL"}, + {"XML_PROFILES_ENV_VAR_74", "MANUAL_BY_PARTICIPANT"}, + {"XML_PROFILES_ENV_VAR_75", "1"}, + {"XML_PROFILES_ENV_VAR_76", "2"}, + {"XML_PROFILES_ENV_VAR_77", "DURATION_INFINITY"}, + {"XML_PROFILES_ENV_VAR_78", "BEST_EFFORT"}, + {"XML_PROFILES_ENV_VAR_79", "0"}, + {"XML_PROFILES_ENV_VAR_80", "0"}, + {"XML_PROFILES_ENV_VAR_81", "partition_name_a"}, + {"XML_PROFILES_ENV_VAR_82", "partition_name_b"}, + {"XML_PROFILES_ENV_VAR_83", "ASYNCHRONOUS"}, + {"XML_PROFILES_ENV_VAR_84", "56.30.0.1"}, + {"XML_PROFILES_ENV_VAR_85", "5.3.1.0"}, + {"XML_PROFILES_ENV_VAR_86", "5.3.1.0.F1"}, + {"XML_PROFILES_ENV_VAR_87", "0"}, + {"XML_PROFILES_ENV_VAR_88", "0"}, + {"XML_PROFILES_ENV_VAR_89", "11"}, + {"XML_PROFILES_ENV_VAR_90", "32"}, + {"XML_PROFILES_ENV_VAR_91", "0"}, + {"XML_PROFILES_ENV_VAR_92", "0"}, + {"XML_PROFILES_ENV_VAR_93", "121"}, + {"XML_PROFILES_ENV_VAR_94", "332"}, + {"XML_PROFILES_ENV_VAR_95", "192.168.1.3"}, + {"XML_PROFILES_ENV_VAR_96", "197"}, + {"XML_PROFILES_ENV_VAR_97", "192.168.1.9"}, + {"XML_PROFILES_ENV_VAR_98", "219"}, + {"XML_PROFILES_ENV_VAR_99", "239.255.0.1"}, + {"XML_PROFILES_ENV_VAR_100", "2020"}, + {"XML_PROFILES_ENV_VAR_101", ""}, + {"XML_PROFILES_ENV_VAR_102", "1989"}, + {"XML_PROFILES_ENV_VAR_103", "true"}, + {"XML_PROFILES_ENV_VAR_104", "10.10.10.10"}, + {"XML_PROFILES_ENV_VAR_105", "2001"}, + {"XML_PROFILES_ENV_VAR_106", "DYNAMIC"}, + {"XML_PROFILES_ENV_VAR_107", "67"}, + {"XML_PROFILES_ENV_VAR_108", "87"}, + {"XML_PROFILES_ENV_VAR_109", "10"}, + {"XML_PROFILES_ENV_VAR_110", "10"}, + {"XML_PROFILES_ENV_VAR_111", "0"}, + {"XML_PROFILES_ENV_VAR_112", "KEEP_ALL"}, + {"XML_PROFILES_ENV_VAR_113", "1001"}, + {"XML_PROFILES_ENV_VAR_114", "52"}, + {"XML_PROFILES_ENV_VAR_115", "25"}, + {"XML_PROFILES_ENV_VAR_116", "32"}, + {"XML_PROFILES_ENV_VAR_117", "37"}, + {"XML_PROFILES_ENV_VAR_118", "PERSISTENT"}, + {"XML_PROFILES_ENV_VAR_119", "MANUAL_BY_TOPIC"}, + {"XML_PROFILES_ENV_VAR_120", "11"}, + {"XML_PROFILES_ENV_VAR_121", "22"}, + {"XML_PROFILES_ENV_VAR_122", "0"}, + {"XML_PROFILES_ENV_VAR_123", "0"}, + {"XML_PROFILES_ENV_VAR_124", "RELIABLE"}, + {"XML_PROFILES_ENV_VAR_125", "DURATION_INFINITY"}, + {"XML_PROFILES_ENV_VAR_126", "partition_name_c"}, + {"XML_PROFILES_ENV_VAR_127", "partition_name_d"}, + {"XML_PROFILES_ENV_VAR_128", "partition_name_e"}, + {"XML_PROFILES_ENV_VAR_129", "partition_name_f"}, + {"XML_PROFILES_ENV_VAR_130", "56.30.0.1"}, + {"XML_PROFILES_ENV_VAR_131", "5.3.1.0"}, + {"XML_PROFILES_ENV_VAR_132", "5.3.1.0.F1"}, + {"XML_PROFILES_ENV_VAR_133", "0"}, + {"XML_PROFILES_ENV_VAR_134", "0"}, + {"XML_PROFILES_ENV_VAR_135", "18"}, + {"XML_PROFILES_ENV_VAR_136", "81"}, + {"XML_PROFILES_ENV_VAR_137", "192.168.1.10"}, + {"XML_PROFILES_ENV_VAR_138", "196"}, + {"XML_PROFILES_ENV_VAR_139", "212"}, + {"XML_PROFILES_ENV_VAR_140", "239.255.0.10"}, + {"XML_PROFILES_ENV_VAR_141", "220"}, + {"XML_PROFILES_ENV_VAR_142", "239.255.0.11"}, + {"XML_PROFILES_ENV_VAR_143", "9891"}, + {"XML_PROFILES_ENV_VAR_144", "true"}, + {"XML_PROFILES_ENV_VAR_145", "10.10.10.10"}, + {"XML_PROFILES_ENV_VAR_146", "2001"}, + {"XML_PROFILES_ENV_VAR_147", "true"}, + {"XML_PROFILES_ENV_VAR_148", "PREALLOCATED_WITH_REALLOC"}, + {"XML_PROFILES_ENV_VAR_149", "13"}, + {"XML_PROFILES_ENV_VAR_150", "31"}, + {"XML_PROFILES_ENV_VAR_151", "10"}, + {"XML_PROFILES_ENV_VAR_152", "10"}, + {"XML_PROFILES_ENV_VAR_153", "0"}, + {"XML_PROFILES_ENV_VAR_154", "KEEP_ALL"}, + {"XML_PROFILES_ENV_VAR_155", "1001"}, + {"XML_PROFILES_ENV_VAR_156", "FULL"}, + {"XML_PROFILES_ENV_VAR_157", "true"}, + {"XML_PROFILES_ENV_VAR_158", "-1"}, + {"XML_PROFILES_ENV_VAR_159", "0"}, + {"XML_PROFILES_ENV_VAR_160", "0"}, + {"XML_PROFILES_ENV_VAR_161", "-1"}, + {"XML_PROFILES_ENV_VAR_162", "ON"}, + {"XML_PROFILES_ENV_VAR_163", "test_flow_controller"}, + {"XML_PROFILES_ENV_VAR_164", "HIGH_PRIORITY"}, + {"XML_PROFILES_ENV_VAR_165", "2048"}, + {"XML_PROFILES_ENV_VAR_166", "45"}, + {"XML_PROFILES_ENV_VAR_167", "test_flow_controller"} + }; + +}; + +static void check_external_locator( + const eprosima::fastdds::rtps::ExternalLocators& external_locators, + uint8_t externality, + uint8_t cost, + uint8_t mask, + const char* address, + uint32_t port) +{ + auto ext_it = external_locators.find(externality); + ASSERT_NE(ext_it, external_locators.end()); + auto cost_it = ext_it->second.find(cost); + ASSERT_NE(cost_it, ext_it->second.end()); + for (const eprosima::fastdds::rtps::LocatorWithMask& loc : cost_it->second) + { + if (IPLocator::ip_to_string(loc).compare(address) == 0) + { + EXPECT_EQ(mask, loc.mask()); + EXPECT_EQ(port, loc.port); + return; + } + } + + EXPECT_FALSE(true); +} + +TEST_F(XMLProfileParserBasicTests, XMLParserRootLibrarySettings) +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) { ASSERT_EQ(xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::loadXMLFile("test_xml_root_library_settings.xml")); @@ -219,7 +459,115 @@ TEST_F(XMLProfileParserTests, XMLParserParticipant) ParticipantAttributes participant_atts; ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, +<<<<<<< HEAD xmlparser::XMLProfileManager::loadXMLFile("test_xml_profiles.xml")); +======= + xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); + EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::fillParticipantAttributes(participant_profile, participant_atts)); + + EXPECT_EQ(participant_atts.domainId, 123u); + RTPSParticipantAttributes& rtps_atts = participant_atts.rtps; + BuiltinAttributes& builtin = rtps_atts.builtin; + Locator_t locator; + LocatorListIterator loc_list_it; + PortParameters& port = rtps_atts.port; + + EXPECT_EQ(rtps_atts.allocation.locators.max_unicast_locators, 4u); + EXPECT_EQ(rtps_atts.allocation.locators.max_multicast_locators, 1u); + EXPECT_EQ(rtps_atts.allocation.participants.initial, 10u); + EXPECT_EQ(rtps_atts.allocation.participants.maximum, 20u); + EXPECT_EQ(rtps_atts.allocation.participants.increment, 2u); + EXPECT_EQ(rtps_atts.allocation.readers.initial, 10u); + EXPECT_EQ(rtps_atts.allocation.readers.maximum, 20u); + EXPECT_EQ(rtps_atts.allocation.readers.increment, 2u); + EXPECT_EQ(rtps_atts.allocation.writers.initial, 10u); + EXPECT_EQ(rtps_atts.allocation.writers.maximum, 20u); + EXPECT_EQ(rtps_atts.allocation.writers.increment, 2u); + EXPECT_EQ(rtps_atts.allocation.send_buffers.preallocated_number, 127u); + EXPECT_EQ(rtps_atts.allocation.send_buffers.dynamic, true); + + IPLocator::setIPv4(locator, 192, 168, 1, 2); + locator.port = 2019; + EXPECT_EQ(*rtps_atts.defaultUnicastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2021; + EXPECT_EQ(*rtps_atts.defaultMulticastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 1); + locator.port = 1979; + check_external_locator(rtps_atts.default_external_unicast_locators, 100, 200, 10, "10.10.10.10", 2001); + EXPECT_TRUE(rtps_atts.ignore_non_matching_locators); + EXPECT_EQ(rtps_atts.sendSocketBufferSize, 32u); + EXPECT_EQ(rtps_atts.listenSocketBufferSize, 1000u); + EXPECT_EQ(builtin.discovery_config.discoveryProtocol, eprosima::fastrtps::rtps::DiscoveryProtocol::SIMPLE); + EXPECT_EQ(builtin.discovery_config.ignoreParticipantFlags, + eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS | + eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_HOST); + EXPECT_EQ(builtin.use_WriterLivelinessProtocol, false); + EXPECT_EQ(builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol, true); + EXPECT_EQ(builtin.discovery_config.use_STATIC_EndpointDiscoveryProtocol, false); + EXPECT_EQ(builtin.discovery_config.leaseDuration, c_TimeInfinite); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.seconds, 10); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.nanosec, 333u); + EXPECT_EQ(builtin.discovery_config.initial_announcements.count, 2u); + EXPECT_EQ(builtin.discovery_config.initial_announcements.period.seconds, 1); + EXPECT_EQ(builtin.discovery_config.initial_announcements.period.nanosec, 827u); + EXPECT_FALSE(builtin.avoid_builtin_multicast); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader, false); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter, true); + check_external_locator(rtps_atts.builtin.metatraffic_external_unicast_locators, 100, 200, 10, "10.10.10.10", 2002); + IPLocator::setIPv4(locator, 192, 168, 1, 5); + locator.port = 9999; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficUnicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 6); + locator.port = 6666; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 2); + locator.port = 32; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficMulticastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 3); + locator.port = 2112; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 21120; + EXPECT_EQ(*(loc_list_it = builtin.initialPeersList.begin()), locator); + EXPECT_EQ(builtin.readerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.writerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.readerPayloadSize, 1000u); + EXPECT_EQ(builtin.writerPayloadSize, 2000u); + EXPECT_EQ(builtin.mutation_tries, 55u); + EXPECT_TRUE(builtin.typelookup_config.use_client); + EXPECT_TRUE(builtin.typelookup_config.use_server); + EXPECT_EQ(port.portBase, 12); + EXPECT_EQ(port.domainIDGain, 34); + EXPECT_EQ(port.participantIDGain, 56); + EXPECT_EQ(port.offsetd0, 78); + EXPECT_EQ(port.offsetd1, 90); + EXPECT_EQ(port.offsetd2, 123); + EXPECT_EQ(port.offsetd3, 456); + EXPECT_EQ(rtps_atts.participantID, 9898); + //EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); + //EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); + EXPECT_EQ(rtps_atts.useBuiltinTransports, true); + EXPECT_EQ(rtps_atts.netmaskFilter, eprosima::fastdds::rtps::NetmaskFilterKind::ON); + EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); +} + +/* + * Checks the participant parsing (with deprecated but supported elements) + */ +TEST_F(XMLProfileParserBasicTests, XMLParserParticipantDeprecated) +{ + std::string participant_profile = std::string("test_participant_profile"); + ParticipantAttributes participant_atts; + + ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillParticipantAttributes(participant_profile, participant_atts)); @@ -302,6 +650,8 @@ TEST_F(XMLProfileParserTests, XMLParserParticipant) EXPECT_EQ(rtps_atts.participantID, 9898); EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); EXPECT_EQ(rtps_atts.useBuiltinTransports, true); EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); } @@ -312,7 +662,98 @@ TEST_F(XMLProfileParserTests, XMLParserDefaultParticipantProfile) ParticipantAttributes participant_atts; ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, +<<<<<<< HEAD xmlparser::XMLProfileManager::loadXMLFile("test_xml_profiles.xml")); +======= + xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); + xmlparser::XMLProfileManager::getDefaultParticipantAttributes(participant_atts); + + EXPECT_EQ(participant_atts.domainId, 123u); + RTPSParticipantAttributes& rtps_atts = participant_atts.rtps; + BuiltinAttributes& builtin = rtps_atts.builtin; + Locator_t locator; + LocatorListIterator loc_list_it; + PortParameters& port = rtps_atts.port; + + IPLocator::setIPv4(locator, 192, 168, 1, 2); + locator.port = 2019; + EXPECT_EQ(*rtps_atts.defaultUnicastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2021; + EXPECT_EQ(*rtps_atts.defaultMulticastLocatorList.begin(), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 1); + locator.port = 1979; + check_external_locator(rtps_atts.default_external_unicast_locators, 100, 200, 10, "10.10.10.10", 2001); + EXPECT_TRUE(rtps_atts.ignore_non_matching_locators); + EXPECT_EQ(rtps_atts.sendSocketBufferSize, 32u); + EXPECT_EQ(rtps_atts.listenSocketBufferSize, 1000u); + EXPECT_EQ(builtin.discovery_config.discoveryProtocol, eprosima::fastrtps::rtps::DiscoveryProtocol::SIMPLE); + EXPECT_EQ(builtin.discovery_config.ignoreParticipantFlags, + eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_SAME_PROCESS | + eprosima::fastrtps::rtps::ParticipantFilteringFlags_t::FILTER_DIFFERENT_HOST); + EXPECT_EQ(builtin.use_WriterLivelinessProtocol, false); + EXPECT_EQ(builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol, true); + EXPECT_EQ(builtin.discovery_config.use_STATIC_EndpointDiscoveryProtocol, false); + EXPECT_EQ(builtin.discovery_config.leaseDuration, c_TimeInfinite); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.seconds, 10); + EXPECT_EQ(builtin.discovery_config.leaseDuration_announcementperiod.nanosec, 333u); + EXPECT_EQ(builtin.discovery_config.initial_announcements.count, 2u); + EXPECT_EQ(builtin.discovery_config.initial_announcements.period.seconds, 1); + EXPECT_EQ(builtin.discovery_config.initial_announcements.period.nanosec, 827u); + EXPECT_FALSE(builtin.avoid_builtin_multicast); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader, false); + EXPECT_EQ(builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter, true); + check_external_locator(rtps_atts.builtin.metatraffic_external_unicast_locators, 100, 200, 10, "10.10.10.10", 2002); + IPLocator::setIPv4(locator, 192, 168, 1, 5); + locator.port = 9999; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficUnicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 6); + locator.port = 6666; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 2); + locator.port = 32; + EXPECT_EQ(*(loc_list_it = builtin.metatrafficMulticastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 239, 255, 0, 3); + locator.port = 2112; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 21120; + EXPECT_EQ(*(loc_list_it = builtin.initialPeersList.begin()), locator); + EXPECT_EQ(builtin.readerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.writerHistoryMemoryPolicy, PREALLOCATED_MEMORY_MODE); + EXPECT_EQ(builtin.readerPayloadSize, 1000u); + EXPECT_EQ(builtin.writerPayloadSize, 2000u); + EXPECT_EQ(builtin.mutation_tries, 55u); + EXPECT_TRUE(builtin.typelookup_config.use_client); + EXPECT_TRUE(builtin.typelookup_config.use_server); + EXPECT_EQ(port.portBase, 12); + EXPECT_EQ(port.domainIDGain, 34); + EXPECT_EQ(port.participantIDGain, 56); + EXPECT_EQ(port.offsetd0, 78); + EXPECT_EQ(port.offsetd1, 90); + EXPECT_EQ(port.offsetd2, 123); + EXPECT_EQ(port.offsetd3, 456); + EXPECT_EQ(rtps_atts.participantID, 9898); + //EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); + //EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); + EXPECT_EQ(rtps_atts.useBuiltinTransports, true); + EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); +} + +/* + * Checks the participant default profile parsing (with deprecated but supported elements) + */ +TEST_F(XMLProfileParserBasicTests, XMLParserDefaultParticipantProfileDeprecated) +{ + ParticipantAttributes participant_atts; + + ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) xmlparser::XMLProfileManager::getDefaultParticipantAttributes(participant_atts); EXPECT_EQ(participant_atts.domainId, 2019102u); @@ -380,6 +821,8 @@ TEST_F(XMLProfileParserTests, XMLParserDefaultParticipantProfile) EXPECT_EQ(rtps_atts.participantID, 9898); EXPECT_EQ(rtps_atts.throughputController.bytesPerPeriod, 2048u); EXPECT_EQ(rtps_atts.throughputController.periodMillisecs, 45u); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->max_bytes_per_period, 2048); + EXPECT_EQ(rtps_atts.flow_controllers.at(0)->period_ms, 45u); EXPECT_EQ(rtps_atts.useBuiltinTransports, true); EXPECT_EQ(std::string(rtps_atts.getName()), "test_name"); } @@ -390,7 +833,87 @@ TEST_F(XMLProfileParserTests, XMLParserPublisher) PublisherAttributes publisher_atts; ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, +<<<<<<< HEAD xmlparser::XMLProfileManager::loadXMLFile("test_xml_profiles.xml")); +======= + xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); + EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::fillPublisherAttributes(publisher_profile, publisher_atts)); + + TopicAttributes& pub_topic = publisher_atts.topic; + WriterQos& pub_qos = publisher_atts.qos; + Locator_t locator; + LocatorListIterator loc_list_it; + WriterTimes& pub_times = publisher_atts.times; + + //EXPECT_EQ(pub_topic.topicKind, NO_KEY); + //EXPECT_EQ(pub_topic.topicName, "samplePubSubTopic"); + //EXPECT_EQ(pub_topic.topicDataType, "samplePubSubTopicType"); + EXPECT_EQ(pub_topic.historyQos.kind, KEEP_LAST_HISTORY_QOS); + EXPECT_EQ(pub_topic.historyQos.depth, 50); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_samples, 432); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_instances, 1); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_samples_per_instance, 100); + EXPECT_EQ(pub_topic.resourceLimitsQos.allocated_samples, 123); + EXPECT_EQ(pub_qos.m_durability.kind, TRANSIENT_LOCAL_DURABILITY_QOS); + EXPECT_EQ(pub_qos.m_liveliness.kind, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + EXPECT_EQ(pub_qos.m_liveliness.lease_duration.seconds, 1); + EXPECT_EQ(pub_qos.m_liveliness.lease_duration.nanosec, 2u); + EXPECT_EQ(pub_qos.m_liveliness.announcement_period, c_TimeInfinite); + EXPECT_EQ(pub_qos.m_reliability.kind, BEST_EFFORT_RELIABILITY_QOS); + EXPECT_EQ(pub_qos.m_reliability.max_blocking_time, c_TimeZero); + EXPECT_EQ(pub_qos.m_partition.names()[0], "partition_name_a"); + EXPECT_EQ(pub_qos.m_partition.names()[1], "partition_name_b"); + EXPECT_EQ(pub_qos.m_publishMode.kind, ASYNCHRONOUS_PUBLISH_MODE); + EXPECT_EQ(pub_qos.m_publishMode.flow_controller_name, "test_flow_controller"); + EXPECT_EQ(pub_times.initialHeartbeatDelay, c_TimeZero); + EXPECT_EQ(pub_times.heartbeatPeriod.seconds, 11); + EXPECT_EQ(pub_times.heartbeatPeriod.nanosec, 32u); + EXPECT_EQ(pub_times.nackResponseDelay, c_TimeZero); + EXPECT_EQ(pub_times.nackSupressionDuration.seconds, 121); + EXPECT_EQ(pub_times.nackSupressionDuration.nanosec, 332u); + EXPECT_TRUE(publisher_atts.ignore_non_matching_locators); + check_external_locator(publisher_atts.external_unicast_locators, 100, 200, 10, "10.10.10.10", 2001); + IPLocator::setIPv4(locator, 192, 168, 1, 3); + locator.port = 197; + EXPECT_EQ(*(loc_list_it = publisher_atts.unicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 9); + locator.port = 219; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2020; + EXPECT_EQ(*(loc_list_it = publisher_atts.multicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 0, 0, 0, 0); + locator.port = 0; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + locator.port = 1989; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + //locator.port = 2021; + //EXPECT_EQ(*(loc_list_it = publisher_atts.outLocatorList.begin()), locator); + //EXPECT_EQ(loc_list_it->get_port(), 2021); + //EXPECT_EQ(publisher_atts.throughputController.bytesPerPeriod, 9236u); + //EXPECT_EQ(publisher_atts.throughputController.periodMillisecs, 234u); + EXPECT_EQ(publisher_atts.historyMemoryPolicy, DYNAMIC_RESERVE_MEMORY_MODE); + EXPECT_EQ(publisher_atts.getUserDefinedID(), 67); + EXPECT_EQ(publisher_atts.getEntityID(), 87); + EXPECT_EQ(publisher_atts.matched_subscriber_allocation, ResourceLimitedContainerConfig::fixed_size_configuration( + 10u)); +} + +/* + * Checks the data writer parsing (with deprecated but supported elements) + */ +TEST_F(XMLProfileParserBasicTests, XMLParserPublisherDeprecated) +{ + std::string publisher_profile = std::string("test_publisher_profile"); + PublisherAttributes publisher_atts; + + ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillPublisherAttributes(publisher_profile, publisher_atts)); @@ -419,6 +942,7 @@ TEST_F(XMLProfileParserTests, XMLParserPublisher) EXPECT_EQ(pub_qos.m_partition.names()[0], "partition_name_a"); EXPECT_EQ(pub_qos.m_partition.names()[1], "partition_name_b"); EXPECT_EQ(pub_qos.m_publishMode.kind, ASYNCHRONOUS_PUBLISH_MODE); + EXPECT_EQ(pub_qos.m_publishMode.flow_controller_name, "test_flow_controller"); EXPECT_EQ(pub_times.initialHeartbeatDelay, c_TimeZero); EXPECT_EQ(pub_times.heartbeatPeriod.seconds, 11); EXPECT_EQ(pub_times.heartbeatPeriod.nanosec, 32u); @@ -460,7 +984,85 @@ TEST_F(XMLProfileParserTests, XMLParserDefaultPublisherProfile) PublisherAttributes publisher_atts; ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, +<<<<<<< HEAD xmlparser::XMLProfileManager::loadXMLFile("test_xml_profiles.xml")); +======= + xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); + xmlparser::XMLProfileManager::getDefaultPublisherAttributes(publisher_atts); + + TopicAttributes& pub_topic = publisher_atts.topic; + WriterQos& pub_qos = publisher_atts.qos; + Locator_t locator; + LocatorListIterator loc_list_it; + WriterTimes& pub_times = publisher_atts.times; + + //EXPECT_EQ(pub_topic.topicKind, NO_KEY); + //EXPECT_EQ(pub_topic.topicName, "samplePubSubTopic"); + //EXPECT_EQ(pub_topic.topicDataType, "samplePubSubTopicType"); + EXPECT_EQ(pub_topic.historyQos.kind, KEEP_LAST_HISTORY_QOS); + EXPECT_EQ(pub_topic.historyQos.depth, 50); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_samples, 432); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_instances, 1); + EXPECT_EQ(pub_topic.resourceLimitsQos.max_samples_per_instance, 100); + EXPECT_EQ(pub_topic.resourceLimitsQos.allocated_samples, 123); + EXPECT_EQ(pub_qos.m_durability.kind, TRANSIENT_LOCAL_DURABILITY_QOS); + EXPECT_EQ(pub_qos.m_liveliness.kind, MANUAL_BY_PARTICIPANT_LIVELINESS_QOS); + EXPECT_EQ(pub_qos.m_liveliness.lease_duration.seconds, 1); + EXPECT_EQ(pub_qos.m_liveliness.lease_duration.nanosec, 2u); + EXPECT_EQ(pub_qos.m_liveliness.announcement_period, c_TimeInfinite); + EXPECT_EQ(pub_qos.m_reliability.kind, BEST_EFFORT_RELIABILITY_QOS); + EXPECT_EQ(pub_qos.m_reliability.max_blocking_time, c_TimeZero); + EXPECT_EQ(pub_qos.m_partition.names()[0], "partition_name_a"); + EXPECT_EQ(pub_qos.m_partition.names()[1], "partition_name_b"); + EXPECT_EQ(pub_qos.m_publishMode.kind, ASYNCHRONOUS_PUBLISH_MODE); + EXPECT_EQ(pub_qos.m_publishMode.flow_controller_name, "test_flow_controller"); + EXPECT_EQ(pub_times.initialHeartbeatDelay, c_TimeZero); + EXPECT_EQ(pub_times.heartbeatPeriod.seconds, 11); + EXPECT_EQ(pub_times.heartbeatPeriod.nanosec, 32u); + EXPECT_EQ(pub_times.nackResponseDelay, c_TimeZero); + EXPECT_EQ(pub_times.nackSupressionDuration.seconds, 121); + EXPECT_EQ(pub_times.nackSupressionDuration.nanosec, 332u); + EXPECT_TRUE(publisher_atts.ignore_non_matching_locators); + check_external_locator(publisher_atts.external_unicast_locators, 100, 200, 10, "10.10.10.10", 2001); + IPLocator::setIPv4(locator, 192, 168, 1, 3); + locator.port = 197; + EXPECT_EQ(*(loc_list_it = publisher_atts.unicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 192, 168, 1, 9); + locator.port = 219; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + IPLocator::setIPv4(locator, 239, 255, 0, 1); + locator.port = 2020; + EXPECT_EQ(*(loc_list_it = publisher_atts.multicastLocatorList.begin()), locator); + IPLocator::setIPv4(locator, 0, 0, 0, 0); + locator.port = 0; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + locator.port = 1989; + ++loc_list_it; + EXPECT_EQ(*loc_list_it, locator); + //locator.port = 2021; + //EXPECT_EQ(*(loc_list_it = publisher_atts.outLocatorList.begin()), locator); + //EXPECT_EQ(loc_list_it->get_port(), 2021); + //EXPECT_EQ(publisher_atts.throughputController.bytesPerPeriod, 9236u); + //EXPECT_EQ(publisher_atts.throughputController.periodMillisecs, 234u); + EXPECT_EQ(publisher_atts.historyMemoryPolicy, DYNAMIC_RESERVE_MEMORY_MODE); + EXPECT_EQ(publisher_atts.getUserDefinedID(), 67); + EXPECT_EQ(publisher_atts.getEntityID(), 87); + EXPECT_EQ(publisher_atts.matched_subscriber_allocation, ResourceLimitedContainerConfig::fixed_size_configuration( + 10u)); +} + +/* + * Checks the data writer default profile parsing (with deprecated but supported elements) + */ +TEST_F(XMLProfileParserBasicTests, XMLParserDefaultPublisherProfileDeprecated) +{ + PublisherAttributes publisher_atts; + + ASSERT_EQ( xmlparser::XMLP_ret::XML_OK, + xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) xmlparser::XMLProfileManager::getDefaultPublisherAttributes(publisher_atts); TopicAttributes& pub_topic = publisher_atts.topic; @@ -488,6 +1090,7 @@ TEST_F(XMLProfileParserTests, XMLParserDefaultPublisherProfile) EXPECT_EQ(pub_qos.m_partition.names()[0], "partition_name_a"); EXPECT_EQ(pub_qos.m_partition.names()[1], "partition_name_b"); EXPECT_EQ(pub_qos.m_publishMode.kind, ASYNCHRONOUS_PUBLISH_MODE); + EXPECT_EQ(pub_qos.m_publishMode.flow_controller_name, "test_flow_controller"); EXPECT_EQ(pub_times.initialHeartbeatDelay, c_TimeZero); EXPECT_EQ(pub_times.heartbeatPeriod.seconds, 11); EXPECT_EQ(pub_times.heartbeatPeriod.nanosec, 32u); diff --git a/test/unittest/xmlparser/test_xml_profile.xml b/test/unittest/xmlparser/test_xml_profile.xml new file mode 100644 index 00000000000..7cf1e948169 --- /dev/null +++ b/test/unittest/xmlparser/test_xml_profile.xml @@ -0,0 +1,454 @@ + + + + + + + true + + + -1 + 0 + 0 + -1 + + + -1 + 0 + 0 + -1 + + + + + 123 + + + + 4 + 1 + + + 10 + 20 + 2 + + + 10 + 20 + 2 + + + 10 + 20 + 2 + + + 127 + true + + + + + +
192.168.1.2
+ 2019 +
+
+
+ + + +
239.255.0.1
+ 2021 +
+
+
+ true + + +
10.10.10.10
+ 2001 +
+
+ 32 + 1000 + + + SIMPLE + SIMPLE + FILTER_SAME_PROCESS | FILTER_DIFFERENT_HOST + + 10 + 333 + + + DURATION_INFINITY + + + 2 + + 1 + 827 + + + + false + true + + + false + false + + + +
192.168.1.5
+ 9999 +
+
+ + +
192.168.1.6
+ 6666 +
+
+
+ + + +
239.255.0.2
+ 32 +
+
+ + +
239.255.0.3
+ 2112 +
+
+
+ + +
10.10.10.10
+ 2002 +
+
+ + + +
239.255.0.1
+ 21120 +
+
+
+ PREALLOCATED + PREALLOCATED + 1000 + 2000 + 55 + + true + true + +
+ + 12 + 34 + 56 + 78 + 90 + 123 + 456 + + 9898 + true + ON + test_name + + 56.30.0.ce + + + 12 + 12 + 12 + 12 + + + 12 + 12 + 12 + 12 + + + 12 + 12 + 12 + 12 + + + 12 + 12 + 12 + 12 + + + 12 + 12 + 12 + 12 + + + + test_flow_controller + HIGH_PRIORITY + 2048 + 45 + + 15 + 1048576 + + + +
+
+ + + + + KEEP_LAST + 50 + + + 432 + 1 + 100 + 123 + + + + + TRANSIENT_LOCAL + + + MANUAL_BY_PARTICIPANT + + 1 + 2 + + + DURATION_INFINITY + + + + BEST_EFFORT + + 0 + 0 + + + + + partition_name_a + partition_name_b + + + + ASYNCHRONOUS + test_flow_controller + + + 56.30.0.1 + + + 5.3.1.0 + + + 5.3.1.0.F1 + + + + + 0 + 0 + + + 11 + 32 + + + 0 + 0 + + + 121 + 332 + + + + + +
192.168.1.3
+ 197 +
+
+ + +
192.168.1.9
+ 219 +
+
+
+ + + +
239.255.0.1
+ 2020 +
+
+ + + + + + 1989 + + +
+ true + + +
10.10.10.10
+ 2001 +
+
+ DYNAMIC + 67 + 87 + + 10 + 10 + 0 + +
+ + + + + KEEP_ALL + 1001 + + + 52 + 25 + 32 + 37 + + + + + PERSISTENT + + + MANUAL_BY_TOPIC + + 11 + 22 + + + 0 + 0 + + + + RELIABLE + + DURATION_INFINITY + + + + + partition_name_c + partition_name_d + partition_name_e + partition_name_f + + + + 56.30.0.1 + + + 5.3.1.0 + + + 5.3.1.0.F1 + + + + + 0 + 0 + + + 18 + 81 + + + + + +
192.168.1.10
+ 196 +
+
+ + + 212 + + +
+ + + +
239.255.0.10
+ 220 +
+
+ + + + + + +
239.255.0.11
+ 9891 +
+
+
+ true + + +
10.10.10.10
+ 2001 +
+
+ true + PREALLOCATED_WITH_REALLOC + 13 + 31 + + 10 + 10 + 0 + +
+ + + KEEP_ALL + 1001 + + +
+ + FULL + +
diff --git a/test/unittest/xmlparser/test_xml_profile_env_var.xml b/test/unittest/xmlparser/test_xml_profile_env_var.xml new file mode 100644 index 00000000000..0509fc4386f --- /dev/null +++ b/test/unittest/xmlparser/test_xml_profile_env_var.xml @@ -0,0 +1,456 @@ + + + + + ${XML_PROFILES_ENV_VAR_1} + + + + ${XML_PROFILES_ENV_VAR_2} + ${XML_PROFILES_ENV_VAR_3} + + + ${XML_PROFILES_ENV_VAR_4} + ${XML_PROFILES_ENV_VAR_5} + ${XML_PROFILES_ENV_VAR_6} + + + ${XML_PROFILES_ENV_VAR_7} + ${XML_PROFILES_ENV_VAR_8} + ${XML_PROFILES_ENV_VAR_9} + + + ${XML_PROFILES_ENV_VAR_10} + ${XML_PROFILES_ENV_VAR_11} + ${XML_PROFILES_ENV_VAR_12} + + + ${XML_PROFILES_ENV_VAR_13} + ${XML_PROFILES_ENV_VAR_14} + + + + + +
${XML_PROFILES_ENV_VAR_15}
+ ${XML_PROFILES_ENV_VAR_16} +
+
+
+ + + +
${XML_PROFILES_ENV_VAR_17}
+ ${XML_PROFILES_ENV_VAR_18} +
+
+
+ ${XML_PROFILES_ENV_VAR_19} + + +
${XML_PROFILES_ENV_VAR_20}
+ ${XML_PROFILES_ENV_VAR_21} +
+
+ ${XML_PROFILES_ENV_VAR_22} + ${XML_PROFILES_ENV_VAR_23} + + + ${XML_PROFILES_ENV_VAR_24} + ${XML_PROFILES_ENV_VAR_25} + ${XML_PROFILES_ENV_VAR_26} + + ${XML_PROFILES_ENV_VAR_27} + ${XML_PROFILES_ENV_VAR_28} + + + ${XML_PROFILES_ENV_VAR_29} + + + ${XML_PROFILES_ENV_VAR_30} + + ${XML_PROFILES_ENV_VAR_31} + ${XML_PROFILES_ENV_VAR_32} + + + + ${XML_PROFILES_ENV_VAR_33} + ${XML_PROFILES_ENV_VAR_34} + + + ${XML_PROFILES_ENV_VAR_35} + ${XML_PROFILES_ENV_VAR_36} + + + +
${XML_PROFILES_ENV_VAR_37}
+ ${XML_PROFILES_ENV_VAR_38} +
+
+ + +
${XML_PROFILES_ENV_VAR_39}
+ ${XML_PROFILES_ENV_VAR_40} +
+
+
+ + + +
${XML_PROFILES_ENV_VAR_41}
+ ${XML_PROFILES_ENV_VAR_42} +
+
+ + +
${XML_PROFILES_ENV_VAR_43}
+ ${XML_PROFILES_ENV_VAR_44} +
+
+
+ + +
${XML_PROFILES_ENV_VAR_45}
+ ${XML_PROFILES_ENV_VAR_46} +
+
+ + + +
${XML_PROFILES_ENV_VAR_47}
+ ${XML_PROFILES_ENV_VAR_48} +
+
+
+ ${XML_PROFILES_ENV_VAR_49} + ${XML_PROFILES_ENV_VAR_50} + ${XML_PROFILES_ENV_VAR_51} + ${XML_PROFILES_ENV_VAR_52} + ${XML_PROFILES_ENV_VAR_53} + + ${XML_PROFILES_ENV_VAR_54} + ${XML_PROFILES_ENV_VAR_55} + +
+ + ${XML_PROFILES_ENV_VAR_56} + ${XML_PROFILES_ENV_VAR_57} + ${XML_PROFILES_ENV_VAR_58} + ${XML_PROFILES_ENV_VAR_59} + ${XML_PROFILES_ENV_VAR_60} + ${XML_PROFILES_ENV_VAR_61} + ${XML_PROFILES_ENV_VAR_62} + + ${XML_PROFILES_ENV_VAR_63} + ${XML_PROFILES_ENV_VAR_64} + ${XML_PROFILES_ENV_VAR_162} + ${XML_PROFILES_ENV_VAR_65} + + ${XML_PROFILES_ENV_VAR_66} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + + ${XML_PROFILES_ENV_VAR_163} + ${XML_PROFILES_ENV_VAR_164} + ${XML_PROFILES_ENV_VAR_165} + ${XML_PROFILES_ENV_VAR_166} + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + +
+
+ + + + + ${XML_PROFILES_ENV_VAR_67} + ${XML_PROFILES_ENV_VAR_68} + + + ${XML_PROFILES_ENV_VAR_69} + ${XML_PROFILES_ENV_VAR_70} + ${XML_PROFILES_ENV_VAR_71} + ${XML_PROFILES_ENV_VAR_72} + + + + + ${XML_PROFILES_ENV_VAR_73} + + + ${XML_PROFILES_ENV_VAR_74} + + ${XML_PROFILES_ENV_VAR_75} + ${XML_PROFILES_ENV_VAR_76} + + + ${XML_PROFILES_ENV_VAR_77} + + + + ${XML_PROFILES_ENV_VAR_78} + + ${XML_PROFILES_ENV_VAR_79} + ${XML_PROFILES_ENV_VAR_80} + + + + + ${XML_PROFILES_ENV_VAR_81} + ${XML_PROFILES_ENV_VAR_82} + + + + ${XML_PROFILES_ENV_VAR_83} + ${XML_PROFILES_ENV_VAR_167} + + + ${XML_PROFILES_ENV_VAR_84} + + + ${XML_PROFILES_ENV_VAR_85} + + + ${XML_PROFILES_ENV_VAR_86} + + + + + ${XML_PROFILES_ENV_VAR_87} + ${XML_PROFILES_ENV_VAR_88} + + + ${XML_PROFILES_ENV_VAR_89} + ${XML_PROFILES_ENV_VAR_90} + + + ${XML_PROFILES_ENV_VAR_91} + ${XML_PROFILES_ENV_VAR_92} + + + ${XML_PROFILES_ENV_VAR_93} + ${XML_PROFILES_ENV_VAR_94} + + + + + +
${XML_PROFILES_ENV_VAR_95}
+ ${XML_PROFILES_ENV_VAR_96} +
+
+ + +
${XML_PROFILES_ENV_VAR_97}
+ ${XML_PROFILES_ENV_VAR_98} +
+
+
+ + + +
${XML_PROFILES_ENV_VAR_99}
+ ${XML_PROFILES_ENV_VAR_100} +
+
+ + ${XML_PROFILES_ENV_VAR_101} + + + + ${XML_PROFILES_ENV_VAR_102} + + +
+ ${XML_PROFILES_ENV_VAR_103} + + +
${XML_PROFILES_ENV_VAR_104}
+ ${XML_PROFILES_ENV_VAR_105} +
+
+ ${XML_PROFILES_ENV_VAR_106} + ${XML_PROFILES_ENV_VAR_107} + ${XML_PROFILES_ENV_VAR_108} + + ${XML_PROFILES_ENV_VAR_109} + ${XML_PROFILES_ENV_VAR_110} + ${XML_PROFILES_ENV_VAR_111} + +
+ + + + + ${XML_PROFILES_ENV_VAR_112} + ${XML_PROFILES_ENV_VAR_113} + + + ${XML_PROFILES_ENV_VAR_114} + ${XML_PROFILES_ENV_VAR_115} + ${XML_PROFILES_ENV_VAR_116} + ${XML_PROFILES_ENV_VAR_117} + + + + + ${XML_PROFILES_ENV_VAR_118} + + + ${XML_PROFILES_ENV_VAR_119} + + ${XML_PROFILES_ENV_VAR_120} + ${XML_PROFILES_ENV_VAR_121} + + + ${XML_PROFILES_ENV_VAR_122} + ${XML_PROFILES_ENV_VAR_123} + + + + ${XML_PROFILES_ENV_VAR_124} + + ${XML_PROFILES_ENV_VAR_125} + + + + + ${XML_PROFILES_ENV_VAR_126} + ${XML_PROFILES_ENV_VAR_127} + ${XML_PROFILES_ENV_VAR_128} + ${XML_PROFILES_ENV_VAR_129} + + + + ${XML_PROFILES_ENV_VAR_130} + + + ${XML_PROFILES_ENV_VAR_131} + + + ${XML_PROFILES_ENV_VAR_132} + + + + + ${XML_PROFILES_ENV_VAR_133} + ${XML_PROFILES_ENV_VAR_134} + + + ${XML_PROFILES_ENV_VAR_135} + ${XML_PROFILES_ENV_VAR_136} + + + + + +
${XML_PROFILES_ENV_VAR_137}
+ ${XML_PROFILES_ENV_VAR_138} +
+
+ + + ${XML_PROFILES_ENV_VAR_139} + + +
+ + + +
${XML_PROFILES_ENV_VAR_140}
+ ${XML_PROFILES_ENV_VAR_141} +
+
+ + + + + + +
${XML_PROFILES_ENV_VAR_142}
+ ${XML_PROFILES_ENV_VAR_143} +
+
+
+ ${XML_PROFILES_ENV_VAR_144} + + +
${XML_PROFILES_ENV_VAR_145}
+ ${XML_PROFILES_ENV_VAR_146} +
+
+ ${XML_PROFILES_ENV_VAR_147} + ${XML_PROFILES_ENV_VAR_148} + ${XML_PROFILES_ENV_VAR_149} + ${XML_PROFILES_ENV_VAR_150} + + ${XML_PROFILES_ENV_VAR_151} + ${XML_PROFILES_ENV_VAR_152} + ${XML_PROFILES_ENV_VAR_153} + +
+ + + ${XML_PROFILES_ENV_VAR_154} + ${XML_PROFILES_ENV_VAR_155} + + +
+ + ${XML_PROFILES_ENV_VAR_156} + + + + + ${XML_PROFILES_ENV_VAR_157} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + ${XML_PROFILES_ENV_VAR_158} + ${XML_PROFILES_ENV_VAR_159} + ${XML_PROFILES_ENV_VAR_160} + ${XML_PROFILES_ENV_VAR_161} + + + +
diff --git a/test/unittest/xmlparser/test_xml_profiles.xml b/test/unittest/xmlparser/test_xml_profiles.xml index 5bc68852324..c593fcc0179 100644 --- a/test/unittest/xmlparser/test_xml_profiles.xml +++ b/test/unittest/xmlparser/test_xml_profiles.xml @@ -132,6 +132,20 @@ 2048 45
+ + + test_flow_controller + 2048 + 45 + FIFO + + 12 + 12 + 12 + 12 + + + true test_name @@ -186,6 +200,7 @@ ASYNCHRONOUS + test_flow_controller 56.30.0.1 diff --git a/test/unittest/xmlparser/test_xml_profiles_rooted.xml b/test/unittest/xmlparser/test_xml_profiles_rooted.xml index 0e9d162831d..089fb2cfb31 100644 --- a/test/unittest/xmlparser/test_xml_profiles_rooted.xml +++ b/test/unittest/xmlparser/test_xml_profiles_rooted.xml @@ -120,6 +120,20 @@ 2048 45 + + + test_flow_controller + 2048 + 45 + FIFO + + 12 + 12 + 12 + 12 + + + true test_name diff --git a/test/unittest/xmlparser/wrapper/XMLParserTest.hpp b/test/unittest/xmlparser/wrapper/XMLParserTest.hpp index 2e783109b3c..8ba6e44e2e4 100644 --- a/test/unittest/xmlparser/wrapper/XMLParserTest.hpp +++ b/test/unittest/xmlparser/wrapper/XMLParserTest.hpp @@ -222,6 +222,14 @@ class XMLParserTest : public XMLParser return getXMLThroughputController(elem, throughputController, ident); } + static XMLP_ret getXMLFlowControllerDescriptorList_wrapper( + tinyxml2::XMLElement* elem, + FlowControllerDescriptorList& flow_controller_descriptors, + uint8_t ident) + { + return getXMLFlowControllerDescriptorList(elem, flow_controller_descriptors, ident); + } + static XMLP_ret getXMLTopicAttributes_wrapper( tinyxml2::XMLElement* elem, TopicAttributes& topic, diff --git a/versions.md b/versions.md index 4528fe0ba57..2f8b6ad616a 100644 --- a/versions.md +++ b/versions.md @@ -1,10 +1,17 @@ Forthcoming ----------- +<<<<<<< HEAD Version 2.6.8 ------------- +======= +* Added new `flow_controller_descriptor_list` XML configuration. + +Version 2.14.0 +-------------- +>>>>>>> e6044e011 (Add XML configuration for FlowControllerDescriptor to 2.x (#4893)) * Added authentication handshake properties. * Added `non_blocking_send` to TCP Transport.