MRI version bumpup for Aluminium
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / listeners / ElanInstanceEntityOwnershipListener.java
index b71598bf1b0e685c492becfeafca90950a5764f3..e53d8f34443ebfc9caf6063af88385ea64684aa5 100644 (file)
@@ -7,20 +7,19 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.listeners;
 
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
+import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.OPERATIONAL;
 import static org.opendaylight.netvirt.elan.utils.ElanConstants.ELAN_EOS_DELAY;
 
-import com.google.common.base.Optional;
-
-import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
+import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipChange;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
@@ -30,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.Elan
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -88,13 +88,14 @@ public class ElanInstanceEntityOwnershipListener implements EntityOwnershipListe
                                 elanDpnInterfacesInstanceIdentifier);
                         if (optional.isPresent() && optional.get().getElanDpnInterfacesList() != null) {
                             LOG.debug("Found elan dpn interfaces list");
-                            optional.get().getElanDpnInterfacesList().forEach(elanDpnInterfacesList -> {
-                                List<DpnInterfaces> dpnInterfaces = elanDpnInterfacesList.getDpnInterfaces();
+                            optional.get().getElanDpnInterfacesList().values().forEach(elanDpnInterfacesList -> {
+                                Map<DpnInterfacesKey, DpnInterfaces> dpnInterfaces
+                                        = elanDpnInterfacesList.getDpnInterfaces();
                                 InstanceIdentifier<ElanDpnInterfacesList> parentIid = InstanceIdentifier
                                         .builder(ElanDpnInterfaces.class).child(ElanDpnInterfacesList.class,
                                                 new ElanDpnInterfacesListKey(elanDpnInterfacesList
                                                         .getElanInstanceName())).build();
-                                for (DpnInterfaces dpnInterface : dpnInterfaces) {
+                                for (DpnInterfaces dpnInterface : dpnInterfaces.values()) {
                                     LOG.debug("Found elan dpn interfaces");
                                     elanDpnInterfaceClusteredListener.add(parentIid
                                                     .child(DpnInterfaces.class, dpnInterface.key()),
@@ -106,7 +107,7 @@ public class ElanInstanceEntityOwnershipListener implements EntityOwnershipListe
                         LOG.info("Not the owner for Elan entity {}", ownershipChange);
                     }
                     ft = null;
-                } catch (Exception e) {
+                } catch (ExecutionException | InterruptedException e) {
                     LOG.error("Failed to read mdsal ", e);
                 }
             }, ELAN_EOS_DELAY, TimeUnit.MINUTES);