Bump to odlparent 2.0.0
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / util / MdSalRegistrationUtils.java
index aa11506cb3be7c4426183927627a183e8c3f3557..f838d8f1818f0b363197da23e7d350a071098e45 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.util;
 import com.google.common.base.Preconditions;
 import com.google.common.reflect.TypeToken;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
@@ -33,6 +33,7 @@ import org.opendaylight.openflowplugin.impl.services.sal.SalPortServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.SalTableServiceImpl;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory;
+import org.opendaylight.openflowplugin.extension.onf.service.SalBundleServiceImpl;
 import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightFlowStatisticsServiceImpl;
 import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightFlowTableStatisticsServiceImpl;
 import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightGroupStatisticsServiceImpl;
@@ -58,6 +59,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalPortService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
@@ -84,8 +86,8 @@ public class MdSalRegistrationUtils {
      * @param deviceContext - every service needs {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
      * @param convertorExecutor convertor executor
      */
-    public static void registerServices(@CheckForNull final RpcContext rpcContext,
-                                        @CheckForNull final DeviceContext deviceContext,
+    public static void registerServices(@Nonnull final RpcContext rpcContext,
+                                        @Nonnull final DeviceContext deviceContext,
                                         final ExtensionConverterProvider extensionConverterProvider,
                                         final ConvertorExecutor convertorExecutor) {
         Preconditions.checkArgument(rpcContext != null);
@@ -133,6 +135,12 @@ public class MdSalRegistrationUtils {
                 new SalExperimenterMessageServiceImpl(rpcContext, deviceContext, extensionConverterProvider));
         rpcContext.registerRpcServiceImplementation(SalExperimenterMpMessageService.class,
                 new SalExperimenterMpMessageServiceImpl(rpcContext, deviceContext, extensionConverterProvider));
+
+        //register onf extension bundles
+        rpcContext.registerRpcServiceImplementation(SalBundleService.class,
+                new SalBundleServiceImpl(new SalExperimenterMessageServiceImpl(
+                        rpcContext, deviceContext, extensionConverterProvider
+                )));
     }
 
     /**
@@ -151,7 +159,7 @@ public class MdSalRegistrationUtils {
         // pickup low statistics service
         final OpendaylightFlowStatisticsService flowStatisticsService = Preconditions.checkNotNull(
                 rpcContext.lookupRpcService(OpendaylightFlowStatisticsService.class));
-        Preconditions.checkArgument(COMPOSITE_SERVICE_TYPE_TOKEN.isAssignableFrom(flowStatisticsService.getClass()));
+        Preconditions.checkArgument(COMPOSITE_SERVICE_TYPE_TOKEN.isSubtypeOf(flowStatisticsService.getClass()));
         // attach delegate to flow statistics service (to cover all but aggregated stats with match filter input)
         final OpendaylightFlowStatisticsServiceDelegateImpl flowStatisticsDelegate =
                 new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService, new AtomicLong(), convertorExecutor);