.
diff --git a/accton/accton_util.py b/accton/accton_util.py
index e6b2adc..9ac96c8 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -435,7 +435,42 @@
do_barrier(ctrl)
return msgs
+
+def del_vlan_table_flow(ctrl, ports, vlan_id=1, flag=VLAN_TABLE_FLAG_ONLY_BOTH, send_barrier=False):
+ # table 10: vlan
+ # goto to table 20
+ msgs=[]
+ for of_port in ports:
+ if (flag == VLAN_TABLE_FLAG_ONLY_TAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH):
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(of_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
+ request = ofp.message.flow_delete(
+ table_id=10,
+ cookie=42,
+ match=match,
+ priority=0)
+ logging.info("Del vlan %d tagged packets on port %d and go to table 20" %( vlan_id, of_port))
+ ctrl.message_send(request)
+ if (flag == VLAN_TABLE_FLAG_ONLY_UNTAG) or (flag == VLAN_TABLE_FLAG_ONLY_BOTH):
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(of_port))
+ match.oxm_list.append(ofp.oxm.vlan_vid_masked(0, 0xfff))
+ request = ofp.message.flow_delete(
+ table_id=10,
+ cookie=42,
+ match=match,
+ priority=0)
+ logging.info("Del vlan %d untagged packets on port %d and go to table 20" % (vlan_id, of_port))
+ ctrl.message_send(request)
+ msgs.append(request)
+
+ if send_barrier:
+ do_barrier(ctrl)
+
+ return msgs
+
def add_vlan_table_flow_pvid(ctrl, in_port, match_vid=None, pvid=1, send_barrier=False):
"""it will tag pack as untagged packet wether it has tagg or not"""
match = ofp.match()
diff --git a/accton/acl_flow.py b/accton/acl_flow.py
new file mode 100755
index 0000000..c6fe8a1
--- /dev/null
+++ b/accton/acl_flow.py
@@ -0,0 +1,55 @@
+import logging
+
+from oftest import config
+import oftest.base_tests as base_tests
+import ofp
+from oftest.testutils import *
+from accton_util import *
+
+
+class NoVlanOnlyAclOutputPort(base_tests.SimpleDataPlane):
+ """
+ In OFDPA, ACL can save the packet it was dropped vlan table
+ """
+ def runTest(self):
+ ports = sorted(config["port_map"].keys())
+ delete_all_flows(self.controller)
+ delete_all_groups(self.controller)
+ input_port=ports[0]
+ output_port=ports[1]
+ vlan_id = 10
+ dmac = [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a]
+ gid, req_msg = add_one_l2_interface_grouop(self.controller, port=output_port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+ #add ACL flow to output port
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(input_port))
+ match.oxm_list.append(ofp.oxm.eth_dst(dmac))
+ match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
+ request = ofp.message.flow_add(
+ table_id=60,
+ cookie=42,
+ match=match,
+ instructions=[
+ ofp.instruction.write_actions(
+ actions=[
+ ofp.action.group(gid)]
+ )
+ ],
+ priority=1)
+ #install flow
+ self.controller.message_send(request)
+
+ dmac_str = convertMACtoStr(dmac)
+ #send packet
+ parsed_pkt = simple_tcp_packet(eth_dst=dmac_str, vlan_vid=vlan_id, dl_vlan_enable=True)
+ self.dataplane.send(input_port, str(parsed_pkt))
+ #verify packet
+ verify_packet(self, str(parsed_pkt), output_port)
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/accton/epr.py b/accton/epr.py
new file mode 100755
index 0000000..0a287a2
--- /dev/null
+++ b/accton/epr.py
@@ -0,0 +1,89 @@
+import logging
+
+from oftest import config
+import oftest.base_tests as base_tests
+import ofp
+from oftest.testutils import *
+from accton_util import *
+
+"""
+This file test case is copied from NTC EPR bug
+"""
+
+class pvidClear(base_tests.SimpleDataPlane):
+ """
+ AOS5700-54X-00620
+ """
+ def runTest(self):
+ ports = sorted(config["port_map"].keys())
+ delete_all_flows(self.controller)
+ delete_all_groups(self.controller)
+ port1=ports[0]
+ port2=ports[1]
+
+ vlan_id = 10
+
+ gid_p1, req_msg_p1 = add_one_l2_interface_grouop(self.controller, port=port1, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
+ gid_p2, req_msg_p2 = add_one_l2_interface_grouop(self.controller, port=port2, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
+ #add ACL flow, in port1 out port2
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(port1))
+ request = ofp.message.flow_add(
+ table_id=60,
+ cookie=42,
+ match=match,
+ instructions=[
+ ofp.instruction.write_actions(
+ actions=[
+ ofp.action.group(gid_p2)]
+ )
+ ],
+ priority=1)
+ #install flow
+ self.controller.message_send(request)
+ #add ACL flow, in port2 out port1
+ match = ofp.match()
+ match.oxm_list.append(ofp.oxm.in_port(port2))
+ request = ofp.message.flow_add(
+ table_id=60,
+ cookie=42,
+ match=match,
+ instructions=[
+ ofp.instruction.write_actions(
+ actions=[
+ ofp.action.group(gid_p1)]
+ )
+ ],
+ priority=1)
+ #install flow
+ self.controller.message_send(request)
+
+ #send packet and verify packet
+ parsed_pkt = simple_tcp_packet()
+ self.dataplane.send(port1, str(parsed_pkt))
+ verify_no_packet(self, str(parsed_pkt), port2)
+ self.dataplane.send(port2, str(parsed_pkt))
+ verify_no_packet(self, str(parsed_pkt), port1)
+
+
+ #add vlan flow table
+ add_vlan_table_flow(self.controller, [port1, port2], vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG)
+ #send packet and verify packet
+ parsed_pkt = simple_tcp_packet()
+ self.dataplane.send(port1, str(parsed_pkt))
+ verify_packet(self, str(parsed_pkt), port2)
+ self.dataplane.send(port2, str(parsed_pkt))
+ verify_packet(self, str(parsed_pkt), port1)
+
+ #remove vlan table flow
+ del_vlan_table_flow(self.controller, [port1, port2], vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG)
+ #send packet and verify packet
+ parsed_pkt = simple_tcp_packet()
+ self.dataplane.send(port1, str(parsed_pkt))
+ verify_packet(self, str(parsed_pkt), port2)
+ self.dataplane.send(port2, str(parsed_pkt))
+ verify_no_packet(self, str(parsed_pkt), port1)
+
+
+
+
\ No newline at end of file