BUG-1994: IP ToS bits match field for OF 1.0
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / util / ActionUtilTest.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, Inc. 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 package org.opendaylight.openflowplugin.openflow.md.util;
9
10 import org.junit.Assert;
11 import org.junit.Test;
12 /**
13  * test of {@link ActionUtil}
14  */
15 public class ActionUtilTest {
16
17     /**
18      * Test method for {@link org.opendaylight.openflowplugin.openflow.md.util.ActionUtil#tosToDscp(short)}.
19      */
20     @Test
21     public void testTosToDscp() {
22         Assert.assertEquals(0, ActionUtil.tosToDscp((short) 1).intValue());
23         Assert.assertEquals(1, ActionUtil.tosToDscp((short) 4).intValue());
24         Assert.assertEquals(63, ActionUtil.tosToDscp((short) 252).intValue());
25     }
26
27     /**
28      * Test method for {@link org.opendaylight.openflowplugin.openflow.md.util.ActionUtil#dscpToTos(short)}.
29      */
30     @Test
31     public void testDscpToTos() {
32         Assert.assertEquals(0, ActionUtil.dscpToTos((short) 0).intValue());
33         Assert.assertEquals(4, ActionUtil.dscpToTos((short) 1).intValue());
34         Assert.assertEquals(16, ActionUtil.dscpToTos((short) 4).intValue());
35         Assert.assertEquals(252, ActionUtil.dscpToTos((short) 63).intValue());
36     }
37 }