Closed mk228 closed 9 years ago
Hi,
are you using ndnSIM? can you share the code that you are running?
Klaus
Hi, I use ndnSIM 2.0 . this code not use new policy. the code use LRU cache policy. But has problem that said.
namespace ns3 {
int main(int argc, char* argv[]) { CommandLine cmd; cmd.Parse(argc, argv);
//read topology from text AnnotatedTopologyReader topologyReader("", 25); topologyReader.SetFileName("src/ndnSIM/examples/topologies/cs.txt"); topologyReader.Read();
Ptr
Ptr
// Install NDN stack on all nodes ndn::StackHelper ndnHelperC;
ndn::StackHelper ndnHelperR;
ndn::StackHelper ndnHelperP;
for(int i=0;i<2;i++){ ndnHelperC.SetOldContentStore("ns3::ndn::cs::Nocache"); ndnHelperC.Install(consumer[i]);}
for(int i=0;i<3;i++){
ndnHelperR.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "3"); // default ContentStore parameters ndnHelperR.Install(router[i]); }
ndnHelperP.SetOldContentStore("ns3::ndn::cs::Lfu", "MaxSize","100"); // default ContentStore parameters ndnHelperP.Install(producer);
// Choosing forwarding strategy ndn::StrategyChoiceHelper::InstallAll("/", "/localhost/nfd/strategy/best-route");
// Installing global routing interface on all nodes ndn::GlobalRoutingHelper ndnGlobalRoutingHelper; ndnGlobalRoutingHelper.InstallAll();
// Install NDN applications
for (int i = 0; i < 2; i++) { std::string prefix = "/video/"; //+Names::FindName (consumer[i]); // install consumer app on consumer node c_i to request data from producer p_i // /////////////////////// ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot"); //consumerHelper.SetAttribute ("LifeTime", StringValue ("0.00000001s")); consumerHelper.SetAttribute ("Frequency", StringValue ("1")); // 2 interests a second consumerHelper.SetAttribute("NumberOfContents", StringValue("5")); //4 different content object //consumerHelper.SetAttribute("MaxSeq", StringValue("2"));
consumerHelper.SetPrefix (prefix); ApplicationContainer consumers = consumerHelper.Install (consumer[i]); consumers.Start (Seconds (0)); // start consumers at 0 consumers.Stop (Seconds (20)); // stop consumers at 100 /////////////////////////////////////////////// // install producer app on producer node p_i // /////////////////////////////////////////////// ndn::AppHelper producerHelper ("ns3::ndn::Producer"); //producerHelper.SetAttribute ("PayloadSize", StringValue("1024")); producerHelper.SetPrefix (prefix); ApplicationContainer producers = producerHelper.Install (producer); // when Start/Stop time is not specified, the application is running throughout the simulation // Add /prefix origins to ndn::GlobalRouter ndnGlobalRoutingHelper.AddOrigins (prefix, producer); } // Calculate and install FIBs ndnGlobalRoutingHelper.CalculateAllPossibleRoutes();
Simulator::Stop(Seconds(20.0)); ndn::L3RateTracer::InstallAll("rate-trace.txt", Seconds(1.0));
ndn::CsTracer::InstallAll("cs-trace1.txt", Seconds(1)); Simulator::Run(); Simulator::Destroy();
return 0; }
} // namespace ns3
int main(int argc, char* argv[]) { return ns3::main(argc, argv); }
Hi,
your code looks fine to me.
Since it is not a problem with our new policy I think you should post the question to the ndnSIM mailing list: ndnSIM@lists.cs.ucla.edu
On 10/17/2015 10:22 PM, mk228 wrote:
Hi, I use ndnSIM 2.0 . this code not use new policy. the code use LRU cache policy. But has problem that said.
include "ns3/core-module.h"
include "ns3/network-module.h"
include "ns3/ndnSIM-module.h"
namespace ns3 {
int main(int argc, char* argv[]) { CommandLine cmd; cmd.Parse(argc, argv);
//read topology from text AnnotatedTopologyReader topologyReader("", 25); topologyReader.SetFileName("src/ndnSIM/examples/topologies/cs.txt"); topologyReader.Read();
Ptr consumer[2]= {Names::Find("Src1"),Names::Find("Src2")}; Ptr router[3]= {Names::Find("Rtr1"),Names::Find("Rtr2"),Names::Find("Rtr3")};
Ptr producer = Names::Find("Dst1");
// Install NDN stack on all nodes ndn::StackHelper ndnHelperC;
ndn::StackHelper ndnHelperR;
ndn::StackHelper ndnHelperP;
for(int i=0;i<2;i++){ ndnHelperC.SetOldContentStore("ns3::ndn::cs::Nocache"); ndnHelperC.Install(consumer[i]);}
for(int i=0;i<3;i++){
ndnHelperR.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "3"); // default ContentStore parameters ndnHelperR.Install(router[i]); }
ndnHelperP.SetOldContentStore("ns3::ndn::cs::Lfu", "MaxSize","100"); // default ContentStore parameters ndnHelperP.Install(producer);
// Choosing forwarding strategy ndn::StrategyChoiceHelper::InstallAll("/", "/localhost/nfd/strategy/best-route");
// Installing global routing interface on all nodes ndn::GlobalRoutingHelper ndnGlobalRoutingHelper; ndnGlobalRoutingHelper.InstallAll();
// Install NDN applications
for (int i = 0; i < 2; i++) { std::string prefix = "/video/"; //+Names::FindName (consumer[i]); // install consumer app on consumer node c_i to request data from producer p_i // /////////////////////// ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot"); //consumerHelper.SetAttribute ("LifeTime", StringValue ("0.00000001s")); consumerHelper.SetAttribute ("Frequency", StringValue ("1")); // 2 interests a second consumerHelper.SetAttribute("NumberOfContents", StringValue("5")); //4 different content object //consumerHelper.SetAttribute("MaxSeq", StringValue("2"));
consumerHelper.SetPrefix (prefix); ApplicationContainer consumers = consumerHelper.Install (consumer[i]); consumers.Start (Seconds (0)); // start consumers at 0 consumers.Stop (Seconds (20)); // stop consumers at 100 /////////////////////////////////////////////// // install producer app on producer node p_i // /////////////////////////////////////////////// ndn::AppHelper producerHelper ("ns3::ndn::Producer"); //producerHelper.SetAttribute ("PayloadSize", StringValue("1024")); producerHelper.SetPrefix (prefix); ApplicationContainer producers = producerHelper.Install (producer); // when Start/Stop time is not specified, the application is running throughout the simulation // Add /prefix origins to ndn::GlobalRouter ndnGlobalRoutingHelper.AddOrigins (prefix, producer); } // Calculate and install FIBs ndnGlobalRoutingHelper.CalculateAllPossibleRoutes();
Simulator::Stop(Seconds(20.0)); ndn::L3RateTracer::InstallAll("rate-trace.txt", Seconds(1.0));
ndn::CsTracer::InstallAll("cs-trace1.txt", Seconds(1)); Simulator::Run(); Simulator::Destroy();
return 0; }
} // namespace ns3
int main(int argc, char* argv[]) { return ns3::main(argc, argv); }
— Reply to this email directly or view it on GitHub https://github.com/ndncomm/nfd-caching-policies/issues/1#issuecomment-148979934.
I write a new cache policy. I want to test it and run 10 times. how can generate new traffic for each test?? each time i run my scenario , the results always show the same interest .