import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
import java.math.BigInteger;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.UnpooledByteBufAllocator;
-
public class TunnelIdEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
@Test
- public void deserializeEntry() throws Exception {
+ public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final BigInteger tunnelId = BigInteger.valueOf(6);
final BigInteger tunnelIdMask = BigInteger.valueOf(5);
Tunnel match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.uint64toBytes(match.getTunnelId()));
assertEquals(0, in.readableBytes());
match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelId(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.uint64toBytes(match.getTunnelId()));
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
- ByteUtil.convertBigIntegerToNBytes(match.getTunnelMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.uint64toBytes(match.getTunnelMask()));
assertEquals(0, in.readableBytes());
}