blob: c055ba138b280e9fd5e3163e12e2b98f61ee2bc6 [file] [log] [blame]
Matteo Scandoloa229eca2017-08-08 13:05:28 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
macauley_cheng6e6a6122015-11-16 14:19:18 +080017import logging
18
19from oftest import config
20import oftest.base_tests as base_tests
21import ofp
22from oftest.testutils import *
23from accton_util import *
24
25
26class NoVlanOnlyAclOutputPort(base_tests.SimpleDataPlane):
27 """
28 In OFDPA, ACL can save the packet it was dropped vlan table
29 """
30 def runTest(self):
31 ports = sorted(config["port_map"].keys())
32 delete_all_flows(self.controller)
33 delete_all_groups(self.controller)
34 input_port=ports[0]
35 output_port=ports[1]
36 vlan_id = 10
37 dmac = [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a]
castroflaviodd171472015-12-08 13:55:58 -050038 gid, req_msg = add_one_l2_interface_group(self.controller, port=output_port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
macauley_cheng6e6a6122015-11-16 14:19:18 +080039 #add ACL flow to output port
40 match = ofp.match()
41 match.oxm_list.append(ofp.oxm.in_port(input_port))
42 match.oxm_list.append(ofp.oxm.eth_dst(dmac))
43 match.oxm_list.append(ofp.oxm.vlan_vid(0x1000+vlan_id))
44 request = ofp.message.flow_add(
45 table_id=60,
46 cookie=42,
47 match=match,
48 instructions=[
49 ofp.instruction.write_actions(
50 actions=[
51 ofp.action.group(gid)]
52 )
53 ],
54 priority=1)
55 #install flow
56 self.controller.message_send(request)
57
58 dmac_str = convertMACtoStr(dmac)
59 #send packet
60 parsed_pkt = simple_tcp_packet(eth_dst=dmac_str, vlan_vid=vlan_id, dl_vlan_enable=True)
61 self.dataplane.send(input_port, str(parsed_pkt))
62 #verify packet
63 verify_packet(self, str(parsed_pkt), output_port)
64
65
66
67
68
69
70
71