Add LISP mapping entry aging mechanism
Change-Id: I9a2a75f64ff4fb580dcc4b2e789af020c5decd8d
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispMapServer.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispMapServer.java
index 8c2a7b7..e69cd41 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispMapServer.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispMapServer.java
@@ -57,17 +57,17 @@
private static final Logger log = LoggerFactory.getLogger(LispMapServer.class);
- private LispEidRlocMap eidRlocMap = LispEidRlocMap.getInstance();
+ private LispMappingDatabase mapDb = LispMappingDatabase.getInstance();
private LispAuthenticationConfig authConfig = LispAuthenticationConfig.getInstance();
- public static LispMapServer getInstance() {
- return SingletonHelper.INSTANCE;
- }
-
// non-instantiable (except for our Singleton)
private LispMapServer() {
}
+ public static LispMapServer getInstance() {
+ return SingletonHelper.INSTANCE;
+ }
+
/**
* Handles map-register message and replies with map-notify message.
*
@@ -83,6 +83,14 @@
return null;
}
+ register.getMapRecords().forEach(mapRecord -> {
+ LispEidRecord eidRecord =
+ new LispEidRecord(mapRecord.getMaskLength(),
+ mapRecord.getEidPrefixAfi());
+
+ mapDb.putMapRecord(eidRecord, mapRecord);
+ });
+
// we only acknowledge back to ETR when want-map-notify bit is set to true
// otherwise, we do not acknowledge back to ETR
if (register.isWantMapNotify()) {
@@ -99,12 +107,6 @@
new InetSocketAddress(register.getSender().getAddress(), MAP_NOTIFY_PORT);
notify.configSender(address);
- register.getMapRecords().forEach(record -> {
- LispEidRecord eidRecord =
- new LispEidRecord(record.getMaskLength(), record.getEidPrefixAfi());
- eidRlocMap.insertMapRecord(eidRecord, record);
- });
-
return notify;
}
@@ -213,7 +215,12 @@
/**
* Prevents object instantiation from external.
*/
- private static class SingletonHelper {
+ private static final class SingletonHelper {
+ private static final String ILLEGAL_ACCESS_MSG = "Should not instantiate this class.";
private static final LispMapServer INSTANCE = new LispMapServer();
+
+ private SingletonHelper() {
+ throw new IllegalAccessError(ILLEGAL_ACCESS_MSG);
+ }
}
}