2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
11 import io.netty.buffer.ByteBuf;
12 import java.util.ArrayList;
13 import java.util.Arrays;
14 import java.util.List;
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
18 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
19 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
20 import org.opendaylight.openflowjava.protocol.impl.util.DefaultDeserializerFactoryTest;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
24 * Test for {@link org.opendaylight.openflowjava.protocol.impl.deserialization.factories.GetConfigReplyMessageFactory}.
25 * @author michal.polkorab
26 * @author timotej.kubas
28 public class GetConfigReplyMessageFactoryTest extends DefaultDeserializerFactoryTest<GetConfigOutput> {
31 * Initializes deserializer registry and lookups OF13 deserializer.
33 public GetConfigReplyMessageFactoryTest() {
34 super(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 8, GetConfigOutput.class));
38 * Testing {@link GetConfigReplyMessageFactory} for correct header version.
41 public void testVersions() {
42 List<Byte> versions = new ArrayList<>(Arrays.asList(
43 EncodeConstants.OF10_VERSION_ID,
44 EncodeConstants.OF13_VERSION_ID,
45 EncodeConstants.OF14_VERSION_ID,
46 EncodeConstants.OF15_VERSION_ID
48 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 03");
49 testHeaderVersions(versions, bb);
53 * Testing {@link GetConfigReplyMessageFactory} for correct translation into POJO.
57 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 03");
58 GetConfigOutput builtByFactory = BufferHelper.deserialize(factory, bb);
59 Assert.assertEquals("Wrong switchConfigFlag", 0x01, builtByFactory.getFlags().getIntValue());
60 Assert.assertEquals("Wrong missSendLen", 0x03, builtByFactory.getMissSendLen().intValue());