use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats in project openflowplugin by opendaylight.
the class FlowRegistryKeyFactoryTest method testEquals.
@Test
public void testEquals() throws Exception {
FlowsStatisticsUpdate flowStats = FLOWS_STATISTICS_UPDATE_BUILDER.build();
HashSet<FlowRegistryKey> flowRegistryKeys = new HashSet<>();
for (FlowAndStatisticsMapList item : flowStats.getFlowAndStatisticsMapList()) {
final FlowRegistryKey key1 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
flowRegistryKeys.add(key1);
flowRegistryKeys.add(key1);
flowRegistryKeys.add(key2);
}
assertEquals(3, flowRegistryKeys.size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method prepareMultipartReplyFlow.
private MultipartReplyBody prepareMultipartReplyFlow() {
MultipartReplyFlowCaseBuilder multipartReplyFlowCaseBuilder = new MultipartReplyFlowCaseBuilder();
MultipartReplyFlowBuilder multipartReplyFlowBuilder = new MultipartReplyFlowBuilder();
multipartReplyFlowBuilder.setFlowStats(Collections.<FlowStats>emptyList());
multipartReplyFlowCaseBuilder.setMultipartReplyFlow(multipartReplyFlowBuilder.build());
return multipartReplyFlowCaseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactory method serializeFlowBody.
private void serializeFlowBody(MultipartReplyBody body, ByteBuf outBuffer, MultipartReplyMessage message) {
MultipartReplyFlowCase flowCase = (MultipartReplyFlowCase) body;
MultipartReplyFlow flow = flowCase.getMultipartReplyFlow();
for (FlowStats flowStats : flow.getFlowStats()) {
ByteBuf flowStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
flowStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
flowStatsBuff.writeByte((byte) flowStats.getTableId().longValue());
flowStatsBuff.writeZero(FLOW_STATS_PADDING_1);
OFSerializer<MatchV10> matchSerializer = registry.getSerializer(new MessageTypeKey<>(message.getVersion(), MatchV10.class));
matchSerializer.serialize(flowStats.getMatchV10(), flowStatsBuff);
flowStatsBuff.writeInt(flowStats.getDurationSec().intValue());
flowStatsBuff.writeInt(flowStats.getDurationNsec().intValue());
flowStatsBuff.writeShort(flowStats.getPriority());
flowStatsBuff.writeShort(flowStats.getIdleTimeout());
flowStatsBuff.writeShort(flowStats.getHardTimeout());
flowStatsBuff.writeZero(FLOW_STATS_PADDING_2);
flowStatsBuff.writeLong(flowStats.getCookie().longValue());
flowStatsBuff.writeLong(flowStats.getPacketCount().longValue());
flowStatsBuff.writeLong(flowStats.getByteCount().longValue());
ListSerializer.serializeList(flowStats.getAction(), ACTION_KEY_MAKER, registry, flowStatsBuff);
flowStatsBuff.setShort(FLOW_STATS_LENGTH_INDEX, flowStatsBuff.readableBytes());
outBuffer.writeBytes(flowStatsBuff);
}
}
Aggregations