use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.
the class OF13MatchSerializerTest method buildIpv6FLabelMatch.
private static Match buildIpv6FLabelMatch(long labelValue, boolean hasMask, byte[] mask) {
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(Ipv6Flabel.class);
entriesBuilder.setHasMask(hasMask);
Ipv6FlabelCaseBuilder ipv6FlabelCaseBuilder = new Ipv6FlabelCaseBuilder();
Ipv6FlabelBuilder ipv6FlabelBuilder = new Ipv6FlabelBuilder();
ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(labelValue));
ipv6FlabelBuilder.setMask(mask);
ipv6FlabelCaseBuilder.setIpv6Flabel(ipv6FlabelBuilder.build());
entriesBuilder.setMatchEntryValue(ipv6FlabelCaseBuilder.build());
entries.add(entriesBuilder.build());
builder.setMatchEntry(entries);
Match match = builder.build();
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.
the class OxmUdpSrcSerializerTest method testSerializeHeader.
/**
* Test correct header serialization.
*/
@Test
public void testSerializeHeader() {
MatchEntryBuilder builder = prepareHeader(false);
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serializeHeader(builder.build(), buffer);
checkHeader(buffer, false);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.
the class OxmUdpSrcSerializerTest method testSerialize.
/**
* Test correct serialization.
*/
@Test
public void testSerialize() {
MatchEntryBuilder builder = prepareMatchEntry(1024);
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, false);
assertEquals("Wrong value", 1024, buffer.readUnsignedShort());
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.
the class OxmUdpSrcSerializerTest method prepareMatchEntry.
private static MatchEntryBuilder prepareMatchEntry(int value) {
MatchEntryBuilder builder = prepareHeader(false);
UdpSrcCaseBuilder casebuilder = new UdpSrcCaseBuilder();
UdpSrcBuilder valueBuilder = new UdpSrcBuilder();
valueBuilder.setPort(new PortNumber(value));
casebuilder.setUdpSrc(valueBuilder.build());
builder.setMatchEntryValue(casebuilder.build());
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.
the class OxmVlanVidSerializerTest method testSerializeWithoutCfiBitSet.
/**
* Test correct serialization.
*/
@Test
public void testSerializeWithoutCfiBitSet() {
MatchEntryBuilder builder = prepareVlanVidMatchEntry(true, false);
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
checkHeader(buffer, true);
assertEquals("Wrong value", 500, buffer.readUnsignedShort());
byte[] tmp = new byte[2];
buffer.readBytes(tmp);
Assert.assertArrayEquals("Wrong mask", new byte[] { 15, 15 }, tmp);
assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
Aggregations