BREAKING: Change Name LSAs to propagate cost which are applied to remote routes
This is a stopgap change to address a lack of functionality in the NDN testbed.
Current restrictions:
-Cost must be set from NFD readvertisement
-Cost is applied after routing calculations but before FIB insertion; lowest cost
nexthop will be chosen but may not be the optimal path given this cost.
Further work will be required to move the application of cost as part of routing
and to make this functionality more easily accessible.
Refs #5349
Change-Id: I914dc5c2d5d3cb6bfa13f5730df0eae66d115c60
diff --git a/tests/lsa/test-name-lsa.cpp b/tests/lsa/test-name-lsa.cpp
index 6f9928e..0634dd7 100644
--- a/tests/lsa/test-name-lsa.cpp
+++ b/tests/lsa/test-name-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,6 +20,9 @@
*/
#include "lsa/name-lsa.hpp"
+#include "name-prefix-list.hpp"
+
+#include "ndn-cxx/encoding/buffer-stream.hpp"
#include "tests/boost-test.hpp"
@@ -28,34 +31,90 @@
BOOST_AUTO_TEST_SUITE(TestNameLsa)
const uint8_t NAME_LSA1[] = {
- 0x89, 0x37, 0x80, 0x23, 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31,
- 0x82, 0x01, 0x0C, 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36,
- 0x20, 0x30, 0x34, 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61,
- 0x6D, 0x65, 0x31, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32
+ 0x89, 0x4F, //name lsa
+ 0x80, 0x23, // lsa
+ 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31, // router name (router1)
+ 0x82, 0x01, 0x0C, // sequence number (12)
+ 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36, 0x20, 0x30, 0x34,
+ 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, // expiration time
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x31, // name (name1)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, // name (name2)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
};
const uint8_t NAME_LSA_EXTRA_NAME[] = {
- 0x89, 0x40, 0x80, 0x23, 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31,
- 0x82, 0x01, 0x0C, 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36,
- 0x20, 0x30, 0x34, 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61,
- 0x6D, 0x65, 0x31, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, 0x07, 0x07, 0x08,
- 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33
+ 0x89, 0x64, //name lsa
+ 0x80, 0x23, // lsa
+ 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31, // router name (router1)
+ 0x82, 0x01, 0x0C, // sequence number (12)
+ 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36, 0x20, 0x30, 0x34,
+ 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, // expiration time
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x31, // name (name1)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, // name (name2)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33, // name (name3)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
};
const uint8_t NAME_LSA_DIFF_SEQ[] = {
- 0x89, 0x40, 0x80, 0x23, 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31,
- 0x82, 0x01, 0x0E, 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36,
- 0x20, 0x30, 0x34, 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61,
- 0x6D, 0x65, 0x31, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, 0x07, 0x07, 0x08,
- 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33
+ 0x89, 0x64, //name lsa
+ 0x80, 0x23, // lsa
+ 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31, // router name (router1)
+ 0x82, 0x01, 0x0E, // sequence number (12)
+ 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36, 0x20, 0x30, 0x34,
+ 0x3A, 0x31, 0x33, 0x3A, 0x33, 0x34, // expiration time
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x31, // name (name1)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, // name (name2)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33, // name (name3)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
};
const uint8_t NAME_LSA_DIFF_TS[] = {
- 0x89, 0x40, 0x80, 0x23, 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31,
- 0x82, 0x01, 0x0E, 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36,
- 0x20, 0x30, 0x34, 0x3A, 0x31, 0x33, 0x3A, 0x34, 0x34, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61,
- 0x6D, 0x65, 0x31, 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, 0x07, 0x07, 0x08,
- 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33
+ 0x89, 0x64, //name lsa
+ 0x80, 0x23, // lsa
+ 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31, // router name (router1)
+ 0x82, 0x01, 0x0E, // sequence number (12)
+ 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36, 0x20, 0x30, 0x34,
+ 0x3A, 0x31, 0x33, 0x3A, 0x34, 0x34, // expiration time (10s higher)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x31, // name (name1)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, // name (name2)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33, // name (name3)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+};
+
+const uint8_t NAME_LSA_DIFF_COST[] = {
+ 0x89, 0x64, //name lsa
+ 0x80, 0x23, // lsa
+ 0x07, 0x09, 0x08, 0x07, 0x72, 0x6F, 0x75, 0x74, 0x65, 0x72, 0x31, // router name (router1)
+ 0x82, 0x01, 0x0E, // sequence number (12)
+ 0x8B, 0x13, 0x32, 0x30, 0x32, 0x30, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x36, 0x20, 0x30, 0x34,
+ 0x3A, 0x31, 0x33, 0x3A, 0x34, 0x34, // expiration time (10s higher)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x31, // name (name1)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x32, // name (name2)
+ 0x8C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (0)
+ 0x92, 0x13, // prefix info
+ 0x07, 0x07, 0x08, 0x05, 0x6E, 0x61, 0x6D, 0x65, 0x33, // name (name3)
+ 0x8C, 0x08, 0x40, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cost (10)
};
BOOST_AUTO_TEST_CASE(Basic)
@@ -76,7 +135,7 @@
auto wire = nlsa1.wireEncode();
BOOST_TEST(wire == NAME_LSA1, boost::test_tools::per_element());
- nlsa1.addName("name3");
+ nlsa1.addName(PrefixInfo(ndn::Name("name3"), 0));
wire = nlsa1.wireEncode();
BOOST_TEST(wire == NAME_LSA_EXTRA_NAME, boost::test_tools::per_element());
@@ -90,6 +149,9 @@
wire = nlsa1.wireEncode();
BOOST_TEST(wire == NAME_LSA_DIFF_TS, boost::test_tools::per_element());
+ nlsa1.addName(PrefixInfo(ndn::Name("name3"), 10));
+ wire = nlsa1.wireEncode();
+ BOOST_TEST(wire == NAME_LSA_DIFF_COST, boost::test_tools::per_element());
// Not testing router name as not sure if that will ever change once set
}
@@ -107,9 +169,10 @@
BOOST_AUTO_TEST_CASE(OperatorEquals)
{
- ndn::Name name1("/ndn/test/name1");
- ndn::Name name2("/ndn/test/name2");
- ndn::Name name3("/ndn/some/other/name1");
+ PrefixInfo name1 = PrefixInfo(ndn::Name("/ndn/test/name1"), 0);
+ PrefixInfo name2 = PrefixInfo(ndn::Name("/ndn/test/name2"), 0);
+ PrefixInfo name3 = PrefixInfo(ndn::Name("/ndn/some/other/name1"), 0);
+ PrefixInfo name4 = PrefixInfo(ndn::Name("/ndn/some/other/name1"), 1);
NameLsa lsa1;
lsa1.addName(name1);
@@ -123,6 +186,18 @@
lsa2.addName(name3);
BOOST_CHECK_EQUAL(lsa1, lsa2);
+
+ NameLsa lsa3;
+ lsa3.addName(name1);
+ lsa3.addName(name2);
+ lsa3.addName(name4);
+ BOOST_CHECK_NE(lsa2, lsa3);
+
+ NameLsa lsa4;
+ lsa4.addName(name1);
+ lsa4.addName(name2);
+ lsa4.addName(name4);
+ BOOST_CHECK_EQUAL(lsa3, lsa4);
}
BOOST_AUTO_TEST_CASE(Update)
@@ -131,8 +206,8 @@
knownNameLsa.m_originRouter = ndn::Name("/yoursunny/_/%C1.Router/dal");
knownNameLsa.m_seqNo = 2683;
knownNameLsa.setExpirationTimePoint(ndn::time::system_clock::now() + 3561_ms);
- knownNameLsa.addName("/yoursunny/_/dal");
- knownNameLsa.addName("/ndn");
+ knownNameLsa.addName(PrefixInfo(ndn::Name("/yoursunny/_/dal"), 0));
+ knownNameLsa.addName(PrefixInfo(ndn::Name("/ndn"), 0));
auto rcvdLsa = std::make_shared<NameLsa>();
rcvdLsa->m_originRouter = ndn::Name("/yoursunny/_/%C1.Router/dal");
@@ -140,10 +215,10 @@
rcvdLsa->setExpirationTimePoint(ndn::time::system_clock::now() + 3600_ms);
auto nlsa = std::static_pointer_cast<NameLsa>(rcvdLsa);
- nlsa->addName("/ndn");
- nlsa->addName("/yoursunny/_/dal");
- ndn::Name addedName1("/yoursunny/video/ndn-dpdk_acmicn20_20200917");
- ndn::Name addedName2("/yoursunny/pushups");
+ nlsa->addName(PrefixInfo(ndn::Name("/ndn"), 0));
+ nlsa->addName(PrefixInfo(ndn::Name("/yoursunny/_/dal"), 0));
+ PrefixInfo addedName1 = PrefixInfo(ndn::Name("/yoursunny/video/ndn-dpdk_acmicn20_20200917"), 0);
+ PrefixInfo addedName2 = PrefixInfo(ndn::Name("/yoursunny/pushups"), 0);
nlsa->addName(addedName1);
nlsa->addName(addedName2);
diff --git a/tests/route/test-name-prefix-table.cpp b/tests/route/test-name-prefix-table.cpp
index 66c1826..5d10dd8 100644
--- a/tests/route/test-name-prefix-table.cpp
+++ b/tests/route/test-name-prefix-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,6 +20,7 @@
*/
#include "route/name-prefix-table.hpp"
+#include "name-prefix-list.hpp"
#include "route/fib.hpp"
#include "route/routing-table.hpp"
#include "lsdb.hpp"
@@ -295,10 +296,12 @@
NamePrefixList npl1;
ndn::Name n1("name1");
ndn::Name n2("name2");
+ PrefixInfo p1 = PrefixInfo(n1, 0);
+ PrefixInfo p2 = PrefixInfo(n2, 0);
ndn::Name router1("/router1/1");
- npl1.insert(n1);
- npl1.insert(n2);
+ npl1.insert(p1);
+ npl1.insert(p2);
NameLsa nlsa1(router1, 12, testTimePoint, npl1);
std::shared_ptr<Lsa> lsaPtr = std::make_shared<NameLsa>(nlsa1);
@@ -311,10 +314,11 @@
BOOST_CHECK(isNameInNpt(n2));
ndn::Name n3("name3");
+ PrefixInfo p3 = PrefixInfo(n3, 0);
auto nlsa = std::static_pointer_cast<NameLsa>(lsaPtr);
- nlsa->removeName(n2);
- nlsa->addName(n3);
- npt.updateFromLsdb(lsaPtr, LsdbUpdate::UPDATED, {n3}, {n2});
+ nlsa->removeName(p2);
+ nlsa->addName(p3);
+ npt.updateFromLsdb(lsaPtr, LsdbUpdate::UPDATED, {p3}, {p2});
BOOST_CHECK(isNameInNpt(n1));
BOOST_CHECK(!isNameInNpt(n2)); // Removed
BOOST_CHECK(isNameInNpt(n3));
diff --git a/tests/test-lsa-segment-storage.cpp b/tests/test-lsa-segment-storage.cpp
index 337cdc7..347b1a5 100644
--- a/tests/test-lsa-segment-storage.cpp
+++ b/tests/test-lsa-segment-storage.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -105,18 +105,23 @@
advanceClocks(ndn::time::milliseconds(10));
makeLsaContent(lsaInterestName);
- BOOST_CHECK_EQUAL(ims.size(), 3);
+ //Does seem to be generating 6 segments, but how to validate correct contents?
+ BOOST_CHECK_EQUAL(ims.size(), 6);
- // 1st segment
sendReplies();
+ // 1st segment
advanceClocks(ndn::time::milliseconds(10));
// 2nd and 3rd segments
sendReplies();
advanceClocks(ndn::time::milliseconds(10));
+ // 4th and 5th segments
+ sendReplies();
+ // 6th segment
+ advanceClocks(ndn::time::milliseconds(10));
// 3 data segments should be in the storage
- BOOST_CHECK_EQUAL(lsdb.m_lsaStorage.size(), 3);
- BOOST_CHECK_EQUAL(numValidationSignal, 3);
+ BOOST_CHECK_EQUAL(lsdb.m_lsaStorage.size(), 6);
+ BOOST_CHECK_EQUAL(numValidationSignal, 6);
numValidationSignal = 0;
// Remove older LSA from storage upon receiving that of higher sequence
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index 28cf59e..96eb4d2 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -67,8 +67,8 @@
void
checkSignalResult(LsdbUpdate updateType,
const std::shared_ptr<Lsa>& lsaPtr,
- const std::list<ndn::Name>& namesToAdd,
- const std::list<ndn::Name>& namesToRemove)
+ const std::list<PrefixInfo>& namesToAdd,
+ const std::list<PrefixInfo>& namesToRemove)
{
BOOST_CHECK(updateHappened);
BOOST_CHECK_EQUAL(lsaPtrCheck->getOriginRouter(), lsaPtr->getOriginRouter());
@@ -101,8 +101,8 @@
Lsdb lsdb;
LsdbUpdate updateTypeCheck = LsdbUpdate::INSTALLED;
- std::list<ndn::Name> namesToAddCheck;
- std::list<ndn::Name> namesToRemoveCheck;
+ std::list<PrefixInfo> namesToAddCheck;
+ std::list<PrefixInfo> namesToRemoveCheck;
std::shared_ptr<Lsa> lsaPtrCheck = nullptr;
bool updateHappened = false;
};
@@ -190,7 +190,7 @@
int nPrefixes = 0;
while (nameLsa->wireEncode().size() < ndn::MAX_NDN_PACKET_SIZE) {
- nameLsa->addName(ndn::Name(prefix).appendNumber(++nPrefixes));
+ nameLsa->addName(PrefixInfo(ndn::Name(prefix).appendNumber(++nPrefixes), 0));
break;
}
lsdb.installLsa(nameLsa);
@@ -232,7 +232,7 @@
int nPrefixes = 0;
while (lsa->wireEncode().size() < ndn::MAX_NDN_PACKET_SIZE) {
- lsa->addName(ndn::Name(prefix).appendNumber(++nPrefixes));
+ lsa->addName(PrefixInfo(ndn::Name(prefix).appendNumber(++nPrefixes), 0));
}
lsdb.installLsa(lsa);
@@ -266,7 +266,7 @@
ndn::Name prefix("/prefix/");
for (int nPrefixes = 0; nPrefixes < 3; ++nPrefixes) {
- lsa.addName(ndn::Name(prefix).appendNumber(nPrefixes));
+ lsa.addName(PrefixInfo(ndn::Name(prefix).appendNumber(nPrefixes), 0));
}
ndn::Name interestName("/localhop/ndn/nlsr/LSA/cs/%C1.Router/router1/NAME/");
@@ -439,7 +439,7 @@
NameLsa nameLsa2(router2, 14, testTimePoint, npl2);
lsaPtr = std::make_shared<NameLsa>(nameLsa2);
lsdb.installLsa(lsaPtr);
- checkSignalResult(LsdbUpdate::UPDATED, lsaPtr, {"name3"}, {"name1"});
+ checkSignalResult(LsdbUpdate::UPDATED, lsaPtr, {PrefixInfo(ndn::Name("/name3"), 0)}, {PrefixInfo(ndn::Name("/name1"), 0)});
lsdb.removeLsa(lsaPtrCheck->getOriginRouter(), Lsa::Type::NAME);
checkSignalResult(LsdbUpdate::REMOVED, lsaPtr, {}, {});
diff --git a/tests/test-name-prefix-list.cpp b/tests/test-name-prefix-list.cpp
index 7fd06ca..0863492 100644
--- a/tests/test-name-prefix-list.cpp
+++ b/tests/test-name-prefix-list.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -108,7 +108,7 @@
/*
Two NamePrefixLists will be considered equal if they contain the
- same names. Sources for names are ignored.
+ same names with the same costs. Sources for names are ignored.
*/
BOOST_AUTO_TEST_CASE(OperatorEquals)
{
@@ -129,6 +129,15 @@
list2.erase(name3, "C0");
BOOST_CHECK_NE(list1, list2);
+
+ list2.insert(name3, "C0");
+ list1.insert(PrefixInfo(name1, 10));
+ list1.insert(PrefixInfo(name2, 20));
+ BOOST_CHECK_NE(list1, list2);
+
+ list2.insert(PrefixInfo(name1, 10));
+ list2.insert(PrefixInfo(name2, 20));
+ BOOST_CHECK_EQUAL(list1, list2);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-statistics.cpp b/tests/test-statistics.cpp
index e4c8a23..bf2c0d9 100644
--- a/tests/test-statistics.cpp
+++ b/tests/test-statistics.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2024, The University of Memphis,
+ * Copyright (c) 2014-2025, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -23,6 +23,7 @@
#include "hello-protocol.hpp"
#include "lsdb.hpp"
#include "nlsr.hpp"
+#include "name-prefix-list.hpp"
#include "tests/io-key-chain-fixture.hpp"
#include "tests/test-common.hpp"
@@ -249,7 +250,7 @@
seqNo = nameLsa->getSeqNo();
- nameLsa->addName(ndn::Name("/ndn/name"));
+ nameLsa->addName(PrefixInfo(ndn::Name("/ndn/name"), 0));
lsdb.installLsa(nameLsa);
// Receive Name LSA Interest