Search in sources :

Example 1 with MatchSetfieldBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createMatchFieldTblFeatureProp.

private TableFeaturePropertiesBuilder createMatchFieldTblFeatureProp() {
    // t10
    List<SetFieldMatch> setFieldMatch = new ArrayList<>();
    SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder();
    setFieldMatchBld.setHasMask(false);
    setFieldMatchBld.setMatchType(MplsLabel.class);
    setFieldMatch.add(setFieldMatchBld.build());
    MatchBuilder matchBld = new MatchBuilder();
    MatchSetfieldBuilder matchSetfieldBld = new MatchSetfieldBuilder();
    matchSetfieldBld.setSetFieldMatch(setFieldMatch);
    matchBld.setMatchSetfield(matchSetfieldBld.build());
    TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
    tableFeatureProperty.setTableFeaturePropType(matchBld.build());
    TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
    tableFeatureProperty.setKey(keyValue);
    tableFeatureProperty.setOrder(1);
    return tableFeatureProperty;
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) MatchSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder) SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder)

Example 2 with MatchSetfieldBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder in project openflowplugin by opendaylight.

the class MultipartReplyTableFeaturesDeserializer method readTableProperties.

private TableProperties readTableProperties(ByteBuf message, int length) {
    final List<TableFeatureProperties> items = new ArrayList<>();
    int tableFeaturesLength = length;
    int order = 0;
    while (tableFeaturesLength > 0) {
        final int propStartIndex = message.readerIndex();
        final TableFeaturesPropType propType = TableFeaturesPropType.forValue(message.readUnsignedShort());
        int propertyLength = message.readUnsignedShort();
        final int paddingRemainder = propertyLength % EncodeConstants.PADDING;
        tableFeaturesLength -= propertyLength;
        final int commonPropertyLength = propertyLength - COMMON_PROPERTY_LENGTH;
        final TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder().setOrder(order).setKey(new TableFeaturePropertiesKey(order));
        switch(propType) {
            case OFPTFPTINSTRUCTIONS:
                propBuilder.setTableFeaturePropType(new InstructionsBuilder().setInstructions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTINSTRUCTIONSMISS:
                propBuilder.setTableFeaturePropType(new InstructionsMissBuilder().setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTNEXTTABLES:
                propBuilder.setTableFeaturePropType(new NextTableBuilder().setTables(new TablesBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTNEXTTABLESMISS:
                propBuilder.setTableFeaturePropType(new NextTableMissBuilder().setTablesMiss(new TablesMissBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITEACTIONS:
                propBuilder.setTableFeaturePropType(new WriteActionsBuilder().setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITEACTIONSMISS:
                propBuilder.setTableFeaturePropType(new WriteActionsMissBuilder().setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYACTIONS:
                propBuilder.setTableFeaturePropType(new ApplyActionsBuilder().setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYACTIONSMISS:
                propBuilder.setTableFeaturePropType(new ApplyActionsMissBuilder().setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTMATCH:
                propBuilder.setTableFeaturePropType(new MatchBuilder().setMatchSetfield(new MatchSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWILDCARDS:
                propBuilder.setTableFeaturePropType(new WildcardsBuilder().setWildcardSetfield(new WildcardSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITESETFIELD:
                propBuilder.setTableFeaturePropType(new WriteSetfieldBuilder().setWriteSetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITESETFIELDMISS:
                propBuilder.setTableFeaturePropType(new WriteSetfieldMissBuilder().setWriteSetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYSETFIELD:
                propBuilder.setTableFeaturePropType(new ApplySetfieldBuilder().setApplySetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYSETFIELDMISS:
                propBuilder.setTableFeaturePropType(new ApplySetfieldMissBuilder().setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTEXPERIMENTER:
            case OFPTFPTEXPERIMENTERMISS:
                final long expId = message.readUnsignedInt();
                message.readerIndex(propStartIndex);
                final OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
                // TODO: Finish experimenter table features (currently using OFJava deserialization only to skip
                // bytes)
                propDeserializer.deserialize(message);
                LOG.debug("Table feature property type {} is not handled yet.", propType);
                break;
            default:
        }
        if (paddingRemainder != 0) {
            message.skipBytes(EncodeConstants.PADDING - paddingRemainder);
            tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder;
        }
        items.add(propBuilder.build());
        order++;
    }
    return new TablePropertiesBuilder().setTableFeatureProperties(items).build();
}
Also used : ApplyActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder) ApplySetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder) MatchSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder) WildcardsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder) ApplyActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder) WriteActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder) ApplySetfieldMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder) TablesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder) WriteSetfieldMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder) NextTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder) TableFeaturesPropType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType) TablesMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMissBuilder) WildcardSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder) InstructionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder) NextTableMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder) WriteActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder) WriteSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder) TablePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder)

Example 3 with MatchSetfieldBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder in project openflowplugin by opendaylight.

the class MatchFieldSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final Match property = new MatchBuilder().setMatchSetfield(new MatchSetfieldBuilder().setSetFieldMatch(ImmutableList.<SetFieldMatch>builder().add(new SetFieldMatchBuilder().setMatchType(ArpOp.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(ArpSha.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(ArpSpa.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(ArpTha.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(ArpTpa.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(EthDst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(EthSrc.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(EthType.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Icmpv4Code.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Icmpv4Type.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Icmpv6Code.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Icmpv6Type.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(InPhyPort.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(InPort.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(IpDscp.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(IpEcn.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(IpProto.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv4Dst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv4Src.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6Dst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6Exthdr.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6Flabel.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6NdSll.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6NdTarget.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6NdTll.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Ipv6Src.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(Metadata.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(MplsBos.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(MplsLabel.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(MplsTc.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(PbbIsid.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(SctpDst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(SctpSrc.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(TcpDst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(TcpFlags.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(TcpSrc.class).setHasMask(true).build()).add(new SetFieldMatchBuilder().setMatchType(TunnelId.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(UdpDst.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(UdpSrc.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(VlanPcp.class).setHasMask(false).build()).add(new SetFieldMatchBuilder().setMatchType(VlanVid.class).setHasMask(false).build()).build()).build()).build();
    assertProperty(property, out -> {
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_SHA << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_SPA << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_THA << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_TPA << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_SRC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_TYPE << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV4_CODE << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV4_TYPE << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV6_CODE << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV6_TYPE << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IN_PHY_PORT << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IN_PORT << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_DSCP << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_ECN << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_SRC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_EXTHDR << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_FLABEL << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_SLL << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_TARGET << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_TLL << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_SRC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.METADATA << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_BOS << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_LABEL << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_TC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.PBB_ISID << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.SCTP_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.SCTP_SRC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.TCP_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.EXPERIMENTER_CLASS);
        assertEquals(out.readUnsignedByte(), EncodeConstants.ONFOXM_ET_TCP_FLAGS << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte() >>> 1, OxmMatchConstants.TCP_SRC);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.TUNNEL_ID << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_DST << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_SRC << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_PCP << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1);
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    });
}
Also used : Ipv6Src(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src) ArpSha(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha) Icmpv6Type(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type) ArpTha(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match) MatchSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder) SctpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst) Icmpv4Type(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type) MplsBos(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos) MplsTc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc) EthDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst) Ipv4Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst) TcpSrc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc) SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) Ipv6Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst) Ipv6NdTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget) InPort(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort) UdpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) IpEcn(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn) EthType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType) VlanPcp(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp) Ipv6Flabel(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel) TcpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder) SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) AbstractTablePropertySerializerTest(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.AbstractTablePropertySerializerTest) Test(org.junit.Test)

Example 4 with MatchSetfieldBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder in project openflowplugin by opendaylight.

the class MatchTablePropertySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final Match property = new MatchBuilder().setMatchSetfield(new MatchSetfieldBuilder().setSetFieldMatch(ImmutableList.<SetFieldMatch>builder().add(new SetFieldMatchBuilder().setMatchType(ArpOp.class).setHasMask(false).build()).build()).build()).build();
    assertProperty(property, out -> {
        assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
        assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
        // Skip match entry length
        out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    });
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) MatchSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder) SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match) Test(org.junit.Test)

Aggregations

MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder)4 MatchSetfieldBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder)4 SetFieldMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)3 SetFieldMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match)2 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)2 TableFeaturePropertiesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey)2 AbstractTablePropertySerializerTest (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.AbstractTablePropertySerializerTest)1 TableFeaturesPropType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType)1 ArpSha (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha)1 ArpTha (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha)1 EthDst (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst)1 EthType (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType)1 Icmpv4Type (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type)1 Icmpv6Type (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type)1 InPort (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort)1 IpEcn (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn)1 Ipv4Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst)1