blob: 3153a7dde0060744f5ca8b268b6b669d74a52719 [file] [log] [blame]
Teng Liang7003e0b2018-03-03 16:03:30 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
Davide Pesaventoe422f9e2022-06-03 01:30:23 -04003 * Copyright (c) 2014-2022, 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
Davide Pesaventoe422f9e2022-06-03 01:30:23 -040034namespace nfd::tests {
Teng Liang7003e0b2018-03-03 16:03:30 -070035
36BOOST_AUTO_TEST_SUITE(Fw)
Davide Pesaventocf7db2f2019-03-24 23:17:28 -040037BOOST_FIXTURE_TEST_SUITE(TestPitExpiry, GlobalIoTimeFixture)
Teng Liang7003e0b2018-03-03 16:03:30 -070038
39class PitExpiryTestStrategy : public DummyStrategy
40{
41public:
42 static Name
43 getStrategyName(uint64_t version)
44 {
45 return Name("/PitExpiryTestStrategy").appendVersion(version);
46 }
47
48 static void
49 registerAs(const Name& strategyName)
50 {
51 registerAsImpl<PitExpiryTestStrategy>(strategyName);
52 }
53
54 explicit
55 PitExpiryTestStrategy(Forwarder& forwarder, const Name& name = getStrategyName(1))
56 : DummyStrategy(forwarder, name)
57 {
58 }
59
60 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040061 afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
Teng Liang7003e0b2018-03-03 16:03:30 -070062 const shared_ptr<pit::Entry>& pitEntry) override
63 {
Davide Pesavento0498ce82021-06-14 02:02:21 -040064 DummyStrategy::afterReceiveInterest(interest, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -070065
66 if (afterReceiveInterest_count <= 1) {
67 setExpiryTimer(pitEntry, 190_ms);
68 }
69 }
70
71 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040072 afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
73 const shared_ptr<pit::Entry>& pitEntry) override
Teng Liang7003e0b2018-03-03 16:03:30 -070074 {
Davide Pesavento0498ce82021-06-14 02:02:21 -040075 if (afterContentStoreHit_count == 0) {
76 setExpiryTimer(pitEntry, 190_ms);
77 }
78
79 DummyStrategy::afterContentStoreHit(data, ingress, pitEntry);
80 }
81
82 void
83 beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
84 const shared_ptr<pit::Entry>& pitEntry) override
85 {
86 DummyStrategy::beforeSatisfyInterest(data, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -070087
Teng Liang43bb2312018-03-26 04:16:42 -070088 if (beforeSatisfyInterest_count <= 2) {
Teng Liang7003e0b2018-03-03 16:03:30 -070089 setExpiryTimer(pitEntry, 190_ms);
90 }
91 }
92
93 void
Davide Pesavento0498ce82021-06-14 02:02:21 -040094 afterReceiveData(const Data& data, const FaceEndpoint& ingress,
95 const shared_ptr<pit::Entry>& pitEntry) override
Teng Liang43bb2312018-03-26 04:16:42 -070096 {
97 ++afterReceiveData_count;
98
99 if (afterReceiveData_count <= 2) {
100 setExpiryTimer(pitEntry, 290_ms);
101 }
102
Davide Pesavento0498ce82021-06-14 02:02:21 -0400103 this->sendDataToAll(data, pitEntry, ingress.face);
Teng Liang43bb2312018-03-26 04:16:42 -0700104 }
105
106 void
Davide Pesavento0498ce82021-06-14 02:02:21 -0400107 afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
Teng Liang7003e0b2018-03-03 16:03:30 -0700108 const shared_ptr<pit::Entry>& pitEntry) override
109 {
Davide Pesavento0498ce82021-06-14 02:02:21 -0400110 DummyStrategy::afterReceiveNack(nack, ingress, pitEntry);
Teng Liang7003e0b2018-03-03 16:03:30 -0700111
112 if (afterReceiveNack_count <= 1) {
113 setExpiryTimer(pitEntry, 50_ms);
114 }
115 }
116};
117
118BOOST_AUTO_TEST_CASE(UnsatisfiedInterest)
119{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400120 FaceTable faceTable;
121 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700122
123 auto face1 = make_shared<DummyFace>();
124 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400125 faceTable.add(face1);
126 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700127
128 Pit& pit = forwarder.getPit();
129
Junxiao Shi9d727852019-05-14 13:44:22 -0600130 auto interest1 = makeInterest("/A/0");
131 auto interest2 = makeInterest("/A/1");
Teng Liang7003e0b2018-03-03 16:03:30 -0700132 interest1->setInterestLifetime(90_ms);
133 interest2->setInterestLifetime(90_ms);
134
Teng Liangd94b7b32022-07-10 21:29:37 +0800135 face1->receiveInterest(*interest1);
136 face2->receiveInterest(*interest2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700137 BOOST_CHECK_EQUAL(pit.size(), 2);
138
139 this->advanceClocks(100_ms);
140 BOOST_CHECK_EQUAL(pit.size(), 0);
141}
142
143BOOST_AUTO_TEST_CASE(SatisfiedInterest)
144{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400145 FaceTable faceTable;
146 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700147
148 auto face1 = make_shared<DummyFace>();
149 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400150 faceTable.add(face1);
151 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700152
153 Pit& pit = forwarder.getPit();
154
Junxiao Shi9d727852019-05-14 13:44:22 -0600155 auto interest = makeInterest("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700156 interest->setInterestLifetime(90_ms);
Junxiao Shi9d727852019-05-14 13:44:22 -0600157 auto data = makeData("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700158
Teng Liangd94b7b32022-07-10 21:29:37 +0800159 face1->receiveInterest(*interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700160
161 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800162 face2->receiveData(*data);
Teng Liang7003e0b2018-03-03 16:03:30 -0700163
164 this->advanceClocks(1_ms);
165 BOOST_CHECK_EQUAL(pit.size(), 0);
166}
167
Teng Liang85a36632018-03-21 05:59:34 -0700168BOOST_AUTO_TEST_CASE(CsHit)
169{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400170 FaceTable faceTable;
171 Forwarder forwarder(faceTable);
Teng Liang85a36632018-03-21 05:59:34 -0700172
173 auto face1 = make_shared<DummyFace>();
174 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400175 faceTable.add(face1);
176 faceTable.add(face2);
Teng Liang85a36632018-03-21 05:59:34 -0700177
Eric Newberry358414d2021-03-21 20:56:42 -0700178 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang85a36632018-03-21 05:59:34 -0700179 PitExpiryTestStrategy::registerAs(strategyA);
180 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
181
Junxiao Shi9d727852019-05-14 13:44:22 -0600182 auto interest = makeInterest("/A/0");
Teng Liang85a36632018-03-21 05:59:34 -0700183 interest->setInterestLifetime(90_ms);
184
Junxiao Shi9d727852019-05-14 13:44:22 -0600185 auto data = makeData("/A/0");
Teng Liang85a36632018-03-21 05:59:34 -0700186 data->setTag(make_shared<lp::IncomingFaceIdTag>(face2->getId()));
187
188 Pit& pit = forwarder.getPit();
189 BOOST_CHECK_EQUAL(pit.size(), 0);
190
191 Cs& cs = forwarder.getCs();
192 cs.insert(*data);
193
Teng Liangd94b7b32022-07-10 21:29:37 +0800194 face1->receiveInterest(*interest);
Teng Liang85a36632018-03-21 05:59:34 -0700195 this->advanceClocks(1_ms);
196 BOOST_CHECK_EQUAL(pit.size(), 1);
197
198 this->advanceClocks(190_ms);
199 BOOST_CHECK_EQUAL(pit.size(), 0);
200
Teng Liangd94b7b32022-07-10 21:29:37 +0800201 face1->receiveInterest(*interest);
Teng Liang85a36632018-03-21 05:59:34 -0700202 this->advanceClocks(1_ms);
203 BOOST_CHECK_EQUAL(pit.size(), 0);
204}
205
Teng Liang7003e0b2018-03-03 16:03:30 -0700206BOOST_AUTO_TEST_CASE(ReceiveNack)
207{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400208 FaceTable faceTable;
209 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700210
211 auto face1 = make_shared<DummyFace>();
212 auto face2 = make_shared<DummyFace>();
213 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400214 faceTable.add(face1);
215 faceTable.add(face2);
216 faceTable.add(face3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700217
Eric Newberry358414d2021-03-21 20:56:42 -0700218 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700219 PitExpiryTestStrategy::registerAs(strategyA);
220 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
221
222 Pit& pit = forwarder.getPit();
223
Junxiao Shi9d727852019-05-14 13:44:22 -0600224 auto interest = makeInterest("/A/0", false, 90_ms, 562);
225 lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
Teng Liang7003e0b2018-03-03 16:03:30 -0700226
Teng Liangd94b7b32022-07-10 21:29:37 +0800227 face1->receiveInterest(*interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700228 auto entry = pit.find(*interest);
Md Ashiqur Rahmanc88d2d42019-08-28 20:19:47 +0000229 entry->insertOrUpdateOutRecord(*face2, *interest);
230 entry->insertOrUpdateOutRecord(*face3, *interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700231
232 this->advanceClocks(10_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800233 face2->receiveNack(nack);
Teng Liang7003e0b2018-03-03 16:03:30 -0700234
235 this->advanceClocks(1_ms);
236 BOOST_CHECK_EQUAL(pit.size(), 1);
237
238 this->advanceClocks(50_ms);
239 BOOST_CHECK_EQUAL(pit.size(), 0);
240}
241
242BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveInterest)
243{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400244 FaceTable faceTable;
245 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700246
247 auto face = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400248 faceTable.add(face);
Teng Liang7003e0b2018-03-03 16:03:30 -0700249
Eric Newberry358414d2021-03-21 20:56:42 -0700250 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700251 PitExpiryTestStrategy::registerAs(strategyA);
252 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
253
254 Pit& pit = forwarder.getPit();
255
Junxiao Shi9d727852019-05-14 13:44:22 -0600256 auto interest = makeInterest("/A/0", false, 90_ms);
Teng Liang7003e0b2018-03-03 16:03:30 -0700257
Teng Liangd94b7b32022-07-10 21:29:37 +0800258 face->receiveInterest(*interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700259 BOOST_CHECK_EQUAL(pit.size(), 1);
260
261 this->advanceClocks(100_ms);
262 BOOST_CHECK_EQUAL(pit.size(), 1);
263
264 this->advanceClocks(100_ms);
265 BOOST_CHECK_EQUAL(pit.size(), 0);
266}
267
268BOOST_AUTO_TEST_CASE(ResetTimerBeforeSatisfyInterest)
269{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400270 FaceTable faceTable;
271 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700272
273 auto face1 = make_shared<DummyFace>();
274 auto face2 = make_shared<DummyFace>();
Teng Liang43bb2312018-03-26 04:16:42 -0700275 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400276 faceTable.add(face1);
277 faceTable.add(face2);
278 faceTable.add(face3);
Teng Liang43bb2312018-03-26 04:16:42 -0700279
Eric Newberry358414d2021-03-21 20:56:42 -0700280 auto strategyA = Name("/strategyA").appendVersion(1);
281 auto strategyB = Name("/strategyB").appendVersion(1);
Teng Liang43bb2312018-03-26 04:16:42 -0700282 PitExpiryTestStrategy::registerAs(strategyA);
283 PitExpiryTestStrategy::registerAs(strategyB);
284 auto& sA = choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
285 auto& sB = choose<PitExpiryTestStrategy>(forwarder, "/A/0", strategyB);
286 Pit& pit = forwarder.getPit();
287
Junxiao Shi9d727852019-05-14 13:44:22 -0600288 auto interest1 = makeInterest("/A", true, 90_ms);
289 auto interest2 = makeInterest("/A/0", false, 90_ms);
290 auto data = makeData("/A/0");
Teng Liang43bb2312018-03-26 04:16:42 -0700291
Teng Liangd94b7b32022-07-10 21:29:37 +0800292 face1->receiveInterest(*interest1);
293 face2->receiveInterest(*interest2);
Teng Liang43bb2312018-03-26 04:16:42 -0700294 BOOST_CHECK_EQUAL(pit.size(), 2);
295
296 // beforeSatisfyInterest: the first Data prolongs PIT expiry timer by 190 ms
297 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800298 face3->receiveData(*data);
Teng Liang43bb2312018-03-26 04:16:42 -0700299 this->advanceClocks(189_ms);
300 BOOST_CHECK_EQUAL(pit.size(), 2);
301 this->advanceClocks(2_ms);
302 BOOST_CHECK_EQUAL(pit.size(), 0);
303
Teng Liangd94b7b32022-07-10 21:29:37 +0800304 face1->receiveInterest(*interest1);
305 face2->receiveInterest(*interest2);
Teng Liang43bb2312018-03-26 04:16:42 -0700306
307 // beforeSatisfyInterest: the second Data prolongs PIT expiry timer
308 // and the third one sets the timer to now
309 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800310 face3->receiveData(*data);
Teng Liang43bb2312018-03-26 04:16:42 -0700311 this->advanceClocks(1_ms);
312 BOOST_CHECK_EQUAL(pit.size(), 2);
313
314 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800315 face3->receiveData(*data);
Teng Liang43bb2312018-03-26 04:16:42 -0700316 this->advanceClocks(1_ms);
317 BOOST_CHECK_EQUAL(pit.size(), 0);
318
319 BOOST_CHECK_EQUAL(sA.beforeSatisfyInterest_count, 3);
320 BOOST_CHECK_EQUAL(sB.beforeSatisfyInterest_count, 3);
321 BOOST_CHECK_EQUAL(sA.afterReceiveData_count, 0);
322 BOOST_CHECK_EQUAL(sB.afterReceiveData_count, 0);
323}
324
325BOOST_AUTO_TEST_CASE(ResetTimerAfterReceiveData)
326{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400327 FaceTable faceTable;
328 Forwarder forwarder(faceTable);
Teng Liang43bb2312018-03-26 04:16:42 -0700329
330 auto face1 = make_shared<DummyFace>();
331 auto face2 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400332 faceTable.add(face1);
333 faceTable.add(face2);
Teng Liang7003e0b2018-03-03 16:03:30 -0700334
Eric Newberry358414d2021-03-21 20:56:42 -0700335 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700336 PitExpiryTestStrategy::registerAs(strategyA);
Teng Liang43bb2312018-03-26 04:16:42 -0700337 auto& sA = choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
Teng Liang7003e0b2018-03-03 16:03:30 -0700338
339 Pit& pit = forwarder.getPit();
340
Junxiao Shi9d727852019-05-14 13:44:22 -0600341 auto interest = makeInterest("/A/0", false, 90_ms);
342 auto data = makeData("/A/0");
Teng Liang7003e0b2018-03-03 16:03:30 -0700343
Teng Liangd94b7b32022-07-10 21:29:37 +0800344 face1->receiveInterest(*interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700345
Teng Liang43bb2312018-03-26 04:16:42 -0700346 // afterReceiveData: the first Data prolongs PIT expiry timer by 290 ms
Teng Liang7003e0b2018-03-03 16:03:30 -0700347 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800348 face2->receiveData(*data);
Teng Liang43bb2312018-03-26 04:16:42 -0700349 this->advanceClocks(289_ms);
350 BOOST_CHECK_EQUAL(pit.size(), 1);
351 this->advanceClocks(2_ms);
352 BOOST_CHECK_EQUAL(pit.size(), 0);
Teng Liang7003e0b2018-03-03 16:03:30 -0700353
Teng Liangd94b7b32022-07-10 21:29:37 +0800354 face1->receiveInterest(*interest);
Teng Liang43bb2312018-03-26 04:16:42 -0700355
356 // afterReceiveData: the second Data prolongs PIT expiry timer
357 // and the third one sets the timer to now
358 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800359 face2->receiveData(*data);
Teng Liang7003e0b2018-03-03 16:03:30 -0700360 this->advanceClocks(1_ms);
361 BOOST_CHECK_EQUAL(pit.size(), 1);
362
363 this->advanceClocks(30_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800364 face2->receiveData(*data);
Teng Liang7003e0b2018-03-03 16:03:30 -0700365 this->advanceClocks(1_ms);
366 BOOST_CHECK_EQUAL(pit.size(), 0);
Teng Liang43bb2312018-03-26 04:16:42 -0700367
368 BOOST_CHECK_EQUAL(sA.beforeSatisfyInterest_count, 0);
369 BOOST_CHECK_EQUAL(sA.afterReceiveData_count, 3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700370}
371
372BOOST_AUTO_TEST_CASE(ReceiveNackAfterResetTimer)
373{
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400374 FaceTable faceTable;
375 Forwarder forwarder(faceTable);
Teng Liang7003e0b2018-03-03 16:03:30 -0700376
377 auto face1 = make_shared<DummyFace>();
378 auto face2 = make_shared<DummyFace>();
379 auto face3 = make_shared<DummyFace>();
Davide Pesaventoa4abfb02019-10-06 16:02:56 -0400380 faceTable.add(face1);
381 faceTable.add(face2);
382 faceTable.add(face3);
Teng Liang7003e0b2018-03-03 16:03:30 -0700383
Eric Newberry358414d2021-03-21 20:56:42 -0700384 auto strategyA = Name("/strategyA").appendVersion(1);
Teng Liang7003e0b2018-03-03 16:03:30 -0700385 PitExpiryTestStrategy::registerAs(strategyA);
386 choose<PitExpiryTestStrategy>(forwarder, "/A", strategyA);
387
388 Pit& pit = forwarder.getPit();
389
Junxiao Shi9d727852019-05-14 13:44:22 -0600390 auto interest = makeInterest("/A/0", false, 90_ms, 562);
391 lp::Nack nack = makeNack(*interest, lp::NackReason::CONGESTION);
Teng Liang7003e0b2018-03-03 16:03:30 -0700392
Teng Liangd94b7b32022-07-10 21:29:37 +0800393 face1->receiveInterest(*interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700394 auto entry = pit.find(*interest);
Md Ashiqur Rahmanc88d2d42019-08-28 20:19:47 +0000395 entry->insertOrUpdateOutRecord(*face2, *interest);
396 entry->insertOrUpdateOutRecord(*face3, *interest);
Teng Liang7003e0b2018-03-03 16:03:30 -0700397
398 //pitEntry is not erased after receiving the first Nack
399 this->advanceClocks(10_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800400 face2->receiveNack(nack);
Teng Liang7003e0b2018-03-03 16:03:30 -0700401 this->advanceClocks(1_ms);
402 BOOST_CHECK_EQUAL(pit.size(), 1);
403
404 //pitEntry is erased after receiving the second Nack
405 this->advanceClocks(10_ms);
Teng Liangd94b7b32022-07-10 21:29:37 +0800406 face3->receiveNack(nack);
Teng Liang7003e0b2018-03-03 16:03:30 -0700407 this->advanceClocks(1_ms);
408 BOOST_CHECK_EQUAL(pit.size(), 0);
409}
410
411BOOST_AUTO_TEST_SUITE_END() // TestPitExpiry
412BOOST_AUTO_TEST_SUITE_END() // Fw
413
Davide Pesaventoe422f9e2022-06-03 01:30:23 -0400414} // namespace nfd::tests