BUG-3157: performance tuning - Skip int->Integer boxing
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / match / MatchConvertorV10Impl.java
index 659bbab6efa1870d7eb72f764c5847b5736b7a7e..0a5a4b7a3fc2f8e5a6b1de523920e208517eceb5 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013-2015 Cisco Systems, Inc. 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,
@@ -20,6 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match;
@@ -45,7 +46,7 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
      * The value 0xffff (OFP_VLAN_NONE) is used to indicate
      * that no VLAN ID is set for OF Flow.
      */
-    private static final int OFP_VLAN_NONE = 0xffff;
+    private static final Integer OFP_VLAN_NONE = 0xffff;
 
     /**
      * Method builds openflow 1.0 specific match (MatchV10) from MD-SAL match.
@@ -122,6 +123,20 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
                     _tPSRC = convertL4UdpSrcMatch(matchBuilder, udpMatch);
                     _tPDST = convertL4UdpDstMatch(matchBuilder, udpMatch);
                 }
+            } else {
+                Icmpv4Match icmpv4Match = match.getIcmpv4Match();
+                if (icmpv4Match != null) {
+                    Short type = icmpv4Match.getIcmpv4Type();
+                    if (type != null) {
+                        matchBuilder.setTpSrc(type.intValue());
+                        _tPSRC = false;
+                    }
+                    Short code = icmpv4Match.getIcmpv4Code();
+                    if (code != null) {
+                        matchBuilder.setTpDst(code.intValue());
+                        _tPDST = false;
+                    }
+                }
             }
         }