Search in sources :

Example 6 with SetFieldMatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder in project openflowplugin by opendaylight.

the class ApplySetfieldTablePropertySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final ApplySetfield property = 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(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) ApplySetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield) ApplySetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) Test(org.junit.Test)

Example 7 with SetFieldMatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder in project openflowplugin by opendaylight.

the class WriteSetfieldTablePropertySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final WriteSetfield property = 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(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) WriteSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder) WriteSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) Test(org.junit.Test)

Example 8 with SetFieldMatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder in project openflowplugin by opendaylight.

the class TableFeaturesResponseConvertor method setSetFieldTableFeatureProperty.

private static List<SetFieldMatch> setSetFieldTableFeatureProperty(final TableFeatureProperties properties, final boolean setHasMask) {
    List<SetFieldMatch> setFieldMatchList = new ArrayList<>();
    SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
    // This handles only OpenflowBasicClass oxm class.
    for (MatchEntry currMatch : properties.getAugmentation(OxmRelatedTableFeatureProperty.class).getMatchEntry()) {
        Class<? extends MatchField> ofMatchField = currMatch.getOxmMatchField();
        if (setHasMask) {
            setFieldMatchBuilder.setHasMask(currMatch.isHasMask());
        }
        setFieldMatchBuilder.setMatchType(OF_TO_SAL_TABLE_FEATURE_PROPERTIES.get(ofMatchField));
        setFieldMatchList.add(setFieldMatchBuilder.build());
    }
    return setFieldMatchList;
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) OxmRelatedTableFeatureProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty) ArrayList(java.util.ArrayList) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)

Example 9 with SetFieldMatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertorTest method setupFieldTableFeatures.

private static void setupFieldTableFeatures() {
    SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
    setFieldMatchBuilder.setHasMask(true);
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
    setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src.class);
    FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder)

Example 10 with SetFieldMatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder in project openflowplugin by opendaylight.

the class TableFeaturesMatchFieldDeserializer method processHeader.

/**
 * Processes match entry header and returns if it have mask, or not.
 *
 * @param in input buffer
 * @return SetFieldMatchBuilder with hasMask properly set
 */
protected static SetFieldMatchBuilder processHeader(ByteBuf in) {
    // skip oxm_class
    in.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    boolean hasMask = (in.readUnsignedByte() & 1) != 0;
    // skip match entry length
    in.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    return new SetFieldMatchBuilder().setHasMask(hasMask);
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder)

Aggregations

SetFieldMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder)16 SetFieldMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)14 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)6 TableFeaturePropertiesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey)6 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder)3 MatchSetfieldBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder)3 ApplySetfieldBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder)2 ApplySetfieldMissBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder)2 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match)2 WildcardsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder)2 WriteSetfieldBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder)2 WriteSetfieldMissBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder)2 WildcardSetfieldBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder)2 AbstractTablePropertySerializerTest (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.AbstractTablePropertySerializerTest)1 OxmRelatedTableFeatureProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty)1 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)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