Flavio Castro | 96646c6 | 2015-11-16 15:05:43 -0500 | [diff] [blame] | 1 | """ |
| 2 | Flow Test |
| 3 | Test each flow table can set entry, and packet rx correctly. |
| 4 | 1) L3UcastRoute |
| 5 | 2) QinQ |
| 6 | """ |
| 7 | |
| 8 | import logging |
| 9 | |
| 10 | from oftest import config |
| 11 | import oftest.base_tests as base_tests |
| 12 | import ofp |
| 13 | from oftest.testutils import * |
| 14 | from accton_util import * |
| 15 | |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 16 | @disabled |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 17 | class Purge(base_tests.SimpleDataPlane): |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 18 | def runTest(self): |
Flavio Castro | 96646c6 | 2015-11-16 15:05:43 -0500 | [diff] [blame] | 19 | delete_all_flows(self.controller) |
| 20 | delete_all_groups(self.controller) |
Flavio Castro | 6efe186 | 2015-11-18 16:28:06 -0500 | [diff] [blame] | 21 | do_barrier(self.controller) |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 22 | add_vlan_table_flow(self.controller, config["port_map"].keys(), 1) |
| 23 | verify_no_other_packets(self) |
| 24 | |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 25 | @disabled |
Flavio Castro | 96646c6 | 2015-11-16 15:05:43 -0500 | [diff] [blame] | 26 | class FlowStats(base_tests.SimpleProtocol): |
| 27 | """ |
| 28 | Flow stats multipart transaction |
| 29 | Only verifies we get a reply. |
| 30 | """ |
| 31 | def runTest(self): |
Flavio Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 32 | |
Flavio Castro | 96646c6 | 2015-11-16 15:05:43 -0500 | [diff] [blame] | 33 | 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 Castro | a823386 | 2015-12-02 14:41:11 -0500 | [diff] [blame] | 37 | print(entry.show()) |
Flavio Castro | 96646c6 | 2015-11-16 15:05:43 -0500 | [diff] [blame] | 38 | |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 39 | class TagFlow20to10(base_tests.SimpleDataPlane): |
| 40 | def runTest(self): |
| 41 | do_barrier(self.controller) |
| 42 | for port in config["port_map"].keys(): |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame^] | 43 | add_one_vlan_table_flow(self.controller, port, 10, flag=VLAN_TABLE_FLAG_ONLY_BOTH) |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 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) |
Flavio Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame^] | 53 | |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 54 | @disabled |
| 55 | class 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 Castro | 1229631 | 2015-12-15 17:48:26 -0500 | [diff] [blame^] | 70 | @disabled |
Flavio Castro | 6d49852 | 2015-12-15 14:05:04 -0500 | [diff] [blame] | 71 | class 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 |
| 88 | class 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) |