bh: add complex topo

This commit is contained in:
SunnyQjm committed 2021-10-14 10:07:34 +08:00
1 parent eabfd21698
commit af4ecdf552
5 files changed
+118 -5

No files matched your search

+1 -1
View File
@@ -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();
+4 -3
View File
@@ -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<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R0"), "/");
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R1"), "/");
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R2"), "/");
@@ -34,7 +34,7 @@ main(int argc, char* argv[])
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R8"), "/");
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R9"), "/");
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R10"), "/");
//ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("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));
+90
View File
@@ -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<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R1"), "/");
ndn::StrategyChoiceHelper::Install<nfd::fw::RandomLoadBalancerStrategy>(Names::Find<Node>("R2"), "/");
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
Ptr<Node> C1 = Names::Find<Node>("C1");
Ptr<Node> C2 = Names::Find<Node>("C2");
Ptr<Node> P1 = Names::Find<Node>("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);
}
+1 -1
View File
@@ -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
R5 R7 15Mbps 1 10ms 20
+22
View File
@@ -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