use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.peers.peer.Stats in project openflowplugin by opendaylight.
the class AggregateFlowsInTableService method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) throws ServiceException {
// Create multipart request body for fetch all the group stats
final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
final MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
mprAggregateRequestBuilder.setTableId(input.getTableId().getValue());
mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
final short version = getVersion();
FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
// Set request body to main multipart request
multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPAGGREGATE, xid.getValue(), version);
mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
return mprInput.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.peers.peer.Stats in project openflowplugin by opendaylight.
the class MdSalRegistrationUtils method registerStatCompatibilityServices.
/**
* Support deprecated statistic related services for backward compatibility. The only exception from deprecation is
* the aggregated flow statistic with match criteria input.
*
* @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, final ConvertorExecutor convertorExecutor) {
AtomicLong compatibilityXidSeed = new AtomicLong();
// pickup low statistics service
final OpendaylightFlowStatisticsService flowStatisticsService = Preconditions.checkNotNull(rpcContext.lookupRpcService(OpendaylightFlowStatisticsService.class));
// 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);
((Delegator<OpendaylightFlowStatisticsService>) flowStatisticsService).setDelegate(flowStatisticsDelegate);
// register all statistics (deprecated) services
rpcContext.registerRpcServiceImplementation(OpendaylightFlowTableStatisticsService.class, new OpendaylightFlowTableStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
rpcContext.registerRpcServiceImplementation(OpendaylightGroupStatisticsService.class, new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
rpcContext.registerRpcServiceImplementation(OpendaylightMeterStatisticsService.class, new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
rpcContext.registerRpcServiceImplementation(OpendaylightQueueStatisticsService.class, new OpendaylightQueueStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
rpcContext.registerRpcServiceImplementation(OpendaylightPortStatisticsService.class, new OpendaylightPortStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.peers.peer.Stats in project openflowplugin by opendaylight.
the class FlowStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform to notification.
*
* @param mpResult raw multipart response from device
* @param deviceInfo device state
* @param ofVersion device version
* @param emulatedTxId emulated transaction Id
* @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static FlowsStatisticsUpdate transformToNotification(final List<MultipartReply> mpResult, final DeviceInfo deviceInfo, final OpenflowVersion ofVersion, final TransactionId emulatedTxId, final ConvertorExecutor convertorExecutor) {
final FlowStatsResponseConvertorData data = new FlowStatsResponseConvertorData(ofVersion.getVersion());
data.setDatapathId(deviceInfo.getDatapathId());
data.setMatchPath(MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
final FlowsStatisticsUpdateBuilder notification = new FlowsStatisticsUpdateBuilder();
final List<FlowAndStatisticsMapList> statsList = new ArrayList<>();
notification.setId(deviceInfo.getNodeId());
notification.setFlowAndStatisticsMapList(statsList);
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
for (MultipartReply mpRawReply : mpResult) {
Preconditions.checkArgument(MultipartType.OFPMPFLOW.equals(mpRawReply.getType()));
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpRawReply.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
final Optional<List<FlowAndStatisticsMapList>> outStatsItem = convertorExecutor.convert(replyBody.getFlowStats(), data);
outStatsItem.ifPresent(statsList::addAll);
}
return notification.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.peers.peer.Stats in project openflowplugin by opendaylight.
the class OpendaylightFlowTableStatisticsServiceImpl method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final GetFlowTablesStatisticsInput input) throws ServiceException {
// Create multipart request body for fetch all the group stats
final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
multipartRequestTableBuilder.setEmpty(true);
multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
// Set request body to main multipart request
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPTABLE, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
return mprInput.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.peers.peer.Stats in project openflowplugin by opendaylight.
the class TestFlowHelper method createFlowAndStatisticsMapListBuilder.
/**
* Creates flow and statistics builder.
* @param index data seed
* @return flow stats builder with dummy content
*/
protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int index) {
FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
flowAndStatisticsMapListBuilder.setPriority(index);
flowAndStatisticsMapListBuilder.setTableId((short) index);
flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + index);
ethernetSourceBuilder.setAddress(macAddress);
ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + index + ":00:00"));
ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
MatchBuilder matchBuilder = new MatchBuilder();
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
return flowAndStatisticsMapListBuilder;
}
Aggregations