blob: 0fad1817ca27da043fb52ce8c0f27ab37794c676 [file] [log] [blame]
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
4 *
5 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
7 *
8 * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
19
20
21#include "model/ndn-net-device-face.hpp"
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070022
23#include "../tests-common.hpp"
24
25namespace ns3 {
26namespace ndn {
27
Alexander Afanasyev91971b72015-08-13 16:53:37 -070028BOOST_FIXTURE_TEST_SUITE(ModelNdnNetDeviceFace, ScenarioHelperWithCleanupFixture)
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070029
Alexander Afanasyev91971b72015-08-13 16:53:37 -070030BOOST_AUTO_TEST_CASE(Basic)
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070031{
Alexander Afanasyev91971b72015-08-13 16:53:37 -070032 Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"));
33 Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
34 Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("20"));
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070035
Alexander Afanasyev91971b72015-08-13 16:53:37 -070036 createTopology({
37 {"1", "2"},
38 });
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070039
Alexander Afanasyev91971b72015-08-13 16:53:37 -070040 addRoutes({
41 {"1", "2", "/prefix", 1},
42 });
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070043
Alexander Afanasyev91971b72015-08-13 16:53:37 -070044 addApps({
45 {"1", "ns3::ndn::ConsumerCbr",
46 {{"Prefix", "/prefix"}, {"Frequency", "10"}},
47 "0s", "9.99s"},
48 {"2", "ns3::ndn::Producer",
49 {{"Prefix", "/prefix"}, {"PayloadSize", "1024"}},
50 "0s", "100s"}
51 });
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070052
Spyridon Mastorakis16622532015-07-18 20:29:46 -070053 Simulator::Stop(Seconds(20.001));
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070054 Simulator::Run();
55
Alexander Afanasyev91971b72015-08-13 16:53:37 -070056 BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNOutInterests(), 100);
57 BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNInDatas(), 100);
Spyridon Mastorakis16622532015-07-18 20:29:46 -070058
Alexander Afanasyev91971b72015-08-13 16:53:37 -070059 BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 100);
60 BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNOutDatas(), 100);
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070061}
62
63BOOST_AUTO_TEST_SUITE_END()
64
65} // namespace ndn
66} // namespace ns3