ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 1 | """These tests fall under Conformance Test-Suite (OF-SWITCH-1.0.0 TestCases). |
| 2 | Refer Documentation -- Detailed testing methodology |
| 3 | <Some of test-cases are directly taken from oftest> """ |
| 4 | |
| 5 | "Test Suite 3 --> Detailed Controller to switch messages" |
| 6 | |
| 7 | import logging |
| 8 | |
| 9 | import unittest |
| 10 | import random |
| 11 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 12 | from oftest import config |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 13 | import oftest.controller as controller |
Rich Lane | d7b0ffa | 2013-03-08 15:53:42 -0800 | [diff] [blame] | 14 | import ofp |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 15 | import oftest.dataplane as dataplane |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 16 | import oftest.parse as parse |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 17 | import oftest.base_tests as base_tests |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 18 | |
Rich Lane | da3b5ad | 2012-10-03 09:05:32 -0700 | [diff] [blame] | 19 | from oftest.testutils import * |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 20 | from time import sleep |
| 21 | from FuncUtils import * |
| 22 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 23 | class OverlapChecking(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 24 | |
| 25 | """Verify that if overlap check flag is set in the flow entry and an overlapping flow is inserted then an error |
| 26 | is generated and switch refuses flow entry""" |
| 27 | |
| 28 | def runTest(self): |
| 29 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 30 | logging.info("Running Overlap_Checking test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 31 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 32 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 33 | of_ports.sort() |
| 34 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 35 | |
| 36 | #Clear Switch State |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 37 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 38 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 39 | logging.info("Inserting two overlapping flows") |
| 40 | logging.info("Expecting switch to return an error") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 41 | |
| 42 | #Insert a flow F with wildcarded all fields |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 43 | (pkt,match) = wildcard_all(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 44 | |
| 45 | #Verify flow is active |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 46 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 47 | |
| 48 | # Build a overlapping flow F'-- Wildcard All except ingress with check overlap bit set |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 49 | pkt_matchingress = simple_tcp_packet() |
| 50 | match3 = parse.packet_to_flow_match(pkt_matchingress) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 51 | self.assertTrue(match3 is not None, "Could not generate flow match from pkt") |
| 52 | match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT |
| 53 | match3.in_port = of_ports[0] |
| 54 | |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 55 | msg3 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 56 | msg3.command = ofp.OFPFC_ADD |
| 57 | msg3.match = match3 |
| 58 | msg3.flags |= ofp.OFPFF_CHECK_OVERLAP |
| 59 | msg3.cookie = random.randint(0,9007199254740992) |
| 60 | msg3.buffer_id = 0xffffffff |
| 61 | |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 62 | act3 = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 63 | act3.port = of_ports[1] |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame^] | 64 | msg3.actions.append(act3) |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 65 | self.controller.message_send(msg3) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 66 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 67 | |
| 68 | # Verify Flow does not get inserted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 69 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 70 | |
| 71 | #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane |
| 72 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR, |
| 73 | timeout=5) |
| 74 | self.assertTrue(response is not None, |
| 75 | 'Switch did not reply with error message') |
| 76 | self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED, |
| 77 | 'Error message type is not flow mod failed ') |
| 78 | self.assertTrue(response.code==ofp.OFPFMFC_OVERLAP, |
| 79 | 'Error Message code is not overlap') |
| 80 | |
| 81 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 82 | class NoOverlapChecking(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 83 | |
| 84 | """Verify that without overlap check flag set, overlapping flows can be created.""" |
| 85 | |
| 86 | def runTest(self): |
| 87 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 88 | logging.info("Running No_Overlap_Checking test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 89 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 90 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 91 | of_ports.sort() |
| 92 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 93 | |
| 94 | #Clear Switch State |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 95 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 96 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 97 | logging.info("Inserting two overlapping flows") |
| 98 | logging.info("Expecting switch to insert the flows without generating errors") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 99 | |
| 100 | #Build a flow F with wildcarded all fields. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 101 | (pkt,match) = wildcard_all(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 102 | |
| 103 | #Verify flow is active |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 104 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 105 | |
| 106 | # Build a overlapping flow F' without check overlap bit set. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 107 | wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 108 | |
| 109 | # Verify Flow gets inserted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 110 | verify_tablestats(self,expect_active=2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 111 | |
| 112 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 113 | class IdenticalFlows(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 114 | |
| 115 | """Verify that adding two identical flows overwrites the existing one and clears counters""" |
| 116 | |
| 117 | def runTest(self): |
| 118 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 119 | logging.info("Running Identical_Flows test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 120 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 121 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 122 | of_ports.sort() |
| 123 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 124 | |
| 125 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 126 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 127 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 128 | logging.info("Inserting two identical flows one by one") |
| 129 | logging.info("Expecting switch to overwrite the first flow and clear the counters associated with it ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 130 | |
| 131 | # Create and add flow-1, check on dataplane it is active. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 132 | (pkt,match) = wildcard_all(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 133 | |
| 134 | # Verify active_entries in table_stats_request =1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 135 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 136 | |
| 137 | # Send Packet (to increment counters like byte_count and packet_count) |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 138 | send_packet(self,pkt,of_ports[0],of_ports[1]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 139 | |
| 140 | # Verify Flow counters have incremented |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 141 | verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt))) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 142 | |
| 143 | #Send Identical flow |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 144 | (pkt1,match1) = wildcard_all(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 145 | |
| 146 | # Verify active_entries in table_stats_request =1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 147 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 148 | |
| 149 | # Verify Flow counters reset |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 150 | verify_flow_stats(self, match, pkts=0, bytes=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 151 | |
| 152 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 153 | class EmerFlowTimeout(base_tests.SimpleProtocol): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 154 | |
| 155 | """Timeout values are not allowed for emergency flows""" |
| 156 | |
| 157 | def runTest(self): |
| 158 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 159 | logging.info("Running Emergency_Flow_Timeout test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 160 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 161 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 162 | of_ports.sort() |
| 163 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 164 | |
| 165 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 166 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 167 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 168 | logging.info("Inserting an emergency flow with timeout values") |
| 169 | logging.info("Expecting switch to generate error ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 170 | |
| 171 | #Insert an emergency flow |
| 172 | pkt = simple_tcp_packet() |
| 173 | match = parse.packet_to_flow_match(pkt) |
| 174 | match.in_port = of_ports[0] |
| 175 | |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 176 | request = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 177 | request.match = match |
| 178 | request.command = ofp.OFPFC_ADD |
| 179 | request.flags = request.flags|ofp.OFPFF_EMERG |
| 180 | request.hard_timeout =9 |
| 181 | request.idle_timeout =9 |
| 182 | |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 183 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 184 | act.port = of_ports[1] |
| 185 | |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame^] | 186 | request.actions.append(act) |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 187 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 188 | self.controller.message_send(request) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 189 | |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 190 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 191 | |
| 192 | #Verify OFPET_FLOW_MOD_FAILED/OFPFMFC_OVERLAP error is recieved on the control plane |
| 193 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR, |
| 194 | timeout=5) |
| 195 | self.assertTrue(response is not None, |
| 196 | 'Switch did not reply with error message') |
| 197 | self.assertTrue(response.type==ofp.OFPET_FLOW_MOD_FAILED, |
| 198 | 'Error message type is not flow mod failed ') |
| 199 | self.assertTrue(response.code==ofp.OFPFMFC_BAD_EMERG_TIMEOUT, |
| 200 | 'Error Message code is not bad emergency timeout') |
| 201 | |
| 202 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 203 | class MissingModifyAdd(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 204 | |
| 205 | """If a modify does not match an existing flow, the flow gets added """ |
| 206 | |
| 207 | def runTest(self): |
| 208 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 209 | logging.info("Running Missing_Modify_Add test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 210 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 211 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 212 | of_ports.sort() |
| 213 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 214 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 215 | logging.info("Inserting a flow-modify that does not match an existing flow") |
| 216 | logging.info("Expecting flow to get added i.e OFPFC_MODIFY command should be taken as OFPFC_ADD ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 217 | |
| 218 | #Clear Switch State |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 219 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 220 | |
| 221 | #Generate a flow-mod,command OFPC_MODIFY |
| 222 | |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 223 | request = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 224 | request.command = ofp.OFPFC_MODIFY |
| 225 | request.match.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT |
| 226 | request.match.in_port = of_ports[0] |
| 227 | request.cookie = random.randint(0,9007199254740992) |
| 228 | request.buffer_id = 0xffffffff |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 229 | act3 = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 230 | act3.port = of_ports[1] |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame^] | 231 | request.actions.append(act3) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 232 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 233 | logging.info("Inserting flow") |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 234 | self.controller.message_send(request) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 235 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 236 | |
| 237 | #Verify the flow gets added i.e. active_count= 1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 238 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 239 | |
| 240 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 241 | class ModifyAction(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 242 | |
| 243 | """A modified flow preserves counters""" |
| 244 | |
| 245 | def runTest(self): |
| 246 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 247 | logging.info("Running Modify_Action test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 248 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 249 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 250 | of_ports.sort() |
| 251 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 252 | |
| 253 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 254 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 255 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 256 | logging.info("Inserting a Flow and incrementing flow counters. Modifying the flow action") |
| 257 | logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 258 | |
| 259 | #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A , output to of_port[1] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 260 | (pkt,match) = match_all_except_source_address(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 261 | |
| 262 | #Send Packet matching the flow thus incrementing counters like packet_count,byte_count |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 263 | send_packet(self,pkt,of_ports[0],of_ports[1]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 264 | |
| 265 | #Verify flow counters |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 266 | verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt))) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 267 | |
| 268 | #Modify flow- 1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 269 | modify_flow_action(self,of_ports,match) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 270 | |
| 271 | # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 272 | send_packet(self,pkt,of_ports[0],of_ports[2]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 273 | |
| 274 | #Verify flow counters are preserved |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 275 | verify_flow_stats(self, match, pkts=2, bytes=len(str(pkt))*2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 276 | |
| 277 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 278 | class StrictModifyAction(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 279 | |
| 280 | """Strict Modify Flow also changes action preserves counters""" |
| 281 | |
| 282 | def runTest(self): |
| 283 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 284 | logging.info("Running Strict_Modify_Action test") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 285 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 286 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 287 | of_ports.sort() |
| 288 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 289 | |
| 290 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 291 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 292 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 293 | logging.info("Inserting Flows and incrementing flow counters. Strict Modify the flow action ") |
| 294 | logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 295 | |
| 296 | #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 297 | (pkt,match) = match_all_except_source_address(self,of_ports,priority=100) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 298 | |
| 299 | #Create and add flow-2 , Match on ingress_port only, Action A |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 300 | (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=10) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 301 | |
| 302 | # Verify both the flows are active |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 303 | verify_tablestats(self,expect_active=2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 304 | |
| 305 | #Send a packet matching the flows, thus incrementing flow-counters (packet matches the flow F-1 with higher priority) |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 306 | send_packet(self,pkt,of_ports[0],of_ports[1]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 307 | |
| 308 | # Verify flow counters of the flow-1 |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 309 | verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt))) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 310 | |
| 311 | # Strict-Modify flow- 1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 312 | strict_modify_flow_action(self,of_ports[2],match,priority=100) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 313 | |
| 314 | # Send Packet matching the flow-1 i.e ingress_port=port[0] and verify it is recieved on corret dataplane port i.e port[2] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 315 | send_packet(self,pkt,of_ports[0],of_ports[2]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 316 | |
| 317 | # Verify flow counters are preserved |
Rich Lane | ae3428c | 2013-03-07 14:37:42 -0800 | [diff] [blame] | 318 | verify_flow_stats(self, match, pkts=2, bytes=2*len(str(pkt))) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 319 | |
| 320 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 321 | class DeleteNonexistingFlow(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 322 | |
| 323 | """Request deletion of non-existing flow""" |
| 324 | |
| 325 | def runTest(self): |
| 326 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 327 | logging.info("Delete_NonExisting_Flow test begins") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 328 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 329 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 330 | of_ports.sort() |
| 331 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 332 | |
| 333 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 334 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 335 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 336 | logging.info("Deleting a non-existing flow") |
| 337 | logging.info("Expecting switch to ignore the command , without generating errors") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 338 | |
| 339 | # Issue a delete command |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 340 | msg = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 341 | msg.match.wildcards = ofp.OFPFW_ALL |
| 342 | msg.out_port = ofp.OFPP_NONE |
| 343 | msg.command = ofp.OFPFC_DELETE |
| 344 | msg.buffer_id = 0xffffffff |
| 345 | |
| 346 | # Verify no message or error is generated by polling the the control plane |
| 347 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_ERROR, |
| 348 | timeout=2) |
| 349 | self.assertTrue(response is None, |
| 350 | 'Recieved Error for deleting non-exiting flow ') |
| 351 | |
| 352 | |
| 353 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 354 | class SendFlowRem(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 355 | |
| 356 | """Check deletion of flows happens and generates messages as configured. |
| 357 | If Send Flow removed message Flag is set in the flow entry, the flow deletion of that respective flow should generate the flow removed message, |
| 358 | vice versa also exists """ |
| 359 | |
| 360 | def runTest(self): |
| 361 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 362 | logging.info("Running Send_Flow_Rem test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 363 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 364 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 365 | of_ports.sort() |
| 366 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 367 | |
| 368 | #Clear swicth state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 369 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 370 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 371 | logging.info("Inserting flows F1 and F2 without and with send_flow_removed_message flag set ") |
| 372 | logging.info("Deleting the flows") |
| 373 | logging.info("Expecting flow removed message only for F2") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 374 | |
| 375 | # Insert flow-1 with F without OFPFF_SEND_FLOW_REM flag set. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 376 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 377 | |
| 378 | # Verify flow is inserted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 379 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 380 | |
| 381 | #Delete the flow-1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 382 | nonstrict_delete(self,match,priority=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 383 | |
| 384 | # Verify no flow removed message is generated for the FLOW-1 |
| 385 | |
| 386 | (response1, pkt1) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED, |
| 387 | timeout=2) |
| 388 | self.assertTrue(response1 is None, |
| 389 | 'Received flow removed message for the flow with flow_rem flag not set') |
| 390 | |
| 391 | # Insert another flow F' with OFPFF_SEND_FLOW_REM flag set. |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 392 | msg9 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 393 | msg9.match.wildcards = ofp.OFPFW_ALL |
| 394 | msg9.cookie = random.randint(0,9007199254740992) |
| 395 | msg9.buffer_id = 0xffffffff |
| 396 | msg9.idle_timeout = 1 |
| 397 | msg9.flags |= ofp.OFPFF_SEND_FLOW_REM |
| 398 | rv1 = self.controller.message_send(msg9) |
| 399 | self.assertTrue(rv1 != -1, "Error installing flow mod") |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 400 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 401 | |
| 402 | # Delete the flow-2 |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 403 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 404 | |
| 405 | # Verify flow removed message is generated for the FLOW-2 |
| 406 | |
| 407 | (response2, pkt2) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED, |
| 408 | timeout=2) |
| 409 | self.assertTrue(response2 is not None, |
| 410 | 'Did not receive flow removed message for this flow') |
| 411 | |
| 412 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 413 | class DeleteEmerFlow(base_tests.SimpleProtocol): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 414 | |
| 415 | """Delete emergency flow and verify no message is generated.An emergency flow deletion will not generate flow-removed messages even if |
| 416 | Send Flow removed message flag was set during the emergency flow entry""" |
| 417 | |
| 418 | def runTest(self): |
| 419 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 420 | logging.info("Running Delete_Emer_Flow") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 421 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 422 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 423 | of_ports.sort() |
| 424 | |
| 425 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 426 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 427 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 428 | logging.info("Inserting a emergency flow with send_flow_removed flag set") |
| 429 | logging.info("Expecting no flow_removed_message on the deletion of the emergency flow") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 430 | |
| 431 | # Insert a flow with emergency bit set. |
| 432 | pkt = simple_tcp_packet() |
| 433 | match = parse.packet_to_flow_match(pkt) |
| 434 | match.in_port = of_ports[0] |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 435 | request = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 436 | request.match = match |
| 437 | request.command = ofp.OFPFC_ADD |
| 438 | request.flags = request.flags|ofp.OFPFF_EMERG|ofp.OFPFF_SEND_FLOW_REM |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 439 | act = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 440 | act.port = of_ports[1] |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame^] | 441 | request.actions.append(act) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 442 | |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 443 | self.controller.message_send(request) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 444 | |
| 445 | # Delete the emergency flow |
| 446 | |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 447 | nonstrict_delete(self,match) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 448 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPFF_SEND_FLOW_REM , |
| 449 | timeout=2) |
| 450 | self.assertTrue(response is None, |
| 451 | 'Test Failed ') |
| 452 | |
| 453 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 454 | class StrictVsNonstrict(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 455 | |
| 456 | """Delete and verify strict and non-strict behaviors |
| 457 | This test compares the behavior of delete strict and non-strict""" |
| 458 | |
| 459 | def runTest(self): |
| 460 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 461 | logging.info("Strict_Vs_Nonstrict test begins") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 462 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 463 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 464 | of_ports.sort() |
| 465 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 466 | |
| 467 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 468 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 469 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 470 | logging.info("Inserting a flow with exact match") |
| 471 | logging.info("Issue Strict Delete command , verify it gets deleted") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 472 | |
| 473 | #Insert F with an exact Match |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 474 | (pkt,match) = exact_match(self,of_ports) |
| 475 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 476 | |
| 477 | #Issue Strict Delete Command , verify F gets deleted. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 478 | strict_delete(self,match) |
| 479 | verify_tablestats(self,expect_active=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 480 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 481 | logging.info("Inserting two overlapping flows") |
| 482 | logging.info("Issue Strict Delete command ") |
| 483 | logging.info("Expecting only one flow gets deleted , because Strict Delete matches on wildcards as well") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 484 | |
| 485 | #Insert Flow T with match on all , except one wildcarded ( say src adddress ). |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 486 | (pkt,match) = match_all_except_source_address(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 487 | |
| 488 | #Insert another flow T' with match on ingress_port , wildcarded rest. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 489 | (pkt1,match1) = wildcard_all_except_ingress(self,of_ports) |
| 490 | verify_tablestats(self,expect_active=2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 491 | |
| 492 | #Issue Strict Delete matching on ingress_port. Verify only T' gets deleted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 493 | strict_delete(self,match1) |
| 494 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 495 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 496 | logging.info("Inserting two overlapping flows") |
| 497 | logging.info("Issue Non-Strict Delete command ") |
| 498 | logging.info("Expecting both the flow gets deleted , because wildcards are active") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 499 | |
| 500 | #Insert T and T' again . |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 501 | (pkt,match) = match_all_except_source_address(self,of_ports) |
| 502 | (pkt1,match1) = wildcard_all_except_ingress(self,of_ports) |
| 503 | verify_tablestats(self,expect_active=2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 504 | |
| 505 | #Issue Non-strict Delete with match on ingress_port.Verify T+T' gets deleted . |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 506 | nonstrict_delete(self,match1) |
| 507 | verify_tablestats(self,expect_active=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 508 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 509 | logging.info("Inserting three overlapping flows with different priorities") |
| 510 | logging.info("Issue Non-Strict Delete command ") |
| 511 | logging.info("Expecting all the flows to get deleted") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 512 | |
| 513 | #Insert T , add Priority P (say 100 ) |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 514 | (pkt,match) = match_all_except_source_address(self,of_ports,priority=100) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 515 | |
| 516 | #Insert T' add priority (200). |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 517 | (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=200) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 518 | |
| 519 | #Insert T' again add priority 300 --> T" . |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 520 | (pkt2,match2) = wildcard_all_except_ingress(self,of_ports,priority=300) |
| 521 | verify_tablestats(self,expect_active=3) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 522 | |
| 523 | #Issue Non-Strict Delete and verify all getting deleted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 524 | nonstrict_delete(self,match1,priority=200) |
| 525 | verify_tablestats(self,expect_active=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 526 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 527 | logging.info("Inserting three overlapping flows with different priorities") |
| 528 | logging.info("Issue Strict Delete command ") |
| 529 | logging.info("Expecting only one to get deleted because here priorities & wildcards are being matched") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 530 | |
| 531 | #Issue Strict-Delete and verify only T'' gets deleted. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 532 | (pkt,match) = match_all_except_source_address(self,of_ports,priority=100) |
| 533 | (pkt1,match1) = wildcard_all_except_ingress(self,of_ports,priority=200) |
| 534 | (pkt2,match2) = wildcard_all_except_ingress(self,of_ports,priority=300) |
| 535 | strict_delete(self,match1,priority=200) |
| 536 | verify_tablestats(self,expect_active=2) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 537 | |
| 538 | |
| 539 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 540 | class Outport1(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 541 | |
| 542 | """Delete flows filtered by action outport.If the out_port field in the delete command contains a value other than OFPP_NONE, |
| 543 | it introduces a constraint when matching. This constraint is that the rule must contain an output action directed at that port.""" |
| 544 | |
| 545 | def runTest(self): |
| 546 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 547 | logging.info("Outport1 test begins") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 548 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 549 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 550 | of_ports.sort() |
| 551 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 552 | |
| 553 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 554 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 555 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 556 | logging.info("Inserting a flow with output action --> of_port[1]") |
| 557 | logging.info("Deleting the flow but with out_port set to of_port[2]") |
| 558 | logging.info("Expecting switch to filter the delete command") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 559 | |
| 560 | #Build and send Flow-1 with action output to of_port[1] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 561 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 562 | |
| 563 | # Verify active_entries in table_stats_request = 1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 564 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 565 | |
| 566 | #Send delete command matching the flow-1 but with contraint out_port = of_port[2] |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 567 | msg7 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 568 | msg7.out_port = of_ports[2] |
| 569 | msg7.command = ofp.OFPFC_DELETE |
| 570 | msg7.buffer_id = 0xffffffff |
| 571 | msg7.match = match |
| 572 | |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 573 | self.controller.message_send(msg7) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 574 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 575 | |
| 576 | # Verify flow will not get deleted, active_entries in table_stats_request = 1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 577 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 578 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 579 | logging.info("Deleting the flow with out_port set to of_port[1]") |
| 580 | logging.info("Expecting switch to delete the flow") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 581 | |
| 582 | #Send Delete command with contraint out_port = of_ports[1] |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 583 | msg7 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 584 | msg7.out_port = of_ports[1] |
| 585 | msg7.command = ofp.OFPFC_DELETE |
| 586 | msg7.buffer_id = 0xffffffff |
| 587 | msg7.match = match |
| 588 | |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 589 | self.controller.message_send(msg7) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 590 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 591 | |
| 592 | #Verify flow gets deleted. |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 593 | verify_tablestats(self,expect_active=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 594 | |
| 595 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 596 | class IdleTimeout(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 597 | |
| 598 | """ Verify that idle timeout is implemented""" |
| 599 | |
| 600 | def runTest(self): |
| 601 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 602 | logging.info("Running Idle_Timeout test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 603 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 604 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 605 | of_ports.sort() |
| 606 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 607 | |
| 608 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 609 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 610 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 611 | logging.info("Inserting flow entry with idle_timeout set. Also send_flow_removed_message flag set") |
| 612 | logging.info("Expecting the flow entry to delete with given idle_timeout") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 613 | |
| 614 | #Insert a flow entry with idle_timeout=1.Send_Flow_Rem flag set |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 615 | msg9 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 616 | msg9.match.wildcards = ofp.OFPFW_ALL |
| 617 | msg9.cookie = random.randint(0,9007199254740992) |
| 618 | msg9.buffer_id = 0xffffffff |
| 619 | msg9.idle_timeout = 1 |
| 620 | msg9.flags |= ofp.OFPFF_SEND_FLOW_REM |
| 621 | rv1 = self.controller.message_send(msg9) |
| 622 | self.assertTrue(rv1 != -1, "Error installing flow mod") |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 623 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 624 | |
| 625 | #Verify flow gets inserted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 626 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 627 | |
| 628 | # Verify flow removed message is recieved. |
| 629 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED, |
| 630 | timeout=5) |
| 631 | self.assertTrue(response is not None, |
| 632 | 'Did not receive flow removed message ') |
| 633 | self.assertEqual(ofp.OFPRR_IDLE_TIMEOUT, response.reason, |
| 634 | 'Flow table entry removal reason is not idle_timeout') |
| 635 | self.assertEqual(1, response.duration_sec, |
| 636 | 'Flow was not alive for 1 sec') |
| 637 | |
| 638 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 639 | class Outport2(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 640 | |
| 641 | """Add, modify flows with outport set. This field is ignored by ADD, MODIFY, and MODIFY STRICT messages.""" |
| 642 | |
| 643 | def runTest(self): |
| 644 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 645 | logging.info("Running Outport2 test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 646 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 647 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 648 | of_ports.sort() |
| 649 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 650 | |
| 651 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 652 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 653 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 654 | logging.info("Adding and modifying flow with out_port fields set") |
| 655 | logging.info("Expecting switch to ignore out_port") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 656 | |
| 657 | # Create and add flow-1,Action A ,output to port of_port[1], out_port set to of_ports[2] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 658 | (pkt,match) = wildcard_all_except_ingress(self,of_ports) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 659 | |
| 660 | # Verify flow is active |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 661 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 662 | |
| 663 | # Send Packet matching the flow |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 664 | send_packet(self,pkt,of_ports[0],of_ports[1]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 665 | |
| 666 | # Insert Flow-Modify matching flow F-1 ,action A', output to port[2], out_port set to port[3] |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 667 | modify_flow_action(self,of_ports,match) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 668 | |
| 669 | # Again verify active_entries in table_stats_request =1 |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 670 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 671 | |
| 672 | #Verify action is modified |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 673 | send_packet(self,pkt,of_ports[0],of_ports[2]) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 674 | |
| 675 | |
| 676 | |
| 677 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 678 | class HardTimeout(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 679 | |
| 680 | """ Verify that hard timeout is implemented """ |
| 681 | |
| 682 | def runTest(self): |
| 683 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 684 | logging.info("Running Hard_Timeout test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 685 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 686 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 687 | of_ports.sort() |
| 688 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 689 | |
| 690 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 691 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 692 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 693 | logging.info("Inserting flow entry with hard_timeout set. Also send_flow_removed_message flag set") |
| 694 | logging.info("Expecting the flow entry to delete with given hard_timeout") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 695 | |
| 696 | # Insert a flow entry with hardtimeout=1 and send_flow_removed flag set |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 697 | msg9 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 698 | msg9.match.wildcards = ofp.OFPFW_ALL |
| 699 | msg9.cookie = random.randint(0,9007199254740992) |
| 700 | msg9.buffer_id = 0xffffffff |
| 701 | msg9.hard_timeout = 1 |
| 702 | msg9.flags |= ofp.OFPFF_SEND_FLOW_REM |
| 703 | rv1 = self.controller.message_send(msg9) |
| 704 | self.assertTrue(rv1 != -1, "Error installing flow mod") |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 705 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 706 | |
| 707 | #Verify flow gets inserted |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 708 | verify_tablestats(self,expect_active=1) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 709 | |
| 710 | # Verify flow removed message is recieved. |
| 711 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED, |
| 712 | timeout=5) |
| 713 | self.assertTrue(response is not None, |
| 714 | 'Did not receive flow removed message ') |
| 715 | self.assertEqual(ofp.OFPRR_HARD_TIMEOUT, response.reason, |
| 716 | 'Flow table entry removal reason is not hard_timeout') |
| 717 | self.assertEqual(1, response.duration_sec, |
| 718 | 'Flow was not alive for 1 sec') |
| 719 | |
| 720 | |
Rich Lane | b90a1c4 | 2012-10-05 09:16:05 -0700 | [diff] [blame] | 721 | class FlowTimeout(base_tests.SimpleDataPlane): |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 722 | |
| 723 | """Verify that Flow removed messages are generated as expected |
| 724 | Flow removed messages being generated when flag is set, is already tested in the above tests |
| 725 | So here, we test the vice-versa condition""" |
| 726 | |
| 727 | |
| 728 | def runTest(self): |
| 729 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 730 | logging.info("Running Flow_Timeout test ") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 731 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 732 | of_ports = config["port_map"].keys() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 733 | of_ports.sort() |
| 734 | self.assertTrue(len(of_ports) > 1, "Not enough ports for test") |
| 735 | |
| 736 | #Clear switch state |
Rich Lane | 32bf948 | 2013-01-03 17:26:30 -0800 | [diff] [blame] | 737 | delete_all_flows(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 738 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 739 | logging.info("Inserting flow entry with hard_timeout set and send_flow_removed_message flag not set") |
| 740 | logging.info("Expecting the flow entry to delete, but no flow removed message") |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 741 | |
| 742 | # Insert a flow with hard_timeout = 1 but no Send_Flow_Rem flag set |
| 743 | pkt = simple_tcp_packet() |
| 744 | match3 = parse.packet_to_flow_match(pkt) |
| 745 | self.assertTrue(match3 is not None, "Could not generate flow match from pkt") |
| 746 | match3.wildcards = ofp.OFPFW_ALL-ofp.OFPFW_IN_PORT |
| 747 | match3.in_port = of_ports[0] |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 748 | msg3 = ofp.message.flow_mod() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 749 | msg3.out_port = of_ports[2] # ignored by flow add,flow modify |
| 750 | msg3.command = ofp.OFPFC_ADD |
| 751 | msg3.cookie = random.randint(0,9007199254740992) |
| 752 | msg3.buffer_id = 0xffffffff |
| 753 | msg3.hard_timeout = 1 |
| 754 | msg3.buffer_id = 0xffffffff |
| 755 | msg3.match = match3 |
Rich Lane | 9d3cc6b | 2013-03-08 16:33:08 -0800 | [diff] [blame] | 756 | act3 = ofp.action.output() |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 757 | act3.port = of_ports[1] |
Rich Lane | c495d9e | 2013-03-08 17:43:36 -0800 | [diff] [blame^] | 758 | msg3.actions.append(act3) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 759 | |
Rich Lane | 5c3151c | 2013-01-03 17:15:41 -0800 | [diff] [blame] | 760 | self.controller.message_send(msg3) |
Rich Lane | 3a261d5 | 2013-01-03 17:45:08 -0800 | [diff] [blame] | 761 | do_barrier(self.controller) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 762 | |
| 763 | #Verify no flow removed message is generated |
| 764 | (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_FLOW_REMOVED, |
| 765 | timeout=3) |
| 766 | self.assertTrue(response is None, |
| 767 | 'Recieved flow removed message ') |
| 768 | |
| 769 | # Verify no entries in the table |
ShreyaPandita | 8dab466 | 2012-11-02 13:40:14 -0400 | [diff] [blame] | 770 | verify_tablestats(self,expect_active=0) |
ShreyaPandita | 9306c77 | 2012-09-28 12:21:40 -0400 | [diff] [blame] | 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |