tests: forwarding with Link objects test suite
Fw/TestLinkForwarding is an end-to-end test suite that verifies
the proper forwarding rules for Interest with Link objects.
It replaces Fw/TestStrategy/LookupFib test suite.
refs #3893
Change-Id: I6dd3fe7988f8be6d55dd5dc589f7953c4d18f2ee
diff --git a/tests/daemon/fw/strategy.t.cpp b/tests/daemon/fw/strategy.t.cpp
index 72d43b4..11f3f38 100644
--- a/tests/daemon/fw/strategy.t.cpp
+++ b/tests/daemon/fw/strategy.t.cpp
@@ -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,
@@ -100,147 +100,7 @@
BOOST_CHECK((strategy.removedFaces == std::vector<FaceId>{id2, id1}));
}
-class LookupFibFixture : public BaseFixture
-{
-protected:
- class TestStrategy : public DummyStrategy
- {
- public:
- explicit
- TestStrategy(Forwarder& forwarder)
- : DummyStrategy(forwarder)
- {
- }
-
- const fib::Entry&
- lookupFib(const pit::Entry& pitEntry) const
- {
- return this->Strategy::lookupFib(pitEntry);
- }
- };
-
- LookupFibFixture()
- : strategy(forwarder)
- , fib(forwarder.getFib())
- , pit(forwarder.getPit())
- , nrt(forwarder.getNetworkRegionTable())
- , inFace(make_shared<DummyFace>())
- , outFace(make_shared<DummyFace>())
- , link(makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}}))
- {
- forwarder.addFace(inFace);
- forwarder.addFace(outFace);
- }
-
- const fib::Entry&
- lookupFib(Interest& interest)
- {
- shared_ptr<pit::Entry> pitEntry = pit.insert(interest).first;
- pitEntry->insertOrUpdateInRecord(*inFace, interest);
- return strategy.lookupFib(*pitEntry);
- }
-
-protected:
- Forwarder forwarder;
- TestStrategy strategy;
- Fib& fib;
- Pit& pit;
- NetworkRegionTable& nrt;
-
- shared_ptr<Face> inFace;
- shared_ptr<Face> outFace;
- shared_ptr<Link> link;
-};
-
-BOOST_FIXTURE_TEST_SUITE(LookupFib, LookupFibFixture)
-
-BOOST_AUTO_TEST_CASE(NoLink)
-{
- fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
- BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(ConsumerRegion)
-{
- nrt.insert("/arizona/cs/avenir");
- fib.insert("/").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- interest->setLink(link->wireEncode());
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/");
- BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeFirstDelegation)
-{
- nrt.insert("/arizona/cs/hobo");
- fib.insert("/telia").first->addNextHop(*outFace, 20);
- fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- interest->setLink(link->wireEncode());
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/telia");
- BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
- BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/telia/terabits");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeSecondDelegation)
-{
- nrt.insert("/arizona/cs/hobo");
- fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- interest->setLink(link->wireEncode());
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
- BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
- BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeHasSelectedDelegation)
-{
- nrt.insert("/ucsd/caida/click");
- fib.insert("/telia").first->addNextHop(*outFace, 10);
- fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- interest->setLink(link->wireEncode());
- interest->setSelectedDelegation("/ucla/cs");
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
- BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
- BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(ProducerRegion)
-{
- nrt.insert("/ucla/cs/spurs");
- fib.insert("/").first->addNextHop(*outFace, 10);
- fib.insert("/ucla").first->addNextHop(*outFace, 10);
- fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
- auto interest = makeInterest("/net/ndnsim/www/index.html");
- interest->setLink(link->wireEncode());
- interest->setSelectedDelegation("/ucla/cs");
- const fib::Entry& fibEntry = this->lookupFib(*interest);
-
- BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
- BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
- BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_SUITE_END() // LookupFib
+// LookupFib is tested in Fw/TestLinkForwarding test suite.
BOOST_AUTO_TEST_SUITE_END() // TestStrategy
BOOST_AUTO_TEST_SUITE_END() // Fw