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;
13 import org.junit.Assert;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
17 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
18 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
19 import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
20 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;
21 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
22 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
26 * @author michal.polkorab
27 * @author timotej.kubas
29 public class OF10GetConfigReplyMessageFactoryTest {
31 private OFDeserializer<GetConfigOutput> configFactory;
34 * Initializes deserializer registry and lookups correct deserializer
37 public void startUp() {
38 DeserializerRegistry registry = new DeserializerRegistryImpl();
40 configFactory = registry.getDeserializer(
41 new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 8, GetConfigOutput.class));
45 * Testing {@link OF10GetConfigReplyMessageFactory} for correct translation into POJO
49 ByteBuf bb = BufferHelper.buildBuffer("00 01 00 03");
50 GetConfigOutput builtByFactory = BufferHelper.deserialize(configFactory, bb);
52 BufferHelper.checkHeaderV10(builtByFactory);
53 Assert.assertEquals("Wrong switchConfigFlag", 0x01, builtByFactory.getFlags().getIntValue());
54 Assert.assertEquals("Wrong missSendLen", 0x03, builtByFactory.getMissSendLen().intValue());