add case
diff --git a/accton/vxlan_flow_test.py b/accton/vxlan_flow_test.py
index c066c70..2e655da 100755
--- a/accton/vxlan_flow_test.py
+++ b/accton/vxlan_flow_test.py
@@ -620,7 +620,7 @@
 												  vlan=network_port_vlan, operation="delete")

         assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)

 

-class AccessWithAccess(base_tests.SimpleDataPlane):

+class AccessWithAccessDiffPortVlan(base_tests.SimpleDataPlane):

    def runTest(self):

         """

         first verify flood over unicast, 

@@ -761,6 +761,161 @@
 												  vlan=access_port3_vid, operation="delete")

         assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)

 

+        

+class AccessWithAccessSamePortDiffVlan(base_tests.SimpleDataPlane):

+   def runTest(self):

+        """

+        first verify flood over unicast, 

+        second verify flood over mcast

+        """

+        if 	config["switch_ip"] == None:

+            logging.error("Doesn't configure switch IP")		

+            return

+			

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+  

+        access_port1_vid=1

+        access_phy_port1=config["port_map"].keys()[0]

+        access_lport1=0x10001

+        access_port2_vid=0

+        access_phy_port2= access_phy_port1

+        access_lport2=0x10002

+        access_port3_vid=3

+        access_phy_port3=access_phy_port1

+        access_lport3=0x10003

+        vnid=10

+        next_hop_id_mcast=1

+        mcast_ipv4="224.1.1.1"

+        dst_mac_mcast="01:00:5e:01:01:01"

+        

+        feature_reply=get_featureReplay(self)	

+        

+        next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast, 

+		                                          dst_mac=dst_mac_mcast, 

+												  phy_port=access_phy_port3, 

+												  vlan=access_port3_vid)        

+        logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id_mcast, dst_mac_mcast, access_phy_port3, access_port3_vid);

+        assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)

+

+        vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)

+        logging.info("config VNI %lx", vnid);

+        assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)

+            

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+                                        lport=access_lport1, phy_port=access_phy_port1, 

+                                        vlan=access_port1_vid, vnid=vnid)

+        logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)

+

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+                                        lport=access_lport2, phy_port=access_phy_port2, 

+                                        vlan=access_port2_vid, vnid=vnid)

+        logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)            

+        

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+                                        lport=access_lport3, phy_port=access_phy_port3, 

+                                        vlan=access_port3_vid, vnid=vnid)

+        logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)            

+

+        

+        #add port table to have vxlan ability

+        add_port_table_flow(self.controller)

+

+		#add DLF bridge flow

+        msg=add_l2_overlay_flood_over_mcast_tunnel_group(self.controller, vnid, [access_lport1, access_lport2, access_lport3], 1)        

+        add_overlay_bridge_flow(self.controller, None, vnid, msg.group_id, True, True)

+        

+        #send packet on access port

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port1_vid)

+        pkt = str(parsed_pkt)

+        self.dataplane.send(access_phy_port1, pkt)

+

+        #verify packet on access port 2, vid=0, so untag

+        parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:00:11:11:11:11')

+        pkt = str(parsed_pkt) 

+        verify_packet(self, pkt, access_phy_port2)

+        #verify packet on access port 3

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port3_vid)

+        pkt = str(parsed_pkt)

+        verify_packet(self, pkt, access_phy_port3) 

+        verify_no_other_packets(self)

+        

+        add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a], vnid, access_lport2, False, True)        

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port1_vid)

+        pkt = str(parsed_pkt)

+        self.dataplane.send(access_phy_port1, pkt)

+        #verify packet on access port		

+        parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:12:34:56:78:9a')

+        pkt = str(parsed_pkt) 

+        verify_packet(self, pkt, access_phy_port2)        

+        verify_no_other_packets(self)

+

+

+        add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0xaa], vnid, access_lport3, False, True)

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port1_vid)

+        pkt = str(parsed_pkt)

+        self.dataplane.send(access_phy_port1, pkt)

+        #verify packet on access port		

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port3_vid)

+        pkt = str(parsed_pkt) 

+        verify_packet(self, pkt, access_phy_port3)

+        verify_no_other_packets(self)

+

+        add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0xbb], vnid, access_lport2, False, True)

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port1_vid)

+        pkt = str(parsed_pkt)

+        self.dataplane.send(access_phy_port1, pkt)

+        #verify packet on access port		

+        parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:bb',

+                                       dl_vlan_enable= True,

+                                       vlan_vid=access_port2_vid)

+        pkt = str(parsed_pkt) 

+        verify_packet(self, pkt, access_phy_port2)

+        verify_no_other_packets(self)        

+        

+		#exit verification so clear all configuration

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+		                                        lport=access_lport1, phy_port=access_phy_port1, 

+												vlan=access_port1_vid, vnid=vnid, operation="delete")

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+		                                        lport=access_lport2, phy_port=access_phy_port2, 

+												vlan=access_port2_vid, vnid=vnid, operation="delete")

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)            

+        vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id, 

+                                        lport=access_lport3, phy_port=access_phy_port3, 

+                                        vlan=access_port3_vid, vnid=vnid, operation="delete")

+        logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);

+        assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)   

+        

+        vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")

+        assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)

+

+        next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast, 

+		                                          dst_mac=dst_mac_mcast, 

+												  phy_port=access_phy_port3, 

+												  vlan=access_port3_vid, operation="delete")

+        assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)

+

+        

 class AccessWithNetwork(base_tests.SimpleDataPlane):

     def runTest(self):

         """

diff --git a/acctonUseDpctl/allow_all_ucast_route.py b/acctonUseDpctl/allow_all_ucast_route.py
index 14a6c56..d572c12 100755
--- a/acctonUseDpctl/allow_all_ucast_route.py
+++ b/acctonUseDpctl/allow_all_ucast_route.py
@@ -32,21 +32,29 @@
 

         apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1000/0x1000 goto:20")

         apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output="+str(output_port))

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

         apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x20000001 goto:60")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

-        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x30003 goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(input_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x3000"+str(input_port)+" goto:60")

 

-        input_pkt = simple_tcp_packet(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      ip_src=toIpV4Str(0xc0a80164),

-                                      ip_dst=toIpV4Str(0xc0a80202))

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 52 00 01 00 00 40 06 f5 ee c0 a8 '

+                '01 64 c0 a8 02 02 04 d2 00 50 00 00 00 00 00 00 '

+                '00 00 50 02 20 00 6c 46 00 00 44 44 44 44 44 44 '

+                '44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 '

+                '44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 '

+                '44 44 44 44')

 

-        output_pkt = simple_tcp_packet(eth_dst="00:00:04:22:44:66",

-                                       eth_src="00:00:04:22:33:55",

-                                       ip_src=toIpV4Str(0xc0a80164),

-                                       ip_dst=toIpV4Str(0xc0a80202))

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '08 00 45 00 00 52 00 01 00 00 3f 06 f6 ee c0 a8 '

+                '01 64 c0 a8 02 02 04 d2 00 50 00 00 00 00 00 00 '

+                '00 00 50 02 20 00 6c 46 00 00 44 44 44 44 44 44 '

+                '44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 '

+                '44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 '

+                '44 44 44 44')

         

         self.dataplane.send(input_port, str(input_pkt))

         verify_packet(self, str(output_pkt), output_port)

diff --git a/acctonUseDpctl/basic.py b/acctonUseDpctl/basic.py
index e7d82d6..a35dedb 100755
--- a/acctonUseDpctl/basic.py
+++ b/acctonUseDpctl/basic.py
@@ -8,25 +8,64 @@
 class features(base_tests.SimpleDataPlane):

     def runTest(self):

         delete_all_flows(self.controller)

-        delete_all_groups(self.controller)    

-		

-        test_ports = sorted(config["port_map"].keys())	

-      

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

         json_result = apply_dpctl_get_cmd(self, config, "features")

         #pprint(json_result)

         result=json_result["RECEIVED"][1]

-        self.assertTrue(result["tabs"]==64, "Table size is not correct")

-        

+        #self.assertTrue(result["tabs"]==64, "Table size is not correct")

+        self.assertNotEqual(result["caps"], 0, "Invalid capabilities")

+

 class get_config(base_tests.SimpleDataPlane):

     def runTest(self):

         delete_all_flows(self.controller)

-        delete_all_groups(self.controller)    

-		

-        test_ports = sorted(config["port_map"].keys())	

-      

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

         json_result = apply_dpctl_get_cmd(self, config, "get-config")

         #pprint(json_result)

         result=json_result["RECEIVED"][1]

-        self.assertNotEqual(result["conf"], {}, "Config reply nothing")        

-        

-        
\ No newline at end of file
+        self.assertNotEqual(result["conf"], {}, "Config reply nothing")

+

+class desc(base_tests.SimpleDataPlane):

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        json_result = apply_dpctl_get_cmd(self, config, "stats-desc")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["mfr"], {}, "DESC MFR reply nothing")

+

+class port_desc(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "port-desc")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["port"], {}, "Port DESC reply nothing")

+

+class table_features(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "table-features")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["table_features"], {}, "Table features reply nothing")

+

+class group_features(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "group-features")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["types"], 0, "Not support group types")

+

+class meter_features(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "meter-features")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]["features"][0]

+        self.assertNotEqual(result["max_meter"], 0, "Not support meter")

+

+

diff --git a/acctonUseDpctl/mpls.py b/acctonUseDpctl/mpls.py
new file mode 100755
index 0000000..f62e2bc
--- /dev/null
+++ b/acctonUseDpctl/mpls.py
@@ -0,0 +1,1053 @@
+import logging

+import oftest.base_tests as base_tests

+import time

+from oftest import config

+from oftest.testutils import *

+from util import *

+from accton_util import convertIP4toStr as toIpV4Str

+from accton_util import convertMACtoStr as toMacStr

+

+class encap_mpls(base_tests.SimpleDataPlane):

+    """

+    [Encap one MPLS label]

+      Encap a MPLS label

+

+    Inject  eth 1/3 Tag 3, SA000000112233, DA000000113355, V4

+    Output  eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(output_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 03 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b2 47 c0 a8 01 64 c0 a8 02 02 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_mpls(base_tests.SimpleDataPlane):

+    """

+    [Decap one MPLS label]

+      Decap the MPLS label

+

+    Inject  eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW, InSA000000112233, InDA000000113355

+    Output  eth 1/3 SA000000112233, DA000000113355

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '

+                '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '

+                '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 '

+                '00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_2mpls(base_tests.SimpleDataPlane):

+    """

+    [Encap two MPLS labels]

+      Encap two MPLS labels

+

+    Inject  eth 1/3 Tag 3, SA000000112233, DA000000113355

+    Output  eth 1/1 Tag 2, Outer label 0x903, TTL 250, InLabel 0x901, TTL 250, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 3e fa 00 90 1f fa 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '

+                'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_3mpls(base_tests.SimpleDataPlane):

+    """

+    [Encap 3 MPLS labels]

+      Encap 3 MPLS labels

+

+    Inject  eth 1/3 Tag 3, SA000000112233, DA000000113355

+    Output  eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903, InLabel 0x901, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '

+                '00 00 00 00 00 11 33 55 00 00 00 11 22 33 81 00 '

+                '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 '

+                'c0 a8 01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_penultimate_mpls(base_tests.SimpleDataPlane):

+    """

+    [Penultimate Hop Pop]

+      Pop outermost tunnel label

+

+    Inject  eth 1/1 Tag 2, Outer label 0x901, InLabel 0xF, SA000004223355, DA000004224466

+    Output  eth 1/3 Tag 2, label 0xF, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1e fa 00 01 0b ff 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 01 0f f9 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_2mpls(base_tests.SimpleDataPlane):

+    """

+    [Pop, decap, and L2 forward]

+      Pop outermost tunnel label and pop outer L2 header (L2 Switch VPWS )

+

+    Inject  eth 1/1 Tag 2, Outer label 0x903, InLabel 0x901, SA000004223355, DA000004224466; InTag 5, InSA000000112233, InDA000000113355

+    Output  eth 1/3 Tag 5, SA000000112233, DA000000113355

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x00008847 goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x00008847 goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 3e fa 00 90 1b ff 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '

+                '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '

+                '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_penultimate_swap_mpls(base_tests.SimpleDataPlane):

+    """

+    [Penultimate Hop Pop and swap inner MPLS label]

+      Pop outermost tunnel label and swap inner MPLS label (MS-PW, LSR)

+

+    Inject  eth 1/1 Tag 2, Outer label 0x903, InLabel 0x901, SA000004223355, DA000004224466; InTag 5, InSA000000112233, InDA000000113355

+    Output  eth 1/3 Tag 2, Label 0x905, TTL 249, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x905,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x905,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 3e fa 00 90 1b ff 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 51 f9 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+

+class swap_out_mpls(base_tests.SimpleDataPlane):

+    """

+    [Swap outermost MPLS label]

+      Swap outermost MPLS label (LSR)

+

+    Inject  eth 1/1 Tag 2, Outer label 0x901, TTL 250, InLabel 0xF, DA000004223355, SA000004224466

+    Output  eth 1/3 Tag 2, Outer label 0x9051, TTL 249, InLabel 0xF, SA000004223357, DA000004224467

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:57,set_field=eth_dst=00:00:04:22:44:67,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9051,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:mpls_dec write:group=0x95000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:57,set_field=eth_dst=00:00:04:22:44:67,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9051,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:mpls_dec write:group=0x95000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1e fa 00 01 0b ff 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 67 00 00 04 22 33 57 81 00 00 02 '

+                '88 47 09 05 10 f9 00 01 0b ff 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+

+class swap_encap_mpls(base_tests.SimpleDataPlane):

+    """

+    [Swap and encap a MPLS label]

+      Swap and encap a MPLS label

+

+    Inject  eth 1/1 Tag 2, MPLS label 0x901, TTL 250, DA000004223355, SA000004224466

+    Output  eth 1/3 Tag 2, Outer label 0x9052, TTL 249, InLabel 0xF, SA000004223358, DA000004224468

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 68 00 00 04 22 33 58 81 00 00 02 '

+                '88 47 09 05 21 f9 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class swap_encap_2mpls(base_tests.SimpleDataPlane):

+    """

+    [Swap and encap 2 MPLS labels]

+      Swap and encap 2 MPLS labels

+

+    Inject  eth 1/1 Tag 2, MPLS label 0x901, TTL 250, DA000004223355, SA000004224466

+    Output  eth 1/3 Tag 2, Outest label 0x904, TTL 249, Middle label 0x903, InLabel 0x9052, SA000004223358, DA000004224468

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 68 00 00 04 22 33 58 81 00 00 02 '

+                '88 47 00 90 40 f9 00 90 30 f9 09 05 21 f9 00 00 '

+                '00 00 00 00 00 11 33 55 00 00 00 11 22 33 81 00 '

+                '00 05 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '

+                'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '

+                '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '

+                '18 19 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_1mpls_of3(base_tests.SimpleDataPlane):

+    """

+    [Decap outermost MPLS label of 3 MPLS labels]

+      Decap outermost one MPLS of 3 MPLS labels

+

+    Inject  eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903/250, InLabel 0x901/250, SA000004224466, DA000004223355

+    Output  eth 1/3 Tag 2, Outer label 0x903/249, InLabel 0x901/250, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '

+                '00 00 00 00 00 11 33 55 00 00 00 11 22 33 00 00 '

+                '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '

+                'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '

+                '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '

+                '18 19')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 3e f9 00 90 1f fa 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 00 00 00 03 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '

+                'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '

+                '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_2mpls_of3(base_tests.SimpleDataPlane):

+    """

+    [Decap outermost 2 MPLS labels of 3 MPLS labels]

+      Decap outermost two MPLS of 3 MPLS labels

+

+    Inject  eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903/250, InLabel 0x901/250, SA000004224466, DA000004223355

+    Output  eth 1/3 Tag 2, MPLS Label 0x901/249, SA000004223355, DA000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '

+                '00 00 00 00 00 11 33 55 00 00 00 11 22 33 00 00 '

+                '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '

+                'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '

+                '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '

+                '18 19')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 1f f9 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 00 00 00 03 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_2mpls_ff(base_tests.SimpleDataPlane):

+    """

+    [Encap two MPLS labels with FF]

+      Encap two MPLS labels with fast failover group

+

+    Env eth 1/1 link up; eth 1/5 link down

+    Inject  eth 1/3 Tag 3, SA000000112233, DA000000113355

+    Output  eth 1/1 Tag 2, Outest label 0x931, TTL 250, InLabel 0x901, SA000004223351, DA000004224461

+

+    Env eth 1/1 link down; eth 1/5 link up

+    Inject  eth 1/3 Tag 3, SA000000112233, DA000000113355

+    Output  eth 1/5 Tag 2, Outest label 0x935, TTL 250, InLabel 0x901, SA000004223355, DA000004224465

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:51,set_field=eth_dst=00:00:04:22:44:61,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x931,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000005 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:65,set_field=vlan_vid=2,group=0x20005

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000005 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x935,group=0x90000005

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ff,group=0xA6000001 group=any,port=1,weight=0 group=0x93000001 group=any,port=5,weight=0 group=0x93000005

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0xA6000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+        

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:51,set_field=eth_dst=00:00:04:22:44:61,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x931,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000005 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:65,set_field=vlan_vid=2,group=0x2000"+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000005 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x935,group=0x90000005")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ff,group=0xA6000001 group=any,port="+str(output_port)+",weight=0 group=0x93000001 group=any,port="+str(output_port2)+",weight=0 group=0x93000005")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0xA6000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 61 00 00 04 22 33 51 81 00 00 02 '

+                '88 47 00 93 1e fa 00 90 1f fa 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '

+                'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt2 = simple_packet(

+                '00 00 04 22 44 65 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 93 5e fa 00 90 1f fa 00 00 00 00 00 00 '

+                '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '

+                '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '

+                'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+        #if output_port link down

+        apply_dpctl_mod(self, config, "port-mod port="+str(output_port)+",conf=0x1,mask=0x1")

+        time.sleep(1)

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt2), output_port2)

+        apply_dpctl_mod(self, config, "port-mod port="+str(output_port)+",conf=0x0,mask=0x1")

+

+

+class decap_mpls_acl(base_tests.SimpleDataPlane):

+    """

+    [Decap a MPLS label with ACL]

+      Decap a MPLS label with ACL

+

+    Inject  eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW, InSA000000112233, InDA000000113355

+    Output  eth 1/5 SA000000112233, DA000000113355

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=60,cmd=add,prio=601 tunn_id=0x10001,ofdpa_mpls_l2_port=131328 write:group=0x20005

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 tunn_id=0x10001,ofdpa_mpls_l2_port=131328 write:group=0x2000"+str(output_port))

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '

+                '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '

+                '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '

+                '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '

+                '10 11 12 13 14 15 16 17 18 19 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '

+                '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '

+                '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 '

+                '00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_mpls_l3(base_tests.SimpleDataPlane):

+    """

+    [Encap a MPLS label with L3]

+      Encap a MPLS label with L3 routing

+

+    Inject  eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2

+    Output  eth 1/1 SA000004223355, DA000004224466, Tag2, MPLS label 0x901; IP the same as original

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x90000001")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '

+                '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 1f fa 45 00 00 4e 04 d2 00 00 7e 00 '

+                'b1 81 c0 a8 03 0a c0 a8 02 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_mpls_l3(base_tests.SimpleDataPlane):

+    """

+    [Decap a MPLS label with L3]

+      Decap a MPLS label with L3 routing

+

+    Inject  eth 1/3 Tag 12, SA000000112233, DA000000000111, MPLS 0x1234, SIP 192.168.3.1, DIP 192.168.2.1

+    Output  eth 1/1 Tag 10, SA000006223355, DA000006224466, SIP 192.168.3.1, DIP 192.168.2.1

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0xa0001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=10,group=0xa0001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.3.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000001 goto:60

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0xa000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=10,group=0xa000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.3.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000001 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 01 11 00 00 00 11 22 33 81 00 00 0c '

+                '88 47 01 23 41 3f 45 00 00 26 00 00 00 00 3f 00 '

+                'f5 84 c0 a8 02 01 c0 a8 03 02 00 01 02 03 04 05 '

+                '06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 '

+                '16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 06 22 44 66 00 00 06 22 33 55 81 00 00 0a '

+                '08 00 45 00 00 26 00 00 00 00 3e 00 f6 84 c0 a8 '

+                '02 01 c0 a8 03 02 00 01 02 03 04 05 06 07 08 09 '

+                '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_2mpls_l3(base_tests.SimpleDataPlane):

+    """

+    [Encap two MPLS labels with L3]

+      Encap two MPLS labels with L3 routing

+

+    Inject  eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2

+    Output  eth 1/1 SA000004223355, DA000004224466, Tag2, Outer Label 0x903, EXP 7, TTL 250, Inner Label 0x901, EXP 7, TTL 250; IP the same as original

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '

+                '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 3e fa 00 90 1f fa 45 00 00 4e 04 d2 '

+                '00 00 7e 00 b1 81 c0 a8 03 0a c0 a8 02 02 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class decap_2mpls_l3(base_tests.SimpleDataPlane):

+    """

+    [Decap two MPLS labels with L3]

+      Decap two MPLS labels with L3 routing

+

+    Inject  eth 1/1 SA000004223355, DA000004224466, Tag2, Outer Label 0x903, EXP 7, TTL 250, Inner Label 0x901, SIP 192.168.3.2, DIP 192.168.2.10

+    Output  eth 1/3 SA000006223355, DA000006224466, Tag2, SIP 192.168.3.2, DIP 192.168.2.10

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=2,group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff apply:set_field=ofdpa_vrf:1 goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000003 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff apply:set_field=ofdpa_vrf:1 goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000003 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '

+                '88 47 00 90 3e fa 00 90 1f fa 45 00 00 26 00 00 '

+                '00 00 7e 06 b6 75 c0 a8 03 02 c0 a8 02 0a 00 03 '

+                '00 06 00 01 f7 fa 00 00 00 00 50 00 04 00 2f 5d '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 06 22 44 66 00 00 06 22 33 55 81 00 00 02 '

+                '08 00 45 00 00 26 00 00 00 00 f9 06 3b 75 c0 a8 '

+                '03 02 c0 a8 02 0a 00 03 00 06 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class encap_3mpls_l3(base_tests.SimpleDataPlane):

+    """

+    [Encap 3 MPLS labels with L3]

+      Encap 3 MPLS labels with L3 routing

+

+    Inject  eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2

+    Output  eth 1/1 SA000004223355, DA000004224466, Tag2, OuterLabel 0x904 EXP 7, TTL 250, M 0x903, Inner0x901, EXP 7, TTL 250; IP the same as original

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x94000001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x94000001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '

+                '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 45 00 '

+                '00 4e 04 d2 00 00 7e 00 b1 81 c0 a8 03 0a c0 a8 '

+                '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

diff --git a/acctonUseDpctl/nat.py b/acctonUseDpctl/nat.py
new file mode 100755
index 0000000..47f4a63
--- /dev/null
+++ b/acctonUseDpctl/nat.py
@@ -0,0 +1,371 @@
+import logging

+import oftest.base_tests as base_tests

+from oftest import config

+from oftest.testutils import *

+from util import *

+from accton_util import convertIP4toStr as toIpV4Str

+from accton_util import convertMACtoStr as toMacStr

+

+

+class dnat(base_tests.SimpleDataPlane):

+    """

+    [DNAT]

+      DNAT (inbound)

+

+    Inject  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 200.0.0.1, DIP 100.0.0.01, Sport 2828, Dport 5000

+    Output  eth 1/1 DA000000000101, SA000000000100, Tag 100, SIP 200.0.0.1, DIP 10.0.0.01, Sport 2828, Dport 2000

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x10c8/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x640001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x640001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x23000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x10c8/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x64000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x64000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28")

+        apply_dpctl_mod(self, config, "flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x23000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 02 00 00 00 00 00 02 01 81 00 00 c8 '

+                '08 00 45 00 00 2a 04 d2 00 00 7f 06 0a fa c8 00 '

+                '00 01 64 00 00 01 0b 0c 13 88 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 50 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 00 01 01 00 00 00 00 01 00 81 00 00 64 '

+                '08 00 45 00 00 2a 04 d2 00 00 7e 06 65 fa c8 00 '

+                '00 01 0a 00 00 01 0b 0c 07 d0 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 cf 08 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class dnat_vrf(base_tests.SimpleDataPlane):

+    """

+    [DNAT VRF]

+      DNAT (inbound) with specified VRF

+

+    Inject  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 200.0.0.1, DIP 100.0.0.01, Sport 2828, Dport 5000

+    Output  eth 1/1 DA000000000101, SA000000000100, Tag 100, SIP 200.0.0.1, DIP 10.0.0.01, Sport 2828, Dport 2000

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x10c8/0x1fff goto:20 apply:set_field=ofdpa_vrf:3

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1064/0x1fff goto:20 apply:set_field=ofdpa_vrf:3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x640001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x640001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000,ofdpa_vrf=3 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x23000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x10c8/0x1fff goto:20 apply:set_field=ofdpa_vrf:3")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1064/0x1fff goto:20 apply:set_field=ofdpa_vrf:3")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x64000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x64000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28")

+        apply_dpctl_mod(self, config, "flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000,ofdpa_vrf=3 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x23000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 02 00 00 00 00 00 02 01 81 00 00 c8 '

+                '08 00 45 00 00 2a 04 d2 00 00 7f 06 0a fa c8 00 '

+                '00 01 64 00 00 01 0b 0c 13 88 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 50 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 00 01 01 00 00 00 00 01 00 81 00 00 64 '

+                '08 00 45 00 00 2a 04 d2 00 00 7e 06 65 fa c8 00 '

+                '00 01 0a 00 00 01 0b 0c 07 d0 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 cf 08 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class dnat_ecmp(base_tests.SimpleDataPlane):

+    """

+    [DNAT ECMP]

+      DNAT (inbound) with ECMP

+

+    Inject  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 200.0.0.1, DIP 100.0.0.01, Sport 2828, Dport 5000 [increase SIP]

+    Output  eth 1/1 DA000000000101, SA000000000100, Tag 100, SIP 200.0.0.X, DIP 10.0.0.01, Sport 2828, Dport 2000

+    Output  eth 1/5 DA000005224466, SA000005223355, Tag 2, SIP 200.0.0.X, DIP 10.0.0.01, Sport 2828, Dport 2000

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x10c8/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x640001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x640001

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x23000005 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:55,set_field=eth_dst=00:00:05:22:44:66,set_field=vlan_vid=2,group=0x20005

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=sel,group=0x71000001 group=any,port=any,weight=0 group=0x23000001 group=any,port=any,weight=0 group=0x23000005

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x71000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x10c8/0x1fff goto:20 apply:set_field=ofdpa_vrf:3")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x64000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x64000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x23000005 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:55,set_field=eth_dst=00:00:05:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=sel,group=0x71000001 group=any,port=any,weight=0 group=0x23000001 group=any,port=any,weight=0 group=0x23000005")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=200/0xfff,eth_dst=00:00:00:00:02:00,eth_type=0x0800 goto:28")

+        apply_dpctl_mod(self, config, "flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ip_proto=6,tcp_dst=5000 write:set_field=ip_dst:10.0.0.1,set_field=tcp_dst:2000,group=0x71000001 goto:60")

+

+        #increased SIP

+        input_pkt = simple_packet(

+                '00 00 00 00 02 00 00 00 00 00 02 01 81 00 00 c8 '

+                '08 00 45 00 00 2a 04 d2 00 00 7f 06 0a fa c8 00 '

+                '00 01 64 00 00 01 0b 0c 13 88 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 50 00 00 00 00')

+

+        #random SIP

+        output_pkt = simple_packet(

+                '00 00 00 00 01 01 00 00 00 00 01 00 81 00 00 64 '

+                '08 00 45 00 00 2a 04 d2 00 00 7e 06 65 ee c8 00 '

+                '00 0d 0a 00 00 01 0b 0c 07 d0 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 ce fc 00 00 00 00')

+

+        #random SIP

+        output_pkt2 = simple_packet(

+                '00 00 05 22 44 66 00 00 05 22 33 55 81 00 00 02 '

+                '08 00 45 00 00 2a 04 d2 00 00 7e 06 65 ef c8 00 '

+                '00 0c 0a 00 00 01 0b 0c 07 d0 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 ce fd 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+        verify_packet(self, str(output_pkt2), output_port2)

+

+

+class dnat_decap_mpls(base_tests.SimpleDataPlane):

+    """

+    [Decap MPLS label and DNAT]

+      Decap MPLS label and DNAT

+

+    Inject  eth 1/3 Tag 12, SA000000112233, DA000000000111, MPLS 0x1234, SIP 200.0.0.1, DIP 100.0.0.1

+    Output  eth 1/1 DA000000000101, SA000000000100, Tag 100, SIP 200.0.0.1, DIP 10.0.0.01

+

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x640001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x640001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ofdpa_vrf=1 write:set_field=ip_dst:10.0.0.1,group=0x23000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x64000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x23000001 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:01:00,set_field=eth_dst=00:00:00:00:01:01,set_field=vlan_vid=100,group=0x64000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24")

+        apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=28,cmd=add,prio=281 eth_type=0x800,ip_dst=100.0.0.1,ofdpa_vrf=1 write:set_field=ip_dst:10.0.0.1,group=0x23000001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 01 11 00 00 00 11 22 33 81 00 00 0c '

+                '88 47 01 23 41 3f 45 00 00 26 00 00 00 00 3f 00 '

+                '4f d6 c8 00 00 01 64 00 00 01 00 01 02 03 04 05 '

+                '06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 '

+                '16 17 18 19')

+

+        output_pkt = simple_packet(

+                '00 00 00 00 01 01 00 00 00 00 01 00 81 00 00 64 '

+                '08 00 45 00 00 26 00 00 00 00 3e 00 aa d6 c8 00 '

+                '00 01 0a 00 00 01 00 01 02 03 04 05 06 07 08 09 '

+                '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class snat(base_tests.SimpleDataPlane):

+    """

+    [SNAT]

+      SNAT (outbound)

+

+    Inject  eth 1/1 DA000000000100, SA000000000101, Tag 100, SIP 10.0.0.1, DIP 200.0.0.01, Sport 2000, Dport 2828

+    Output  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 100.0.0.1, DIP 200.0.0.01, Sport 5000, Dport 2828

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1064/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0xC80003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC80003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0 write:group=0x22000002 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1064/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0xC8000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC8000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0 write:group=0x22000002 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 01 00 00 00 00 00 02 00 81 00 00 64 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 06 64 f6 0a 00 '

+                '00 01 c8 00 00 01 07 d0 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 cf 04 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 00 02 01 00 00 00 00 02 00 81 00 00 c8 '

+                '08 00 45 00 00 2e 04 d2 00 00 7e 06 0b f6 64 00 '

+                '00 01 c8 00 00 01 13 88 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 4c 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class snat_vrf(base_tests.SimpleDataPlane):

+    """

+    [SNAT VRF]

+      SNAT (outbound) with specified VRF

+

+    Inject  eth 1/1 DA000000000100, SA000000000101, Tag 100, SIP 10.0.0.1, DIP 200.0.0.01, Sport 2000, Dport 2828

+    Output  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 100.0.0.1, DIP 200.0.0.01, Sport 5000, Dport 2828

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1064/0x1fff goto:20 apply:set_field=ofdpa_vrf:3

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x10c8/0x1fff goto:20 apply:set_field=ofdpa_vrf:3

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0xC80003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC80003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000,ofdpa_vrf=3 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0,ofdpa_vrf=3 write:group=0x22000002 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1064/0x1fff goto:20 apply:set_field=ofdpa_vrf:3")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x10c8/0x1fff goto:20 apply:set_field=ofdpa_vrf:3")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0xC8000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC8000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000,ofdpa_vrf=3 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0,ofdpa_vrf=3 write:group=0x22000002 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 00 01 00 00 00 00 00 02 00 81 00 00 64 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 06 64 f6 0a 00 '

+                '00 01 c8 00 00 01 07 d0 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 cf 04 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 00 02 01 00 00 00 00 02 00 81 00 00 c8 '

+                '08 00 45 00 00 2e 04 d2 00 00 7e 06 0b f6 64 00 '

+                '00 01 c8 00 00 01 13 88 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 4c 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class snat_ecmp(base_tests.SimpleDataPlane):

+    """

+    [SNAT ECMP]

+      SNAT (outbound) with ECMP

+

+    Inject  eth 1/1 DA000000000100, SA000000000101, Tag 100, SIP 10.0.0.1, DIP 200.0.0.01, Sport 2000, Dport 2828 [increase DIP]

+    Output  eth 1/3 DA000000000200, SA000000000201, Tag 200, SIP 100.0.0.1, DIP 200.0.0.X, Sport 5000, Dport 2828

+    Output  eth 1/5 DA000000000500, SA000000000501, Tag 5, SIP 100.0.0.1, DIP 200.0.0.X, Sport 5000, Dport 2828

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1064/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0xC80003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC80003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x50005 group=any,port=any,weight=0 output=5

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x22000005 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:05:00,set_field=eth_dst=00:00:00:00:05:01,set_field=vlan_vid=5,group=0x50005

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=sel,group=0x71000001 group=any,port=any,weight=0 group=0x22000002 group=any,port=any,weight=0 group=0x22000005

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0 write:group=0x71000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1064/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=100/0xfff,eth_dst=00:00:00:00:01:00,eth_type=0x0800 goto:29")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0xC8000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x22000002 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:02:00,set_field=eth_dst=00:00:00:00:02:01,set_field=vlan_vid=200,group=0xC8000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x5000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x22000005 group=any,port=any,weight=0 set_field=eth_src=00:00:00:00:05:00,set_field=eth_dst=00:00:00:00:05:01,set_field=vlan_vid=5,group=0x5000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=sel,group=0x71000001 group=any,port=any,weight=0 group=0x22000002 group=any,port=any,weight=0 group=0x22000005")

+        apply_dpctl_mod(self, config, "flow-mod table=29,cmd=add,prio=291 eth_type=0x800,ip_src=10.0.0.1,ip_proto=6,tcp_src=2000 write:set_field=ip_src:100.0.0.1,set_field=tcp_src:5000 goto:30")

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=200.0.0.1/255.255.255.0 write:group=0x71000001 goto:60")

+

+        #increased DIP

+        input_pkt = simple_packet(

+                '00 00 00 00 01 00 00 00 00 00 02 00 81 00 00 64 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 06 64 f6 0a 00 '

+                '00 01 c8 00 00 01 07 d0 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 cf 04 00 00 00 00 00 00 00 00')

+

+        #rnadom DIP

+        output_pkt = simple_packet(

+                '00 00 00 00 02 01 00 00 00 00 02 00 81 00 00 c8 '

+                '08 00 45 00 00 2e 04 d2 00 00 7e 06 0b e8 64 00 '

+                '00 01 c8 00 00 0f 13 88 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 3e 00 00 00 00 00 00 00 00')

+

+        #rnadom DIP

+        output_pkt2 = simple_packet(

+                '00 00 00 00 05 01 00 00 00 00 05 00 81 00 00 05 '

+                '08 00 45 00 00 2e 04 d2 00 00 7e 06 0b f4 64 00 '

+                '00 01 c8 00 00 03 13 88 0b 0c 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 69 4a 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+        verify_packet(self, str(output_pkt2), output_port2)

diff --git a/acctonUseDpctl/phase1.py b/acctonUseDpctl/phase1.py
new file mode 100755
index 0000000..88d788e
--- /dev/null
+++ b/acctonUseDpctl/phase1.py
@@ -0,0 +1,398 @@
+import logging

+import oftest.base_tests as base_tests

+from oftest import config

+from oftest.testutils import *

+from util import *

+from accton_util import convertIP4toStr as toIpV4Str

+from accton_util import convertMACtoStr as toMacStr

+

+

+class l3ucast_route(base_tests.SimpleDataPlane):

+    """

+    [L3 unicast route]

+      Do unicast route and output to specified port

+

+    Inject  eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 192.168.1.100, DIP 192.168.2.2

+    Output  eth 1/1 Tag3, SA 000004223355, DA 000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x30001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x20000003 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x3000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x20000003 goto:60")

+

+        input_pkt = simple_packet(

+                '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '

+                '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 03 '

+                '08 00 45 00 00 4e 04 d2 00 00 7e 06 b3 7b c0 a8 '

+                '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class l3ucast_route6(base_tests.SimpleDataPlane):

+    """

+    [L3 IPv6 unicast route]

+      Do unicast route and output to specified port

+

+    Inject  eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 2014::2, DIP 2014::1

+    Output  eth 1/1 Tag2, SA 000004223355, DA 000004224466

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60")

+

+        input_pkt = simple_packet(

+                '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '

+                '86 dd 60 00 00 00 00 08 11 7f 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '

+                'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '

+                '86 dd 60 00 00 00 00 08 11 7e 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '

+                'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class l3mcast_route(base_tests.SimpleDataPlane):

+    """

+    [L3 multicast route]

+      Do multicast route and output to specified ports

+

+    Inject  eth 1/3 Tag2, SA000000112233, DA01005E404477, SIP 192.168.1.100, DIP 224.0.2.2

+    Output  eth 1/1 original

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60")

+

+        input_pkt = simple_packet(

+                '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '

+                '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '

+                '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '

+                '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class l3mcast_route6(base_tests.SimpleDataPlane):

+    """

+    [L3 IPv6 multicast route]

+      Do multicast route and output to specified ports

+

+    Inject  eth 1/5 Tag2, SA000000112233, DA333300224477, SIP 2014::2, DIP ff01::2

+    Output  eth 1/1 Tag2, original

+    Output  eth 1/3 Tag3, original

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x30003

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x50000003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=501 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x3000"+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x50000003")

+        apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60")

+

+        input_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt2 = simple_packet(

+                '33 33 00 22 44 77 00 00 05 22 33 99 81 00 00 03 '

+                '86 dd 60 00 00 00 00 26 3b 7e 20 14 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+        verify_packet(self, str(output_pkt2), output_port2)

+

+

+class bridge_ucast(base_tests.SimpleDataPlane):

+    """

+    [Bridge unicast]

+      Do unicast bridge

+

+    Inject  eth 1/1 Tag2, SA000000112233, DA000000224477, SIP 192.168.2.1, DIP 192.168.2.2

+    Output  eth 1/3 untag

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x20003 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x2000"+str(output_port)+" goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '

+                '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '

+                '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '

+                '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+

+class bridge_mcast(base_tests.SimpleDataPlane):

+    """

+    [Bridge multicast]

+      Do multicast bridge

+

+    Inject  eth 1/5 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2

+    Output  eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2

+    Output  eth 1/3 untag

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60")

+

+        input_pkt = simple_packet(

+                '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '

+                '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '

+                '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt2 = simple_packet(

+                '11 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '

+                '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '

+                '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+        verify_packet(self, str(output_pkt2), output_port2)

+

+

+class bridge_dlf(base_tests.SimpleDataPlane):

+    """

+    [Bridge DLF]

+      Do DLF bridge

+

+    Inject  eth 1/5 Tag2, SA000000112233, DA110000224466, SIP 192.168.2.1, DIP 192.168.2.2

+    Output  eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2

+    Output  eth 1/3 untag

+

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3

+    ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003

+    ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+        output_port2 = test_ports[2]

+

+        apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60")

+

+        input_pkt = simple_packet(

+                '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '

+                '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '

+                '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt2 = simple_packet(

+                '00 00 00 22 44 66 00 00 00 11 22 33 08 00 45 00 '

+                '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '

+                '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+        verify_packet(self, str(output_pkt2), output_port2)

+

diff --git a/acctonUseDpctl/pim_bidr.py b/acctonUseDpctl/pim_bidr.py
new file mode 100755
index 0000000..f603c15
--- /dev/null
+++ b/acctonUseDpctl/pim_bidr.py
@@ -0,0 +1,165 @@
+import logging

+import oftest.base_tests as base_tests

+from oftest import config

+from oftest.testutils import *

+from util import *

+from accton_util import convertIP4toStr as toIpV4Str

+from accton_util import convertMACtoStr as toMacStr

+

+

+class test_v4(base_tests.SimpleDataPlane):

+    """

+    [PIM BIDR IPv4]

+      PIM BIDR IPv4

+

+    Inject  eth 1/3 tag 3, SA unknown, DA 01005E010101, SIP 192.168.2.1, DIP 224.0.0.1

+    Output  eth 1/1 tag 2, SA 000001223355, DA 01005e010101, SIP 192.168.2.1, DIP 224.0.0.1

+

+    Inject  eth 1/1 tag 2, SA unknown, DA 01005E010101, SIP 192.168.2.1, DIP 224.0.0.1

+    Output  eth 1/3 tag 3, SA 000002223355, DA 01005e010101, SIP 192.168.2.1, DIP 224.0.0.1

+

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x00001fff goto:20

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x00001fff goto:20

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:01:01:01/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=1 output=1

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=1 output=3

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x58000001 group=any,port=any,weight=0 set_field=eth_src=00:00:01:22:33:55,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x58000002 group=any,port=any,weight=0 set_field=eth_src=00:00:02:22:33:55,set_field=vlan_vid=3,group=0x30003

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=all,group=0x60058001 group=any,port=any,weight=1 group=0x58000001 group=any,port=any,weight=1 group=0x58000002

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=40,cmd=add,prio=401 eth_type=0x800,ip_dst=224.0.0.1 write:group=0x60058001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1002/0x00001fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x00001fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:01:01:01/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x58000001 group=any,port=any,weight=0 set_field=eth_src=00:00:01:22:33:55,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x58000002 group=any,port=any,weight=0 set_field=eth_src=00:00:02:22:33:55,set_field=vlan_vid=3,group=0x3000"+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60058001 group=any,port=any,weight=1 group=0x58000001 group=any,port=any,weight=1 group=0x58000002")

+        apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x800,ip_dst=224.0.0.1 write:group=0x60058001 goto:60")

+

+        input_pkt = simple_packet(

+                '01 00 5e 01 01 01 00 00 00 00 00 aa 81 00 00 03 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 94 33 c0 a8 '

+                '02 01 e0 00 00 01 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '01 00 5e 01 01 01 00 00 01 22 33 55 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7e 00 95 33 c0 a8 '

+                '02 01 e0 00 00 01 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+        input_pkt = simple_packet(

+                '01 00 5e 01 01 01 00 00 00 00 00 aa 81 00 00 02 '

+                '08 00 45 00 00 4e 04 d2 00 00 7f 00 94 33 c0 a8 '

+                '02 01 e0 00 00 01 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '01 00 5e 01 01 01 00 00 02 22 33 55 81 00 00 03 '

+                '08 00 45 00 00 4e 04 d2 00 00 7e 00 95 33 c0 a8 '

+                '02 01 e0 00 00 01 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(output_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), input_port)

+

+

+class test_v6(base_tests.SimpleDataPlane):

+    """

+    [PIM BIDR IPv4]

+      PIM BIDR IPv4

+

+    Inject  eth 1/3 tag 3, SA unknown, DA 333300224477, SIP 2015::1, DIP ff01::2, UDP proto

+    Output  eth 1/1 tag 2, SA 000001223355, DA 333300224477, SIP 2015::1, DIP ff01::2

+

+    Inject  eth 1/1 tag 2, SA unknown, DA 333300224477, SIP 2015::1, DIP ff01::2, UDP proto

+    Output  eth 1/3 tag 3, SA 000002223355, DA 333300224477, SIP 2015::1, DIP ff01::2

+

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff goto:20

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=1 output=1

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=1 output=3

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x58000001 group=any,port=any,weight=0 set_field=eth_src=00:00:01:22:33:55,set_field=vlan_vid=2,group=0x20001

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=ind,group=0x58000002 group=any,port=any,weight=0 set_field=eth_src=00:00:02:22:33:55,set_field=vlan_vid=3,group=0x30003

+    ./dpctl tcp:0.0.0.0:6633 group-mod cmd=add,type=all,group=0x60058001 group=any,port=any,weight=1 group=0x58000001 group=any,port=any,weight=1 group=0x58000002

+    ./dpctl tcp:0.0.0.0:6633 flow-mod table=40,cmd=add,prio=401 eth_type=0x86dd,ipv6_dst=ff01::2 write:group=0x60058001 goto:60

+    """

+    def runTest(self):

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+

+        test_ports = sorted(config["port_map"].keys())

+

+        input_port = test_ports[0]

+        output_port = test_ports[1]

+

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1002/0x00001fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x00001fff goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x58000001 group=any,port=any,weight=0 set_field=eth_src=00:00:01:22:33:55,set_field=vlan_vid=2,group=0x2000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x58000002 group=any,port=any,weight=0 set_field=eth_src=00:00:02:22:33:55,set_field=vlan_vid=3,group=0x3000"+str(input_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60058001 group=any,port=any,weight=1 group=0x58000001 group=any,port=any,weight=1 group=0x58000002")

+        apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x86dd,ipv6_dst=ff01::2 write:group=0x60058001 goto:60")

+

+        input_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 00 00 00 aa 81 00 00 03 '

+                '86 dd 60 00 00 00 00 26 11 7f 20 15 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 3f 00 41 00 26 '

+                '71 8f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d '

+                '0e 0f 10 11 12 13 14 15 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 01 22 33 55 81 00 00 02 '

+                '86 dd 60 00 00 00 00 26 11 7e 20 15 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 3f 00 41 00 26 '

+                '71 8f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d '

+                '0e 0f 10 11 12 13 14 15 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(input_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), output_port)

+

+        input_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 00 00 00 aa 81 00 00 02 '

+                '86 dd 60 00 00 00 00 26 11 7f 20 15 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 3f 00 41 00 26 '

+                '71 8f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d '

+                '0e 0f 10 11 12 13 14 15 00 00 00 00 00 00 00 00')

+

+        output_pkt = simple_packet(

+                '33 33 00 22 44 77 00 00 02 22 33 55 81 00 00 03 '

+                '86 dd 60 00 00 00 00 26 11 7e 20 15 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 02 00 3f 00 41 00 26 '

+                '71 8f 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d '

+                '0e 0f 10 11 12 13 14 15 00 00 00 00 00 00 00 00')

+

+        self.dataplane.send(output_port, str(input_pkt))

+        verify_packet(self, str(output_pkt), input_port)

diff --git a/acctonUseDpctl/stats.py b/acctonUseDpctl/stats.py
new file mode 100755
index 0000000..312ab60
--- /dev/null
+++ b/acctonUseDpctl/stats.py
@@ -0,0 +1,70 @@
+import logging

+import oftest.base_tests as base_tests

+from oftest import config

+from oftest.testutils import *

+from util import *

+

+

+class table_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-table")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Table stats reply nothing")

+

+class port_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-port")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Ports stats reply nothing")

+

+class queue_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-queue")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Queue stats reply nothing")

+

+class flow_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-flow")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Flow stats reply nothing")

+

+class aggr_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-aggr")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["flow_cnt"], 0, "No flow exist")

+

+class group_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-group")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Group stats reply nothing")

+

+class group_desc_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-group-desc")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Group desc stats reply nothing")

+

+class meter_stats(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "stats-meter")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Meter stats reply nothing")

+

+class meter_config(base_tests.SimpleDataPlane):

+    def runTest(self):

+        json_result = apply_dpctl_get_cmd(self, config, "meter-config")

+        #pprint(json_result)

+        result=json_result["RECEIVED"][1]

+        self.assertNotEqual(result["stats"], {}, "Meter config reply nothing")

+

diff --git a/acctonUseDpctl/util.py b/acctonUseDpctl/util.py
index b8d451e..bf10d3b 100755
--- a/acctonUseDpctl/util.py
+++ b/acctonUseDpctl/util.py
@@ -2,6 +2,7 @@
 import json

 import os

 from pprint import pprint

+import time

 

 test_tmp_file=os.getcwd()+os.sep+"dpctloutputtmp.tmp"

 

@@ -12,8 +13,9 @@
         assert(0)

 

     #apply dpctl command     

-    subprocess.call("dpctl tcp:"+switch_ip+":6633 "+cmd+" > "+test_tmp_file, shell=True)

-

+    subprocess.call(os.getcwd()+"/dpctl tcp:"+switch_ip+":6633 "+cmd+" > "+test_tmp_file, shell=True)

+#    subprocess.call("dpctl tcp:"+switch_ip+":6633 "+cmd+" > "+test_tmp_file, shell=True)

+    time.sleep(0.2)

     

 def apply_dpctl_get_cmd(test, config, cmd):

 

@@ -23,7 +25,7 @@
         subprocess.call(["sudo", "chmod", "a+w", test_tmp_file])

 

     apply_dpctl(test, config, cmd)

-    

+

     #parse result

     with open(test_tmp_file) as tmp_file:

         try:

diff --git a/acctonUseDpctl/vlan_translate.py b/acctonUseDpctl/vlan_translate.py
index 04f0037..e0d5c6a 100755
--- a/acctonUseDpctl/vlan_translate.py
+++ b/acctonUseDpctl/vlan_translate.py
@@ -32,22 +32,23 @@
 

         apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:push_vlan=0x8100,set_field=vlan_vid=5 goto:20")

         apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=3/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x50001 group=any,port=any,weight=0 output=1"+str(output_port))

-        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x50001")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

-        apply_dpctl_mod(self, config, " flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x30003 goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x5000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x5000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(input_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

+        apply_dpctl_mod(self, config, " flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x3000"+str(input_port)+" goto:60")

 

-        input_pkt = simple_tcp_packet(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      dl_vlan_enable=True,

-                                      vlan_vid=3)

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

 

-        output_pkt = simple_tcp_packet_two_vlan(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      out_dl_vlan_enable=True,

-                                      in_dl_vlan_enable=True,

-                                      out_vlan_vid=5,

-                                      in_vlan_vid=3)

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '

+                '81 00 00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 '

+                'b2 47 c0 a8 01 64 c0 a8 02 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00')

         

         self.dataplane.send(input_port, str(input_pkt))

         verify_packet(self, str(output_pkt), output_port)

@@ -81,24 +82,24 @@
         output_port = test_ports[1]

 

         apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1006/0x1fff apply:pop_vlan,set_field=ofdpa_ovid:6 goto:11")

-        apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff,ofdpa_ovid=0x1006 goto:20")

+        apply_dpctl_mod(self, config, "flow-mod table=11,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff,ofdpa_ovid=0x1006 goto:20")

         apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=6/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")        

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x30001 group=any,port=any,weight=0 output="+str(output_port))

-        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x30001")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x60003 group=any,port=any,weight=0 output="+str(input_port))

-        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=6,eth_dst=00:00:00:11:22:33 write:group=0x60003 goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x3000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x6000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=6,eth_dst=00:00:00:11:22:33 write:group=0x6000"+str(input_port)+" goto:60")

 

-        input_pkt = simple_tcp_packet_two_vlan(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      out_dl_vlan_enable=True,

-                                      in_dl_vlan_enable=True,

-                                      out_vlan_vid=6,

-                                      in_vlan_vid=3)

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 06 '

+                '81 00 00 03 08 00 45 00 00 2a 04 d2 00 00 7f 00 '

+                'b2 4b c0 a8 01 64 c0 a8 02 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

 

-        output_pkt = simple_tcp_packet(eth_dst="00:00:04:22:44:66",

-                                       eth_src="00:00:04:22:33:55",

-                                       dl_vlan_enable=True,

-                                       vlan_vid=5)

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2a 04 d2 00 00 7f 00 b2 4b c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

         

         self.dataplane.send(input_port, str(input_pkt))

         verify_packet(self, str(output_pkt), output_port)

@@ -106,7 +107,7 @@
         

 

 

-class vlan_translate(base_tests.SimpleDataPlane):

+class double2single_vlan_translate(base_tests.SimpleDataPlane):

     """																					 

 	[Double tag to single tag and modify inner tag]																				

 		Pop outter tag of incoming double tagged packet and modify inner tag																			

@@ -134,24 +135,22 @@
         apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1006/0x1fff apply:pop_vlan,set_field=ofdpa_ovid:6 goto:11")

         apply_dpctl_mod(self, config, "flow-mod table=11,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff,ofdpa_ovid=0x1006 apply:set_field=vlan_vid=4 goto:20")

         apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=6/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")        

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x40001 group=any,port=any,weight=0 output="+str(output_port))

-        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x40001")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x4000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x4000"+str(output_port))

         apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x60003 group=any,port=any,weight=0 output="+str(input_port))

-        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=6,eth_dst=00:00:00:11:22:33 write:group=0x60003 goto:60")

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=6,eth_dst=00:00:00:11:22:33 write:group=0x6000"+str(input_port)+" goto:60")

 

-        input_pkt = simple_tcp_packet_two_vlan(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      out_dl_vlan_enable=True,

-                                      in_dl_vlan_enable=True,

-                                      out_vlan_vid=6,

-                                      in_vlan_vid=3)

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 06 '

+                '81 00 00 03 08 00 45 00 00 2a 04 d2 00 00 7f 00 '

+                'b2 4b c0 a8 01 64 c0 a8 02 02 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

 

-        output_pkt = simple_tcp_packet_two_vlan(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      out_dl_vlan_enable=True,

-                                      in_dl_vlan_enable=True,

-                                      out_vlan_vid=6,

-                                      in_vlan_vid=4)

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 04 '

+                '08 00 45 00 00 2a 04 d2 00 00 7f 00 b2 4b c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00')

 

         self.dataplane.send(input_port, str(input_pkt))

         verify_packet(self, str(output_pkt), output_port)   

@@ -184,20 +183,22 @@
 

         apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=vlan_vid=5 goto:20")

         apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=3/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x50001 group=any,port=any,weight=0 output="+str(output_port))

-        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x50001")

-        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

-        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x30003 goto:60")

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x5000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))

+        apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 eth_type=0x0800,in_port="+str(input_port)+" write:group=0x5000"+str(output_port))

+        apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(input_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(input_port))

+        apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=3,eth_dst=00:00:00:11:22:33 write:group=0x3000"+str(input_port)+" goto:60")

 

-        input_pkt = simple_tcp_packet(eth_dst="00:00:00:11:33:55",

-                                      eth_src="00:00:00:11:22:33",

-                                      dl_vlan_enable=True,

-                                      vlan_vid=3)

+        input_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

 

-        output_pkt = simple_tcp_packet(eth_dst="00:00:00:11:33:55",

-                                       eth_src="00:00:00:11:22:33",

-                                       dl_vlan_enable=True,

-                                       vlan_vid=5)

-        

+        output_pkt = simple_packet(

+                '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '

+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '

+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '

+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')

+

         self.dataplane.send(input_port, str(input_pkt))

         verify_packet(self, str(output_pkt), output_port)        
\ No newline at end of file
diff --git a/command.sh b/command.sh
index 9d3577a..cc8cd75 100755
--- a/command.sh
+++ b/command.sh
@@ -1 +1,2 @@
-sudo ./oft --verbose --default-timeout=6 -i 1@eth1 -i 2@eth2 -i 3@eth3 --disable-ipv6 --switch-ip=192.168.2.2 --host=192.168.2.4 --of-version=1.3 --port=6633 --test-dir=accton --log-dir=log-dir
+#sudo ./oft --verbose --default-timeout=6 -i 1@eth1 -i 2@eth2 -i 3@eth3 --disable-ipv6 --switch-ip=192.168.2.2 --host=192.168.2.4 --of-version=1.3 --port=6633 --test-dir=accton --log-dir=log-dir
+sudo ./oft --verbose --default-timeout=6 -i 1@eth1 -i 2@eth2 -i 3@eth3 --disable-ipv6 --switch-ip=192.168.2.197 --host=192.168.2.4 --of-version=1.3 --port=6633 --test-dir=acctonUseDpctl --log-dir=log-dir phase1
\ No newline at end of file
diff --git a/src/python/.gitignore b/src/python/.gitignore
old mode 100644
new mode 100755
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 256bfcd..5dbc0dc 100755
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -67,6 +67,16 @@
     else:
         return 0
 
+def simple_packet(content='00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '
+                '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '
+                '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
+                '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'):
+    data = (content)
+    data_list = data.split(" ")
+    pkt = ''.join(data_list).decode('hex')
+
+    return pkt
+
 def simple_tcp_packet(pktlen=100, 
                       eth_dst='00:01:02:03:04:05',
                       eth_src='00:06:07:08:09:0a',