macauley_cheng | c249052 | 2015-09-02 17:57:53 +0800 | [diff] [blame] | 1 | """
|
| 2 | Basic test cases
|
| 3 |
|
| 4 | Test cases in other modules depend on this functionality.
|
| 5 | """
|
| 6 |
|
| 7 | import logging
|
| 8 |
|
| 9 | from oftest import config
|
| 10 | import oftest.base_tests as base_tests
|
| 11 | import ofp
|
| 12 | import time
|
| 13 | from oftest.testutils import *
|
| 14 | from accton_util import *
|
| 15 |
|
| 16 | class 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)
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 28 | add_one_l2_interface_group(self.controller, out_port, 10, True, False)
|
macauley_cheng | c249052 | 2015-09-02 17:57:53 +0800 | [diff] [blame] | 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) |