blob: 5ac5a31e875fa27b55eabcaae51f92e657b37aa2 [file] [log] [blame]
Davide Pesavento248d6bd2014-03-09 10:24:08 +01001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -07003 * Copyright (c) 2014 Regents of the University of California,
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 *
10 * This file is part of NFD (Named Data Networking Forwarding Daemon).
11 * See AUTHORS.md for complete list of NFD authors and contributors.
12 *
13 * NFD is free software: you can redistribute it and/or modify it under the terms
14 * of the GNU General Public License as published by the Free Software Foundation,
15 * either version 3 of the License, or (at your option) any later version.
16 *
17 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
23 **/
Davide Pesavento248d6bd2014-03-09 10:24:08 +010024
25#include "core/network-interface.hpp"
26#include "tests/test-common.hpp"
27
Davide Pesavento248d6bd2014-03-09 10:24:08 +010028namespace nfd {
29namespace tests {
30
31BOOST_FIXTURE_TEST_SUITE(CoreNetworkInterface, BaseFixture)
32
33BOOST_AUTO_TEST_CASE(ListNetworkInterfaces)
34{
Davide Pesaventob499a602014-11-18 22:36:56 +010035 std::vector<NetworkInterfaceInfo> netifs;
Davide Pesavento248d6bd2014-03-09 10:24:08 +010036 BOOST_CHECK_NO_THROW(netifs = listNetworkInterfaces());
37
Davide Pesaventob499a602014-11-18 22:36:56 +010038 for (const auto& netif : netifs) {
39 BOOST_TEST_MESSAGE(netif.index << ": " << netif.name);
40 BOOST_TEST_MESSAGE("\tether " << netif.etherAddress);
41 for (const auto& address : netif.ipv4Addresses)
Davide Pesavento248d6bd2014-03-09 10:24:08 +010042 BOOST_TEST_MESSAGE("\tinet " << address);
Davide Pesaventob499a602014-11-18 22:36:56 +010043 for (const auto& address : netif.ipv6Addresses)
Davide Pesavento248d6bd2014-03-09 10:24:08 +010044 BOOST_TEST_MESSAGE("\tinet6 " << address);
Davide Pesaventob499a602014-11-18 22:36:56 +010045 BOOST_TEST_MESSAGE("\tloopback : " << netif.isLoopback());
46 BOOST_TEST_MESSAGE("\tmulticast : " << netif.isMulticastCapable());
47 BOOST_TEST_MESSAGE("\tup : " << netif.isUp());
Davide Pesavento248d6bd2014-03-09 10:24:08 +010048 }
49}
50
51BOOST_AUTO_TEST_SUITE_END()
52
53} // namespace tests
54} // namespace nfd