Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 2 | /* |
Junxiao Shi | 38b24c7 | 2017-01-05 02:59:31 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2017, Regents of the University of California, |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
| 26 | #include "face/udp-factory.hpp" |
| 27 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 28 | #include "face-system-fixture.hpp" |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 29 | #include "factory-test-common.hpp" |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 30 | #include "test-netif-ip.hpp" |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 31 | |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 32 | #include <boost/algorithm/string/replace.hpp> |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 33 | #include <boost/range/algorithm/count_if.hpp> |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 34 | #include <ndn-cxx/net/address-converter.hpp> |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 35 | |
| 36 | namespace nfd { |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 37 | namespace face { |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 38 | namespace tests { |
| 39 | |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 40 | class UdpFactoryFixture : public FaceSystemFactoryFixture<UdpFactory> |
| 41 | { |
| 42 | protected: |
| 43 | shared_ptr<UdpChannel> |
| 44 | createChannel(const std::string& localIp, const std::string& localPort) |
| 45 | { |
| 46 | udp::Endpoint endpoint(ndn::ip::addressFromString(localIp), |
| 47 | boost::lexical_cast<uint16_t>(localPort)); |
| 48 | return factory.createChannel(endpoint, time::minutes(5)); |
| 49 | } |
| 50 | }; |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 51 | |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 52 | BOOST_AUTO_TEST_SUITE(Face) |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 53 | BOOST_FIXTURE_TEST_SUITE(TestUdpFactory, UdpFactoryFixture) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 54 | |
| 55 | using nfd::Face; |
| 56 | |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 57 | BOOST_AUTO_TEST_SUITE(ProcessConfig) |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 58 | |
| 59 | BOOST_AUTO_TEST_CASE(Channels) |
| 60 | { |
| 61 | const std::string CONFIG = R"CONFIG( |
| 62 | face_system |
| 63 | { |
| 64 | udp |
| 65 | { |
| 66 | port 7001 |
| 67 | enable_v4 yes |
| 68 | enable_v6 yes |
| 69 | idle_timeout 30 |
| 70 | mcast no |
| 71 | } |
| 72 | } |
| 73 | )CONFIG"; |
| 74 | |
| 75 | parseConfig(CONFIG, true); |
| 76 | parseConfig(CONFIG, false); |
| 77 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 78 | checkChannelListEqual(factory, {"udp4://0.0.0.0:7001", "udp6://[::]:7001"}); |
| 79 | } |
| 80 | |
| 81 | BOOST_AUTO_TEST_CASE(ChannelV4) |
| 82 | { |
| 83 | const std::string CONFIG = R"CONFIG( |
| 84 | face_system |
| 85 | { |
| 86 | udp |
| 87 | { |
| 88 | port 7001 |
| 89 | enable_v4 yes |
| 90 | enable_v6 no |
| 91 | mcast no |
| 92 | } |
| 93 | } |
| 94 | )CONFIG"; |
| 95 | |
| 96 | parseConfig(CONFIG, true); |
| 97 | parseConfig(CONFIG, false); |
| 98 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 99 | checkChannelListEqual(factory, {"udp4://0.0.0.0:7001"}); |
| 100 | } |
| 101 | |
| 102 | BOOST_AUTO_TEST_CASE(ChannelV6) |
| 103 | { |
| 104 | const std::string CONFIG = R"CONFIG( |
| 105 | face_system |
| 106 | { |
| 107 | udp |
| 108 | { |
| 109 | port 7001 |
| 110 | enable_v4 no |
| 111 | enable_v6 yes |
| 112 | mcast no |
| 113 | } |
| 114 | } |
| 115 | )CONFIG"; |
| 116 | |
| 117 | parseConfig(CONFIG, true); |
| 118 | parseConfig(CONFIG, false); |
| 119 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 120 | checkChannelListEqual(factory, {"udp6://[::]:7001"}); |
| 121 | } |
| 122 | |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 123 | class UdpMcastConfigFixture : public UdpFactoryFixture |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 124 | { |
| 125 | protected: |
| 126 | UdpMcastConfigFixture() |
| 127 | { |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 128 | for (const auto& netif : collectNetworkInterfaces()) { |
| 129 | if (netif->isUp() && netif->canMulticast() && hasAddressFamily<AddressFamily::V4>(*netif)) { |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 130 | netifs.push_back(netif); |
| 131 | } |
| 132 | } |
Junxiao Shi | 79a9208 | 2017-08-08 02:40:59 +0000 | [diff] [blame] | 133 | |
| 134 | this->copyRealNetifsToNetmon(); |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | std::vector<const Face*> |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 138 | listUdpMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 139 | { |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 140 | return this->listFacesByScheme("udp4", linkType); |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | size_t |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 144 | countUdpMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 145 | { |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 146 | return this->listUdpMcastFaces(linkType).size(); |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 149 | /** \brief determine whether a UDP multicast face is created on \p netif |
| 150 | */ |
| 151 | static bool |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 152 | isFaceOnNetif(const Face& face, const shared_ptr<const ndn::net::NetworkInterface>& netif) |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 153 | { |
| 154 | auto ip = boost::asio::ip::address_v4::from_string(face.getLocalUri().getHost()); |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 155 | return std::any_of(netif->getNetworkAddresses().begin(), netif->getNetworkAddresses().end(), |
| 156 | [ip] (const ndn::net::NetworkAddress& a) { return a.getIp() == ip; }); |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 159 | protected: |
| 160 | /** \brief MulticastUdpTransport-capable network interfaces |
| 161 | */ |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 162 | std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs; |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | #define SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(n) \ |
| 166 | do { \ |
| 167 | if (this->netifs.size() < (n)) { \ |
| 168 | BOOST_WARN_MESSAGE(false, "skipping assertions that require " #n \ |
| 169 | " or more MulticastUdpTransport-capable network interfaces"); \ |
| 170 | return; \ |
| 171 | } \ |
| 172 | } while (false) |
| 173 | |
| 174 | BOOST_FIXTURE_TEST_CASE(EnableDisableMcast, UdpMcastConfigFixture) |
| 175 | { |
| 176 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 177 | // need superuser privilege for creating multicast faces on Linux |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 178 | SKIP_IF_NOT_SUPERUSER(); |
| 179 | #endif // __linux__ |
| 180 | |
| 181 | const std::string CONFIG_WITH_MCAST = R"CONFIG( |
| 182 | face_system |
| 183 | { |
| 184 | udp |
| 185 | { |
| 186 | mcast yes |
| 187 | } |
| 188 | } |
| 189 | )CONFIG"; |
| 190 | const std::string CONFIG_WITHOUT_MCAST = R"CONFIG( |
| 191 | face_system |
| 192 | { |
| 193 | udp |
| 194 | { |
| 195 | mcast no |
| 196 | } |
| 197 | } |
| 198 | )CONFIG"; |
| 199 | |
| 200 | parseConfig(CONFIG_WITHOUT_MCAST, false); |
| 201 | BOOST_CHECK_EQUAL(this->countUdpMcastFaces(), 0); |
| 202 | |
| 203 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(1); |
| 204 | |
| 205 | parseConfig(CONFIG_WITH_MCAST, false); |
| 206 | g_io.poll(); |
| 207 | BOOST_CHECK_EQUAL(this->countUdpMcastFaces(), netifs.size()); |
| 208 | |
| 209 | parseConfig(CONFIG_WITHOUT_MCAST, false); |
| 210 | g_io.poll(); |
| 211 | BOOST_CHECK_EQUAL(this->countUdpMcastFaces(), 0); |
| 212 | } |
| 213 | |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 214 | BOOST_FIXTURE_TEST_CASE(McastAdHoc, UdpMcastConfigFixture) |
| 215 | { |
| 216 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 217 | // need superuser privilege for creating multicast faces on Linux |
Teng Liang | fe4fce3 | 2017-03-29 04:49:38 +0000 | [diff] [blame] | 218 | SKIP_IF_NOT_SUPERUSER(); |
| 219 | #endif // __linux__ |
| 220 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(1); |
| 221 | |
| 222 | const std::string CONFIG = R"CONFIG( |
| 223 | face_system |
| 224 | { |
| 225 | udp |
| 226 | { |
| 227 | mcast_ad_hoc yes |
| 228 | } |
| 229 | } |
| 230 | )CONFIG"; |
| 231 | |
| 232 | parseConfig(CONFIG, false); |
| 233 | BOOST_CHECK_EQUAL(this->countUdpMcastFaces(ndn::nfd::LINK_TYPE_AD_HOC), netifs.size()); |
| 234 | } |
| 235 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 236 | BOOST_FIXTURE_TEST_CASE(ChangeMcastEndpoint, UdpMcastConfigFixture) |
| 237 | { |
| 238 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 239 | // need superuser privilege for creating multicast faces on Linux |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 240 | SKIP_IF_NOT_SUPERUSER(); |
| 241 | #endif // __linux__ |
| 242 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(1); |
| 243 | |
| 244 | const std::string CONFIG1 = R"CONFIG( |
| 245 | face_system |
| 246 | { |
| 247 | udp |
| 248 | { |
| 249 | mcast_group 239.66.30.1 |
| 250 | mcast_port 7011 |
| 251 | } |
| 252 | } |
| 253 | )CONFIG"; |
| 254 | const std::string CONFIG2 = R"CONFIG( |
| 255 | face_system |
| 256 | { |
| 257 | udp |
| 258 | { |
| 259 | mcast_group 239.66.30.2 |
| 260 | mcast_port 7012 |
| 261 | } |
| 262 | } |
| 263 | )CONFIG"; |
| 264 | |
| 265 | parseConfig(CONFIG1, false); |
| 266 | auto udpMcastFaces = this->listUdpMcastFaces(); |
| 267 | BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), netifs.size()); |
| 268 | BOOST_CHECK_EQUAL(udpMcastFaces.front()->getRemoteUri(), |
| 269 | FaceUri("udp4://239.66.30.1:7011")); |
| 270 | |
| 271 | parseConfig(CONFIG2, false); |
| 272 | g_io.poll(); |
| 273 | udpMcastFaces = this->listUdpMcastFaces(); |
| 274 | BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), netifs.size()); |
| 275 | BOOST_CHECK_EQUAL(udpMcastFaces.front()->getRemoteUri(), |
| 276 | FaceUri("udp4://239.66.30.2:7012")); |
| 277 | } |
| 278 | |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 279 | BOOST_FIXTURE_TEST_CASE(Whitelist, UdpMcastConfigFixture) |
| 280 | { |
| 281 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 282 | // need superuser privilege for creating multicast faces on Linux |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 283 | SKIP_IF_NOT_SUPERUSER(); |
| 284 | #endif // __linux__ |
| 285 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(1); |
| 286 | |
| 287 | std::string CONFIG = R"CONFIG( |
| 288 | face_system |
| 289 | { |
| 290 | udp |
| 291 | { |
| 292 | whitelist |
| 293 | { |
| 294 | ifname %ifname |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | )CONFIG"; |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 299 | boost::replace_first(CONFIG, "%ifname", netifs.front()->getName()); |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 300 | |
| 301 | parseConfig(CONFIG, false); |
| 302 | auto udpMcastFaces = this->listUdpMcastFaces(); |
| 303 | BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), 1); |
| 304 | BOOST_CHECK(isFaceOnNetif(*udpMcastFaces.front(), netifs.front())); |
| 305 | } |
| 306 | |
| 307 | BOOST_FIXTURE_TEST_CASE(Blacklist, UdpMcastConfigFixture) |
| 308 | { |
| 309 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 310 | // need superuser privilege for creating multicast faces on Linux |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 311 | SKIP_IF_NOT_SUPERUSER(); |
| 312 | #endif // __linux__ |
| 313 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(1); |
| 314 | |
| 315 | std::string CONFIG = R"CONFIG( |
| 316 | face_system |
| 317 | { |
| 318 | udp |
| 319 | { |
| 320 | blacklist |
| 321 | { |
| 322 | ifname %ifname |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | )CONFIG"; |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 327 | boost::replace_first(CONFIG, "%ifname", netifs.front()->getName()); |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 328 | |
| 329 | parseConfig(CONFIG, false); |
| 330 | auto udpMcastFaces = this->listUdpMcastFaces(); |
| 331 | BOOST_CHECK_EQUAL(udpMcastFaces.size(), netifs.size() - 1); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 332 | BOOST_CHECK_EQUAL(boost::count_if(udpMcastFaces, [this] (const Face* face) { |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 333 | return isFaceOnNetif(*face, netifs.front()); |
| 334 | }), 0); |
| 335 | } |
| 336 | |
| 337 | BOOST_FIXTURE_TEST_CASE(ChangePredicate, UdpMcastConfigFixture) |
| 338 | { |
| 339 | #ifdef __linux__ |
Junxiao Shi | bbace1d | 2017-08-06 20:03:37 +0000 | [diff] [blame] | 340 | // need superuser privilege for creating multicast faces on Linux |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 341 | SKIP_IF_NOT_SUPERUSER(); |
| 342 | #endif // __linux__ |
| 343 | SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(2); |
| 344 | |
| 345 | std::string CONFIG1 = R"CONFIG( |
| 346 | face_system |
| 347 | { |
| 348 | udp |
| 349 | { |
| 350 | whitelist |
| 351 | { |
| 352 | ifname %ifname |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | )CONFIG"; |
| 357 | std::string CONFIG2 = CONFIG1; |
Junxiao Shi | 84d62cb | 2017-07-12 16:15:18 +0000 | [diff] [blame] | 358 | boost::replace_first(CONFIG1, "%ifname", netifs.front()->getName()); |
| 359 | boost::replace_first(CONFIG2, "%ifname", netifs.back()->getName()); |
Junxiao Shi | c31080d | 2017-01-24 15:10:12 +0000 | [diff] [blame] | 360 | |
| 361 | parseConfig(CONFIG1, false); |
| 362 | auto udpMcastFaces = this->listUdpMcastFaces(); |
| 363 | BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), 1); |
| 364 | BOOST_CHECK(isFaceOnNetif(*udpMcastFaces.front(), netifs.front())); |
| 365 | |
| 366 | parseConfig(CONFIG2, false); |
| 367 | g_io.poll(); |
| 368 | udpMcastFaces = this->listUdpMcastFaces(); |
| 369 | BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), 1); |
| 370 | BOOST_CHECK(isFaceOnNetif(*udpMcastFaces.front(), netifs.back())); |
| 371 | } |
| 372 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 373 | BOOST_AUTO_TEST_CASE(Omitted) |
| 374 | { |
| 375 | const std::string CONFIG = R"CONFIG( |
| 376 | face_system |
| 377 | { |
| 378 | } |
| 379 | )CONFIG"; |
| 380 | |
| 381 | parseConfig(CONFIG, true); |
| 382 | parseConfig(CONFIG, false); |
| 383 | |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 384 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 385 | BOOST_CHECK_EQUAL(this->listFacesByScheme("udp4", ndn::nfd::LINK_TYPE_MULTI_ACCESS).size(), 0); |
| 386 | } |
| 387 | |
| 388 | BOOST_AUTO_TEST_CASE(BadIdleTimeout) |
| 389 | { |
| 390 | const std::string CONFIG = R"CONFIG( |
| 391 | face_system |
| 392 | { |
| 393 | udp |
| 394 | { |
| 395 | idle_timeout hello |
| 396 | } |
| 397 | } |
| 398 | )CONFIG"; |
| 399 | |
| 400 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 401 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 402 | } |
| 403 | |
| 404 | BOOST_AUTO_TEST_CASE(BadMcast) |
| 405 | { |
| 406 | const std::string CONFIG = R"CONFIG( |
| 407 | face_system |
| 408 | { |
| 409 | udp |
| 410 | { |
| 411 | mcast hello |
| 412 | } |
| 413 | } |
| 414 | )CONFIG"; |
| 415 | |
| 416 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 417 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 418 | } |
| 419 | |
| 420 | BOOST_AUTO_TEST_CASE(BadMcastGroup) |
| 421 | { |
| 422 | const std::string CONFIG = R"CONFIG( |
| 423 | face_system |
| 424 | { |
| 425 | udp |
| 426 | { |
| 427 | mcast_group hello |
| 428 | } |
| 429 | } |
| 430 | )CONFIG"; |
| 431 | |
| 432 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 433 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 434 | } |
| 435 | |
| 436 | BOOST_AUTO_TEST_CASE(BadMcastGroupV4Unicast) |
| 437 | { |
| 438 | const std::string CONFIG = R"CONFIG( |
| 439 | face_system |
| 440 | { |
| 441 | udp |
| 442 | { |
| 443 | mcast_group 10.0.0.1 |
| 444 | } |
| 445 | } |
| 446 | )CONFIG"; |
| 447 | |
| 448 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 449 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 450 | } |
| 451 | |
| 452 | BOOST_AUTO_TEST_CASE(BadMcastGroupV6) |
| 453 | { |
| 454 | const std::string CONFIG = R"CONFIG( |
| 455 | face_system |
| 456 | { |
| 457 | udp |
| 458 | { |
| 459 | mcast_group ff00::1 |
| 460 | } |
| 461 | } |
| 462 | )CONFIG"; |
| 463 | |
| 464 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 465 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 466 | } |
| 467 | |
| 468 | BOOST_AUTO_TEST_CASE(AllDisabled) |
| 469 | { |
| 470 | const std::string CONFIG = R"CONFIG( |
| 471 | face_system |
| 472 | { |
| 473 | udp |
| 474 | { |
| 475 | enable_v4 no |
| 476 | enable_v6 no |
| 477 | mcast no |
| 478 | } |
| 479 | } |
| 480 | )CONFIG"; |
| 481 | |
| 482 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 483 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 484 | } |
| 485 | |
| 486 | BOOST_AUTO_TEST_CASE(UnknownOption) |
| 487 | { |
| 488 | const std::string CONFIG = R"CONFIG( |
| 489 | face_system |
| 490 | { |
| 491 | udp |
| 492 | { |
| 493 | hello |
| 494 | } |
| 495 | } |
| 496 | )CONFIG"; |
| 497 | |
| 498 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 499 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 500 | } |
| 501 | |
| 502 | BOOST_AUTO_TEST_SUITE_END() // ProcessConfig |
| 503 | |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 504 | BOOST_AUTO_TEST_CASE(GetChannels) |
| 505 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 506 | BOOST_CHECK_EQUAL(factory.getChannels().empty(), true); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 507 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 508 | std::set<std::string> expected; |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 509 | expected.insert(createChannel("127.0.0.1", "20070")->getUri().toString()); |
| 510 | expected.insert(createChannel("127.0.0.1", "20071")->getUri().toString()); |
| 511 | expected.insert(createChannel("::1", "20071")->getUri().toString()); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 512 | checkChannelListEqual(factory, expected); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 513 | } |
| 514 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 515 | BOOST_AUTO_TEST_CASE(CreateChannel) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 516 | { |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 517 | auto channel1 = createChannel("127.0.0.1", "20070"); |
| 518 | auto channel1a = createChannel("127.0.0.1", "20070"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 519 | BOOST_CHECK_EQUAL(channel1, channel1a); |
| 520 | BOOST_CHECK_EQUAL(channel1->getUri().toString(), "udp4://127.0.0.1:20070"); |
| 521 | |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 522 | auto channel2 = createChannel("127.0.0.1", "20071"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 523 | BOOST_CHECK_NE(channel1, channel2); |
| 524 | |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 525 | auto channel3 = createChannel("::1", "20071"); |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 526 | BOOST_CHECK_NE(channel2, channel3); |
| 527 | BOOST_CHECK_EQUAL(channel3->getUri().toString(), "udp6://[::1]:20071"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 528 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 529 | // createChannel with multicast address |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 530 | BOOST_CHECK_EXCEPTION(createChannel("224.0.0.1", "20070"), UdpFactory::Error, |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 531 | [] (const UdpFactory::Error& e) { |
| 532 | return strcmp(e.what(), |
| 533 | "createChannel is only for unicast channels. The provided endpoint " |
| 534 | "is multicast. Use createMulticastFace to create a multicast face") == 0; |
| 535 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 536 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 537 | // createChannel with a local endpoint that has already been allocated for a UDP multicast face |
| 538 | auto multicastFace = factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20072"); |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 539 | BOOST_CHECK_EXCEPTION(createChannel("127.0.0.1", "20072"), UdpFactory::Error, |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 540 | [] (const UdpFactory::Error& e) { |
| 541 | return strcmp(e.what(), |
| 542 | "Cannot create the requested UDP unicast channel, local " |
| 543 | "endpoint is already allocated for a UDP multicast face") == 0; |
| 544 | }); |
| 545 | } |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 546 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 547 | BOOST_AUTO_TEST_CASE(CreateMulticastFace) |
| 548 | { |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 549 | auto multicastFace1 = factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20070"); |
| 550 | auto multicastFace1a = factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20070"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 551 | BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a); |
| 552 | |
Davide Pesavento | eee53aa | 2016-04-11 17:20:21 +0200 | [diff] [blame] | 553 | // createMulticastFace with a local endpoint that is already used by a channel |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 554 | auto channel = createChannel("127.0.0.1", "20071"); |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 555 | BOOST_CHECK_EXCEPTION(factory.createMulticastFace("127.0.0.1", "224.0.0.1", "20071"), UdpFactory::Error, |
| 556 | [] (const UdpFactory::Error& e) { |
| 557 | return strcmp(e.what(), |
| 558 | "Cannot create the requested UDP multicast face, local " |
| 559 | "endpoint is already allocated for a UDP unicast channel") == 0; |
| 560 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 561 | |
Davide Pesavento | eee53aa | 2016-04-11 17:20:21 +0200 | [diff] [blame] | 562 | // createMulticastFace with a local endpoint that is already |
| 563 | // used by a multicast face on a different multicast group |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 564 | BOOST_CHECK_EXCEPTION(factory.createMulticastFace("127.0.0.1", "224.0.0.42", "20070"), UdpFactory::Error, |
| 565 | [] (const UdpFactory::Error& e) { |
| 566 | return strcmp(e.what(), |
| 567 | "Cannot create the requested UDP multicast face, local " |
| 568 | "endpoint is already allocated for a UDP multicast face " |
| 569 | "on a different multicast group") == 0; |
| 570 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 571 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 572 | // createMulticastFace with an IPv4 unicast address |
| 573 | BOOST_CHECK_EXCEPTION(factory.createMulticastFace("127.0.0.1", "192.168.10.15", "20072"), UdpFactory::Error, |
| 574 | [] (const UdpFactory::Error& e) { |
| 575 | return strcmp(e.what(), |
| 576 | "Cannot create the requested UDP multicast face, " |
| 577 | "the multicast group given as input is not a multicast address") == 0; |
| 578 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 579 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 580 | // createMulticastFace with an IPv6 multicast address |
| 581 | BOOST_CHECK_EXCEPTION(factory.createMulticastFace("::1", "ff01::114", "20073"), UdpFactory::Error, |
| 582 | [] (const UdpFactory::Error& e) { |
| 583 | return strcmp(e.what(), |
| 584 | "IPv6 multicast is not supported yet. Please provide an IPv4 " |
| 585 | "address") == 0; |
| 586 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 587 | |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 588 | // createMulticastFace with different local and remote port numbers |
Davide Pesavento | eee53aa | 2016-04-11 17:20:21 +0200 | [diff] [blame] | 589 | udp::Endpoint localEndpoint(boost::asio::ip::address_v4::loopback(), 20074); |
| 590 | udp::Endpoint multicastEndpoint(boost::asio::ip::address::from_string("224.0.0.1"), 20075); |
Weiwei Liu | 72cee94 | 2016-02-04 16:49:19 -0700 | [diff] [blame] | 591 | BOOST_CHECK_EXCEPTION(factory.createMulticastFace(localEndpoint, multicastEndpoint), UdpFactory::Error, |
| 592 | [] (const UdpFactory::Error& e) { |
| 593 | return strcmp(e.what(), |
| 594 | "Cannot create the requested UDP multicast face, " |
| 595 | "both endpoints should have the same port number. ") == 0; |
| 596 | }); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 597 | } |
| 598 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 599 | BOOST_AUTO_TEST_CASE(CreateFace) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 600 | { |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 601 | createFace(factory, |
| 602 | FaceUri("udp4://127.0.0.1:6363"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 603 | {}, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 604 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 605 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 606 | false, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 607 | {CreateFaceExpectedResult::FAILURE, 504, "No channels available to connect"}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 608 | |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 609 | createChannel("127.0.0.1", "20071"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 610 | |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 611 | createFace(factory, |
Davide Pesavento | a3c9ddb | 2017-04-10 22:15:24 -0400 | [diff] [blame] | 612 | FaceUri("udp4://127.0.0.1:6363"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 613 | {}, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 614 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 615 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 616 | false, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 617 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 618 | |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 619 | createFace(factory, |
Davide Pesavento | a3c9ddb | 2017-04-10 22:15:24 -0400 | [diff] [blame] | 620 | FaceUri("udp4://127.0.0.1:6363"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 621 | {}, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 622 | ndn::nfd::FACE_PERSISTENCY_PERMANENT, |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 623 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 624 | false, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 625 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 626 | |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 627 | createFace(factory, |
| 628 | FaceUri("udp4://127.0.0.1:20072"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 629 | {}, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 630 | ndn::nfd::FACE_PERSISTENCY_PERMANENT, |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 631 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 632 | false, |
| 633 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 634 | |
| 635 | |
| 636 | createFace(factory, |
| 637 | FaceUri("udp4://127.0.0.1:20073"), |
| 638 | {}, |
| 639 | ndn::nfd::FACE_PERSISTENCY_PERMANENT, |
| 640 | false, |
| 641 | true, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 642 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 643 | } |
| 644 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 645 | BOOST_AUTO_TEST_CASE(UnsupportedCreateFace) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 646 | { |
Davide Pesavento | 4b89a6e | 2017-10-07 15:29:50 -0400 | [diff] [blame^] | 647 | createChannel("127.0.0.1", "20071"); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 648 | |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 649 | createFace(factory, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 650 | FaceUri("udp4://127.0.0.1:20072"), |
Davide Pesavento | a3c9ddb | 2017-04-10 22:15:24 -0400 | [diff] [blame] | 651 | FaceUri("udp4://127.0.0.1:20071"), |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 652 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
| 653 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 654 | false, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 655 | {CreateFaceExpectedResult::FAILURE, 406, |
| 656 | "Unicast UDP faces cannot be created with a LocalUri"}); |
| 657 | |
| 658 | createFace(factory, |
| 659 | FaceUri("udp4://127.0.0.1:20072"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 660 | {}, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 661 | ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 662 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 663 | false, |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 664 | {CreateFaceExpectedResult::FAILURE, 406, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 665 | "Outgoing UDP faces do not support on-demand persistency"}); |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 666 | |
| 667 | createFace(factory, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 668 | FaceUri("udp4://233.252.0.1:23252"), |
| 669 | {}, |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 670 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
| 671 | false, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 672 | false, |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 673 | {CreateFaceExpectedResult::FAILURE, 406, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 674 | "Cannot create multicast UDP faces"}); |
| 675 | |
| 676 | createFace(factory, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 677 | FaceUri("udp4://127.0.0.1:20072"), |
| 678 | {}, |
| 679 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
| 680 | true, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 681 | false, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 682 | {CreateFaceExpectedResult::FAILURE, 406, |
| 683 | "Local fields can only be enabled on faces with local scope"}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 684 | } |
| 685 | |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 686 | BOOST_AUTO_TEST_SUITE_END() // TestUdpFactory |
| 687 | BOOST_AUTO_TEST_SUITE_END() // Face |
| 688 | |
| 689 | } // namespace tests |
Junxiao Shi | 64d99f2 | 2017-01-21 23:06:36 +0000 | [diff] [blame] | 690 | } // namespace face |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 691 | } // namespace nfd |