blob: 464ab4233566c0038223b5b96656b58a42f814be [file] [log] [blame]
macauley_cheng6b311612015-09-04 11:32:27 +08001"""
2Flow Test
3
4Test each flow table can set entry, and packet rx correctly.
5"""
6
7import logging
8
9from oftest import config
10import oftest.base_tests as base_tests
11import ofp
12from oftest.testutils import *
13from accton_util import *
14
15class qinq(base_tests.SimpleDataPlane):
16 def runTest(self):
17 delete_all_flows(self.controller)
18 delete_all_groups(self.controller)
19
20 in_port = config["port_map"].keys()[0]
21 out_port=config["port_map"].keys()[1]
22 out_vlan=10
23 add_vlan_table_flow_pvid(self.controller, in_port, None, out_vlan, False)
24 add_vlan_table_flow_pvid(self.controller, in_port, 1,out_vlan, False)
castroflaviodd171472015-12-08 13:55:58 -050025 group_id, msg=add_one_l2_interface_group(self.controller, out_port, out_vlan, True, False)
macauley_cheng6b311612015-09-04 11:32:27 +080026 #add acl
27 match = ofp.match()
28 match.oxm_list.append(ofp.oxm.in_port(in_port))
29 request = ofp.message.flow_add(
30 table_id=60,
31 cookie=42,
32 match=match,
33 instructions=[
34 ofp.instruction.write_actions(
35 actions=[
36 ofp.action.group(msg.group_id)])
37 ],
38 buffer_id=ofp.OFP_NO_BUFFER,
39 priority=1000)
40 self.controller.message_send(request)
41
42 #input untag packet
43
44 parsed_pkt = simple_tcp_packet(pktlen=100)
45 pkt = str(parsed_pkt)
46 self.dataplane.send(in_port, pkt)
47
48 parsed_pkt = simple_tcp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=10)
49 verify_packet(self, str(parsed_pkt), out_port)
50
51 #input tag packet
52 parsed_pkt = simple_tcp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=1)
53 pkt = str(parsed_pkt)
54 self.dataplane.send(in_port, pkt)
55
56 parsed_pkt = simple_tcp_packet_two_vlan(pktlen=108, out_dl_vlan_enable=True, out_vlan_vid=10,
57 in_dl_vlan_enable=True, in_vlan_vid=1)
58 verify_packet(self, str(parsed_pkt), out_port)