1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import org.junit.Assert;
\r
7 import org.junit.Test;
\r
8 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
\r
13 * @author michal.polkorab
\r
14 * @author timotej.kubas
\r
16 public class FeaturesReplyMessageFactoryTest {
\r
19 * Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO
\r
22 public void test() {
\r
23 ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 01 00 00 00"
\r
24 + " 00 01 41 00 01 02 03");
\r
25 GetFeaturesOutput builtByFactory = BufferHelper.decodeV13(
\r
26 FeaturesReplyMessageFactory.getInstance(), bb);
\r
28 BufferHelper.checkHeaderV13(builtByFactory);
\r
29 Assert.assertEquals("Wrong datapathId", 0x0001020304050607L, builtByFactory.getDatapathId().longValue());
\r
30 Assert.assertEquals("Wrong buffers", 0x00010203L, builtByFactory.getBuffers().longValue());
\r
31 Assert.assertEquals("Wrong number of tables", 0x01, builtByFactory.getTables().shortValue());
\r
32 Assert.assertEquals("Wrong auxiliaryId", 0x01, builtByFactory.getAuxiliaryId().shortValue());
\r
33 Assert.assertEquals("Wrong capabilities", new Capabilities(true, false, false, true, false, true, false), builtByFactory.getCapabilities());
\r
34 Assert.assertEquals("Wrong reserved", 0x00010203L, builtByFactory.getReserved().longValue());
\r