Search in sources :

Example 1 with MplsTc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.

the class OfToSalMplsTcCase method process.

@Override
public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    final MatchBuilder matchBuilder = data.getMatchBuilder();
    final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
    MplsTc mplsTc = source.getMplsTc();
    if (mplsTc != null) {
        protocolMatchFieldsBuilder.setMplsTc(mplsTc.getTc());
        matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
    }
    return Optional.of(matchBuilder);
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder) MplsTc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Example 2 with MplsTc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.

the class MplsTcEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final short mplsTc = message.readUnsignedByte();
    if (Objects.isNull(builder.getProtocolMatchFields())) {
        builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsTc(mplsTc).build());
    } else if (Objects.isNull(builder.getProtocolMatchFields().getMplsTc())) {
        builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder(builder.getProtocolMatchFields()).setMplsTc(mplsTc).build());
    } else {
        throwErrorOnMalformed(builder, "protocolMatchFields", "mplsTc");
    }
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder)

Example 3 with MplsTc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.

the class MplsTcEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final short mplsTc = (short) 1;
    final Match mplsTcMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsTc(mplsTc).build()).build();
    assertMatch(mplsTcMatch, false, (out) -> assertEquals(out.readUnsignedByte(), mplsTc));
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 4 with MplsTc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.

the class MplsTcEntryDeserializerTest method deserializeEntry.

@Test
public void deserializeEntry() throws Exception {
    final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
    final short mplsTc = 6;
    writeHeader(in, false);
    in.writeByte(mplsTc);
    ProtocolMatchFields match = deserialize(in).getProtocolMatchFields();
    assertEquals(mplsTc, match.getMplsTc().shortValue());
    assertEquals(0, in.readableBytes());
}
Also used : ProtocolMatchFields(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 5 with MplsTc

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.

the class MatchConvertor method toOfMplsTc.

private static MatchEntry toOfMplsTc(final Short mplsTc) {
    MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
    matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
    matchEntryBuilder.setHasMask(false);
    matchEntryBuilder.setOxmMatchField(MplsTc.class);
    MplsTcCaseBuilder mplsTcCaseBuilder = new MplsTcCaseBuilder();
    MplsTcBuilder mplsTcBuilder = new MplsTcBuilder();
    mplsTcBuilder.setTc(mplsTc);
    mplsTcCaseBuilder.setMplsTc(mplsTcBuilder.build());
    matchEntryBuilder.setMatchEntryValue(mplsTcCaseBuilder.build());
    return matchEntryBuilder.build();
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) MplsTcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTcBuilder) MplsTcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCaseBuilder)

Aggregations

ProtocolMatchFieldsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder)3 Test (org.junit.Test)2 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)1 ProtocolMatchFields (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields)1 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)1 MplsTcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCaseBuilder)1 MplsTc (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc)1 MplsTcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTcBuilder)1