fw: replace Link with forwarding hint
Forwarding now processes forwarding hint on Interests, and no longer considers the Link object. refs #4055 Change-Id: I0331687ee8ec31afa2f1a105e903670689647c4d
This commit is contained in:
1 parent
944f38bb49
commit
fc2e13d58d
12 files changed
+93
-229
No files matched your search
+5
-3
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -57,9 +57,10 @@
|
||||
#include <vector>
|
||||
|
||||
#include <ndn-cxx/data.hpp>
|
||||
#include <ndn-cxx/delegation.hpp>
|
||||
#include <ndn-cxx/delegation-list.hpp>
|
||||
#include <ndn-cxx/exclude.hpp>
|
||||
#include <ndn-cxx/interest.hpp>
|
||||
#include <ndn-cxx/link.hpp>
|
||||
#include <ndn-cxx/name.hpp>
|
||||
#include <ndn-cxx/encoding/block.hpp>
|
||||
#include <ndn-cxx/lp/nack.hpp>
|
||||
@@ -100,12 +101,13 @@ using ndn::to_string;
|
||||
|
||||
using ndn::Block;
|
||||
using ndn::Data;
|
||||
using ndn::Delegation;
|
||||
using ndn::DelegationList;
|
||||
using ndn::Exclude;
|
||||
using ndn::FaceUri;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
using ndn::PartialName;
|
||||
using ndn::Link;
|
||||
|
||||
namespace tlv {
|
||||
// Don't write "namespace tlv = ndn::tlv", because NFD can add other members into this namespace.
|
||||
|
||||
+5
-53
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -72,53 +72,6 @@ Forwarder::Forwarder()
|
||||
|
||||
Forwarder::~Forwarder() = default;
|
||||
|
||||
void
|
||||
Forwarder::startProcessInterest(Face& face, const Interest& interest)
|
||||
{
|
||||
// check fields used by forwarding are well-formed
|
||||
try {
|
||||
if (interest.hasLink()) {
|
||||
interest.getLink();
|
||||
}
|
||||
}
|
||||
catch (const tlv::Error&) {
|
||||
NFD_LOG_DEBUG("startProcessInterest face=" << face.getId() <<
|
||||
" interest=" << interest.getName() << " malformed");
|
||||
// It's safe to call interest.getName() because Name has been fully parsed
|
||||
return;
|
||||
}
|
||||
|
||||
this->onIncomingInterest(face, interest);
|
||||
}
|
||||
|
||||
void
|
||||
Forwarder::startProcessData(Face& face, const Data& data)
|
||||
{
|
||||
// check fields used by forwarding are well-formed
|
||||
// (none needed)
|
||||
|
||||
this->onIncomingData(face, data);
|
||||
}
|
||||
|
||||
void
|
||||
Forwarder::startProcessNack(Face& face, const lp::Nack& nack)
|
||||
{
|
||||
// check fields used by forwarding are well-formed
|
||||
try {
|
||||
if (nack.getInterest().hasLink()) {
|
||||
nack.getInterest().getLink();
|
||||
}
|
||||
}
|
||||
catch (const tlv::Error&) {
|
||||
NFD_LOG_DEBUG("startProcessNack face=" << face.getId() <<
|
||||
" nack=" << nack.getInterest().getName() <<
|
||||
"~" << nack.getReason() << " malformed");
|
||||
return;
|
||||
}
|
||||
|
||||
this->onIncomingNack(face, nack);
|
||||
}
|
||||
|
||||
void
|
||||
Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
|
||||
{
|
||||
@@ -146,13 +99,12 @@ Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
|
||||
return;
|
||||
}
|
||||
|
||||
// strip Link object if Interest has reached producer region
|
||||
if (interest.hasLink() && m_networkRegionTable.isInProducerRegion(interest.getLink())) {
|
||||
// strip forwarding hint if Interest has reached producer region
|
||||
if (!interest.getForwardingHint().empty() &&
|
||||
m_networkRegionTable.isInProducerRegion(interest.getForwardingHint())) {
|
||||
NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
|
||||
" interest=" << interest.getName() << " reaching-producer-region");
|
||||
Interest& interestRef = const_cast<Interest&>(interest);
|
||||
interestRef.unsetLink();
|
||||
interestRef.unsetSelectedDelegation();
|
||||
const_cast<Interest&>(interest).setForwardingHint({});
|
||||
}
|
||||
|
||||
// PIT insert
|
||||
|
||||
+16
-7
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -106,24 +106,33 @@ public: // faces and policies
|
||||
public: // forwarding entrypoints and tables
|
||||
/** \brief start incoming Interest processing
|
||||
* \param face face on which Interest is received
|
||||
* \param interest the incoming Interest, must be created with make_shared
|
||||
* \param interest the incoming Interest, must be well-formed and created with make_shared
|
||||
*/
|
||||
void
|
||||
startProcessInterest(Face& face, const Interest& interest);
|
||||
startProcessInterest(Face& face, const Interest& interest)
|
||||
{
|
||||
this->onIncomingInterest(face, interest);
|
||||
}
|
||||
|
||||
/** \brief start incoming Data processing
|
||||
* \param face face on which Data is received
|
||||
* \param data the incoming Data, must be created with make_shared
|
||||
* \param data the incoming Data, must be well-formed and created with make_shared
|
||||
*/
|
||||
void
|
||||
startProcessData(Face& face, const Data& data);
|
||||
startProcessData(Face& face, const Data& data)
|
||||
{
|
||||
this->onIncomingData(face, data);
|
||||
}
|
||||
|
||||
/** \brief start incoming Nack processing
|
||||
* \param face face on which Nack is received
|
||||
* \param nack the incoming Nack, must be created with make_shared
|
||||
* \param nack the incoming Nack, must be well-formed
|
||||
*/
|
||||
void
|
||||
startProcessNack(Face& face, const lp::Nack& nack);
|
||||
startProcessNack(Face& face, const lp::Nack& nack)
|
||||
{
|
||||
this->onIncomingNack(face, nack);
|
||||
}
|
||||
|
||||
NameTree&
|
||||
getNameTree()
|
||||
|
||||
+23
-41
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -198,54 +198,36 @@ Strategy::lookupFib(const pit::Entry& pitEntry) const
|
||||
const Fib& fib = m_forwarder.getFib();
|
||||
|
||||
const Interest& interest = pitEntry.getInterest();
|
||||
// has Link object?
|
||||
if (!interest.hasLink()) {
|
||||
// has forwarding hint?
|
||||
if (interest.getForwardingHint().empty()) {
|
||||
// FIB lookup with Interest name
|
||||
const fib::Entry& fibEntry = fib.findLongestPrefixMatch(pitEntry);
|
||||
NFD_LOG_TRACE("lookupFib noLinkObject found=" << fibEntry.getPrefix());
|
||||
NFD_LOG_TRACE("lookupFib noForwardingHint found=" << fibEntry.getPrefix());
|
||||
return fibEntry;
|
||||
}
|
||||
|
||||
const Link& link = interest.getLink();
|
||||
const DelegationList& fh = interest.getForwardingHint();
|
||||
// Forwarding hint should have been stripped by incoming Interest pipeline when reaching producer region
|
||||
BOOST_ASSERT(!m_forwarder.getNetworkRegionTable().isInProducerRegion(fh));
|
||||
|
||||
// Link should have been stripped by incoming Interest pipeline when reaching producer region
|
||||
BOOST_ASSERT(!m_forwarder.getNetworkRegionTable().isInProducerRegion(link));
|
||||
|
||||
// has SelectedDelegation?
|
||||
if (interest.hasSelectedDelegation()) {
|
||||
// FIB lookup with SelectedDelegation
|
||||
Name selectedDelegation = interest.getSelectedDelegation();
|
||||
const fib::Entry& fibEntry = fib.findLongestPrefixMatch(selectedDelegation);
|
||||
NFD_LOG_TRACE("lookupFib hasSelectedDelegation=" << selectedDelegation << " found=" << fibEntry.getPrefix());
|
||||
return fibEntry;
|
||||
}
|
||||
|
||||
// FIB lookup with first delegation Name
|
||||
const fib::Entry& fibEntry0 = fib.findLongestPrefixMatch(link.getDelegations().begin()->second);
|
||||
// in default-free zone?
|
||||
bool isDefaultFreeZone = !(fibEntry0.getPrefix().size() == 0 && fibEntry0.hasNextHops());
|
||||
if (!isDefaultFreeZone) {
|
||||
NFD_LOG_TRACE("lookupFib inConsumerRegion found=" << fibEntry0.getPrefix());
|
||||
return fibEntry0;
|
||||
}
|
||||
|
||||
// choose and set SelectedDelegation
|
||||
for (const std::pair<uint32_t, Name>& delegation : link.getDelegations()) {
|
||||
const Name& delegationName = delegation.second;
|
||||
const fib::Entry& fibEntry = fib.findLongestPrefixMatch(delegationName);
|
||||
if (fibEntry.hasNextHops()) {
|
||||
/// \todo Don't modify in-record Interests.
|
||||
/// Set SelectedDelegation in outgoing Interest pipeline.
|
||||
std::for_each(pitEntry.in_begin(), pitEntry.in_end(),
|
||||
[&delegationName] (const pit::InRecord& inR) {
|
||||
const_cast<Interest&>(inR.getInterest()).setSelectedDelegation(delegationName);
|
||||
});
|
||||
NFD_LOG_TRACE("lookupFib enterDefaultFreeZone setSelectedDelegation=" << delegationName);
|
||||
return fibEntry;
|
||||
const fib::Entry* fibEntry = nullptr;
|
||||
for (const Delegation& del : fh) {
|
||||
fibEntry = &fib.findLongestPrefixMatch(del.name);
|
||||
if (fibEntry->hasNextHops()) {
|
||||
if (fibEntry->getPrefix().size() == 0) {
|
||||
// in consumer region, return the default route
|
||||
NFD_LOG_TRACE("lookupFib inConsumerRegion found=" << fibEntry->getPrefix());
|
||||
}
|
||||
else {
|
||||
// in default-free zone, use the first delegation that finds a FIB entry
|
||||
NFD_LOG_TRACE("lookupFib delegation=" << del.name << " found=" << fibEntry->getPrefix());
|
||||
}
|
||||
return *fibEntry;
|
||||
}
|
||||
BOOST_ASSERT(fibEntry->getPrefix().size() == 0); // only ndn:/ FIB entry can have zero nexthop
|
||||
}
|
||||
BOOST_ASSERT(false);
|
||||
return fibEntry0;
|
||||
BOOST_ASSERT(fibEntry != nullptr && fibEntry->getPrefix().size() == 0);
|
||||
return *fibEntry; // only occurs if no delegation finds a FIB nexthop
|
||||
}
|
||||
|
||||
} // namespace fw
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -29,11 +29,11 @@
|
||||
namespace nfd {
|
||||
|
||||
bool
|
||||
NetworkRegionTable::isInProducerRegion(const Link& link) const
|
||||
NetworkRegionTable::isInProducerRegion(const DelegationList& forwardingHint) const
|
||||
{
|
||||
for (const Name& regionName : *this) {
|
||||
for (const Name& delegationName : boost::adaptors::values(link.getDelegations())) {
|
||||
if (delegationName.isPrefixOf(regionName)) {
|
||||
for (const Delegation& delegation : forwardingHint) {
|
||||
if (delegation.name.isPrefixOf(regionName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2016, Regents of the University of California,
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -41,16 +41,16 @@ class NetworkRegionTable : public std::set<Name>
|
||||
{
|
||||
public:
|
||||
/** \brief determines whether an Interest has reached a producer region
|
||||
* \param link the Link object on an Interest
|
||||
* \param forwardingHint forwarding hint of an Interest
|
||||
* \retval true the Interest has reached a producer region
|
||||
* \retval false the Interest has not reached a producer region
|
||||
*
|
||||
* If any delegation names in the Link object is a prefix of any region name,
|
||||
* If any delegation name in the forwarding hint is a prefix of any region name,
|
||||
* the Interest has reached the producer region and should be forwarded according to its Name;
|
||||
* otherwise, the Interest should be forwarded according to the delegations.
|
||||
* otherwise, the Interest should be forwarded according to the forwarding hint.
|
||||
*/
|
||||
bool
|
||||
isInProducerRegion(const Link& link) const;
|
||||
isInProducerRegion(const DelegationList& forwardingHint) const;
|
||||
};
|
||||
|
||||
} // namespace nfd
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -588,61 +588,6 @@ BOOST_AUTO_TEST_CASE(PitLeak) // Bug 3484
|
||||
BOOST_CHECK_EQUAL(pit.size(), 0);
|
||||
}
|
||||
|
||||
|
||||
class MalformedPacketFixture : public UnitTestTimeFixture
|
||||
{
|
||||
protected:
|
||||
MalformedPacketFixture()
|
||||
: face1(make_shared<DummyFace>())
|
||||
, face2(make_shared<DummyFace>())
|
||||
{
|
||||
forwarder.addFace(face1);
|
||||
forwarder.addFace(face2);
|
||||
}
|
||||
|
||||
void
|
||||
processInterest(shared_ptr<Interest> badInterest)
|
||||
{
|
||||
forwarder.startProcessInterest(*face1, *badInterest);
|
||||
this->continueProcessPacket();
|
||||
}
|
||||
|
||||
// processData
|
||||
|
||||
// processNack
|
||||
|
||||
private:
|
||||
void
|
||||
continueProcessPacket()
|
||||
{
|
||||
this->advanceClocks(time::milliseconds(10), time::seconds(6));
|
||||
}
|
||||
|
||||
protected:
|
||||
Forwarder forwarder;
|
||||
shared_ptr<DummyFace> face1; // face of incoming bad packet
|
||||
shared_ptr<DummyFace> face2; // another face for setting up states
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(MalformedPacket, MalformedPacketFixture)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(BadLink)
|
||||
{
|
||||
shared_ptr<Interest> goodInterest = makeInterest("ndn:/");
|
||||
Block wire = goodInterest->wireEncode();
|
||||
wire.push_back(ndn::encoding::makeEmptyBlock(tlv::Data)); // bad Link
|
||||
wire.encode();
|
||||
|
||||
auto badInterest = make_shared<Interest>();
|
||||
BOOST_REQUIRE_NO_THROW(badInterest->wireDecode(wire));
|
||||
BOOST_REQUIRE(badInterest->hasLink());
|
||||
BOOST_REQUIRE_THROW(badInterest->getLink(), tlv::Error);
|
||||
|
||||
BOOST_CHECK_NO_THROW(this->processInterest(badInterest));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // MalformedPacket
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -34,7 +34,7 @@ namespace tests {
|
||||
using namespace nfd::tests;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Fw)
|
||||
BOOST_AUTO_TEST_SUITE(TestLinkForwarding)
|
||||
BOOST_AUTO_TEST_SUITE(TestForwardingHint)
|
||||
|
||||
/**
|
||||
* /arizona/cs/avenir
|
||||
@@ -95,8 +95,6 @@ public:
|
||||
topo.registerPrefix(nodeH, linkHC->getFace(nodeH), "/ucla", 20);
|
||||
topo.registerPrefix(nodeC, linkCS->getFace(nodeC), "/ucla", 10);
|
||||
topo.registerPrefix(nodeS, linkSQ->getFace(nodeS), "/net/ndnsim", 10);
|
||||
|
||||
linkObject = makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}});
|
||||
}
|
||||
|
||||
/** \brief express an Interest with Link object from consumerA
|
||||
@@ -105,7 +103,7 @@ public:
|
||||
consumerExpressInterest(int seq)
|
||||
{
|
||||
auto interest = makeInterest(Name("/net/ndnsim").appendNumber(seq));
|
||||
interest->setLink(linkObject->wireEncode());
|
||||
interest->setForwardingHint({delTelia, delUcla});
|
||||
consumerA->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@@ -114,7 +112,9 @@ public:
|
||||
TopologyNode nodeA, nodeH, nodeT, nodeP, nodeC, nodeS, nodeQ;
|
||||
shared_ptr<TopologyLink> linkAH, linkHT, linkTP, linkHC, linkCS, linkSQ;
|
||||
shared_ptr<TopologyAppLink> consumerA, producerP, producerQ;
|
||||
shared_ptr<Link> linkObject;
|
||||
|
||||
Delegation delTelia = {10, "/telia/terabits"};
|
||||
Delegation delUcla = {20, "/ucla/cs"};
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(NdnsimTeliaUclaTopology, NdnsimTeliaUclaTopologyFixture)
|
||||
@@ -124,24 +124,20 @@ BOOST_AUTO_TEST_CASE(FetchTelia)
|
||||
this->consumerExpressInterest(1);
|
||||
this->advanceClocks(time::milliseconds(11), 20);
|
||||
|
||||
// A forwards Interest according to default route, no change to Link and SelectedDelegation
|
||||
// A forwards Interest according to default route, no change to forwarding hint
|
||||
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
|
||||
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
|
||||
BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
|
||||
BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
|
||||
|
||||
// H prefers T, and sets SelectedDelegation
|
||||
// H prefers T, no change to forwarding hint
|
||||
BOOST_CHECK_EQUAL(linkHT->getFace(nodeH).getCounters().nOutInterests, 1);
|
||||
const Interest& interestHT = topo.getPcap(linkHT->getFace(nodeH)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestHT.hasLink(), true);
|
||||
BOOST_CHECK_EQUAL(interestHT.hasSelectedDelegation(), true);
|
||||
BOOST_CHECK_EQUAL(interestHT.getSelectedDelegation(), "/telia/terabits");
|
||||
BOOST_CHECK_EQUAL(interestHT.getForwardingHint(), DelegationList({delTelia, delUcla}));
|
||||
|
||||
// T forwards to P, Link and SelectedDelegation are stripped when Interest reaches producer region
|
||||
// T forwards to P, forwarding hint stripped when Interest reaches producer region
|
||||
BOOST_CHECK_EQUAL(linkTP->getFace(nodeT).getCounters().nOutInterests, 1);
|
||||
const Interest& interestTP = topo.getPcap(linkTP->getFace(nodeT)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestTP.hasLink(), false);
|
||||
BOOST_CHECK_EQUAL(interestTP.hasSelectedDelegation(), false);
|
||||
BOOST_CHECK(interestTP.getForwardingHint().empty());
|
||||
|
||||
// Data is served by P and reaches A
|
||||
BOOST_CHECK_EQUAL(producerP->getForwarderFace().getCounters().nInData, 1);
|
||||
@@ -157,31 +153,25 @@ BOOST_AUTO_TEST_CASE(FetchUcla)
|
||||
this->consumerExpressInterest(1);
|
||||
this->advanceClocks(time::milliseconds(11), 20);
|
||||
|
||||
// A forwards Interest according to default route, no change to Link and SelectedDelegation
|
||||
// A forwards Interest according to default route, no change to forwarding hint
|
||||
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
|
||||
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
|
||||
BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
|
||||
BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
|
||||
|
||||
// H forwards to C, and sets SelectedDelegation
|
||||
// H forwards to C, no change to forwarding hint
|
||||
BOOST_CHECK_EQUAL(linkHC->getFace(nodeH).getCounters().nOutInterests, 1);
|
||||
const Interest& interestHC = topo.getPcap(linkHC->getFace(nodeH)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestHC.hasLink(), true);
|
||||
BOOST_CHECK_EQUAL(interestHC.hasSelectedDelegation(), true);
|
||||
BOOST_CHECK_EQUAL(interestHC.getSelectedDelegation(), "/ucla/cs");
|
||||
BOOST_CHECK_EQUAL(interestHC.getForwardingHint(), DelegationList({delTelia, delUcla}));
|
||||
|
||||
// C forwards to S, no change to Link and SelectedDelegation
|
||||
// C forwards to S, no change to forwarding hint
|
||||
BOOST_CHECK_EQUAL(linkCS->getFace(nodeC).getCounters().nOutInterests, 1);
|
||||
const Interest& interestCS = topo.getPcap(linkCS->getFace(nodeC)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestCS.hasLink(), true);
|
||||
BOOST_CHECK_EQUAL(interestCS.hasSelectedDelegation(), true);
|
||||
BOOST_CHECK_EQUAL(interestCS.getSelectedDelegation(), "/ucla/cs");
|
||||
BOOST_CHECK_EQUAL(interestCS.getForwardingHint(), DelegationList({delTelia, delUcla}));
|
||||
|
||||
// S forwards to Q, Link and SelectedDelegation are stripped when Interest reaches producer region
|
||||
// S forwards to Q, forwarding hint stripped when Interest reaches producer region
|
||||
BOOST_CHECK_EQUAL(linkSQ->getFace(nodeS).getCounters().nOutInterests, 1);
|
||||
const Interest& interestSQ = topo.getPcap(linkSQ->getFace(nodeS)).sentInterests.at(0);
|
||||
BOOST_CHECK_EQUAL(interestSQ.hasLink(), false);
|
||||
BOOST_CHECK_EQUAL(interestSQ.hasSelectedDelegation(), false);
|
||||
BOOST_CHECK(interestSQ.getForwardingHint().empty());
|
||||
|
||||
// Data is served by Q and reaches A
|
||||
BOOST_CHECK_EQUAL(producerQ->getForwarderFace().getCounters().nInData, 1);
|
||||
@@ -190,7 +180,7 @@ BOOST_AUTO_TEST_CASE(FetchUcla)
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // NdnsimTeliaUclaTopology
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestLinkForwarding
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestForwardingHint
|
||||
BOOST_AUTO_TEST_SUITE_END() // Fw
|
||||
|
||||
} // namespace tests
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2015, Regents of the University of California,
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -35,24 +35,24 @@ BOOST_FIXTURE_TEST_SUITE(TestNetworkRegionTable, BaseFixture)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InProducerRegion)
|
||||
{
|
||||
shared_ptr<Link> link = makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}});
|
||||
DelegationList fh{{10, "/telia/terabits"}, {20, "/ucla/cs"}};
|
||||
|
||||
NetworkRegionTable nrt1;
|
||||
nrt1.insert("/verizon");
|
||||
BOOST_CHECK_EQUAL(nrt1.isInProducerRegion(*link), false);
|
||||
BOOST_CHECK_EQUAL(nrt1.isInProducerRegion(fh), false);
|
||||
|
||||
NetworkRegionTable nrt2;
|
||||
nrt2.insert("/ucla");
|
||||
BOOST_CHECK_EQUAL(nrt2.isInProducerRegion(*link), false);
|
||||
BOOST_CHECK_EQUAL(nrt2.isInProducerRegion(fh), false);
|
||||
|
||||
NetworkRegionTable nrt3;
|
||||
nrt3.insert("/ucla/cs");
|
||||
BOOST_CHECK_EQUAL(nrt3.isInProducerRegion(*link), true);
|
||||
BOOST_CHECK_EQUAL(nrt3.isInProducerRegion(fh), true);
|
||||
|
||||
NetworkRegionTable nrt4;
|
||||
nrt4.insert("/ucla/cs/software");
|
||||
nrt4.insert("/ucla/cs/irl");
|
||||
BOOST_CHECK_EQUAL(nrt4.isInProducerRegion(*link), true);
|
||||
BOOST_CHECK_EQUAL(nrt4.isInProducerRegion(fh), true);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -55,8 +55,7 @@ BOOST_AUTO_TEST_CASE(CanMatch)
|
||||
BOOST_CHECK_EQUAL(entry.canMatch(*interest3), true);
|
||||
|
||||
shared_ptr<Interest> interest4 = makeInterest("/A");
|
||||
shared_ptr<Link> link4 = makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}});
|
||||
interest4->setLink(link4->wireEncode());
|
||||
interest4->setForwardingHint({{10, "/telia/terabits"}, {20, "/ucla/cs"}});
|
||||
BOOST_CHECK_EQUAL(entry.canMatch(*interest4), false); // expected failure until #3162
|
||||
|
||||
shared_ptr<Interest> interest5 = makeInterest("/A");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -110,14 +110,6 @@ signData(Data& data)
|
||||
return data;
|
||||
}
|
||||
|
||||
shared_ptr<Link>
|
||||
makeLink(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> delegations)
|
||||
{
|
||||
auto link = make_shared<Link>(name, delegations);
|
||||
signData(link);
|
||||
return link;
|
||||
}
|
||||
|
||||
lp::Nack
|
||||
makeNack(Interest interest, lp::NackReason reason)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2014-2017, Regents of the University of California,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
@@ -135,13 +135,6 @@ signData(shared_ptr<Data> data)
|
||||
return data;
|
||||
}
|
||||
|
||||
/** \brief create a Link object with fake signature
|
||||
* \note Link may be modified afterwards without losing the fake signature.
|
||||
* If a real signature is desired, sign again with KeyChain.
|
||||
*/
|
||||
shared_ptr<Link>
|
||||
makeLink(const Name& name, std::initializer_list<std::pair<uint32_t, Name>> delegations);
|
||||
|
||||
/** \brief create a Nack
|
||||
* \param interest Interest
|
||||
* \param reason Nack reason
|
||||
|
||||
Reference in new issue
Block a user