Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 1 | /* -*- 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 Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 31 | #include "ns3/rocketfuel-topology-reader.h" |
| 32 | |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 33 | using namespace ns3; |
| 34 | |
| 35 | NS_LOG_COMPONENT_DEFINE ("CcnxSprintTopology"); |
| 36 | |
| 37 | int |
| 38 | main (int argc, char *argv[]) |
| 39 | { |
| 40 | Packet::EnableChecking(); |
| 41 | Packet::EnablePrinting(); |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame^] | 42 | std::string weights ("./src/NDNabstraction/examples/sprint.weights"); |
| 43 | std::string latencies ("./src/NDNabstraction/examples/sprint.latencies"); |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 44 | |
| 45 | // ------------------------------------------------------------ |
| 46 | // -- Read topology data. |
| 47 | // -------------------------------------------- |
| 48 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame^] | 49 | RocketfuelWeightsReader reader; |
| 50 | |
| 51 | reader.SetFileName (weights); |
| 52 | reader.SetFileType (RocketfuelWeightsReader::WEIGHTS); |
| 53 | NodeContainer nodes = reader.Read (); |
| 54 | |
| 55 | reader.SetFileName (latencies); |
| 56 | reader.SetFileType (RocketfuelWeightsReader::LATENCIES); |
| 57 | reader.Read (); |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 58 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame^] | 59 | if (reader.LinksSize () == 0) |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 60 | { |
| 61 | NS_LOG_ERROR ("Problems reading the topology file. Failing."); |
| 62 | return -1; |
| 63 | } |
| 64 | |
| 65 | NS_LOG_INFO("Nodes = " << nodes.GetN()); |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame^] | 66 | NS_LOG_INFO("Links = " << reader.LinksSize ()); |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 67 | |
| 68 | NS_LOG_INFO ("Run Simulation."); |
| 69 | Simulator::Run (); |
| 70 | Simulator::Destroy (); |
| 71 | NS_LOG_INFO ("Done."); |
| 72 | return 0; |
Alexander Afanasyev | 3406f3e | 2011-12-08 14:11:31 -0800 | [diff] [blame] | 73 | } |