blob: 2edac36e85f84d2cf8f9eefa510b123e501812ba [file] [log] [blame]
Ilya Moiseenko9d258692011-09-01 11:20:11 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
19 */
20
21#include "ns3/test.h"
22#include "ns3/annotated-topology-reader.h"
23#include "ns3/ccnx-interest-header.h"
24#include "ns3/uinteger.h"
25#include "ns3/random-variable.h"
26#include <limits>
27#include "ns3/ccnx-header-helper.h"
28#include "ns3/header.h"
29#include "ns3/ccnx-name-components.h"
30#include "ns3/nstime.h"
31#include "ns3/buffer.h"
32#include "ns3/log.h"
33
34#include <ctime>
35#include <sstream>
36
37#include "ns3/internet-stack-helper.h"
38#include "ns3/ipv4-list-routing-helper.h"
39#include "ns3/ipv4-static-routing-helper.h"
40#include "ns3/point-to-point-helper.h"
41#include "ns3/application.h"
42#include "ns3/ipv4-static-routing-helper.h"
43#include "ns3/ipv4-list-routing-helper.h"
44#include "ns3/annotated-topology-reader.h"
45#include <list>
46
47
48using namespace ns3;
49using namespace std;
50
51NS_LOG_COMPONENT_DEFINE ("CcnxBasicRegressionTest");
52
53class BasicRegressionTest : public TestCase
54{
55public:
56
57 BasicRegressionTest ();
58 virtual ~BasicRegressionTest ();
59
60private:
61 virtual void DoRun (void);
62};
63
64BasicRegressionTest::BasicRegressionTest ()
65: TestCase ("Basic regression test")
66{
67}
68
69BasicRegressionTest::~BasicRegressionTest ()
70{
71}
72
73void
74BasicRegressionTest::DoRun(void)
75{
76 //string input ("/Users/iliamo/ns3-abstract-ndn/ns-3.11/src/NDNabstraction/examples/simpletopology.txt");
77
78 // Set up command line parameters used to control the experiment.
79 //CommandLine cmd;
80 //cmd.AddValue ("input", "Name of the input file.",
81 // input);
82 //cmd.Parse (argc, argv);
83
84
85 // ------------------------------------------------------------
86 // -- Read topology data.
87 // --------------------------------------------
88
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080089 // string input = NS_TEST_SOURCEDIR;
90 // input += "/testtopology.txt";
Ilya Moiseenko9d258692011-09-01 11:20:11 -070091
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080092 // Ptr<AnnotatedTopologyReader> reader = CreateObject<AnnotatedTopologyReader> ();
93 // reader->SetFileName (input);
Ilya Moiseenko9d258692011-09-01 11:20:11 -070094
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -080095 // NodeContainer nodes;
96 // if (reader != 0)
97 // {
98 // nodes = reader->Read ();
99 // }
100 // else
101 // {
102 // NS_TEST_ASSERT_MSG_EQ (true, false, "file not found");
103 // }
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700104
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800105 // NS_TEST_ASSERT_MSG_EQ (7, reader->LinksSize (), "link count is wrong");
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700106
107
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800108 // // ------------------------------------------------------------
109 // // -- Create nodes and network stacks
110 // // --------------------------------------------
111 // NS_LOG_INFO ("creating internet stack");
112 // InternetStackHelper stack;
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700113
114
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800115 // //routing
116 // /*Ipv4StaticRoutingHelper staticRouting;
117 // Ipv4ListRoutingHelper listRH;
118 // listRH.Add (staticRouting, 0);
119 // stack.SetRoutingHelper (listRH); // has effect on the next Install ()
120 // stack.Install (nodes);
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700121
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800122 // NS_LOG_INFO ("creating ip4 addresses");
123 // Ipv4AddressHelper address;
124 // address.SetBase ("10.0.0.0", "255.255.255.252");*/
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700125
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800126 // int totlinks = reader->LinksSize ();
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700127
128
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800129 // /// applying settings
130 // NS_LOG_INFO ("creating node containers");
131 // NodeContainer* nc = new NodeContainer[totlinks];
132 // TopologyReader::ConstLinksIterator iter;
133 // int i = 0;
134 // for ( iter = reader->LinksBegin (); iter != reader->LinksEnd (); iter++, i++ )
135 // {
136 // nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode ());
137 // }
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700138
Alexander Afanasyeve9c9d722012-01-19 16:59:30 -0800139 // NetDeviceContainer* ndc = new NetDeviceContainer[totlinks];
140 // reader->ApplySettings(ndc,nc);
141 // /// settings applied
Ilya Moiseenko9d258692011-09-01 11:20:11 -0700142
143
144
145
146 // it creates little subnets, one for each couple of nodes.
147 /*NS_LOG_INFO ("creating ipv4 interfaces");
148 Ipv4InterfaceContainer* ipic = new Ipv4InterfaceContainer[totlinks];
149 for (int i = 0; i < totlinks; i++)
150 {
151 ipic[i] = address.Assign (ndc[i]);
152 address.NewNetwork ();
153 }
154
155 // ------------------------------------------------------------
156 // -- Run the simulation
157 // --------------------------------------------
158 NS_LOG_INFO ("Run Simulation.");
159 Simulator::Stop (Seconds (20));
160 Simulator::Run ();
161 Simulator::Destroy ();
162
163 delete[] ipic;
164 delete[] ndc;
165 delete[] nc;
166
167 NS_LOG_INFO ("Done.");
168
169 */
170}
171
172class BasicRegressionTestSuite : public TestSuite
173{
174public:
175 BasicRegressionTestSuite ();
176};
177
178BasicRegressionTestSuite::BasicRegressionTestSuite ()
179: TestSuite ("ccnx-basic-regression-test-suite", UNIT)
180{
181 SetDataDir (NS_TEST_SOURCEDIR);
182 AddTestCase (new BasicRegressionTest);
183}
184
185static BasicRegressionTestSuite suite;