blob: 1b7f7be63429a38643bf39f932b14c89f426c23d [file] [log] [blame]
macauley_cheng79927b62015-08-27 14:31:41 +08001import logging
2
3from oftest import config
4import oftest.base_tests as base_tests
5import ofp
6from oftest.testutils import *
7from accton_util import *
8
9class PacketInMiss(base_tests.SimpleDataPlane):
10 """
11 Test packet in function for a table-miss flow
12
13 Send a packet to each dataplane port and verify that a packet
14 in message is received from the controller for each
15
16 NOTE: Verify This case the oft option shall not use --switch-ip
17 """
18
19 def runTest(self):
20 delete_all_flows(self.controller)
21 delete_all_groups(self.controller)
22
23 # table 10: vlan
24 # send to table 20
25 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
26
27 # group table
28 # set up untag groups for each port
29 add_l2_interface_grouop(self.controller, config["port_map"].keys(), 1, False, 1)
30
31 verify_port = config["port_map"].keys()[0]
32
33 # create match
34 match = ofp.match()
35 match.oxm_list.append(ofp.oxm.in_port(verify_port))
36 match.oxm_list.append(ofp.oxm.eth_type(0x0800))
37 match.oxm_list.append(ofp.oxm.ipv4_dst_masked(0xa0a0a0a, 0xffffffff))
38 request = ofp.message.flow_add(
39 table_id=60,
40 cookie=42,
41 match=match,
42 instructions=[
43 ofp.instruction.apply_actions(
44 actions=[
45 ofp.action.output(
46 port=ofp.OFPP_CONTROLLER,
47 max_len=ofp.OFPCML_NO_BUFFER)]),
48 ],
49 buffer_id=ofp.OFP_NO_BUFFER,
50 priority=1)
51
52 logging.info("Inserting packet in flow to controller")
53 self.controller.message_send(request)
54 do_barrier(self.controller)
55
56
57 logging.info("PacketInMiss test, port %d", verify_port)
58 parsed_pkt = simple_tcp_packet(pktlen=100, ip_dst="10.10.10.10")
59 pkt = str(parsed_pkt)
60 self.dataplane.send(verify_port, pkt)
61
62 #AOS current packet in will not have vlan tag
63 verify_packet_in(self, pkt, verify_port, ofp.OFPR_ACTION)
64
65 verify_no_other_packets(self)