macauley_cheng | 6e6a612 | 2015-11-16 14:19:18 +0800 | [diff] [blame] | 1 | import logging
|
| 2 |
|
| 3 | from oftest import config
|
| 4 | import oftest.base_tests as base_tests
|
| 5 | import ofp
|
| 6 | from oftest.testutils import *
|
| 7 | from accton_util import *
|
| 8 |
|
| 9 |
|
| 10 | class NoVlanOnlyAclOutputPort(base_tests.SimpleDataPlane):
|
| 11 | """
|
| 12 | In OFDPA, ACL can save the packet it was dropped vlan table
|
| 13 | """
|
| 14 | def runTest(self):
|
| 15 | ports = sorted(config["port_map"].keys())
|
| 16 | delete_all_flows(self.controller)
|
| 17 | delete_all_groups(self.controller)
|
| 18 | input_port=ports[0]
|
| 19 | output_port=ports[1]
|
| 20 | vlan_id = 10
|
| 21 | dmac = [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a]
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 22 | gid, req_msg = add_one_l2_interface_group(self.controller, port=output_port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
|
macauley_cheng | 6e6a612 | 2015-11-16 14:19:18 +0800 | [diff] [blame] | 23 | #add ACL flow to output port
|
| 24 | match = ofp.match()
|
| 25 | match.oxm_list.append(ofp.oxm.in_port(input_port))
|
| 26 | match.oxm_list.append(ofp.oxm.eth_dst(dmac))
|
| 27 | match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
|
| 28 | request = ofp.message.flow_add(
|
| 29 | table_id=60,
|
| 30 | cookie=42,
|
| 31 | match=match,
|
| 32 | instructions=[
|
| 33 | ofp.instruction.write_actions(
|
| 34 | actions=[
|
| 35 | ofp.action.group(gid)]
|
| 36 | )
|
| 37 | ],
|
| 38 | priority=1)
|
| 39 | #install flow
|
| 40 | self.controller.message_send(request)
|
| 41 |
|
| 42 | dmac_str = convertMACtoStr(dmac)
|
| 43 | #send packet
|
| 44 | parsed_pkt = simple_tcp_packet(eth_dst=dmac_str, vlan_vid=vlan_id, dl_vlan_enable=True)
|
| 45 | self.dataplane.send(input_port, str(parsed_pkt))
|
| 46 | #verify packet
|
| 47 | verify_packet(self, str(parsed_pkt), output_port)
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 | |