Initial set of Fabric switch test cases
Change-Id: I86fd2b67d3b773aa496f5ef61f1e1fdf51fd9925
diff --git a/Fabric/Utilities/accton/epr.py b/Fabric/Utilities/accton/epr.py
new file mode 100755
index 0000000..c13a3d7
--- /dev/null
+++ b/Fabric/Utilities/accton/epr.py
@@ -0,0 +1,105 @@
+
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+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_group(self.controller, port=port1, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
+ gid_p2, req_msg_p2 = add_one_l2_interface_group(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_no_packet(self, str(parsed_pkt), port2)
+ self.dataplane.send(port2, str(parsed_pkt))
+ verify_no_packet(self, str(parsed_pkt), port1)
+
+
+
+