use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate in project openflowplugin by opendaylight.
the class FlowTableStatNotificationSupplierImplTest method testCreate.
@Test
public void testCreate() {
final FlowTableStatisticsUpdate notification = notifSupplierImpl.createNotification(createTestFlowTableStat(), createTestFlowTableStatPath());
assertNotNull(notification);
assertEquals(FLOW_NODE_ID, notification.getId().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate in project openflowplugin by opendaylight.
the class OpendaylightFlowTableStatisticsServiceImpl method transformToNotification.
@Override
public FlowTableStatisticsUpdate transformToNotification(List<MultipartReply> mpReplyList, TransactionId emulatedTxId) {
FlowTableStatisticsUpdateBuilder notification = new FlowTableStatisticsUpdateBuilder();
notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
final List<FlowTableAndStatisticsMap> salFlowStats = new ArrayList<>();
notification.setFlowTableAndStatisticsMap(salFlowStats);
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyTableCase caseBody = (MultipartReplyTableCase) mpReply.getMultipartReplyBody();
MultipartReplyTable replyBody = caseBody.getMultipartReplyTable();
List<TableStats> swTablesStats = replyBody.getTableStats();
// TODO: Duplicate code: look at MultiReplyTranslatorUtil method translateTable
for (TableStats swTableStats : swTablesStats) {
FlowTableAndStatisticsMapBuilder statisticsBuilder = new FlowTableAndStatisticsMapBuilder();
statisticsBuilder.setActiveFlows(new Counter32(swTableStats.getActiveCount()));
statisticsBuilder.setPacketsLookedUp(new Counter64(swTableStats.getLookupCount()));
statisticsBuilder.setPacketsMatched(new Counter64(swTableStats.getMatchedCount()));
statisticsBuilder.setTableId(new TableId(swTableStats.getTableId()));
salFlowStats.add(statisticsBuilder.build());
}
}
return notification.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate in project openflowplugin by opendaylight.
the class FlowTableStatNotificationSupplierImpl method createNotification.
@Override
public FlowTableStatisticsUpdate createNotification(final FlowTableStatistics flowTableStatistics, final InstanceIdentifier<FlowTableStatistics> path) {
Preconditions.checkArgument(flowTableStatistics != null);
Preconditions.checkArgument(path != null);
final FlowTableAndStatisticsMapBuilder ftsmBuilder = new FlowTableAndStatisticsMapBuilder(flowTableStatistics);
ftsmBuilder.setKey(new FlowTableAndStatisticsMapKey(new TableId(path.firstKeyOf(Table.class, TableKey.class).getId())));
final FlowTableStatisticsUpdateBuilder builder = new FlowTableStatisticsUpdateBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
builder.setNodeConnector(Collections.<NodeConnector>emptyList());
builder.setFlowTableAndStatisticsMap(Collections.singletonList(ftsmBuilder.build()));
return builder.build();
}
Aggregations