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(): |
| 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 |
| 54 | class 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 | |
| 69 | class 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 |
| 86 | class 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) |