blob: 44c01260fb6a68a4ef0fc9e6c2ef8915aaec0a2b [file] [log] [blame]
macauley_cheng6e6a6122015-11-16 14:19:18 +08001import logging
2
3from oftest import config
4import oftest.base_tests as base_tests
5import ofp
6from oftest.testutils import *
7from accton_util import *
8
9"""
10This file test case is copied from NTC EPR bug
11"""
12
13class pvidClear(base_tests.SimpleDataPlane):
14 """
15 AOS5700-54X-00620
16 """
17 def runTest(self):
18 ports = sorted(config["port_map"].keys())
19 delete_all_flows(self.controller)
20 delete_all_groups(self.controller)
21 port1=ports[0]
22 port2=ports[1]
23
24 vlan_id = 10
25
castroflaviodd171472015-12-08 13:55:58 -050026 gid_p1, req_msg_p1 = add_one_l2_interface_group(self.controller, port=port1, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
27 gid_p2, req_msg_p2 = add_one_l2_interface_group(self.controller, port=port2, vlan_id=vlan_id, is_tagged=False, send_barrier=False)
macauley_cheng6e6a6122015-11-16 14:19:18 +080028 #add ACL flow, in port1 out port2
29 match = ofp.match()
30 match.oxm_list.append(ofp.oxm.in_port(port1))
31 request = ofp.message.flow_add(
32 table_id=60,
33 cookie=42,
34 match=match,
35 instructions=[
36 ofp.instruction.write_actions(
37 actions=[
38 ofp.action.group(gid_p2)]
39 )
40 ],
41 priority=1)
42 #install flow
43 self.controller.message_send(request)
44 #add ACL flow, in port2 out port1
45 match = ofp.match()
46 match.oxm_list.append(ofp.oxm.in_port(port2))
47 request = ofp.message.flow_add(
48 table_id=60,
49 cookie=42,
50 match=match,
51 instructions=[
52 ofp.instruction.write_actions(
53 actions=[
54 ofp.action.group(gid_p1)]
55 )
56 ],
57 priority=1)
58 #install flow
59 self.controller.message_send(request)
60
61 #send packet and verify packet
62 parsed_pkt = simple_tcp_packet()
63 self.dataplane.send(port1, str(parsed_pkt))
64 verify_no_packet(self, str(parsed_pkt), port2)
65 self.dataplane.send(port2, str(parsed_pkt))
66 verify_no_packet(self, str(parsed_pkt), port1)
67
68
69 #add vlan flow table
70 add_vlan_table_flow(self.controller, [port1, port2], vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG)
71 #send packet and verify packet
72 parsed_pkt = simple_tcp_packet()
73 self.dataplane.send(port1, str(parsed_pkt))
74 verify_packet(self, str(parsed_pkt), port2)
75 self.dataplane.send(port2, str(parsed_pkt))
76 verify_packet(self, str(parsed_pkt), port1)
77
78 #remove vlan table flow
79 del_vlan_table_flow(self.controller, [port1, port2], vlan_id=vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG)
80 #send packet and verify packet
81 parsed_pkt = simple_tcp_packet()
82 self.dataplane.send(port1, str(parsed_pkt))
Macauley Cheng98cc4592015-11-16 15:45:02 +080083 verify_no_packet(self, str(parsed_pkt), port2)
macauley_cheng6e6a6122015-11-16 14:19:18 +080084 self.dataplane.send(port2, str(parsed_pkt))
85 verify_no_packet(self, str(parsed_pkt), port1)
86
87
88
Macauley Cheng98cc4592015-11-16 15:45:02 +080089