private volatile String bindingAddress = "0.0.0.0";
private volatile int xtrPort = LispMessage.XTR_PORT_NUM;
private volatile boolean listenOnXtrPort = false;
+ private boolean mapRegisterCacheEnabled = true;
private RpcRegistration<OdlLispSbService> sbRpcRegistration;
private NioDatagramChannel xtrChannel;
private LispSouthboundStats statistics = new LispSouthboundStats();
lispSouthboundHandler = new LispSouthboundHandler(this);
lispSouthboundHandler.setDataBroker(dataBroker);
lispSouthboundHandler.setNotificationProvider(this.notificationPublishService);
+ lispSouthboundHandler.setMapRegisterCacheEnabled(mapRegisterCacheEnabled);
lispSouthboundHandler.init();
lispXtrSouthboundHandler = new LispXtrSouthboundHandler();
this.dataBroker = dataBroker;
}
+ public void setMapRegisterCacheEnabled(final boolean mapRegisterCacheEnabled) {
+ this.mapRegisterCacheEnabled = mapRegisterCacheEnabled;
+ if (mapRegisterCacheEnabled) {
+ LOG.info("Enabling Map-Register cache");
+ } else {
+ LOG.info("Disabling Map-Register cache");
+ }
+ }
+
@Override
public void close() throws Exception {
unloadActions();
public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramPacket>
implements ILispSouthboundService, AutoCloseable {
private MapRegisterCache mapRegisterCache;
+ private boolean mapRegisterCacheEnabled = true;
/**
* How long is record supposed to be relevant. After this time record isn't valid.
private void handleMapRegister(ByteBuffer inBuffer, InetAddress sourceAddress, int port) {
try {
- final Map.Entry<MapRegisterCacheKey, byte[]> artificialEntry = MapRegisterPartialDeserializer
- .deserializePartially(inBuffer, sourceAddress);
- final MapRegisterCacheKey cacheKey = artificialEntry == null ? null : artificialEntry.getKey();
-
- final MapRegisterCacheValue cacheValue = resolveCacheValue(artificialEntry);
+ Map.Entry<MapRegisterCacheKey, byte[]> artificialEntry = null;
+ MapRegisterCacheKey cacheKey = null;
+ MapRegisterCacheValue cacheValue = null;
+ if (mapRegisterCacheEnabled) {
+ artificialEntry = MapRegisterPartialDeserializer.deserializePartially(inBuffer, sourceAddress);
+ cacheKey = artificialEntry == null ? null : artificialEntry.getKey();
+ cacheValue = resolveCacheValue(artificialEntry);
+ }
if (cacheValue != null) {
final MapRegisterCacheMetadata mapRegisterValue = cacheValue.getMapRegisterCacheMetadata();
LOG.debug("Map register message site-ID: {} xTR-ID: {} from cache.", mapRegisterValue.getSiteId(),
this.mapRegisterCache = mapRegisterCache;
}
+ public void setMapRegisterCacheEnabled(final boolean mapRegisterCacheEnabled) {
+ this.mapRegisterCacheEnabled = mapRegisterCacheEnabled;
+ }
public void init() {
Preconditions.checkNotNull(dataBroker);