blob: 99521c629314e26c68c7e09a56fb07d641597570 [file] [log] [blame]
Ilya Moiseenko58d26672011-12-08 13:48:06 -08001/* -*- 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
22#include "ns3/core-module.h"
23#include "ns3/network-module.h"
24#include "ns3/point-to-point-module.h"
25#include "ns3/NDNabstraction-module.h"
26#include "ns3/point-to-point-grid.h"
27#include "ns3/ipv4-global-routing-helper.h"
28
29#include <iostream>
30#include <sstream>
Ilya Moiseenko58d26672011-12-08 13:48:06 -080031#include "ns3/annotated-topology-reader.h"
32
33using namespace ns3;
34using namespace std;
35
36NS_LOG_COMPONENT_DEFINE ("CcnxAbileneTopology");
37
38int
39main (int argc, char *argv[])
40{
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080041 // Packet::EnableChecking();
42 // Packet::EnablePrinting();
43 string input ("./src/NDNabstraction/examples/abilene-topology.txt");
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080044
45 Time finishTime = Seconds (20.0);
46 string animationFile;
47 string strategy = "ns3::CcnxFloodingStrategy";
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080048 CommandLine cmd;
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080049 cmd.AddValue ("finish", "Finish time", finishTime);
50 cmd.AddValue ("netanim", "NetAnim filename", animationFile);
51 cmd.AddValue ("strategy", "CCNx forwarding strategy", strategy);
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080052 cmd.Parse (argc, argv);
Ilya Moiseenko58d26672011-12-08 13:48:06 -080053
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080054 // ------------------------------------------------------------
55 // -- Read topology data.
56 // --------------------------------------------
Ilya Moiseenko58d26672011-12-08 13:48:06 -080057
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080058 AnnotatedTopologyReader reader;
59 reader.SetFileName (input);
60 reader.SetBoundingBox (100.0, 100.0, 400.0, 400.0);
61
62 NodeContainer nodes = reader.Read ();
Ilya Moiseenko58d26672011-12-08 13:48:06 -080063
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080064 if (reader.LinksSize () == 0)
Ilya Moiseenko58d26672011-12-08 13:48:06 -080065 {
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080066 NS_LOG_ERROR ("Problems reading the topology file. Failing.");
67 return -1;
Ilya Moiseenko58d26672011-12-08 13:48:06 -080068 }
69
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080070 NS_LOG_INFO("Nodes = " << nodes.GetN());
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080071 NS_LOG_INFO("Links = " << reader.LinksSize ());
Ilya Moiseenko58d26672011-12-08 13:48:06 -080072
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080073 // Install CCNx stack
74 NS_LOG_INFO ("Installing CCNx stack");
75 CcnxStackHelper ccnxHelper;
76 // ccnxHelper.SetForwardingStrategy (strategy);
77 ccnxHelper.EnableLimits (true, Seconds(0.1));
78 ccnxHelper.InstallAll ();
Ilya Moiseenko58d26672011-12-08 13:48:06 -080079
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080080 // NS_LOG_INFO ("Installing Applications");
81 // CcnxConsumerHelper consumerHelper ("preved");
82 // ApplicationContainer consumers = consumerHelper.Install (nc[0]);
Ilya Moiseenko58d26672011-12-08 13:48:06 -080083
Alexander Afanasyev8633d5d2011-12-12 18:02:31 -080084 Simulator::Stop (finishTime);
Alexander Afanasyev3406f3e2011-12-08 14:11:31 -080085 NS_LOG_INFO ("Run Simulation.");
86 Simulator::Run ();
87 Simulator::Destroy ();
88 NS_LOG_INFO ("Done.");
89 return 0;
90}