use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId in project openflowplugin by opendaylight.
the class MultipartReplyFlowTableStatsDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyFlowTableStatsBuilder builder = new MultipartReplyFlowTableStatsBuilder();
final List<FlowTableAndStatisticsMap> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final FlowTableAndStatisticsMapBuilder itemBuilder = new FlowTableAndStatisticsMapBuilder().setTableId(new TableId(message.readUnsignedByte()));
message.skipBytes(PADDING_IN_TABLE_HEADER);
itemBuilder.setKey(new FlowTableAndStatisticsMapKey(itemBuilder.getTableId())).setActiveFlows(new Counter32(message.readUnsignedInt()));
final byte[] packetsLooked = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(packetsLooked);
final byte[] packetsMatched = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(packetsMatched);
items.add(itemBuilder.setPacketsLookedUp(new Counter64(new BigInteger(1, packetsLooked))).setPacketsMatched(new Counter64(new BigInteger(1, packetsMatched))).build());
}
return builder.setFlowTableAndStatisticsMap(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId in project openflowplugin by opendaylight.
the class PacketInMessageDeserializer method deserialize.
@Override
public PacketInMessage deserialize(final ByteBuf message) {
final PacketInMessageBuilder packetInMessageBuilder = new PacketInMessageBuilder().setVersion((short) EncodeConstants.OF13_VERSION_ID).setXid(message.readUnsignedInt());
// We are ignoring buffer id and total len as it is not specified in OpenFlowPlugin models
message.readUnsignedInt();
message.readUnsignedShort();
packetInMessageBuilder.setPacketInReason(PacketInUtil.getMdSalPacketInReason(PacketInReason.forValue(message.readUnsignedByte()))).setTableId(new TableId(message.readUnsignedByte()));
final byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(cookie);
packetInMessageBuilder.setFlowCookie(new FlowCookie(new BigInteger(1, cookie)));
final OFDeserializer<Match> matchDeserializer = Preconditions.checkNotNull(registry).getDeserializer(MATCH_KEY);
packetInMessageBuilder.setMatch(MatchUtil.transformMatch(matchDeserializer.deserialize(message), org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.in.message.Match.class));
message.skipBytes(PADDING_IN_PACKET_IN_HEADER);
final byte[] data = new byte[message.readableBytes()];
message.readBytes(data);
return packetInMessageBuilder.setPayload(data).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId in project openflowplugin by opendaylight.
the class OpendaylightFlowStatisticsServiceImpl1Test method testGetAggregateFlowStatisticsFromFlowTableForAllFlows.
@Test(expected = IllegalAccessError.class)
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder().setNode(createNodeRef("unitProt:123")).setTableId(new TableId((short) 1));
flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId in project openflowplugin by opendaylight.
the class OpendaylightFlowStatisticsServiceImpl1Test method testGetAllFlowStatisticsFromFlowTable.
@Test(expected = IllegalAccessError.class)
public void testGetAllFlowStatisticsFromFlowTable() throws Exception {
GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder().setNode(createNodeRef("unitProt:123")).setTableId(new TableId((short) 1));
flowStatisticsService.getAllFlowStatisticsFromFlowTable(input.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId in project openflowplugin by opendaylight.
the class OpendaylightFlowStatisticsServiceImpl3Test method testGetAggregateFlowStatisticsFromFlowTableForAllFlows.
@Test
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder().setNode(createNodeRef("unitProt:123")).setTableId(new TableId((short) 1)).build();
flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
Mockito.verify(flowStatisticsDelegate).getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
}
Aggregations