blob: b5140b40d6a641a3fca5de702f4d4d8aa6f45bd6 [file] [log] [blame]
Flavio Castro96646c62015-11-16 15:05:43 -05001"""
2Flow Test
3Test each flow table can set entry, and packet rx correctly.
41) L3UcastRoute
52) QinQ
6"""
7
8import logging
9
10from oftest import config
11import oftest.base_tests as base_tests
12import ofp
13from oftest.testutils import *
14from accton_util import *
15
Flavio Castro6d498522015-12-15 14:05:04 -050016@disabled
Flavio Castroa8233862015-12-02 14:41:11 -050017class Purge(base_tests.SimpleDataPlane):
Flavio Castro6efe1862015-11-18 16:28:06 -050018 def runTest(self):
Flavio Castro96646c62015-11-16 15:05:43 -050019 delete_all_flows(self.controller)
20 delete_all_groups(self.controller)
Flavio Castro6efe1862015-11-18 16:28:06 -050021 do_barrier(self.controller)
Flavio Castroa8233862015-12-02 14:41:11 -050022 add_vlan_table_flow(self.controller, config["port_map"].keys(), 1)
23 verify_no_other_packets(self)
24
Flavio Castro6d498522015-12-15 14:05:04 -050025@disabled
Flavio Castro96646c62015-11-16 15:05:43 -050026class FlowStats(base_tests.SimpleProtocol):
27 """
28 Flow stats multipart transaction
29 Only verifies we get a reply.
30 """
31 def runTest(self):
Flavio Castroa8233862015-12-02 14:41:11 -050032
Flavio Castro96646c62015-11-16 15:05:43 -050033 logging.info("Sending flow stats request")
34 stats = get_flow_stats(self, ofp.match())
35 logging.info("Received %d flow stats entries", len(stats))
36 for entry in stats:
Flavio Castroa8233862015-12-02 14:41:11 -050037 print(entry.show())
Flavio Castro96646c62015-11-16 15:05:43 -050038
Flavio Castro6d498522015-12-15 14:05:04 -050039class TagFlow20to10(base_tests.SimpleDataPlane):
40 def runTest(self):
41 do_barrier(self.controller)
42 for port in config["port_map"].keys():
43 add_one_vlan_table_flow(self.controller, port, 10)
44 do_barrier(self.controller)
45 logging.info("Sending flow stats request")
46 stats = get_flow_stats(self, ofp.match())
47 print "STATS"
48 for entry in stats:
49 print(entry.show())
50 print "END"
51 do_barrier(self.controller)
52 verify_no_other_packets(self)
53@disabled
54class UnTagFlow0(base_tests.SimpleDataPlane):
55 def runTest(self):
56 do_barrier(self.controller)
57 for port in config["port_map"].keys():
58 add_untag_vlan_table_flow(self.controller, port, 0x0000, 0x1000)
59 do_barrier(self.controller)
60 logging.info("Sending flow stats request")
61 stats = get_flow_stats(self, ofp.match())
62 print "STATS"
63 for entry in stats:
64 print(entry.show())
65 print "END"
66 do_barrier(self.controller)
67 verify_no_other_packets(self)
68
69class UnTagFlow10(base_tests.SimpleDataPlane):
70 def runTest(self):
71 do_barrier(self.controller)
72 for port in config["port_map"].keys():
73 add_untag_vlan_table_flow(self.controller, port, 0x0000, 0x1fff)
74 do_barrier(self.controller)
75 logging.info("Sending flow stats request")
76 stats = get_flow_stats(self, ofp.match())
77 print "STATS"
78 for entry in stats:
79 print(entry.show())
80 print "END"
81 do_barrier(self.controller)
82 verify_no_other_packets(self)
83
84
85@disabled
86class UnTagFlow1(base_tests.SimpleDataPlane):
87 def runTest(self):
88 do_barrier(self.controller)
89 for port in config["port_map"].keys():
90 add_untag_vlan_table(self.controller, port)
91 do_barrier(self.controller)
92 logging.info("Sending flow stats request")
93 stats = get_flow_stats(self, ofp.match())
94 print "STATS"
95 for entry in stats:
96 print(entry.show())
97 print "END"
98 do_barrier(self.controller)
99 verify_no_other_packets(self)