+/*\r
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\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.PortStateV10;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OpenflowUtilsTest {\r
+\r
+ /**\r
+ * Tests {@link OpenflowUtils#createPortState(long)}\r
+ */\r
+ @Test\r
+ public void testPortState() {\r
+ PortStateV10 state = OpenflowUtils.createPortState(512L);\r
+ Assert.assertEquals("Wrong port state",\r
+ new PortStateV10(false, false, false, false, true, false, true, false), state);\r
+\r
+ state = OpenflowUtils.createPortState(1793L);\r
+ Assert.assertEquals("Wrong port state",\r
+ new PortStateV10(false, true, false, true, true, true, false, true), state);\r
+\r
+ state = OpenflowUtils.createPortState(1L);\r
+ Assert.assertEquals("Wrong port state",\r
+ new PortStateV10(false, true, false, false, false, false, true, false), state);\r
+ }\r
+\r
+ /**\r
+ * Tests {@link OpenflowUtils#createPortConfig(long)}\r
+ */\r
+ @Test\r
+ public void testPortConfig() {\r
+ PortConfigV10 config = OpenflowUtils.createPortConfig(127L);\r
+ Assert.assertEquals("Wrong port config",\r
+ new PortConfigV10(true, true, true, true, true, true, true), config);\r
+\r
+ config = OpenflowUtils.createPortConfig(0L);\r
+ Assert.assertEquals("Wrong port config",\r
+ new PortConfigV10(false, false, false, false, false, false, false), config);\r
+ }\r
+\r
+ /**\r
+ * Tests {@link OpenflowUtils#createPortFeatures(long)}\r
+ */\r
+ @Test\r
+ public void testPortFeatures() {\r
+ PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);\r
+ Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,\r
+ true, true, true, true, true), features);\r
+\r
+ features = OpenflowUtils.createPortFeatures(0L);\r
+ Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,\r
+ false, false, false, false, false, false), features);\r
+ }\r
+}
\ No newline at end of file