Creating Empty Tables in datastore only when statistics polling is
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / device / initialization / OF10DeviceInitializer.java
index b6a0cc639370e0e3aa024f465752c21ece508a15..69b88f24a9bbcd55ffa40618f9e7032f4085a261 100644 (file)
@@ -7,13 +7,12 @@
  */
 package org.opendaylight.openflowplugin.impl.device.initialization;
 
-import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -53,7 +52,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
     private static final Logger LOG = LoggerFactory.getLogger(OF10DeviceInitializer.class);
 
     @Override
-    protected Future<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext,
+    protected ListenableFuture<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext,
                                                      final boolean switchFeaturesMandatory,
                                                      final boolean skipTableFeatures,
                                                      @Nullable final MultipartWriterProvider multipartWriterProvider,
@@ -80,7 +79,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                     DeviceInitializationUtil.makeEmptyTables(
                         deviceContext,
                         deviceInfo,
-                        deviceContext.getPrimaryConnectionContext().getFeatures().getTables());
+                        deviceContext.getPrimaryConnectionContext().getFeatures().getTables().toJava());
                 }
             }
 
@@ -91,13 +90,10 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
             }
         }, MoreExecutors.directExecutor());
 
-        return Futures.transform(future, new Function<Boolean, Void>() {
-            @Override
-            public Void apply(final Boolean input) {
-                LOG.debug("Writing physical port information for {}", deviceInfo);
-                writePhyPortInformation(deviceContext);
-                return null;
-            }
+        return Futures.transform(future, input -> {
+            LOG.debug("Writing physical port information for {}", deviceInfo);
+            writePhyPortInformation(deviceContext);
+            return null;
         }, MoreExecutors.directExecutor());
     }
 
@@ -136,6 +132,8 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
+            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static void makeEmptyFlowCapableNode(final TxFacade txFacade, final DeviceInfo deviceInfo) {
         try {
             txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL,