Bug 5540 - PortConvertor, MatchConvertor
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / match / MatchV10ResponseConvertorTest.java
@@ -9,14 +9,18 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;\r
 \r
 import java.math.BigInteger;\r
+import java.util.Optional;\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
-import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4Match;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch;\r
@@ -31,7 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
  * @author michal.polkorab\r
  *\r
  */\r
-public class MatchConvertorImplV10Test {\r
+public class MatchV10ResponseConvertorTest {\r
 \r
     /**\r
      * Initializes OpenflowPortsUtil\r
@@ -42,7 +46,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * Test {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}\r
+     * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void test() {\r
@@ -65,7 +69,10 @@ public class MatchConvertorImplV10Test {
         builder.setTpDst(4096);\r
         MatchV10 match = builder.build();\r
 \r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(match, new BigInteger("42"), OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
+\r
+        final Match salMatch = convert(match, datapathIdConvertorData).build();\r
 \r
         Assert.assertEquals("Wrong in port", "openflow:42:6653", salMatch.getInPort().getValue());\r
         Assert.assertEquals("Wrong dl src", new MacAddress("01:01:01:01:01:01"), salMatch.getEthernetMatch()\r
@@ -89,7 +96,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * Test {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}\r
+     * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testWildcardedMatch() {\r
@@ -112,7 +119,10 @@ public class MatchConvertorImplV10Test {
         builder.setTpDst(4096);\r
         MatchV10 match = builder.build();\r
 \r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(match, new BigInteger("42"), OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
+\r
+        final Match salMatch = convert(match, datapathIdConvertorData).build();\r
 \r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl match", null, salMatch.getEthernetMatch());\r
@@ -124,7 +134,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * Test {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}\r
+     * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testWildcardedMatchWithNoValuesSet() {\r
@@ -133,7 +143,10 @@ public class MatchConvertorImplV10Test {
                 true, true, true, true, true, true));\r
         MatchV10 match = builder.build();\r
 \r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(match, new BigInteger("42"), OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
+\r
+        final Match salMatch = convert(match, datapathIdConvertorData).build();\r
 \r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl match", null, salMatch.getEthernetMatch());\r
@@ -145,7 +158,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * Test {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}\r
+     * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testMatchWithValuesUnset() {\r
@@ -157,7 +170,10 @@ public class MatchConvertorImplV10Test {
         builder.setTpDst(4096);\r
         MatchV10 match = builder.build();\r
 \r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(match, new BigInteger("42"), OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
+\r
+        final Match salMatch = convert(match, datapathIdConvertorData).build();\r
 \r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl match", null, salMatch.getEthernetMatch());\r
@@ -170,19 +186,21 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * Test {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}\r
+     * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test(expected=NullPointerException.class)\r
     public void testEmptyMatch() {\r
         MatchV10Builder builder = new MatchV10Builder();\r
         MatchV10 match = builder.build();\r
 \r
-        MatchConvertorImpl.fromOFMatchV10ToSALMatch(match, new BigInteger("42"), OpenflowVersion.OF10);\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
+\r
+        final Match salMatch = convert(match, datapathIdConvertorData).build();\r
     }\r
 \r
     /**\r
-     * ICMPv4 match test for\r
-     * {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}.\r
+     * ICMPv4 match test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testIcmpv4Match() {\r
@@ -196,8 +214,11 @@ public class MatchConvertorImplV10Test {
         MatchV10 match = builder.build();\r
 \r
         BigInteger dpid = BigInteger.valueOf(12345L);\r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(dpid);\r
+\r
+        Match salMatch = convert(match, datapathIdConvertorData).build();\r
+\r
         EthernetMatch etherMatch = salMatch.getEthernetMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl src",\r
@@ -217,8 +238,8 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, true, true);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl src",\r
@@ -237,8 +258,7 @@ public class MatchConvertorImplV10Test {
         // Specify ICMPv4 protocol.\r
         Short ipProto = 1;\r
         match = builder.setNwProto(ipProto).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         IpMatch ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -263,8 +283,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, true, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -288,8 +307,7 @@ public class MatchConvertorImplV10Test {
         // Specify ICMPv4 type.\r
         Short icmpType = 10;\r
         match = builder.setTpSrc(icmpType.intValue()).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         Icmpv4Match icmpv4Match = salMatch.getIcmpv4Match();\r
@@ -317,8 +335,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, false, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         icmpv4Match = salMatch.getIcmpv4Match();\r
@@ -345,8 +362,7 @@ public class MatchConvertorImplV10Test {
         // Specify ICMPv4 code only.\r
         Short icmpCode = 33;\r
         match = builder.setTpSrc(null).setTpDst(icmpCode.intValue()).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         icmpv4Match = salMatch.getIcmpv4Match();\r
@@ -375,8 +391,7 @@ public class MatchConvertorImplV10Test {
         icmpCode = 8;\r
         match = builder.setTpSrc(icmpType.intValue()).\r
             setTpDst(icmpCode.intValue()).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         icmpv4Match = salMatch.getIcmpv4Match();\r
@@ -402,8 +417,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * TCP match test for\r
-     * {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}.\r
+     * TCP match test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testTcpMatch() {\r
@@ -418,8 +432,10 @@ public class MatchConvertorImplV10Test {
         MatchV10 match = builder.build();\r
 \r
         BigInteger dpid = BigInteger.valueOf(12345L);\r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(dpid);\r
+\r
+        Match salMatch = convert(match, datapathIdConvertorData).build();\r
         EthernetMatch etherMatch = salMatch.getEthernetMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl src",\r
@@ -438,8 +454,7 @@ public class MatchConvertorImplV10Test {
         // Specify TCP protocol.\r
         Short ipProto = 6;\r
         match = builder.setNwProto(ipProto).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         IpMatch ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -464,8 +479,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, true, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -489,8 +503,7 @@ public class MatchConvertorImplV10Test {
         // Specify TCP source port.\r
         Integer srcPort = 60000;\r
         match = builder.setTpSrc(srcPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         TcpMatch tcpMatch = (TcpMatch)salMatch.getLayer4Match();\r
@@ -519,8 +532,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, false, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         tcpMatch = (TcpMatch)salMatch.getLayer4Match();\r
@@ -548,8 +560,7 @@ public class MatchConvertorImplV10Test {
         // Specify TCP destination port only.\r
         Integer dstPort = 6653;\r
         match = builder.setTpSrc(null).setTpDst(dstPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         tcpMatch = (TcpMatch)salMatch.getLayer4Match();\r
@@ -578,8 +589,7 @@ public class MatchConvertorImplV10Test {
         srcPort = 32767;\r
         dstPort = 9999;\r
         match = builder.setTpSrc(srcPort).setTpDst(dstPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         tcpMatch = (TcpMatch)salMatch.getLayer4Match();\r
@@ -606,8 +616,7 @@ public class MatchConvertorImplV10Test {
     }\r
 \r
     /**\r
-     * UDP match test for\r
-     * {@link MatchConvertorImpl#fromOFMatchV10ToSALMatch(MatchV10, BigInteger, OpenflowVersion)}.\r
+     * UDP match test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)}\r
      */\r
     @Test\r
     public void testUdpMatch() {\r
@@ -622,8 +631,10 @@ public class MatchConvertorImplV10Test {
         MatchV10 match = builder.build();\r
 \r
         BigInteger dpid = BigInteger.valueOf(12345L);\r
-        Match salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        datapathIdConvertorData.setDatapathId(dpid);\r
+\r
+        Match salMatch = convert(match, datapathIdConvertorData).build();\r
         EthernetMatch etherMatch = salMatch.getEthernetMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
         Assert.assertEquals("Wrong dl src",\r
@@ -642,8 +653,7 @@ public class MatchConvertorImplV10Test {
         // Specify UDP protocol.\r
         Short ipProto = 17;\r
         match = builder.setNwProto(ipProto).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         IpMatch ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -668,8 +678,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, true, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         Assert.assertEquals("Wrong in port", null, salMatch.getInPort());\r
@@ -693,8 +702,7 @@ public class MatchConvertorImplV10Test {
         // Specify UDP source port.\r
         Integer srcPort = 60000;\r
         match = builder.setTpSrc(srcPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         UdpMatch udpMatch = (UdpMatch)salMatch.getLayer4Match();\r
@@ -723,8 +731,7 @@ public class MatchConvertorImplV10Test {
         wc = new FlowWildcardsV10(\r
             true, true, false, true, true, true, false, true, false, false);\r
         match = builder.setWildcards(wc).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         udpMatch = (UdpMatch)salMatch.getLayer4Match();\r
@@ -752,8 +759,7 @@ public class MatchConvertorImplV10Test {
         // Specify UDP destination port only.\r
         Integer dstPort = 6653;\r
         match = builder.setTpSrc(null).setTpDst(dstPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         udpMatch = (UdpMatch)salMatch.getLayer4Match();\r
@@ -782,8 +788,7 @@ public class MatchConvertorImplV10Test {
         srcPort = 32767;\r
         dstPort = 9999;\r
         match = builder.setTpSrc(srcPort).setTpDst(dstPort).build();\r
-        salMatch = MatchConvertorImpl.fromOFMatchV10ToSALMatch(\r
-                match, dpid, OpenflowVersion.OF10).build();\r
+        salMatch = convert(match, datapathIdConvertorData).build();\r
         etherMatch = salMatch.getEthernetMatch();\r
         ipMatch = salMatch.getIpMatch();\r
         udpMatch = (UdpMatch)salMatch.getLayer4Match();\r
@@ -808,4 +813,10 @@ public class MatchConvertorImplV10Test {
         Assert.assertEquals("Wrong ICMPv4 match",\r
                             null, salMatch.getIcmpv4Match());\r
     }\r
+\r
+    private MatchBuilder convert(MatchV10 match, VersionDatapathIdConvertorData data) {\r
+        final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);\r
+\r
+        return salMatchOptional.orElse(new MatchBuilder());\r
+    }\r
 }\r