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 | /* |
Davide Pesavento | d7083a5 | 2023-10-19 17:51:16 -0400 | [diff] [blame] | 3 | * Copyright (c) 2014-2023, 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/ethernet-factory.hpp" |
| 27 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 28 | #include "ethernet-fixture.hpp" |
| 29 | #include "face-system-fixture.hpp" |
Junxiao Shi | 79a9208 | 2017-08-08 02:40:59 +0000 | [diff] [blame] | 30 | #include "factory-test-common.hpp" |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 31 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 32 | #include <boost/algorithm/string/replace.hpp> |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 33 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 34 | namespace nfd::tests { |
| 35 | |
| 36 | using face::EthernetFactory; |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 37 | |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 38 | class EthernetFactoryFixture : public EthernetFixture |
| 39 | , public FaceSystemFactoryFixture<EthernetFactory> |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 40 | { |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 41 | protected: |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 42 | std::set<std::string> |
| 43 | listUrisOfAvailableNetifs() const |
| 44 | { |
| 45 | std::set<std::string> uris; |
| 46 | std::transform(netifs.begin(), netifs.end(), std::inserter(uris, uris.end()), |
Davide Pesavento | d7083a5 | 2023-10-19 17:51:16 -0400 | [diff] [blame] | 47 | [] (const auto& netif) { return FaceUri::fromDev(netif->getName()).toString(); }); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 48 | return uris; |
| 49 | } |
| 50 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 51 | std::vector<const Face*> |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 52 | listEtherMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 53 | { |
Davide Pesavento | d7083a5 | 2023-10-19 17:51:16 -0400 | [diff] [blame] | 54 | return listFacesByScheme("ether", linkType); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 55 | } |
| 56 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 57 | shared_ptr<ndn::net::NetworkInterface> |
| 58 | makeFakeNetif() |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 59 | { |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 60 | static int counter = 0; |
| 61 | ++counter; |
| 62 | |
| 63 | auto netif = netmon->makeNetworkInterface(); |
| 64 | netif->setIndex(1000 + counter); |
| 65 | netif->setName("ethdummy" + std::to_string(counter)); |
| 66 | netif->setType(ndn::net::InterfaceType::ETHERNET); |
| 67 | netif->setFlags(IFF_MULTICAST | IFF_UP); |
| 68 | netif->setState(ndn::net::InterfaceState::RUNNING); |
| 69 | netif->setMtu(1500); |
| 70 | netif->setEthernetAddress(ethernet::Address{0x00, 0x00, 0x5e, 0x00, 0x53, 0x5e}); |
| 71 | return netif; |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | class EthernetFactoryFixtureWithRealNetifs : public EthernetFactoryFixture |
| 76 | { |
| 77 | protected: |
| 78 | EthernetFactoryFixtureWithRealNetifs() |
| 79 | { |
| 80 | copyRealNetifsToNetmon(); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 81 | } |
| 82 | }; |
| 83 | |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 84 | BOOST_AUTO_TEST_SUITE(Face) |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 85 | BOOST_AUTO_TEST_SUITE(TestEthernetFactory) |
Junxiao Shi | 0ba6d64 | 2017-07-17 00:53:22 +0000 | [diff] [blame] | 86 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 87 | BOOST_FIXTURE_TEST_SUITE(ProcessConfig, EthernetFactoryFixtureWithRealNetifs) |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 88 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 89 | BOOST_AUTO_TEST_CASE(Defaults) |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 90 | { |
| 91 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 92 | |
| 93 | const std::string CONFIG = R"CONFIG( |
| 94 | face_system |
| 95 | { |
| 96 | ether |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 97 | } |
| 98 | )CONFIG"; |
| 99 | |
| 100 | parseConfig(CONFIG, true); |
| 101 | parseConfig(CONFIG, false); |
| 102 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 103 | checkChannelListEqual(factory, this->listUrisOfAvailableNetifs()); |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 104 | auto channels = factory.getChannels(); |
| 105 | BOOST_CHECK(std::all_of(channels.begin(), channels.end(), |
Davide Pesavento | d27841b | 2018-11-13 00:22:24 -0500 | [diff] [blame] | 106 | [] (const auto& ch) { return ch->isListening(); })); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 107 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), netifs.size()); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 108 | } |
| 109 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 110 | BOOST_AUTO_TEST_CASE(DisableListenAndMcast) |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 111 | { |
| 112 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 113 | |
| 114 | const std::string CONFIG = R"CONFIG( |
| 115 | face_system |
| 116 | { |
| 117 | ether |
| 118 | { |
| 119 | listen no |
| 120 | idle_timeout 60 |
| 121 | mcast no |
| 122 | } |
| 123 | } |
| 124 | )CONFIG"; |
| 125 | |
| 126 | parseConfig(CONFIG, true); |
| 127 | parseConfig(CONFIG, false); |
| 128 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 129 | checkChannelListEqual(factory, this->listUrisOfAvailableNetifs()); |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 130 | auto channels = factory.getChannels(); |
| 131 | BOOST_CHECK(std::none_of(channels.begin(), channels.end(), |
Davide Pesavento | d27841b | 2018-11-13 00:22:24 -0500 | [diff] [blame] | 132 | [] (const auto& ch) { return ch->isListening(); })); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 133 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 134 | } |
| 135 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 136 | BOOST_AUTO_TEST_CASE(McastNormal) |
| 137 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 138 | const std::string CONFIG = R"CONFIG( |
| 139 | face_system |
| 140 | { |
| 141 | ether |
| 142 | { |
| 143 | listen no |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 144 | mcast yes |
| 145 | mcast_group 01:00:5E:00:17:AA |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 146 | mcast_ad_hoc no |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 147 | whitelist |
| 148 | { |
| 149 | * |
| 150 | } |
| 151 | blacklist |
| 152 | { |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | )CONFIG"; |
| 157 | |
Junxiao Shi | 1b65ca1 | 2017-01-21 23:04:41 +0000 | [diff] [blame] | 158 | parseConfig(CONFIG, true); |
| 159 | parseConfig(CONFIG, false); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 160 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 161 | auto etherMcastFaces = this->listEtherMcastFaces(); |
| 162 | BOOST_CHECK_EQUAL(etherMcastFaces.size(), netifs.size()); |
| 163 | for (const auto* face : etherMcastFaces) { |
Alexander Afanasyev | 3a2339a | 2020-05-27 23:05:06 -0400 | [diff] [blame] | 164 | BOOST_REQUIRE(face->getChannel().lock()); |
| 165 | // not universal, but for Ethernet, local URI of a mcast face matches URI of the associated channel |
| 166 | BOOST_CHECK_EQUAL(face->getLocalUri(), face->getChannel().lock()->getUri()); |
| 167 | } |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 168 | } |
| 169 | |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 170 | BOOST_AUTO_TEST_CASE(EnableDisableMcast) |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 171 | { |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 172 | const std::string CONFIG_WITH_MCAST = R"CONFIG( |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 173 | face_system |
| 174 | { |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 175 | ether |
| 176 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 177 | listen no |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 178 | mcast yes |
| 179 | } |
| 180 | } |
| 181 | )CONFIG"; |
| 182 | const std::string CONFIG_WITHOUT_MCAST = R"CONFIG( |
| 183 | face_system |
| 184 | { |
| 185 | ether |
| 186 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 187 | listen no |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 188 | mcast no |
| 189 | } |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 190 | } |
| 191 | )CONFIG"; |
| 192 | |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 193 | parseConfig(CONFIG_WITHOUT_MCAST, false); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 194 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 195 | |
| 196 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 197 | |
| 198 | parseConfig(CONFIG_WITH_MCAST, false); |
| 199 | g_io.poll(); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 200 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), netifs.size()); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 201 | |
| 202 | parseConfig(CONFIG_WITHOUT_MCAST, false); |
| 203 | g_io.poll(); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 204 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | BOOST_AUTO_TEST_CASE(McastAdHoc) |
| 208 | { |
| 209 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 210 | |
| 211 | const std::string CONFIG = R"CONFIG( |
| 212 | face_system |
| 213 | { |
| 214 | ether |
| 215 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 216 | listen no |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 217 | mcast_ad_hoc yes |
| 218 | } |
| 219 | } |
| 220 | )CONFIG"; |
| 221 | |
| 222 | parseConfig(CONFIG, false); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 223 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces(ndn::nfd::LINK_TYPE_MULTI_ACCESS).size(), 0); |
| 224 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces(ndn::nfd::LINK_TYPE_AD_HOC).size(), netifs.size()); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | BOOST_AUTO_TEST_CASE(ChangeMcastGroup) |
| 228 | { |
| 229 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 230 | |
| 231 | const std::string CONFIG1 = R"CONFIG( |
| 232 | face_system |
| 233 | { |
| 234 | ether |
| 235 | { |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame] | 236 | mcast_group 01:00:5e:90:10:01 |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 237 | } |
| 238 | } |
| 239 | )CONFIG"; |
| 240 | const std::string CONFIG2 = R"CONFIG( |
| 241 | face_system |
| 242 | { |
| 243 | ether |
| 244 | { |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame] | 245 | mcast_group 01:00:5e:90:10:02 |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 246 | } |
| 247 | } |
| 248 | )CONFIG"; |
| 249 | |
| 250 | parseConfig(CONFIG1, false); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 251 | g_io.poll(); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 252 | auto etherMcastFaces = this->listEtherMcastFaces(); |
| 253 | BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), netifs.size()); |
| 254 | BOOST_CHECK_EQUAL(etherMcastFaces.front()->getRemoteUri(), |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame] | 255 | FaceUri(ethernet::Address{0x01, 0x00, 0x5e, 0x90, 0x10, 0x01})); |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 256 | |
| 257 | parseConfig(CONFIG2, false); |
| 258 | g_io.poll(); |
| 259 | etherMcastFaces = this->listEtherMcastFaces(); |
| 260 | BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), netifs.size()); |
| 261 | BOOST_CHECK_EQUAL(etherMcastFaces.front()->getRemoteUri(), |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame] | 262 | FaceUri(ethernet::Address{0x01, 0x00, 0x5e, 0x90, 0x10, 0x02})); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | BOOST_AUTO_TEST_CASE(Whitelist) |
| 266 | { |
| 267 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 268 | |
| 269 | std::string CONFIG = R"CONFIG( |
| 270 | face_system |
| 271 | { |
| 272 | ether |
| 273 | { |
| 274 | whitelist |
| 275 | { |
| 276 | ifname %ifname |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | )CONFIG"; |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 281 | auto ifname = netifs.front()->getName(); |
| 282 | boost::replace_first(CONFIG, "%ifname", ifname); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 283 | |
Junxiao Shi | 1b65ca1 | 2017-01-21 23:04:41 +0000 | [diff] [blame] | 284 | parseConfig(CONFIG, false); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 285 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 286 | auto etherMcastFaces = this->listEtherMcastFaces(); |
| 287 | BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), 1); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 288 | BOOST_CHECK_EQUAL(etherMcastFaces.front()->getLocalUri(), FaceUri::fromDev(ifname)); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | BOOST_AUTO_TEST_CASE(Blacklist) |
| 292 | { |
| 293 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 294 | |
| 295 | std::string CONFIG = R"CONFIG( |
| 296 | face_system |
| 297 | { |
| 298 | ether |
| 299 | { |
| 300 | blacklist |
| 301 | { |
| 302 | ifname %ifname |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | )CONFIG"; |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 307 | auto ifname = netifs.front()->getName(); |
| 308 | boost::replace_first(CONFIG, "%ifname", ifname); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 309 | |
Junxiao Shi | 1b65ca1 | 2017-01-21 23:04:41 +0000 | [diff] [blame] | 310 | parseConfig(CONFIG, false); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 311 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 312 | auto etherMcastFaces = this->listEtherMcastFaces(); |
| 313 | BOOST_CHECK_EQUAL(etherMcastFaces.size(), netifs.size() - 1); |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 314 | BOOST_CHECK(std::none_of(etherMcastFaces.begin(), etherMcastFaces.end(), |
Davide Pesavento | d7083a5 | 2023-10-19 17:51:16 -0400 | [diff] [blame] | 315 | [uri = FaceUri::fromDev(ifname)] (const auto* face) { |
| 316 | return face->getLocalUri() == uri; |
| 317 | })); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 320 | BOOST_AUTO_TEST_CASE(Omitted) |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 321 | { |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 322 | const std::string CONFIG = R"CONFIG( |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 323 | face_system |
| 324 | { |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 325 | } |
| 326 | )CONFIG"; |
| 327 | |
Teng Liang | bfea575 | 2017-03-29 04:51:10 +0000 | [diff] [blame] | 328 | parseConfig(CONFIG, true); |
| 329 | parseConfig(CONFIG, false); |
| 330 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 331 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 332 | } |
| 333 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 334 | BOOST_AUTO_TEST_CASE(BadListen) |
| 335 | { |
| 336 | const std::string CONFIG = R"CONFIG( |
| 337 | face_system |
| 338 | { |
| 339 | ether |
| 340 | { |
| 341 | listen hello |
| 342 | } |
| 343 | } |
| 344 | )CONFIG"; |
| 345 | |
| 346 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 347 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 348 | } |
| 349 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 350 | BOOST_AUTO_TEST_CASE(BadIdleTimeout) |
| 351 | { |
| 352 | // not a number |
| 353 | const std::string CONFIG1 = R"CONFIG( |
| 354 | face_system |
| 355 | { |
| 356 | ether |
| 357 | { |
| 358 | idle_timeout hello |
| 359 | } |
| 360 | } |
| 361 | )CONFIG"; |
| 362 | |
| 363 | BOOST_CHECK_THROW(parseConfig(CONFIG1, true), ConfigFile::Error); |
| 364 | BOOST_CHECK_THROW(parseConfig(CONFIG1, false), ConfigFile::Error); |
| 365 | |
| 366 | // negative number |
| 367 | const std::string CONFIG2 = R"CONFIG( |
| 368 | face_system |
| 369 | { |
| 370 | ether |
| 371 | { |
| 372 | idle_timeout -15 |
| 373 | } |
| 374 | } |
| 375 | )CONFIG"; |
| 376 | |
| 377 | BOOST_CHECK_THROW(parseConfig(CONFIG2, true), ConfigFile::Error); |
| 378 | BOOST_CHECK_THROW(parseConfig(CONFIG2, false), ConfigFile::Error); |
| 379 | } |
| 380 | |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 381 | BOOST_AUTO_TEST_CASE(BadMcast) |
| 382 | { |
| 383 | const std::string CONFIG = R"CONFIG( |
| 384 | face_system |
| 385 | { |
| 386 | ether |
| 387 | { |
| 388 | mcast hello |
| 389 | } |
| 390 | } |
| 391 | )CONFIG"; |
| 392 | |
| 393 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 394 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 395 | } |
| 396 | |
| 397 | BOOST_AUTO_TEST_CASE(BadMcastGroup) |
| 398 | { |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 399 | // not an address |
| 400 | const std::string CONFIG1 = R"CONFIG( |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 401 | face_system |
| 402 | { |
| 403 | ether |
| 404 | { |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 405 | mcast_group hello |
| 406 | } |
| 407 | } |
| 408 | )CONFIG"; |
| 409 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 410 | BOOST_CHECK_THROW(parseConfig(CONFIG1, true), ConfigFile::Error); |
| 411 | BOOST_CHECK_THROW(parseConfig(CONFIG1, false), ConfigFile::Error); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 412 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 413 | // non-multicast address |
| 414 | const std::string CONFIG2 = R"CONFIG( |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 415 | face_system |
| 416 | { |
| 417 | ether |
| 418 | { |
Davide Pesavento | 43ff2a9 | 2017-05-18 19:50:57 -0400 | [diff] [blame] | 419 | mcast_group 00:00:5e:00:53:5e |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 420 | } |
| 421 | } |
| 422 | )CONFIG"; |
| 423 | |
Davide Pesavento | 494a955 | 2018-02-04 22:16:05 -0500 | [diff] [blame] | 424 | BOOST_CHECK_THROW(parseConfig(CONFIG2, true), ConfigFile::Error); |
| 425 | BOOST_CHECK_THROW(parseConfig(CONFIG2, false), ConfigFile::Error); |
Junxiao Shi | 7003c60 | 2017-01-10 13:35:28 +0000 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | BOOST_AUTO_TEST_CASE(UnknownOption) |
| 429 | { |
| 430 | const std::string CONFIG = R"CONFIG( |
| 431 | face_system |
| 432 | { |
| 433 | ether |
| 434 | { |
| 435 | hello |
| 436 | } |
| 437 | } |
| 438 | )CONFIG"; |
| 439 | |
| 440 | BOOST_CHECK_THROW(parseConfig(CONFIG, true), ConfigFile::Error); |
| 441 | BOOST_CHECK_THROW(parseConfig(CONFIG, false), ConfigFile::Error); |
| 442 | } |
| 443 | |
| 444 | BOOST_AUTO_TEST_SUITE_END() // ProcessConfig |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 445 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 446 | BOOST_FIXTURE_TEST_CASE(GetChannels, EthernetFactoryFixtureWithRealNetifs) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 447 | { |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 448 | BOOST_CHECK_EQUAL(factory.getChannels().empty(), true); |
Davide Pesavento | d7083a5 | 2023-10-19 17:51:16 -0400 | [diff] [blame] | 449 | |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 450 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 451 | |
Davide Pesavento | 14e71f0 | 2019-03-28 17:35:25 -0400 | [diff] [blame] | 452 | factory.createChannel(netifs.front(), 1_min); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 453 | checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 456 | BOOST_FIXTURE_TEST_CASE(CreateChannel, EthernetFactoryFixtureWithRealNetifs) |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 457 | { |
| 458 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 459 | |
Davide Pesavento | 14e71f0 | 2019-03-28 17:35:25 -0400 | [diff] [blame] | 460 | auto channel1 = factory.createChannel(netifs.front(), 1_min); |
| 461 | auto channel1a = factory.createChannel(netifs.front(), 5_min); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 462 | BOOST_CHECK_EQUAL(channel1, channel1a); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 463 | checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()}); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 464 | |
| 465 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(2); |
| 466 | |
Davide Pesavento | 14e71f0 | 2019-03-28 17:35:25 -0400 | [diff] [blame] | 467 | auto channel2 = factory.createChannel(netifs.back(), 1_min); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 468 | BOOST_CHECK_NE(channel1, channel2); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 469 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 2); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 470 | } |
| 471 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 472 | BOOST_FIXTURE_TEST_CASE(CreateFace, EthernetFactoryFixtureWithRealNetifs) |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 473 | { |
| 474 | createFace(factory, |
| 475 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 476 | FaceUri("dev://eth0"), |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 477 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 478 | {CreateFaceExpectedResult::FAILURE, 504, "No channels available to connect"}); |
| 479 | |
| 480 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
Davide Pesavento | 14e71f0 | 2019-03-28 17:35:25 -0400 | [diff] [blame] | 481 | auto localUri = factory.createChannel(netifs.front(), 1_min)->getUri(); |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 482 | |
| 483 | createFace(factory, |
| 484 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 485 | localUri, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 486 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 487 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 488 | |
| 489 | createFace(factory, |
| 490 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 491 | localUri, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 492 | {ndn::nfd::FACE_PERSISTENCY_PERMANENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 493 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 494 | |
| 495 | createFace(factory, |
| 496 | FaceUri("ether://[00:00:5e:00:53:53]"), |
| 497 | localUri, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 498 | {ndn::nfd::FACE_PERSISTENCY_PERMANENT, {}, {}, {}, false, false, false}, |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 499 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 500 | |
| 501 | createFace(factory, |
| 502 | FaceUri("ether://[00:00:5e:00:53:57]"), |
| 503 | localUri, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 504 | {ndn::nfd::FACE_PERSISTENCY_PERMANENT, {}, {}, {}, false, true, false}, |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 505 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 506 | |
| 507 | createFace(factory, |
| 508 | FaceUri("ether://[00:00:5e:00:53:5b]"), |
| 509 | localUri, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 510 | {ndn::nfd::FACE_PERSISTENCY_PERMANENT, {}, {}, {}, false, false, true}, |
| 511 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 512 | |
| 513 | createFace(factory, |
| 514 | FaceUri("ether://[00:00:5e:00:53:5c]"), |
| 515 | localUri, |
| 516 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, 1000, false, false, false}, |
Davide Pesavento | b15276f | 2017-07-15 16:27:13 -0400 | [diff] [blame] | 517 | {CreateFaceExpectedResult::SUCCESS, 0, ""}); |
| 518 | } |
| 519 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 520 | BOOST_FIXTURE_TEST_CASE(CreateFaceInvalidRequest, EthernetFactoryFixture) |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 521 | { |
Eric Newberry | 4260241 | 2016-08-27 09:33:18 -0700 | [diff] [blame] | 522 | createFace(factory, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 523 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
Eric Newberry | 78e32b0 | 2017-04-01 14:34:44 +0000 | [diff] [blame] | 524 | {}, |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 525 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 526 | {CreateFaceExpectedResult::FAILURE, 406, |
| 527 | "Creation of unicast Ethernet faces requires a LocalUri with dev:// scheme"}); |
| 528 | |
| 529 | createFace(factory, |
| 530 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 531 | FaceUri("udp4://127.0.0.1:20071"), |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 532 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 533 | {CreateFaceExpectedResult::FAILURE, 406, |
| 534 | "Creation of unicast Ethernet faces requires a LocalUri with dev:// scheme"}); |
| 535 | |
| 536 | createFace(factory, |
| 537 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 538 | FaceUri("dev://eth0"), |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 539 | {ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, {}, {}, {}, false, false, false}, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 540 | {CreateFaceExpectedResult::FAILURE, 406, |
| 541 | "Outgoing Ethernet faces do not support on-demand persistency"}); |
| 542 | |
| 543 | createFace(factory, |
| 544 | FaceUri("ether://[01:00:5e:90:10:5e]"), |
| 545 | FaceUri("dev://eth0"), |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 546 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, false, false, false}, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 547 | {CreateFaceExpectedResult::FAILURE, 406, |
| 548 | "Cannot create multicast Ethernet faces"}); |
| 549 | |
| 550 | createFace(factory, |
| 551 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 552 | FaceUri("dev://eth0"), |
Eric Newberry | 812d615 | 2018-06-06 15:06:01 -0700 | [diff] [blame] | 553 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, true, false, false}, |
Davide Pesavento | 46afec4 | 2017-05-28 14:28:47 -0400 | [diff] [blame] | 554 | {CreateFaceExpectedResult::FAILURE, 406, |
| 555 | "Local fields can only be enabled on faces with local scope"}); |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 556 | |
| 557 | createFace(factory, |
| 558 | FaceUri("ether://[00:00:5e:00:53:5e]"), |
| 559 | FaceUri("dev://eth0"), |
| 560 | {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, 42, false, false, false}, |
| 561 | {CreateFaceExpectedResult::FAILURE, 406, |
| 562 | "Override MTU cannot be less than 64"}); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 563 | } |
| 564 | |
Davide Pesavento | a9ec67c | 2023-10-19 20:04:04 -0400 | [diff] [blame] | 565 | BOOST_FIXTURE_TEST_SUITE(OnInterfaceAdded, EthernetFactoryFixture) |
| 566 | |
| 567 | BOOST_AUTO_TEST_CASE(EligibleForChannelAndMcast) |
| 568 | { |
| 569 | parseConfig(R"CONFIG( |
| 570 | face_system |
| 571 | { |
| 572 | ether |
| 573 | } |
| 574 | )CONFIG", false); |
| 575 | g_io.poll(); |
| 576 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 577 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 578 | |
| 579 | // Add a fake interface that satisfies both unicast and multicast criteria. |
| 580 | netmon->addInterface(this->makeFakeNetif()); |
| 581 | // The channel fails to listen because the interface is fake. |
| 582 | // However, it's not removed from the channel list (issue #4400). |
| 583 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 1); |
| 584 | // Multicast face creation fails because the interface is fake. |
| 585 | // This test is to ensure that the factory handles failures gracefully. |
| 586 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 587 | |
| 588 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 589 | |
| 590 | // Now add a real interface: both channel and multicast face should be created successfully. |
| 591 | netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front())); |
| 592 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 2); |
| 593 | auto etherMcastFaces = this->listEtherMcastFaces(); |
| 594 | BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), 1); |
| 595 | BOOST_CHECK_EQUAL(etherMcastFaces.front()->getLocalUri(), FaceUri::fromDev(netifs.front()->getName())); |
| 596 | } |
| 597 | |
| 598 | BOOST_AUTO_TEST_CASE(EligibleForChannelOnly) |
| 599 | { |
| 600 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 601 | |
| 602 | parseConfig(R"CONFIG( |
| 603 | face_system |
| 604 | { |
| 605 | ether |
| 606 | { |
| 607 | listen no |
| 608 | } |
| 609 | } |
| 610 | )CONFIG", false); |
| 611 | g_io.poll(); |
| 612 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 613 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 614 | |
| 615 | // Add an interface that satisfies only the unicast criteria. |
| 616 | auto netif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()); |
| 617 | netif->setFlags(netif->getFlags() & ~IFF_MULTICAST); |
| 618 | netmon->addInterface(netif); |
| 619 | checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()}); |
| 620 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 621 | } |
| 622 | |
| 623 | BOOST_AUTO_TEST_CASE(Ineligible) |
| 624 | { |
| 625 | parseConfig(R"CONFIG( |
| 626 | face_system |
| 627 | { |
| 628 | ether |
| 629 | } |
| 630 | )CONFIG", false); |
| 631 | g_io.poll(); |
| 632 | |
| 633 | // netif is down |
| 634 | auto netif = this->makeFakeNetif(); |
| 635 | netif->setFlags(netif->getFlags() & ~IFF_UP); |
| 636 | netmon->addInterface(netif); |
| 637 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 638 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 639 | |
| 640 | // incompatible netif type |
| 641 | netif = this->makeFakeNetif(); |
| 642 | netif->setType(ndn::net::InterfaceType::LOOPBACK); |
| 643 | netmon->addInterface(netif); |
| 644 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 645 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 646 | |
| 647 | // invalid Ethernet address |
| 648 | netif = this->makeFakeNetif(); |
| 649 | netif->setEthernetAddress(ethernet::Address{}); |
| 650 | netmon->addInterface(netif); |
| 651 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 652 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 653 | } |
| 654 | |
| 655 | BOOST_AUTO_TEST_CASE(Disabled) |
| 656 | { |
| 657 | SKIP_IF_ETHERNET_NETIF_COUNT_LT(1); |
| 658 | |
| 659 | parseConfig("", false); |
| 660 | g_io.poll(); |
| 661 | |
| 662 | netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front())); |
| 663 | BOOST_CHECK_EQUAL(factory.getChannels().size(), 0); |
| 664 | BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0); |
| 665 | } |
| 666 | |
| 667 | BOOST_AUTO_TEST_SUITE_END() // OnInterfaceAdded |
| 668 | |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 669 | BOOST_AUTO_TEST_SUITE_END() // TestEthernetFactory |
| 670 | BOOST_AUTO_TEST_SUITE_END() // Face |
| 671 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 672 | } // namespace nfd::tests |