import org.opendaylight.openflowplugin.impl.services.PacketProcessingServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalEchoServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalExperimenterMessageServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.SalFlatBatchServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalFlowServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.SalFlowsBatchServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalGroupServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.SalGroupsBatchServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalMeterServiceImpl;
+import org.opendaylight.openflowplugin.impl.services.SalMetersBatchServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalPortServiceImpl;
import org.opendaylight.openflowplugin.impl.services.SalTableServiceImpl;
import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightFlowStatisticsServiceImpl;
import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightPortStatisticsServiceImpl;
import org.opendaylight.openflowplugin.impl.statistics.services.OpendaylightQueueStatisticsServiceImpl;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.OpendaylightFlowStatisticsServiceDelegateImpl;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.FlowDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.GroupDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.MeterDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.NodeConnectorDirectStatisticsService;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceImpl;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider;
+import org.opendaylight.openflowplugin.impl.statistics.services.direct.QueueDirectStatisticsService;
+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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.SalFlatBatchService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
/**
* Method registers all OF services for role {@link OfpRole#BECOMEMASTER}
- * @param rpcContext - registration processing is implemented in {@link RpcContext}
+ *
+ * @param rpcContext - registration processing is implemented in {@link RpcContext}
* @param deviceContext - every service needs {@link DeviceContext} as input parameter
- * @param newRole - role validation for {@link OfpRole#BECOMEMASTER}
+ * @param newRole - role validation for {@link OfpRole#BECOMEMASTER}
*/
public static void registerMasterServices(@CheckForNull final RpcContext rpcContext,
- @CheckForNull final DeviceContext deviceContext, @CheckForNull final OfpRole newRole) {
+ @CheckForNull final DeviceContext deviceContext, @CheckForNull final OfpRole newRole) {
Preconditions.checkArgument(rpcContext != null);
Preconditions.checkArgument(deviceContext != null);
Preconditions.checkArgument(newRole != null);
Verify.verify(OfpRole.BECOMEMASTER.equals(newRole), "Service call with bad Role {} we expect role BECOMEMASTER", newRole);
- rpcContext.registerRpcServiceImplementation(SalEchoService.class, new SalEchoServiceImpl(rpcContext, deviceContext));
+ // create service instances
+ final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext);
+ final FlowCapableTransactionServiceImpl flowCapableTransactionService = new FlowCapableTransactionServiceImpl(rpcContext, deviceContext);
+ final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext);
+ final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext);
- rpcContext.registerRpcServiceImplementation(SalFlowService.class, new SalFlowServiceImpl(rpcContext, deviceContext));
+ // register routed service instances
+ rpcContext.registerRpcServiceImplementation(SalEchoService.class, new SalEchoServiceImpl(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(SalFlowService.class, salFlowService);
//TODO: add constructors with rcpContext and deviceContext to meter, group, table constructors
- rpcContext.registerRpcServiceImplementation(FlowCapableTransactionService.class, new FlowCapableTransactionServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(SalMeterService.class, new SalMeterServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(SalGroupService.class, new SalGroupServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(FlowCapableTransactionService.class, flowCapableTransactionService);
+ rpcContext.registerRpcServiceImplementation(SalMeterService.class, salMeterService);
+ rpcContext.registerRpcServiceImplementation(SalGroupService.class, salGroupService);
+ rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, deviceContext.getPrimaryConnectionContext().getNodeId()));
rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext));
rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext));
rpcContext.registerRpcServiceImplementation(NodeConfigService.class, new NodeConfigServiceImpl(rpcContext, deviceContext));
- rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, new OpendaylightFlowStatisticsServiceImpl(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext));
+
+ // Direct statistics gathering
+ final OpendaylightDirectStatisticsServiceProvider statisticsProvider = new OpendaylightDirectStatisticsServiceProvider();
+ statisticsProvider.register(FlowDirectStatisticsService.class, new FlowDirectStatisticsService(rpcContext, deviceContext));
+ statisticsProvider.register(GroupDirectStatisticsService.class, new GroupDirectStatisticsService(rpcContext, deviceContext));
+ statisticsProvider.register(MeterDirectStatisticsService.class, new MeterDirectStatisticsService(rpcContext, deviceContext));
+ statisticsProvider.register(NodeConnectorDirectStatisticsService.class, new NodeConnectorDirectStatisticsService(rpcContext, deviceContext));
+ statisticsProvider.register(QueueDirectStatisticsService.class, new QueueDirectStatisticsService(rpcContext, deviceContext));
+ rpcContext.registerRpcServiceImplementation(OpendaylightDirectStatisticsService.class, new OpendaylightDirectStatisticsServiceImpl(statisticsProvider));
+
+ final SalFlatBatchServiceImpl salFlatBatchService = new SalFlatBatchServiceImpl(
+ new SalFlowsBatchServiceImpl(salFlowService, flowCapableTransactionService),
+ new SalGroupsBatchServiceImpl(salGroupService, flowCapableTransactionService),
+ new SalMetersBatchServiceImpl(salMeterService, flowCapableTransactionService)
+ );
+ rpcContext.registerRpcServiceImplementation(SalFlatBatchService.class, salFlatBatchService);
+
// TODO: experimenter symmetric and multipart message services
rpcContext.registerRpcServiceImplementation(SalExperimenterMessageService.class, new SalExperimenterMessageServiceImpl(rpcContext, deviceContext));
}
* directly before by change role from {@link OfpRole#BECOMEMASTER} to {@link OfpRole#BECOMESLAVE}.
* Method registers {@link SalEchoService} in next step only because we would like to have SalEchoService as local service for all apps
* to be able actively check connection status for slave connection too.
+ *
* @param rpcContext - registration/unregistration processing is implemented in {@link RpcContext}
- * @param newRole - role validation for {@link OfpRole#BECOMESLAVE}
+ * @param newRole - role validation for {@link OfpRole#BECOMESLAVE}
*/
public static void registerSlaveServices(@CheckForNull final RpcContext rpcContext, @CheckForNull final OfpRole newRole) {
Preconditions.checkArgument(rpcContext != null);
/**
* Method unregisters all OF services.
+ *
* @param rpcContext - unregistration processing is implemented in {@link RpcContext}
*/
public static void unregisterServices(@CheckForNull final RpcContext rpcContext) {
rpcContext.unregisterRpcServiceImplementation(PacketProcessingService.class);
rpcContext.unregisterRpcServiceImplementation(NodeConfigService.class);
rpcContext.unregisterRpcServiceImplementation(OpendaylightFlowStatisticsService.class);
+ rpcContext.unregisterRpcServiceImplementation(SalFlatBatchService.class);
// TODO: experimenter symmetric and multipart message services
rpcContext.unregisterRpcServiceImplementation(SalExperimenterMessageService.class);
+ rpcContext.unregisterRpcServiceImplementation(OpendaylightDirectStatisticsService.class);
}
/**