OPNFLWPLUG-930 Inconsistent flow IDs between flows
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / util / MdSalRegistrationUtils.java
index c3bfc0e38cd76cfc528e164555d1eebfc844456e..c20d978fe5ff244e44407e39ca3533475d59dc17 100644 (file)
@@ -15,12 +15,13 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.compatibility.Delegator;
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
-import org.opendaylight.openflowplugin.extension.onf.service.SalBundleServiceImpl;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory;
 import org.opendaylight.openflowplugin.impl.services.sal.FlowCapableTransactionServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.NodeConfigServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.PacketProcessingServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.sal.SalAsyncConfigServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.sal.SalBundleServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.SalEchoServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.SalExperimenterMessageServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.sal.SalExperimenterMpMessageServiceImpl;
@@ -44,6 +45,7 @@ import org.opendaylight.openflowplugin.impl.statistics.services.direct.Opendayli
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.multilayer.MultiLayerDirectStatisticsProviderInitializer;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.singlelayer.SingleLayerDirectStatisticsProviderInitializer;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SalAsyncConfigService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SalEchoService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SalExperimenterMessageService;
@@ -66,7 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 
-public class MdSalRegistrationUtils {
+public final class MdSalRegistrationUtils {
 
     //TODO: Make one register and one unregister method for all services
     private MdSalRegistrationUtils() {
@@ -74,9 +76,14 @@ public class MdSalRegistrationUtils {
     }
 
     /**
-     * Method registers all OF services for role {@link OfpRole#BECOMEMASTER}
-     *  @param rpcContext    - registration processing is implemented in {@link org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext}
-     * @param deviceContext - every service needs {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
+     * Method registers all OF services for role {@link OfpRole#BECOMEMASTER}.
+     *
+     * @param rpcContext    - registration processing is implemented in
+     *        {@link org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext}
+     *
+     * @param deviceContext - every service needs
+     *        {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
+     *
      * @param convertorExecutor convertor executor
      */
     public static void registerServices(@Nonnull final RpcContext rpcContext,
@@ -89,21 +96,33 @@ public class MdSalRegistrationUtils {
 
         // create service instances
         final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext, convertorExecutor);
-        final FlowCapableTransactionServiceImpl flowCapableTransactionService = new FlowCapableTransactionServiceImpl(rpcContext, deviceContext);
-        final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext, convertorExecutor);
-        final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext, convertorExecutor);
+        final FlowCapableTransactionServiceImpl flowCapableTransactionService =
+                new FlowCapableTransactionServiceImpl(rpcContext, deviceContext);
+        final SalAsyncConfigServiceImpl salAsyncConfigService =
+                new SalAsyncConfigServiceImpl(rpcContext, deviceContext);
+        final SalGroupServiceImpl salGroupService =
+                new SalGroupServiceImpl(rpcContext, deviceContext, convertorExecutor);
+        final SalMeterServiceImpl salMeterService =
+                new SalMeterServiceImpl(rpcContext, deviceContext, convertorExecutor);
 
         // register routed service instances
-        rpcContext.registerRpcServiceImplementation(SalEchoService.class, new SalEchoServiceImpl(rpcContext, deviceContext));
+        rpcContext.registerRpcServiceImplementation(SalEchoService.class,
+                new SalEchoServiceImpl(rpcContext, deviceContext));
         rpcContext.registerRpcServiceImplementation(SalFlowService.class, salFlowService);
         rpcContext.registerRpcServiceImplementation(FlowCapableTransactionService.class, flowCapableTransactionService);
+        rpcContext.registerRpcServiceImplementation(SalAsyncConfigService.class, salAsyncConfigService);
         rpcContext.registerRpcServiceImplementation(SalMeterService.class, salMeterService);
         rpcContext.registerRpcServiceImplementation(SalGroupService.class, salGroupService);
-        rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, convertorExecutor, multipartWriterProvider));
-        rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext, convertorExecutor));
-        rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext, convertorExecutor));
-        rpcContext.registerRpcServiceImplementation(NodeConfigService.class, new NodeConfigServiceImpl(rpcContext, deviceContext));
-        rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext, convertorExecutor));
+        rpcContext.registerRpcServiceImplementation(SalTableService.class,
+                new SalTableServiceImpl(rpcContext, deviceContext, convertorExecutor, multipartWriterProvider));
+        rpcContext.registerRpcServiceImplementation(SalPortService.class,
+                new SalPortServiceImpl(rpcContext, deviceContext, convertorExecutor));
+        rpcContext.registerRpcServiceImplementation(PacketProcessingService.class,
+                new PacketProcessingServiceImpl(rpcContext, deviceContext, convertorExecutor));
+        rpcContext.registerRpcServiceImplementation(NodeConfigService.class,
+                new NodeConfigServiceImpl(rpcContext, deviceContext));
+        rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class,
+                OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext, convertorExecutor));
 
         // register direct statistics gathering services
         rpcContext.registerRpcServiceImplementation(OpendaylightDirectStatisticsService.class,
@@ -129,17 +148,22 @@ public class MdSalRegistrationUtils {
         //register onf extension bundles
         rpcContext.registerRpcServiceImplementation(SalBundleService.class,
                 new SalBundleServiceImpl(new SalExperimenterMessageServiceImpl(
-                        rpcContext, deviceContext, extensionConverterProvider
-                )));
+                        rpcContext, deviceContext, extensionConverterProvider)));
     }
 
     /**
      * Support deprecated statistic related services for backward compatibility. The only exception from deprecation is
      * the aggregated flow statistic with match criteria input.
-     * @param rpcContext
-     * @param deviceContext
-     * @param notificationPublishService
-     * @param convertorExecutor
+     *
+     * @param rpcContext    - registration processing is implemented in
+     *        {@link org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext}
+     *
+     * @param deviceContext - every service needs
+     *        {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
+     *
+     * @param notificationPublishService - notification service
+     *
+     * @param convertorExecutor - convertor executor
      */
     public static void registerStatCompatibilityServices(final RpcContext rpcContext, final DeviceContext deviceContext,
                                                          final NotificationPublishService notificationPublishService,
@@ -152,19 +176,25 @@ public class MdSalRegistrationUtils {
 
         // 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);
+                new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService,
+                        new AtomicLong(), convertorExecutor);
         ((Delegator<OpendaylightFlowStatisticsService>) flowStatisticsService).setDelegate(flowStatisticsDelegate);
 
         // register all statistics (deprecated) services
         rpcContext.registerRpcServiceImplementation(OpendaylightFlowTableStatisticsService.class,
-                new OpendaylightFlowTableStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+                new OpendaylightFlowTableStatisticsServiceImpl(rpcContext, deviceContext,
+                        compatibilityXidSeed, notificationPublishService));
         rpcContext.registerRpcServiceImplementation(OpendaylightGroupStatisticsService.class,
-                new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
+                new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext,
+                        compatibilityXidSeed, notificationPublishService, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(OpendaylightMeterStatisticsService.class,
-                new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
+                new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext,
+                        compatibilityXidSeed, notificationPublishService, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(OpendaylightQueueStatisticsService.class,
-                new OpendaylightQueueStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+                new OpendaylightQueueStatisticsServiceImpl(rpcContext, deviceContext,
+                        compatibilityXidSeed, notificationPublishService));
         rpcContext.registerRpcServiceImplementation(OpendaylightPortStatisticsService.class,
-                new OpendaylightPortStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+                new OpendaylightPortStatisticsServiceImpl(rpcContext, deviceContext,
+                        compatibilityXidSeed, notificationPublishService));
     }
 }