update
This commit is contained in:
1 parent
d75b3d40d9
commit
6b7c86c654
26 files changed
+1549
-123
No files matched your search
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"*.txt": "cpp",
|
||||||
|
"fstream": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "mircc-consumer.hpp"
|
#include "mircc-consumer.hpp"
|
||||||
#include "ns3/ptr.h"
|
#include "ns3/ptr.h"
|
||||||
#include "ns3/log.h"
|
#include "ns3/log.h"
|
||||||
@@ -124,8 +122,11 @@ ConsumerMIRCC:: StopApplication()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConsumerMIRCC:: mircclog()
|
ConsumerMIRCC::mircclog()
|
||||||
{
|
{
|
||||||
|
if (logtms == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
log_event = Simulator::Schedule(Seconds((double)logtms/1000), &ConsumerMIRCC::mircclog, this);
|
log_event = Simulator::Schedule(Seconds((double)logtms/1000), &ConsumerMIRCC::mircclog, this);
|
||||||
double time = logcnt * (double)logtms / 1000;
|
double time = logcnt * (double)logtms / 1000;
|
||||||
|
|
||||||
@@ -174,12 +175,15 @@ ConsumerMIRCC:: StartApplication()
|
|||||||
|
|
||||||
// 调用父类开启face等接口服务
|
// 调用父类开启face等接口服务
|
||||||
App::StartApplication();
|
App::StartApplication();
|
||||||
|
|
||||||
log_event = Simulator::Schedule(Seconds((double)logtms/1000), &ConsumerMIRCC::mircclog, this);
|
// 如果logtms == 0,不记录客户端日志
|
||||||
std::ofstream ofs;
|
if (logtms > 0) {
|
||||||
ofs.open(std::to_string(appid) + ".txt",std::ios::app);
|
log_event = Simulator::Schedule(Seconds((double)logtms/1000), &ConsumerMIRCC::mircclog, this);
|
||||||
ofs << "Time Node FaceId FaceDescr Type Packets Kilobytes PacketRaw KilobytesRaw" << std::endl;
|
std::ofstream ofs;
|
||||||
ofs.close();
|
ofs.open(std::to_string(appid) + ".txt",std::ios::app);
|
||||||
|
ofs << "Time Node FaceId FaceDescr Type Packets Kilobytes PacketRaw KilobytesRaw" << std::endl;
|
||||||
|
ofs.close();
|
||||||
|
}
|
||||||
|
|
||||||
// 调用路径探索
|
// 调用路径探索
|
||||||
if (pathId2RandomId.size() == 0)
|
if (pathId2RandomId.size() == 0)
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
#include "ndn-consumer-nwfq.hpp"
|
|
||||||
|
|
||||||
NS_LOG_COMPONENT_DEFINE("ndn.ConsumerNWFQ");
|
|
||||||
namespace ns3 {
|
|
||||||
namespace ndn {
|
|
||||||
NS_OBJECT_ENSURE_REGISTERED(ConsumerNWFQ);
|
|
||||||
|
|
||||||
|
|
||||||
TypeId ConsumerNWFQ::GetTypeId() {
|
|
||||||
static TypeId tid =
|
|
||||||
TypeId("ns3::ndn::ConsumerNWFQ")
|
|
||||||
.SetGroupName("Ndn")
|
|
||||||
.SetParent<ConsumerPcon>()
|
|
||||||
.AddConstructor<ConsumerNWFQ>()
|
|
||||||
// Add Attribute here
|
|
||||||
.AddAttribute("Tos",
|
|
||||||
"Type of service",
|
|
||||||
UintegerValue(1),
|
|
||||||
MakeUintegerAccessor(&ConsumerNWFQ::tos),
|
|
||||||
MakeUintegerChecker<uint32_t>())
|
|
||||||
.AddAttribute("Dsz",
|
|
||||||
"Data size",
|
|
||||||
UintegerValue(1040),
|
|
||||||
MakeUintegerAccessor(&ConsumerNWFQ::dsz),
|
|
||||||
MakeUintegerChecker<uint32_t>());
|
|
||||||
return tid;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsumerNWFQ::ConsumerNWFQ()
|
|
||||||
: tos(1)
|
|
||||||
, dsz(1040) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#ifndef NDN_CONSUMER_NWFQ_H
|
|
||||||
#define NDN_CONSUMER_NWFQ_H
|
|
||||||
|
|
||||||
#include "ns3/ndnSIM/model/ndn-common.hpp"
|
|
||||||
#include "ndn-consumer-pcon.hpp"
|
|
||||||
|
|
||||||
namespace ns3 {
|
|
||||||
namespace ndn {
|
|
||||||
|
|
||||||
class ConsumerNWFQ : public ConsumerPcon {
|
|
||||||
public:
|
|
||||||
static TypeId GetTypeId();
|
|
||||||
|
|
||||||
explicit ConsumerNWFQ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
// private function here
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
// private attribute here
|
|
||||||
uint64_t tos; // 优先级
|
|
||||||
uint64_t dsz; // 数据包大小
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -114,6 +114,7 @@ ConsumerPcon::OnData(shared_ptr<const Data> data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data->getCongestionMark() > 0) {
|
if (data->getCongestionMark() > 0) {
|
||||||
|
std::cout << "GetCongestionMark: " << data->getCongestionMark() << std::endl;
|
||||||
if (m_reactToCongestionMarks) {
|
if (m_reactToCongestionMarks) {
|
||||||
NS_LOG_DEBUG("Received congestion mark: " << data->getCongestionMark());
|
NS_LOG_DEBUG("Received congestion mark: " << data->getCongestionMark());
|
||||||
WindowDecrease();
|
WindowDecrease();
|
||||||
@@ -138,6 +139,7 @@ ConsumerPcon::OnData(shared_ptr<const Data> data)
|
|||||||
void
|
void
|
||||||
ConsumerPcon::OnTimeout(uint32_t sequenceNum)
|
ConsumerPcon::OnTimeout(uint32_t sequenceNum)
|
||||||
{
|
{
|
||||||
|
// std::cout << "OnTimeout" << std::endl;
|
||||||
WindowDecrease();
|
WindowDecrease();
|
||||||
|
|
||||||
if (m_inFlight > static_cast<uint32_t>(0)) {
|
if (m_inFlight > static_cast<uint32_t>(0)) {
|
||||||
@@ -175,6 +177,7 @@ ConsumerPcon::WindowIncrease()
|
|||||||
void
|
void
|
||||||
ConsumerPcon::WindowDecrease()
|
ConsumerPcon::WindowDecrease()
|
||||||
{
|
{
|
||||||
|
// std::cout << "Window Decrease" << std::endl;
|
||||||
if (!m_useCwa || m_highData > m_recPoint) {
|
if (!m_useCwa || m_highData > m_recPoint) {
|
||||||
const double diff = m_seq - m_highData;
|
const double diff = m_seq - m_highData;
|
||||||
BOOST_ASSERT(diff > 0);
|
BOOST_ASSERT(diff > 0);
|
||||||
@@ -212,6 +215,7 @@ ConsumerPcon::WindowDecrease()
|
|||||||
void
|
void
|
||||||
ConsumerPcon::BicIncrease()
|
ConsumerPcon::BicIncrease()
|
||||||
{
|
{
|
||||||
|
// std::cout << "BIC Increase" << std::endl;
|
||||||
if (m_window < BIC_LOW_WINDOW) {
|
if (m_window < BIC_LOW_WINDOW) {
|
||||||
// Normal TCP AIMD behavior
|
// Normal TCP AIMD behavior
|
||||||
if (m_window < m_ssthresh) {
|
if (m_window < m_ssthresh) {
|
||||||
|
|||||||
@@ -78,7 +78,32 @@ ConsumerWindow::GetTypeId(void)
|
|||||||
"ns3::ndn::ConsumerWindow::WindowTraceCallback")
|
"ns3::ndn::ConsumerWindow::WindowTraceCallback")
|
||||||
.AddTraceSource("InFlight", "Current number of outstanding interests",
|
.AddTraceSource("InFlight", "Current number of outstanding interests",
|
||||||
MakeTraceSourceAccessor(&ConsumerWindow::m_inFlight),
|
MakeTraceSourceAccessor(&ConsumerWindow::m_inFlight),
|
||||||
"ns3::ndn::ConsumerWindow::WindowTraceCallback");
|
"ns3::ndn::ConsumerWindow::WindowTraceCallback")
|
||||||
|
.AddAttribute("TimingStop",
|
||||||
|
"Timing stop (ms)",
|
||||||
|
IntegerValue(-1),
|
||||||
|
MakeIntegerAccessor(&ConsumerWindow::timingStop),
|
||||||
|
MakeIntegerChecker<int32_t>())
|
||||||
|
.AddAttribute("Dsz",
|
||||||
|
"Data size",
|
||||||
|
UintegerValue(8800),
|
||||||
|
MakeUintegerAccessor(&ConsumerWindow::dsz),
|
||||||
|
MakeUintegerChecker<uint32_t>())
|
||||||
|
.AddAttribute("DelayGreedy",
|
||||||
|
"Start greedy after the specified time (ms)",
|
||||||
|
IntegerValue(-1),
|
||||||
|
MakeIntegerAccessor(&ConsumerWindow::delayGreedy),
|
||||||
|
MakeIntegerChecker<int32_t>())
|
||||||
|
.AddAttribute("GreedyRate",
|
||||||
|
"Transmission rate when greedy (bps)",
|
||||||
|
IntegerValue(-1),
|
||||||
|
MakeIntegerAccessor(&ConsumerWindow::greedyRate),
|
||||||
|
MakeIntegerChecker<int32_t>())
|
||||||
|
.AddAttribute("DelayStart",
|
||||||
|
"Delay start time (ms)",
|
||||||
|
UintegerValue(0),
|
||||||
|
MakeUintegerAccessor(&ConsumerWindow::delayStart),
|
||||||
|
MakeUintegerChecker<uint32_t>());
|
||||||
|
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
@@ -152,29 +177,68 @@ ConsumerWindow::SetSeqMax(uint32_t seqMax)
|
|||||||
// ignore otherwise
|
// ignore otherwise
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConsumerWindow::stop() {
|
||||||
|
this->stopFlag = true;
|
||||||
|
Simulator::Remove(m_sendEvent);
|
||||||
|
this->StopApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConsumerWindow::startGreedy() {
|
||||||
|
std::cout << "startGreedy" << std::endl;
|
||||||
|
this->greedyFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ConsumerWindow::ScheduleNextPacket()
|
ConsumerWindow::ScheduleNextPacket()
|
||||||
{
|
{
|
||||||
if (m_window == static_cast<uint32_t>(0)) {
|
if (this->stopFlag) {
|
||||||
Simulator::Remove(m_sendEvent);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NS_LOG_DEBUG(
|
// 处理贪婪
|
||||||
"Next event in " << (std::min<double>(0.5, m_rtt->RetransmitTimeout().ToDouble(Time::S)))
|
if (this->greedyFlag) {
|
||||||
<< " sec");
|
if (!m_sendEvent.IsRunning()) {
|
||||||
m_sendEvent =
|
auto waitTime = (this->dsz * 1000000000) / this->greedyRate + 1;
|
||||||
Simulator::Schedule(Seconds(
|
|
||||||
std::min<double>(0.5, m_rtt->RetransmitTimeout().ToDouble(Time::S))),
|
m_sendEvent = Simulator::Schedule(NanoSeconds(waitTime), &Consumer::SendPacket, this);
|
||||||
&Consumer::SendPacket, this);
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (m_inFlight >= m_window) {
|
|
||||||
// simply do nothing
|
if (this->m_firstTime) {
|
||||||
}
|
this->m_firstTime = false;
|
||||||
else {
|
// 如果开启了指定时间后停止,则设置一个定时事件,在指定时间后停止客户端
|
||||||
if (m_sendEvent.IsRunning()) {
|
if (this->timingStop > 0) {
|
||||||
Simulator::Remove(m_sendEvent);
|
Simulator::Schedule(MilliSeconds(this->timingStop), &ConsumerWindow::stop, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sendEvent = Simulator::ScheduleNow(&Consumer::SendPacket, this);
|
// 如果开启了延迟贪婪,则在指定时间后客户端开始贪婪
|
||||||
|
if (this->delayGreedy > 0 && this->greedyRate > 0) {
|
||||||
|
Simulator::Schedule(MilliSeconds(this->delayGreedy), &ConsumerWindow::startGreedy, this);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
m_sendEvent = Simulator::Schedule(MilliSeconds(this->delayStart), &Consumer::SendPacket, this);
|
||||||
|
} else {
|
||||||
|
if (m_window == static_cast<uint32_t>(0)) {
|
||||||
|
Simulator::Remove(m_sendEvent);
|
||||||
|
|
||||||
|
NS_LOG_DEBUG(
|
||||||
|
"Next event in " << (std::min<double>(0.5, m_rtt->RetransmitTimeout().ToDouble(Time::S)))
|
||||||
|
<< " sec");
|
||||||
|
m_sendEvent =
|
||||||
|
Simulator::Schedule(Seconds(
|
||||||
|
std::min<double>(0.5, m_rtt->RetransmitTimeout().ToDouble(Time::S))),
|
||||||
|
&Consumer::SendPacket, this);
|
||||||
|
}
|
||||||
|
else if (m_inFlight >= m_window) {
|
||||||
|
// simply do nothing
|
||||||
|
} else {
|
||||||
|
if (m_sendEvent.IsRunning()) {
|
||||||
|
Simulator::Remove(m_sendEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sendEvent = Simulator::ScheduleNow(&Consumer::SendPacket, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,12 +92,29 @@ private:
|
|||||||
void
|
void
|
||||||
SetSeqMax(uint32_t seqMax);
|
SetSeqMax(uint32_t seqMax);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Stop send packet
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
// 开始贪婪
|
||||||
|
void startGreedy();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32_t m_payloadSize; // expected payload size
|
uint32_t m_payloadSize; // expected payload size
|
||||||
double m_maxSize; // max size to request
|
double m_maxSize; // max size to request
|
||||||
|
|
||||||
uint32_t m_initialWindow;
|
uint32_t m_initialWindow;
|
||||||
bool m_setInitialWindowOnTimeout;
|
bool m_setInitialWindowOnTimeout;
|
||||||
|
bool m_firstTime = true;
|
||||||
|
bool stopFlag = false; // 标识是否停止
|
||||||
|
bool greedyFlag = false; // 标识是否贪婪
|
||||||
|
uint64_t delayStart; // 延迟启动时间
|
||||||
|
int32_t timingStop; // 定时停止
|
||||||
|
|
||||||
|
uint64_t dsz; // 数据包大小
|
||||||
|
int32_t delayGreedy; // 定时贪婪,在指定时间之后开始贪婪
|
||||||
|
int32_t greedyRate; // 贪婪速率
|
||||||
|
|
||||||
TracedValue<double> m_window;
|
TracedValue<double> m_window;
|
||||||
TracedValue<uint32_t> m_inFlight;
|
TracedValue<uint32_t> m_inFlight;
|
||||||
|
|||||||
+1
-1
Submodule pybindgen updated: 572e1d92d9...a619e22a14.
@@ -6,3 +6,4 @@
|
|||||||
.lock*
|
.lock*
|
||||||
build/
|
build/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
/*.txt
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"*.txt": "cpp",
|
||||||
|
"*.ipp": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"list": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
#include "PCONStrategy.hpp"
|
||||||
|
#include <ndn-cxx/lp/tags.hpp>
|
||||||
|
|
||||||
|
NFD_LOG_INIT(PCONStrategy);
|
||||||
|
namespace nfd
|
||||||
|
{
|
||||||
|
namespace fw
|
||||||
|
{
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//// PCONStrategy
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
const time::milliseconds PCONStrategy::RETX_SUPPRESSION_INITIAL(10);
|
||||||
|
const time::milliseconds PCONStrategy::RETX_SUPPRESSION_MAX(250);
|
||||||
|
|
||||||
|
PCONStrategy::PCONStrategy(nfd::Forwarder &forwarder, const ndn::Name &name)
|
||||||
|
: Strategy(forwarder), ProcessNackTraits<PCONStrategy>(this), m_retxSuppression(RETX_SUPPRESSION_INITIAL,
|
||||||
|
RetxSuppressionExponential::DEFAULT_MULTIPLIER,
|
||||||
|
RETX_SUPPRESSION_MAX)
|
||||||
|
{
|
||||||
|
this->setInstanceName(makeInstanceName(name, getStrategyName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
const Name &
|
||||||
|
PCONStrategy::getStrategyName()
|
||||||
|
{
|
||||||
|
static Name strategyName("/localhost/nfd/strategy/PCON/%FD%01");
|
||||||
|
return strategyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到 Interest 之后处理
|
||||||
|
* @param ingress
|
||||||
|
* @param interest
|
||||||
|
* @param pitEntry
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
PCONStrategy::afterReceiveInterest(const nfd::FaceEndpoint &ingress, const ndn::Interest &interest,
|
||||||
|
const std::shared_ptr<nfd::pit::Entry> &pitEntry)
|
||||||
|
{
|
||||||
|
const fib::Entry &fibEntry = this->lookupFib(*pitEntry);
|
||||||
|
const fib::NextHopList &nexthops = fibEntry.getNextHops();
|
||||||
|
// 获取度量信息
|
||||||
|
MtForwardingInfo *measurementInfo = this->getPrefixMeasurements(fibEntry);
|
||||||
|
|
||||||
|
// 如果度量信息不存在,则创建一个新的
|
||||||
|
if (measurementInfo == nullptr)
|
||||||
|
{
|
||||||
|
measurementInfo = this->addPrefixMeasurements(fibEntry);
|
||||||
|
const Name prefixName = fibEntry.getPrefix();
|
||||||
|
measurementInfo->setPrefix(prefixName.toUri());
|
||||||
|
// 初始化转发概率
|
||||||
|
initializeForwMap(measurementInfo, nexthops);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interest 抑制
|
||||||
|
RetxSuppressionResult suppression = m_retxSuppression.decidePerPitEntry(*pitEntry);
|
||||||
|
if (suppression == RetxSuppressionResult::SUPPRESS)
|
||||||
|
{
|
||||||
|
NFD_LOG_DEBUG(interest << " from=" << ingress << " suppressed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Face *outFace = nullptr;
|
||||||
|
// 如果face是 LOCAL 的,不做额外的处理,直接按最短路径转发
|
||||||
|
if (ingress.face.getScope() != ndn::nfd::FACE_SCOPE_NON_LOCAL)
|
||||||
|
{
|
||||||
|
// 对于本地的face,直接按最佳路径走即可
|
||||||
|
auto selected = std::find_if(nexthops.begin(), nexthops.end(), [&](const auto &nexthop) {
|
||||||
|
return isNextHopEligible(ingress.face, interest, nexthop, pitEntry);
|
||||||
|
});
|
||||||
|
if (selected != nexthops.end())
|
||||||
|
{
|
||||||
|
outFace = &((*selected).getFace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Random number between 0 and 1.
|
||||||
|
double r = ((double)rand() / (RAND_MAX));
|
||||||
|
|
||||||
|
double percSum = 0;
|
||||||
|
|
||||||
|
// Add all eligbile faces to list (excludes current downstream)
|
||||||
|
std::vector<Face *> eligbleFaces;
|
||||||
|
for (auto &n : fibEntry.getNextHops())
|
||||||
|
{
|
||||||
|
if (isNextHopEligible(ingress.face, interest, n, pitEntry))
|
||||||
|
{
|
||||||
|
// Add up percentage Sum.
|
||||||
|
percSum += measurementInfo->getforwPerc(n.getFace().getId());
|
||||||
|
eligbleFaces.push_back(&n.getFace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eligbleFaces.size() < 1)
|
||||||
|
{
|
||||||
|
// 回环抑制
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (eligbleFaces.size() == 1)
|
||||||
|
{
|
||||||
|
// 只有一个有效下一跳,直接转发
|
||||||
|
outFace = eligbleFaces.front();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 有多个下一跳,按概率转发
|
||||||
|
// Choose face according to current forwarding percentage:
|
||||||
|
double forwPerc = 0;
|
||||||
|
for (auto face : eligbleFaces)
|
||||||
|
{
|
||||||
|
forwPerc += measurementInfo->getforwPerc(face->getId()) / percSum;
|
||||||
|
if (r < forwPerc)
|
||||||
|
{
|
||||||
|
outFace = face;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 无法转发,返回Nack
|
||||||
|
if (outFace == nullptr)
|
||||||
|
{
|
||||||
|
lp::NackHeader nackHeader;
|
||||||
|
nackHeader.setReason(lp::NackReason::NO_ROUTE);
|
||||||
|
this->sendNack(pitEntry, ingress, nackHeader);
|
||||||
|
this->rejectPendingInterest(pitEntry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 可以转发则直接转发
|
||||||
|
this->sendInterest(pitEntry, FaceEndpoint(*outFace, 0), interest);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 探测
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PCONStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry> &pitEntry,
|
||||||
|
const FaceEndpoint &ingress, const Data &data)
|
||||||
|
{
|
||||||
|
Name currentPrefix;
|
||||||
|
MtForwardingInfo *measurementInfo;
|
||||||
|
std::tie(currentPrefix, measurementInfo) = this->findPrefixMeasurementsLPM(
|
||||||
|
*pitEntry);
|
||||||
|
|
||||||
|
// 判断是否携带拥塞标记,如果携带拥塞标记,则将转发概率转移到其它接口
|
||||||
|
if (data.getCongestionMark() > 0)
|
||||||
|
{
|
||||||
|
// std::cout << ">>2: " << data.getCongestionMark() << std::endl;
|
||||||
|
double fwPerc = measurementInfo->getforwPerc(ingress.face.getId());
|
||||||
|
double change_perc = CHANGE_PER_MARK * fwPerc;
|
||||||
|
this->reduceFwPerc(measurementInfo, ingress.face.getId(), change_perc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到 Nack 时处理
|
||||||
|
* @param ingress
|
||||||
|
* @param nack
|
||||||
|
* @param pitEntry
|
||||||
|
*/
|
||||||
|
void PCONStrategy::afterReceiveNack(const nfd::FaceEndpoint &ingress, const ndn::lp::Nack &nack,
|
||||||
|
const std::shared_ptr<nfd::pit::Entry> &pitEntry)
|
||||||
|
{
|
||||||
|
this->processNack(ingress.face, nack, pitEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化转发概率
|
||||||
|
*
|
||||||
|
* @param measurementInfo
|
||||||
|
* @param nextHops
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
PCONStrategy::initializeForwMap(MtForwardingInfo *measurementInfo,
|
||||||
|
const fib::NextHopList &nextHops)
|
||||||
|
{
|
||||||
|
int lowestId = std::numeric_limits<int>::max();
|
||||||
|
int minCost = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
|
// 找到开销最小的下一跳
|
||||||
|
for (auto &n : nextHops)
|
||||||
|
{
|
||||||
|
if (n.getCost() < minCost)
|
||||||
|
{
|
||||||
|
minCost = n.getCost();
|
||||||
|
lowestId = n.getFace().getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开销最小的路径转发概率为 100%, 其它为0
|
||||||
|
for (auto &n : nextHops)
|
||||||
|
{
|
||||||
|
double perc = 0.0;
|
||||||
|
if (n.getFace().getId() == lowestId)
|
||||||
|
{
|
||||||
|
perc = 1.0;
|
||||||
|
}
|
||||||
|
measurementInfo->setforwPerc(n.getFace().getId(), perc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
#ifndef NFD_DAEMON_FW_PCON_STRATEGY_HPP
|
||||||
|
#define NFD_DAEMON_FW_PCON_STRATEGY_HPP
|
||||||
|
|
||||||
|
#include <boost/random/mersenne_twister.hpp>
|
||||||
|
#include "face/face.hpp"
|
||||||
|
#include "fw/strategy.hpp"
|
||||||
|
#include "fw/retx-suppression-exponential.hpp"
|
||||||
|
#include "fw/algorithm.hpp"
|
||||||
|
#include "fw/process-nack-traits.hpp"
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <limits>
|
||||||
|
#include "mt-forward-info.hpp"
|
||||||
|
|
||||||
|
namespace nfd
|
||||||
|
{
|
||||||
|
namespace fw
|
||||||
|
{
|
||||||
|
class PCONStrategy : public Strategy, public ProcessNackTraits<PCONStrategy>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit PCONStrategy(Forwarder &forwarder, const Name &name = getStrategyName());
|
||||||
|
|
||||||
|
~PCONStrategy() override = default;
|
||||||
|
|
||||||
|
void
|
||||||
|
afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest,
|
||||||
|
const shared_ptr<pit::Entry> &pitEntry) override;
|
||||||
|
|
||||||
|
void
|
||||||
|
beforeSatisfyInterest(const shared_ptr<pit::Entry> &pitEntry,
|
||||||
|
const FaceEndpoint &ingress, const Data &data) override;
|
||||||
|
|
||||||
|
void
|
||||||
|
afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack,
|
||||||
|
const shared_ptr<pit::Entry> &pitEntry) override;
|
||||||
|
|
||||||
|
static const Name &
|
||||||
|
getStrategyName();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend ProcessNackTraits<PCONStrategy>;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void
|
||||||
|
initializeForwMap(MtForwardingInfo *measurementInfo,
|
||||||
|
const fib::NextHopList &nextHops);
|
||||||
|
|
||||||
|
MtForwardingInfo *
|
||||||
|
getPrefixMeasurements(const fib::Entry &fibEntry)
|
||||||
|
{
|
||||||
|
std::string key = fibEntry.getPrefix().getPrefix(1).toUri();
|
||||||
|
if (this->innerMap.count(key) == 0)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this->innerMap[key].get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MtForwardingInfo *
|
||||||
|
addPrefixMeasurements(const fib::Entry &fibEntry)
|
||||||
|
{
|
||||||
|
std::string key = fibEntry.getPrefix().getPrefix(1).toUri();
|
||||||
|
if (this->innerMap.count(key) == 0)
|
||||||
|
{
|
||||||
|
this->innerMap[key] = make_unique<MtForwardingInfo>();
|
||||||
|
}
|
||||||
|
return this->innerMap[key].get();
|
||||||
|
// measurements::Entry* me = measurements.get(fibEntry);
|
||||||
|
// // std::cout << fibEntry.getPrefix().toUri() << std::endl;
|
||||||
|
// measurements.extendLifetime(*me, 8_s);
|
||||||
|
// return me->insertStrategyInfo<MtForwardingInfo>().first;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::tuple<Name, MtForwardingInfo *>
|
||||||
|
findPrefixMeasurementsLPM(const pit::Entry &pitEntry)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string key = pitEntry.getName().getPrefix(1).toUri();
|
||||||
|
if (this->innerMap.count(key) == 0) {
|
||||||
|
return std::forward_as_tuple(Name(), nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::forward_as_tuple(pitEntry.getName().getPrefix(1), this->innerMap[key].get());
|
||||||
|
// measurements::Entry *me = measurements.findLongestPrefixMatch(pitEntry);
|
||||||
|
// if (me == nullptr)
|
||||||
|
// {
|
||||||
|
// std::cout << "Name " << pitEntry.getName().toUri() << " not found!\n";
|
||||||
|
// return std::forward_as_tuple(Name(), nullptr);
|
||||||
|
// }
|
||||||
|
// return std::forward_as_tuple(me->getName(), me->getStrategyInfo<MtForwardingInfo>());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reduceFwPerc(MtForwardingInfo *forwInfo,
|
||||||
|
const FaceId reducedFaceId,
|
||||||
|
const double change)
|
||||||
|
{
|
||||||
|
if (forwInfo->getFaceCount() == 1)
|
||||||
|
{
|
||||||
|
std::cout << "reduce1" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Reduction is at most the current forwarding percentage of the face that is reduced.
|
||||||
|
double changeRate = 0 - std::min(change, forwInfo->getforwPerc(reducedFaceId));
|
||||||
|
|
||||||
|
std::cout << "reduce2: " << changeRate << std::endl;
|
||||||
|
// Decrease fw percentage of the given face:
|
||||||
|
forwInfo->increaseforwPerc(reducedFaceId, changeRate);
|
||||||
|
double sumFWPerc = 0;
|
||||||
|
sumFWPerc += forwInfo->getforwPerc(reducedFaceId);
|
||||||
|
const auto forwMap = forwInfo->getForwPercMap();
|
||||||
|
|
||||||
|
// std::cout << "\n";
|
||||||
|
for (auto f : forwMap)
|
||||||
|
{
|
||||||
|
auto tempChangeRate = changeRate;
|
||||||
|
auto &faceId = f.first;
|
||||||
|
if (faceId == reducedFaceId)
|
||||||
|
{ // Do nothing. Percentage has already been added.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Increase forwarding percentage of all other faces by and equal amount.
|
||||||
|
tempChangeRate = std::abs(changeRate / (double)(forwMap.size() - 1));
|
||||||
|
forwInfo->increaseforwPerc((faceId), tempChangeRate);
|
||||||
|
sumFWPerc += forwInfo->getforwPerc(faceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (sumFWPerc < 0.999 || sumFWPerc > 1.001)
|
||||||
|
// {
|
||||||
|
// std::cout << StrHelper::getTime() << "ERROR! Sum of fw perc out of range: " << sumFWPerc
|
||||||
|
// << "\n";
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const time::milliseconds RETX_SUPPRESSION_INITIAL;
|
||||||
|
static const time::milliseconds RETX_SUPPRESSION_MAX;
|
||||||
|
double CHANGE_PER_MARK = 0.1;
|
||||||
|
std::unordered_map<std::string, unique_ptr<MtForwardingInfo>> innerMap;
|
||||||
|
RetxSuppressionExponential m_retxSuppression;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -111,16 +111,16 @@ namespace nfd {
|
|||||||
Rp = m_Rp_base[inface(mface)] + m_Rp_ex[inface(mface)];
|
Rp = m_Rp_base[inface(mface)] + m_Rp_ex[inface(mface)];
|
||||||
Rs = m_Rs_base[inface(mface)] + m_Rs_ex[inface(mface)];
|
Rs = m_Rs_base[inface(mface)] + m_Rs_ex[inface(mface)];
|
||||||
|
|
||||||
NS_LOG_DEBUG("face:" << mface << "d:" << m_d[inface(mface)]);
|
// NS_LOG_DEBUG("face:" << mface << "d:" << m_d[inface(mface)]);
|
||||||
|
|
||||||
NS_LOG_DEBUG("Rp: " << Rp << " Rs: " << Rs << " Yt: " << m_Yp[inface(mface)] << " C:" << m_linkC[inface(mface)]);
|
// NS_LOG_DEBUG("Rp: " << Rp << " Rs: " << Rs << " Yt: " << m_Yp[inface(mface)] << " C:" << m_linkC[inface(mface)]);
|
||||||
//Rp计算过程
|
//Rp计算过程
|
||||||
ia = std::max(m_linkC[inface(mface)],m_Yp[inface(mface)]);
|
ia = std::max(m_linkC[inface(mface)],m_Yp[inface(mface)]);
|
||||||
|
|
||||||
ib = std::max(Rp,1ll);
|
ib = std::max(Rp,1ll);
|
||||||
double Np = std::max((double)ia / ib,1.0);
|
double Np = std::max((double)ia / ib,1.0);
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Np: " << Np);
|
// NS_LOG_DEBUG(" Np: " << Np);
|
||||||
|
|
||||||
double Bp;
|
double Bp;
|
||||||
if (m_Yp[inface(mface)] >= m_Yp_old[inface(mface)])
|
if (m_Yp[inface(mface)] >= m_Yp_old[inface(mface)])
|
||||||
@@ -135,16 +135,16 @@ namespace nfd {
|
|||||||
Bp = m_B;
|
Bp = m_B;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Bp: " << Bp);
|
// NS_LOG_DEBUG(" Bp: " << Bp);
|
||||||
|
|
||||||
ia = m_miu * m_linkC[inface(mface)] - Bp * getQt(mface) / std::max((double)m_d[inface(mface)],(double)0.001);
|
ia = m_miu * m_linkC[inface(mface)] - Bp * getQt(mface) / std::max((double)m_d[inface(mface)],(double)0.001);
|
||||||
NS_LOG_DEBUG("Qt "<< getQt(mface) << " ia " << ia);
|
// NS_LOG_DEBUG("Qt "<< getQt(mface) << " ia " << ia);
|
||||||
db = std::max(Np,(double)1);
|
db = std::max(Np,(double)1);
|
||||||
long long Rp_base_n = std::min(std::max(ia / db,0.0),m_linkC[inface(mface)] / Np);
|
long long Rp_base_n = std::min(std::max(ia / db,0.0),m_linkC[inface(mface)] / Np);
|
||||||
NS_LOG_DEBUG(" Ppbn:" << Rp_base_n);
|
// NS_LOG_DEBUG(" Ppbn:" << Rp_base_n);
|
||||||
m_Rp_base[inface(mface)] = m_a * m_Rp_base[inface(mface)] + (1 - m_a) * Rp_base_n;
|
m_Rp_base[inface(mface)] = m_a * m_Rp_base[inface(mface)] + (1 - m_a) * Rp_base_n;
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Rpb: " << m_Rp_base[inface(mface)]);
|
// NS_LOG_DEBUG(" Rpb: " << m_Rp_base[inface(mface)]);
|
||||||
|
|
||||||
ia = m_Yp[inface(mface)];
|
ia = m_Yp[inface(mface)];
|
||||||
|
|
||||||
@@ -153,22 +153,22 @@ namespace nfd {
|
|||||||
long long Rp_ex_n = std::min(std::max((uint64_t)0,(uint64_t)(Rp - ia / db)),(uint64_t)(m_linkC[inface(mface)] - Rp_base_n));
|
long long Rp_ex_n = std::min(std::max((uint64_t)0,(uint64_t)(Rp - ia / db)),(uint64_t)(m_linkC[inface(mface)] - Rp_base_n));
|
||||||
|
|
||||||
m_Rp_ex[inface(mface)] = m_a * m_Rp_ex[inface(mface)] + (1 - m_a) * Rp_ex_n;
|
m_Rp_ex[inface(mface)] = m_a * m_Rp_ex[inface(mface)] + (1 - m_a) * Rp_ex_n;
|
||||||
NS_LOG_DEBUG(" Rpe: " << m_Rp_ex[inface(mface)]);
|
// NS_LOG_DEBUG(" Rpe: " << m_Rp_ex[inface(mface)]);
|
||||||
NS_LOG_DEBUG(" !!Ppne:" << Rp_ex_n << " " << (m_linkC[inface(mface)] / Np - Rp_base_n));
|
// NS_LOG_DEBUG(" !!Ppne:" << Rp_ex_n << " " << (m_linkC[inface(mface)] / Np - Rp_base_n));
|
||||||
m_Yp_old[inface(mface)] = m_Yp[inface(mface)];
|
m_Yp_old[inface(mface)] = m_Yp[inface(mface)];
|
||||||
|
|
||||||
//Rs计算过程
|
//Rs计算过程
|
||||||
uint64_t Cs = std::max(m_linkC[inface(mface)] - m_Yp[inface(mface)] ,(uint64_t)0);
|
uint64_t Cs = std::max(m_linkC[inface(mface)] - m_Yp[inface(mface)] ,(uint64_t)0);
|
||||||
|
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Cs: " << Cs << " Ys" << m_Ys[inface(mface)]);
|
// NS_LOG_DEBUG(" Cs: " << Cs << " Ys" << m_Ys[inface(mface)]);
|
||||||
|
|
||||||
|
|
||||||
//TODO: R(t-T) Rs? Rs+Rp?
|
//TODO: R(t-T) Rs? Rs+Rp?
|
||||||
|
|
||||||
double Ns = std::max((double)std::max(Cs,m_Ys[inface(mface)]) / std::max(Rp + Rs,1ll) ,1.0);
|
double Ns = std::max((double)std::max(Cs,m_Ys[inface(mface)]) / std::max(Rp + Rs,1ll) ,1.0);
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Ns: " << Ns);
|
// NS_LOG_DEBUG(" Ns: " << Ns);
|
||||||
|
|
||||||
ia = m_Ys[inface(mface)] - m_Ys_old[inface(mface)];
|
ia = m_Ys[inface(mface)] - m_Ys_old[inface(mface)];
|
||||||
ib = std::max(m_Ys[inface(mface)],(uint64_t)1);
|
ib = std::max(m_Ys[inface(mface)],(uint64_t)1);
|
||||||
@@ -176,13 +176,13 @@ namespace nfd {
|
|||||||
|
|
||||||
|
|
||||||
ia = m_miu * Cs - Bs * getQt(mface) / std::max(m_d[inface(mface)],(double)0.001);
|
ia = m_miu * Cs - Bs * getQt(mface) / std::max(m_d[inface(mface)],(double)0.001);
|
||||||
NS_LOG_DEBUG(" ia: " << ia);
|
// NS_LOG_DEBUG(" ia: " << ia);
|
||||||
db = Ns;
|
db = Ns;
|
||||||
|
|
||||||
uint64_t Rs_base_n = std::min((uint64_t)std::max(0.0,ia / db),uint64_t(Cs / Ns));
|
uint64_t Rs_base_n = std::min((uint64_t)std::max(0.0,ia / db),uint64_t(Cs / Ns));
|
||||||
m_Rs_base[inface(mface)] = m_a * m_Rs_base[inface(mface)] + (1 - m_a) * Rs_base_n;
|
m_Rs_base[inface(mface)] = m_a * m_Rs_base[inface(mface)] + (1 - m_a) * Rs_base_n;
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Rsb: " << m_Rs_base[inface(mface)]);
|
// NS_LOG_DEBUG(" Rsb: " << m_Rs_base[inface(mface)]);
|
||||||
|
|
||||||
|
|
||||||
ia = m_Ys[inface(mface)];
|
ia = m_Ys[inface(mface)];
|
||||||
@@ -194,35 +194,28 @@ namespace nfd {
|
|||||||
|
|
||||||
m_Rs_ex[inface(mface)] = m_a * m_Rs_ex[inface(mface)] + (1 - m_a) * Rs_ex_n;
|
m_Rs_ex[inface(mface)] = m_a * m_Rs_ex[inface(mface)] + (1 - m_a) * Rs_ex_n;
|
||||||
|
|
||||||
NS_LOG_DEBUG(" Rse: " << m_Rs_ex[inface(mface)]);
|
// NS_LOG_DEBUG(" Rse: " << m_Rs_ex[inface(mface)]);
|
||||||
|
|
||||||
m_Ys_old[inface(mface)] = m_Ys[inface(mface)];
|
m_Ys_old[inface(mface)] = m_Ys[inface(mface)];
|
||||||
|
|
||||||
m_Yp[inface(mface)] = 0;
|
m_Yp[inface(mface)] = 0;
|
||||||
m_Ys[inface(mface)] = 0;
|
m_Ys[inface(mface)] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
MIRCCStrategy::getQt(FaceId mface)
|
MIRCCStrategy::getQt(FaceId mface)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//清除队列中过期兴趣包,避免造成干扰
|
//清除队列中过期兴趣包,避免造成干扰
|
||||||
//refreshQueueInterest(mface);
|
//refreshQueueInterest(mface);
|
||||||
//返回兴趣包个数*兴趣包大小*数据包与兴趣包大小之比
|
//返回兴趣包个数*兴趣包大小*数据包与兴趣包大小之比
|
||||||
uint64_t time = 10;//保持Rt计算周期一致
|
uint64_t time = 10;//保持Rt计算周期一致
|
||||||
return (m_Queue[inface(mface)].qp.size() + m_Queue[inface(mface)].qs.size()) * DATA_SIZE * time;
|
return (m_Queue[inface(mface)].qp.size() + m_Queue[inface(mface)].qs.size()) * DATA_SIZE * time;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MIRCCStrategy::pushQueueInterest(FaceId mface,const shared_ptr<Interest>& interest,const shared_ptr<pit::Entry>& pitEntry)
|
MIRCCStrategy::pushQueueInterest(FaceId mface,const shared_ptr<Interest>& interest,const shared_ptr<pit::Entry>& pitEntry)
|
||||||
{
|
{
|
||||||
//NS_LOG_DEBUG("MIRCC pushQueueInterest");
|
//// NS_LOG_DEBUG("MIRCC pushQueueInterest");
|
||||||
uint64_t p = *(interest->getTag<lp::PTag>());
|
uint64_t p = *(interest->getTag<lp::PTag>());
|
||||||
//如果是第一类兴趣包
|
//如果是第一类兴趣包
|
||||||
if (p == 1)
|
if (p == 1)
|
||||||
@@ -245,6 +238,7 @@ namespace nfd {
|
|||||||
//否则当前兴趣包丢失
|
//否则当前兴趣包丢失
|
||||||
|
|
||||||
//这里应该回传Nack,还没有写完
|
//这里应该回传Nack,还没有写完
|
||||||
|
this->rejectPendingInterest(pitEntry);
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@@ -259,7 +253,7 @@ namespace nfd {
|
|||||||
if (m_Queue[inface(mface)].qp.size() + m_Queue[inface(mface)].qs.size() >= MAX_QUEUE)
|
if (m_Queue[inface(mface)].qp.size() + m_Queue[inface(mface)].qs.size() >= MAX_QUEUE)
|
||||||
{
|
{
|
||||||
//当前兴趣包丢失
|
//当前兴趣包丢失
|
||||||
|
this->rejectPendingInterest(pitEntry);
|
||||||
//这里是否应该回传Nack不确定,需要回去看论文,第二类兴趣包处理方式似乎与第一类不同,还没有写完
|
//这里是否应该回传Nack不确定,需要回去看论文,第二类兴趣包处理方式似乎与第一类不同,还没有写完
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@@ -275,7 +269,7 @@ namespace nfd {
|
|||||||
void
|
void
|
||||||
MIRCCStrategy::afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr<pit::Entry> &pitEntry)
|
MIRCCStrategy::afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr<pit::Entry> &pitEntry)
|
||||||
{//目前在按照标识路径转发,采用MIRCC论文中的方法2
|
{//目前在按照标识路径转发,采用MIRCC论文中的方法2
|
||||||
//NS_LOG_DEBUG("MIRCC afterReceiveInterest");
|
//// NS_LOG_DEBUG("MIRCC afterReceiveInterest");
|
||||||
|
|
||||||
if (hasPendingOutRecords(*pitEntry))
|
if (hasPendingOutRecords(*pitEntry))
|
||||||
{
|
{
|
||||||
@@ -331,14 +325,14 @@ namespace nfd {
|
|||||||
void
|
void
|
||||||
MIRCCStrategy::afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack, const shared_ptr<pit::Entry> &pitEntry)
|
MIRCCStrategy::afterReceiveNack(const FaceEndpoint &ingress, const lp::Nack &nack, const shared_ptr<pit::Entry> &pitEntry)
|
||||||
{
|
{
|
||||||
//NS_LOG_DEBUG("MIRCC afterReceiveNack");
|
//// NS_LOG_DEBUG("MIRCC afterReceiveNack");
|
||||||
//nack无需处理
|
//nack无需处理
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MIRCCStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry> &pitEntry, const FaceEndpoint &ingress, const Data &data)
|
MIRCCStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry> &pitEntry, const FaceEndpoint &ingress, const Data &data)
|
||||||
{
|
{
|
||||||
//NS_LOG_DEBUG("MIRCC beforeSatisfyInterest");
|
//// NS_LOG_DEBUG("MIRCC beforeSatisfyInterest");
|
||||||
auto now = time::steady_clock::now();
|
auto now = time::steady_clock::now();
|
||||||
//目前计算中,只考虑没有过期的并成功收到数据包的兴趣包对RTT和ratio的影响.超时的数据包是否对RTT有影响?。
|
//目前计算中,只考虑没有过期的并成功收到数据包的兴趣包对RTT和ratio的影响.超时的数据包是否对RTT有影响?。
|
||||||
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
|
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
|
||||||
@@ -351,7 +345,7 @@ namespace nfd {
|
|||||||
//计算收到数据包对RTT的影响。
|
//计算收到数据包对RTT的影响。
|
||||||
//RTT暂时为固定值50ms
|
//RTT暂时为固定值50ms
|
||||||
auto dura = now - inRecord.getLastRenewed();
|
auto dura = now - inRecord.getLastRenewed();
|
||||||
NS_LOG_DEBUG("RTT:" << dura.count());
|
// NS_LOG_DEBUG("RTT:" << dura.count());
|
||||||
m_d[inface(ingress.face.getId())] = m_rtt_a * m_d[inface(ingress.face.getId())] + (1.0 - m_rtt_a) * ((double)dura.count() / 1000000000);
|
m_d[inface(ingress.face.getId())] = m_rtt_a * m_d[inface(ingress.face.getId())] + (1.0 - m_rtt_a) * ((double)dura.count() / 1000000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +355,7 @@ namespace nfd {
|
|||||||
MIRCCStrategy::afterReceiveData(const shared_ptr<pit::Entry> &pitEntry, const FaceEndpoint &ingress, const Data &data)
|
MIRCCStrategy::afterReceiveData(const shared_ptr<pit::Entry> &pitEntry, const FaceEndpoint &ingress, const Data &data)
|
||||||
{
|
{
|
||||||
|
|
||||||
//NS_LOG_DEBUG("MIRCC afterReceiveData");
|
//// NS_LOG_DEBUG("MIRCC afterReceiveData");
|
||||||
|
|
||||||
if (ingress.face.getId() >= 257)
|
if (ingress.face.getId() >= 257)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace nfd {
|
|||||||
|
|
||||||
const double m_B = 0.1;//公式B系数
|
const double m_B = 0.1;//公式B系数
|
||||||
const double m_a = 0.5;//速率更新系数
|
const double m_a = 0.5;//速率更新系数
|
||||||
const double m_miu = 0.95;//链路利用率
|
const double m_miu = 0.99;//链路利用率
|
||||||
const double m_rtt_a = 0.7;//RTT更新系数
|
const double m_rtt_a = 0.7;//RTT更新系数
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
#ifndef NFD_DAEMON_FW_MT_FORWARDING_INFO_HPP
|
||||||
|
#define NFD_DAEMON_FW_MT_FORWARDING_INFO_HPP
|
||||||
|
|
||||||
|
#include "face/face.hpp"
|
||||||
|
#include "fw/strategy-info.hpp"
|
||||||
|
|
||||||
|
namespace nfd
|
||||||
|
{
|
||||||
|
namespace fw
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Measurement information that can be saved and retrieved per-name-prefix.
|
||||||
|
*/
|
||||||
|
class MtForwardingInfo : public StrategyInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static constexpr int
|
||||||
|
getTypeId()
|
||||||
|
{
|
||||||
|
return 1051;
|
||||||
|
}
|
||||||
|
|
||||||
|
MtForwardingInfo()
|
||||||
|
: m_ownPrefix("null")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
getforwPerc(FaceId face)
|
||||||
|
{
|
||||||
|
if (m_forwPercMap.find(face) == m_forwPercMap.end())
|
||||||
|
{
|
||||||
|
std::cout << time::steady_clock::now().time_since_epoch().count() / 1000 * 1000
|
||||||
|
<< " ms, couldn't find face " << face << "\n";
|
||||||
|
}
|
||||||
|
// assert(m_forwPercMap.find(face) != m_forwPercMap.end());
|
||||||
|
double forwPerc = m_forwPercMap.at(face);
|
||||||
|
// assert(forwPerc >= 0 && forwPerc <= 1);
|
||||||
|
|
||||||
|
return forwPerc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setforwPerc(FaceId faceId, double perc)
|
||||||
|
{
|
||||||
|
m_forwPercMap[faceId] = perc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
increaseforwPerc(FaceId faceId, double changeRate)
|
||||||
|
{
|
||||||
|
m_forwPercMap[faceId] += changeRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::map<FaceId, double>
|
||||||
|
getForwPercMap() const
|
||||||
|
{
|
||||||
|
return m_forwPercMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
getFaceCount()
|
||||||
|
{
|
||||||
|
std::vector<FaceId> faceIdList;
|
||||||
|
for (auto faceInfo : m_forwPercMap)
|
||||||
|
{
|
||||||
|
faceIdList.push_back(faceInfo.first);
|
||||||
|
}
|
||||||
|
return faceIdList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setPrefix(std::string prefix)
|
||||||
|
{
|
||||||
|
m_ownPrefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
getPrefix() const
|
||||||
|
{
|
||||||
|
return m_ownPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** These Functions were used to disable faces in the "highly congested" state:*/
|
||||||
|
// void
|
||||||
|
// enableFace(FaceId faceId)
|
||||||
|
// {
|
||||||
|
// m_disabledFaces.erase(faceId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void
|
||||||
|
// disableFace(FaceId faceId)
|
||||||
|
// {
|
||||||
|
// m_disabledFaces.emplace(faceId);
|
||||||
|
//// std::cout << "Disabling face " << faceId << "\n";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// bool
|
||||||
|
// isFaceEnabled(FaceId faceId)
|
||||||
|
// {
|
||||||
|
// bool disabled = (m_disabledFaces.find(faceId) != m_disabledFaces.end());
|
||||||
|
// return !disabled;
|
||||||
|
// }
|
||||||
|
std::string m_ownPrefix;
|
||||||
|
std::map<FaceId, double> m_forwPercMap;
|
||||||
|
|
||||||
|
std::unordered_set<FaceId> m_disabledFaces;
|
||||||
|
};
|
||||||
|
|
||||||
|
} //fw
|
||||||
|
} //nfd
|
||||||
|
|
||||||
|
#endif
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,135 @@
|
|||||||
|
#include "ns3/core-module.h"
|
||||||
|
#include "ns3/network-module.h"
|
||||||
|
#include "ns3/ndnSIM-module.h"
|
||||||
|
#include "../extensions/PCONStrategy.hpp"
|
||||||
|
#include "../extensions/mircc-strategy.hpp"
|
||||||
|
|
||||||
|
namespace ns3
|
||||||
|
{
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CommandLine cmd;
|
||||||
|
cmd.Parse(argc, argv);
|
||||||
|
|
||||||
|
AnnotatedTopologyReader topologyReader("", 25);
|
||||||
|
topologyReader.SetFileName("topologies/dsccp3-1.txt");
|
||||||
|
topologyReader.Read();
|
||||||
|
|
||||||
|
// Install NDN stack on all nodes
|
||||||
|
ndn::StackHelper ndnHelper;
|
||||||
|
ndnHelper.setPolicy("nfd::cs::lru");
|
||||||
|
// ndnHelper.setCsSize(10000);
|
||||||
|
ndnHelper.setCsSize(0);
|
||||||
|
ndnHelper.InstallAll();
|
||||||
|
|
||||||
|
// Choosing forwarding strategy
|
||||||
|
ndn::StrategyChoiceHelper::InstallAll<nfd::fw::PCONStrategy>("/");
|
||||||
|
// ndn::StrategyChoiceHelper::InstallAll<nfd::fw::MIRCCStrategy>("/");
|
||||||
|
|
||||||
|
// 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> C3 = Names::Find<Node>("C3");
|
||||||
|
|
||||||
|
Ptr<Node> P1 = Names::Find<Node>("P1");
|
||||||
|
Ptr<Node> P2 = Names::Find<Node>("P2");
|
||||||
|
Ptr<Node> P3 = Names::Find<Node>("P3");
|
||||||
|
Ptr<Node> P4 = Names::Find<Node>("P4");
|
||||||
|
|
||||||
|
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerPcon");
|
||||||
|
consumerHelper.SetAttribute("Dsz", UintegerValue(8696));
|
||||||
|
consumerHelper.SetAttribute("CcAlgorithm", StringValue("BIC"));
|
||||||
|
// consumerHelper.SetAttribute("NumberOfContents", UintegerValue(100000));
|
||||||
|
|
||||||
|
|
||||||
|
// C1
|
||||||
|
consumerHelper.SetPrefix("/A");
|
||||||
|
// consumerHelper.SetAttribute("Tos", UintegerValue(5));
|
||||||
|
consumerHelper.Install("C1");
|
||||||
|
|
||||||
|
// C2
|
||||||
|
consumerHelper.SetPrefix("/B");
|
||||||
|
// consumerHelper.SetAttribute("Tos", UintegerValue(5));
|
||||||
|
consumerHelper.SetAttribute("DelayStart", UintegerValue(30000)); // 延迟30秒启动
|
||||||
|
consumerHelper.Install("C2");
|
||||||
|
|
||||||
|
// C3
|
||||||
|
consumerHelper.SetPrefix("/C");
|
||||||
|
// consumerHelper.SetAttribute("Tos", UintegerValue(5));
|
||||||
|
consumerHelper.SetAttribute("DelayStart", UintegerValue(60000)); // 延迟60秒启动
|
||||||
|
consumerHelper.SetAttribute("DelayGreedy", IntegerValue(150000)); // 150秒开始贪婪
|
||||||
|
consumerHelper.SetAttribute("GreedyRate", IntegerValue(6000000));
|
||||||
|
consumerHelper.Install("C3");
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/B", P2);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/C", P3);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/A", P4);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/B", P4);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/C", P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/A");
|
||||||
|
producerHelper.Install(P1);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/B");
|
||||||
|
producerHelper.Install(P2);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/C");
|
||||||
|
producerHelper.Install(P3);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
// Calculate all possible routes and install FIBs
|
||||||
|
ndn::GlobalRoutingHelper::CalculateRoutes();
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R4", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R5", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/A", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/B", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/C", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/A", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/B", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/C", "R5", 0);
|
||||||
|
|
||||||
|
Simulator::Stop(Seconds(200.0));
|
||||||
|
|
||||||
|
ndn::L3RateTracer::InstallAll("dsccp3-1-zipf_throughput.txt", Seconds(0.5));
|
||||||
|
ndn::AppDelayTracer::InstallAll("dsccp3-1-zipf_delay.txt");
|
||||||
|
L2RateTracer::InstallAll("dsccp3-1-zipf_drop.txt", Seconds(0.5));
|
||||||
|
Simulator::Run();
|
||||||
|
Simulator::Destroy();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ns3
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return ns3::main(argc, argv);
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
#include "ns3/core-module.h"
|
||||||
|
#include "ns3/network-module.h"
|
||||||
|
#include "ns3/ndnSIM-module.h"
|
||||||
|
#include "../extensions/mircc-strategy.hpp"
|
||||||
|
#include "../extensions/PCONStrategy.hpp"
|
||||||
|
|
||||||
|
namespace ns3
|
||||||
|
{
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CommandLine cmd;
|
||||||
|
cmd.Parse(argc, argv);
|
||||||
|
|
||||||
|
AnnotatedTopologyReader topologyReader("", 25);
|
||||||
|
topologyReader.SetFileName("topologies/dsccp3-1.txt");
|
||||||
|
topologyReader.Read();
|
||||||
|
|
||||||
|
// Install NDN stack on all nodes
|
||||||
|
ndn::StackHelper ndnHelper;
|
||||||
|
ndnHelper.setPolicy("nfd::cs::lru");
|
||||||
|
// ndnHelper.setCsSize(10000);
|
||||||
|
ndnHelper.setCsSize(0);
|
||||||
|
ndnHelper.InstallAll();
|
||||||
|
|
||||||
|
// Choosing forwarding strategy
|
||||||
|
ndn::StrategyChoiceHelper::InstallAll<nfd::fw::MIRCCStrategy>("/");
|
||||||
|
// ndn::StrategyChoiceHelper::InstallAll<nfd::fw::PCONStrategy>("/");
|
||||||
|
|
||||||
|
// 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> C3 = Names::Find<Node>("C3");
|
||||||
|
|
||||||
|
Ptr<Node> P1 = Names::Find<Node>("P1");
|
||||||
|
Ptr<Node> P2 = Names::Find<Node>("P2");
|
||||||
|
Ptr<Node> P3 = Names::Find<Node>("P3");
|
||||||
|
Ptr<Node> P4 = Names::Find<Node>("P4");
|
||||||
|
|
||||||
|
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerMIRCC");
|
||||||
|
consumerHelper.SetAttribute("logtms",StringValue("0"));
|
||||||
|
// consumerHelper.SetAttribute("NumberOfContents", UintegerValue(100000));
|
||||||
|
|
||||||
|
// C1
|
||||||
|
consumerHelper.SetPrefix("/A");
|
||||||
|
consumerHelper.SetAttribute("appid",StringValue("1"));
|
||||||
|
consumerHelper.SetAttribute("start_ms",StringValue("0"));
|
||||||
|
consumerHelper.SetAttribute("end_ms",StringValue("200000"));
|
||||||
|
consumerHelper.Install("C1");
|
||||||
|
|
||||||
|
// C2
|
||||||
|
consumerHelper.SetPrefix("/B");
|
||||||
|
// consumerHelper.SetAttribute("DelayStart", UintegerValue(30000)); // 延迟10秒启动
|
||||||
|
consumerHelper.SetAttribute("start_ms",StringValue("30000"));
|
||||||
|
consumerHelper.SetAttribute("end_ms",StringValue("200000"));
|
||||||
|
consumerHelper.SetAttribute("appid",StringValue("2"));
|
||||||
|
consumerHelper.Install("C2");
|
||||||
|
|
||||||
|
// C3
|
||||||
|
consumerHelper.SetPrefix("/C");
|
||||||
|
// consumerHelper.SetAttribute("DelayStart", UintegerValue(60000)); // 延迟20秒启动
|
||||||
|
// consumerHelper.SetAttribute("DelayGreedy", IntegerValue(150000));
|
||||||
|
// consumerHelper.SetAttribute("GreedyRate", IntegerValue(6000000));
|
||||||
|
consumerHelper.SetAttribute("greedy_ms",StringValue("150000"));
|
||||||
|
consumerHelper.SetAttribute("greedy_rate",StringValue("6000000"));
|
||||||
|
consumerHelper.SetAttribute("start_ms",StringValue("60000"));
|
||||||
|
consumerHelper.SetAttribute("end_ms",StringValue("200000"));
|
||||||
|
consumerHelper.SetAttribute("appid",StringValue("3"));
|
||||||
|
consumerHelper.Install("C3");
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/B", P2);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/C", P3);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/A", P4);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/B", P4);
|
||||||
|
ndnGlobalRoutingHelper.AddOrigins("/C", P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/A");
|
||||||
|
producerHelper.Install(P1);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/B");
|
||||||
|
producerHelper.Install(P2);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/C");
|
||||||
|
producerHelper.Install(P3);
|
||||||
|
producerHelper.Install(P4);
|
||||||
|
|
||||||
|
// Calculate all possible routes and install FIBs
|
||||||
|
ndn::GlobalRoutingHelper::CalculateRoutes();
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R4", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/A", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/B", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/C", "R5", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/A", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/B", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/C", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/A", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/B", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/C", "R5", 0);
|
||||||
|
|
||||||
|
Simulator::Stop(Seconds(200.0));
|
||||||
|
|
||||||
|
ndn::L3RateTracer::InstallAll("dsccp3-1-zipf_throughput.txt", Seconds(0.5));
|
||||||
|
ndn::AppDelayTracer::InstallAll("dsccp3-1-zipf_delay.txt");
|
||||||
|
L2RateTracer::InstallAll("dsccp3-1-zipf_drop.txt", Seconds(0.5));
|
||||||
|
Simulator::Run();
|
||||||
|
Simulator::Destroy();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ns3
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return ns3::main(argc, argv);
|
||||||
|
}
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
#include "ns3/core-module.h"
|
||||||
|
#include "ns3/network-module.h"
|
||||||
|
#include "ns3/ndnSIM-module.h"
|
||||||
|
#include "../extensions/mircc-strategy.hpp"
|
||||||
|
|
||||||
|
namespace ns3
|
||||||
|
{
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CommandLine cmd;
|
||||||
|
cmd.Parse(argc, argv);
|
||||||
|
|
||||||
|
AnnotatedTopologyReader topologyReader("", 25);
|
||||||
|
topologyReader.SetFileName("topologies/dsccp4.txt");
|
||||||
|
topologyReader.Read();
|
||||||
|
|
||||||
|
// Install NDN stack on all nodes
|
||||||
|
ndn::StackHelper ndnHelper;
|
||||||
|
ndnHelper.setPolicy("nfd::cs::lru");
|
||||||
|
// ndnHelper.setCsSize(10000);
|
||||||
|
ndnHelper.setCsSize(0);
|
||||||
|
ndnHelper.InstallAll();
|
||||||
|
|
||||||
|
// Choosing forwarding strategy
|
||||||
|
ndn::StrategyChoiceHelper::InstallAll<nfd::fw::MIRCCStrategy>("/");
|
||||||
|
|
||||||
|
// 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> C3 = Names::Find<Node>("C3");
|
||||||
|
Ptr<Node> C4 = Names::Find<Node>("C4");
|
||||||
|
Ptr<Node> C5 = Names::Find<Node>("C5");
|
||||||
|
Ptr<Node> C6 = Names::Find<Node>("C6");
|
||||||
|
Ptr<Node> C7 = Names::Find<Node>("C7");
|
||||||
|
Ptr<Node> C8 = Names::Find<Node>("C8");
|
||||||
|
|
||||||
|
Ptr<Node> P1 = Names::Find<Node>("P1");
|
||||||
|
Ptr<Node> P2 = Names::Find<Node>("P2");
|
||||||
|
Ptr<Node> P3 = Names::Find<Node>("P3");
|
||||||
|
|
||||||
|
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerMIRCC");
|
||||||
|
consumerHelper.SetAttribute("MaxSeq", StringValue("5000")); // 100 interests a second
|
||||||
|
consumerHelper.SetAttribute("logtms",StringValue("0"));
|
||||||
|
consumerHelper.SetAttribute("start_ms",StringValue("0"));
|
||||||
|
consumerHelper.SetAttribute("end_ms",StringValue("60000"));
|
||||||
|
|
||||||
|
// // /Amazon
|
||||||
|
// consumerHelper.SetPrefix("/Amazon");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// // /Google
|
||||||
|
// consumerHelper.SetPrefix("/Google");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// // /Warner
|
||||||
|
// consumerHelper.SetPrefix("/Warner");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Amazon
|
||||||
|
consumerHelper.SetPrefix("/Amazon/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Google
|
||||||
|
consumerHelper.SetPrefix("/Google/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Google/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Google/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Google/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Google/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Google/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Google/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Google/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Warner
|
||||||
|
consumerHelper.SetPrefix("/Warner/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Warner/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Warner/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Warner/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Warner/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Warner/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Warner/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Warner/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Amazon");
|
||||||
|
producerHelper.Install(P1);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Google");
|
||||||
|
producerHelper.Install(P2);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Warner");
|
||||||
|
producerHelper.Install(P3);
|
||||||
|
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Amazon", P1);
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Google", P2);
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Warner", P3);
|
||||||
|
|
||||||
|
// // Calculate all possible routes and install FIBs
|
||||||
|
// ndn::GlobalRoutingHelper::CalculateRoutes();
|
||||||
|
|
||||||
|
|
||||||
|
// 单路径配置
|
||||||
|
ndn::FibHelper::AddRoute("R1", "/Amazon", "P1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R1", "/Google", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Amazon", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Google", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Google", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Amazon", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R5", "/Google", "P2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Amazon", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Warner", "R7", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Amazon", "R8", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Google", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Warner", "P3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Google", "R8", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Google", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Amazon", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Google", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Warner", "R10", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Amazon", "R0", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Google", "R0", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Warner", "R0", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Google", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Warner", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Amazon", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Google", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Amazon", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Google", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Warner", "R4", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Amazon", "R6", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Google", "R6", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Warner", "R6", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Amazon", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Google", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Warner", "R7", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Google", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Amazon", "R10", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Google", "R10", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Warner", "R10", 0);
|
||||||
|
|
||||||
|
// // 多路径配置
|
||||||
|
// ndn::FibHelper::AddRoute("R0", "/Warner", "R1", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R1", "/Warner", "R2", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R2", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R3", "/Google", "R8", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R5", "/Amazon", "R4", 0);
|
||||||
|
// ndn::FibHelper::AddRoute("R5", "/Warner", "R4", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R6", "/Amazon", "R5", 0);
|
||||||
|
// ndn::FibHelper::AddRoute("R6", "/Google", "R7", 0);
|
||||||
|
// ndn::FibHelper::AddRoute("R6", "/Warner", "R5", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R7", "/Amazon", "R5", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R8", "/Amazon", "R3", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R9", "/Google", "R2", 0);
|
||||||
|
|
||||||
|
// ndn::FibHelper::AddRoute("R10", "/Amazon", "R0", 0);
|
||||||
|
|
||||||
|
Simulator::Stop(Seconds(60.0));
|
||||||
|
|
||||||
|
ndn::L3RateTracer::InstallAll("dsccp4-1-mircc_throughput.txt", Seconds(0.1));
|
||||||
|
ndn::AppDelayTracer::InstallAll("dsccp4-1-mircc_delay.txt");
|
||||||
|
L2RateTracer::InstallAll("dsccp4-1-mircc_drop.txt", Seconds(0.1));
|
||||||
|
Simulator::Run();
|
||||||
|
Simulator::Destroy();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ns3
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return ns3::main(argc, argv);
|
||||||
|
}
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
#include "ns3/core-module.h"
|
||||||
|
#include "ns3/network-module.h"
|
||||||
|
#include "ns3/ndnSIM-module.h"
|
||||||
|
#include "../extensions/mircc-strategy.hpp"
|
||||||
|
|
||||||
|
namespace ns3
|
||||||
|
{
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CommandLine cmd;
|
||||||
|
cmd.Parse(argc, argv);
|
||||||
|
|
||||||
|
AnnotatedTopologyReader topologyReader("", 25);
|
||||||
|
topologyReader.SetFileName("topologies/dsccp4.txt");
|
||||||
|
topologyReader.Read();
|
||||||
|
|
||||||
|
// Install NDN stack on all nodes
|
||||||
|
ndn::StackHelper ndnHelper;
|
||||||
|
ndnHelper.setPolicy("nfd::cs::lru");
|
||||||
|
// ndnHelper.setCsSize(10000);
|
||||||
|
ndnHelper.setCsSize(0);
|
||||||
|
ndnHelper.InstallAll();
|
||||||
|
|
||||||
|
// Choosing forwarding strategy
|
||||||
|
ndn::StrategyChoiceHelper::InstallAll<nfd::fw::MIRCCStrategy>("/");
|
||||||
|
|
||||||
|
// 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> C3 = Names::Find<Node>("C3");
|
||||||
|
Ptr<Node> C4 = Names::Find<Node>("C4");
|
||||||
|
Ptr<Node> C5 = Names::Find<Node>("C5");
|
||||||
|
Ptr<Node> C6 = Names::Find<Node>("C6");
|
||||||
|
Ptr<Node> C7 = Names::Find<Node>("C7");
|
||||||
|
Ptr<Node> C8 = Names::Find<Node>("C8");
|
||||||
|
|
||||||
|
Ptr<Node> P1 = Names::Find<Node>("P1");
|
||||||
|
Ptr<Node> P2 = Names::Find<Node>("P2");
|
||||||
|
Ptr<Node> P3 = Names::Find<Node>("P3");
|
||||||
|
|
||||||
|
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerMIRCC");
|
||||||
|
consumerHelper.SetAttribute("MaxSeq", StringValue("5000")); // 100 interests a second
|
||||||
|
consumerHelper.SetAttribute("logtms",StringValue("0"));
|
||||||
|
consumerHelper.SetAttribute("start_ms",StringValue("0"));
|
||||||
|
consumerHelper.SetAttribute("end_ms",StringValue("60000"));
|
||||||
|
|
||||||
|
// // /Amazon
|
||||||
|
// consumerHelper.SetPrefix("/Amazon");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// // /Google
|
||||||
|
// consumerHelper.SetPrefix("/Google");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// // /Warner
|
||||||
|
// consumerHelper.SetPrefix("/Warner");
|
||||||
|
// consumerHelper.Install(C1);
|
||||||
|
// consumerHelper.Install(C2);
|
||||||
|
// consumerHelper.Install(C3);
|
||||||
|
// consumerHelper.Install(C4);
|
||||||
|
// consumerHelper.Install(C5);
|
||||||
|
// consumerHelper.Install(C6);
|
||||||
|
// consumerHelper.Install(C7);
|
||||||
|
// consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Amazon
|
||||||
|
consumerHelper.SetPrefix("/Amazon/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Amazon/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Google
|
||||||
|
consumerHelper.SetPrefix("/Google/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Google/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Google/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Google/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Google/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Google/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Google/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Google/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
// /Warner
|
||||||
|
consumerHelper.SetPrefix("/Warner/1");
|
||||||
|
consumerHelper.Install(C1);
|
||||||
|
consumerHelper.SetPrefix("/Warner/2");
|
||||||
|
consumerHelper.Install(C2);
|
||||||
|
consumerHelper.SetPrefix("/Warner/3");
|
||||||
|
consumerHelper.Install(C3);
|
||||||
|
consumerHelper.SetPrefix("/Warner/4");
|
||||||
|
consumerHelper.Install(C4);
|
||||||
|
consumerHelper.SetPrefix("/Warner/5");
|
||||||
|
consumerHelper.Install(C5);
|
||||||
|
consumerHelper.SetPrefix("/Warner/6");
|
||||||
|
consumerHelper.Install(C6);
|
||||||
|
consumerHelper.SetPrefix("/Warner/7");
|
||||||
|
consumerHelper.Install(C7);
|
||||||
|
consumerHelper.SetPrefix("/Warner/8");
|
||||||
|
consumerHelper.Install(C8);
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Amazon");
|
||||||
|
producerHelper.Install(P1);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Google");
|
||||||
|
producerHelper.Install(P2);
|
||||||
|
|
||||||
|
producerHelper.SetPrefix("/Warner");
|
||||||
|
producerHelper.Install(P3);
|
||||||
|
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Amazon", P1);
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Google", P2);
|
||||||
|
// ndnGlobalRoutingHelper.AddOrigins("/Warner", P3);
|
||||||
|
|
||||||
|
// // Calculate all possible routes and install FIBs
|
||||||
|
// ndn::GlobalRoutingHelper::CalculateRoutes();
|
||||||
|
|
||||||
|
|
||||||
|
// 单路径配置
|
||||||
|
ndn::FibHelper::AddRoute("R1", "/Amazon", "P1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R1", "/Google", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Amazon", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Google", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Google", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Amazon", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R4", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R5", "/Google", "P2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Amazon", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Warner", "R7", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Amazon", "R8", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Google", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Google", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Warner", "P3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Google", "R8", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Warner", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Google", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Amazon", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Google", "R1", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Warner", "R10", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Amazon", "R0", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Google", "R0", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C1", "/Warner", "R0", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Amazon", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Google", "R2", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C2", "/Warner", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Amazon", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Google", "R3", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C3", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Amazon", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Google", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C4", "/Warner", "R4", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Amazon", "R6", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Google", "R6", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C5", "/Warner", "R6", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Amazon", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Google", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C6", "/Warner", "R7", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Amazon", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Google", "R9", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C7", "/Warner", "R9", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Amazon", "R10", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Google", "R10", 0);
|
||||||
|
ndn::FibHelper::AddRoute("C8", "/Warner", "R10", 0);
|
||||||
|
|
||||||
|
// 多路径配置
|
||||||
|
ndn::FibHelper::AddRoute("R0", "/Warner", "R1", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R1", "/Warner", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R2", "/Warner", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R3", "/Google", "R8", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R5", "/Amazon", "R4", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R5", "/Warner", "R4", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Amazon", "R5", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Google", "R7", 0);
|
||||||
|
ndn::FibHelper::AddRoute("R6", "/Warner", "R5", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R7", "/Amazon", "R5", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R8", "/Amazon", "R3", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R9", "/Google", "R2", 0);
|
||||||
|
|
||||||
|
ndn::FibHelper::AddRoute("R10", "/Amazon", "R0", 0);
|
||||||
|
|
||||||
|
Simulator::Stop(Seconds(60.0));
|
||||||
|
|
||||||
|
ndn::L3RateTracer::InstallAll("dsccp4-2-mircc_throughput.txt", Seconds(0.1));
|
||||||
|
ndn::AppDelayTracer::InstallAll("dsccp4-2-mircc_delay.txt");
|
||||||
|
L2RateTracer::InstallAll("dsccp4-2-mircc_drop.txt", Seconds(0.1));
|
||||||
|
Simulator::Run();
|
||||||
|
Simulator::Destroy();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ns3
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return ns3::main(argc, argv);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
router
|
||||||
|
|
||||||
|
# node comment yPos xPos
|
||||||
|
R1 NA 5 3
|
||||||
|
R2 NA 5 5
|
||||||
|
R4 NA 5 7
|
||||||
|
R6 NA 5 9
|
||||||
|
C1 NA 7 1
|
||||||
|
C2 NA 5 1
|
||||||
|
C3 NA 3 1
|
||||||
|
P1 NA 8 11
|
||||||
|
P2 NA 6 11
|
||||||
|
P3 NA 4 11
|
||||||
|
P4 NA 2 11
|
||||||
|
R3 NA 7 8
|
||||||
|
R5 NA 3 8
|
||||||
|
|
||||||
|
link
|
||||||
|
|
||||||
|
# srcNode dstNode bandwidth metric delay queue
|
||||||
|
C1 R1 100Mbps 1 10ms 20
|
||||||
|
C2 R1 100Mbps 1 10ms 20
|
||||||
|
C3 R1 100Mbps 1 10ms 20
|
||||||
|
R6 P1 100Mbps 1 10ms 20
|
||||||
|
R6 P2 100Mbps 1 10ms 20
|
||||||
|
R6 P3 100Mbps 1 10ms 20
|
||||||
|
R6 P4 100Mbps 1 10ms 20
|
||||||
|
R1 R2 8Mbps 1 10ms 20
|
||||||
|
R2 R3 1Mbps 1 10ms 20
|
||||||
|
R4 R3 2Mbps 1 5ms 20
|
||||||
|
R3 R6 3Mbps 1 10ms 20
|
||||||
|
R4 R5 3Mbps 1 5ms 20
|
||||||
|
R2 R4 5Mbps 1 5ms 20
|
||||||
|
R2 R5 4Mbps 1 10ms 20
|
||||||
|
R5 R6 7Mbps 1 10ms 20
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# topo_abilene.txt
|
||||||
|
|
||||||
|
router
|
||||||
|
|
||||||
|
# node comment yPos xPos
|
||||||
|
C1 NA 3 7
|
||||||
|
C2 NA 1 4
|
||||||
|
C3 NA 1 3
|
||||||
|
C4 NA 3 1
|
||||||
|
C5 NA 5 1
|
||||||
|
C6 NA 6 3
|
||||||
|
C7 NA 6 5
|
||||||
|
C8 NA 4 7
|
||||||
|
R0 NA 3 6
|
||||||
|
R1 NA 2 5
|
||||||
|
R2 NA 2 4
|
||||||
|
R3 NA 2 3
|
||||||
|
R4 NA 3 2
|
||||||
|
R5 NA 4 2
|
||||||
|
R6 NA 5 2
|
||||||
|
R7 NA 5 3
|
||||||
|
R8 NA 5 4
|
||||||
|
R9 NA 5 5
|
||||||
|
R10 NA 4 6
|
||||||
|
P1 NA 1 5
|
||||||
|
P2 NA 4 1
|
||||||
|
P3 NA 6 4
|
||||||
|
|
||||||
|
|
||||||
|
link
|
||||||
|
|
||||||
|
# srcNode dstNode bandwidth metric delay queue
|
||||||
|
C1 R0 100Mbps 1 10ms 20
|
||||||
|
R1 P1 100Mbps 1 10ms 20
|
||||||
|
R2 C2 100Mbps 1 10ms 20
|
||||||
|
R3 C3 100Mbps 1 10ms 20
|
||||||
|
R4 C4 100Mbps 1 10ms 20
|
||||||
|
R5 P2 100Mbps 1 10ms 20
|
||||||
|
R6 C5 100Mbps 1 10ms 20
|
||||||
|
R7 C6 100Mbps 1 10ms 20
|
||||||
|
R8 P3 100Mbps 1 10ms 20
|
||||||
|
R9 C7 100Mbps 1 10ms 20
|
||||||
|
R10 C8 100Mbps 1 10ms 20
|
||||||
|
R0 R1 10Mbps 1 10ms 20
|
||||||
|
R1 R2 25Mbps 1 10ms 20
|
||||||
|
R2 R3 15Mbps 1 10ms 20
|
||||||
|
R3 R4 15Mbps 1 10ms 20
|
||||||
|
R4 R5 20Mbps 1 10ms 20
|
||||||
|
R5 R6 5Mbps 1 10ms 20
|
||||||
|
R6 R7 5Mbps 1 10ms 20
|
||||||
|
R7 R8 10Mbps 1 10ms 20
|
||||||
|
R8 R9 20Mbps 1 10ms 20
|
||||||
|
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
|
||||||
Reference in new issue
Block a user