2 * Copyright (c) 2015 NetIDE Consortium 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
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
10 import io.netty.buffer.ByteBuf;
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
15 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
16 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
17 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
18 import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl;
19 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
27 * @author giuseppex.petralia@intel.com
30 public class OF10PortModInputMessageFactoryTest {
31 private OFDeserializer<PortModInput> factory;
34 public void startUp() {
35 DeserializerRegistry desRegistry = new DeserializerRegistryImpl();
38 .getDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 15, PortModInput.class));
43 ByteBuf bb = BufferHelper
44 .buildBuffer("19 e9 08 00 27 00 b0 eb " + "00 00 00 15 00 00 00 62 00 00 02 8c 00 00 00 00 ");
45 PortModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
46 BufferHelper.checkHeaderV10(deserializedMessage);
47 Assert.assertEquals("Wrong port", new PortNumber(6633L), deserializedMessage.getPortNo());
48 Assert.assertEquals("Wrong hwAddr", new MacAddress("08:00:27:00:B0:EB"), deserializedMessage.getHwAddress());
49 Assert.assertEquals("Wrong config", new PortConfigV10(true, false, false, true, false, false, true),
50 deserializedMessage.getConfigV10());
51 Assert.assertEquals("Wrong mask", new PortConfigV10(false, true, true, false, false, true, false),
52 deserializedMessage.getMaskV10());
53 Assert.assertEquals("Wrong advertise",
54 new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false),
55 deserializedMessage.getAdvertiseV10());