Remove unused authentication variable.
[lispflowmapping.git] / mappingservice / implementation / src / main / java / org / opendaylight / lispflowmapping / implementation / lisp / MapServer.java
index 9fb9c09181943916d9dfeba4a4e813ea69a90273..36f0a292a6db2688bdc183f4eeb15e9b1b3ada77 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Set;
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.lispflowmapping.implementation.authentication.LispAuthenticationUtil;
 import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
 import org.opendaylight.lispflowmapping.interfaces.dao.SubKeys;
 import org.opendaylight.lispflowmapping.interfaces.dao.SubscriberRLOC;
@@ -55,7 +54,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.OdlMappingserviceListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,16 +63,14 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
 
     protected static final Logger LOG = LoggerFactory.getLogger(MapServer.class);
     private IMappingService mapService;
-    private boolean authenticate;
     private boolean subscriptionService;
     private IMapNotifyHandler notifyHandler;
     private NotificationService notificationService;
 
-    public MapServer(IMappingService mapService, boolean authenticate, boolean subscriptionService,
+    public MapServer(IMappingService mapService, boolean subscriptionService,
             IMapNotifyHandler notifyHandler, NotificationService notificationService) {
         Preconditions.checkNotNull(mapService);
         this.mapService = mapService;
-        this.authenticate = authenticate;
         this.subscriptionService = subscriptionService;
         this.notifyHandler = notifyHandler;
         this.notificationService = notificationService;
@@ -88,34 +84,15 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
         this.subscriptionService = subscriptionService;
     }
 
-    @Override
-    public boolean shouldAuthenticate() {
-        return authenticate;
-    }
-
-    @Override
-    public void setShouldAuthenticate(boolean shouldAuthenticate) {
-        authenticate = shouldAuthenticate;
-    }
-
     @SuppressWarnings("unchecked")
     public void handleMapRegister(MapRegister mapRegister) {
-        boolean authFailed = false;
         boolean mappingUpdated = false;
         boolean merge = ConfigIni.getInstance().mappingMergeIsSet() && mapRegister.isMergeEnabled();
-        MappingAuthkey authkey = null;
         Set<SubscriberRLOC> subscribers = null;
         MappingRecord oldMapping;
 
         for (MappingRecordItem record : mapRegister.getMappingRecordItem()) {
             MappingRecord mapping = record.getMappingRecord();
-            if (authenticate) {
-                authkey = mapService.getAuthenticationKey(mapping.getEid());
-                if (!LispAuthenticationUtil.validate(mapRegister, mapping.getEid(), authkey)) {
-                    authFailed = true;
-                    break;
-                }
-            }
 
             oldMapping = (MappingRecord) mapService.getMapping(MappingOrigin.Southbound, mapping.getEid());
             mapService.addMapping(MappingOrigin.Southbound, mapping.getEid(), getSiteId(mapRegister), mapping, merge);
@@ -135,7 +112,7 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
                 }
             }
         }
-        if (!authFailed && BooleanUtils.isTrue(mapRegister.isWantMapNotify())) {
+        if (BooleanUtils.isTrue(mapRegister.isWantMapNotify())) {
             LOG.trace("MapRegister wants MapNotify");
             MapNotifyBuilder builder = new MapNotifyBuilder();
             List<TransportAddress> rlocs = null;
@@ -161,10 +138,6 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
             } else {
                 MapNotifyBuilderHelper.setFromMapRegister(builder, mapRegister);
             }
-            if (authenticate) {
-                builder.setAuthenticationData(LispAuthenticationUtil.createAuthenticationData(builder.build(),
-                        authkey.getKeyString()));
-            }
             notifyHandler.handleMapNotify(builder.build(), rlocs);
         }
     }
@@ -226,7 +199,7 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
 
         // For SrcDst LCAF also send SMRs to Dst prefix
         if (eid.getAddress() instanceof SourceDestKey) {
-            Eid dstAddr = SourceDestKeyHelper.getDst(eid);
+            Eid dstAddr = SourceDestKeyHelper.getDstBinary(eid);
             Set<SubscriberRLOC> dstSubs = getSubscribers(dstAddr);
             MappingRecord newRecord = new MappingRecordBuilder(record).setEid(dstAddr).build();
             handleSmr(newRecord.getEid(), dstSubs, notifyHandler);