examples: New example showing how to activate link weights for global routing controller calculations
diff --git a/examples/ndn-triangle-calculate-routes.cc b/examples/ndn-triangle-calculate-routes.cc
new file mode 100644
index 0000000..04575c8
--- /dev/null
+++ b/examples/ndn-triangle-calculate-routes.cc
@@ -0,0 +1,99 @@
+/* -*-  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>
+ */
+// ndn-triangle-calculate-routes.cc
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/ndnSIM-module.h"
+
+using namespace ns3;
+using namespace std;
+
+int 
+main (int argc, char *argv[])
+{
+  // setting default parameters for PointToPoint links and channels
+  Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
+  Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
+  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));
+
+  // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
+  CommandLine cmd;
+  cmd.Parse (argc, argv);
+
+  ofstream file1 ("/tmp/topo1.txt");
+  file1 << "router\n\n"
+        << "#node	city	y	x	mpi-partition\n"
+        << "A1	NA	1	1	1\n"
+        << "B1	NA	80	-40	1\n"
+        << "C1	NA	80	40	1\n"
+        << "A2	NA	1	1	1\n"
+        << "B2	NA	80	-40	1\n"
+        << "C2	NA	80	40	1\n\n"
+        << "link\n\n"
+        << "# from  to  capacity	metric	delay	queue\n"
+        << "A1	    B1	10Mbps		100	1ms	100\n"
+        << "A1	    C1	10Mbps		50	1ms	100\n"
+        << "B1	    C1	10Mbps		1	1ms	100\n"
+        << "A2	    B2	10Mbps		50	1ms	100\n"
+        << "A2	    C2	10Mbps		100	1ms	100\n"
+        << "B2	    C2	10Mbps		1	1ms	100\n";
+  file1.close ();
+
+  AnnotatedTopologyReader topologyReader ("");
+  topologyReader.SetFileName ("/tmp/topo1.txt");
+  topologyReader.Read ();
+
+  // Install NDN stack on all nodes
+  ndn::StackHelper ndnHelper;
+  ndnHelper.InstallAll ();
+
+  topologyReader.ApplyOspfMetric ();
+
+  ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
+  ndnGlobalRoutingHelper.InstallAll ();
+
+  ndnGlobalRoutingHelper.AddOrigins ("/test/prefix", Names::Find<Node> ("C1"));
+  ndnGlobalRoutingHelper.AddOrigins ("/test/prefix", Names::Find<Node> ("C2"));
+  ndn::GlobalRoutingHelper::CalculateRoutes ();
+
+  cout << "FIB content on node A1" << endl;
+  Ptr<ndn::Fib> fib = Names::Find<Node> ("A1")->GetObject<ndn::Fib> ();
+  for (Ptr<ndn::fib::Entry> entry = fib->Begin (); entry != fib->End (); entry = fib->Next (entry))
+    {
+      cout << *entry << " (this is towards: ";
+      cout << Names::FindName (DynamicCast<const ndn::NetDeviceFace> (entry->FindBestCandidate (0).GetFace ())->GetNetDevice ()->GetChannel ()->GetDevice (1)->GetNode ());
+      cout << ")" << endl;
+    }
+
+  cout << "FIB content on node A2" << endl;
+  fib = Names::Find<Node> ("A2")->GetObject<ndn::Fib> ();
+  for (Ptr<ndn::fib::Entry> entry = fib->Begin (); entry != fib->End (); entry = fib->Next (entry))
+    {
+      cout << *entry << " (this is towards: ";
+      cout << Names::FindName (DynamicCast<const ndn::NetDeviceFace> (entry->FindBestCandidate (0).GetFace ())->GetNetDevice ()->GetChannel ()->GetDevice (1)->GetNode ());
+      cout << ")" << endl;
+    }
+    
+  Simulator::Stop (Seconds (20.0));
+  Simulator::Run ();
+  Simulator::Destroy ();
+  
+  return 0;
+}
diff --git a/examples/wscript b/examples/wscript
index bbc0f06..4f8eddd 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -54,6 +54,9 @@
         obj = bld.create_ns3_program('ndn-tree-with-l2tracer', all_modules)
         obj.source = 'ndn-tree-with-l2tracer.cc'
 
+        obj = bld.create_ns3_program('ndn-triangle-calculate-routes', all_modules)
+        obj.source = 'ndn-triangle-calculate-routes.cc'
+
     obj = bld.create_ns3_program('ndn-simple-pit-policies', all_modules)
     obj.source = 'ndn-simple-pit-policies.cc'