blob: 8214275ebf6039170d0b01a92fb93791e1331bed [file] [log] [blame]
macauley_chengc2490522015-09-02 17:57:53 +08001"""
2Basic test cases
3
4Test cases in other modules depend on this functionality.
5"""
6
7import logging
8
9from oftest import config
10import oftest.base_tests as base_tests
11import ofp
12import time
13from oftest.testutils import *
14from accton_util import *
15
16class case1(base_tests.SimpleDataPlane):
17 """
18 pakcet from port 1 (tag/untag) ouptut to port 2 with vlan 10
19 """
20 def runTest(self):
21 delete_all_flows(self.controller)
22 delete_all_groups(self.controller)
23
24 in_port = config["port_map"].keys()[0]
25 out_port=config["port_map"].keys()[1]
26
27 add_one_vlan_table_flow(self.controller, in_port, vlan_id=1, vrf=0, flag=VLAN_TABLE_FLAG_ONLY_BOTH, send_barrier=False)
28 add_one_l2_interface_grouop(self.controller, out_port, 10, True, False)
29 msg=add_l2_rewrite_group(self.controller, out_port, 10, 1, None, None)
30
31 match = ofp.match()
32 match.oxm_list.append(ofp.oxm.in_port(in_port))
33
34 request = ofp.message.flow_add(
35 table_id=60,
36 cookie=42,
37 match=match,
38 instructions=[
39 ofp.instruction.write_actions(
40 actions=[
41 ofp.action.group(msg.group_id)])
42 ],
43 buffer_id=ofp.OFP_NO_BUFFER,
44 priority=1000)
45
46 self.controller.message_send(request)
47
48 parsed_pkt = simple_tcp_packet(pktlen=100)
49 pkt = str(parsed_pkt)
50 self.dataplane.send(in_port, pkt)
51
52 parsed_pkt = simple_tcp_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=10)
53 verify_packet(self, str(parsed_pkt), out_port)