Bug 5255: Send SMRs on NB mapping creation 10/34210/1
authorFlorin Coras <fcoras@cisco.com>
Sat, 6 Feb 2016 15:05:59 +0000 (16:05 +0100)
committerFlorin Coras <fcoras@cisco.com>
Sat, 6 Feb 2016 15:05:59 +0000 (16:05 +0100)
Change-Id: If96f59dc7ebb8fce0b6890c0eea512e01a4c64ed
Signed-off-by: Florin Coras <fcoras@cisco.com>
mappingservice/api/src/main/yang/odl-mappingservice.yang
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/MappingDataListener.java

index 5cca689cc7062b1e75a476c02a1d6de15423c712..868f72dcd975d08e5fc03d9b4649e8ee59a8deec 100644 (file)
@@ -61,6 +61,7 @@ module odl-mappingservice {
     typedef mapping-change {
         description "Type of mapping update";
         type enumeration {
+            enum created;
             enum updated;
             enum removed;
         }
index 2124066eb45f2321df1b23462f112fbc78db526f..37bb69a53ce2949e088b8691c875ef07a751b2aa 100644 (file)
@@ -67,6 +67,17 @@ public class MappingDataListener extends AbstractDataListener {
 
                 mapSystem.addMapping(mapping.getOrigin(), mapping.getMappingRecord().getEid(),
                         mapping.getMappingRecord());
+
+                if (mapping.getOrigin() == MappingOrigin.Northbound) {
+                    // Only publish notifications for mapping changes caused by Northbound, since Southbound has a
+                    // dedicated code path for detecting mapping updates. The notifications are used for sending SMR.
+                    try {
+                        notificationPublishService.putNotification(MSNotificationInputUtil.toMappingChanged(mapping,
+                                MappingChange.Created));
+                    } catch (InterruptedException e) {
+                        LOG.warn("Notification publication interrupted!");
+                    }
+                }
             }
         }