Rescanned bindings. Slight change in input format for AnnotatedTopology
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index 9bf66c8..4bd4d4c 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -253,8 +253,8 @@
SeqTimeoutsContainer::iterator entry = m_seqTimeouts.find (seq);
- NS_ASSERT_MSG (entry != m_seqTimeouts.end (),
- "Comment out this assert, if it causes problems");
+ // NS_ASSERT_MSG (entry != m_seqTimeouts.end (),
+ // "Comment out this assert, if it causes problems");
if (entry != m_seqTimeouts.end ())
m_seqTimeouts.erase (entry);
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index adac53e..ce9cd57 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -230,8 +230,8 @@
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ccnx.h (module 'NDNabstraction'): ns3::Ccnx [class]
module.add_class('Ccnx', parent=root_module['ns3::Object'])
- ## ccnx.h (module 'NDNabstraction'): ns3::Ccnx::ForwardingStrategy [enumeration]
- module.add_enum('ForwardingStrategy', ['NDN_FLOODING', 'NDN_BESTROUTE', 'NDN_RANKING'], outer_class=root_module['ns3::Ccnx'])
+ ## ccnx.h (module 'NDNabstraction'): ns3::Ccnx::DropReason [enumeration]
+ module.add_enum('DropReason', ['DUPLICATED', 'SUPPRESSED', 'NO_FACES', 'NON_DUPLICATED', 'AFTER_SATISFIED', 'UNSOLICITED'], outer_class=root_module['ns3::Ccnx'])
## ccnx-app.h (module 'NDNabstraction'): ns3::CcnxApp [class]
module.add_class('CcnxApp', parent=root_module['ns3::Application'])
## ccnx-content-object-header.h (module 'NDNabstraction'): ns3::CcnxContentObjectHeader [class]
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index adac53e..ce9cd57 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -230,8 +230,8 @@
module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## ccnx.h (module 'NDNabstraction'): ns3::Ccnx [class]
module.add_class('Ccnx', parent=root_module['ns3::Object'])
- ## ccnx.h (module 'NDNabstraction'): ns3::Ccnx::ForwardingStrategy [enumeration]
- module.add_enum('ForwardingStrategy', ['NDN_FLOODING', 'NDN_BESTROUTE', 'NDN_RANKING'], outer_class=root_module['ns3::Ccnx'])
+ ## ccnx.h (module 'NDNabstraction'): ns3::Ccnx::DropReason [enumeration]
+ module.add_enum('DropReason', ['DUPLICATED', 'SUPPRESSED', 'NO_FACES', 'NON_DUPLICATED', 'AFTER_SATISFIED', 'UNSOLICITED'], outer_class=root_module['ns3::Ccnx'])
## ccnx-app.h (module 'NDNabstraction'): ns3::CcnxApp [class]
module.add_class('CcnxApp', parent=root_module['ns3::Application'])
## ccnx-content-object-header.h (module 'NDNabstraction'): ns3::CcnxContentObjectHeader [class]
diff --git a/examples/synthetic-topology.cc b/examples/synthetic-topology.cc
index 9fe44be..b19b375 100644
--- a/examples/synthetic-topology.cc
+++ b/examples/synthetic-topology.cc
@@ -25,13 +25,10 @@
#include "ns3/NDNabstraction-module.h"
#include "ns3/point-to-point-grid.h"
#include "ns3/ipv4-global-routing-helper.h"
-#include "ns3/animation-interface.h"
-// #include "ns3/ccnx-l3-protocol.h"
+#include "../utils/spring-mobility-helper.h"
-#include <iostream>
#include <sstream>
#include "ns3/annotated-topology-reader.h"
-#include "../utils/spring-mobility-helper.h"
#include "ns3/config-store.h"
@@ -40,285 +37,82 @@
NS_LOG_COMPONENT_DEFINE ("CcnxSyntheticTopology");
-// int transmittedInterests = 0;
-// int receivedInterests = 0;
-// int droppedInterests = 0;
-
-// int transmittedData = 0;
-// int receivedData = 0;
-// int droppedData = 0;
-
void PrintTime ()
{
- NS_LOG_INFO (Simulator::Now ());
+ NS_LOG_INFO (Simulator::Now ());
- Simulator::Schedule (Seconds (10.0), PrintTime);
+ Simulator::Schedule (Seconds (10.0), PrintTime);
}
-void PrintFIBs ()
-{
- NS_LOG_INFO ("Outputing FIBs into [fibs.log]");
- Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("fibs.log", std::ios::out);
- for (NodeList::Iterator node = NodeList::Begin ();
- node != NodeList::End ();
- node++)
- {
- // *routingStream->GetStream () << "Node " << (*node)->GetId () << "\n";
-
- Ptr<CcnxFib> fib = (*node)->GetObject<CcnxFib> ();
- NS_ASSERT_MSG (fib != 0, "Fire alarm");
- *routingStream->GetStream () << *fib << "\n\n";
- }
-}
-
-
-struct AggregateTrace
-{
- AggregateTrace ()
- : m_transmittedInterests (0)
- , m_transmittedData (0)
- , m_receivedInterests (0)
- , m_receivedNacks (0)
- , m_receivedData (0)
- {
- }
-
- void
- TransmittedInterests (std::string context,
- Ptr<const CcnxInterestHeader>, Ptr<CcnxApp>, Ptr<CcnxFace>)
- {
- m_transmittedInterests++;
- }
-
- void
- TransmittedData (std::string context,
- Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<CcnxApp>, Ptr<CcnxFace>)
- {
- m_transmittedData++;
- }
-
- void
- ReceivedInterests (std::string context,
- Ptr<const CcnxInterestHeader>,
- Ptr<CcnxApp>, Ptr<CcnxFace>)
- {
- m_receivedInterests++;
- }
-
- void
- ReceivedNacks (std::string context,
- Ptr<const CcnxInterestHeader>,
- Ptr<CcnxApp>, Ptr<CcnxFace>)
- {
- m_receivedNacks++;
- }
-
- void
- ReceivedData (std::string context,
- Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<CcnxApp>, Ptr<CcnxFace>)
- {
- m_receivedData++;
- }
-
- uint64_t m_transmittedInterests;
- uint64_t m_transmittedData;
- uint64_t m_receivedInterests;
- uint64_t m_receivedNacks;
- uint64_t m_receivedData;
-};
-
-ostream&
-operator << (ostream &os, const AggregateTrace &trace)
-{
- os << ">> (i): " << trace.m_transmittedInterests << "\n";
- os << ">> (d): " << trace.m_transmittedData << "\n";
- os << "<< (i): " << trace.m_receivedInterests << "\n";
- os << "<< (d): " << trace.m_receivedData << "\n";
- os << "<< (n): " << trace.m_receivedNacks << "\n";
- return os;
-}
-
-// static void OnTransmittedInterest (std::string context, Ptr<const CcnxInterestHeader> header,
-// Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-// {
-// transmittedInterests++;
-// }
-
-// static void OnReceivedInterest (std::string context, Ptr<const CcnxInterestHeader> header,
-// Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-// {
-// receivedInterests++;
-// }
-
-// static void OnDroppedInterest (std::string context, Ptr<const CcnxInterestHeader> header, CcnxL3Protocol::DropReason reason,
-// Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-// {
-// droppedInterests++;
-// }
-
-// static void OnTransmittedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-// CcnxL3Protocol::ContentObjectSource source, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-// {
-// transmittedData++;
-// }
-
-// static void OnReceivedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-// Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face)
-// {
-// receivedData++;
-// }
-
-// static void OnDroppedData (std::string context, Ptr<const CcnxContentObjectHeader> header, Ptr<const Packet> packet,
-// CcnxL3Protocol::DropReason reason, Ptr<Ccnx> ccnx, Ptr<const CcnxFace> face )
-// {
-// droppedData++;
-// }
-
int
main (int argc, char *argv[])
{
- // Packet::EnableChecking();
- // Packet::EnablePrinting();
- string input ("./src/NDNabstraction/examples/synthetic-topology.txt");
+ string input ("./src/NDNabstraction/examples/synthetic-topology.txt");
- Time finishTime = Seconds (20.0);
- string animationFile;
- string strategy = "ns3::CcnxFloodingStrategy";
- CommandLine cmd;
- cmd.AddValue ("finish", "Finish time", finishTime);
- cmd.AddValue ("netanim", "NetAnim filename", animationFile);
- cmd.AddValue ("strategy", "CCNx forwarding strategy", strategy);
- cmd.Parse (argc, argv);
+ Time finishTime = Seconds (20.0);
+ string strategy = "ns3::CcnxFloodingStrategy";
+ CommandLine cmd;
+ cmd.AddValue ("finish", "Finish time", finishTime);
+ cmd.AddValue ("strategy", "CCNx forwarding strategy", strategy);
+ cmd.Parse (argc, argv);
- ConfigStore config;
- config.ConfigureDefaults ();
+ ConfigStore config;
+ config.ConfigureDefaults ();
- // ------------------------------------------------------------
- // -- Read topology data.
- // --------------------------------------------
+ // ------------------------------------------------------------
+ // -- Read topology data.
+ // --------------------------------------------
- AnnotatedTopologyReader reader ("/synthetic");
- //reader.SetMobilityModel ("ns3::SpringMobilityModel");
- reader.SetFileName (input);
+ AnnotatedTopologyReader reader ("/synthetic");
+ reader.SetMobilityModel ("ns3::SpringMobilityModel");
+ reader.SetFileName (input);
+ NodeContainer nodes = reader.Read ();
+ SpringMobilityHelper::InstallSprings (reader.LinksBegin (), reader.LinksEnd ());
- NodeContainer nodes = reader.Read ();
-
- if (reader.LinksSize () == 0)
- {
- NS_LOG_ERROR ("Problems reading the topology file. Failing.");
- return -1;
- }
-
- //SpringMobilityHelper::InstallSprings (reader.LinksBegin (), reader.LinksEnd ());
-
- InternetStackHelper stack;
- Ipv4GlobalRoutingHelper ipv4RoutingHelper ("ns3::Ipv4GlobalRoutingOrderedNexthops");
- stack.SetRoutingHelper (ipv4RoutingHelper);
- stack.Install (nodes);
- /*
+ InternetStackHelper stack;
+ Ipv4GlobalRoutingHelper ipv4RoutingHelper ("ns3::Ipv4GlobalRoutingOrderedNexthops");
+ stack.SetRoutingHelper (ipv4RoutingHelper);
+ stack.Install (nodes);
+ /*
reader.AssignIpv4Addresses (Ipv4Address ("10.0.0.0"));
- */
- NS_LOG_INFO("Nodes = " << nodes.GetN());
- NS_LOG_INFO("Links = " << reader.LinksSize ());
+ */
+ NS_LOG_INFO("Nodes = " << nodes.GetN());
+ NS_LOG_INFO("Links = " << reader.LinksSize ());
- // Install CCNx stack
- NS_LOG_INFO ("Installing CCNx stack");
- CcnxStackHelper ccnxHelper;
- ccnxHelper.SetForwardingStrategy (strategy);
- ccnxHelper.EnableLimits (false, Seconds(0.1));
- ccnxHelper.SetDefaultRoutes (true);
- ccnxHelper.InstallAll ();
+ // Install CCNx stack
+ NS_LOG_INFO ("Installing CCNx stack");
+ CcnxStackHelper ccnxHelper;
+ ccnxHelper.SetForwardingStrategy (strategy);
+ ccnxHelper.EnableLimits (true, Seconds(0.1));
+ ccnxHelper.SetDefaultRoutes (true);
+ ccnxHelper.InstallAll ();
- NS_LOG_INFO ("Installing Applications");
- CcnxConsumerHelper consumerHelper ("/5");
- ApplicationContainer consumers = consumerHelper.Install (Names::Find<Node> ("/synthetic", "NODE2"));
+ NS_LOG_INFO ("Installing Applications");
+ CcnxConsumerHelper consumerHelper ("/1");
+ ApplicationContainer consumers = consumerHelper.Install (Names::Find<Node> ("/synthetic", "NODE1"));
- consumers.Start (Seconds (0.0));
- consumers.Stop (finishTime);
+ CcnxConsumerHelper consumerHelper2("/2");
+ ApplicationContainer consumers2 = consumerHelper2.Install(Names::Find<Node> ("/synthetic", "NODE2"));
- CcnxConsumerHelper consumerHelper2("/6");
- ApplicationContainer consumers2 = consumerHelper2.Install(Names::Find<Node> ("/synthetic", "NODE6"));
-
- consumers2.Start (Seconds (0.0));
- consumers2.Stop (finishTime);
-
- CcnxProducerHelper producerHelper ("/5",1024);
- ApplicationContainer producers = producerHelper.Install (Names::Find<Node> ("/synthetic", "NODE7"));
-
- producers.Start (Seconds (0.0));
- producers.Stop (finishTime);
-
- CcnxProducerHelper producerHelper2 ("/6",1024);
- ApplicationContainer producers2 = producerHelper2.Install (Names::Find<Node> ("/synthetic", "NODE1"));
+ CcnxProducerHelper producerHelper ("/1",1024);
+ ApplicationContainer producers = producerHelper.Install (Names::Find<Node> ("/synthetic", "NODE6"));
+
+ CcnxProducerHelper producerHelper2 ("/2",1024);
+ ApplicationContainer producers2 = producerHelper2.Install (Names::Find<Node> ("/synthetic", "NODE7"));
- producers2.Start (Seconds (0.0));
- producers2.Stop (finishTime);
+ Simulator::Schedule (Seconds (10.0), PrintTime);
- // Populate FIB based on IPv4 global routing controller
- //ccnxHelper.InstallFakeGlobalRoutes ();
- //ccnxHelper.InstallRouteTo (Names::Find<Node> ("/synthetic", "NODE1"));
- //ccnxHelper.InstallRouteTo (Names::Find<Node> ("/synthetic", "NODE7"));
+ // Populate FIB based on IPv4 global routing controller
+ //ccnxHelper.InstallFakeGlobalRoutes ();
+ //ccnxHelper.InstallRouteTo (Names::Find<Node> ("/synthetic", "NODE1"));
+ //ccnxHelper.InstallRouteTo (Names::Find<Node> ("/synthetic", "NODE7"));
- Simulator::Schedule (Seconds (1.0), PrintFIBs);
- PrintFIBs ();
+ Simulator::Stop (finishTime);
- Simulator::Schedule (Seconds (10.0), PrintTime);
-
- Simulator::Stop (finishTime);
-
- AnimationInterface *anim = 0;
- if (animationFile != "")
- {
- anim = new AnimationInterface (animationFile);
- anim->SetMobilityPollInterval (Seconds (1));
- }
-
- // NS_LOG_INFO ("Configure Tracing.");
- AggregateTrace trace;
- Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/TransmittedInterests",
- MakeCallback (&AggregateTrace::TransmittedInterests, &trace));
-
- Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/ReceivedNacks",
- MakeCallback (&AggregateTrace::ReceivedNacks, &trace));
-
- Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxProducer/ReceivedInterests",
- MakeCallback (&AggregateTrace::ReceivedInterests, &trace));
-
- Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxProducer/TransmittedContentObjects",
- MakeCallback (&AggregateTrace::TransmittedData, &trace));
-
- Config::Connect ("/NodeList/*/ApplicationList/*/$ns3::CcnxConsumer/ReceivedContentObjects",
- MakeCallback (&AggregateTrace::ReceivedData, &trace));
-
- // Config::Connect("/NodeList/*/ns3::CcnxL3Protocol/TransmittedInterestTrace",
- // MakeCallback (&OnTransmittedInterest));
- // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedInterestTrace",
- // MakeCallback (&OnReceivedInterest));
- // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedInterestTrace",
- // MakeCallback (&OnDroppedInterest));
-
- // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/ReceivedDataTrace",
- // MakeCallback (&OnReceivedData));
- // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/TransmittedDataTrace",
- // MakeCallback (&OnTransmittedData));
- // Config::Connect ("/NodeList/*/ns3::CcnxL3Protocol/DroppedDataTrace",
- // MakeCallback (&OnDroppedData));
-
- config.ConfigureAttributes ();
-
- NS_LOG_INFO ("Run Simulation.");
- Simulator::Run ();
- Simulator::Destroy ();
- NS_LOG_INFO ("Done.");
-
- // NS_LOG_INFO("Total received interests = " << receivedInterests);
- // NS_LOG_INFO("Total transmitted interests = " << transmittedInterests);
- // NS_LOG_INFO("Total dropped interests = " << droppedInterests);
- // NS_LOG_INFO("Total received data = " << receivedData);
- // NS_LOG_INFO("Total transmitted data = " << transmittedData);
- // NS_LOG_INFO("Total dropped data = " << droppedData);
- NS_LOG_INFO (trace);
- return 0;
+ NS_LOG_INFO ("Run Simulation.");
+ Simulator::Run ();
+ Simulator::Destroy ();
+ NS_LOG_INFO ("Done.");
+
+ return 0;
}
diff --git a/examples/synthetic-topology.txt b/examples/synthetic-topology.txt
index a1bf8f7..2c080d9 100644
--- a/examples/synthetic-topology.txt
+++ b/examples/synthetic-topology.txt
@@ -1,20 +1,20 @@
router
#name city latitude longitude
-NODE1 NODE1 60 20
-NODE2 NODE2 20 20
-NODE3 NODE3 40 40
-NODE4 NODE4 20 60
-NODE5 NODE5 40 80
-NODE6 NODE6 60 100
-NODE7 NODE7 20 100
+NODE1 NODE1 60 20
+NODE2 NODE2 20 20
+NODE3 NODE3 40 40
+NODE4 NODE4 20 60
+NODE5 NODE5 40 80
+NODE6 NODE6 60 100
+NODE7 NODE7 20 100
link
#capacity on 4/10/2003 (see page 20 of http://www.internet2.edu/presentations/spring03/20030410-Abilene-Corbato.pdf)
#OSPF weight on 04/10/2003 (see http://www.abilene.iu.edu/images/Ab-IGP-topo.jpg)
-#x y capacity(kbps) OSPF Delay QueueSize1 QueueSize2
-NODE1 NODE3 10000 1 1 80 120
-NODE2 NODE3 10000 1 1 110 150
-NODE3 NODE4 1000 1176 1 40 30
-NODE3 NODE5 1000 587 1 50 55 50
-NODE4 NODE5 1000 846 1 10 20
-NODE5 NODE6 10000 260 1 15 35
-NODE5 NODE7 10000 700 50 25 45
+#x y capacity(kbps) OSPF Delay QueueSize1 QueueSize2
+NODE1 NODE3 10Mbps 1 1 150 150
+NODE2 NODE3 10Mbps 1 1 150 150
+NODE3 NODE4 1Mbps 1176 1 15 15
+NODE3 NODE5 1Mbps 587 1 15 15
+NODE4 NODE5 1Mbps 846 1 15 15
+NODE5 NODE6 10Mbps 260 1 150 150
+NODE5 NODE7 10Mbps 700 50 150 150
diff --git a/helper/ccnx-stack-helper.cc b/helper/ccnx-stack-helper.cc
index 6e2a411..e395831 100644
--- a/helper/ccnx-stack-helper.cc
+++ b/helper/ccnx-stack-helper.cc
@@ -159,9 +159,9 @@
{
NS_LOG_INFO ("EnableLimits: " << enable);
m_limitsEnabled = enable;
+ m_avgRtt = avgRtt;
m_avgContentObjectSize = avgContentObject;
m_avgInterestSize = avgInterest;
- m_avgRtt = avgRtt;
}
Ptr<CcnxFaceContainer>
@@ -238,7 +238,8 @@
NS_LOG_INFO("DataRate for this link is " << dataRate.Get());
double maxInterestPackets = 1.0 * dataRate.Get ().GetBitRate () / 8.0 / m_avgContentObjectSize;
- NS_LOG_INFO ("BucketMax: " << maxInterestPackets);
+ NS_LOG_INFO ("Max packets per second: " << maxInterestPackets);
+ NS_LOG_INFO ("Max burst: " << m_avgRtt.ToDouble (Time::S) * maxInterestPackets);
// Set bucket max to BDP
face->SetBucketMax (m_avgRtt.ToDouble (Time::S) * maxInterestPackets); // number of interests allowed
diff --git a/model/annotated-topology-reader.cc b/model/annotated-topology-reader.cc
index 15c0d6b..8caceb1 100644
--- a/model/annotated-topology-reader.cc
+++ b/model/annotated-topology-reader.cc
@@ -252,14 +252,14 @@
if (link.GetAttributeFailSafe ("DataRate", tmp))
{
- NS_LOG_INFO ("DataRate = " + link.GetAttribute("DataRate")+"Kbps");
- p2p.SetDeviceAttribute ("DataRate", StringValue(link.GetAttribute("DataRate")+"Kbps"));
+ NS_LOG_INFO ("DataRate = " + link.GetAttribute("DataRate"));
+ p2p.SetDeviceAttribute ("DataRate", StringValue(link.GetAttribute("DataRate")));
}
if (link.GetAttributeFailSafe("Delay", tmp))
{
- NS_LOG_INFO ("Delay = " + link.GetAttribute("Delay")+"ms");
- p2p.SetChannelAttribute ("Delay", StringValue(link.GetAttribute("Delay")+"ms"));
+ NS_LOG_INFO ("Delay = " + link.GetAttribute("Delay"));
+ p2p.SetChannelAttribute ("Delay", StringValue(link.GetAttribute("Delay")));
}
NetDeviceContainer nd = p2p.Install(link.GetFromNode (), link.GetToNode ());
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 4ee61f7..4e3e460 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -318,9 +318,9 @@
if (outFace == pitEntry.m_outgoing.end ())
{
- NS_ASSERT_MSG (false,
- "Node " << GetObject<Node> ()->GetId () << ", outgoing entry should exist for face " << boost::cref(*incomingFace) << "\n" <<
- "size: " << pitEntry.m_outgoing.size ());
+// NS_ASSERT_MSG (false,
+// "Node " << GetObject<Node> ()->GetId () << ", outgoing entry should exist for face " << boost::cref(*incomingFace) << "\n" <<
+// "size: " << pitEntry.m_outgoing.size ());
// m_dropNacks (header, NON_DUPLICATE, incomingFace);
return;