1 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
\r
3 import io.netty.buffer.ByteBuf;
\r
5 import org.junit.Assert;
\r
6 import org.junit.Test;
\r
7 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
8 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;
\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
\r
12 public class OF10PacketInMessageFactoryTest {
\r
15 * Testing {@link OF10PacketInMessageFactory} for correct translation into POJO
\r
19 ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 01 02 01 02 00 00 01 02 03 04");
\r
20 PacketInMessage builtByFactory = BufferHelper.decodeV10(OF10PacketInMessageFactory.getInstance(), bb);
\r
22 BufferHelper.checkHeaderV10(builtByFactory);
\r
23 Assert.assertEquals("Wrong bufferID", 0x00010203L, builtByFactory.getBufferId().longValue());
\r
24 Assert.assertEquals("Wrong totalLength", 0x0102, builtByFactory.getTotalLen().intValue());
\r
25 Assert.assertEquals("Wrong inPort", 0x0102, builtByFactory.getInPort().intValue());
\r
26 Assert.assertEquals("Wrong reason", PacketInReason.OFPRNOMATCH, builtByFactory.getReason());
\r
27 Assert.assertArrayEquals("Wrong data", ByteBufUtils.hexStringToBytes("01 02 03 04"), builtByFactory.getData());
\r