Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / OpenflowUtilsTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowjava.protocol.impl.util;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
16
17 /**
18  * @author michal.polkorab
19  *
20  */
21 public class OpenflowUtilsTest {
22
23     /**
24      * Tests {@link OpenflowUtils#createPortState(long)}
25      */
26     @Test
27     public void testPortState() {
28         PortStateV10 state = OpenflowUtils.createPortState(512L);
29         Assert.assertEquals("Wrong port state",
30                 new PortStateV10(false, false, false, false, true, false, true, false), state);
31
32         state = OpenflowUtils.createPortState(1793L);
33         Assert.assertEquals("Wrong port state",
34                 new PortStateV10(false, true, false, true, true, true, false, true), state);
35
36         state = OpenflowUtils.createPortState(1L);
37         Assert.assertEquals("Wrong port state",
38                 new PortStateV10(false, true, false, false, false, false, true, false), state);
39     }
40
41     /**
42      * Tests {@link OpenflowUtils#createPortConfig(long)}
43      */
44     @Test
45     public void testPortConfig() {
46         PortConfigV10 config = OpenflowUtils.createPortConfig(127L);
47         Assert.assertEquals("Wrong port config",
48                 new PortConfigV10(true, true, true, true, true, true, true), config);
49
50         config = OpenflowUtils.createPortConfig(0L);
51         Assert.assertEquals("Wrong port config",
52                 new PortConfigV10(false, false, false, false, false, false, false), config);
53     }
54
55     /**
56      * Tests {@link OpenflowUtils#createPortFeatures(long)}
57      */
58     @Test
59     public void testPortFeatures() {
60         PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
61         Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true,
62                 true, true, true, true, true), features);
63
64         features = OpenflowUtils.createPortFeatures(0L);
65         Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false,
66                 false, false, false, false, false, false), features);
67     }
68 }