Reverted some changes
diff --git a/accton/accton_util.py b/accton/accton_util.py
index aeff03f..5823a65 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -421,7 +421,7 @@
     # goto to table 20
     msgs=[]
     for of_port in ports:
-        if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH):
+        if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH) or (flag == 4):
             match = ofp.match()
             match.oxm_list.append(ofp.oxm.in_port(of_port))
             match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
@@ -462,6 +462,27 @@
             ctrl.message_send(request)
             msgs.append(request)
 
+        if (flag == 4) :
+            match = ofp.match()
+            match.oxm_list.append(ofp.oxm.in_port(of_port))
+            match.oxm_list.append(ofp.oxm.vlan_vid_masked(0x1000, 0x1fff))
+            request = ofp.message.flow_add(
+                table_id=10,
+                cookie=42,
+                match=match,
+                instructions=[
+                  ofp.instruction.apply_actions(
+                    actions=[
+                      ofp.action.set_field(ofp.oxm.vlan_vid(vlan_id))
+                    ]
+                  ),
+                  ofp.instruction.goto_table(20)
+                ],
+                priority=0)
+            logging.info("Add vlan %d untagged packets on port %d and go to table 20" % (vlan_id, of_port))
+            ctrl.message_send(request)
+            msgs.append(request)
+
     if send_barrier:
         do_barrier(ctrl)
 
@@ -551,7 +572,7 @@
 def add_one_vlan_table_flow(ctrl, of_port, vlan_id=1, vrf=0, flag=VLAN_TABLE_FLAG_ONLY_BOTH, send_barrier=False):
     # table 10: vlan
     # goto to table 20
-    if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH):
+    if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH) or (flag == 4):
         match = ofp.match()
         match.oxm_list.append(ofp.oxm.in_port(of_port))
         match.oxm_list.append(ofp.oxm.vlan_vid_masked(0x1000+vlan_id,0x1fff))
@@ -600,6 +621,31 @@
             priority=0)
         logging.info("Add vlan %d untagged packets on port %d and go to table 20" % (vlan_id, of_port))
         ctrl.message_send(request)
+    
+    if (flag == 4) :
+        match = ofp.match()
+        match.oxm_list.append(ofp.oxm.in_port(of_port))
+        match.oxm_list.append(ofp.oxm.vlan_vid_masked(0x1000,0x1fff))
+
+        actions=[]
+        if vrf!=0:
+            actions.append(ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)))
+
+        actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(value=vlan_id)))
+
+        request = ofp.message.flow_add(
+            table_id=10,
+            cookie=42,
+            match=match,
+            instructions=[
+                ofp.instruction.apply_actions(
+                     actions=actions
+                ),
+                ofp.instruction.goto_table(20)
+            ],
+            priority=0)
+        logging.info("Add vlan %d tagged packets on port %d and go to table 20" %( vlan_id, of_port))
+        ctrl.message_send(request)
 
     if send_barrier:
         do_barrier(ctrl)
diff --git a/ofdpa/flows.py b/ofdpa/flows.py
index 44184b3..e4df84e 100644
--- a/ofdpa/flows.py
+++ b/ofdpa/flows.py
@@ -119,7 +119,7 @@
             priority=40000)
         self.controller.message_send(request)
         for port in ports:
-            add_one_l2_interface_group(self.controller, port, 1, True, False)
+            add_one_l2_interface_group(self.controller, port, 1, False, False)
             add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
             group_id = encode_l2_interface_group_id(1, port)
             add_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, port], 1, group_id, True)
@@ -149,8 +149,6 @@
 
                 verify_no_other_packets(self)
 
-
-
 class PacketInArp(base_tests.SimpleDataPlane):
     """
     Test packet in function for a table-miss flow
@@ -200,7 +198,6 @@
 
             verify_no_other_packets(self)
 
-
 class L2FloodQinQ(base_tests.SimpleDataPlane):
     """
     Test L2 flood of double tagged vlan packets (802.1Q)
@@ -240,7 +237,6 @@
 
         verify_no_other_packets(self)
 
-
 class L2FloodTagged(base_tests.SimpleDataPlane):
     """
     Test L2 flood to a vlan
@@ -655,7 +651,7 @@
             l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id, True, False)
             dst_mac[5]=vlan_id
             #add L3 Unicast  group
-            l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=mcast_mac)
+            l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)
             #add L3 ecmp group
             ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
             #add vlan flow table
@@ -690,7 +686,7 @@
                 mac_dst='00:00:00:22:22:%02X' % out_port
                 mcast='01:00:5e:00:00:01'
                 exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
-                    eth_dst=mcast, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst) 
+                    eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst) 
                 pkt=str(exp_pkt)
                 verify_packet(self, pkt, out_port)
                 verify_no_other_packets(self)
@@ -780,8 +776,8 @@
         """
         port1 (vlan 300)-> All Ports (vlan 300)
         """
-        delete_all_flows(self.controller)
-        delete_all_groups(self.controller)
+        #delete_all_flows(self.controller)
+        #delete_all_groups(self.controller)
 
         if len(config["port_map"]) <3:
             logging.info("Port count less than 3, can't run this case")
@@ -809,12 +805,11 @@
         #add l2 interface group
         l2_intf_group_list=[]
         for port in config["port_map"].keys():
+            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=4) 
             if port == port2:
                 continue
             l2_intf_gid, msg=add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
             l2_intf_group_list.append(l2_intf_gid)
-            #add vlan flow table
-            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
 
         #add termination flow
         add_termination_flow(self.controller, port1, 0x0800, switch_mac, vlan_id)
@@ -823,7 +818,8 @@
         mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id,  2, l2_intf_group_list)
         add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)
 
-        parsed_pkt = simple_udp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=300,
+        parsed_pkt = simple_udp_packet(pktlen=100, 
+                                       dl_vlan_enable=True, 
                                        eth_dst=dst_mac_str,
                                        eth_src=port1_mac_str,
                                        ip_ttl=64,
@@ -964,8 +960,6 @@
         mpls_label_gid3, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
                      index=(0x10000+port3), ref_gid= mpls_gid3, push_mpls_header=True, set_mpls_label=port3, set_bos=1, cpy_ttl_outward=True)
 
-
-
         mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan,  2, [0x92020022 , 0x92010023])
         add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)