Bug 3661: Avoid storing mappings in config datastore when authentication 44/22744/1
authorFlorin Coras <fcoras@cisco.com>
Tue, 16 Jun 2015 18:23:26 +0000 (11:23 -0700)
committerFlorin Coras <fcoras@cisco.com>
Wed, 17 Jun 2015 01:09:28 +0000 (01:09 +0000)
fails

Change-Id: Ia1a30e75514ecdcb96ee123a22fa22cbd1ef61e0
Signed-off-by: Florin Coras <fcoras@cisco.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java

index 1e58e7a981a18e98e7ad151ffca4fbdb317b8da5..2efb485002185a55818356138adba414d82f9e35 100644 (file)
@@ -310,6 +310,15 @@ public class LispMappingService implements IFlowMapping, IFlowMappingShell, Bind
         public void onNotification(AddMapping mapRegisterNotification) {
             MapNotify mapNotify = handleMapRegister(mapRegisterNotification.getMapRegister(), smr);
             if (mapNotify != null) {
+                // store mappings in md-sal datastore only if we have a MapNotify
+                // XXX: this assumes that null MapNotifys are equivalent to authentication/registration errors
+                //      however notifies may be disabled with a flag (by the registering router). This should
+                //      be solved by moving southbound authentication of registrations out of handleMapRegister().
+                List<Mapping> mappings = LispNotificationHelper.getMapping(mapRegisterNotification);
+                for (Mapping mapping : mappings) {
+                    dsbe.updateMapping(mapping);
+                }
+
                 TransportAddressBuilder tab = new TransportAddressBuilder();
                 tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
                 tab.setPort(new PortNumber(LispMessage.PORT_NUM));
@@ -321,10 +330,6 @@ public class LispMappingService implements IFlowMapping, IFlowMappingShell, Bind
                 LOG.warn("got null map notify");
             }
 
-            List<Mapping> mappings = LispNotificationHelper.getMapping(mapRegisterNotification);
-            for (Mapping mapping : mappings) {
-                dsbe.updateMapping(mapping);
-            }
         }
     }