MatchInfo redesign 18/50518/4
authorStephen Kitt <skitt@redhat.com>
Thu, 5 Jan 2017 10:54:41 +0000 (11:54 +0100)
committerSam Hague <shague@redhat.com>
Wed, 25 Jan 2017 23:25:08 +0000 (23:25 +0000)
This uses the new MatchInfo subclasses and drops all references to
MatchFieldType.

Change-Id: I4e17f86b20d2b3f605f728c36871341b177b244b
Signed-off-by: Stephen Kitt <skitt@redhat.com>
38 files changed:
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractIngressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatefulEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatefulIngressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatelessEgressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/StatelessIngressAclServiceImpl.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/listeners/AclNodeListener.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclServiceOFFlowBuilder.java
vpnservice/aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/utils/AclServiceUtils.java
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/LearnEgressAclServiceImplTest.java
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/StatelessEgressAclServiceImplTest.java
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/StatelessIngressAclServiceImplTest.java
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/tests/FlowEntryObjectsBase.xtend
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/tests/FlowEntryObjectsStateful.xtend
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/tests/FlowEntryObjectsStateless.xtend
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/utils/AclServiceOFFlowBuilderTest.java
vpnservice/aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/utils/AclServiceTestUtils.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/listeners/VpnToElanFallbackNodeListener.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/utils/ElanServiceChainUtils.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/utils/VpnServiceChainUtils.java
vpnservice/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/netvirt/dhcpservice/DhcpServiceUtils.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInterfaceManager.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanUtils.java
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibRpcServiceImpl.java
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/VrfEntryListener.java
vpnservice/ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/utils/Ipv6ServiceUtils.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalNetworkListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/FloatingIPListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptSwitchHA.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/SNATDefaultRouteProgrammer.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VpnFloatingIpHandler.java
vpnservice/natservice/natservice-impl/src/test/java/org/opendaylight/netvirt/natservice/internal/test/ExternalNetworksChangeListenerTest.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnNodeListener.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnUtil.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/arp/responder/ArpResponderUtil.java
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/intervpnlink/InterVpnLinkUtil.java

index 59a4f5bfe9cc007af6e2e0dd6fedc74e5163a12e..8248fb8ad7799408d2696990076817d9ace0858a 100644 (file)
@@ -17,12 +17,13 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionDrop;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchArpSha;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
@@ -35,6 +36,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.cont
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.AceType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
@@ -317,15 +319,15 @@ public abstract class AbstractEgressAclServiceImpl extends AbstractAclServiceImp
     protected void programArpRule(BigInteger dpId, List<AllowedAddressPairs> allowedAddresses, int lportTag,
             int addOrRemove) {
         for (AllowedAddressPairs allowedAddress : allowedAddresses) {
-            String attachMac = allowedAddress.getMacAddress().getValue();
+            MacAddress attachMac = allowedAddress.getMacAddress();
             List<MatchInfo> matches = new ArrayList<>();
-            matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_ARP}));
-            matches.add(new MatchInfo(MatchFieldType.arp_sha, new String[] {attachMac}));
+            matches.add(MatchEthernetType.ARP);
+            matches.add(new MatchArpSha(attachMac));
             matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
 
             List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>());
 
-            String flowName = "Egress_ARP_" + dpId + "_" + attachMac;
+            String flowName = "Egress_ARP_" + dpId + "_" + attachMac.getValue();
             syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName,
                     AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0, 0,
                     AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
index 8fc10a6175ccb46a109413b09f4cda9b1f5df731..4eb2c13855acdb4b0a4c6f9b8d62ffd3f485e184 100644 (file)
@@ -17,11 +17,11 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
@@ -283,7 +283,7 @@ public abstract class AbstractIngressAclServiceImpl extends AbstractAclServiceIm
      */
     protected void programArpRule(BigInteger dpId, int lportTag, int addOrRemove) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_ARP}));
+        matches.add(MatchEthernetType.ARP);
         matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
 
         List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(new ArrayList<>());
index 8bd3e39c5f1b5e4a6ae2882ab4a0c04a53a03cb5..39da8849cf56df2f28da770f1090a1389b595480 100644 (file)
@@ -15,8 +15,6 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
@@ -24,12 +22,14 @@ import org.opendaylight.genius.mdsalutil.NxMatchInfo;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.MatchCriteria;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
 import org.slf4j.Logger;
@@ -103,10 +103,10 @@ public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
             Integer priority, String flowId, String portId, int addOrRemove) {
         for (AllowedAddressPairs allowedAddress : allowedAddresses) {
             IpPrefixOrAddress attachIp = allowedAddress.getIpAddress();
-            String attachMac = allowedAddress.getMacAddress().getValue();
+            MacAddress attachMac = allowedAddress.getMacAddress();
 
             List<MatchInfoBase> matches = new ArrayList<>();
-            matches.add(new MatchInfo(MatchFieldType.eth_src, new String[] {attachMac}));
+            matches.add(new MatchEthernetSource(attachMac));
             matches.addAll(AclServiceUtils.buildIpMatches(attachIp, MatchCriteria.MATCH_SOURCE));
 
             Long elanTag = AclServiceUtils.getElanIdFromInterface(portId, dataBroker);
@@ -115,7 +115,7 @@ public class StatefulEgressAclServiceImpl extends AbstractEgressAclServiceImpl {
             actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag.intValue(), NwConstants.INGRESS_ACL_FILTER_TABLE));
             instructions.add(new InstructionApplyActions(actionsInfos));
 
-            String flowName = "Egress_Fixed_Conntrk_" + dpId + "_" + attachMac + "_"
+            String flowName = "Egress_Fixed_Conntrk_" + dpId + "_" + attachMac.getValue() + "_"
                     + String.valueOf(attachIp.getValue()) + "_" + flowId;
             syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                     AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
index 2a957cb6293937564edd28f5703194d302675394..79bc64344fdbf6f5bdbbe20138f8b08d5621ea0d 100644 (file)
@@ -15,8 +15,6 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
@@ -24,12 +22,15 @@ import org.opendaylight.genius.mdsalutil.NxMatchInfo;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.MatchCriteria;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
 import org.slf4j.Logger;
@@ -115,11 +116,11 @@ public class StatefulIngressAclServiceImpl extends AbstractIngressAclServiceImpl
             Integer priority, String flowId, String portId, int addOrRemove) {
         for (AllowedAddressPairs allowedAddress : allowedAddresses) {
             IpPrefixOrAddress attachIp = allowedAddress.getIpAddress();
-            String attachMac = allowedAddress.getMacAddress().getValue();
+            MacAddress attachMac = allowedAddress.getMacAddress();
 
             List<MatchInfoBase> matches = new ArrayList<>();
-            matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_IPV4 }));
-            matches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { attachMac }));
+            matches.add(MatchEthernetType.IPV4);
+            matches.add(new MatchEthernetDestination(attachMac));
             matches.addAll(AclServiceUtils.buildIpMatches(attachIp, MatchCriteria.MATCH_DESTINATION));
 
             List<InstructionInfo> instructions = new ArrayList<>();
@@ -128,7 +129,7 @@ public class StatefulIngressAclServiceImpl extends AbstractIngressAclServiceImpl
             Long elanTag = AclServiceUtils.getElanIdFromInterface(portId, dataBroker);
             actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag.intValue(), NwConstants.EGRESS_ACL_FILTER_TABLE));
             instructions.add(new InstructionApplyActions(actionsInfos));
-            String flowName = "Ingress_Fixed_Conntrk_" + dpId + "_" + attachMac + "_"
+            String flowName = "Ingress_Fixed_Conntrk_" + dpId + "_" + attachMac.getValue() + "_"
                     + String.valueOf(attachIp.getValue()) + "_" + flowId;
             syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
                     AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
index 26d26aec90aa6d8b782050692869a533080ac925..db7dc3eacd6dd9d4f866beb2ad0ffaf65d072bcd 100644 (file)
@@ -15,12 +15,11 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
@@ -104,7 +103,7 @@ public class StatelessEgressAclServiceImpl extends AbstractEgressAclServiceImpl
         List<MatchInfoBase> flowMatches = new ArrayList<>();
         flowMatches.addAll(origFlowMatches);
         if (new Short((short) NwConstants.IP_PROT_TCP).equals(protocol)) {
-            flowMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN }));
+            flowMatches.add(MatchTcpFlags.SYN);
         }
 
         List<ActionInfo> actionsInfos = new ArrayList<>();
index 84384d7410f73885a36b5c9281aa1f2a79a6d3cd..1390fd7a5d6eff5f70cb0526552bd04a77c774f6 100644 (file)
@@ -15,12 +15,11 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
@@ -102,7 +101,7 @@ public class StatelessIngressAclServiceImpl extends AbstractIngressAclServiceImp
         List<MatchInfoBase> flowMatches = new ArrayList<>();
         flowMatches.addAll(origFlowMatches);
         if (new Short((short) NwConstants.IP_PROT_TCP).equals(protocol)) {
-            flowMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN }));
+            flowMatches.add(MatchTcpFlags.SYN);
         }
         List<ActionInfo> actionsInfos = new ArrayList<>();
         List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(actionsInfos);
index 190bb79fee463f93ab837dbb92cbd560377b10e1..48e0b53a23432b055c123e0ac7e32e1c36835060 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -32,7 +31,9 @@ import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -310,12 +311,10 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
      */
     private void addStatelessIngressAclTableMissFlow(BigInteger dpId) {
         List<MatchInfo> synMatches = new ArrayList<>();
-        synMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        synMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.TCP.intValue() }));
+        synMatches.add(MatchEthernetType.IPV4);
+        synMatches.add(MatchIpProtocol.TCP);
 
-        synMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN }));
+        synMatches.add(MatchTcpFlags.SYN);
 
         List<ActionInfo> dropActionsInfos = new ArrayList<>();
         dropActionsInfos.add(new ActionDrop());
@@ -329,11 +328,9 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
         mdsalManager.installFlow(synFlowEntity);
 
         synMatches = new ArrayList<>();
-        synMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        synMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.TCP.intValue() }));
-        synMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN_ACK }));
+        synMatches.add(MatchEthernetType.IPV4);
+        synMatches.add(MatchIpProtocol.TCP);
+        synMatches.add(MatchTcpFlags.SYN_ACK);
 
         List<InstructionInfo> allowAllInstructions = new ArrayList<>();
         allowAllInstructions.add(new InstructionGotoTable(NwConstants.EGRESS_ACL_FILTER_TABLE));
@@ -377,11 +374,9 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
         allowAllInstructions.add(new InstructionGotoTable(NwConstants.INGRESS_ACL_FILTER_TABLE));
 
         List<MatchInfo> synMatches = new ArrayList<>();
-        synMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        synMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.TCP.intValue() }));
-        synMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN }));
+        synMatches.add(MatchEthernetType.IPV4);
+        synMatches.add(MatchIpProtocol.TCP);
+        synMatches.add(MatchTcpFlags.SYN);
 
         List<ActionInfo> synActionsInfos = new ArrayList<>();
         synActionsInfos.add(new ActionDrop());
@@ -395,11 +390,9 @@ public class AclNodeListener extends AsyncDataTreeChangeListenerBase<FlowCapable
         mdsalManager.installFlow(synFlowEntity);
 
         synMatches = new ArrayList<>();
-        synMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        synMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.TCP.intValue() }));
-        synMatches.add(new MatchInfo(MatchFieldType.tcp_flags, new long[] { AclConstants.TCP_FLAG_SYN_ACK }));
+        synMatches.add(MatchEthernetType.IPV4);
+        synMatches.add(MatchIpProtocol.TCP);
+        synMatches.add(MatchTcpFlags.SYN_ACK);
 
         FlowEntity synAckFlowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.INGRESS_ACL_TABLE,
                 "SYN-ACK-ALLOW-" + getTableMissFlowId(NwConstants.INGRESS_ACL_TABLE),
index aab3a19251801c93698de30c3945352d2a920ef2..5be831a559eb86ae152ccf37b68d13c97537bf91 100644 (file)
@@ -13,12 +13,18 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.NxMatchInfo;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv4;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6Source;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4;
@@ -84,14 +90,11 @@ public class AclServiceOFFlowBuilder {
         flowMatches.addAll(addSrcIpMatches(acl));
         flowMatches.addAll(addDstIpMatches(acl));
         if (acl.getAceIpVersion() instanceof AceIpv4 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
+            flowMatches.add(MatchEthernetType.IPV4);
         } else if (acl.getAceIpVersion() instanceof AceIpv6 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
+            flowMatches.add(MatchEthernetType.IPV6);
         }
-        flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-            new long[] { acl.getProtocol() }));
+        flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
         String flowId = "OTHER_PROTO" + acl.getProtocol();
         Map<String,List<MatchInfoBase>> flowMatchesMap = new HashMap<>();
         flowMatchesMap.put(flowId,flowMatches);
@@ -111,15 +114,13 @@ public class AclServiceOFFlowBuilder {
         String flowId = "ICMP_";
         if (sourcePortRange != null) {
             if (acl.getAceIpVersion() instanceof AceIpv4 ) {
-                flowMatches.add(new MatchInfo(MatchFieldType.icmp_v4,
-                    new long[] { sourcePortRange.getLowerPort().getValue(),
-                                 sourcePortRange.getUpperPort().getValue() }));
+                flowMatches.add(new MatchIcmpv4(sourcePortRange.getLowerPort().getValue().shortValue(),
+                                 sourcePortRange.getUpperPort().getValue().shortValue()));
                 flowId = flowId + "V4_SOURCE_" + sourcePortRange.getLowerPort().getValue()
                         + sourcePortRange.getUpperPort().getValue();
             } else if (acl.getAceIpVersion() instanceof AceIpv6 ) {
-                flowMatches.add(new MatchInfo(MatchFieldType.icmp_v6,
-                    new long[] { sourcePortRange.getLowerPort().getValue(),
-                                 sourcePortRange.getUpperPort().getValue() }));
+                flowMatches.add(new MatchIcmpv6(sourcePortRange.getLowerPort().getValue().shortValue(),
+                                 sourcePortRange.getUpperPort().getValue().shortValue()));
                 flowId = flowId + "V6_SOURCE_" + sourcePortRange.getLowerPort().getValue() + "_"
                         + sourcePortRange.getUpperPort().getValue() + "_";
             }
@@ -127,21 +128,18 @@ public class AclServiceOFFlowBuilder {
         DestinationPortRange destinationPortRange = acl.getDestinationPortRange();
         if (destinationPortRange != null) {
             if (acl.getAceIpVersion() instanceof AceIpv4 ) {
-                flowMatches.add(new MatchInfo(MatchFieldType.icmp_v4,
-                    new long[] { destinationPortRange.getLowerPort().getValue(),
-                                 destinationPortRange.getUpperPort().getValue() }));
+                flowMatches.add(new MatchIcmpv4(destinationPortRange.getLowerPort().getValue().shortValue(),
+                                 destinationPortRange.getUpperPort().getValue().shortValue()));
                 flowId = flowId + "V4_DESTINATION_" + destinationPortRange.getLowerPort().getValue()
                         + destinationPortRange.getUpperPort().getValue() + "_";
             } else if (acl.getAceIpVersion() instanceof AceIpv6 ) {
-                flowMatches.add(new MatchInfo(MatchFieldType.icmp_v6,
-                    new long[] { destinationPortRange.getLowerPort().getValue(),
-                                 destinationPortRange.getUpperPort().getValue() }));
+                flowMatches.add(new MatchIcmpv6(destinationPortRange.getLowerPort().getValue().shortValue(),
+                                 destinationPortRange.getUpperPort().getValue().shortValue()));
                 flowId = flowId + "V6_DESTINATION_" + destinationPortRange.getLowerPort().getValue()
                         + destinationPortRange.getUpperPort().getValue() + "_";
             }
         }
-        flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-            new long[] { acl.getProtocol() }));
+        flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
         Map<String,List<MatchInfoBase>> flowMatchesMap = new HashMap<>();
         flowMatchesMap.put(flowId,flowMatches);
         return flowMatchesMap;
@@ -159,8 +157,7 @@ public class AclServiceOFFlowBuilder {
             List<MatchInfoBase> flowMatches = new ArrayList<>();
             flowMatches.addAll(addSrcIpMatches(acl));
             flowMatches.addAll(addDstIpMatches(acl));
-            flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { acl.getProtocol() }));
+            flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
             String flowId = "TCP_SOURCE_ALL_";
             flowMatchesMap.put(flowId,flowMatches);
             return flowMatchesMap;
@@ -176,8 +173,7 @@ public class AclServiceOFFlowBuilder {
                     flowMatches.add(new NxMatchInfo(NxMatchFieldType.nx_tcp_src_with_mask,
                         new long[] {  port, portMaskMap.get(port) }));
                 }
-                flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                    new long[] { acl.getProtocol() }));
+                flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
                 String flowId = "TCP_SOURCE_" + port + "_" + portMaskMap.get(port);
                 flowMatchesMap.put(flowId,flowMatches);
             }
@@ -193,8 +189,7 @@ public class AclServiceOFFlowBuilder {
                     flowMatches.add(new NxMatchInfo(NxMatchFieldType.nx_tcp_dst_with_mask,
                         new long[] {  port, portMaskMap.get(port) }));
                 }
-                flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                    new long[] { acl.getProtocol() }));
+                flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
                 String flowId = "TCP_DESTINATION_" + port + "_" + portMaskMap.get(port);
                 flowMatchesMap.put(flowId,flowMatches);
             }
@@ -214,8 +209,7 @@ public class AclServiceOFFlowBuilder {
             List<MatchInfoBase> flowMatches = new ArrayList<>();
             flowMatches.addAll(addSrcIpMatches(acl));
             flowMatches.addAll(addDstIpMatches(acl));
-            flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { acl.getProtocol() }));
+            flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
             String flowId = "UDP_SOURCE_ALL_";
             flowMatchesMap.put(flowId,flowMatches);
             return flowMatchesMap;
@@ -231,8 +225,7 @@ public class AclServiceOFFlowBuilder {
                     flowMatches.add(new NxMatchInfo(NxMatchFieldType.nx_udp_src_with_mask,
                         new long[] {  port, portMaskMap.get(port) }));
                 }
-                flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                    new long[] { acl.getProtocol() }));
+                flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
                 String flowId = "UDP_SOURCE_" + port + "_" + portMaskMap.get(port);
                 flowMatchesMap.put(flowId ,flowMatches);
             }
@@ -248,8 +241,7 @@ public class AclServiceOFFlowBuilder {
                     flowMatches.add(new NxMatchInfo(NxMatchFieldType.nx_udp_dst_with_mask,
                         new long[] {  port, portMaskMap.get(port) }));
                 }
-                flowMatches.add(new MatchInfo(MatchFieldType.ip_proto,
-                    new long[] { acl.getProtocol() }));
+                flowMatches.add(new MatchIpProtocol(acl.getProtocol()));
                 String flowId = "UDP_DESTINATION_" + port + "_" + portMaskMap.get(port);
                 flowMatchesMap.put(flowId, flowMatches);
             }
@@ -265,21 +257,16 @@ public class AclServiceOFFlowBuilder {
     public static List<MatchInfoBase> addSrcIpMatches(AceIp acl) {
         List<MatchInfoBase> flowMatches = new ArrayList<>();
         if (acl.getAceIpVersion() instanceof AceIpv4 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
+            flowMatches.add(MatchEthernetType.IPV4);
             Ipv4Prefix srcNetwork = ((AceIpv4)acl.getAceIpVersion()).getSourceIpv4Network();
             if (null != srcNetwork && !srcNetwork.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
-                String[] ipaddressValues = srcNetwork.getValue().split("/");
-                flowMatches.add(new MatchInfo(MatchFieldType.ipv4_source,
-                    new String[] {ipaddressValues[0], ipaddressValues[1]}));
+                flowMatches.add(new MatchIpv4Source(srcNetwork));
             }
         } else if (acl.getAceIpVersion() instanceof AceIpv6 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
+            flowMatches.add(MatchEthernetType.IPV6);
             Ipv6Prefix srcNetwork = ((AceIpv6)acl.getAceIpVersion()).getSourceIpv6Network();
             if (null != srcNetwork) {
-                flowMatches.add(new MatchInfo(MatchFieldType.ipv6_source,
-                    new String[] {srcNetwork.getValue()}));
+                flowMatches.add(new MatchIpv6Source(srcNetwork));
             }
         }
         return flowMatches;
@@ -292,21 +279,16 @@ public class AclServiceOFFlowBuilder {
     public static List<MatchInfoBase> addDstIpMatches(AceIp acl) {
         List<MatchInfoBase> flowMatches = new ArrayList<>();
         if (acl.getAceIpVersion() instanceof AceIpv4 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
+            flowMatches.add(MatchEthernetType.IPV4);
             Ipv4Prefix dstNetwork = ((AceIpv4)acl.getAceIpVersion()).getDestinationIpv4Network();
             if (null != dstNetwork && !dstNetwork.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
-                String[] ipaddressValues = dstNetwork.getValue().split("/");
-                flowMatches.add(new MatchInfo(MatchFieldType.ipv4_destination,
-                    new String[] {ipaddressValues[0], ipaddressValues[1]}));
+                flowMatches.add(new MatchIpv4Destination(dstNetwork));
             }
         } else if (acl.getAceIpVersion() instanceof AceIpv6 ) {
-            flowMatches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
+            flowMatches.add(MatchEthernetType.IPV6);
             Ipv6Prefix dstNetwork = ((AceIpv6)acl.getAceIpVersion()).getDestinationIpv6Network();
             if (null != dstNetwork) {
-                flowMatches.add(new MatchInfo(MatchFieldType.ipv6_destination,
-                    new String[] {dstNetwork.getValue()}));
+                flowMatches.add(new MatchIpv6Destination(dstNetwork));
             }
         }
         return flowMatches;
index 658b8daa3fb3e11330e8a47be491fc2fadac49df..0a5854d744c638af5db563bb01b845602931e368 100644 (file)
@@ -9,12 +9,9 @@
 package org.opendaylight.netvirt.aclservice.utils;
 
 import com.google.common.base.Optional;
-import com.googlecode.ipv6.IPv6Address;
-import com.googlecode.ipv6.IPv6NetworkMask;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -30,14 +27,21 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
-import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.NxMatchInfo;
-import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort;
 import org.opendaylight.netvirt.aclservice.api.AclServiceManager.MatchCriteria;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.AccessLists;
@@ -288,14 +292,10 @@ public final class AclServiceUtils {
      */
     public static List<MatchInfoBase> buildDhcpMatches(int srcPort, int dstPort, int lportTag) {
         List<MatchInfoBase> matches = new ArrayList<>(6);
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.UDP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.udp_dst,
-                new long[] { dstPort }));
-        matches.add(new MatchInfo(MatchFieldType.udp_src,
-                new long[] { srcPort}));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(MatchIpProtocol.UDP);
+        matches.add(new MatchUdpDestinationPort(dstPort));
+        matches.add(new MatchUdpSourcePort(srcPort));
         matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
         return matches;
     }
@@ -310,14 +310,10 @@ public final class AclServiceUtils {
      */
     public static List<MatchInfoBase> buildDhcpV6Matches(int srcPort, int dstPort, int lportTag) {
         List<MatchInfoBase> matches = new ArrayList<>(6);
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.UDP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.udp_dst,
-                new long[] { dstPort }));
-        matches.add(new MatchInfo(MatchFieldType.udp_src,
-                new long[] { srcPort}));
+        matches.add(MatchEthernetType.IPV6);
+        matches.add(MatchIpProtocol.UDP);
+        matches.add(new MatchUdpDestinationPort(dstPort));
+        matches.add(new MatchUdpSourcePort(srcPort));
         matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
         return matches;
     }
@@ -332,13 +328,10 @@ public final class AclServiceUtils {
      */
     public static List<MatchInfoBase> buildIcmpV6Matches(int icmpType, int icmpCode, int lportTag) {
         List<MatchInfoBase> matches = new ArrayList<>(6);
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.IPV6ICMP.intValue() }));
+        matches.add(MatchEthernetType.IPV6);
+        matches.add(MatchIpProtocol.ICMPV6);
         if (icmpType != 0) {
-            matches.add(new MatchInfo(MatchFieldType.icmp_v6,
-                    new long[] { icmpType, icmpCode}));
+            matches.add(new MatchIcmpv6((short) icmpType, (short) icmpCode));
         }
         matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
         return matches;
@@ -456,39 +449,28 @@ public final class AclServiceUtils {
                                                      MatchCriteria matchCriteria) {
         List<MatchInfoBase> flowMatches = new ArrayList<>();
         IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
-        MatchFieldType matchFieldType;
         if (ipPrefix != null) {
             if (ipPrefix.getIpv4Prefix() != null) {
-                flowMatches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4}));
-                String[] ipaddressValues = ipPrefix.getIpv4Prefix().getValue().split("/");
-                matchFieldType = matchCriteria == MatchCriteria.MATCH_SOURCE
-                        ? MatchFieldType.ipv4_source : MatchFieldType.ipv4_destination;
-                flowMatches.add(new MatchInfo(matchFieldType, new String[] {ipaddressValues[0], ipaddressValues[1]}));
+                flowMatches.add(MatchEthernetType.IPV4);
+                flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv4Source(
+                        ipPrefix.getIpv4Prefix()) : new MatchIpv4Destination(ipPrefix.getIpv4Prefix()));
             } else {
-                matchFieldType = matchCriteria == MatchCriteria.MATCH_SOURCE
-                        ? MatchFieldType.ipv6_source : MatchFieldType.ipv6_destination;
-                String[] ipv6addressValues = ipPrefix.getIpv6Prefix().getValue().split("/");
-                IPv6Address ipv6Address = IPv6Address.fromString(ipv6addressValues[0]);
-                IPv6Address maskedV6Address = ipv6Address.maskWithNetworkMask(
-                        IPv6NetworkMask.fromPrefixLength(Integer.parseInt(ipv6addressValues[1])));
-                flowMatches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV6}));
-                flowMatches.add(new MatchInfo(matchFieldType,
-                        new String[] {maskedV6Address.toString() + "/" + ipv6addressValues[1]}));
+                flowMatches.add(MatchEthernetType.IPV6);
+                flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv6Source(
+                        ipPrefix.getIpv6Prefix()) : new MatchIpv6Destination(ipPrefix.getIpv6Prefix()));
             }
         } else {
             IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
             if (ipAddress.getIpv4Address() != null) {
-                matchFieldType = matchCriteria == MatchCriteria.MATCH_SOURCE
-                        ? MatchFieldType.ipv4_source : MatchFieldType.ipv4_destination;
-                flowMatches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4}));
-                flowMatches.add(new MatchInfo(matchFieldType,
-                        new String[] {ipAddress.getIpv4Address().getValue(), "32"}));
+                flowMatches.add(MatchEthernetType.IPV4);
+                flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv4Source(
+                        ipAddress.getIpv4Address().getValue(), "32") : new MatchIpv4Destination(
+                        ipAddress.getIpv4Address().getValue(), "32"));
             } else {
-                matchFieldType = matchCriteria == MatchCriteria.MATCH_SOURCE
-                        ? MatchFieldType.ipv6_source : MatchFieldType.ipv6_destination;
-                flowMatches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV6}));
-                flowMatches.add(new MatchInfo(matchFieldType,
-                        new String[] {ipAddress.getIpv6Address().getValue() + "/128" }));
+                flowMatches.add(MatchEthernetType.IPV6);
+                flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv6Source(
+                        ipAddress.getIpv6Address().getValue() + "/128") : new MatchIpv6Destination(
+                        ipAddress.getIpv6Address().getValue() + "/128"));
             }
         }
         return flowMatches;
@@ -501,8 +483,7 @@ public final class AclServiceUtils {
      * @return the lport tag match
      */
     public static MatchInfo buildLPortTagMatch(int lportTag) {
-        return new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] {MetaDataUtil.getLportTagMetaData(lportTag), MetaDataUtil.METADATA_MASK_LPORT_TAG});
+        return new MatchMetadata(MetaDataUtil.getLportTagMetaData(lportTag), MetaDataUtil.METADATA_MASK_LPORT_TAG);
     }
 
     public static List<Ace> getAceWithRemoteAclId(DataBroker dataBroker, AclInterface port, Uuid remoteAcl) {
@@ -530,8 +511,8 @@ public final class AclServiceUtils {
             return null;
         }
         Map<String, List<MatchInfoBase>> updatedFlowMatchesMap = new HashMap<>();
-        MatchInfoBase ipv4Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4});
-        MatchInfoBase ipv6Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV6});
+        MatchInfoBase ipv4Match = MatchEthernetType.IPV4;
+        MatchInfoBase ipv6Match = MatchEthernetType.IPV6;
         for (String flowName : flowMatchesMap.keySet()) {
             List<MatchInfoBase> flows = flowMatchesMap.get(flowName);
             for (AclInterface port : interfaceList) {
@@ -590,8 +571,8 @@ public final class AclServiceUtils {
             return null;
         }
         Map<String, List<MatchInfoBase>> updatedFlowMatchesMap = new HashMap<>();
-        MatchInfoBase ipv4Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4});
-        MatchInfoBase ipv6Match = new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV6});
+        MatchInfoBase ipv4Match = MatchEthernetType.IPV4;
+        MatchInfoBase ipv6Match = MatchEthernetType.IPV6;
         for (String flowName : flowMatchesMap.keySet()) {
             List<MatchInfoBase> flows = flowMatchesMap.get(flowName);
             // iterate over allow address pair and update match type
@@ -655,25 +636,6 @@ public final class AclServiceUtils {
         return matchInfoBaseList;
     }
 
-    public static MatchInfoBase popMatchInfoByType(List<MatchInfoBase> flows, MatchFieldType type) {
-        MatchInfoBase mib = getMatchInfoByType(flows, type);
-        if (mib != null) {
-            flows.remove(mib);
-        }
-        return mib;
-    }
-
-    public static MatchInfo getMatchInfoByType(List<MatchInfoBase> flows, MatchFieldType type) {
-        for (MatchInfoBase mib : flows) {
-            if (mib instanceof MatchInfo) {
-                if (((MatchInfo)mib).getMatchField() == type) {
-                    return (MatchInfo) mib;
-                }
-            }
-        }
-        return null;
-    }
-
     public static MatchInfoBase getMatchInfoByType(List<MatchInfoBase> flows, NxMatchFieldType type) {
         for (MatchInfoBase mib : flows) {
             if (mib instanceof NxMatchInfo) {
@@ -685,14 +647,6 @@ public final class AclServiceUtils {
         return null;
     }
 
-    public static boolean containsMatchFieldType(List<MatchInfoBase> flows, MatchFieldType type) {
-        MatchInfoBase mib = getMatchInfoByType(flows, type);
-        if (mib != null) {
-            return true;
-        }
-        return false;
-    }
-
     public static boolean containsMatchFieldType(List<MatchInfoBase> flows, NxMatchFieldType type) {
         MatchInfoBase mib = getMatchInfoByType(flows, type);
         if (mib != null) {
@@ -701,22 +655,12 @@ public final class AclServiceUtils {
         return false;
     }
 
-    public static boolean containsMatchFieldTypeAndValue(List<MatchInfoBase> flows, MatchFieldType type,
-            long[] values) {
-        MatchInfo mib = getMatchInfoByType(flows, type);
-        if (mib != null && Arrays.equals(mib.getMatchValues(), values)) {
-            return true;
-        }
-
-        return false;
-    }
-
     public static boolean containsTcpMatchField(List<MatchInfoBase> flows) {
-        return containsMatchFieldTypeAndValue(flows, MatchFieldType.ip_proto, new long[] {IPProtocols.TCP.intValue()});
+        return flows.contains(MatchIpProtocol.TCP);
     }
 
     public static boolean containsUdpMatchField(List<MatchInfoBase> flows) {
-        return containsMatchFieldTypeAndValue(flows, MatchFieldType.ip_proto, new long[] {IPProtocols.UDP.intValue()});
+        return flows.contains(MatchIpProtocol.UDP);
     }
 
     public static Integer allocateId(IdManagerService idManager, String poolName, String idKey) {
index afcbc13230203f5fb91418098aec6913bbddd142..1bc05cc9fa833baba92853e2eed5e170e8940b8a 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.netvirt.aclservice;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -31,11 +32,11 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.actions.ActionLearn;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
 import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
@@ -196,10 +197,9 @@ public class LearnEgressAclServiceImplTest {
         assertEquals(true, testedService.removeAcl(ai));
         assertEquals(5, removeFlowValueSaver.getNumOfInvocations());
         FlowEntity firstRangeFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(4).get(0);
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
-
     }
 
     private AclInterface stubUdpAclInterface(Uuid sgUuid, String ifName, String ipv4PrefixStr,
index 029fc9f4900ff7312490eca7e1d4696612b688d4..d9b2bd1a5be1bd00f26a23260447f7ba09c73352 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.netvirt.aclservice;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -27,11 +28,11 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceTestUtils;
@@ -110,7 +111,7 @@ public class StatelessEgressAclServiceImplTest {
         FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
         AclServiceTestUtils.verifyActionInfo(firstRangeFlow.getInstructionInfoList().get(0).getActionInfos(),
                 new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
 
@@ -137,12 +138,12 @@ public class StatelessEgressAclServiceImplTest {
         FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65532");
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
 
         FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(10).get(0);
         AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "84", "65535");
-        AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(secondRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
     }
 
     @Test
@@ -160,7 +161,7 @@ public class StatelessEgressAclServiceImplTest {
         assertEquals(true, testedService.removeAcl(ai));
         assertEquals(10, removeFlowValueSaver.getNumOfInvocations());
         FlowEntity firstRangeFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(9).get(0);
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
 
index 9f976d931ef03227dac713de4026f2334488dc10..af8f90c82fbd0c598b08212673082db188b46140 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.netvirt.aclservice;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -27,13 +28,12 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
-import org.opendaylight.netvirt.aclservice.utils.AclConstants;
 import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceTestUtils;
 import org.opendaylight.netvirt.aclservice.utils.AclServiceUtils;
@@ -111,7 +111,7 @@ public class StatelessIngressAclServiceImplTest {
         FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(0);
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
         AclServiceTestUtils.verifyActionInfo(firstRangeFlow.getInstructionInfoList().get(0).getActionInfos(),
                 new ActionNxResubmit(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE));
     }
@@ -139,12 +139,12 @@ public class StatelessIngressAclServiceImplTest {
         // https://bugs.opendaylight.org/show_bug.cgi?id=6200
         AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65532");
-        AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
 
         FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(7).get(0);
         AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "84", "65535");
-        AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(), MatchFieldType.tcp_flags, "2");
+        assertTrue(secondRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
     }
 
     @Test
@@ -164,8 +164,7 @@ public class StatelessIngressAclServiceImplTest {
         FlowEntity firstSynFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(6).get(0);
         AclServiceTestUtils.verifyMatchInfo(firstSynFlow.getMatchInfoList(),
                 NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
-        AclServiceTestUtils.verifyMatchInfo(firstSynFlow.getMatchInfoList(), MatchFieldType.tcp_flags,
-                AclConstants.TCP_FLAG_SYN + "");
+        assertTrue(firstSynFlow.getMatchInfoList().contains(MatchTcpFlags.SYN));
 
     }
 
index b6f69dfff654f4e7d9c48ca4f4dcb4c75fdaec6f..cba490ce9cc15bef8150ca50f71fb2e313771e19 100644 (file)
@@ -9,12 +9,16 @@ package org.opendaylight.netvirt.aclservice.tests
 
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit
 import org.opendaylight.genius.mdsalutil.FlowEntity
-import org.opendaylight.genius.mdsalutil.MatchFieldType
-import org.opendaylight.genius.mdsalutil.MatchInfoBuilder
 import org.opendaylight.genius.mdsalutil.MetaDataUtil
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
-
-import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
+import org.opendaylight.genius.mdsalutil.matches.MatchArpSha
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress
 
 class FlowEntryObjectsBase {
 
@@ -34,37 +38,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -79,37 +57,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -124,32 +76,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -164,32 +94,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -204,32 +112,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -244,19 +130,8 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -278,37 +153,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67),
+                    new MatchUdpSourcePort(68),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -323,37 +172,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547),
+                    new MatchUdpSourcePort(546),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -365,37 +188,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -407,37 +204,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -449,32 +220,10 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -489,32 +238,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -529,32 +256,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -569,32 +274,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -609,25 +292,9 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.arp_sha
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F3"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F3")),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -648,37 +315,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -693,37 +334,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -738,32 +353,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -778,32 +371,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -818,32 +389,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -858,19 +407,8 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -890,37 +428,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67),
+                    new MatchUdpSourcePort(68),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -935,37 +447,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547),
+                    new MatchUdpSourcePort(546),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -977,37 +463,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1019,37 +479,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1061,32 +495,10 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -1101,32 +513,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1141,32 +531,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1181,32 +549,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1221,25 +567,9 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.arp_sha
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F4"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1260,37 +590,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1305,37 +609,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1350,32 +628,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1390,32 +646,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1430,32 +664,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1470,19 +682,8 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1502,37 +703,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67),
+                    new MatchUdpSourcePort(68),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1547,37 +722,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547),
+                    new MatchUdpSourcePort(546),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1589,37 +738,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1631,37 +754,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1673,32 +770,10 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -1713,32 +788,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1753,32 +806,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1793,32 +824,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1833,25 +842,9 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.arp_sha
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F5"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F5")),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -1872,37 +865,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1917,37 +884,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1962,32 +903,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2002,32 +921,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2042,32 +939,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2082,19 +957,8 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2109,37 +973,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67),
+                    new MatchUdpSourcePort(68),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2154,37 +992,11 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547),
+                    new MatchUdpSourcePort(546),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2196,37 +1008,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68),
+                    new MatchUdpSourcePort(67),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2238,37 +1024,11 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546),
+                    new MatchUdpSourcePort(547),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2280,32 +1040,10 @@ class FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -2320,32 +1058,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2360,32 +1076,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2400,32 +1094,10 @@ class FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
index 9e69ef2c481c55503aa1c097f26f13bf96471d1e..c124de4bfd91ab4d6e5536e140c6248cde32eba4 100644 (file)
@@ -7,17 +7,28 @@
  */
 package org.opendaylight.netvirt.aclservice.tests
 
+import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack
+import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit
 import org.opendaylight.genius.mdsalutil.FlowEntity
-import org.opendaylight.genius.mdsalutil.MatchFieldType
-import org.opendaylight.genius.mdsalutil.MatchInfoBuilder
+import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
+import org.opendaylight.genius.mdsalutil.matches.MatchArpSha
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv4
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort
 import org.opendaylight.genius.mdsalutil.MetaDataUtil
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType
 import org.opendaylight.genius.mdsalutil.NxMatchInfoBuilder
-import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress
 
 import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
-import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack
-import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit
 
 class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
 
@@ -119,31 +130,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 ])
             ]
             matchInfoList = #[
-                new MatchInfoBuilder >> [
-                    matchField = MatchFieldType.eth_type
-                    matchValues = #[
-                        2048L
-                    ]
-                ],
-                new MatchInfoBuilder >> [
-                    matchField = MatchFieldType.eth_dst
-                    stringMatchValues = #[
-                        "0D:AA:D8:42:30:F3"
-                ]
-            ],
-            new MatchInfoBuilder >> [
-                matchField = MatchFieldType.eth_type
-                matchValues = #[
-                    2048L
-                ]
-            ],
-            new MatchInfoBuilder >> [
-                matchField = MatchFieldType.ipv4_destination
-                stringMatchValues = #[
-                    "10.0.0.1",
-                "24"
-                        ]
-                    ]
+                new MatchEthernetType(2048L),
+                new MatchEthernetDestination(new MacAddress("0D:AA:D8:42:30:F3")),
+            new MatchEthernetType(2048L),
+            new MatchIpv4Destination("10.0.0.1", "24")
                 ]
                 priority = 61010
                 tableId = 251 as short
@@ -167,38 +157,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -224,38 +187,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -282,25 +218,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_src
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F3"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ]
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F3")),
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.1", "24")
                 ]
                 priority = 61010
                 tableId = 40 as short
@@ -320,31 +240,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_dst
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F4"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetDestination(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.2", "24")
                 ]
                 priority = 61010
                 tableId = 251 as short
@@ -364,25 +263,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_src
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F4"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ]
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.2", "24")
                 ]
                 priority = 61010
                 tableId = 40 as short
@@ -402,31 +285,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_dst
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F5"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.3",
-                            "24"
-                        ]
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetDestination(new MacAddress("0D:AA:D8:42:30:F5")),
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.3", "24")
                 ]
                 priority = 61010
                 tableId = 251 as short
@@ -447,25 +309,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_src
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F5"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.3",
-                            "24"
-                        ]
-                    ]
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F5")),
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.3", "24")
                 ]
                 priority = 61010
                 tableId = 40 as short
@@ -485,37 +331,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67 as short),
+                    new MatchUdpSourcePort(68 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -530,37 +350,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547 as short),
+                    new MatchUdpSourcePort(546 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -572,37 +366,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68 as short),
+                    new MatchUdpSourcePort(67 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -614,37 +382,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546 as short),
+                    new MatchUdpSourcePort(547 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -656,32 +398,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -696,32 +416,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -736,32 +434,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -776,32 +452,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -816,25 +470,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.arp_sha
-                        stringMatchValues = #[
-                            "0D:AA:D8:42:30:F4"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -856,25 +494,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -902,25 +524,9 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -948,18 +554,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -967,19 +563,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1007,18 +592,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1026,19 +601,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1069,31 +633,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1101,19 +644,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1136,31 +668,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1168,24 +679,13 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new NxMatchInfoBuilder >> [
+                        matchField = NxMatchFieldType.ct_state
                         matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new NxMatchInfoBuilder >> [
-                        matchField = NxMatchFieldType.ct_state
-                        matchValues = #[
-                            33L,
-                            33L
+                            33L,
+                            33L
                         ]
                     ]
                 ]
@@ -1208,18 +708,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1227,19 +717,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1270,31 +749,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1302,19 +760,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1337,31 +784,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1369,19 +795,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1409,18 +824,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1428,19 +833,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1468,38 +862,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1527,38 +894,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1589,51 +929,13 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1659,51 +961,13 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1731,18 +995,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1750,19 +1004,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65532L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1790,18 +1033,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1809,19 +1042,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65534L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1844,18 +1066,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1863,19 +1075,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65280L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1898,18 +1099,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1917,19 +1108,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65534L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1952,18 +1132,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1971,19 +1141,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2006,18 +1165,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -2025,19 +1174,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65520L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2060,18 +1198,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -2079,19 +1207,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65504L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2114,18 +1231,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -2133,19 +1240,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65408L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2168,18 +1264,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -2187,19 +1273,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                             65528L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2227,31 +1302,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2279,31 +1333,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2332,38 +1365,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2386,38 +1392,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2445,38 +1424,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2499,38 +1451,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -2558,37 +1483,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68 as short),
+                    new MatchUdpSourcePort(67 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2603,37 +1502,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546 as short),
+                    new MatchUdpSourcePort(547 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2648,32 +1521,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2688,32 +1539,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2728,32 +1557,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2768,19 +1575,8 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2795,37 +1591,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67 as short),
+                    new MatchUdpSourcePort(68 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2840,37 +1610,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547 as short),
+                    new MatchUdpSourcePort(546 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2882,37 +1626,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68 as short),
+                    new MatchUdpSourcePort(67 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2924,37 +1642,11 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546 as short),
+                    new MatchUdpSourcePort(547 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2966,32 +1658,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -3006,32 +1676,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -3046,32 +1694,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -3086,32 +1712,10 @@ class FlowEntryObjectsStateful extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
index cf0c443085d0e90d707030c7b8db38c2eb9b04b9..9737efeb9a5bd76c2c728fce8fe258035e19f947 100644 (file)
@@ -10,12 +10,20 @@ package org.opendaylight.netvirt.aclservice.tests
 import org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit
 import org.opendaylight.genius.mdsalutil.FlowEntity
-import org.opendaylight.genius.mdsalutil.MatchFieldType
-import org.opendaylight.genius.mdsalutil.MatchInfoBuilder
+import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv4
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpFlags
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort
 import org.opendaylight.genius.mdsalutil.MetaDataUtil
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType
 import org.opendaylight.genius.mdsalutil.NxMatchInfoBuilder
-import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
 
 import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
 
@@ -89,25 +97,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                 ])
             ]
             matchInfoList = #[
-                new MatchInfoBuilder >> [
-                    matchField = MatchFieldType.eth_type
-                    matchValues = #[
-                        2048L
-                    ]
-                ],
-                new MatchInfoBuilder >> [
-                    matchField = MatchFieldType.eth_type
-                    matchValues = #[
-                        2048L
-                    ]
-                ],
-                new MatchInfoBuilder >> [
-                    bigMatchValues = #[
-                        1085217976614912bi,
-                        1152920405095219200bi
-                    ]
-                    matchField = MatchFieldType.metadata
-                ]
+                new MatchEthernetType(2048L),
+                new MatchEthernetType(2048L),
+                new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
             ]
             priority = 61005
             tableId = 251 as short
@@ -126,25 +118,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -163,25 +139,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
                 ]
                 priority = 61005
                 tableId = 251 as short
@@ -196,25 +156,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
                 ]
                 priority = 61005
                 tableId = 251 as short
@@ -234,25 +178,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
             ])
         ]
         matchInfoList = #[
-            new MatchInfoBuilder >> [
-                matchField = MatchFieldType.eth_type
-                matchValues = #[
-                    2048L
-                ]
-            ],
-            new MatchInfoBuilder >> [
-                matchField = MatchFieldType.eth_type
-                matchValues = #[
-                    2048L
-                ]
-            ],
-            new MatchInfoBuilder >> [
-                bigMatchValues = #[
-                    1085217976614912bi,
-                    1152920405095219200bi
-                ]
-                matchField = MatchFieldType.metadata
-            ]
+            new MatchEthernetType(2048L),
+            new MatchEthernetType(2048L),
+            new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
         ]
         priority = 61005
         tableId = 251 as short
@@ -272,25 +200,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -310,18 +222,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                         ])
                     ]
                     matchInfoList = #[
-                        new MatchInfoBuilder >> [
-                            matchField = MatchFieldType.eth_type
-                            matchValues = #[
-                                2048L
-                            ]
-                        ],
-                        new MatchInfoBuilder >> [
-                            matchField = MatchFieldType.eth_type
-                            matchValues = #[
-                                2048L
-                            ]
-                        ],
+                        new MatchEthernetType(2048L),
+                        new MatchEthernetType(2048L),
                         new NxMatchInfoBuilder >> [
                             matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                             matchValues = #[
@@ -329,25 +231,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                                 65535L
                             ]
                         ],
-                        new MatchInfoBuilder >> [
-                            matchField = MatchFieldType.ip_proto
-                            matchValues = #[
-                                6L
-                            ]
-                        ],
-                        new MatchInfoBuilder >> [
-                            bigMatchValues = #[
-                                1085217976614912bi,
-                                1152920405095219200bi
-                            ]
-                            matchField = MatchFieldType.metadata
-                        ],
-                        new MatchInfoBuilder >> [
-                            matchField = MatchFieldType.tcp_flags
-                            matchValues = #[
-                                2L
-                            ]
-                        ]
+                        new MatchIpProtocol(6 as short),
+                        new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                        new MatchTcpFlags(2)
                     ]
                     priority = 61005
                     tableId = 251 as short
@@ -367,18 +253,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -386,25 +262,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 251 as short
@@ -424,18 +284,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -443,25 +293,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -481,18 +315,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -500,25 +324,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -533,18 +341,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -552,25 +350,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -591,18 +373,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -610,19 +382,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -653,31 +414,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -685,19 +425,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -720,31 +449,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_source
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Source("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -752,19 +460,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -792,18 +489,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -811,19 +498,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -851,38 +527,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -910,38 +559,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -972,51 +594,13 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.1",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.1", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1042,51 +626,13 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ipv4_destination
-                        stringMatchValues = #[
-                            "10.0.0.2",
-                            "24"
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchIpv4Destination("10.0.0.2", "24"),
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1114,18 +660,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_udp_dst_with_mask
                         matchValues = #[
@@ -1133,19 +669,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65532L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchIpProtocol(17 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1172,18 +697,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1191,25 +706,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65534L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1224,18 +723,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1243,25 +732,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65280L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1276,18 +749,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1295,25 +758,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65534L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1328,18 +775,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1347,25 +784,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65535L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1380,18 +801,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1399,25 +810,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65520L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1432,18 +827,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1451,25 +836,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65504L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1484,18 +853,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1503,25 +862,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65408L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1536,18 +879,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.nx_tcp_dst_with_mask
                         matchValues = #[
@@ -1555,25 +888,9 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                             65528L
                         ]
                     ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            6L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            1152920405095219200bi
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.tcp_flags
-                        matchValues = #[
-                            2L
-                        ]
-                    ]
+                    new MatchIpProtocol(6 as short),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi),
+                    new MatchTcpFlags(2)
                 ]
                 priority = 61005
                 tableId = 40 as short
@@ -1594,38 +911,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1648,38 +938,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1707,38 +970,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1761,38 +997,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v4
-                        matchValues = #[
-                            2L,
-                            3L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            1L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ],
+                    new MatchEthernetType(2048L),
+                    new MatchEthernetType(2048L),
+                    new MatchIcmpv4(2 as short, 3 as short),
+                    new MatchIpProtocol(1 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
                     new NxMatchInfoBuilder >> [
                         matchField = NxMatchFieldType.ct_state
                         matchValues = #[
@@ -1819,37 +1028,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68 as short),
+                    new MatchUdpSourcePort(67 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1864,37 +1047,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546 as short),
+                    new MatchUdpSourcePort(547 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1909,32 +1066,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            130L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(130 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1949,32 +1084,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -1989,32 +1102,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2029,19 +1120,8 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2054L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2054L),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 251 as short
@@ -2056,37 +1136,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(67 as short),
+                    new MatchUdpSourcePort(68 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2101,37 +1155,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(547 as short),
+                    new MatchUdpSourcePort(546 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2143,37 +1171,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            2048L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            68L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            67L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(2048L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(68 as short),
+                    new MatchUdpSourcePort(67 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2185,37 +1187,11 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            17L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_dst
-                        matchValues = #[
-                            546L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.udp_src
-                        matchValues = #[
-                            547L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(17 as short),
+                    new MatchUdpDestinationPort(546 as short),
+                    new MatchUdpSourcePort(547 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2227,32 +1203,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                 instructionInfoList = #[
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            134L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(134 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63020
                 tableId = 40 as short
@@ -2267,32 +1221,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            133L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(133 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2307,32 +1239,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            135L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(135 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
@@ -2347,32 +1257,10 @@ class FlowEntryObjectsStateless extends FlowEntryObjectsBase {
                     ])
                 ]
                 matchInfoList = #[
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.eth_type
-                        matchValues = #[
-                            34525L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.ip_proto
-                        matchValues = #[
-                            58L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        matchField = MatchFieldType.icmp_v6
-                        matchValues = #[
-                            136L,
-                            0L
-                        ]
-                    ],
-                    new MatchInfoBuilder >> [
-                        bigMatchValues = #[
-                            1085217976614912bi,
-                            MetaDataUtil.METADATA_MASK_LPORT_TAG
-                        ]
-                        matchField = MatchFieldType.metadata
-                    ]
+                    new MatchEthernetType(34525L),
+                    new MatchIpProtocol(58 as short),
+                    new MatchIcmpv6(136 as short, 0 as short),
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 40 as short
index e4d25152c9b5deb42c93345633fd9754cb10f530..8e82704b369c45df4412325c0f9364062a2710d2 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.netvirt.aclservice.utils;
 import static com.google.common.collect.Iterables.filter;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.Iterables;
 
@@ -19,12 +20,13 @@ import java.util.List;
 import java.util.Map;
 
 import org.junit.Test;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
-import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
-import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.NxMatchInfo;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv4;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4Builder;
@@ -59,10 +61,14 @@ public class AclServiceOFFlowBuilderTest {
 
         AclServiceTestUtils.verifyGeneralFlows(flowMatches, "1", "10.1.1.1", "20.1.1.1", "24");
 
-        Iterable<MatchInfoBase> icmpv4Matches = filter(flowMatches,
-                (item -> ((MatchInfo) item).getMatchField().equals(MatchFieldType.icmp_v4)));
-        AclServiceTestUtils.verifyMatchValues((MatchInfo) Iterables.get(icmpv4Matches, 0), "1024", "2048");
-        AclServiceTestUtils.verifyMatchValues((MatchInfo) Iterables.get(icmpv4Matches, 1), "1024", "2048");
+        int matches = 0;
+        MatchIcmpv4 check = new MatchIcmpv4((short) 1024, (short) 2048);
+        for (MatchInfoBase flowMatch : flowMatches) {
+            if (check.equals(flowMatch)) {
+                matches++;
+            }
+        }
+        assertEquals(2, matches);
     }
 
     @Test
@@ -179,9 +185,8 @@ public class AclServiceOFFlowBuilderTest {
 
         List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addDstIpMatches(builder.build());
 
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.eth_type,
-                Integer.toString(NwConstants.ETHTYPE_IPV4));
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.ipv4_destination, "10.1.1.1", "24");
+        assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
+        assertTrue(flowMatches.contains(new MatchIpv4Destination("10.1.1.1", "24")));
     }
 
     @Test
@@ -193,9 +198,8 @@ public class AclServiceOFFlowBuilderTest {
 
         List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addDstIpMatches(builder.build());
 
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.eth_type,
-                Integer.toString(NwConstants.ETHTYPE_IPV4));
-        AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchFieldType.ipv4_destination);
+        assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
+        AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchIpv4Destination.class);
     }
 
     @Test
@@ -207,9 +211,8 @@ public class AclServiceOFFlowBuilderTest {
 
         List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addSrcIpMatches(builder.build());
 
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.eth_type,
-                Integer.toString(NwConstants.ETHTYPE_IPV4));
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.ipv4_source, "10.1.1.1", "24");
+        assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
+        assertTrue(flowMatches.contains(new MatchIpv4Source("10.1.1.1", "24")));
     }
 
     @Test
@@ -220,9 +223,8 @@ public class AclServiceOFFlowBuilderTest {
         builder.setAceIpVersion(v4builder.build());
 
         List<MatchInfoBase> flowMatches = AclServiceOFFlowBuilder.addSrcIpMatches(builder.build());
-        AclServiceTestUtils.verifyMatchInfo(flowMatches, MatchFieldType.eth_type,
-                Integer.toString(NwConstants.ETHTYPE_IPV4));
-        AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchFieldType.ipv4_source);
+        assertTrue(flowMatches.contains(MatchEthernetType.IPV4));
+        AclServiceTestUtils.verifyMatchFieldTypeDontExist(flowMatches, MatchIpv4Source.class);
     }
 
     @Test
index 477364239b2f0f7dbd976b994e2b042d498217d9..e8255713b25f2888be6983db2fd41856951dfd9d 100644 (file)
@@ -26,13 +26,15 @@ import java.util.stream.Stream;
 
 import org.junit.Assert;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
-import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
 import org.opendaylight.genius.mdsalutil.NxMatchInfo;
 import org.opendaylight.genius.mdsalutil.actions.ActionLearn;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
 import org.opendaylight.genius.utils.cache.CacheUtil;
 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl;
@@ -51,10 +53,10 @@ public class AclServiceTestUtils {
 
     public static void verifyGeneralFlows(List<MatchInfoBase> srcFlowMatches, String protocol, String srcIpv4Net,
             String dstIpv4Net, String mask) {
-        verifyMatchInfo(srcFlowMatches, MatchFieldType.eth_type, Integer.toString(NwConstants.ETHTYPE_IPV4));
-        verifyMatchInfo(srcFlowMatches, MatchFieldType.ip_proto, protocol);
-        verifyMatchInfo(srcFlowMatches, MatchFieldType.ipv4_source, srcIpv4Net, mask);
-        verifyMatchInfo(srcFlowMatches, MatchFieldType.ipv4_destination, dstIpv4Net, mask);
+        assertTrue(srcFlowMatches.contains(MatchEthernetType.IPV4));
+        assertTrue(srcFlowMatches.contains(new MatchIpProtocol(Short.parseShort(protocol))));
+        assertTrue(srcFlowMatches.contains(new MatchIpv4Source(srcIpv4Net, mask)));
+        assertTrue(srcFlowMatches.contains(new MatchIpv4Destination(dstIpv4Net, mask)));
     }
 
     public static AceIpBuilder prepareAceIpBuilder(String srcIpv4Net, String dstIpv4Net, String lowerPort,
@@ -87,31 +89,12 @@ public class AclServiceTestUtils {
         return builder;
     }
 
-    public static void verifyMatchInfo(List<MatchInfoBase> flowMatches, MatchFieldType matchType, String... params) {
-        Iterable<MatchInfoBase> matches = filter(flowMatches,
-            item -> item instanceof MatchInfo && ((MatchInfo) item).getMatchField().equals(matchType)
-                 || item instanceof NxMatchInfo && ((NxMatchInfo) item).getMatchField().equals(matchType));
-        assertFalse(Iterables.isEmpty(matches));
-        for (MatchInfoBase baseMatch : matches) {
-            if (baseMatch instanceof MatchInfo) {
-                verifyMatchValues((MatchInfo)baseMatch, params);
-            } else {
-                verifyMatchValues((NxMatchInfo)baseMatch, params);
-            }
-        }
-    }
-
     public static void verifyMatchInfo(List<MatchInfoBase> flowMatches, NxMatchFieldType matchType, String... params) {
         Iterable<MatchInfoBase> matches = filter(flowMatches,
-            item -> item instanceof MatchInfo && ((MatchInfo) item).getMatchField().equals(matchType)
-                 || item instanceof NxMatchInfo && ((NxMatchInfo) item).getMatchField().equals(matchType));
+            item -> item instanceof NxMatchInfo && ((NxMatchInfo) item).getMatchField().equals(matchType));
         assertFalse(Iterables.isEmpty(matches));
         for (MatchInfoBase baseMatch : matches) {
-            if (baseMatch instanceof MatchInfo) {
-                verifyMatchValues((MatchInfo)baseMatch, params);
-            } else {
-                verifyMatchValues((NxMatchInfo)baseMatch, params);
-            }
+            verifyMatchValues((NxMatchInfo)baseMatch, params);
         }
     }
 
@@ -131,34 +114,11 @@ public class AclServiceTestUtils {
         }
     }
 
-    public static void verifyMatchValues(MatchInfo match, String... params) {
-        switch (match.getMatchField()) {
-
-            case ip_proto:
-            case eth_type:
-            case tcp_flags:
-            case icmp_v4:
-                long[] values = Arrays.stream(params).mapToLong(l -> Long.parseLong(l)).toArray();
-                Assert.assertArrayEquals(values, match.getMatchValues());
-                break;
-            case ipv4_source:
-            case ipv4_destination:
-            case eth_src:
-            case eth_dst:
-            case arp_sha:
-            case arp_tha:
-                Assert.assertArrayEquals(params, match.getStringMatchValues());
-                break;
-            default:
-                assertTrue("match type is not supported", false);
-                break;
-        }
-    }
-
-    public static void verifyMatchFieldTypeDontExist(List<MatchInfoBase> flowMatches, MatchFieldType matchType) {
+    public static void verifyMatchFieldTypeDontExist(List<MatchInfoBase> flowMatches,
+            Class<? extends MatchInfo> matchType) {
         Iterable<MatchInfoBase> matches = filter(flowMatches,
-            item -> ((MatchInfo) item).getMatchField().equals(matchType));
-        Assert.assertTrue("unexpected match type " + matchType.name(), Iterables.isEmpty(matches));
+            item -> matchType.isAssignableFrom(item.getClass()));
+        Assert.assertTrue("unexpected match type " + matchType.getSimpleName(), Iterables.isEmpty(matches));
     }
 
     public static void verifyMatchFieldTypeDontExist(List<MatchInfoBase> flowMatches, NxMatchFieldType matchType) {
index 51136e42d2998e2c85d30dcdc7299885d3daca23..5848949ae5801405665e62c4b1d2dd7cd35f310c 100644 (file)
@@ -9,17 +9,18 @@ package org.opendaylight.netvirt.cloudservicechain.listeners;
 
 import java.math.BigInteger;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.cloudservicechain.CloudServiceChainConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -112,12 +113,9 @@ public class VpnToElanFallbackNodeListener extends AsyncDataTreeChangeListenerBa
 
         LOG.debug("Installing L3VPN to ELAN default Fallback flow in LPortDispatcher table on Dpn {}",
                   add.getNodeId());
-        BigInteger[] metadataToMatch = new BigInteger[] {
-            MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME,
-                                                                       NwConstants.L3VPN_SERVICE_INDEX)),
-            MetaDataUtil.METADATA_MASK_SERVICE_INDEX
-        };
-        List<MatchInfo> matches = Arrays.asList(new MatchInfo(MatchFieldType.metadata, metadataToMatch));
+        List<MatchInfo> matches = Collections.singletonList(new MatchMetadata(MetaDataUtil.getServiceIndexMetaData(
+                ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)),
+                MetaDataUtil.METADATA_MASK_SERVICE_INDEX));
 
         BigInteger metadataToWrite =
             MetaDataUtil.getServiceIndexMetaData(ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME,
index fb30d23c7dbbbd1f474b1fe527e52d28aad1117a..1b5a34803a96b39d65880790a7fe4e450284db3c 100755 (executable)
@@ -19,12 +19,13 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionRegLoad;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.cloudservicechain.CloudServiceChainConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
@@ -105,11 +106,11 @@ public class ElanServiceChainUtils {
             instructions.add(MDSALUtil.buildApplyActionsInstruction(MDSALUtil
                     .buildActions(actionsInfos),instructionKey++));
             instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(tableId, instructionKey++));
-            List<MatchInfo> matches = Arrays.asList(
-                    new MatchInfo(MatchFieldType.metadata,
-                            new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
+            List<MatchInfo> matches = Collections.singletonList(
+                    new MatchMetadata(
+                            MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
                                     ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)),
-                                    MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
+                            MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
 
             Flow flow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                     CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef,
@@ -141,13 +142,10 @@ public class ElanServiceChainUtils {
                  dpnId, elanLportTag, elanTag, addOrRemove);
         String flowRef = buildLportDispFromScfFlowRef(elanTag, elanLportTag );
         if (addOrRemove == NwConstants.ADD_FLOW) {
-            List<MatchInfo> matches = Arrays.asList(
-                new MatchInfo(MatchFieldType.metadata,
-                              new BigInteger[] {
-                                  MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
-                                                                ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME,
-                                                                                      NwConstants.ELAN_SERVICE_INDEX)),
-                                  MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
+            List<MatchInfo> matches = Collections.singletonList(
+                    new MatchMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(elanLportTag,
+                            ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX)),
+                            MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
             int instructionKey = 0;
             List<Instruction> instructions = Arrays.asList(
                     // BigInter.ONE is for setting also the Split-Horizon flag since it could have been cleared
@@ -197,8 +195,7 @@ public class ElanServiceChainUtils {
                  dpnId, vni, elanLportTag, addOrRemove);
         String flowRef = buildExtTunnelTblToLportDispFlowRef(vni, elanLportTag);
         if (addOrRemove == NwConstants.ADD_FLOW) {
-            List<MatchInfo> matches = Arrays.asList(new MatchInfo(MatchFieldType.tunnel_id,
-                    new BigInteger[] { BigInteger.valueOf(vni) } ) );
+            List<MatchInfo> matches = Collections.singletonList(new MatchTunnelId(BigInteger.valueOf(vni)));
             List<Instruction> instructions = buildSetLportTagAndGotoLportDispInstructions(elanLportTag);
             Flow flow = MDSALUtil.buildFlowNew(NwConstants.EXTERNAL_TUNNEL_TABLE, flowRef,
                     CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef,
index 9ee8a8a63276f081b096ba0a775a534c33d0d5f0..79ad0f69f659a907b4fbfbf64438c503bd44c060 100755 (executable)
@@ -19,7 +19,6 @@ import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALDataStoreUtils;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -29,6 +28,9 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.cloudservicechain.CloudServiceChainConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
@@ -256,9 +258,8 @@ public class VpnServiceChainUtils {
      */
     public static List<MatchInfo> buildMatchOnLportTagAndSI(Integer lportTag, short serviceIndex) {
         return Collections.singletonList(
-                   new MatchInfo(MatchFieldType.metadata,
-                                 new BigInteger[] { MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, serviceIndex),
-                                                    MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
+                new MatchMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, serviceIndex),
+                        MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
     }
 
     /**
@@ -297,8 +298,8 @@ public class VpnServiceChainUtils {
     public static FlowEntity buildLFibVpnPseudoPortFlow(BigInteger dpId, Long label, String nextHop, int lportTag) {
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_MPLS_UC }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[] { label.toString() }));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(label));
 
         List<ActionInfo> actionsInfos = Collections.singletonList(new ActionPopMpls());
         List<InstructionInfo> instructions = new ArrayList<>();
index 653b315a5a408471038c74bbc903659726d63e13..3256c267d138a21786df1da5946cc110877f31dc 100644 (file)
@@ -23,18 +23,22 @@ import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionDrop;
 import org.opendaylight.genius.mdsalutil.actions.ActionPuntToController;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.dhcpservice.api.DhcpMConstants;
 import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
@@ -139,16 +143,11 @@ public class DhcpServiceUtils {
 
     private static List<MatchInfo> getDhcpMatch(String vmMacAddress) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV4 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.UDP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.udp_src,
-                new long[] { DhcpMConstants.DHCP_CLIENT_PORT}));
-        matches.add(new MatchInfo(MatchFieldType.udp_dst,
-                new long[] { DhcpMConstants.DHCP_SERVER_PORT}));
-        matches.add(new MatchInfo(MatchFieldType.eth_src,
-                new String[] { vmMacAddress }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(MatchIpProtocol.UDP);
+        matches.add(new MatchUdpSourcePort(DhcpMConstants.DHCP_CLIENT_PORT));
+        matches.add(new MatchUdpDestinationPort(DhcpMConstants.DHCP_SERVER_PORT));
+        matches.add(new MatchEthernetSource(new MacAddress(vmMacAddress)));
         return matches;
     }
 
index 9a76b6b3fb42c2afdfc43d2847e95ce9764828da..54f57eefb35823628cc1b7ec5c892abb732d8da8 100644 (file)
@@ -38,7 +38,6 @@ import org.opendaylight.genius.itm.globals.ITMConstants;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -49,6 +48,8 @@ import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.elan.ElanException;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
@@ -972,7 +973,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
 
     private List<MatchInfo> buildMatchesForVni(Long vni) {
         List<MatchInfo> mkMatches = new ArrayList<>();
-        MatchInfo match = new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] { BigInteger.valueOf(vni) });
+        MatchInfo match = new MatchTunnelId(BigInteger.valueOf(vni));
         mkMatches.add(match);
         return mkMatches;
     }
@@ -988,8 +989,8 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
     private List<MatchInfo> getMatchesForElanTag(long elanTag, boolean isSHFlagSet) {
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                ElanUtils.getElanMetadataLabel(elanTag, isSHFlagSet), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG }));
+        mkMatches.add(new MatchMetadata(
+                ElanUtils.getElanMetadataLabel(elanTag, isSHFlagSet), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG));
         return mkMatches;
     }
 
@@ -1623,16 +1624,16 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
     private List<MatchInfo> getMatchesForFilterEqualsLPortTag(int lportTag) {
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { MetaDataUtil.getLportTagMetaData(lportTag), MetaDataUtil.METADATA_MASK_LPORT_TAG }));
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] { BigInteger.valueOf(lportTag) }));
+        mkMatches.add(
+                new MatchMetadata(MetaDataUtil.getLportTagMetaData(lportTag), MetaDataUtil.METADATA_MASK_LPORT_TAG));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(lportTag)));
         return mkMatches;
     }
 
     private List<MatchInfo> getTunnelIdMatchForFilterEqualsLPortTag(int lportTag) {
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] { BigInteger.valueOf(lportTag) }));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(lportTag)));
         return mkMatches;
     }
 
index 00cedacf360887afd066b042dd66531a0e036e08..64fe75249c4e9f6cd09c69c0847587000b85bbe9 100755 (executable)
@@ -41,7 +41,6 @@ import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MDSALUtil.MdsalOp;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -49,6 +48,10 @@ import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.elan.ElanException;
 import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
@@ -60,6 +63,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
@@ -706,9 +710,8 @@ public class ElanUtils {
         int lportTag = interfaceInfo.getInterfaceTag();
         // Matching metadata and eth_src fields
         List<MatchInfo> mkMatches = new ArrayList<>();
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                getElanMetadataLabel(elanInfo.getElanTag(), lportTag), getElanMetadataMask() }));
-        mkMatches.add(new MatchInfo(MatchFieldType.eth_src, new String[] { macAddress }));
+        mkMatches.add(new MatchMetadata(getElanMetadataLabel(elanInfo.getElanTag(), lportTag), getElanMetadataMask()));
+        mkMatches.add(new MatchEthernetSource(new MacAddress(macAddress)));
         List<InstructionInfo> mkInstructions = new ArrayList<>();
         mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
 
@@ -795,7 +798,7 @@ public class ElanUtils {
     public static List<MatchInfo> getTunnelIdMatchForFilterEqualsLPortTag(int lportTag) {
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] { BigInteger.valueOf(lportTag) }));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(lportTag)));
         return mkMatches;
     }
 
@@ -1015,9 +1018,8 @@ public class ElanUtils {
         }
 
         List<MatchInfo> mkMatches = new ArrayList<>();
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE }));
-        mkMatches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { macAddress }));
+        mkMatches.add(new MatchMetadata(getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
+        mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddress)));
 
         List<Instruction> mkInstructions = new ArrayList<>();
         List<Action> actions = getEgressActionsForInterface(ifName, /* tunnelKey */ null);
@@ -1085,9 +1087,8 @@ public class ElanUtils {
     public Flow buildRemoteDmacFlowEntry(BigInteger srcDpId, BigInteger destDpId, int lportTag, long elanTag,
             String macAddress, String displayName, ElanInstance elanInstance) throws ElanException {
         List<MatchInfo> mkMatches = new ArrayList<>();
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE }));
-        mkMatches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { macAddress }));
+        mkMatches.add(new MatchMetadata(getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
+        mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddress)));
 
         List<Instruction> mkInstructions = new ArrayList<>();
 
@@ -1482,7 +1483,7 @@ public class ElanUtils {
     public static List<MatchInfo> getTunnelMatchesForServiceId(int elanTag) {
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] { BigInteger.valueOf(elanTag) }));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(elanTag)));
 
         return mkMatches;
     }
@@ -1685,9 +1686,9 @@ public class ElanUtils {
 
     public static List<MatchInfo> buildMatchesForElanTagShFlagAndDstMac(long elanTag, boolean shFlag, String macAddr) {
         List<MatchInfo> mkMatches = new ArrayList<>();
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                getElanMetadataLabel(elanTag, shFlag), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG }));
-        mkMatches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { macAddr }));
+        mkMatches.add(
+                new MatchMetadata(getElanMetadataLabel(elanTag, shFlag), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG));
+        mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddr)));
 
         return mkMatches;
     }
@@ -2044,9 +2045,8 @@ public class ElanUtils {
     public static FlowEntity buildDmacRedirectToDispatcherFlow(BigInteger dpId, String dstMacAddress,
             String displayName, long elanTag) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE }));
-        matches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { dstMacAddress }));
+        matches.add(new MatchMetadata(getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
+        matches.add(new MatchEthernetDestination(new MacAddress(dstMacAddress)));
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actions = new ArrayList<>();
         actions.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
@@ -2062,9 +2062,8 @@ public class ElanUtils {
     public static FlowEntity buildDmacRedirectToDispatcherFlowMacNoActions(BigInteger dpId, String dstMacAddress,
             String displayName, long elanTag) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE }));
-        matches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { dstMacAddress }));
+        matches.add(new MatchMetadata(getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
+        matches.add(new MatchEthernetDestination(new MacAddress(dstMacAddress)));
 
         String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, dstMacAddress, elanTag);
         FlowEntity flow  = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 20, displayName, 0, 0,
index aa767f32545e59ec55bc90f2ed9445ee73c61891..9ab9607686409146021adcda6a768dfbdb01aa8d 100644 (file)
@@ -24,13 +24,17 @@ import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionPopMpls;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
@@ -144,15 +148,12 @@ public class FibRpcServiceImpl implements FibRpcService {
         }
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
 
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         if(prefixLength != 0) {
-            matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[] {
-                    destPrefix.getHostAddress(), Integer.toString(prefixLength) }));
+            matches.add(new MatchIpv4Destination(destPrefix.getHostAddress(), Integer.toString(prefixLength)));
         }
 
         String flowRef = getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, vpnId, ipAddress);
@@ -170,9 +171,8 @@ public class FibRpcServiceImpl implements FibRpcService {
 
     private void removeLFibTableEntry(BigInteger dpnId, long serviceId) {
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x8847L }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         String flowRef = getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, serviceId, "");
 
@@ -191,7 +191,7 @@ public class FibRpcServiceImpl implements FibRpcService {
         LOG.info("remove terminatingServiceActions called with DpnId = {} and label = {}", dpnId , serviceId);
         List<MatchInfo> mkMatches = new ArrayList<MatchInfo>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""),
                 5, String.format("%s:%d","TST Flow Entry ",serviceId), 0, 0,
@@ -205,7 +205,7 @@ public class FibRpcServiceImpl implements FibRpcService {
 
         LOG.info("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", dpnId , serviceId);
 
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
 
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d","TST Flow Entry ",serviceId),
@@ -233,15 +233,12 @@ public class FibRpcServiceImpl implements FibRpcService {
         }
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
 
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         if(prefixLength != 0) {
-            matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[] {
-                    destPrefix.getHostAddress(), Integer.toString(prefixLength) }));
+            matches.add(new MatchIpv4Destination(destPrefix.getHostAddress(), Integer.toString(prefixLength)));
         }
 
         String flowRef = getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, vpnId, ipAddress);
@@ -259,9 +256,8 @@ public class FibRpcServiceImpl implements FibRpcService {
 
     private void makeLFibTableEntry(BigInteger dpId, long serviceId, List<Instruction> customInstructions) {
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x8847L }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         List<Instruction> instructions = new ArrayList<Instruction>();
         List<ActionInfo> actionsInfos = new ArrayList<ActionInfo>();
index e7de7211bf6f558bcebe1459a843bf7ff14d85df..8d76ff96faa5d901265c2152f68b2cf91c807684 100755 (executable)
@@ -36,7 +36,6 @@ import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -57,6 +56,14 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv4;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.genius.utils.batching.ActionableResource;
@@ -65,15 +72,14 @@ import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
 import org.opendaylight.genius.utils.batching.ResourceHandler;
 import org.opendaylight.genius.utils.batching.SubTransaction;
 import org.opendaylight.genius.utils.batching.SubTransactionImpl;
-import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.fibmanager.NexthopManager.AdjacencyResult;
 import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
 import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
 import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache;
 import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite;
 import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -109,14 +115,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev15033
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthop;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3nexthop.rev150409.l3nexthop.vpnnexthops.VpnNexthopBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.Adjacencies;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.PrefixToInterface;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInstanceOpData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnToExtraroute;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.VpnIdsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntryKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList;
@@ -712,13 +714,11 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
         int prefixLength = (values.length == 1) ? 0 : Integer.parseInt(values[1]);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] { MetaDataUtil.getVpnIdMetadata(vpnTag),
-                                                                              MetaDataUtil.METADATA_MASK_VRFID }));
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_IPV4 }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnTag), MetaDataUtil.METADATA_MASK_VRFID));
+        matches.add(MatchEthernetType.IPV4);
 
         if (prefixLength != 0) {
-            matches.add(new MatchInfo(MatchFieldType.ipv4_destination,
-                                      new String[] { destPrefixIpAddress, Integer.toString(prefixLength) }));
+            matches.add(new MatchIpv4Destination(destPrefixIpAddress, Integer.toString(prefixLength)));
         }
 
         int priority = DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
@@ -945,7 +945,7 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
 
         // Matching metadata
         // FIXME vxlan vni bit set is not working properly with OVS.need to revisit
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(label)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
 
         List<InstructionInfo> mkInstructions = new ArrayList<>();
         mkInstructions.add(new InstructionApplyActions(actionsInfos));
@@ -970,7 +970,7 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
         LOG.debug("remove terminatingServiceActions called with DpnId = {} and label = {}", dpId , label);
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(label)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
         flowEntity = MDSALUtil.buildFlowEntity(dpId,
                 NwConstants.INTERNAL_TUNNEL_TABLE,
                 getTableMissFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int)label),
@@ -1615,22 +1615,17 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
 
         List<MatchInfo> matches = new ArrayList<>();
 
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         if (destPrefix instanceof Inet4Address) {
-            matches.add(new MatchInfo(MatchFieldType.eth_type,
-                    new long[] { NwConstants.ETHTYPE_IPV4 }));
+            matches.add(MatchEthernetType.IPV4);
             if(prefixLength != 0) {
-                matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[] {
-                        destPrefix.getHostAddress(), Integer.toString(prefixLength)}));
+                matches.add(new MatchIpv4Destination(destPrefix.getHostAddress(), Integer.toString(prefixLength)));
             }
         } else {
-            matches.add(new MatchInfo(MatchFieldType.eth_type,
-                    new long[] { NwConstants.ETHTYPE_IPV6 }));
+            matches.add(MatchEthernetType.IPV6);
             if(prefixLength != 0) {
-                matches.add(new MatchInfo(MatchFieldType.ipv6_destination, new String[] {
-                        destPrefix.getHostAddress() + "/" + Integer.toString(prefixLength)}));
+                matches.add(new MatchIpv6Destination(destPrefix.getHostAddress() + "/" + prefixLength));
             }
         }
 
@@ -1689,9 +1684,8 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
         }
 
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_MPLS_UC }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(label)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(label));
 
         // Install the flow entry in L3_LFIB_TABLE
         String flowRef = getFlowRef(dpId, NwConstants.L3_LFIB_TABLE, label, priority);
@@ -2135,8 +2129,7 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionGotoTable(NwConstants.L3_LFIB_TABLE));
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_MPLS_UC }));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
         FlowEntity flowEntityToLfib = MDSALUtil.buildFlowEntity(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE,
                 getTableMissFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE,
                         NwConstants.L3_LFIB_TABLE),
@@ -2246,12 +2239,11 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
 
         List<MatchInfo> matches = new ArrayList<>();
 
-        matches.add(new MatchInfo(MatchFieldType.ip_proto, new long[] { IPProtocols.ICMP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
-        matches.add(new MatchInfo(MatchFieldType.icmp_v4, new long[] { (short) 8, (short) 0 }));
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_IPV4 }));
-        matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[] { subSplit[0], "32" }));
+        matches.add(MatchIpProtocol.ICMP);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
+        matches.add(new MatchIcmpv4((short) 8, (short) 0));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchIpv4Destination(subSplit[0], "32"));
 
         List<ActionInfo> actionsInfos = new ArrayList<>();
 
index f9ca1ded9d1c6d83b037dfb4ed16242d95931c14..7adebfafbff7a4526f12ebfa9b13e911b54636c6 100644 (file)
@@ -28,14 +28,17 @@ import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionPuntToController;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv6NdTarget;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
@@ -302,29 +305,20 @@ public class Ipv6ServiceUtils {
 
     private static List<MatchInfo> getIcmpv6RSMatch(Long elanTag) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.IPV6ICMP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.icmp_v6,
-                new long[] { Ipv6Constants.ICMP_V6_RS_CODE, 0}));
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { ElanUtils.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE}));
+        matches.add(MatchEthernetType.IPV6);
+        matches.add(MatchIpProtocol.ICMPV6);
+        matches.add(new MatchIcmpv6(Ipv6Constants.ICMP_V6_RS_CODE, (short) 0));
+        matches.add(new MatchMetadata(ElanUtils.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
         return matches;
     }
 
     private List<MatchInfo> getIcmpv6NSMatch(Long elanTag, String ndTarget) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_IPV6 }));
-        matches.add(new MatchInfo(MatchFieldType.ip_proto,
-                new long[] { IPProtocols.IPV6ICMP.intValue() }));
-        matches.add(new MatchInfo(MatchFieldType.icmp_v6,
-                new long[] { Ipv6Constants.ICMP_V6_NS_CODE, 0}));
-        matches.add(new MatchInfo(MatchFieldType.ipv6_nd_target,
-                new String[] { ndTarget }));
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { ElanUtils.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE}));
+        matches.add(MatchEthernetType.IPV6);
+        matches.add(MatchIpProtocol.ICMPV6);
+        matches.add(new MatchIcmpv6(Ipv6Constants.ICMP_V6_NS_CODE, (short) 0));
+        matches.add(new MatchIpv6NdTarget(new Ipv6Address(ndTarget)));
+        matches.add(new MatchMetadata(ElanUtils.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
         return matches;
     }
 
index f4c1b5d7214df2d614a2b9d022919ddaedd76a9c..7fe7ab6942a9b42890cc4b70ebb2cd6d6cb45a68 100644 (file)
@@ -19,12 +19,13 @@ import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList;
@@ -162,16 +163,14 @@ public class ExternalNetworkListener extends AsyncDataTreeChangeListenerBase<Net
         }
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         //add match for default route "0.0.0.0/0"
         //matches.add(new MatchInfo(MatchFieldType.ipv4_src, new long[] {
         //        NatUtil.getIpAddress(defaultIP.getAddress()), 0 }));
 
         //add match for vrfid
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionGotoTable(NwConstants.PSNAT_TABLE));
index 6714f6c0b10dbd2fcf09d5802986ffeb3584029c..d8d6e67730dda8424138d4adb93ef0ed94eeb0f9 100644 (file)
@@ -36,7 +36,6 @@ import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.GroupEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -50,6 +49,11 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
 import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
@@ -618,10 +622,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
     protected FlowEntity buildOutboundFlowEntity(BigInteger dpId, long routerId) {
         LOG.debug("NAT Service : buildOutboundFlowEntity called for dpId {} and routerId{}", dpId, routerId);
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
@@ -712,10 +714,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         LOG.debug("NAT Service : buildSnatFlowEntity is called for dpId {}, routerName {} and groupId {}", dpId, routerName, groupId );
         long routerId = NatUtil.getVpnId(dataBroker, routerName);
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
 
 
         List<InstructionInfo> instructions = new ArrayList<>();
@@ -740,10 +740,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 routerName );
         long routerId = NatUtil.getVpnId(dataBroker, routerName);
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
         instructions.add(new InstructionGotoTable(NwConstants.OUTBOUND_NAPT_TABLE));
@@ -769,9 +767,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         BigInteger routerId = BigInteger.valueOf (NatUtil.getVpnId(dataBroker, routerName));
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.tunnel_id, new  BigInteger[] {routerId }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchTunnelId(routerId));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()),
@@ -911,10 +908,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         LOG.debug("NAT Service : buildNaptPfibFlowEntity is called for dpId {}, segmentId {}", dpId, segmentId );
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID));
 
         ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
         ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
@@ -1036,9 +1031,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
     private void makeLFibTableEntry(BigInteger dpId, long serviceId, short tableId) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[]{0x8847L}));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         List<Instruction> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
@@ -1064,7 +1058,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         LOG.debug("NAT Service : Create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", dpnId , serviceId);
 
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
 
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d", "TST Flow Entry ", serviceId),
@@ -2019,7 +2013,7 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         LOG.info("NAT Service : remove terminatingServiceActions called with DpnId = {} and label = {}", dpnId , serviceId);
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""),
                 5, String.format("%s:%d","TST Flow Entry ",serviceId), 0, 0,
@@ -2030,9 +2024,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
     private void removeLFibTableEntry(BigInteger dpnId, long serviceId) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x8847L }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         String flowRef = getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, serviceId, "");
 
@@ -2235,10 +2228,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         LOG.debug("NAT Service : buildSnatFlowEntity is called for dpId {}, routerName {} groupId {} changed VPN ID {}", dpId, routerName, groupId, changedVpnId );
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfo = new ArrayList<>();
@@ -2260,10 +2251,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         LOG.debug("NAT Service : buildSnatFlowEntity is called for dpId {}, routerName {} changed VPN ID {}", dpId, routerName, changedVpnId );
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
         instructions.add(new InstructionGotoTable(NwConstants.OUTBOUND_NAPT_TABLE));
@@ -2290,9 +2279,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         BigInteger routerId = BigInteger.valueOf (NatUtil.getVpnId(dataBroker, routerName));
         BigInteger bgpVpnIdAsBigInt = BigInteger.valueOf(changedVpnId);
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.tunnel_id, new  BigInteger[] {bgpVpnIdAsBigInt }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchTunnelId(bgpVpnIdAsBigInt));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId),
@@ -2315,10 +2303,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
     protected FlowEntity buildOutboundFlowEntityWithBgpVpn(BigInteger dpId, long routerId, long changedVpnId) {
         LOG.debug("NAT Service : buildOutboundFlowEntityWithBgpVpn called for dpId {} and routerId {}, BGP VPN ID {}", dpId, routerId, changedVpnId);
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[]{0x0800L}));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[]{
-                MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID}));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
@@ -2340,10 +2326,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 externalIp);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_IPV4 }));
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { MetaDataUtil.getVpnIdMetadata(extVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
-        matches.add(new MatchInfo(MatchFieldType.ipv4_source, new String[] { externalIp , "32" }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(extVpnId), MetaDataUtil.METADATA_MASK_VRFID));
+        matches.add(new MatchIpv4Source(externalIp , "32"));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
@@ -2369,10 +2354,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
 
         LOG.debug("NAT Service : buildNaptPfibFlowEntityWithUpdatedVpnId is called for dpId {}, segmentId {}, BGP VPN ID {}", dpId, segmentId, changedVpnId);
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         ArrayList<ActionInfo> listActionInfo = new ArrayList<>();
         ArrayList<InstructionInfo> instructionInfo = new ArrayList<>();
index 1737a58e1c22c98a786721cbe89fa5377831345b..5af753458107a5fc86cc1889ebce30cca9cfccee 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
@@ -30,6 +29,10 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.FloatingIpInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts;
@@ -134,12 +137,12 @@ public class FloatingIPListener extends AsyncDataTreeChangeListenerBase<Internal
         LOG.debug("NAT Service : Segment id {} in build preDNAT Flow", segmentId);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[]{0x0800L}));
+        matches.add(MatchEthernetType.IPV4);
 
-        matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[]{externalIp, "32"}));
+        matches.add(new MatchIpv4Destination(externalIp, "32"));
 
-//        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-//                BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+//        matches.add(new MatchMetadata(
+//                BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
         List<ActionInfo> actionsInfos = new ArrayList<>();
         actionsInfos.add(new ActionSetDestinationIp(internalIp, "32"));
 
@@ -168,12 +171,11 @@ public class FloatingIPListener extends AsyncDataTreeChangeListenerBase<Internal
         LOG.debug("NAT Service : Segment id {} in build DNAT", segmentId);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID));
 
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
-        matches.add(new MatchInfo(MatchFieldType.ipv4_destination, new String[] { internalIp, "32" }));
+        matches.add(new MatchIpv4Destination(internalIp, "32"));
 
         List<ActionInfo> actionsInfos = new ArrayList<>();
 //        actionsInfos.add(new ActionSetDestinationIp(internalIp, "32"));
@@ -205,12 +207,11 @@ public class FloatingIPListener extends AsyncDataTreeChangeListenerBase<Internal
         LOG.debug("NAT Service : Segment id {} in build preSNAT flow", segmentId);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
-        matches.add(new MatchInfo(MatchFieldType.ipv4_source, new String[] { internalIp, "32" }));
+        matches.add(new MatchIpv4Source(internalIp, "32"));
 
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<ActionInfo> actionsInfos = new ArrayList<>();
         actionsInfos.add(new ActionSetSourceIp(externalIp, "32"));
@@ -244,12 +245,11 @@ public class FloatingIPListener extends AsyncDataTreeChangeListenerBase<Internal
         }
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
-        matches.add(new MatchInfo(MatchFieldType.ipv4_source, new String[] { externalIp, "32" }));
+        matches.add(new MatchIpv4Source(externalIp, "32"));
 
         List<ActionInfo> actionsInfo = new ArrayList<>();
         List<InstructionInfo> instructions = new ArrayList<InstructionInfo>();
index e3e011cf1ffdcdc4c75f0a3c49669f335059bcf1..31593ade7c998431867b6720ed6e854268514dad 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -43,8 +42,16 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpProtocol;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination;
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpDestinationPort;
+import org.opendaylight.genius.mdsalutil.matches.MatchTcpSourcePort;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort;
+import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort;
 import org.opendaylight.genius.mdsalutil.packet.Ethernet;
-import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
 import org.opendaylight.genius.mdsalutil.packet.IPv4;
 import org.opendaylight.genius.mdsalutil.packet.TCP;
 import org.opendaylight.genius.mdsalutil.packet.UDP;
@@ -311,29 +318,28 @@ public class NaptEventHandler {
 
         MatchInfo metaDataMatchInfo = null;
         if(tableId == NwConstants.OUTBOUND_NAPT_TABLE){
-            ipMatchInfo = new MatchInfo(MatchFieldType.ipv4_source, new String[] {ipAddressAsString, "32" });
+            ipMatchInfo = new MatchIpv4Source(ipAddressAsString, "32");
             if(protocol == NAPTEntryEvent.Protocol.TCP) {
-                protocolMatchInfo = new MatchInfo(MatchFieldType.ip_proto, new long[] {IPProtocols.TCP.intValue()});
-                portMatchInfo = new MatchInfo(MatchFieldType.tcp_src, new long[]{port});
+                protocolMatchInfo = MatchIpProtocol.TCP;
+                portMatchInfo = new MatchTcpSourcePort(port);
             } else if(protocol == NAPTEntryEvent.Protocol.UDP) {
-                protocolMatchInfo = new MatchInfo(MatchFieldType.ip_proto, new long[] {IPProtocols.UDP.intValue()});
-                portMatchInfo = new MatchInfo(MatchFieldType.udp_src, new long[]{port});
+                protocolMatchInfo = MatchIpProtocol.UDP;
+                portMatchInfo = new MatchUdpSourcePort(port);
             }
-            metaDataMatchInfo = new MatchInfo(MatchFieldType.metadata,
-                    new BigInteger[] { MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID });
+            metaDataMatchInfo =
+                    new MatchMetadata(MetaDataUtil.getVpnIdMetadata(segmentId), MetaDataUtil.METADATA_MASK_VRFID);
         }else{
-            ipMatchInfo = new MatchInfo(MatchFieldType.ipv4_destination, new String[] {ipAddressAsString, "32" });
+            ipMatchInfo = new MatchIpv4Destination(ipAddressAsString, "32");
             if(protocol == NAPTEntryEvent.Protocol.TCP) {
-                protocolMatchInfo = new MatchInfo(MatchFieldType.ip_proto, new long[] {IPProtocols.TCP.intValue()});
-                portMatchInfo = new MatchInfo(MatchFieldType.tcp_dst, new long[]{port});
+                protocolMatchInfo = MatchIpProtocol.TCP;
+                portMatchInfo = new MatchTcpDestinationPort(port);
             } else if(protocol == NAPTEntryEvent.Protocol.UDP) {
-                protocolMatchInfo = new MatchInfo(MatchFieldType.ip_proto, new long[] {IPProtocols.UDP.intValue()});
-                portMatchInfo = new MatchInfo(MatchFieldType.udp_dst, new long[]{port});
+                protocolMatchInfo = new MatchUdpDestinationPort(port);
             }
-            //metaDataMatchInfo = new MatchInfo(MatchFieldType.metadata, new BigInteger[]{BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID});
+            //metaDataMatchInfo = new MatchMetadata(BigInteger.valueOf(vpnId), MetaDataUtil.METADATA_MASK_VRFID);
         }
         ArrayList<MatchInfo> matchInfo = new ArrayList<>();
-        matchInfo.add(new MatchInfo(MatchFieldType.eth_type, new long[] { 0x0800L }));
+        matchInfo.add(MatchEthernetType.IPV4);
         matchInfo.add(ipMatchInfo);
         matchInfo.add(protocolMatchInfo);
         matchInfo.add(portMatchInfo);
index 9125766ceb8e91fae58fefb25b090311b051e2fa..93679851bf431292b1d184b340750d989d58c9dc 100644 (file)
@@ -9,13 +9,20 @@ package org.opendaylight.netvirt.natservice.internal;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.Sets;
-
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.BucketInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.GroupEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
@@ -25,11 +32,11 @@ import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
+import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
@@ -68,14 +75,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.HashMap;
-
 public class NaptSwitchHA {
     private static final Logger LOG = LoggerFactory.getLogger(NaptSwitchHA.class);
     private final DataBroker dataBroker;
@@ -697,10 +696,8 @@ public class NaptSwitchHA {
 
         FlowEntity flowEntity;
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[]{ 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
 
@@ -728,10 +725,8 @@ public class NaptSwitchHA {
 
         FlowEntity flowEntity;
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[]{ 0x0800L }));
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(MatchEthernetType.IPV4);
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
 
index a5aac39622ec3c94e42f7bd07c209262b4725891..3c61c17763caafc095926f30b907e4426873738b 100644 (file)
@@ -15,13 +15,14 @@ import java.util.List;
 
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,16 +48,14 @@ public class SNATDefaultRouteProgrammer {
         }
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         //add match for default route "0.0.0.0/0"
 //        matches.add(new MatchInfo(MatchFieldType.ipv4_dst, new long[] {
 //                NatUtil.getIpAddress(defaultIP.getAddress()), 0 }));
 
         //add match for vrfid
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionGotoTable(NwConstants.PSNAT_TABLE));
@@ -85,16 +84,14 @@ public class SNATDefaultRouteProgrammer {
         }
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         //add match for default route "0.0.0.0/0"
 //        matches.add(new MatchInfo(MatchFieldType.ipv4_dst, new long[] {
 //                NatUtil.getIpAddress(defaultIP.getAddress()), 0 }));
 
         //add match for vrfid
-        matches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(bgpVpnId), MetaDataUtil.METADATA_MASK_VRFID }));
+        matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(bgpVpnId), MetaDataUtil.METADATA_MASK_VRFID));
 
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionGotoTable(NwConstants.PSNAT_TABLE));
index b4f8bd52a0d076650e5694c5bc6f75ee75d38673..075f2b72c0f4b5336b6451a3239b76df76bdebca 100644 (file)
@@ -25,7 +25,6 @@ import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.ActionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
@@ -33,6 +32,9 @@ import org.opendaylight.genius.mdsalutil.actions.ActionPopMpls;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel;
+import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
@@ -289,7 +291,7 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
         LOG.info("remove terminatingServiceActions called with DpnId = {} and label = {}", dpnId , serviceId);
         List<MatchInfo> mkMatches = new ArrayList<>();
         // Matching metadata
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""),
                 5, String.format("%s:%d","TST Flow Entry ",serviceId), 0, 0,
@@ -303,7 +305,7 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
 
         LOG.info("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", dpnId , serviceId);
 
-        mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {BigInteger.valueOf(serviceId)}));
+        mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
 
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5,
@@ -315,9 +317,8 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
 
     private void makeLFibTableEntry(BigInteger dpId, long serviceId, short tableId) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x8847L }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         List<Instruction> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
@@ -340,9 +341,8 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
 
     private void removeLFibTableEntry(BigInteger dpnId, long serviceId) {
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                                  new long[] { 0x8847L }));
-        matches.add(new MatchInfo(MatchFieldType.mpls_label, new String[]{Long.toString(serviceId)}));
+        matches.add(MatchEthernetType.MPLS_UNICAST);
+        matches.add(new MatchMplsLabel(serviceId));
 
         String flowRef = getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, serviceId, "");
 
index 033fff390fd8402bfb02679a01ef8516116a5cea..0b96169144881a5ce612a3fe87b78cc7de5589f6 100644 (file)
@@ -31,12 +31,12 @@ import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.GroupEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
 import org.opendaylight.genius.mdsalutil.actions.ActionOutput;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.natservice.internal.ExternalNetworksChangeListener;
 import org.opendaylight.netvirt.natservice.internal.ExternalRoutersListener;
@@ -113,8 +113,7 @@ public class ExternalNetworksChangeListenerTest {
         bucketInfo.add(1, bucketSecondary);
 
         List<MatchInfo> matches = new ArrayList<>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { 0x0800L }));
+        matches.add(MatchEthernetType.IPV4);
 
         List<InstructionInfo> instructions = new ArrayList<>();
         List<ActionInfo> actionsInfos = new ArrayList<>();
index 86d264a09c52e22d99e153941b8541669b10ada6..a51a9a756990a40722719fcb0d356ed1650af6b0 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.genius.mdsalutil.BucketInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
@@ -30,6 +29,8 @@ import org.opendaylight.genius.mdsalutil.actions.ActionPuntToController;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchArpOp;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
 import org.opendaylight.netvirt.vpnmanager.arp.responder.ArpResponderConstant;
 import org.opendaylight.netvirt.vpnmanager.arp.responder.ArpResponderUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
@@ -188,8 +189,8 @@ public class VpnNodeListener extends AsyncClusteredDataTreeChangeListenerBase<No
                 ArpResponderConstant.GROUP_FLOW_NAME.value(), buckets);
 
         final List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_ARP }));
-        matches.add(new MatchInfo(MatchFieldType.arp_op, new long[] {NwConstants.ARP_REQUEST}));
+        matches.add(MatchEthernetType.ARP);
+        matches.add(MatchArpOp.REQUEST);
         final List<ActionInfo> actionInfos = Collections.singletonList(
             new ActionGroup(ArpResponderUtil.retrieveStandardArpResponderGroupId(idManagerService)));
         final List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionInfos));
@@ -202,8 +203,8 @@ public class VpnNodeListener extends AsyncClusteredDataTreeChangeListenerBase<No
 
     private void createArpResponseMatchFlowForGwMacTable(WriteTransaction writeFlowTx, BigInteger dpId) {
         List<MatchInfo> matches = new ArrayList<MatchInfo>();
-        matches.add(new MatchInfo(MatchFieldType.eth_type, new long[] { NwConstants.ETHTYPE_ARP }));
-        matches.add(new MatchInfo(MatchFieldType.arp_op, new long[] {NwConstants.ARP_REPLY}));
+        matches.add(MatchEthernetType.ARP);
+        matches.add(MatchArpOp.REPLY);
         List<ActionInfo> actionsInfos = new ArrayList<>();
         actionsInfos.add(new ActionPuntToController());
         actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
index b368ceadb1a41eb81b87c2ee91bdc700a3d34364..83c0f8d7dd6f136fcac7c53067458d730886e1b6 100755 (executable)
@@ -28,12 +28,13 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.InstructionInfo;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.genius.utils.cache.DataStoreCache;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
@@ -52,6 +53,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
@@ -1167,9 +1169,8 @@ public class VpnUtil {
 
     public static FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId) {
         List<MatchInfo> mkMatches = new ArrayList<MatchInfo>();
-        mkMatches.add(new MatchInfo(MatchFieldType.metadata, new BigInteger[] {
-                MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID }));
-        mkMatches.add(new MatchInfo(MatchFieldType.eth_dst, new String[] { gwMacAddress }));
+        mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
+        mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
         List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
         mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
         String flowId = getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
index 6c23f5b767747e653776fe16a58a7eaa00cc8cc8..057d2afa874705796c877c092a0dcedf82345f40 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.genius.mdsalutil.BucketInfo;
 import org.opendaylight.genius.mdsalutil.FlowEntity;
 import org.opendaylight.genius.mdsalutil.GroupEntity;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -40,6 +39,10 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchArpOp;
+import org.opendaylight.genius.mdsalutil.matches.MatchArpTpa;
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetType;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.netvirt.vpnmanager.ArpReplyOrRequest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
@@ -190,14 +193,10 @@ public class ArpResponderUtil {
                         MetaDataUtil.METADATA_MASK_VRFID);
 
         // Matching Arp request flows
-        matches.add(new MatchInfo(MatchFieldType.eth_type,
-                new long[] { NwConstants.ETHTYPE_ARP }));
-        matches.add(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] { metadata, metadataMask }));
-        matches.add(new MatchInfo(MatchFieldType.arp_op,
-                new long[] { ArpReplyOrRequest.REQUEST.getArpOperation() }));
-        matches.add(new MatchInfo(MatchFieldType.arp_tpa,
-                new String[] { ipAddress, "32" }));
+        matches.add(MatchEthernetType.ARP);
+        matches.add(new MatchMetadata(metadata, metadataMask));
+        matches.add(MatchArpOp.REQUEST);
+        matches.add(new MatchArpTpa(ipAddress, "32"));
         return matches;
 
     }
index 7ce8af50eb0ea0e7d2e49675ce94f5104a70d51f..e0e731b45bdd9751645dc862fd814a181b17dba7 100755 (executable)
@@ -12,11 +12,11 @@ import com.google.common.base.Preconditions;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.genius.mdsalutil.MatchFieldType;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.genius.mdsalutil.matches.MatchMetadata;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
@@ -234,11 +234,10 @@ public class InterVpnLinkUtil {
      */
     public static Flow buildLPortDispatcherFlow(String interVpnLinkName, long vpnId, int lportTag) {
         LOG.info("Inter-vpn-link : buildLPortDispatcherFlow. vpnId {}   lportTag {} ", vpnId, lportTag);
-        List<MatchInfo> matches = Arrays.asList(new MatchInfo(MatchFieldType.metadata,
-                new BigInteger[] {
+        List<MatchInfo> matches = Collections.singletonList(new MatchMetadata(
                         MetaDataUtil.getMetaDataForLPortDispatcher(lportTag,
                                 ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX)),
-                        MetaDataUtil.getMetaDataMaskForLPortDispatcher() }));
+                        MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
         String flowRef = getLportDispatcherFlowRef(interVpnLinkName, lportTag);
         Flow lPortDispatcherFlow = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef,
                 VpnConstants.DEFAULT_LPORT_DISPATCHER_FLOW_PRIORITY, flowRef,