changed manual test to untagged
diff --git a/ofdpa/flows.py b/ofdpa/flows.py
index 89cd88f..90a7612 100644
--- a/ofdpa/flows.py
+++ b/ofdpa/flows.py
@@ -21,7 +21,6 @@
 from oftest.testutils import *
 from accton_util import *
 
-
 class PacketInSrcMacMiss(base_tests.SimpleDataPlane):
     """
     Test packet in function on a src-mac miss
@@ -51,7 +50,7 @@
 
             verify_no_other_packets(self)
 
-class PacketInMiss(base_tests.SimpleDataPlane):
+class PacketInUDP(base_tests.SimpleDataPlane):
     """
     Test packet in function for a table-miss flow
     Send a packet to each dataplane port and verify that a packet
@@ -75,7 +74,7 @@
         # create match
         match = ofp.match()
         match.oxm_list.append(ofp.oxm.eth_type(0x0800))
-        match.oxm_list.append(ofp.oxm.ip_proto(17))
+        match.oxm_list.append(ofp.oxm.ip_proto(0x02))
         request = ofp.message.flow_add(
             table_id=60,
             cookie=42,
@@ -102,6 +101,111 @@
 
             verify_no_other_packets(self)
 
+class ArpNL2(base_tests.SimpleDataPlane):
+     def runTest(self):
+        delete_all_flows(self.controller)
+        delete_all_groups(self.controller)
+
+        ports = sorted(config["port_map"].keys())
+        match = ofp.match()
+        match.oxm_list.append(ofp.oxm.eth_type(0x0806))
+        request = ofp.message.flow_add(
+            table_id=60,
+            cookie=42,
+            match=match,
+            instructions=[
+                ofp.instruction.apply_actions(
+                    actions=[
+                        ofp.action.output(
+                            port=ofp.OFPP_CONTROLLER,
+                            max_len=ofp.OFPCML_NO_BUFFER)]),
+            ],
+            buffer_id=ofp.OFP_NO_BUFFER,
+            priority=40000)
+        self.controller.message_send(request)
+        for port in ports:
+            add_one_l2_interface_group(self.controller, port, 1, True, 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)
+        do_barrier(self.controller)
+        parsed_arp_pkt = simple_arp_packet()
+        arp_pkt = str(parsed_arp_pkt)
+
+        for out_port in ports:
+            self.dataplane.send(out_port, arp_pkt)
+            verify_packet_in(self, arp_pkt, out_port, ofp.OFPR_ACTION)
+            # change dest based on port number
+            mac_dst= '00:12:34:56:78:%02X' % out_port
+            for in_port in ports:
+                if in_port == out_port:
+                    continue
+                # change source based on port number to avoid packet-ins from learning
+                mac_src= '00:12:34:56:78:%02X' % in_port
+                parsed_pkt = simple_tcp_packet(eth_dst=mac_dst, eth_src=mac_src)
+                pkt = str(parsed_pkt)
+                self.dataplane.send(in_port, pkt)
+
+                for ofport in ports:
+                    if ofport in [out_port]:
+                        verify_packet(self, pkt, ofport)
+                    else:
+                        verify_no_packet(self, pkt, ofport)
+
+                verify_no_other_packets(self)
+
+
+
+class PacketInArp(base_tests.SimpleDataPlane):
+    """
+    Test packet in function for a table-miss flow
+    Send a packet to each dataplane port and verify that a packet
+    in message is received from the controller for each
+
+    NOTE: Verify This case the oft option shall not use --switch-ip
+    """
+
+    def runTest(self):
+        delete_all_flows(self.controller)
+        delete_all_groups(self.controller)
+
+        parsed_arp_pkt = simple_arp_packet()
+        arp_pkt = str(parsed_arp_pkt)
+        ports = sorted(config["port_map"].keys())
+        #for port in ports:
+        #    add_one_l2_interface_group(self.controller, port, 1, True, False)
+        #    add_one_vlan_table_flow(self.controller, port, 1, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+
+        # create match
+        match = ofp.match()
+        match.oxm_list.append(ofp.oxm.eth_type(0x0806))
+        request = ofp.message.flow_add(
+            table_id=60,
+            cookie=42,
+            match=match,
+            instructions=[
+                ofp.instruction.apply_actions(
+                    actions=[
+                        ofp.action.output(
+                            port=ofp.OFPP_CONTROLLER,
+                            max_len=ofp.OFPCML_NO_BUFFER)]),
+            ],
+            buffer_id=ofp.OFP_NO_BUFFER,
+            priority=1)
+
+        logging.info("Inserting packet in flow to controller")
+        self.controller.message_send(request)
+        do_barrier(self.controller)
+
+        for of_port in config["port_map"].keys():
+            logging.info("PacketInMiss test, port %d", of_port)
+            self.dataplane.send(of_port, arp_pkt)
+
+            verify_packet_in(self, arp_pkt, of_port, ofp.OFPR_ACTION)
+
+            verify_no_other_packets(self)
+
+
 class L2FloodQinQ(base_tests.SimpleDataPlane):
     """
     Test L2 flood of double tagged vlan packets (802.1Q)
@@ -545,6 +649,8 @@
 
         intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
         dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
+        mcast_mac = [0x01, 0x00, 0x5e, 0x00, 0x00, 0x01]
+
         dip=0xc0a80001
         index=1
         ports = config["port_map"].keys()
@@ -554,7 +660,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=dst_mac)
+            l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=mcast_mac)
             #add L3 ecmp group
             ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
             #add vlan flow table
@@ -587,8 +693,9 @@
 
                 #build expect packet
                 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=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst) 
+                    eth_dst=mcast, 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)
diff --git a/ofdpa/manual.py b/ofdpa/manual.py
index c43b7aa..342b458 100644
--- a/ofdpa/manual.py
+++ b/ofdpa/manual.py
@@ -12,97 +12,81 @@
      #Add flows correspondent to Leaf1
      switch_mac=[0x00, 0x00, 0x00, 0x01, 0xea, 0xf1]
      dst_mac= [0x00, 0x00, 0x00, 0x12, 0x34, 0x01]
+     id=0x1eaf
      #Add L3Unicast to Host
-     port, vlan_id = 33, 10
+     port, vlan_id = 33, 4093
      ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
      ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=switch_mac, 
+     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac, 
                                 dst_mac=dst_mac)
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, vrf=vlan_id,
-                             flag=VLAN_TABLE_FLAG_ONLY_TAG)
+     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      ##add Termination Flow
      add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
      ##add unicast routing flow
      dst_ip=0x0a000001
      mask=0xffffff00
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id, vrf=10)
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(vlan_id, port)
-     add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
+     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id)
 
      port = 32
-     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
-     add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
+     add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-     do_barrier(self.controller)
 
      #Add L3VPN initiation
      dst_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
-     vlan_id = 100
-     ##add L2 Interface Group
-     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
      #add MPLS interface group
      mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, switch_mac, vlan_id, port)
      ##add L3VPN interface
      mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
-	 index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=20, set_bos=1, set_ttl=32)
+	 index=id, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=20, set_bos=1, cpy_ttl_outward=True)
+     ecmp_msg=add_l3_ecmp_group(self.controller, port, [mpls_label_gid])
      ##add unicast routing flow
      dst_ip=0x14000001
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, mpls_label_gid, vrf=10)
+     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, ecmp_msg.group_id)
    
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(vlan_id, port)
-     add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
- 
      do_barrier(self.controller)
 
 class Leaf2(base_tests.SimpleDataPlane):
 
-  def runTest(self):  
-     #Add flows correspondent to Leaf2
+    def runTest(self):
+     #Add flows correspondent to Leaf1
      switch_mac=[0x00, 0x00, 0x00, 0x01, 0xea, 0xf2]
      dst_mac= [0x00, 0x00, 0x00, 0x12, 0x34, 0x02]
+     id=0x2eaf
      #Add L3Unicast to Host
-     port, vlan_id=33, 20
+     port, vlan_id = 33, 4093
      ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+     add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
      ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=switch_mac,
+     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
                                 dst_mac=dst_mac)
-     add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=20, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      ##add Termination Flow
      add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
      ##add unicast routing flow
      dst_ip=0x14000001
      mask=0xffffff00
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id, vrf=vlan_id)
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(vlan_id, port)
-     add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
+     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, l3_msg.group_id)
 
      port = 32
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=True, send_barrier=False)
-     add_one_vlan_table_flow(self.controller, port, vlan_id, vrf=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
+     add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      add_termination_flow(self.controller, port, 0x0800, switch_mac, vlan_id)
-     do_barrier(self.controller)
 
      #Add L3VPN initiation
-     dst_mac= [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
-     vlan_id = 100
-     ##add L2 Interface Group
-     l2_gid, l2_msg = add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+     dst_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
      #add MPLS interface group
      mpls_gid, mpls_msg = add_mpls_intf_group(self.controller, l2_gid, dst_mac, switch_mac, vlan_id, port)
      ##add L3VPN interface
-     mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,  
-         index=port, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=10, set_bos=1, set_ttl=32)
+     mpls_label_gid, mpls_label_msg = add_mpls_label_group(self.controller, subtype=OFDPA_MPLS_GROUP_SUBTYPE_L3_VPN_LABEL,
+         index=id, ref_gid= mpls_gid, push_mpls_header=True, set_mpls_label=20, set_bos=1, cpy_ttl_outward=True)
+     ecmp_msg=add_l3_ecmp_group(self.controller, id, [mpls_label_gid])
      ##add unicast routing flow
      dst_ip=0x0a000001
-     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, mpls_label_gid, vrf=20)
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(vlan_id, port)
-     add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
+     add_unicast_routing_flow(self.controller, 0x0800, dst_ip, mask, ecmp_msg.group_id)
+
+     do_barrier(self.controller)
 
 class Spine(base_tests.SimpleDataPlane):
 
@@ -110,38 +94,32 @@
      #add Spine Flows
      switch_mac = [0x00, 0x00, 0x00, 0x55, 0x55, 0x55]
      dst_mac = [0x00, 0x00, 0x00, 0x01, 0xea, 0xf1]
+     id = 0x55
      #Add MPLS termination 
-     port, vlan_id=31, 10 
+     port, vlan_id=31, 4093 
      ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=False, send_barrier=False)
      ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=switch_mac,
+     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
                                 dst_mac=dst_mac)
      ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
-     vlan_id=100
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=100, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      add_termination_flow(self.controller, port, 0x8847, switch_mac, vlan_id, goto_table=24)
      add_mpls_flow(self.controller, ecmp_msg.group_id, 10)
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(100, port)
-     add_bridge_flow(self.controller, dst_mac, 100, group_id, True)
      
      dst_mac = [0x00, 0x00, 0x00, 0x01, 0xea, 0xf2]
      #Add MPLS termination
-     port, vlan_id=32, 20
+     port=32
      ##add L2 Interface Group
-     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+     add_one_l2_interface_group(self.controller, port,  vlan_id=vlan_id, is_tagged=False, send_barrier=False)
      ##add L3 Unicast Group
-     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=switch_mac,
+     id=id+1
+     l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=id, src_mac=switch_mac,
                                 dst_mac=dst_mac)
      ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
-     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=100, flag=VLAN_TABLE_FLAG_ONLY_TAG)
-     vlan_id=100
+     add_one_vlan_table_flow(self.controller, of_port=port, vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
      add_termination_flow(self.controller, port, 0x8847, switch_mac, vlan_id, goto_table=24)
      add_mpls_flow(self.controller, ecmp_msg.group_id, 20)
-     #add entries in the Bridging table to avoid packet-in from mac learning
-     group_id = encode_l2_interface_group_id(100, port)
-     add_bridge_flow(self.controller, dst_mac, 100, group_id, True)
 
 class TestLeaf1(base_tests.SimpleDataPlane):
 
@@ -150,7 +128,7 @@
         ip_src='10.0.0.1'
         ip_dst='20.0.0.2'
         switch_mac='00:00:00:01:ea:f1'
-        parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=10, ip_src=ip_src,
+        parsed_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
                       ip_dst=ip_dst, eth_dst=switch_mac, eth_src=host_mac, ip_ttl=33)
         pkt=str(parsed_pkt)
         self.dataplane.send(33, pkt)
@@ -192,13 +170,13 @@
         ip_src='10.0.0.1'
         ip_dst='20.0.0.3'
         switch_mac='00:00:00:01:ea:f1'
-        parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=10, ip_src=ip_src,
+        parsed_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
                       ip_dst=ip_dst, eth_dst=switch_mac, eth_src=host_mac, ip_ttl=33)
         pkt=str(parsed_pkt)
         self.dataplane.send(33, pkt)
         switch_mac='00:00:00:01:ea:f2'
         host_mac='00:00:00:12:34:02'
-        exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=20, ip_src=ip_src,
+        exp_pkt = simple_tcp_packet(pktlen=100, ip_src=ip_src,
                         ip_dst=ip_dst, eth_dst=host_mac, eth_src=switch_mac, ip_ttl=30)
         pkt=str(exp_pkt)
         verify_packet(self, pkt, 37)