Bug 8981: ACL: ARP/DHCP anti-spoofing flows does not include VM/AAP ip/mac
[netvirt.git] / vpnservice / aclservice / impl / src / test / java / org / opendaylight / netvirt / aclservice / tests / FlowEntryObjectsBase.xtend
index 63ab3bcc9ac7f746b1d223bbf51d4deb83abb179..ec1f65521cc97604cd792e6e420a9343d5a8f679 100644 (file)
@@ -7,24 +7,29 @@
  */
 package org.opendaylight.netvirt.aclservice.tests
 
+import org.opendaylight.genius.mdsalutil.FlowEntityBuilder
+import org.opendaylight.genius.mdsalutil.MetaDataUtil
 import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit
-import org.opendaylight.genius.mdsalutil.FlowEntity
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions
-import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable
+import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata
 import org.opendaylight.genius.mdsalutil.matches.MatchArpSha
+import org.opendaylight.genius.mdsalutil.matches.MatchArpSpa
+import org.opendaylight.genius.mdsalutil.matches.MatchEthernetSource
 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.MatchMetadata
 import org.opendaylight.genius.mdsalutil.matches.MatchUdpDestinationPort
 import org.opendaylight.genius.mdsalutil.matches.MatchUdpSourcePort
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress
 import org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix
+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.openflowjava.nx.match.rev140421.NxmNxReg6
-import org.opendaylight.genius.mdsalutil.MetaDataUtil
-import org.opendaylight.genius.mdsalutil.matches.MatchMetadata
+
+import static extension org.opendaylight.mdsal.binding.testutils.XtendBuilderExtensions.operator_doubleGreaterThan
 
 class FlowEntryObjectsBase {
 
@@ -34,15 +39,16 @@ class FlowEntryObjectsBase {
 
     protected def fixedIngressFlowsPort1() {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v4123_987__Permit_"
-            flowName = "ACL"
-            instructionInfoList = #[
-                new InstructionApplyActions(#[
-                    new ActionNxResubmit(220 as short)
-                    ])
-                ]
+                flowName = "ACL"
+                instructionInfoList = #[
+                    new InstructionApplyActions(#[
+                        new ActionNxResubmit(220 as short)
+                        ])
+                    ]
                 matchInfoList = #[
                     new MatchEthernetType(2048L),
                     new MatchIpProtocol(17 as short),
@@ -53,7 +59,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v6_123_987___Permit_"
             flowName = "ACL"
@@ -72,7 +79,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_130_Permit_"
             flowName = "ACL"
@@ -90,7 +98,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_135_Permit_"
             flowName = "ACL"
@@ -108,7 +117,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_136_Permit_"
             flowName = "ACL"
@@ -126,7 +136,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ARP_123_987"
             flowName = "ACL"
@@ -149,9 +160,10 @@ class FlowEntryObjectsBase {
      protected def fixedEgressFlowsPort1() {
         #[
 
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v4123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v4123_987_0D:AA:D8:42:30:F3_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -163,14 +175,16 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(67),
                     new MatchUdpSourcePort(68),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F3"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v6_123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v6_123_987_0D:AA:D8:42:30:F3_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -182,12 +196,14 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(547),
                     new MatchUdpSourcePort(546),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F3"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v4123_987__Drop_"
                 flowName = "ACL"
@@ -203,7 +219,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v6_123_987__Drop_"
                 flowName = "ACL"
@@ -219,7 +236,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_134_Drop_"
                 flowName = "ACL"
@@ -234,7 +252,8 @@ class FlowEntryObjectsBase {
                 priority = 63020
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_133_Permit_"
                 flowName = "ACL"
@@ -252,7 +271,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -270,7 +290,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -287,10 +308,17 @@ class FlowEntryObjectsBase {
                 ]
                 priority = 63010
                 tableId = 211 as short
-            ],
-            new FlowEntity(123bi) => [
+            ]
+        ] + fixedEgressArpFlowsPort1
+
+    }
+
+     protected def fixedEgressArpFlowsPort1() {
+        #[
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F3"
+                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F310.0.0.1/32"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -300,18 +328,20 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F3")),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F3")),
+                    new MatchArpSpa(new Ipv4Prefix("10.0.0.1/32")),
                     new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 211 as short
             ]
-        ]
+       ]
     }
 
-
      protected def fixedIngressFlowsPort2() {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v4123_987__Permit_"
                 flowName = "ACL"
@@ -330,7 +360,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v6_123_987___Permit_"
                 flowName = "ACL"
@@ -349,7 +380,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_130_Permit_"
                 flowName = "ACL"
@@ -367,7 +399,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -385,7 +418,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -403,7 +437,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ARP_123_987"
                 flowName = "ACL"
@@ -424,9 +459,10 @@ class FlowEntryObjectsBase {
 
      protected def fixedEgressFlowsPort2 () {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v4123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v4123_987_0D:AA:D8:42:30:F4_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -438,14 +474,16 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(67 as short),
                     new MatchUdpSourcePort(68 as short),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F4"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v6_123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v6_123_987_0D:AA:D8:42:30:F4_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -457,12 +495,14 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(547 as short),
                     new MatchUdpSourcePort(546 as short),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F4"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v4123_987__Drop_"
                 flowName = "ACL"
@@ -478,7 +518,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v6_123_987__Drop_"
                 flowName = "ACL"
@@ -494,7 +535,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_134_Drop_"
                 flowName = "ACL"
@@ -509,7 +551,8 @@ class FlowEntryObjectsBase {
                 priority = 63020
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_133_Permit_"
                 flowName = "ACL"
@@ -527,7 +570,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -545,7 +589,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -562,10 +607,16 @@ class FlowEntryObjectsBase {
                 ]
                 priority = 63010
                 tableId = 211 as short
-            ],
-            new FlowEntity(123bi) => [
+            ]
+        ] + fixedEgressArpFlowsPort2
+    }
+
+    protected def fixedEgressArpFlowsPort2() {
+        #[
+           new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F4"
+                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F410.0.0.2/32"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -575,18 +626,20 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F4")),
+                    new MatchArpSpa(new Ipv4Prefix("10.0.0.2/32")),
                     new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 211 as short
             ]
-        ]
-
+       ]
     }
 
      protected def fixedIngressFlowsPort3() {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v4123_987__Permit_"
                 flowName = "ACL"
@@ -605,7 +658,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v6_123_987___Permit_"
                 flowName = "ACL"
@@ -624,7 +678,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_130_Permit_"
                 flowName = "ACL"
@@ -642,7 +697,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -660,7 +716,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -678,7 +735,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ARP_123_987"
                 flowName = "ACL"
@@ -699,9 +757,10 @@ class FlowEntryObjectsBase {
 
      protected def fixedEgressFlowsPort3 () {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v4123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v4123_987_0D:AA:D8:42:30:F5_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -713,14 +772,16 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(67),
                     new MatchUdpSourcePort(68),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F5"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v6_123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v6_123_987_0D:AA:D8:42:30:F5_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -732,12 +793,14 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(547),
                     new MatchUdpSourcePort(546),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F5"))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v4123_987__Drop_"
                 flowName = "ACL"
@@ -753,7 +816,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v6_123_987__Drop_"
                 flowName = "ACL"
@@ -769,7 +833,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_134_Drop_"
                 flowName = "ACL"
@@ -784,7 +849,8 @@ class FlowEntryObjectsBase {
                 priority = 63020
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_133_Permit_"
                 flowName = "ACL"
@@ -802,7 +868,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -820,7 +887,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -838,9 +906,10 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F5"
+                flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F510.0.0.3/32"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -850,6 +919,8 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F5")),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F5")),
+                    new MatchArpSpa(new Ipv4Prefix("10.0.0.3/32")),
                     new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
@@ -860,7 +931,8 @@ class FlowEntryObjectsBase {
 
     static def fixedIngressFlowsPort4() {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v4123_987__Permit_"
                 flowName = "ACL"
@@ -879,7 +951,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v6_123_987___Permit_"
                 flowName = "ACL"
@@ -898,7 +971,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_130_Permit_"
                 flowName = "ACL"
@@ -916,7 +990,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -934,7 +1009,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -952,7 +1028,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ARP_123_987"
                 flowName = "ACL"
@@ -973,7 +1050,8 @@ class FlowEntryObjectsBase {
 
     static def fixedEgressFlowsPort4 () {
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Client_v4123_987__Permit_"
                 flowName = "ACL"
@@ -992,7 +1070,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Client_v6_123_987__Permit_"
                 flowName = "ACL"
@@ -1011,7 +1090,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v4123_987__Drop_"
                 flowName = "ACL"
@@ -1027,7 +1107,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v6_123_987__Drop_"
                 flowName = "ACL"
@@ -1043,7 +1124,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_134_Drop_"
                 flowName = "ACL"
@@ -1058,7 +1140,8 @@ class FlowEntryObjectsBase {
                 priority = 63020
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_133_Permit_"
                 flowName = "ACL"
@@ -1076,7 +1159,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -1094,7 +1178,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -1112,7 +1197,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F6"
                 flowName = "ACL"
@@ -1124,12 +1210,14 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F6")),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F6")),
                     new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ARP_123_987_0D:AA:D8:42:30:F6"
                 flowName = "ACL"
@@ -1141,6 +1229,7 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress("0D:AA:D8:42:30:F6")),
+                    new MatchEthernetSource(new MacAddress("0D:AA:D8:42:30:F6")),
                     new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
                 ]
                 priority = 63010
@@ -1151,14 +1240,8 @@ class FlowEntryObjectsBase {
 
     protected def remoteFlows() {
         remoteIngressFlowsPort1
-        + remoteIngressFlowsPort1
-        + remoteIngressFlowsPort1
-        + remoteEgressFlowsPort1
-        + remoteEgressFlowsPort1
         + remoteEgressFlowsPort1
         + remoteIngressFlowsPort2
-        + remoteIngressFlowsPort2
-        + remoteEgressFlowsPort2
         + remoteEgressFlowsPort2
     }
 
@@ -1187,9 +1270,10 @@ class FlowEntryObjectsBase {
     }
 
     protected def remoteIngressFlowsPort(String ip) {
-        new FlowEntity(123bi) => [
+        new FlowEntityBuilder >> [
+                dpnId = 123bi
             cookie = 110100480bi
-            flowId = "Acl_Filter_Ingress_" + ip + "/32_5000"
+            flowId = "Acl_Filter_Egress_" + ip + "/32_5000"
             flowName = "ACL"
             instructionInfoList = #[
                 new InstructionWriteMetadata(4bi, 16777214bi),
@@ -1206,9 +1290,10 @@ class FlowEntryObjectsBase {
     }
 
     protected def remoteEgressFlowsPort(String ip) {
-        new FlowEntity(123bi) => [
+        new FlowEntityBuilder >> [
+                dpnId = 123bi
             cookie = 110100480bi
-            flowId = "Acl_Filter_Egress_" + ip + "/32_5000"
+            flowId = "Acl_Filter_Ingress_" + ip + "/32_5000"
             flowName = "ACL"
             instructionInfoList = #[
                 new InstructionWriteMetadata(4bi, 16777214bi),
@@ -1227,7 +1312,8 @@ class FlowEntryObjectsBase {
     protected def expectedFlows(String mac) {
         // Code auto. generated by https://github.com/vorburger/xtendbeans
         #[
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v4123_987__Permit_"
                 flowName = "ACL"
@@ -1246,7 +1332,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_DHCP_Server_v6_123_987___Permit_"
                 flowName = "ACL"
@@ -1265,7 +1352,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_130_Permit_"
                 flowName = "ACL"
@@ -1283,7 +1371,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -1301,7 +1390,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -1319,7 +1409,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Ingress_ARP_123_987"
                 flowName = "ACL"
@@ -1335,9 +1426,10 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 241 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v4123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v4123_987_" + mac + "_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -1349,14 +1441,16 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(67),
                     new MatchUdpSourcePort(68),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress(mac))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
-                flowId = "Egress_DHCP_Client_v6_123_987__Permit_"
+                flowId = "Egress_DHCP_Client_v6_123_987_" + mac + "_Permit_"
                 flowName = "ACL"
                 instructionInfoList = #[
                     new InstructionApplyActions(#[
@@ -1368,12 +1462,14 @@ class FlowEntryObjectsBase {
                     new MatchIpProtocol(17 as short),
                     new MatchUdpDestinationPort(547),
                     new MatchUdpSourcePort(546),
-                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG)
+                    new MatchMetadata(1085217976614912bi, MetaDataUtil.METADATA_MASK_LPORT_TAG),
+                    new MatchEthernetSource(new MacAddress(mac))
                 ]
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v4123_987__Drop_"
                 flowName = "ACL"
@@ -1389,7 +1485,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_DHCP_Server_v6_123_987__Drop_"
                 flowName = "ACL"
@@ -1405,7 +1502,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_134_Drop_"
                 flowName = "ACL"
@@ -1420,7 +1518,8 @@ class FlowEntryObjectsBase {
                 priority = 63020
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_133_Permit_"
                 flowName = "ACL"
@@ -1438,7 +1537,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_135_Permit_"
                 flowName = "ACL"
@@ -1456,7 +1556,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ICMPv6_123_987_136_Permit_"
                 flowName = "ACL"
@@ -1474,7 +1575,8 @@ class FlowEntryObjectsBase {
                 priority = 63010
                 tableId = 211 as short
             ],
-            new FlowEntity(123bi) => [
+            new FlowEntityBuilder >> [
+                dpnId = 123bi
                 cookie = 110100480bi
                 flowId = "Egress_ARP_123_987_" + mac
                 flowName = "ACL"
@@ -1486,6 +1588,7 @@ class FlowEntryObjectsBase {
                 matchInfoList = #[
                     new MatchEthernetType(2054L),
                     new MatchArpSha(new MacAddress(mac)),
+                    new MatchEthernetSource(new MacAddress(mac)),
                     new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
                 ]
                 priority = 63010