blob: 46608c1f10380e399880d8b36f619a68ec5a8966 [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():
Flavio Castro12296312015-12-15 17:48:26 -050043 add_one_vlan_table_flow(self.controller, port, 10, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
Flavio Castro6d498522015-12-15 14:05:04 -050044 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)
Flavio Castro12296312015-12-15 17:48:26 -050053
Flavio Castro6d498522015-12-15 14:05:04 -050054@disabled
55class UnTagFlow0(base_tests.SimpleDataPlane):
56 def runTest(self):
57 do_barrier(self.controller)
58 for port in config["port_map"].keys():
59 add_untag_vlan_table_flow(self.controller, port, 0x0000, 0x1000)
60 do_barrier(self.controller)
61 logging.info("Sending flow stats request")
62 stats = get_flow_stats(self, ofp.match())
63 print "STATS"
64 for entry in stats:
65 print(entry.show())
66 print "END"
67 do_barrier(self.controller)
68 verify_no_other_packets(self)
69
Flavio Castro12296312015-12-15 17:48:26 -050070@disabled
Flavio Castro6d498522015-12-15 14:05:04 -050071class UnTagFlow10(base_tests.SimpleDataPlane):
72 def runTest(self):
73 do_barrier(self.controller)
74 for port in config["port_map"].keys():
75 add_untag_vlan_table_flow(self.controller, port, 0x0000, 0x1fff)
76 do_barrier(self.controller)
77 logging.info("Sending flow stats request")
78 stats = get_flow_stats(self, ofp.match())
79 print "STATS"
80 for entry in stats:
81 print(entry.show())
82 print "END"
83 do_barrier(self.controller)
84 verify_no_other_packets(self)
85
86
87@disabled
88class UnTagFlow1(base_tests.SimpleDataPlane):
89 def runTest(self):
90 do_barrier(self.controller)
91 for port in config["port_map"].keys():
92 add_untag_vlan_table(self.controller, port)
93 do_barrier(self.controller)
94 logging.info("Sending flow stats request")
95 stats = get_flow_stats(self, ofp.match())
96 print "STATS"
97 for entry in stats:
98 print(entry.show())
99 print "END"
100 do_barrier(self.controller)
101 verify_no_other_packets(self)