-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-import junit.framework.Assert;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10PortModInputMessageFactoryTest {\r
-\r
- /**\r
- * Testing of {@link OF10PortModInputMessageFactory} for correct translation from POJO\r
- * @throws Exception \r
- */\r
- @Test\r
- public void testPortModInput() throws Exception {\r
- PortModInputBuilder builder = new PortModInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setPortNo(new PortNumber(6633L));\r
- builder.setHwAddress(new MacAddress("08:00:27:00:B0:EB"));\r
- builder.setConfigV10(new PortConfigV10(true, false, false, true, false, false, true));\r
- builder.setMaskV10(new PortConfigV10(false, true, true, false, false, true, false));\r
- builder.setAdvertiseV10(new PortFeaturesV10(true, true, false, false, false, false,\r
- false, true, true, false, false, false));\r
- PortModInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- OF10PortModInputMessageFactory factory = OF10PortModInputMessageFactory.getInstance();\r
- factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, message);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 15, 32);\r
- Assert.assertEquals("Wrong PortNo", message.getPortNo().getValue().longValue(), out.readUnsignedShort());\r
- byte[] address = new byte[6];\r
- out.readBytes(address);\r
- Assert.assertEquals("Wrong MacAddress", message.getHwAddress(),\r
- new MacAddress(ByteBufUtils.macAddressToString(address)));\r
- Assert.assertEquals("Wrong config", 21, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong mask", 98, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong advertise", 652, out.readUnsignedInt());\r
- out.skipBytes(4);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF10PortModInputMessageFactoryTest {
+
+ /**
+ * Testing of {@link OF10PortModInputMessageFactory} for correct translation from POJO
+ * @throws Exception
+ */
+ @Test
+ public void testPortModInput() throws Exception {
+ PortModInputBuilder builder = new PortModInputBuilder();
+ BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
+ builder.setPortNo(new PortNumber(6633L));
+ builder.setHwAddress(new MacAddress("08:00:27:00:B0:EB"));
+ builder.setConfigV10(new PortConfigV10(true, false, false, true, false, false, true));
+ builder.setMaskV10(new PortConfigV10(false, true, true, false, false, true, false));
+ builder.setAdvertiseV10(new PortFeaturesV10(true, true, false, false, false, false,
+ false, true, true, false, false, false));
+ PortModInput message = builder.build();
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ OF10PortModInputMessageFactory factory = OF10PortModInputMessageFactory.getInstance();
+ factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, message);
+
+ BufferHelper.checkHeaderV10(out, (byte) 15, 32);
+ Assert.assertEquals("Wrong PortNo", message.getPortNo().getValue().longValue(), out.readUnsignedShort());
+ byte[] address = new byte[6];
+ out.readBytes(address);
+ Assert.assertEquals("Wrong MacAddress", message.getHwAddress(),
+ new MacAddress(ByteBufUtils.macAddressToString(address)));
+ Assert.assertEquals("Wrong config", 21, out.readUnsignedInt());
+ Assert.assertEquals("Wrong mask", 98, out.readUnsignedInt());
+ Assert.assertEquals("Wrong advertise", 652, out.readUnsignedInt());
+ out.skipBytes(4);
+ }
+
+}