add vxlan test case
diff --git a/accton/flow_test.py b/accton/flow_test.py
index c2e65d2..8755857 100755
--- a/accton/flow_test.py
+++ b/accton/flow_test.py
@@ -101,6 +101,60 @@
                         

                 verify_no_other_packets(self)

 

+class L2Flood(base_tests.SimpleDataPlane):

+    """

+    Test L2 unknown unicast flooding and broadcast flood

+    """

+    def runTest(self):

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

+

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+        # table 10: vlan

+        # send to table 20

+        add_vlan_table_flow(self.controller, ports, 1)

+

+        # group table

+        # set up untag groups for each port

+        add_l2_interface_grouop(self.controller, ports, 1,  False, 1)

+

+        input_port = ports.pop()

+        flood_ports= ports

+        print "flood_ports %s"%flood_ports

+        print "input_port %s"%input_port        

+        #no fllod group create, veriy all drop

+        parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')

+        pkt = str(parsed_pkt)

+        self.dataplane.send(input_port, pkt)

+        verify_no_other_packets(self)

+        parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')

+        pkt = str(parsed_pkt)

+        self.dataplane.send(input_port, pkt)

+        verify_no_other_packets(self)        

+        #add flood groupo    

+        msg=add_l2_flood_group(self.controller, flood_ports, 1, 1)

+        add_bridge_flow(self.controller, None, 1, msg.group_id, True)

+        #verify flood 

+        parsed_pkt = simple_tcp_packet(eth_dst='00:12:34:56:78:9a')

+        pkt = str(parsed_pkt)

+        self.dataplane.send(input_port, pkt)

+        for ofport in flood_ports:

+            verify_packet(self, pkt, ofport)

+

+        verify_no_other_packets(self)

+               

+        for ofport in flood_ports:

+            self.dataplane.send(ofport, pkt)

+            verify_no_packet(self, pkt, ofport)

+        verify_no_other_packets(self)

+

+        parsed_pkt = simple_tcp_packet(eth_dst='FF:FF:FF:FF:FF:FF')

+        pkt = str(parsed_pkt)

+        self.dataplane.send(input_port, pkt)

+        for ofport in flood_ports:

+            verify_packet(self, pkt, ofport)        

+        

+        

 class PacketInMiss(base_tests.SimpleDataPlane):

     """

     Test packet in function for a table-miss flow

@@ -231,7 +285,8 @@
 

 class L3UcastRoute(base_tests.SimpleDataPlane):

     """

-    P1(vlan1, 192.168.1.1) , port2(vlan2, 19.168.2.1)

+    Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) , 

+    Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)

     """

     def runTest(self):          

         delete_all_flows(self.controller)

@@ -314,12 +369,219 @@
         pkt=str(exp_pkt) 

         verify_packet(self, pkt, port1)

         verify_no_other_packets(self)    

-    

-class L3McastRoute(base_tests.SimpleDataPlane):

+

+

+class L3UcastECMP(base_tests.SimpleDataPlane):

+    """

+    Port1(vlan1, 0x00, 0x00, 0x00, 0x22, 0x22, 0x01, 192.168.1.1) , 

+    Port2(vlan2, 0x00, 0x00, 0x00, 0x22, 0x22, 0x02, 19.168.2.1)

+    """

     def runTest(self):          

         delete_all_flows(self.controller)

         delete_all_groups(self.controller)

+

+        if len(config["port_map"]) <2:

+            logging.info("Port count less than 2, can't run this case")

+            return

         

+        vlan_id=1

+        intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]

+        dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]

+        dip=0xc0a80001

+        for port in config["port_map"].keys():

+            #add l2 interface group

+            add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)

+            dst_mac[5]=vlan_id

+            l3_msg=add_l3_unicast_group(self.controller, port, vlanid=vlan_id, id=vlan_id, src_mac=intf_src_mac, dst_mac=dst_mac)            

+            ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [l3_msg.group_id])

+            #add vlan flow table

+            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)

+            #add termination flow

+            add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)           

+            #add unicast routing flow

+            dst_ip = dip + (vlan_id<<8)

+            #ECMP shall have prefix not 32

+            add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id)            

+            vlan_id += 1

+        

+        do_barrier(self.controller)  

+        

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

+        port2=config["port_map"].keys()[1]

+        #port 1 to port 2        

+        switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])

+        dst_mac[5]=1

+        port1_mac=':'.join(['%02X' % x for x in dst_mac])

 

+        parsed_pkt = simple_tcp_packet(pktlen=100, 

+                                       eth_dst=switch_mac,

+                                       eth_src=port1_mac,

+                                       ip_ttl=64,

+                                       ip_src="192.168.1.1",

+                                       ip_dst='192.168.2.1')

+        pkt=str(parsed_pkt)

+        self.dataplane.send(port1, pkt)

+        #build expect packet

+        dst_mac[5]=2

+        port2_mac=':'.join(['%02X' % x for x in dst_mac])  

+        exp_pkt = simple_tcp_packet(pktlen=100, 

+                                       eth_dst=port2_mac,

+                                       eth_src=switch_mac,

+                                       ip_ttl=63,

+                                       ip_src="192.168.1.1",

+                                       ip_dst='192.168.2.1')        

+        pkt=str(exp_pkt)

+        verify_packet(self, pkt, port2)

+        verify_no_other_packets(self)

 

-    
\ No newline at end of file
+        #port 2 to port 1

+        switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])

+        dst_mac[5]=2

+        port2_mac=':'.join(['%02X' % x for x in dst_mac])  

+

+        parsed_pkt = simple_tcp_packet(pktlen=100, 

+                                       eth_dst=switch_mac,

+                                       eth_src=port2_mac,

+                                       ip_ttl=64,

+                                       ip_src="192.168.2.1",

+                                       ip_dst='192.168.1.1')

+        pkt=str(parsed_pkt)                                       

+        self.dataplane.send(port2, pkt)

+        #build expect packet

+        dst_mac[5]=1

+        port1_mac=':'.join(['%02X' % x for x in dst_mac])  

+        exp_pkt = simple_tcp_packet(pktlen=100, 

+                                       eth_dst=port1_mac,

+                                       eth_src=switch_mac,

+                                       ip_ttl=63,

+                                       ip_src="192.168.2.1",

+                                       ip_dst='192.168.1.1')        

+        pkt=str(exp_pkt) 

+        verify_packet(self, pkt, port1)

+        verify_no_other_packets(self)    

+    

+        

+class L3McastRoute1(base_tests.SimpleDataPlane):

+    """

+    Mcast routing, From VLAN 1 to VLAN 2

+    """

+    def runTest(self):          

+        """

+        port1 (vlan 1)-> port 2 (vlan 2)

+        """

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+        

+        if len(config["port_map"]) <2:

+            logging.info("Port count less than 2, can't run this case")

+            return

+

+        vlan_id =1

+        out_vlan=2

+        in_vlan=1 #macast group vid shall use input vlan diffe from l3 interface use output vlan        

+        intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]

+        intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])        

+        dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]

+        dst_mac_str=':'.join(['%02X' % x for x in dst_mac])

+        port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]

+        port1_mac_str=':'.join(['%02X' % x for x in port1_mac])

+        src_ip=0xc0a80101

+        src_ip_str="192.168.1.1"

+        dst_ip=0xe0010101

+        dst_ip_str="224.1.1.1"

+        

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

+        port2=config["port_map"].keys()[1]

+        

+        #add l2 interface group

+        for port in config["port_map"].keys():        

+            add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)           

+            #add vlan flow table

+            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)            

+            vlan_id +=1            

+

+        #add termination flow

+        add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)

+

+        #add l3 interface group

+        port2_ucast_msg=add_l3_interface_group(self.controller, port2, out_vlan, 2, intf_src_mac)

+        mcat_group_msg=add_l3_mcast_group(self.controller, in_vlan,  2, [port2_ucast_msg.group_id])

+        add_mcast4_routing_flow(self.controller, in_vlan, src_ip, 0, dst_ip, mcat_group_msg.group_id)               

+        

+        parsed_pkt = simple_udp_packet(pktlen=100, 

+                                       eth_dst=dst_mac_str,

+                                       eth_src=port1_mac_str,

+                                       ip_ttl=64,

+                                       ip_src=src_ip_str,

+                                       ip_dst=dst_ip_str)

+        pkt=str(parsed_pkt)

+        self.dataplane.send(port1, pkt)            

+        parsed_pkt = simple_udp_packet(pktlen=100, 

+                                       eth_dst=dst_mac_str,

+                                       eth_src=intf_src_mac_str,

+                                       ip_ttl=63,

+                                       ip_src=src_ip_str,

+                                       ip_dst=dst_ip_str)

+        pkt=str(parsed_pkt)            

+        verify_packet(self, pkt, port2)

+        verify_no_other_packets(self)               

+

+        

+class L3McastRoute2(base_tests.SimpleDataPlane):

+    """

+    Mcast routing, From VLAN 1 to VLAN 2

+    """

+    def runTest(self):          

+        """

+        port1 (vlan 1)-> port 2 (vlan 1)

+        """

+        delete_all_flows(self.controller)

+        delete_all_groups(self.controller)

+        

+        if len(config["port_map"]) <2:

+            logging.info("Port count less than 2, can't run this case")

+            return

+

+        vlan_id =1

+        intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]

+        intf_src_mac_str=':'.join(['%02X' % x for x in intf_src_mac])        

+        dst_mac=[0x01, 0x00, 0x5e, 0x01, 0x01, 0x01]

+        dst_mac_str=':'.join(['%02X' % x for x in dst_mac])

+        port1_mac=[0x00, 0x11, 0x11, 0x11, 0x11, 0x11]

+        port1_mac_str=':'.join(['%02X' % x for x in port1_mac])

+        src_ip=0xc0a80101

+        src_ip_str="192.168.1.1"

+        dst_ip=0xe0010101

+        dst_ip_str="224.1.1.1"

+        

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

+        port2=config["port_map"].keys()[1]

+        

+        #add l2 interface group

+        l2_intf_group_list=[]

+        for port in config["port_map"].keys():        

+            l2_intf_gid, msg=add_one_l2_interface_grouop(self.controller, port, vlan_id=vlan_id, is_tagged=False, send_barrier=False)           

+            l2_intf_group_list.append(l2_intf_gid)

+            #add vlan flow table

+            add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)            

+

+        #add termination flow

+        add_termination_flow(self.controller, port1, 0x0800, [0x01, 0x00, 0x5e, 0x00, 0x00, 0x00], vlan_id)

+

+        #add l3 interface group

+        mcat_group_msg=add_l3_mcast_group(self.controller, vlan_id,  2, l2_intf_group_list)

+        add_mcast4_routing_flow(self.controller, vlan_id, src_ip, 0, dst_ip, mcat_group_msg.group_id)               

+

+        parsed_pkt = simple_udp_packet(pktlen=100, 

+                                       eth_dst=dst_mac_str,

+                                       eth_src=port1_mac_str,

+                                       ip_ttl=64,

+                                       ip_src=src_ip_str,

+                                       ip_dst=dst_ip_str)

+        pkt=str(parsed_pkt)

+        self.dataplane.send(port1, pkt)            

+        verify_packet(self, pkt, port2)

+        verify_no_other_packets(self)               

+            

+

+            
\ No newline at end of file