List of usage examples for io.netty.buffer ByteBuf readUnsignedByte
public abstract short readUnsignedByte();
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte()); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); if (hasMask) { assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte()); } else {/* w w w. j a va 2 s .c om*/ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte()); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); if (hasMask) { assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte()); } else {/*from www. j a v a 2 s . c om*/ assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte()); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); if (hasMask) { assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte()); } else {/* w w w .j ava 2 s .co m*/ assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte()); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_SLL, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte()); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_ND_TLL, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); assertEquals("Wrong length", EncodeConstants.MAC_ADDRESS_LENGTH, buffer.readUnsignedByte()); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_SRC, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); if (hasMask) { assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES, buffer.readUnsignedByte()); } else {/*w w w . ja v a 2 s. com*/ assertEquals("Wrong length", EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES, buffer.readUnsignedByte()); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); if (hasMask) { assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte()); } else {/* w w w . ja v a 2s . c om*/ assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte()); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializerTest.java
License:Open Source License
/** * Test correct serialization/*from w ww .j ava2 s .c o m*/ */ @Test public void testSerialize() { MatchEntryBuilder builder = prepareMplsBosMatchEntry(true); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); assertEquals("Wrong value", 1, buffer.readUnsignedByte()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializerTest.java
License:Open Source License
private static void checkHeader(ByteBuf buffer, boolean hasMask) { assertEquals("Wrong oxm-class", OxmMatchConstants.OPENFLOW_BASIC_CLASS, buffer.readUnsignedShort()); short fieldAndMask = buffer.readUnsignedByte(); assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1); assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0); assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte()); }