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