Fixed invalid value in TestFromSalConversionsUtils. 43/3343/1
authorMartin Vitez <mvitez@cisco.com>
Mon, 2 Dec 2013 14:52:26 +0000 (15:52 +0100)
committerMartin Vitez <mvitez@cisco.com>
Mon, 2 Dec 2013 14:57:24 +0000 (15:57 +0100)
Casting 0x84 to byte created invalid input (-124) for uint8 field.

Change-Id: Id3594149b26b3a6de76c1209681cac2c0d1e230f
Signed-off-by: Martin Vitez <mvitez@cisco.com>
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ProtocolConstants.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java

index cc86659..ad6009c 100644 (file)
@@ -9,7 +9,6 @@ import java.net.Inet6Address;
 import java.net.InetAddress;
 
 
-import org.opendaylight.controller.sal.compatibility.MDFlowMapping;
 import org.opendaylight.controller.sal.core.NodeConnector;
 
 
@@ -118,7 +117,7 @@ public class FromSalConversionsUtils {
                 return Layer4MatchAsTcp(sourceMatch);
             case UDP:
                 return Layer4MatchAsUdp(sourceMatch);
-            case SCTP:
+            case CRUDP:
                 return Layer4MatchAsSctp(sourceMatch);
             }
         }
index 7392f5c..92a1aa9 100644 (file)
@@ -7,7 +7,7 @@ public class ProtocolConstants {
     // source: http://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
     public static final byte TCP = (byte) 0x06;
     public static final byte UDP = (byte) 0x11;
-    public static final byte SCTP = (byte) 0x84;
+    public static final byte CRUDP = (byte) 0x7F;
 
     private ProtocolConstants() {
 
index 064b920..b5ed3fe 100644 (file)
@@ -93,7 +93,7 @@ import java.util.Collections;
 import java.util.List;
 
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.SCTP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
 import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
@@ -464,7 +464,7 @@ public class ToSalConversionsUtils {
             }
         }
 
-        target.setField(NW_PROTO, SCTP);
+        target.setField(NW_PROTO, CRUDP);
 
     }
 
index 96b8caf..cb70174 100644 (file)
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.SCTP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
 
@@ -134,7 +134,7 @@ public class TestFromSalConversionsUtils {
             break;
         case sctp:
             boolean sctpFound = false;
-            assertEquals("Wrong protocol", SCTP, match.getIpMatch().getIpProtocol().byteValue());
+            assertEquals("Wrong protocol", CRUDP, match.getIpMatch().getIpProtocol().byteValue());
             Layer4Match layer4Match = match.getLayer4Match();
             if (layer4Match instanceof SctpMatch) {
                 assertEquals("Sctp source port is incorrect.", 0xffff, (int) ((SctpMatch) layer4Match)
@@ -325,7 +325,7 @@ public class TestFromSalConversionsUtils {
             salMatch.setField(MatchType.NW_TOS, (byte) 0x3f);
             break;
         case sctp:
-            salMatch.setField(MatchType.NW_PROTO, SCTP);
+            salMatch.setField(MatchType.NW_PROTO, CRUDP);
             salMatch.setField(MatchType.TP_SRC, (short) 0xffff);
             salMatch.setField(MatchType.TP_DST, (short) 0xfffe);
             break;
index 8108074..97e1660 100644 (file)
@@ -60,7 +60,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import com.google.common.net.InetAddresses;
 
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.SCTP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
 import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
 
@@ -142,7 +142,7 @@ public class TestToSalConversionsUtils {
         case sctp:
             assertEquals("TP_SRC isn't equal.", 31, (short) match.getField(MatchType.TP_SRC).getValue());
             assertEquals("TP_DST isn't equal.", 32, (short) match.getField(MatchType.TP_DST).getValue());
-            assertEquals("NW_PROTO isn't equal.", SCTP, (byte) match.getField(MatchType.NW_PROTO).getValue());
+            assertEquals("NW_PROTO isn't equal.", CRUDP, (byte) match.getField(MatchType.NW_PROTO).getValue());
             break;
         case tcp:
             assertEquals("TP_SRC isn't equal.", 21, (short) match.getField(MatchType.TP_SRC).getValue());

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.