diff --git a/scenario/extensions/DataRateMerger.cpp b/scenario/extensions/DataRateMerger.cpp index caf8936..91885b5 100644 --- a/scenario/extensions/DataRateMerger.cpp +++ b/scenario/extensions/DataRateMerger.cpp @@ -65,7 +65,7 @@ namespace nfd { if (!this->isInitial) { // 第一次初始化,给所有可能的下一跳设置一个初始的转发权重 for (selected = nexthops.begin(); selected != nexthops.end(); ++selected) { - this->addRate(selected->getFace().getId(), 10000); + this->addRate(selected->getFace().getId(), 100000); } this->isInitial = true; return nexthops.begin(); diff --git a/scenario/scenarios/abilene.cpp b/scenario/scenarios/abilene.cpp index 06460bd..e4070f3 100644 --- a/scenario/scenarios/abilene.cpp +++ b/scenario/scenarios/abilene.cpp @@ -22,7 +22,7 @@ main(int argc, char* argv[]) ndnHelper.InstallAll(); // Choosing forwarding strategy - ndn::StrategyChoiceHelper::InstallAll("/", "/localhost/nfd/strategy/best-route"); + // ndn::StrategyChoiceHelper::InstallAll("/", "/localhost/nfd/strategy/best-route"); ndn::StrategyChoiceHelper::Install(Names::Find("R0"), "/"); ndn::StrategyChoiceHelper::Install(Names::Find("R1"), "/"); ndn::StrategyChoiceHelper::Install(Names::Find("R2"), "/"); @@ -34,7 +34,7 @@ main(int argc, char* argv[]) ndn::StrategyChoiceHelper::Install(Names::Find("R8"), "/"); ndn::StrategyChoiceHelper::Install(Names::Find("R9"), "/"); ndn::StrategyChoiceHelper::Install(Names::Find("R10"), "/"); - //ndn::StrategyChoiceHelper::Install(Names::Find("R3"), "/"); + //xianzai mei xie duo yuan duo jing // Installing global routing interface on all nodes ndn::GlobalRoutingHelper ndnGlobalRoutingHelper; @@ -133,7 +133,8 @@ main(int argc, char* argv[]) // Calculate and install FIBs - ndn::GlobalRoutingHelper::CalculateRoutes(); + // ndn::GlobalRoutingHelper::CalculateRoutes(); + ndn::GlobalRoutingHelper::CalculateAllPossibleRoutes(); Simulator::Stop(Seconds(20.0)); diff --git a/scenario/scenarios/easyloop.cpp b/scenario/scenarios/easyloop.cpp new file mode 100644 index 0000000..12ca2c1 --- /dev/null +++ b/scenario/scenarios/easyloop.cpp @@ -0,0 +1,90 @@ +#include "ns3/core-module.h" +#include "ns3/network-module.h" +#include "ns3/ndnSIM-module.h" +#include "../extensions/random-load-balancer-strategy.hpp" + +namespace ns3 { + +int +main(int argc, char* argv[]) +{ + CommandLine cmd; + cmd.Parse(argc, argv); + + AnnotatedTopologyReader topologyReader("", 25); + topologyReader.SetFileName("topologies/topo_easyloop.txt"); + topologyReader.Read(); + + // Install NDN stack on all nodes + ndn::StackHelper ndnHelper; + ndnHelper.setPolicy("nfd::cs::lru"); + ndnHelper.setCsSize(10000); + ndnHelper.InstallAll(); + + // Choosing forwarding strategy + //ndn::StrategyChoiceHelper::InstallAll("/", "/localhost/nfd/strategy/best-route"); + ndn::StrategyChoiceHelper::Install(Names::Find("R1"), "/"); + ndn::StrategyChoiceHelper::Install(Names::Find("R2"), "/"); + + // Installing global routing interface on all nodes + ndn::GlobalRoutingHelper ndnGlobalRoutingHelper; + ndnGlobalRoutingHelper.InstallAll(); + + // Getting containers for the consumer/producer + Ptr C1 = Names::Find("C1"); + Ptr C2 = Names::Find("C2"); + + Ptr P1 = Names::Find("P1"); + + ndn::AppHelper consumerHelper("ns3::ndn::ConsumerNWFQ"); + consumerHelper.SetAttribute("Dsz", UintegerValue(8616)); + //consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second + + + // on the first consumer node install a Consumer application + // that will express interests in /dst1 namespace + // C1 + consumerHelper.SetPrefix("/A"); + consumerHelper.SetAttribute("Tos", UintegerValue(1)); + consumerHelper.Install("C1"); + + // C2 + consumerHelper.SetPrefix("/B"); + consumerHelper.SetAttribute("Tos", UintegerValue(1)); + consumerHelper.Install("C2"); + + ndn::AppHelper producerHelper("ns3::ndn::Producer"); + producerHelper.SetAttribute("PayloadSize", StringValue("1024")); + + // Register /dst1 prefix with global routing controller and + // install producer that will satisfy Interests in /dst1 namespace + // P1 + ndnGlobalRoutingHelper.AddOrigins("/A", P1); + producerHelper.SetPrefix("/A"); + producerHelper.Install(P1); + + ndnGlobalRoutingHelper.AddOrigins("/B", P1); + producerHelper.SetPrefix("/B"); + producerHelper.Install(P1); + + // Calculate and install FIBs + ndn::GlobalRoutingHelper::CalculateAllPossibleRoutes(); + + Simulator::Stop(Seconds(10.0)); + + ndn::L3RateTracer::InstallAll("easyloop.txt", Seconds(0.5)); + ndn::AppDelayTracer::InstallAll("delay_easyloop.txt"); + L2RateTracer::InstallAll("drop_easyloop.txt", Seconds(0.5)); + Simulator::Run(); + Simulator::Destroy(); + + return 0; +} + +} // namespace ns3 + +int +main(int argc, char* argv[]) +{ + return ns3::main(argc, argv); +} diff --git a/scenario/topologies/topo_abilene.txt b/scenario/topologies/topo_abilene.txt index 974468e..6348d96 100644 --- a/scenario/topologies/topo_abilene.txt +++ b/scenario/topologies/topo_abilene.txt @@ -54,4 +54,4 @@ R9 R10 20Mbps 1 10ms 20 R10 R0 10Mbps 1 10ms 20 R2 R9 20Mbps 1 10ms 20 R3 R8 10Mbps 1 10ms 20 -R5 R7 15Mbps 1 10ms 20 \ No newline at end of file +R5 R7 15Mbps 1 10ms 20 diff --git a/scenario/topologies/topo_easyloop.txt b/scenario/topologies/topo_easyloop.txt new file mode 100644 index 0000000..00881d3 --- /dev/null +++ b/scenario/topologies/topo_easyloop.txt @@ -0,0 +1,22 @@ +# topo_easyloop + +router + +# node comment yPos xPos +C2 NA 1 5 +C1 NA 1 1 +R1 NA 2 2 +R2 NA 2 4 +R3 NA 3 3 +P1 NA 4 3 + + +link + +# srcNode dstNode bandwidth metric delay queue +C1 R1 100Mbps 1 10ms 20 +C2 R2 100Mbps 1 10ms 20 +R1 R2 10Mbps 1 10ms 20 +R1 R3 10Mbps 1 10ms 20 +R2 R3 10Mbps 1 10ms 20 +P1 R3 100Mbps 1 10ms 20