plugins+tools: Adding experimental RocketfuelMapReader and tool to convert topology from .cch format into annotated topology format
diff --git a/tools/rocketfuel-maps-cch-to-annotaded.cc b/tools/rocketfuel-maps-cch-to-annotaded.cc
new file mode 100644
index 0000000..d9fa17e
--- /dev/null
+++ b/tools/rocketfuel-maps-cch-to-annotaded.cc
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ *         Ilya Moiseenko <iliamo@ucla.edu>
+ */
+
+#include "ns3/core-module.h"
+#include "ns3/log.h"
+#include "ns3/ndnSIM-module.h"
+#include "ns3/point-to-point-module.h"
+#include "ns3/random-variable.h"
+
+#include <boost/foreach.hpp>
+
+#include "ns3/ndnSIM/plugins/topology/rocketfuel-map-reader.h"
+
+using namespace ns3;
+using namespace std;
+
+int main (int argc, char**argv)
+{
+  string topology = "";
+  string output_prefix = "";
+  uint32_t run = 0;
+  int clientNodeDegrees = -1;
+  bool buildGraphvizGraph = false;
+  bool keepLargestComponent = false;
+  bool connectBackbones = false;
+
+  CommandLine cmd;
+  cmd.AddValue ("topology", "Topology filename (.ccn)", topology);
+  cmd.AddValue ("output",   "Prefix for output files", output_prefix);
+  cmd.AddValue ("run", "Run for ranged parameter randomization", run);
+  cmd.AddValue ("clients", "Maximum degree of client nodes", clientNodeDegrees);
+  cmd.AddValue ("buildGraph", "Whether or not build a graphviz graph (using neato)", buildGraphvizGraph);
+  cmd.AddValue ("keepLargestComponent", "Keep only largest connected component of the network graph", keepLargestComponent);
+  cmd.AddValue ("connectBackbones", "Make sure that ``backbone'' nodes are connected (adding extra links)", connectBackbones);
+  cmd.Parse (argc, argv);
+
+  /**
+   * @todo Make range parameters as command line arguments
+   */
+
+  if (topology == "")
+    {
+      cerr << "ERROR: topology needs to be specified" << endl;
+      cerr << endl;
+
+      cerr << cmd;
+      return 1;
+    }
+
+  if (output_prefix == "")
+    {
+      cerr << "ERROR: output needs to be specified" << endl;
+      cerr << endl;
+
+      cerr << cmd;
+      return 1;
+    }
+
+  if (run == 0)
+    {
+      cerr << "ERROR: run needs to be specified" << endl;
+      cerr << endl;
+
+      cerr << cmd;
+      return 1;
+    }
+
+  if (clientNodeDegrees < 0)
+    {
+      cerr << "ERROR: clients needs to be specified" << endl;
+      cerr << endl;
+
+      cerr << cmd;
+      return 1;
+    }
+
+  Config::SetGlobal ("RngRun", IntegerValue (run));
+  GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::VisualSimulatorImpl"));
+
+  string input = topology;
+  string output = output_prefix+"-conv-annotated.txt";
+  string graph  = output_prefix+"-conv-annotated.dot";
+  string graph_pdf  = output_prefix+"-conv-annotated.pdf";
+
+  RocketfuelParams params;
+  params.clientNodeDegrees = clientNodeDegrees;
+  params.averageRtt = 0.25; // 250ms
+  //parameters for links Backbone<->Backbone
+  params.minb2bBandwidth = "40Mbps";
+  params.minb2bDelay = "5ms";
+
+  params.maxb2bBandwidth = "100Mbps";
+  params.maxb2bDelay = "10ms";
+
+  //parameters for links Backbone<->Gateway and Gateway <-> Gateway
+  params.minb2gBandwidth = "10Mbps";
+  params.minb2gDelay = "5ms";
+
+  params.maxb2gBandwidth = "20Mbps";
+  params.maxb2gDelay = "10ms";
+
+  //parameters for links Gateway <-> Customer
+  params.ming2cBandwidth ="1Mbps";
+  params.ming2cDelay = "70ms";
+
+  params.maxg2cBandwidth ="3Mbps";
+  params.maxg2cDelay = "10ms";
+
+  RocketfuelMapReader topologyReader ("/", 1.0);
+  topologyReader.SetFileName (input);
+  NodeContainer nodes = topologyReader.Read (params, keepLargestComponent, connectBackbones);
+  NodeContainer backboneRouters = topologyReader.GetBackboneRouters();
+  NodeContainer gatewayRouters = topologyReader.GetGatewayRouters();
+  NodeContainer customerRouters = topologyReader.GetCustomerRouters();
+  list<TopologyReader::Link> links = topologyReader.GetLinks();
+
+  topologyReader.SaveGraphviz (graph);
+  if (buildGraphvizGraph)
+    {
+      system (("neato -Tpdf \"" + graph + "\" > \"" + graph_pdf + "\"").c_str ());
+    }
+
+  topologyReader.SaveTopology (output);
+
+  // Names::Clear ();
+  // Simulator::Destroy ();
+
+  // // assign weights
+  // AnnotatedTopologyReader topologyReader2 ("", 1.0);
+  // topologyReader2.SetFileName (output);
+  // topologyReader2.Read ();
+
+  // char env[] = "NS_VIS_ASSIGN=1";
+  // putenv (env);
+
+  // Simulator::Stop (Seconds (0.0));
+  // Simulator::Run ();
+
+  // topologyReader2.SaveTopology (output);
+
+  // Simulator::Destroy ();
+  return 0;
+}
diff --git a/tools/wscript b/tools/wscript
new file mode 100644
index 0000000..6ebf98e
--- /dev/null
+++ b/tools/wscript
@@ -0,0 +1,6 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+    if 'topology' in bld.env['NDN_plugins']:
+        obj = bld.create_ns3_program('rocketfuel-maps-cch-to-annotaded', ['ndnSIM'])
+        obj.source = 'rocketfuel-maps-cch-to-annotaded.cc'