Search in sources :

Example 66 with TableId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactoryTest method testFlow.

/**
 * Testing OF10StatsReplyMessageFactory (Flow) for correct deserialization.
 */
@Test
public void testFlow() {
    ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 68 01 00 " + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " + "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 " + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 " + "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");
    MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
    BufferHelper.checkHeaderV10(builtByFactory);
    Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
    Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE().booleanValue());
    MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
    MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
    Assert.assertEquals("Wrong tableId", 1, message.getFlowStats().get(0).getTableId().intValue());
    Assert.assertEquals("Wrong durationSec", 2, message.getFlowStats().get(0).getDurationSec().intValue());
    Assert.assertEquals("Wrong durationNsec", 3, message.getFlowStats().get(0).getDurationNsec().intValue());
    Assert.assertEquals("Wrong priority", 4, message.getFlowStats().get(0).getPriority().intValue());
    Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());
    Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }), message.getFlowStats().get(0).getCookie());
    Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }), message.getFlowStats().get(0).getPacketCount());
    Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20 }), message.getFlowStats().get(0).getByteCount());
    Action action1 = message.getFlowStats().get(0).getAction().get(0);
    Assert.assertTrue("Wrong action type", action1.getActionChoice() instanceof OutputActionCase);
    Assert.assertEquals("Wrong action port", 1, ((OutputActionCase) action1.getActionChoice()).getOutputAction().getPort().getValue().intValue());
    Assert.assertEquals("Wrong action port", 2, ((OutputActionCase) action1.getActionChoice()).getOutputAction().getMaxLength().intValue());
    Action action2 = message.getFlowStats().get(0).getAction().get(1);
    Assert.assertTrue("Wrong action type", action2.getActionChoice() instanceof SetVlanVidCase);
    Assert.assertEquals("Wrong action port", 3, ((SetVlanVidCase) action2.getActionChoice()).getSetVlanVidAction().getVlanVid().intValue());
    Assert.assertTrue("Unread data", bb.readableBytes() == 0);
}
Also used : SetVlanVidCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCase) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) MultipartReplyFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow) BigInteger(java.math.BigInteger) MultipartReplyFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase) ByteBuf(io.netty.buffer.ByteBuf) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase) Test(org.junit.Test)

Example 67 with TableId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project openflowplugin by opendaylight.

the class FlowRemovedMessageFactoryTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setCookie(BigInteger.valueOf(1234L));
    builder.setPriority(1234);
    builder.setReason(FlowRemovedReason.forValue(2));
    builder.setTableId(new TableId(65L));
    builder.setDurationSec(1234L);
    builder.setDurationNsec(1234L);
    builder.setIdleTimeout(1234);
    builder.setHardTimeout(1234);
    builder.setPacketCount(BigInteger.valueOf(1234L));
    builder.setByteCount(BigInteger.valueOf(1234L));
    MatchBuilder matchBuilder = new MatchBuilder();
    matchBuilder.setType(OxmMatchType.class);
    final List<MatchEntry> entries = new ArrayList<>();
    MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(InPhyPort.class);
    entriesBuilder.setHasMask(false);
    InPhyPortCaseBuilder inPhyPortCaseBuilder = new InPhyPortCaseBuilder();
    InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder();
    inPhyPortBuilder.setPortNumber(new PortNumber(42L));
    inPhyPortCaseBuilder.setInPhyPort(inPhyPortBuilder.build());
    entriesBuilder.setMatchEntryValue(inPhyPortCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(IpEcn.class);
    entriesBuilder.setHasMask(false);
    IpEcnCaseBuilder ipEcnCaseBuilder = new IpEcnCaseBuilder();
    IpEcnBuilder ipEcnBuilder = new IpEcnBuilder();
    ipEcnBuilder.setEcn((short) 4);
    ipEcnCaseBuilder.setIpEcn(ipEcnBuilder.build());
    entriesBuilder.setMatchEntryValue(ipEcnCaseBuilder.build());
    entries.add(entriesBuilder.build());
    matchBuilder.setMatchEntry(entries);
    builder.setMatch(matchBuilder.build());
    final FlowRemovedMessage message = builder.build();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    // simulate parent message
    serializedBuffer.writeInt(1);
    serializedBuffer.writeZero(2);
    serializedBuffer.writeShort(3);
    factory.serialize(message, serializedBuffer);
    // read parent message
    serializedBuffer.readInt();
    serializedBuffer.skipBytes(2);
    serializedBuffer.readShort();
    BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 72);
    Assert.assertEquals("Wrong cookie", message.getCookie().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong priority", message.getPriority().intValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong reason", message.getReason().getIntValue(), serializedBuffer.readByte());
    Assert.assertEquals("Wrong Table ID", message.getTableId().getValue().intValue(), serializedBuffer.readUnsignedByte());
    Assert.assertEquals("Wrong duration sec", message.getDurationSec().intValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong duration nsec", message.getDurationNsec().intValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong Idle timeout", message.getIdleTimeout().intValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong Hard timeout", message.getIdleTimeout().intValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong Packet count", message.getPacketCount().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong Byte count", message.getByteCount().longValue(), serializedBuffer.readLong());
    Assert.assertEquals("Wrong match type", 1, serializedBuffer.readUnsignedShort());
    serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
    short fieldAndMask = serializedBuffer.readUnsignedByte();
    Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
    Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);
    serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    Assert.assertEquals("Wrong oxm value", 42, serializedBuffer.readUnsignedInt());
    Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
    fieldAndMask = serializedBuffer.readUnsignedByte();
    Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
    Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);
    serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    Assert.assertEquals("Wrong oxm value", 4, serializedBuffer.readUnsignedByte());
    serializedBuffer.skipBytes(7);
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) IpEcnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.ecn._case.IpEcnBuilder) ArrayList(java.util.ArrayList) ByteBuf(io.netty.buffer.ByteBuf) InPhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.phy.port._case.InPhyPortBuilder) FlowRemovedMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) InPhyPortCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPhyPortCaseBuilder) FlowRemovedMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) IpEcnCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpEcnCaseBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Test(org.junit.Test)

Example 68 with TableId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project openflowplugin by opendaylight.

the class MultipartReplyFlowTest method testMultipartReplyFlowBody.

/**
 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
 */
@Test
public void testMultipartReplyFlowBody() {
    ByteBuf bb = BufferHelper.buildBuffer(// 
    "00 01 00 01 00 00 00 00 " + // first flow stat
    "00 48 08 00 " + // length, tableId, padding
    "00 00 00 09 " + // durationSec
    "00 00 00 07 " + // durationNsec
    "00 0C 00 0E 00 0F 00 1F " + // priority, idleTimeout, hardTimeout, flags
    "00 00 00 00 " + // pad_02
    "FF 01 01 01 01 01 01 01 " + // cookie
    "EF 01 01 01 01 01 01 01 " + // packetCount
    "7F 01 01 01 01 01 01 01 " + // byteCount
    "00 01 00 04 00 00 00 00 " + // empty match
    "00 01 00 08 06 00 00 00 " + // 
    "00 01 00 08 06 00 00 00 " + // second flow stat
    "00 48 08 00 " + // length, tableId, padding
    "00 00 00 09 " + // durationSec
    "00 00 00 07 " + // durationNsec
    "00 0C 00 0E 00 0F 00 00 " + // priority, idleTimeout, hardTimeout, flags
    "00 00 00 00 " + // pad_02
    "FF 01 01 01 01 01 01 01 " + // cookie
    "EF 01 01 01 01 01 01 01 " + // packetCount
    "7F 01 01 01 01 01 01 01 " + // byteCount
    "00 01 00 04 00 00 00 00 " + // empty match
    "00 01 00 08 06 00 00 00 " + // 
    "00 01 00 08 06 00 00 00");
    MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 0x01, builtByFactory.getType().getIntValue());
    Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
    MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
    MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
    Assert.assertEquals("Wrong flow stats size", 2, message.getFlowStats().size());
    FlowStats flowStats1 = message.getFlowStats().get(0);
    Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
    Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
    Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
    Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
    Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
    Assert.assertEquals("Wrong flags", new FlowModFlags(true, true, true, true, true), flowStats1.getFlags());
    Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getCookie());
    Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xEF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getPacketCount());
    Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0x7F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getByteCount());
    Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
    flowStats1 = message.getFlowStats().get(1);
    Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
    Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
    Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
    Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
    Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
    Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
    Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowStats1.getFlags());
    Assert.assertEquals("Wrong cookie", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getCookie());
    Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xEF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getPacketCount());
    Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0x7F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), flowStats1.getByteCount());
    Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
}
Also used : FlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags) MultipartReplyFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow) BigInteger(java.math.BigInteger) MultipartReplyFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 69 with TableId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project openflowplugin by opendaylight.

the class TableModInputMessageFactoryTest method test.

@Test
public void test() {
    ByteBuf bb = BufferHelper.buildBuffer("09 00 00 00 00 00 00 01");
    TableModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV13(deserializedMessage);
    // Test Message
    Assert.assertEquals("Wrong table id ", new TableId(9L), deserializedMessage.getTableId());
    Assert.assertEquals("Wrong config ", new TableConfig(true), deserializedMessage.getConfig());
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) TableModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 70 with TableId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId in project openflowplugin by opendaylight.

the class MultipartReplyTableFeaturesTest method testMultipartReplyTableFeatures2.

/**
 * Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
 */
@Test
public void testMultipartReplyTableFeatures2() {
    ByteBuf bb = BufferHelper.buildBuffer(// 
    "00 0C 00 00 00 00 00 00 " + // length, tableId, padding
    "00 B0 01 00 00 00 00 00 " + // 
    "4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 " + // name
    "00 00 00 00 00 00 00 00 00 00 00 00 00 " + // metadata match
    "00 00 00 00 00 00 00 01 " + // metadata write
    "00 00 00 00 00 00 00 02 " + // config
    "00 00 00 00 " + // max entries
    "00 00 00 2A " + // 
    "00 00 00 04 00 00 00 00 " + // 
    "00 01 00 04 00 00 00 00 " + // 
    "00 02 00 08 01 02 03 04 " + // 
    "00 03 00 07 05 06 07 00 " + // 
    "00 04 00 04 00 00 00 00 " + // 
    "00 05 00 04 00 00 00 00 " + // 
    "00 06 00 04 00 00 00 00 " + // 
    "00 07 00 04 00 00 00 00 " + // 
    "00 08 00 04 00 00 00 00 " + // 
    "00 0A 00 04 00 00 00 00 " + // 
    "00 0C 00 04 00 00 00 00 " + // 
    "00 0D 00 04 00 00 00 00 " + // 
    "00 0E 00 04 00 00 00 00 " + "00 0F 00 04 00 00 00 00");
    MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
    Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
    MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
    MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
    Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());
    TableFeatures feature = message.getTableFeatures().get(0);
    Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
    Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
    Assert.assertArrayEquals("Wrong metadata match", new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, feature.getMetadataMatch());
    Assert.assertArrayEquals("Wrong metadata write", new byte[] { 0, 0, 0, 0, 0, 0, 0, 2 }, feature.getMetadataWrite());
    Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
    Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
    Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS, feature.getTableFeatureProperties().get(0).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS, feature.getTableFeatureProperties().get(1).getType());
    TableFeatureProperties property = feature.getTableFeatureProperties().get(2);
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES, property.getType());
    List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();
    Assert.assertEquals("Wrong next table id size", 4, tableIds.size());
    Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());
    Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());
    Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());
    Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());
    property = feature.getTableFeatureProperties().get(3);
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS, property.getType());
    tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();
    Assert.assertEquals("Wrong next table id size", 3, tableIds.size());
    Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());
    Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());
    Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS, feature.getTableFeatureProperties().get(4).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS, feature.getTableFeatureProperties().get(5).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS, feature.getTableFeatureProperties().get(6).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS, feature.getTableFeatureProperties().get(7).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH, feature.getTableFeatureProperties().get(8).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS, feature.getTableFeatureProperties().get(9).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD, feature.getTableFeatureProperties().get(10).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS, feature.getTableFeatureProperties().get(11).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD, feature.getTableFeatureProperties().get(12).getType());
    Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS, feature.getTableFeatureProperties().get(13).getType());
}
Also used : MultipartReplyTableFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeatures) MultipartReplyTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) NextTableIds(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds) ByteBuf(io.netty.buffer.ByteBuf) NextTableRelatedTableFeatureProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty) MultipartReplyTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures) Test(org.junit.Test)

Aggregations

BigInteger (java.math.BigInteger)38 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)26 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)17 ByteBuf (io.netty.buffer.ByteBuf)16 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)16 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)15 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)15 TableId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId)14 TableId (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId)14 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)13 FlowCookie (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie)12 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)12 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)9 FlowModFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags)7 Optional (com.google.common.base.Optional)6 ExecutionException (java.util.concurrent.ExecutionException)5 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)5 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)5 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)5