mgmt: tables.cs_unsolicited_policy config option
This commit introduces tests/check-typeid.hpp which provides
unit testing tools to validate runtime type information.
refs #2181
Change-Id: I987c9875517001ea82878cbe2646839a03ad54f3
diff --git a/daemon/mgmt/tables-config-section.cpp b/daemon/mgmt/tables-config-section.cpp
index 57230cd..2773a24 100644
--- a/daemon/mgmt/tables-config-section.cpp
+++ b/daemon/mgmt/tables-config-section.cpp
@@ -50,6 +50,7 @@
}
m_forwarder.getCs().setLimit(DEFAULT_CS_MAX_PACKETS);
+ m_forwarder.setUnsolicitedDataPolicy(make_unique<fw::DefaultUnsolicitedDataPolicy>());
m_isConfigured = true;
}
@@ -65,6 +66,20 @@
nCsMaxPackets = ConfigFile::parseNumber<size_t>(*csMaxPacketsNode, "cs_max_packets", "tables");
}
+ unique_ptr<fw::UnsolicitedDataPolicy> unsolicitedDataPolicy;
+ OptionalNode unsolicitedDataPolicyNode = section.get_child_optional("cs_unsolicited_policy");
+ if (unsolicitedDataPolicyNode) {
+ std::string policyKey = unsolicitedDataPolicyNode->get_value<std::string>();
+ unsolicitedDataPolicy = fw::makeUnsolicitedDataPolicy(policyKey);
+ if (unsolicitedDataPolicy == nullptr) {
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(
+ "Unknown cs_unsolicited_policy \"" + policyKey + "\" in \"tables\" section"));
+ }
+ }
+ else {
+ unsolicitedDataPolicy = make_unique<fw::DefaultUnsolicitedDataPolicy>();
+ }
+
OptionalNode strategyChoiceSection = section.get_child_optional("strategy_choice");
if (strategyChoiceSection) {
processStrategyChoiceSection(*strategyChoiceSection, isDryRun);
@@ -81,6 +96,8 @@
m_forwarder.getCs().setLimit(nCsMaxPackets);
+ m_forwarder.setUnsolicitedDataPolicy(std::move(unsolicitedDataPolicy));
+
m_isConfigured = true;
}