blob: 099d03157089224d41138b351b0a9acc9ace77a7 [file] [log] [blame]
Teng Liang7003e0b2018-03-03 16:03:30 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
Eric Newberry358414d2021-03-21 20:56:42 -07003 * Copyright (c) 2014-2021, Regents of the University of California,
Teng Liang7003e0b2018-03-03 16:03:30 -07004 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
10 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
Teng Liang7003e0b2018-03-03 16:03:30 -070026#include "tests/test-common.hpp"
Davide Pesaventocf7db2f2019-03-24 23:17:28 -040027#include "tests/daemon/global-io-fixture.hpp"
28#include "tests/daemon/face/dummy-face.hpp"
29#include "choose-strategy.hpp"
30#include "dummy-strategy.hpp"
Teng Liang7003e0b2018-03-03 16:03:30 -070031
Teng Liang85a36632018-03-21 05:59:34 -070032#include <ndn-cxx/lp/tags.hpp>
33
Teng Liang7003e0b2018-03-03 16:03:30 -070034namespace nfd {
35namespace fw {
36namespace tests {
37
38using namespace nfd::tests;
39
40BOOST_AUTO_TEST_SUITE(Fw)
Davide Pesaventocf7db2f2019-03-24 23:17:28 -040041BOOST_FIXTURE_TEST_SUITE(TestPitExpiry, GlobalIoTimeFixture)
Teng Liang7003e0b2018-03-03 16:03:30 -070042
43class PitExpiryTestStrategy : public DummyStrategy
44{
45public:
46 static Name
47 getStrategyName(uint64_t version)
48 {
49 return Name("/PitExpiryTestStrategy").appendVersion(version);
50 }
51
52 static void
53 registerAs(const Name& strategyName)
54 {
55 registerAsImpl<PitExpiryTestStrategy>(strategyName);
56 }
57
58 explicit
59 PitExpiryTestStrategy(Forwarder& forwarder, const Name& name = getStrategyName(1))
60 : DummyStrategy(forwarder, name)
61 {
62 }
63
64 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040065 afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
Teng Liang7003e0b2018-03-03 16:03:30 -070066 const shared_ptr<pit::Entry>& pitEntry) override
67 {
Davide Pesavento0498ce82021-06-14 02:02:21 -040068 DummyStrategy::afterReceiveInterest(interest, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -070069
70 if (afterReceiveInterest_count <= 1) {
71 setExpiryTimer(pitEntry, 190_ms);
72 }
73 }
74
75 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040076 afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
77 const shared_ptr<pit::Entry>& pitEntry) override
Teng Liang7003e0b2018-03-03 16:03:30 -070078 {
Davide Pesavento0498ce82021-06-14 02:02:21 -040079 if (afterContentStoreHit_count == 0) {
80 setExpiryTimer(pitEntry, 190_ms);
81 }
82
83 DummyStrategy::afterContentStoreHit(data, ingress, pitEntry);
84 }
85
86 void
87 beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
88 const shared_ptr<pit::Entry>& pitEntry) override
89 {
90 DummyStrategy::beforeSatisfyInterest(data, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -070091
Teng Liang43bb2312018-03-26 04:16:42 -070092 if (beforeSatisfyInterest_count <= 2) {
Teng Liang7003e0b2018-03-03 16:03:30 -070093 setExpiryTimer(pitEntry, 190_ms);
94 }
95 }
96
97 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040098 afterReceiveData(const Data& data, const FaceEndpoint& ingress,
99 const shared_ptr<pit::Entry>& pitEntry) override
Teng Liang43bb2312018-03-26 04:16:42 -0700100 {
101 ++afterReceiveData_count;
102
103 if (afterReceiveData_count <= 2) {
104 setExpiryTimer(pitEntry, 290_ms);
105 }
106
Davide Pesavento0498ce82021-06-14 02:02:21 -0400107 this->sendDataToAll(data, pitEntry, ingress.face);
Teng Liang43bb2312018-03-26 04:16:42 -0700108 }
109
110 void
Davide Pesavento0498ce82021-06-14 02:02:21 -0400111 afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
Teng Liang7003e0b2018-03-03 16:03:30 -0700112 const shared_ptr<pit::Entry>& pitEntry) override
113 {
Davide Pesavento0498ce82021-06-14 02:02:21 -0400114 DummyStrategy::afterReceiveNack(nack, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -0700115
116 if (afterReceiveNack_count <= 1) {
117 setExpiryTimer(pitEntry, 50_ms);
118 }
119 }
120};
121
122BOOST_AUTO_TEST_CASE(UnsatisfiedInterest)
123{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400124 FaceTable faceTable;
125 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700126
127 auto face1 = make_shared<DummyFace>();
128 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400129 faceTable.add(face1);
130 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700131
132 Pit& pit = forwarder.getPit();
133
Junxiao Shi9d727852019-05-14 13:44:22 -0600134 auto interest1 = makeInterest("/A/0");
135 auto interest2 = makeInterest("/A/1");
Teng Liang7003e0b2018-03-03 16:03:30 -0700136 interest1->setInterestLifetime(90_ms);
137 interest2->setInterestLifetime(90_ms);
138
ashiqopu075bb7d2019-03-10 01:38:21 +0000139 face1->receiveInterest(*interest1, 0);
140 face2->receiveInterest(*interest2, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700141 BOOST_CHECK_EQUAL(pit.size(), 2);
142
143 this->advanceClocks(100_ms);
144 BOOST_CHECK_EQUAL(pit.size(), 0);
145}
146
147BOOST_AUTO_TEST_CASE(SatisfiedInterest)
148{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400149 FaceTable faceTable;
150 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700151
152 auto face1 = make_shared<DummyFace>();
153 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400154 faceTable.add(face1);
155 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700156
157 Pit& pit = forwarder.getPit();
158
Junxiao Shi9d727852019-05-14 13:44:22 -0600159 auto interest = makeInterest("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700160 interest->setInterestLifetime(90_ms);
Junxiao Shi9d727852019-05-14 13:44:22 -0600161 auto data = makeData("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700162
ashiqopu075bb7d2019-03-10 01:38:21 +0000163 face1->receiveInterest(*interest, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700164
165 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000166 face2->receiveData(*data, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700167
168 this->advanceClocks(1_ms);
169 BOOST_CHECK_EQUAL(pit.size(), 0);
170}
171
Teng Liang85a36632018-03-21 05:59:34 -0700172BOOST_AUTO_TEST_CASE(CsHit)
173{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400174 FaceTable faceTable;
175 Forwarder forwarder(faceTable);
Teng Liang85a36632018-03-21 05:59:34 -0700176
177 auto face1 = make_shared<DummyFace>();
178 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400179 faceTable.add(face1);
180 faceTable.add(face2);
Teng Liang85a36632018-03-21 05:59:34 -0700181
Eric Newberry358414d2021-03-21 20:56:42 -0700182 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang85a36632018-03-21 05:59:34 -0700183 PitExpiryTestStrategy::registerAs(strategyA);
184 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
185
Junxiao Shi9d727852019-05-14 13:44:22 -0600186 auto interest = makeInterest("/A/0");
Teng Liang85a36632018-03-21 05:59:34 -0700187 interest->setInterestLifetime(90_ms);
188
Junxiao Shi9d727852019-05-14 13:44:22 -0600189 auto data = makeData("/A/0");
Teng Liang85a36632018-03-21 05:59:34 -0700190 data->setTag(make_shared<lp::IncomingFaceIdTag>(face2->getId()));
191
192 Pit& pit = forwarder.getPit();
193 BOOST_CHECK_EQUAL(pit.size(), 0);
194
195 Cs& cs = forwarder.getCs();
196 cs.insert(*data);
197
ashiqopu075bb7d2019-03-10 01:38:21 +0000198 face1->receiveInterest(*interest, 0);
Teng Liang85a36632018-03-21 05:59:34 -0700199 this->advanceClocks(1_ms);
200 BOOST_CHECK_EQUAL(pit.size(), 1);
201
202 this->advanceClocks(190_ms);
203 BOOST_CHECK_EQUAL(pit.size(), 0);
204
ashiqopu075bb7d2019-03-10 01:38:21 +0000205 face1->receiveInterest(*interest, 0);
Teng Liang85a36632018-03-21 05:59:34 -0700206 this->advanceClocks(1_ms);
207 BOOST_CHECK_EQUAL(pit.size(), 0);
208}
209
Teng Liang7003e0b2018-03-03 16:03:30 -0700210BOOST_AUTO_TEST_CASE(ReceiveNack)
211{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400212 FaceTable faceTable;
213 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700214
215 auto face1 = make_shared<DummyFace>();
216 auto face2 = make_shared<DummyFace>();
217 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400218 faceTable.add(face1);
219 faceTable.add(face2);
220 faceTable.add(face3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700221
Eric Newberry358414d2021-03-21 20:56:42 -0700222 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700223 PitExpiryTestStrategy::registerAs(strategyA);
224 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
225
226 Pit& pit = forwarder.getPit();
227
Junxiao Shi9d727852019-05-14 13:44:22 -0600228 auto interest = makeInterest("/A/0", false, 90_ms, 562);
229 lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
Teng Liang7003e0b2018-03-03 16:03:30 -0700230
ashiqopu075bb7d2019-03-10 01:38:21 +0000231 face1->receiveInterest(*interest, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700232 auto entry = pit.find(*interest);
Md Ashiqur Rahmanc88d2d42019-08-28 20:19:47 +0000233 entry->insertOrUpdateOutRecord(*face2, *interest);
234 entry->insertOrUpdateOutRecord(*face3, *interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700235
236 this->advanceClocks(10_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000237 face2->receiveNack(nack, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700238
239 this->advanceClocks(1_ms);
240 BOOST_CHECK_EQUAL(pit.size(), 1);
241
242 this->advanceClocks(50_ms);
243 BOOST_CHECK_EQUAL(pit.size(), 0);
244}
245
246BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveInterest)
247{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400248 FaceTable faceTable;
249 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700250
251 auto face = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400252 faceTable.add(face);
Teng Liang7003e0b2018-03-03 16:03:30 -0700253
Eric Newberry358414d2021-03-21 20:56:42 -0700254 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700255 PitExpiryTestStrategy::registerAs(strategyA);
256 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
257
258 Pit& pit = forwarder.getPit();
259
Junxiao Shi9d727852019-05-14 13:44:22 -0600260 auto interest = makeInterest("/A/0", false, 90_ms);
Teng Liang7003e0b2018-03-03 16:03:30 -0700261
ashiqopu075bb7d2019-03-10 01:38:21 +0000262 face->receiveInterest(*interest, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700263 BOOST_CHECK_EQUAL(pit.size(), 1);
264
265 this->advanceClocks(100_ms);
266 BOOST_CHECK_EQUAL(pit.size(), 1);
267
268 this->advanceClocks(100_ms);
269 BOOST_CHECK_EQUAL(pit.size(), 0);
270}
271
272BOOST_AUTO_TEST_CASE(ResetTimerBeforeSatisfyInterest)
273{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400274 FaceTable faceTable;
275 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700276
277 auto face1 = make_shared<DummyFace>();
278 auto face2 = make_shared<DummyFace>();
Teng Liang43bb2312018-03-26 04:16:42 -0700279 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400280 faceTable.add(face1);
281 faceTable.add(face2);
282 faceTable.add(face3);
Teng Liang43bb2312018-03-26 04:16:42 -0700283
Eric Newberry358414d2021-03-21 20:56:42 -0700284 auto strategyA = Name("/strategyA").appendVersion(1);
285 auto strategyB = Name("/strategyB").appendVersion(1);
Teng Liang43bb2312018-03-26 04:16:42 -0700286 PitExpiryTestStrategy::registerAs(strategyA);
287 PitExpiryTestStrategy::registerAs(strategyB);
288 auto& sA = choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
289 auto& sB = choose<PitExpiryTestStrategy>(forwarder, "/A/0", strategyB);
290 Pit& pit = forwarder.getPit();
291
Junxiao Shi9d727852019-05-14 13:44:22 -0600292 auto interest1 = makeInterest("/A", true, 90_ms);
293 auto interest2 = makeInterest("/A/0", false, 90_ms);
294 auto data = makeData("/A/0");
Teng Liang43bb2312018-03-26 04:16:42 -0700295
ashiqopu075bb7d2019-03-10 01:38:21 +0000296 face1->receiveInterest(*interest1, 0);
297 face2->receiveInterest(*interest2, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700298 BOOST_CHECK_EQUAL(pit.size(), 2);
299
300 // beforeSatisfyInterest: the first Data prolongs PIT expiry timer by 190 ms
301 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000302 face3->receiveData(*data, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700303 this->advanceClocks(189_ms);
304 BOOST_CHECK_EQUAL(pit.size(), 2);
305 this->advanceClocks(2_ms);
306 BOOST_CHECK_EQUAL(pit.size(), 0);
307
ashiqopu075bb7d2019-03-10 01:38:21 +0000308 face1->receiveInterest(*interest1, 0);
309 face2->receiveInterest(*interest2, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700310
311 // beforeSatisfyInterest: the second Data prolongs PIT expiry timer
312 // and the third one sets the timer to now
313 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000314 face3->receiveData(*data, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700315 this->advanceClocks(1_ms);
316 BOOST_CHECK_EQUAL(pit.size(), 2);
317
318 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000319 face3->receiveData(*data, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700320 this->advanceClocks(1_ms);
321 BOOST_CHECK_EQUAL(pit.size(), 0);
322
323 BOOST_CHECK_EQUAL(sA.beforeSatisfyInterest_count, 3);
324 BOOST_CHECK_EQUAL(sB.beforeSatisfyInterest_count, 3);
325 BOOST_CHECK_EQUAL(sA.afterReceiveData_count, 0);
326 BOOST_CHECK_EQUAL(sB.afterReceiveData_count, 0);
327}
328
329BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveData)
330{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400331 FaceTable faceTable;
332 Forwarder forwarder(faceTable);
Teng Liang43bb2312018-03-26 04:16:42 -0700333
334 auto face1 = make_shared<DummyFace>();
335 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400336 faceTable.add(face1);
337 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700338
Eric Newberry358414d2021-03-21 20:56:42 -0700339 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700340 PitExpiryTestStrategy::registerAs(strategyA);
Teng Liang43bb2312018-03-26 04:16:42 -0700341 auto& sA = choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
Teng Liang7003e0b2018-03-03 16:03:30 -0700342
343 Pit& pit = forwarder.getPit();
344
Junxiao Shi9d727852019-05-14 13:44:22 -0600345 auto interest = makeInterest("/A/0", false, 90_ms);
346 auto data = makeData("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700347
ashiqopu075bb7d2019-03-10 01:38:21 +0000348 face1->receiveInterest(*interest, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700349
Teng Liang43bb2312018-03-26 04:16:42 -0700350 // afterReceiveData: the first Data prolongs PIT expiry timer by 290 ms
Teng Liang7003e0b2018-03-03 16:03:30 -0700351 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000352 face2->receiveData(*data, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700353 this->advanceClocks(289_ms);
354 BOOST_CHECK_EQUAL(pit.size(), 1);
355 this->advanceClocks(2_ms);
356 BOOST_CHECK_EQUAL(pit.size(), 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700357
ashiqopu075bb7d2019-03-10 01:38:21 +0000358 face1->receiveInterest(*interest, 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700359
360 // afterReceiveData: the second Data prolongs PIT expiry timer
361 // and the third one sets the timer to now
362 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000363 face2->receiveData(*data, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700364 this->advanceClocks(1_ms);
365 BOOST_CHECK_EQUAL(pit.size(), 1);
366
367 this->advanceClocks(30_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000368 face2->receiveData(*data, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700369 this->advanceClocks(1_ms);
370 BOOST_CHECK_EQUAL(pit.size(), 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700371
372 BOOST_CHECK_EQUAL(sA.beforeSatisfyInterest_count, 0);
373 BOOST_CHECK_EQUAL(sA.afterReceiveData_count, 3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700374}
375
376BOOST_AUTO_TEST_CASE(ReceiveNackAfterResetTimer)
377{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400378 FaceTable faceTable;
379 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700380
381 auto face1 = make_shared<DummyFace>();
382 auto face2 = make_shared<DummyFace>();
383 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400384 faceTable.add(face1);
385 faceTable.add(face2);
386 faceTable.add(face3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700387
Eric Newberry358414d2021-03-21 20:56:42 -0700388 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700389 PitExpiryTestStrategy::registerAs(strategyA);
390 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
391
392 Pit& pit = forwarder.getPit();
393
Junxiao Shi9d727852019-05-14 13:44:22 -0600394 auto interest = makeInterest("/A/0", false, 90_ms, 562);
395 lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
Teng Liang7003e0b2018-03-03 16:03:30 -0700396
ashiqopu075bb7d2019-03-10 01:38:21 +0000397 face1->receiveInterest(*interest, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700398 auto entry = pit.find(*interest);
Md Ashiqur Rahmanc88d2d42019-08-28 20:19:47 +0000399 entry->insertOrUpdateOutRecord(*face2, *interest);
400 entry->insertOrUpdateOutRecord(*face3, *interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700401
402 //pitEntry is not erased after receiving the first Nack
403 this->advanceClocks(10_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000404 face2->receiveNack(nack, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700405 this->advanceClocks(1_ms);
406 BOOST_CHECK_EQUAL(pit.size(), 1);
407
408 //pitEntry is erased after receiving the second Nack
409 this->advanceClocks(10_ms);
ashiqopu075bb7d2019-03-10 01:38:21 +0000410 face3->receiveNack(nack, 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700411 this->advanceClocks(1_ms);
412 BOOST_CHECK_EQUAL(pit.size(), 0);
413}
414
415BOOST_AUTO_TEST_SUITE_END() // TestPitExpiry
416BOOST_AUTO_TEST_SUITE_END() // Fw
417
418} // namespace tests
419} // namespace fw
420} // namespace nfd