Fix: enforce to match VNI for ARP request in broadcast mode

Change-Id: I4dd31866c843f16d527e9d6c25ea1f99946c8990
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/api/Constants.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
index 123cacc..ead7234 100644
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
@@ -84,6 +84,7 @@
     public static final int PRIORITY_ARP_CONTROL_RULE = 40000;
     public static final int PRIORITY_ARP_REPLY_RULE = 40000;
     public static final int PRIORITY_ARP_REQUEST_RULE = 40000;
+    public static final int PRIORITY_ARP_FLOOD_RULE = 39000;
     public static final int PRIORITY_FORCED_ACL_RULE = 50000;
     public static final int PRIORITY_ICMP_PROBE_RULE = 50000;
 
@@ -94,9 +95,10 @@
     public static final int STAT_FLAT_OUTBOUND_TABLE = 10;
     public static final int VTAP_FLAT_OUTBOUND_TABLE = 11;
     public static final int VTAP_FLAT_OUTBOUND_MIRROR_TABLE = 12;
-    public static final int DHCP_ARP_TABLE = 5;
+    public static final int DHCP_TABLE = 5;
     public static final int FLAT_TABLE = 20;
     public static final int VTAG_TABLE = 30;
+    public static final int ARP_TABLE = 35;
     public static final int ACL_TABLE = 40;
     public static final int CT_TABLE = 41;
     public static final int JUMP_TABLE = 50;
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackAddAclCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackAddAclCommand.java
index 1b9a707..45a7658 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackAddAclCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackAddAclCommand.java
@@ -34,7 +34,7 @@
 
 import java.util.Optional;
 
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.OPENSTACK_NETWORKING_APP_ID;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_FORCED_ACL_RULE;
 
@@ -119,7 +119,7 @@
                 sBuilder.build(),
                 treatment,
                 PRIORITY_FORCED_ACL_RULE,
-                DHCP_ARP_TABLE,
+                DHCP_TABLE,
                 true);
     }
 }
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackRemoveAclCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackRemoveAclCommand.java
index cba0c7a..a34fe9e 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackRemoveAclCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackRemoveAclCommand.java
@@ -34,7 +34,7 @@
 
 import java.util.Optional;
 
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.OPENSTACK_NETWORKING_APP_ID;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_FORCED_ACL_RULE;
 
@@ -116,7 +116,7 @@
                 sBuilder.build(),
                 treatment,
                 PRIORITY_FORCED_ACL_RULE,
-                DHCP_ARP_TABLE,
+                DHCP_TABLE,
                 false);
     }
 }
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManager.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManager.java
index a1289c4..6aa0dae 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManager.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManager.java
@@ -200,11 +200,18 @@
     protected void initializePipeline(DeviceId deviceId) {
         // for inbound table transition
         connectTables(deviceId, Constants.STAT_INBOUND_TABLE, Constants.VTAP_INBOUND_TABLE);
-        connectTables(deviceId, Constants.VTAP_INBOUND_TABLE, Constants.DHCP_ARP_TABLE);
+        connectTables(deviceId, Constants.VTAP_INBOUND_TABLE, Constants.DHCP_TABLE);
 
-        // for vTag and ACL table transition
-        connectTables(deviceId, Constants.DHCP_ARP_TABLE, Constants.VTAG_TABLE);
-        connectTables(deviceId, Constants.VTAG_TABLE, Constants.ACL_TABLE);
+        // for DHCP and vTag table transition
+        connectTables(deviceId, Constants.DHCP_TABLE, Constants.VTAG_TABLE);
+
+        // for vTag and ARP table transition
+        connectTables(deviceId, Constants.VTAG_TABLE, Constants.ARP_TABLE);
+
+        // for ARP and ACL table transition
+        connectTables(deviceId, Constants.ARP_TABLE, Constants.ACL_TABLE);
+
+        // for ACL and JUMP table transition
         connectTables(deviceId, Constants.ACL_TABLE, Constants.JUMP_TABLE);
 
         // for JUMP table transition
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackMetadataProxyHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackMetadataProxyHandler.java
index 9f928cd..e99651e 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackMetadataProxyHandler.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackMetadataProxyHandler.java
@@ -77,7 +77,7 @@
 import java.util.Objects;
 import java.util.Set;
 
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_DHCP_RULE;
 import static org.onosproject.openstacknetworking.impl.OpenstackMetadataProxyHandler.Http.Type.RESPONSE;
 import static org.onosproject.openstacknetworking.util.OpenstackNetworkingUtil.hmacEncrypt;
@@ -572,7 +572,7 @@
                     selector,
                     treatment,
                     PRIORITY_DHCP_RULE,
-                    DHCP_ARP_TABLE,
+                    DHCP_TABLE,
                     install);
         }
     }
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingArpHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingArpHandler.java
index c60dfec..8cbec2a 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingArpHandler.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingArpHandler.java
@@ -75,15 +75,15 @@
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.openstacknetworking.api.Constants.ARP_BROADCAST_MODE;
 import static org.onosproject.openstacknetworking.api.Constants.ARP_PROXY_MODE;
+import static org.onosproject.openstacknetworking.api.Constants.ARP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.DEFAULT_ARP_MODE_STR;
 import static org.onosproject.openstacknetworking.api.Constants.DEFAULT_GATEWAY_MAC_STR;
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.OPENSTACK_NETWORKING_APP_ID;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_CONTROL_RULE;
+import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_FLOOD_RULE;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_GATEWAY_RULE;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_REPLY_RULE;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_REQUEST_RULE;
-import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_ARP_SUBNET_RULE;
 import static org.onosproject.openstacknetworking.api.InstancePort.State.ACTIVE;
 import static org.onosproject.openstacknetworking.util.OpenstackNetworkingUtil.getPropertyValue;
 import static org.onosproject.openstacknetworking.util.OpenstackNetworkingUtil.swapStaleLocation;
@@ -324,7 +324,7 @@
                                 selector,
                                 treatment,
                                 PRIORITY_ARP_GATEWAY_RULE,
-                                DHCP_ARP_TABLE,
+                                ARP_TABLE,
                                 install
                         )
                 );
@@ -335,7 +335,7 @@
                         selector,
                         treatment,
                         PRIORITY_ARP_GATEWAY_RULE,
-                        DHCP_ARP_TABLE,
+                        ARP_TABLE,
                         install
                 );
             }
@@ -396,10 +396,13 @@
 
         OpenstackNode localNode = osNodeService.node(port.deviceId());
 
+        String segId = osNetworkService.segmentId(port.networkId());
+
         TrafficSelector selector = DefaultTrafficSelector.builder()
                 .matchEthType(EthType.EtherType.ARP.ethType().toShort())
                 .matchArpOp(ARP.OP_REQUEST)
                 .matchArpTpa(port.ipAddress().getIp4Address())
+                .matchTunnelId(Long.valueOf(segId))
                 .build();
 
         setRemoteArpTreatmentForVxlan(selector, port, localNode, install);
@@ -450,7 +453,7 @@
                 selector,
                 treatment,
                 PRIORITY_ARP_REPLY_RULE,
-                DHCP_ARP_TABLE,
+                ARP_TABLE,
                 install
         );
 
@@ -479,7 +482,7 @@
                         selector,
                         treatmentToRemote,
                         PRIORITY_ARP_REQUEST_RULE,
-                        DHCP_ARP_TABLE,
+                        ARP_TABLE,
                         install
                 );
             }
@@ -502,7 +505,7 @@
                         selector,
                         treatmentToRemote,
                         PRIORITY_ARP_REQUEST_RULE,
-                        DHCP_ARP_TABLE,
+                        ARP_TABLE,
                         install);
             }
         }
@@ -675,7 +678,7 @@
                     selector,
                     treatment,
                     PRIORITY_ARP_CONTROL_RULE,
-                    DHCP_ARP_TABLE,
+                    ARP_TABLE,
                     install
             );
         }
@@ -695,8 +698,8 @@
                     osNode.intgBridge(),
                     selector,
                     treatment,
-                    PRIORITY_ARP_SUBNET_RULE,
-                    DHCP_ARP_TABLE,
+                    PRIORITY_ARP_FLOOD_RULE,
+                    ARP_TABLE,
                     install
             );
         }
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingDhcpHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingDhcpHandler.java
index 32c1ad9..de4f8f2 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingDhcpHandler.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingDhcpHandler.java
@@ -86,7 +86,7 @@
 import static org.onlab.packet.DHCP.MsgType.DHCPACK;
 import static org.onlab.packet.DHCP.MsgType.DHCPOFFER;
 import static org.onosproject.openstacknetworking.api.Constants.DEFAULT_GATEWAY_MAC_STR;
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_DHCP_RULE;
 import static org.onosproject.openstacknode.api.OpenstackNode.NodeType.COMPUTE;
 import static org.slf4j.LoggerFactory.getLogger;
@@ -578,7 +578,7 @@
                     selector,
                     treatment,
                     PRIORITY_DHCP_RULE,
-                    DHCP_ARP_TABLE,
+                    DHCP_TABLE,
                     install);
         }
     }
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
index 332ed7f..1d74e9a 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
@@ -24,6 +24,8 @@
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onlab.packet.Ethernet;
 import org.onlab.packet.VlanId;
+import org.onosproject.cfg.ComponentConfigService;
+import org.onosproject.cfg.ConfigProperty;
 import org.onosproject.cluster.ClusterService;
 import org.onosproject.cluster.LeadershipService;
 import org.onosproject.cluster.NodeId;
@@ -56,12 +58,15 @@
 import org.slf4j.Logger;
 
 import java.util.Objects;
+import java.util.Set;
 import java.util.concurrent.ExecutorService;
 
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
 import static org.onlab.util.Tools.groupedThreads;
 import static org.onosproject.openstacknetworking.api.Constants.ACL_TABLE;
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.ARP_BROADCAST_MODE;
+import static org.onosproject.openstacknetworking.api.Constants.ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FLAT_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FORWARDING_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.OPENSTACK_NETWORKING_APP_ID;
@@ -74,6 +79,7 @@
 import static org.onosproject.openstacknetworking.api.Constants.PRIORITY_TUNNEL_TAG_RULE;
 import static org.onosproject.openstacknetworking.api.Constants.STAT_FLAT_OUTBOUND_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.VTAG_TABLE;
+import static org.onosproject.openstacknetworking.util.OpenstackNetworkingUtil.getPropertyValue;
 import static org.onosproject.openstacknetworking.util.OpenstackNetworkingUtil.swapStaleLocation;
 import static org.onosproject.openstacknetworking.util.RulePopulatorUtil.buildExtension;
 import static org.onosproject.openstacknode.api.OpenstackNode.NodeType.COMPUTE;
@@ -89,6 +95,7 @@
 
     private final Logger log = getLogger(getClass());
 
+    private static final String ARP_MODE = "arpMode";
     private static final String ERR_SET_FLOWS_VNI = "Failed to set flows for %s: Failed to get VNI for %s";
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -107,6 +114,9 @@
     protected ClusterService clusterService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected ComponentConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected LeadershipService leadershipService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -162,12 +172,22 @@
         NetworkType type = osNetworkService.network(instPort.networkId()).getNetworkType();
         switch (type) {
             case VXLAN:
-                setTunnelTagFlowRules(instPort, install);
+                setTunnelTagIpFlowRules(instPort, install);
                 setForwardingRulesForVxlan(instPort, install);
+
+                if (ARP_BROADCAST_MODE.equals(getArpMode())) {
+                    setTunnelTagArpFlowRules(instPort, install);
+                }
+
                 break;
             case VLAN:
-                setVlanTagFlowRules(instPort, install);
+                setVlanTagIpFlowRules(instPort, install);
                 setForwardingRulesForVlan(instPort, install);
+
+                if (ARP_BROADCAST_MODE.equals(getArpMode())) {
+                    setVlanTagArpFlowRules(instPort, install);
+                }
+
                 break;
             case FLAT:
                 setFlatJumpRules(instPort, install);
@@ -190,10 +210,20 @@
 
         switch (type) {
             case VXLAN:
-                setTunnelTagFlowRules(instPort, false);
+                setTunnelTagIpFlowRules(instPort, false);
+
+                if (ARP_BROADCAST_MODE.equals(getArpMode())) {
+                    setTunnelTagArpFlowRules(instPort, false);
+                }
+
                 break;
             case VLAN:
-                setVlanTagFlowRules(instPort, false);
+                setVlanTagIpFlowRules(instPort, false);
+
+                if (ARP_BROADCAST_MODE.equals(getArpMode())) {
+                    setVlanTagArpFlowRules(instPort, false);
+                }
+
                 break;
             case FLAT:
                 setFlatJumpRules(instPort, false);
@@ -219,7 +249,7 @@
                 selector.build(),
                 treatment.build(),
                 PRIORITY_FLAT_JUMP_UPSTREAM_RULE,
-                DHCP_ARP_TABLE,
+                DHCP_TABLE,
                 install);
 
         Network network = osNetworkService.network(port.networkId());
@@ -247,7 +277,7 @@
                 selector.build(),
                 treatment.build(),
                 PRIORITY_FLAT_JUMP_DOWNSTREAM_RULE,
-                DHCP_ARP_TABLE,
+                DHCP_TABLE,
                 install);
 
         selector = DefaultTrafficSelector.builder();
@@ -261,7 +291,7 @@
                 selector.build(),
                 treatment.build(),
                 PRIORITY_FLAT_JUMP_DOWNSTREAM_RULE,
-                DHCP_ARP_TABLE,
+                DHCP_TABLE,
                 install);
     }
 
@@ -446,18 +476,27 @@
                 });
     }
 
+    private void setTunnelTagArpFlowRules(InstancePort instPort, boolean install) {
+        setTunnelTagFlowRules(instPort, Ethernet.TYPE_ARP, install);
+    }
+
+    private void setTunnelTagIpFlowRules(InstancePort instPort, boolean install) {
+        setTunnelTagFlowRules(instPort, Ethernet.TYPE_IPV4, install);
+    }
+
     /**
      * Configures the flow rule which is for using VXLAN to tag the packet
      * based on the in_port number of a virtual instance.
-     * Note that this rule will be inserted in VNI table (table 0).
+     * Note that this rule will be inserted in vTag table.
      *
      * @param instPort instance port object
      * @param install install flag, add the rule if true, remove it otherwise
      */
-    private void setTunnelTagFlowRules(InstancePort instPort, boolean install) {
+    private void setTunnelTagFlowRules(InstancePort instPort,
+                                       short ethType,
+                                       boolean install) {
         TrafficSelector selector = DefaultTrafficSelector.builder()
-                // TODO: need to handle IPv6 in near future
-                .matchEthType(Ethernet.TYPE_IPV4)
+                .matchEthType(ethType)
                 .matchInPort(instPort.portNumber())
                 .build();
 
@@ -469,9 +508,9 @@
 
         TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder()
                 .setTunnelId(getVni(instPort))
-                .transition(ACL_TABLE);
+                .transition(ARP_TABLE);
 
-        if (securityGroupService.isSecurityGroupEnabled()) {
+        if (securityGroupService.isSecurityGroupEnabled() && ethType == Ethernet.TYPE_IPV4) {
             tb.extension(ctTreatment, instPort.deviceId());
         }
 
@@ -485,18 +524,27 @@
                 install);
     }
 
+    private void setVlanTagIpFlowRules(InstancePort instPort, boolean install) {
+        setVlanTagFlowRules(instPort, Ethernet.TYPE_IPV4, install);
+    }
+
+    private void setVlanTagArpFlowRules(InstancePort instPort, boolean install) {
+        setVlanTagFlowRules(instPort, Ethernet.TYPE_ARP, install);
+    }
+
     /**
      * Configures the flow rule which is for using VLAN to tag the packet
      * based on the in_port number of a virtual instance.
-     * Note that this rule will be inserted in VNI table (table 0).
+     * Note that this rule will be inserted in vTag table.
      *
      * @param instPort instance port object
      * @param install install flag, add the rule if true, remove it otherwise
      */
-    private void setVlanTagFlowRules(InstancePort instPort, boolean install) {
+    private void setVlanTagFlowRules(InstancePort instPort,
+                                     short ethType,
+                                     boolean install) {
         TrafficSelector selector = DefaultTrafficSelector.builder()
-                // TODO: need to handle IPv6 in near future
-                .matchEthType(Ethernet.TYPE_IPV4)
+                .matchEthType(ethType)
                 .matchInPort(instPort.portNumber())
                 .build();
 
@@ -637,6 +685,11 @@
         return Long.valueOf(osNet.getProviderSegID());
     }
 
+    private String getArpMode() {
+        Set<ConfigProperty> properties = configService.getProperties(OpenstackSwitchingArpHandler.class.getName());
+        return getPropertyValue(properties, ARP_MODE);
+    }
+
     /**
      * An internal instance port listener which listens the port events generated
      * from VM. The corresponding L2 forwarding rules will be generated and
diff --git a/apps/openstacknetworking/app/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManagerTest.java b/apps/openstacknetworking/app/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManagerTest.java
index e3e449b..d1410b2 100644
--- a/apps/openstacknetworking/app/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManagerTest.java
+++ b/apps/openstacknetworking/app/src/test/java/org/onosproject/openstacknetworking/impl/OpenstackFlowRuleManagerTest.java
@@ -45,7 +45,8 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.onosproject.openstacknetworking.api.Constants.ACL_TABLE;
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FLAT_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FORWARDING_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.JUMP_TABLE;
@@ -187,13 +188,14 @@
         fros = Sets.newConcurrentHashSet();
 
         target.initializePipeline(DEVICE_ID);
-        assertEquals("Flow Rule size was not match", 11, fros.size());
+        assertEquals("Flow Rule size was not match", 12, fros.size());
 
         Map<Integer, Integer> fromToTableMap = Maps.newConcurrentMap();
         fromToTableMap.put(STAT_INBOUND_TABLE, VTAP_INBOUND_TABLE);
-        fromToTableMap.put(VTAP_INBOUND_TABLE, DHCP_ARP_TABLE);
-        fromToTableMap.put(DHCP_ARP_TABLE, VTAG_TABLE);
-        fromToTableMap.put(VTAG_TABLE, ACL_TABLE);
+        fromToTableMap.put(VTAP_INBOUND_TABLE, DHCP_TABLE);
+        fromToTableMap.put(DHCP_TABLE, VTAG_TABLE);
+        fromToTableMap.put(VTAG_TABLE, ARP_TABLE);
+        fromToTableMap.put(ARP_TABLE, ACL_TABLE);
         fromToTableMap.put(ACL_TABLE, JUMP_TABLE);
         fromToTableMap.put(STAT_OUTBOUND_TABLE, VTAP_OUTBOUND_TABLE);
         fromToTableMap.put(VTAP_OUTBOUND_TABLE, FORWARDING_TABLE);
diff --git a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/impl/OpenstackVtapManager.java b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/impl/OpenstackVtapManager.java
index 6370de6..4ea817c 100644
--- a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/impl/OpenstackVtapManager.java
+++ b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/impl/OpenstackVtapManager.java
@@ -110,7 +110,7 @@
 import static org.onosproject.net.AnnotationKeys.PORT_NAME;
 import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE;
 import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST;
-import static org.onosproject.openstacknetworking.api.Constants.DHCP_ARP_TABLE;
+import static org.onosproject.openstacknetworking.api.Constants.DHCP_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FLAT_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.FORWARDING_TABLE;
 import static org.onosproject.openstacknetworking.api.Constants.VTAP_FLAT_OUTBOUND_GROUP_TABLE;
@@ -187,7 +187,7 @@
     private static final int PRIORITY_VTAP_OUTPUT_RULE = 1000;
     private static final int PRIORITY_VTAP_OUTPUT_DROP = 0;
 
-    private static final int INBOUND_NEXT_TABLE = DHCP_ARP_TABLE;
+    private static final int INBOUND_NEXT_TABLE = DHCP_TABLE;
     private static final int FLAT_OUTBOUND_NEXT_TABLE = FLAT_TABLE;
     private static final int OUTBOUND_NEXT_TABLE = FORWARDING_TABLE;