Switch to MD-SAL APIs
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / device / initialization / OF10DeviceInitializer.java
index 95c78e43a4e02056081387e64a2d0496da6a44a8..1e04acbf235d2236bfff00ff31965577dba77c4b 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.impl.device.initialization;
 
 import com.google.common.base.Function;
@@ -13,11 +12,11 @@ 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 java.util.List;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.concurrent.Future;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
@@ -40,7 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeCon
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
@@ -91,7 +89,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                 LOG.warn("Error occurred in preparation node {} for protocol 1.0", deviceInfo);
                 LOG.trace("Error for node {} : ", deviceInfo, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return Futures.transform(future, new Function<Boolean, Void>() {
             @Nullable
@@ -101,7 +99,7 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                 writePhyPortInformation(deviceContext);
                 return null;
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
@@ -158,29 +156,14 @@ public class OF10DeviceInitializer extends AbstractDeviceInitializer {
                     new SingleLayerMultipartCollectorService(deviceContext, deviceContext);
 
             return Futures.transform(service.handleServiceCall(multipartType),
-                    new Function<RpcResult<List<MultipartReply>>, Boolean>() {
-                        @Nonnull
-                        @Override
-                        public Boolean apply(final RpcResult<List<MultipartReply>> input) {
-                            return input.isSuccessful();
-                        }
-                    });
+                RpcResult::isSuccessful, MoreExecutors.directExecutor());
         }
 
         final MultiLayerMultipartCollectorService service =
                 new MultiLayerMultipartCollectorService(deviceContext, deviceContext);
 
         return Futures.transform(service.handleServiceCall(multipartType),
-                new Function<RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol
-                        .rev130731.MultipartReply>>, Boolean>() {
-                    @Nonnull
-                    @Override
-                    public Boolean apply(final RpcResult<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
-                            .protocol
-                            .rev130731.MultipartReply>> input) {
-                        return input.isSuccessful();
-                    }
-                });
+            RpcResult::isSuccessful, MoreExecutors.directExecutor());
     }
 
 }