communication+route: Do not advertise Adjacency LSAs when hyperbolic routing is enabled
refs: #2402
Change-Id: If204807733f858606e31a0ff8231f140905063cf
diff --git a/src/route/map.cpp b/src/route/map.cpp
index a34f415..3b7378b 100644
--- a/src/route/map.cpp
+++ b/src/route/map.cpp
@@ -113,6 +113,14 @@
}
void
+Map::createFromCoordinateLsdb(Nlsr& nlsr)
+{
+ for (CoordinateLsa lsa : nlsr.getLsdb().getCoordinateLsdb()) {
+ addEntry(lsa.getOrigRouter());
+ }
+}
+
+void
Map::reset()
{
m_table.clear();
diff --git a/src/route/map.hpp b/src/route/map.hpp
index 8f7d0f4..c13869e 100644
--- a/src/route/map.hpp
+++ b/src/route/map.hpp
@@ -50,6 +50,9 @@
void
createFromAdjLsdb(Nlsr& pnlsr);
+ void
+ createFromCoordinateLsdb(Nlsr& nlsr);
+
const ndn::Name
getRouterNameByMappingNo(int32_t mn);
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 343767a..e538153 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -49,9 +49,20 @@
if (pnlsr.getIsRoutingTableCalculating() == false) {
//setting routing table calculation
pnlsr.setIsRoutingTableCalculating(true);
- if (pnlsr.getLsdb().doesLsaExist(
- pnlsr.getConfParameter().getRouterPrefix().toUri() + "/" + "adjacency",
- std::string("adjacency"))) {
+
+ bool isHrEnabled = pnlsr.getConfParameter().getHyperbolicState() != HYPERBOLIC_STATE_OFF;
+
+ if ((!isHrEnabled
+ &&
+ pnlsr.getLsdb()
+ .doesLsaExist(pnlsr.getConfParameter().getRouterPrefix().toUri()
+ + "/" + "adjacency", std::string("adjacency")))
+ ||
+ (isHrEnabled
+ &&
+ pnlsr.getLsdb()
+ .doesLsaExist(pnlsr.getConfParameter().getRouterPrefix().toUri()
+ + "/" + "coordinate", std::string("coordinate")))) {
if (pnlsr.getIsBuildAdjLsaSheduled() != 1) {
_LOG_TRACE("Clearing old routing table");
clearRoutingTable();
@@ -127,7 +138,7 @@
RoutingTable::calculateHypRoutingTable(Nlsr& nlsr)
{
Map map;
- map.createFromAdjLsdb(nlsr);
+ map.createFromCoordinateLsdb(nlsr);
map.writeLog();
size_t nRouters = map.getMapSize();