Copyright update
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / PortStatusMessageFactoryTest.java
index 967c9fd5502c7e28ec3e73d69b06fbf3ce5a3f48..9d427381250ec19a6f6095159b619a8e65842abe 100644 (file)
@@ -1,66 +1,73 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\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.PortConfig;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;\r
-\r
-/**\r
- * @author timotej.kubas\r
- * @author michal.polkorab\r
- */\r
-public class PortStatusMessageFactoryTest {\r
-\r
-    /**\r
-     * Testing {@link PortStatusMessageFactory} for correct translation into POJO\r
-     */\r
-    @Test\r
-    public void test(){\r
-        ByteBuf bb = BufferHelper.buildBuffer("01 " + //reason \r
-                                              "00 00 00 00 00 00 00 " + //padding\r
-                                              "00 01 02 03 " + //port no\r
-                                              "00 00 00 00 " + //padding in ofp_port1\r
-                                              "08 00 27 00 B0 EB " + //mac address\r
-                                              "00 00 " + //padding in ofp_port2\r
-                                              "00 00 00 41 " + //port config\r
-                                              "00 00 00 05 " + //port state\r
-                                              "00 00 00 81 " + //current features\r
-                                              "00 00 00 81 " + //advertised features\r
-                                              "00 00 00 81 " + //supported features\r
-                                              "00 00 00 81 " + //peer features\r
-                                              "00 00 00 81 " + //curr speed\r
-                                              "00 00 00 80" //max speed\r
-                                              );\r
-        \r
-        PortStatusMessage builtByFactory = BufferHelper.decodeV13(PortStatusMessageFactory.getInstance(), bb);\r
-        \r
-        BufferHelper.checkHeaderV13(builtByFactory);\r
-        Assert.assertEquals("Wrong reason", 0x01, builtByFactory.getReason().getIntValue());\r
-        Assert.assertEquals("Wrong portNumber", 66051L, builtByFactory.getPortNo().longValue());\r
-        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), builtByFactory.getHwAddr());\r
-        Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true), builtByFactory.getConfig());\r
-        Assert.assertEquals("Wrong portState", new PortState(false, true, true), builtByFactory.getState());\r
-        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,\r
-                                             false, false, false, true, false, false, false, false, \r
-                                             false, false, false, false), builtByFactory.getCurrentFeatures());\r
-        Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(true, false, false, false,\r
-                                             false, false, false, true, false, false, false, false, \r
-                                             false, false, false, false), builtByFactory.getAdvertisedFeatures());\r
-        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, false, false, false,\r
-                                             false, false, false, true, false, false, false, false, \r
-                                             false, false, false, false), builtByFactory.getSupportedFeatures());\r
-        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, false, false, false,\r
-                                             false, false, false, true, false, false, false, false, \r
-                                             false, false, false, false), builtByFactory.getSupportedFeatures());\r
-        Assert.assertEquals("Wrong currSpeed", 129L, builtByFactory.getCurrSpeed().longValue());\r
-        Assert.assertEquals("Wrong maxSpeed", 128L, builtByFactory.getMaxSpeed().longValue());\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.deserialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
+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.PortConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
+
+/**
+ * @author timotej.kubas
+ * @author michal.polkorab
+ */
+public class PortStatusMessageFactoryTest {
+
+    /**
+     * Testing {@link PortStatusMessageFactory} for correct translation into POJO
+     */
+    @Test
+    public void test(){
+        ByteBuf bb = BufferHelper.buildBuffer("01 " + //reason 
+                                              "00 00 00 00 00 00 00 " + //padding
+                                              "00 01 02 03 " + //port no
+                                              "00 00 00 00 " + //padding in ofp_port1
+                                              "08 00 27 00 B0 EB " + //mac address
+                                              "00 00 " + //padding in ofp_port2
+                                              "00 00 00 41 " + //port config
+                                              "00 00 00 05 " + //port state
+                                              "00 00 00 81 " + //current features
+                                              "00 00 00 81 " + //advertised features
+                                              "00 00 00 81 " + //supported features
+                                              "00 00 00 81 " + //peer features
+                                              "00 00 00 81 " + //curr speed
+                                              "00 00 00 80" //max speed
+                                              );
+        
+        PortStatusMessage builtByFactory = BufferHelper.decodeV13(PortStatusMessageFactory.getInstance(), bb);
+        
+        BufferHelper.checkHeaderV13(builtByFactory);
+        Assert.assertEquals("Wrong reason", 0x01, builtByFactory.getReason().getIntValue());
+        Assert.assertEquals("Wrong portNumber", 66051L, builtByFactory.getPortNo().longValue());
+        Assert.assertEquals("Wrong macAddress", new MacAddress("08:00:27:00:B0:EB"), builtByFactory.getHwAddr());
+        Assert.assertEquals("Wrong portConfig", new PortConfig(false, true, false, true), builtByFactory.getConfig());
+        Assert.assertEquals("Wrong portState", new PortState(false, true, true), builtByFactory.getState());
+        Assert.assertEquals("Wrong currentFeatures", new PortFeatures(true, false, false, false,
+                                             false, false, false, true, false, false, false, false, 
+                                             false, false, false, false), builtByFactory.getCurrentFeatures());
+        Assert.assertEquals("Wrong advertisedFeatures", new PortFeatures(true, false, false, false,
+                                             false, false, false, true, false, false, false, false, 
+                                             false, false, false, false), builtByFactory.getAdvertisedFeatures());
+        Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, false, false, false,
+                                             false, false, false, true, false, false, false, false, 
+                                             false, false, false, false), builtByFactory.getSupportedFeatures());
+        Assert.assertEquals("Wrong peerFeatures", new PortFeatures(true, false, false, false,
+                                             false, false, false, true, false, false, false, false, 
+                                             false, false, false, false), builtByFactory.getSupportedFeatures());
+        Assert.assertEquals("Wrong currSpeed", 129L, builtByFactory.getCurrSpeed().longValue());
+        Assert.assertEquals("Wrong maxSpeed", 128L, builtByFactory.getMaxSpeed().longValue());
+    }
+}