Implement remote ACL indirection table
[netvirt.git] / vpnservice / aclservice / impl / src / test / java / org / opendaylight / netvirt / aclservice / tests / FlowEntryObjectsBase.xtend
index 8cd92a83944a16816af3169306558415b7ef3338..ddb6719738f65834af60afe709ce7fb16e87050b 100644 (file)
@@ -10,10 +10,14 @@ package org.opendaylight.netvirt.aclservice.tests
 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.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.MatchIpv4Destination
+import org.opendaylight.genius.mdsalutil.matches.MatchIpv4Source
 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
@@ -1145,6 +1149,81 @@ class FlowEntryObjectsBase {
         ]
     }
 
+    protected def remoteFlows() {
+        remoteIngressFlowsPort1
+        + remoteIngressFlowsPort1
+        + remoteIngressFlowsPort1
+        + remoteEgressFlowsPort1
+        + remoteEgressFlowsPort1
+        + remoteEgressFlowsPort1
+        + remoteIngressFlowsPort2
+        + remoteIngressFlowsPort2
+        + remoteEgressFlowsPort2
+        + remoteEgressFlowsPort2
+    }
+
+    protected def remoteIngressFlowsPort1() {
+        #[
+            remoteIngressFlowsPort("10.0.0.1")
+         ]
+    }
+
+    protected def remoteIngressFlowsPort2() {
+        #[
+            remoteIngressFlowsPort("10.0.0.2")
+         ]
+    }
+
+    protected def remoteEgressFlowsPort1() {
+        #[
+            remoteEgressFlowsPort("10.0.0.1")
+         ]
+    }
+
+    protected def remoteEgressFlowsPort2() {
+        #[
+            remoteEgressFlowsPort("10.0.0.2")
+         ]
+    }
+
+    protected def remoteIngressFlowsPort(String ip) {
+        new FlowEntity(123bi) => [
+            cookie = 110100480bi
+            flowId = "Acl_Filter_Ingress_" + ip + "/32_5000"
+            flowName = "ACL"
+            instructionInfoList = #[
+                new InstructionWriteMetadata(2bi, 16777214bi),
+                new InstructionGotoTable(213 as short)
+            ]
+            matchInfoList = #[
+                new MatchMetadata(83886080000bi, 1099494850560bi),
+                new MatchEthernetType(2048L),
+                new MatchIpv4Destination(ip, "32")
+            ]
+            priority = 50
+            tableId = 212 as short
+        ]
+    }
+
+    protected def remoteEgressFlowsPort(String ip) {
+        new FlowEntity(123bi) => [
+            cookie = 110100480bi
+            flowId = "Acl_Filter_Egress_" + ip + "/32_5000"
+            flowName = "ACL"
+            instructionInfoList = #[
+                new InstructionWriteMetadata(2bi, 16777214bi),
+                new InstructionGotoTable(243 as short)
+            ]
+            matchInfoList = #[
+                new MatchMetadata(83886080000bi, 1099494850560bi),
+                new MatchEthernetType(2048L),
+                new MatchIpv4Source(ip, "32")
+            ]
+            priority = 50
+            tableId = 242 as short
+        ]
+    }
+
     protected def expectedFlows(String mac) {
         // Code auto. generated by https://github.com/vorburger/xtendbeans
         #[
@@ -1394,6 +1473,23 @@ class FlowEntryObjectsBase {
                 ]
                 priority = 63010
                 tableId = 211 as short
+            ],
+            new FlowEntity(123bi) => [
+                cookie = 110100480bi
+                flowId = "Egress_ARP_123_987_" + mac
+                flowName = "ACL"
+                instructionInfoList = #[
+                    new InstructionApplyActions(#[
+                        new ActionNxResubmit
+                    ])
+                ]
+                matchInfoList = #[
+                    new MatchEthernetType(2054L),
+                    new MatchArpSha(new MacAddress(mac)),
+                    new MatchMetadata(1085217976614912bi, 1152920405095219200bi)
+                ]
+                priority = 63010
+                tableId = 211 as short
             ]
         ]
     }