Removing hijacker app. Hijacking is implemented now by changing face states
diff --git a/apps/ccnx-hijacker.cc b/apps/ccnx-hijacker.cc
deleted file mode 100644
index f09b098..0000000
--- a/apps/ccnx-hijacker.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnx-hijacker.h"
-#include "ns3/log.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/string.h"
-#include "ns3/uinteger.h"
-#include "ns3/packet.h"
-
-#include "../model/ccnx-local-face.h"
-#include "ns3/ccnx-fib.h"
-
-#include <boost/ref.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-namespace ll = boost::lambda;
-
-NS_LOG_COMPONENT_DEFINE ("CcnxHijacker");
-
-namespace ns3
-{    
-
-NS_OBJECT_ENSURE_REGISTERED (CcnxHijacker);
-    
-TypeId
-CcnxHijacker::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::CcnxHijacker")
-    .SetParent<CcnxApp> ()
-    .AddConstructor<CcnxHijacker> ()
-    .AddAttribute ("Prefix","Prefix, which hijacker wants to attack",
-                   StringValue ("/"),
-                   MakeCcnxNameComponentsAccessor (&CcnxHijacker::m_prefix),
-                   MakeCcnxNameComponentsChecker ())
-    .AddAttribute ("PayloadSize", "Virtual payload size for Content packets",
-                   UintegerValue (1024),
-                   MakeUintegerAccessor(&CcnxHijacker::m_virtualPayloadSize),
-                   MakeUintegerChecker<uint32_t>())
-    
-    .AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
-                    MakeTraceSourceAccessor (&CcnxHijacker::m_transmittedContentObjects))
-    ;
-        
-  return tid;
-}
-    
-CcnxHijacker::CcnxHijacker ()
-{
-  // NS_LOG_FUNCTION_NOARGS ();
-}
-
-// inherited from Application base class.
-void
-CcnxHijacker::StartApplication ()
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
-
-  CcnxApp::StartApplication ();
-
-  Ptr<CcnxFib> fib = GetNode ()->GetObject<CcnxFib> ();
-  CcnxFibEntryContainer::type::iterator fibEntry = fib->Add (m_prefix, m_face, 0);
-
-  // make face green, so it will be used primarily
-  fib->m_fib.modify (fibEntry,
-                     ll::bind (&CcnxFibEntry::UpdateStatus,
-                               ll::_1, m_face, CcnxFibFaceMetric::NDN_FIB_GREEN));
-}
-
-void
-CcnxHijacker::StopApplication ()
-{
-  NS_LOG_FUNCTION_NOARGS ();
-  NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
-
-  CcnxApp::StopApplication ();
-}
-
-
-void
-CcnxHijacker::OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet)
-{
-  CcnxApp::OnInterest (interest, packet); // tracing inside
-
-  NS_LOG_FUNCTION (this << interest);
-
-  /*
-  if (!m_active) return;
-    
-  static CcnxContentObjectTail tail;
-  Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
-  header->SetName (Create<CcnxNameComponents> (interest->GetName ()));
-
-  NS_LOG_INFO ("Respodning with ContentObject:\n" << boost::cref(*header));
-  
-  Ptr<Packet> packet = Create<Packet> (m_virtualPayloadSize);
-
-  m_transmittedContentObjects (header, packet, this, m_face);
-  
-  packet->AddHeader (*header);
-  packet->AddTrailer (tail);
-
-  m_protocolHandler (packet);*/
-}
-
-} // namespace ns3
diff --git a/apps/ccnx-hijacker.h b/apps/ccnx-hijacker.h
deleted file mode 100644
index 3269599..0000000
--- a/apps/ccnx-hijacker.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2011 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: Ilya Moiseenko <iliamo@cs.ucla.edu>
- *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef CCNX_HIJACKER_H
-#define CCNX_HIJACKER_H
-
-#include "ccnx-app.h"
-
-#include "ns3/ptr.h"
-#include "ns3/ccnx-name-components.h"
-
-namespace ns3 
-{
-
-class CcnxHijacker : public CcnxApp
-{
-public: 
-  static TypeId
-  GetTypeId (void);
-        
-  CcnxHijacker ();
-
-  // inherited from CcnxApp
-  void OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet);
-
-protected:
-  // inherited from Application base class.
-  virtual void
-  StartApplication ();    // Called at time specified by Start
-
-  virtual void
-  StopApplication ();     // Called at time specified by Stop
-
-private:
-  CcnxNameComponents m_prefix;
-  uint32_t m_virtualPayloadSize;
-
-  TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
-                 Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedContentObjects;
-};
-
-}
-
-#endif // CCNX_HIJACKER_H
diff --git a/examples/blackhole-sprint.cc b/examples/blackhole-sprint.cc
index d4884d5..cf29d64 100644
--- a/examples/blackhole-sprint.cc
+++ b/examples/blackhole-sprint.cc
@@ -62,184 +62,6 @@
 class Experiment : public BaseExperiment
 {
 public:
-  enum nodes {N0,N1,N2,N3,N4,N5,N6,N7,N8,N9,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27,N28,N29,N30,N31,N32,N33,N34,N35,N36,N37,N38,N39,N40,N41,N42,N43,N44,N45,N46,N47,N48,N49,N50,N51};
-  
-  typedef std::pair<int, int> Edge;
-  const Edge edge_array[84];
-  
-  Experiment ()
-    : edge_array((Edge[84]){ 
-    Edge(N0, N1), 
-    Edge(N2, N3), 
-    Edge(N1, N4), 
-    Edge(N1, N5),
-    Edge(N1, N6),
-    Edge(N1, N7),
-    Edge(N1, N8),
-    Edge(N1, N9),
-    Edge(N1, N10),
-    Edge(N1, N11),
-    Edge(N12, N13),
-    Edge(N14, N15),
-    Edge(N14, N16),
-    Edge(N14, N17),
-    Edge(N15, N18),
-    Edge(N15, N19),
-    Edge(N20, N21),
-    Edge(N20, N22),
-    Edge(N23, N24),
-    Edge(N25, N26),
-    Edge(N27, N28),
-    Edge(N8, N20),
-    Edge(N8, N16),
-    Edge(N8, N28),
-    Edge(N8, N24),
-    Edge(N8, N26),
-    Edge(N21, N31),
-    Edge(N13, N32),
-    Edge(N13, N33),
-    Edge(N17, N35),
-    Edge(N17, N20),
-    Edge(N17, N18),
-    Edge(N17, N28),
-    Edge(N17, N24),
-    Edge(N17, N25),
-    Edge(N17, N26),
-    Edge(N17, N29),
-    Edge(N17, N36),
-    Edge(N11, N24),
-    Edge(N11, N38),
-    Edge(N11, N17),
-    Edge(N33, N39),
-    Edge(N33, N40),
-    Edge(N6, N7),
-    Edge(N6, N28),
-    Edge(N6, N25),
-    Edge(N6, N8),
-    Edge(N6, N17),
-    Edge(N6, N34),
-    Edge(N6, N11),
-    Edge(N39, N42),
-    Edge(N16, N24),
-    Edge(N16, N29),
-    Edge(N16, N17),
-    Edge(N31, N45),
-    Edge(N31, N46),
-    Edge(N31, N37),
-    Edge(N31, N47),
-    Edge(N32, N48),
-    Edge(N32, N44),
-    Edge(N32, N42),
-    Edge(N48, N49),
-    Edge(N7, N13),
-    Edge(N38, N43),
-    Edge(N9, N15),
-    Edge(N9, N20),
-    Edge(N9, N31),
-    Edge(N9, N30),
-    Edge(N9, N17),
-    Edge(N9, N19),
-    Edge(N5, N32),
-    Edge(N5, N8),
-    Edge(N5, N7),
-    Edge(N18, N23),
-    Edge(N40, N48),
-    Edge(N40, N49),
-    Edge(N24, N38),
-    Edge(N24, N31),
-    Edge(N24, N45),
-    Edge(N24, N50),
-    Edge(N3, N9),
-    Edge(N19, N41),
-    Edge(N19, N20),
-    Edge(N19, N51) 
-    })
-  { }
-
-  
-  int
-  ComputeShortestWeightsPath(uint32_t sourceNode, uint32_t destinationNode)
-  {
-    typedef adjacency_list < listS, vecS, undirectedS,
-    no_property, property < edge_weight_t, int > > graph_t;
-    typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;
-    typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;
-    
-    //string name[] = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51"};
-  
-    
-    int weights[] = { 312, 10786, 222, 2500, 4000, 2500, 3860, 11769, 352, 3500, 2622, 500, 14192, 8909, 11747, 44530, 19775, 345, 5337, 2184, 645, 11409, 8282, 3000, 7735, 5500, 20741, 7552, 1500, 2091,  14409, 4337, 4000, 5735, 1315, 2500, 3282, 2478, 5096, 3235, 4360, 2000, 3000, 2500, 6860, 5176, 5860, 3860, 802, 5500, 699, 1547, 3000, 5282, 500, 268, 3375, 2708, 1712, 2329, 3352, 3201, 30890, 1643, 5500, 2500, 4735, 124, 13909, 42030, 28338, 2360, 2000, 5735, 2340, 2529, 2860, 9909, 10409, 92, 59812, 26190, 39530, 14125 };
-    
-    int num_arcs = sizeof(edge_array) / sizeof(Edge);
-    
-    graph_t g(edge_array, edge_array + num_arcs, weights, m_numNodes);
-    property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);
-    
-    std::vector<vertex_descriptor> p(num_vertices(g));
-    std::vector<int> d(num_vertices(g));
-    
-    vertex_descriptor s = vertex(static_cast<nodes>(sourceNode), g);
-    
-    dijkstra_shortest_paths(g, s, predecessor_map(&p[0]).distance_map(&d[0]));
-    
-    NS_LOG_INFO("Shortest distance (weights) from Node"<<sourceNode << " to Node"<<destinationNode<<" equals  " << d[destinationNode]);
-    
-    /*
-    //PRINTING
-    NS_LOG_INFO ("distances and parents:");
-    graph_traits < graph_t >::vertex_iterator vi, vend;
-    
-    for (boost::tie(vi, vend) = vertices(g); vi != vend; ++vi) 
-      {
-        NS_LOG_INFO("distance(" << name[*vi] << ") = " << d[*vi] << ", ");
-        NS_LOG_INFO("parent(" << name[*vi] << ") = " << name[p[*vi]] << std::endl);
-      }
-    */
-      
-    return d[destinationNode];
-  }
-  
-  double 
-  ComputeShortestDelayPath(uint32_t sourceNode, uint32_t destinationNode)
-  {
-    typedef adjacency_list < listS, vecS, undirectedS,
-    no_property, property < edge_weight_t, double > > graph_t;
-    typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor;
-    typedef graph_traits < graph_t >::edge_descriptor edge_descriptor;
-    
-    //string name[] = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51"};
-    
-    double weights[] = {0.312, 10.786, 0.222, 1.035, 1.414, 1.24, 0.814, 19.532, 0.352, 4.593, 2.622, 0.207, 12.098, 13.941, 7.791, 38.946, 19.775, 0.345, 5.337, 0.276, 0.645, 19.787, 8.352, 1.578,  10.459, 5.005, 20.741, 4.737, 1.424, 2.091, 14.409, 7.13, 6.214, 6.437, 1.315, 1.176, 3.282, 2.478, 5.751, 3.235, 4.718, 1.817, 2.035, 0.327, 0.97, 5.176, 0.612, 5.725, 0.802, 6.007, 0.699, 3.655, 0.135, 3.286, 0.268, 0.268, 3.375, 2.708, 1.712, 2.329, 1.595, 3.201, 31.13, 1.643, 5.513, 0.437, 2.648, 0.124, 14.774, 42.03, 28.338, 0.359, 0.316, 0.779, 2.34, 2.529, 7.706, 9.827, 10.045, 0.092, 59.812, 26.19, 42.057, 14.125};
-
-    int num_arcs = sizeof(edge_array) / sizeof(Edge);
-    
-    graph_t g(edge_array, edge_array + num_arcs, weights, m_numNodes);
-    property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);
-    
-    std::vector<vertex_descriptor> p(num_vertices(g));
-    std::vector<double> d(num_vertices(g));
-    
-    vertex_descriptor s = vertex(static_cast<nodes>(sourceNode), g);
-    
-    dijkstra_shortest_paths(g, s, predecessor_map(&p[0]).distance_map(&d[0]));
-    
-    NS_LOG_INFO("Shortest distance (delay) from Node"<<sourceNode << " to Node"<<destinationNode<<" equals  " << d[destinationNode]);
-    
-    /*
-    //PRINTING
-    NS_LOG_INFO ("distances and parents:");
-    graph_traits < graph_t >::vertex_iterator vi, vend;
-    
-    for (boost::tie(vi, vend) = vertices(g); vi != vend; ++vi) 
-      {
-        NS_LOG_INFO("distance(" << name[*vi] << ") = " << d[*vi] << ", ");
-        NS_LOG_INFO("parent(" << name[*vi] << ") = " << name[p[*vi]] << std::endl);
-      }
-    */
-    
-    return d[destinationNode];
-  }
-
   // hijacker is more than an application. just disable all faces
   static void
   InstallHijacker (std::string prefix, Ptr<Node> node)
@@ -348,8 +170,6 @@
       Experiment experiment;
       // experiment.GenerateRandomPairs (1);
       experiment.SetPair (run);
-      experiment.ComputeShortestWeightsPath(1,12);
-      experiment.ComputeShortestDelayPath(1,12);
       cout << "Run " << run << endl;
       
       string prefix = "blackhole-" + lexical_cast<string> (run) + "-";
diff --git a/examples/link-failure-sprint.cc b/examples/link-failure-sprint.cc
index 421f134..85e7b3d 100644
--- a/examples/link-failure-sprint.cc
+++ b/examples/link-failure-sprint.cc
@@ -53,144 +53,83 @@
 }
 
 
-class Experiment
+#include "base-experiment.h"
+
+class Experiment : public BaseExperiment
 {
 public:
-  Experiment ()
-  : m_reader ("/sprint") { }
-
-  void
-  ConfigureTopology ()
+  // hijacker is more than an application. just disable all faces
+  static void
+  FailLinks (uint32_t failId)
   {
-    Names::Clear ();
-    
-    string weights   ("./src/NDNabstraction/examples/sprint-pops.weights");
-    string latencies ("./src/NDNabstraction/examples/sprint-pops.latencies");
-    string positions ("./src/NDNabstraction/examples/sprint-pops.positions");
-  
-    //RocketfuelWeightsReader reader ("/sprint");
+    // Ptr<Ccnx> ccnx = node->GetObject<Ccnx> ();
+    // for (uint32_t i = 0; i < ccnx->GetNFaces (); i++)
+    //   {
+    //     Ptr<CcnxFace> face = ccnx->GetFace (i);
+    //     face->SetUp (false);
+    //   }
+    // CcnxStackHelper::InstallRouteTo (prefix, node);
+  }
 
-    m_reader.SetFileName (positions);
-    m_reader.SetFileType (RocketfuelWeightsReader::POSITIONS);
-    m_reader.Read ();
-  
-    m_reader.SetFileName (weights);
-    m_reader.SetFileType (RocketfuelWeightsReader::WEIGHTS);    
-    m_reader.Read ();
-
-    m_reader.SetFileName (latencies);
-    m_reader.SetFileType (RocketfuelWeightsReader::LATENCIES);    
-    m_reader.Read ();
+  // void
+  // FailLinks(double threshold)
+  // {
+  //   NS_LOG_INFO("Failing links");
+  //   m_linkRand = UniformVariable(0, 1.0);
+  //   double probability = 0.0;
     
-    m_reader.Commit ();
-    NS_ASSERT_MSG (m_reader.LinksSize () != 0, "Problems reading the topology file. Failing.");
-    
-    NS_LOG_INFO("Nodes = " << m_reader.GetNodes ().GetN());
-    NS_LOG_INFO("Links = " << m_reader.LinksSize ());
-  
-    // ------------------------------------------------------------
-    // -- Read topology data.
-    // --------------------------------------------
+  //   BOOST_FOREACH (const TopologyReader::Link &link, m_reader.GetLinks())
+  //     {
+  //       probability = m_linkRand.GetValue();
+  //       NS_LOG_INFO ("Probability = " << probability);
         
-    InternetStackHelper stack;
-    Ipv4GlobalRoutingHelper ipv4RoutingHelper ("ns3::Ipv4GlobalRoutingOrderedNexthops");
-    stack.SetRoutingHelper (ipv4RoutingHelper);
-    stack.Install (m_reader.GetNodes ());
-
-    m_reader.AssignIpv4Addresses (Ipv4Address ("10.0.0.0"));
-    
-    // Install CCNx stack
-    NS_LOG_INFO ("Installing CCNx stack");
-    CcnxStackHelper ccnxHelper;
-    ccnxHelper.SetForwardingStrategy ("ns3::CcnxBestRouteStrategy");
-    ccnxHelper.EnableLimits (true, Seconds(0.1));
-    ccnxHelper.SetDefaultRoutes (false);
-    ccnxHelper.InstallAll ();
-    
-    m_rand = UniformVariable (0, m_reader.GetNodes ().GetN());
-    //m_linkRand = UniformVariable(0, m_reader.LinksSize());
-  }
-
-  void
-  ConfigureRouting ()
-  {
-    CcnxStackHelper ccnxHelper;
-    // // Populate FIB based on IPv4 global routing controller
-    ccnxHelper.InstallFakeGlobalRoutes ();
-    ccnxHelper.InstallRoutesToAll ();
-  }
-
-public:  
-  void
-  Run (const Time &finishTime)
-  {
-    cout << "Run Simulation.\n";
-    Simulator::Stop (finishTime);
-    Simulator::Schedule (Seconds (1.0), PrintTime);
-    Simulator::Run ();
-    Simulator::Destroy ();
-    cout << "Done.\n";
-  }
-
-  void
-  FailLinks(double threshold)
-  {
-    NS_LOG_INFO("Failing links");
-    m_linkRand = UniformVariable(0, 1.0);
-    double probability = 0.0;
-    
-    BOOST_FOREACH (const TopologyReader::Link &link, m_reader.GetLinks())
-      {
-        probability = m_linkRand.GetValue();
-        NS_LOG_INFO ("Probability = " << probability);
-        
-        if(probability <= threshold)
-          {
-            Ptr<Node> fromNode = link.GetFromNode ();
-            Ptr<Node> toNode = link.GetToNode ();
-            NS_LOG_INFO("From node id = " << fromNode->GetId());
-            NS_LOG_INFO("To node id = " << toNode->GetId());
+  //       if(probability <= threshold)
+  //         {
+  //           Ptr<Node> fromNode = link.GetFromNode ();
+  //           Ptr<Node> toNode = link.GetToNode ();
+  //           NS_LOG_INFO("From node id = " << fromNode->GetId());
+  //           NS_LOG_INFO("To node id = " << toNode->GetId());
             
-            Ptr<CcnxL3Protocol> fromCcnx = fromNode->GetObject<CcnxL3Protocol> ();
-            Ptr<CcnxL3Protocol> toCcnx = toNode->GetObject<CcnxL3Protocol> (); 
+  //           Ptr<CcnxL3Protocol> fromCcnx = fromNode->GetObject<CcnxL3Protocol> ();
+  //           Ptr<CcnxL3Protocol> toCcnx = toNode->GetObject<CcnxL3Protocol> (); 
           
-            Ptr<NetDevice> fromDevice = link.GetFromNetDevice ();
-            Ptr<NetDevice> toDevice = link.GetToNetDevice ();
+  //           Ptr<NetDevice> fromDevice = link.GetFromNetDevice ();
+  //           Ptr<NetDevice> toDevice = link.GetToNetDevice ();
           
-            Ptr<CcnxFace> fromFace = fromCcnx->GetFaceByNetDevice (fromDevice);
-            Ptr<CcnxFace> toFace = toCcnx->GetFaceByNetDevice (toDevice);
+  //           Ptr<CcnxFace> fromFace = fromCcnx->GetFaceByNetDevice (fromDevice);
+  //           Ptr<CcnxFace> toFace = toCcnx->GetFaceByNetDevice (toDevice);
           
-            NS_LOG_INFO("From face id = " << fromFace->GetId());
-            NS_LOG_INFO("To face id = " << toFace->GetId());
-            fromFace->SetUp (false);
-            toFace->SetUp (false);
+  //           NS_LOG_INFO("From face id = " << fromFace->GetId());
+  //           NS_LOG_INFO("To face id = " << toFace->GetId());
+  //           fromFace->SetUp (false);
+  //           toFace->SetUp (false);
             
-            NS_LOG_INFO(fromFace->IsUp());
-            NS_LOG_INFO(toFace->IsUp());
-          }
+  //           NS_LOG_INFO(fromFace->IsUp());
+  //           NS_LOG_INFO(toFace->IsUp());
+  //         }
 
-      }
-    /*
-    uint32_t nodeId = m_rand.GetValue ();
-    Ptr<Node> node = Names::Find<Node> ("/sprint", lexical_cast<string> (nodeId));
+  //     }
+  //   /*
+  //   uint32_t nodeId = m_rand.GetValue ();
+  //   Ptr<Node> node = Names::Find<Node> ("/sprint", lexical_cast<string> (nodeId));
     
-    Ptr<CcnxL3Protocol> ccnx = node->GetObject<CcnxL3Protocol> ();
-    UniformVariable faceRandom = UniformVariable (0, ccnx->GetNFaces ());
-    uint32_t faceId = faceRandom.GetValue();
-    Ptr<CcnxFace> face = ccnx->GetFace (faceId);
-    face->SetUp(false);
-    */
-  }
+  //   Ptr<CcnxL3Protocol> ccnx = node->GetObject<CcnxL3Protocol> ();
+  //   UniformVariable faceRandom = UniformVariable (0, ccnx->GetNFaces ());
+  //   uint32_t faceId = faceRandom.GetValue();
+  //   Ptr<CcnxFace> face = ccnx->GetFace (faceId);
+  //   face->SetUp(false);
+  //   */
+  // }
 
   //We are creating "everybody-to-everybody" usage pattern
   ApplicationContainer
   AddApplications()
   {
-    NS_LOG_INFO("Adding applications");
-    NS_LOG_INFO("GetN = " << m_reader.GetNodes().GetN());
+    NS_LOG_INFO ("Adding applications");
+    NS_LOG_INFO ("GetN = " << m_reader.GetNodes().GetN());
     
     ApplicationContainer apps;
-    for(uint32_t i = 0; i<m_reader.GetNodes().GetN(); i++)
+    for (uint32_t i = 0; i<m_reader.GetNodes().GetN(); i++)
     {
       NS_LOG_INFO("i="<<i);
       Ptr<Node> node1 = Names::Find<Node> ("/sprint", lexical_cast<string> (i));
@@ -198,8 +137,12 @@
       CcnxAppHelper producerHelper ("ns3::CcnxProducer");
       producerHelper.SetPrefix ("/" + lexical_cast<string> (node1->GetId ()));
         
-      apps.Add(producerHelper.Install (node1));
+      apps.Add (producerHelper.Install (node1));
             
+      CcnxAppHelper consumerHelper ("ns3::CcnxConsumerBatches");
+      consumerHelper.SetAttribute ("LifeTime", StringValue("100s"));
+      consumerHelper.SetAttribute ("Batches", StringValue("0s 10 6s 1 20s 1"));
+      
       for(uint32_t j = 0; j<m_reader.GetNodes().GetN();j++)
       {
         NS_LOG_INFO("j="<<j);
@@ -208,87 +151,137 @@
         
         Ptr<Node> node2 = Names::Find<Node> ("/sprint", lexical_cast<string> (j));
           
-        CcnxAppHelper consumerHelper ("ns3::CcnxConsumer");
-        consumerHelper.SetPrefix ("/" + lexical_cast<string> (node1->GetId ()));
-        consumerHelper.SetAttribute ("MeanRate", StringValue ("1Kbps"));
-        consumerHelper.SetAttribute ("Size", StringValue ("2"));  
-        
-        apps.Add(consumerHelper.Install (node2));
+        consumerHelper.SetPrefix ("/" + lexical_cast<string> (node1->GetId ()) + "/" + lexical_cast<string> (node2->GetId ()));
+        apps.Add (consumerHelper.Install (node2));
       }
     }
     
     return apps;
   }
-
-  UniformVariable m_rand;
-  UniformVariable m_linkRand;
-  RocketfuelWeightsReader m_reader;
 };
 
 int 
 main (int argc, char *argv[])
 {
   cout << "Begin link failure scenario\n";
-  
-  Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("10Mbps"));
-  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("100"));
 
-  Time finishTime1 = Seconds (5.0);
-  Time finishTime2 = Seconds (20.0);
+  Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("100Mbps"));
+  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("2000"));
+  Config::SetDefault ("ns3::RttEstimator::InitialEstimation", StringValue ("0.5s"));
 
+  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("attributes.xml"));
+  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
+  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("Xml"));
+
+  uint32_t maxRuns = 1;
+  uint32_t startRun = 0;
+  std::string failures = "";
   CommandLine cmd;
-  cmd.AddValue ("finish", "Finish time", finishTime1);
+  cmd.AddValue ("start", "Initial run number", startRun);
+  cmd.AddValue ("runs", "Number of runs", maxRuns);
+  cmd.AddValue ("failures", "File with failures", failures);
   cmd.Parse (argc, argv);
 
-  Experiment experiment;
-
-  for (uint32_t i = 0; i < 80; i++)
+  if (failures == "")
     {
-      Config::SetGlobal ("RngRun", IntegerValue (i));
+      std::cerr << "--failures=<file> parameter has to be specified" << std::endl;
+      return 1;
+    }
+
+  // ConfigStore config;
+  // config.ConfigureDefaults ();
+
+  Experiment experiment;
+  for (uint32_t run = startRun; run < startRun + maxRuns; run++)
+    {
+      Config::SetGlobal ("RngRun", IntegerValue (run));
       cout << "seed = " << SeedManager::GetSeed () << ", run = " << SeedManager::GetRun () << endl;
 
       Experiment experiment;
-      cout << "Run " << i << endl;
+      // experiment.GenerateRandomPairs (1);
+      experiment.FailLinks (run);
+      cout << "Run " << run << endl;
       
-      string prefix = "run-" + lexical_cast<string> (i) + "-";
+      string prefix = "link-failure-" + lexical_cast<string> (run) + "-";
   
-      //before link failure
       experiment.ConfigureTopology ();
+      experiment.InstallCcnxStack (false);
       ApplicationContainer apps = experiment.AddApplications ();
-      experiment.ConfigureRouting ();
-      //tracing
-      //...
-      //experiment.Run (finishTime1);
-      
-      //after link failure 
-      experiment.FailLinks(0.1);
-      
+            
       //tracing
       CcnxTraceHelper traceHelper;
-      traceHelper.EnableRateL3All (prefix + "rate-trace.log");
-      traceHelper.EnableSeqsAppAll ("ns3::CcnxConsumer", prefix + "consumers-seqs.log");
-      //...
-      experiment.Run (finishTime2);
+      // traceHelper.EnableRateL3All (prefix + "rate-trace.log");
+      traceHelper.EnableSeqsAppAll ("ns3::CcnxConsumerBatches", prefix + "consumers-seqs.log");
 
-/*
-      for (uint32_t i = 0; i < apps.GetN () / 2; i++) 
-        {
-          cout << "From " << apps.Get (i*2)->GetNode ()->GetId ()
-               << " to "  << apps.Get (i*2 + 1)->GetNode ()->GetId ();
-          cout << "\n";
-        }*/
+      // enable path weights some time from now (ensure that all faces are created)
+      Simulator::Schedule (Seconds (4.5), &CcnxTraceHelper::EnablePathWeights, &traceHelper, prefix + "weights.log");
+      std::cout << "Total " << apps.GetN () << " applications\n";
+
+      experiment.Run (Seconds(40.0));
+    }
+
+
+
   
-      //CcnxTraceHelper traceHelper;
-      // traceHelper.EnableAggregateAppAll ("ns3::CcnxConsumer");
-      // traceHelper.EnableAggregateAppAll ("ns3::CcnxProducer");
-      // traceHelper.EnableAggregateL3All ();
-      // traceHelper.SetL3TraceFile ("trace-l3.log");
-      // traceHelper.SetAppTraceFile ("trace-app.log");
-      // traceHelper.EnableRateL3All ("rate-trace.log");
-      //traceHelper.EnableSeqsAppAll ("ns3::CcnxConsumer", "consumers-seqs.log");
+//   Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("10Mbps"));
+//   Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("100"));
+
+//   Time finishTime1 = Seconds (5.0);
+//   Time finishTime2 = Seconds (20.0);
+
+//   CommandLine cmd;
+//   cmd.AddValue ("finish", "Finish time", finishTime1);
+//   cmd.Parse (argc, argv);
+
+//   Experiment experiment;
+
+//   for (uint32_t i = 0; i < 80; i++)
+//     {
+//       Config::SetGlobal ("RngRun", IntegerValue (i));
+//       cout << "seed = " << SeedManager::GetSeed () << ", run = " << SeedManager::GetRun () << endl;
+
+//       Experiment experiment;
+//       cout << "Run " << i << endl;
+      
+//       string prefix = "run-" + lexical_cast<string> (i) + "-";
+  
+//       //before link failure
+//       experiment.ConfigureTopology ();
+//       ApplicationContainer apps = experiment.AddApplications ();
+//       experiment.ConfigureRouting ();
+//       //tracing
+//       //...
+//       //experiment.Run (finishTime1);
+      
+//       //after link failure 
+//       experiment.FailLinks(0.1);
+      
+//       //tracing
+//       CcnxTraceHelper traceHelper;
+//       traceHelper.EnableRateL3All (prefix + "rate-trace.log");
+//       traceHelper.EnableSeqsAppAll ("ns3::CcnxConsumer", prefix + "consumers-seqs.log");
+//       //...
+//       experiment.Run (finishTime2);
+
+// /*
+//       for (uint32_t i = 0; i < apps.GetN () / 2; i++) 
+//         {
+//           cout << "From " << apps.Get (i*2)->GetNode ()->GetId ()
+//                << " to "  << apps.Get (i*2 + 1)->GetNode ()->GetId ();
+//           cout << "\n";
+//         }*/
+  
+//       //CcnxTraceHelper traceHelper;
+//       // traceHelper.EnableAggregateAppAll ("ns3::CcnxConsumer");
+//       // traceHelper.EnableAggregateAppAll ("ns3::CcnxProducer");
+//       // traceHelper.EnableAggregateL3All ();
+//       // traceHelper.SetL3TraceFile ("trace-l3.log");
+//       // traceHelper.SetAppTraceFile ("trace-app.log");
+//       // traceHelper.EnableRateL3All ("rate-trace.log");
+//       //traceHelper.EnableSeqsAppAll ("ns3::CcnxConsumer", "consumers-seqs.log");
 
       
-    }
+//     }
 
   cout << "Finish link failure scenario\n";
   return 0;
diff --git a/wscript b/wscript
index 68b1f63..7e476b7 100644
--- a/wscript
+++ b/wscript
@@ -110,8 +110,8 @@
         obj = bld.create_ns3_program('congestion-pop', ['NDNabstraction'])
         obj.source = 'examples/congestion-pop.cc'
 
-        #obj = bld.create_ns3_program('link-failure-sprint', ['NDNabstraction'])
-        #obj.source = 'examples/link-failure-sprint.cc'
+        # obj = bld.create_ns3_program('link-failure-sprint', ['NDNabstraction'])
+        # obj.source = 'examples/link-failure-sprint.cc'
 
         obj = bld.create_ns3_program('blackhole-sprint', ['NDNabstraction'])
         obj.source = 'examples/blackhole-sprint.cc'