mgmt: add support for enabling/disabling IPv4 or v6 channels
refs: #1461
Change-Id: I00bda4098c9a7722bce9d498acce339809af3f01
diff --git a/tests/mgmt/face-manager.cpp b/tests/mgmt/face-manager.cpp
index 3b07274..c410878 100644
--- a/tests/mgmt/face-manager.cpp
+++ b/tests/mgmt/face-manager.cpp
@@ -400,6 +400,8 @@
" {\n"
" listen yes\n"
" port 6363\n"
+ " enable_v4 yes\n"
+ " enable_v6 yes\n"
" }\n"
"}\n";
try
@@ -425,6 +427,8 @@
" {\n"
" listen yes\n"
" port 6363\n"
+ " enable_v4 yes\n"
+ " enable_v6 yes\n"
" }\n"
"}\n";
BOOST_CHECK_NO_THROW(parseConfig(CONFIG, true));
@@ -445,6 +449,25 @@
"Invalid value for option \"listen\" in \"tcp\" section"));
}
+BOOST_AUTO_TEST_CASE(TestProcessSectionTcpChannelsDisabled)
+{
+ const std::string CONFIG =
+ "face_system\n"
+ "{\n"
+ " tcp\n"
+ " {\n"
+ " port 6363\n"
+ " enable_v4 no\n"
+ " enable_v6 no\n"
+ " }\n"
+ "}\n";
+ BOOST_CHECK_EXCEPTION(parseConfig(CONFIG, false), ConfigFile::Error,
+ bind(&isExpectedException, _1,
+ "IPv4 and IPv6 channels have been disabled."
+ " Remove \"tcp\" section to disable TCP channels or"
+ " re-enable at least one channel type."));
+}
+
BOOST_AUTO_TEST_CASE(TestProcessSectionTcpUnknownOption)
{
const std::string CONFIG =
@@ -468,6 +491,8 @@
" udp\n"
" {\n"
" port 6363\n"
+ " enable_v4 yes\n"
+ " enable_v6 yes\n"
" idle_timeout 30\n"
" keep_alive_interval 25\n"
" mcast yes\n"
@@ -564,6 +589,55 @@
"Invalid value for option \"mcast_group\" in \"udp\" section"));
}
+BOOST_AUTO_TEST_CASE(TestProcessSectionUdpChannelsDisabled)
+{
+ const std::string CONFIG =
+ "face_system\n"
+ "{\n"
+ " udp\n"
+ " {\n"
+ " port 6363\n"
+ " enable_v4 no\n"
+ " enable_v6 no\n"
+ " idle_timeout 30\n"
+ " keep_alive_interval 25\n"
+ " mcast yes\n"
+ " mcast_port 56363\n"
+ " mcast_group 224.0.23.170\n"
+ " }\n"
+ "}\n";
+ BOOST_CHECK_EXCEPTION(parseConfig(CONFIG, false), ConfigFile::Error,
+ bind(&isExpectedException, _1,
+ "IPv4 and IPv6 channels have been disabled."
+ " Remove \"udp\" section to disable UDP channels or"
+ " re-enable at least one channel type."));
+}
+
+BOOST_AUTO_TEST_CASE(TestProcessSectionUdpConflictingMcast)
+{
+ const std::string CONFIG =
+ "face_system\n"
+ "{\n"
+ " udp\n"
+ " {\n"
+ " port 6363\n"
+ " enable_v4 no\n"
+ " enable_v6 yes\n"
+ " idle_timeout 30\n"
+ " keep_alive_interval 25\n"
+ " mcast yes\n"
+ " mcast_port 56363\n"
+ " mcast_group 224.0.23.170\n"
+ " }\n"
+ "}\n";
+ BOOST_CHECK_EXCEPTION(parseConfig(CONFIG, false), ConfigFile::Error,
+ bind(&isExpectedException, _1,
+ "IPv4 multicast requested, but IPv4 channels"
+ " have been disabled (conflicting configuration options set)"));
+}
+
+
+
BOOST_AUTO_TEST_CASE(TestProcessSectionUdpUnknownOption)
{
const std::string CONFIG =