Matteo Scandolo | a229eca | 2017-08-08 13:05:28 -0700 | [diff] [blame^] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 17 | """ |
| 18 | Connection test cases |
| 19 | |
| 20 | """ |
| 21 | |
| 22 | import time |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 23 | import sys |
| 24 | import logging |
| 25 | |
| 26 | import unittest |
| 27 | import random |
| 28 | |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 29 | from oftest import config |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 30 | import oftest.controller as controller |
Rich Lane | d7b0ffa | 2013-03-08 15:53:42 -0800 | [diff] [blame] | 31 | import ofp |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 32 | import oftest.dataplane as dataplane |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 33 | |
Rich Lane | da3b5ad | 2012-10-03 09:05:32 -0700 | [diff] [blame] | 34 | from oftest.testutils import * |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 35 | |
Rich Lane | 0a4f637 | 2013-01-02 14:40:22 -0800 | [diff] [blame] | 36 | @disabled |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 37 | class BaseHandshake(unittest.TestCase): |
| 38 | """ |
| 39 | Base handshake case to set up controller, but do not send hello. |
| 40 | """ |
| 41 | |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 42 | def controllerSetup(self, host, port): |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 43 | con = controller.Controller(host=host,port=port) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 44 | |
| 45 | # clean_shutdown should be set to False to force quit app |
| 46 | self.clean_shutdown = True |
| 47 | # disable initial hello so hello is under control of test |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 48 | con.initial_hello = False |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 49 | |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 50 | con.start() |
| 51 | self.controllers.append(con) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 52 | |
| 53 | def setUp(self): |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 54 | logging.info("** START TEST CASE " + str(self)) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 55 | |
Ed Swierk | cfdcbd3 | 2013-01-02 18:44:52 -0800 | [diff] [blame] | 56 | self.controllers = [] |
Ken Chiang | e875baf | 2012-10-09 15:24:40 -0700 | [diff] [blame] | 57 | self.default_timeout = test_param_get('default_timeout', |
| 58 | default=2) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 59 | |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 60 | def tearDown(self): |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 61 | logging.info("** END TEST CASE " + str(self)) |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 62 | for con in self.controllers: |
| 63 | con.shutdown() |
| 64 | if self.clean_shutdown: |
| 65 | con.join() |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 66 | |
| 67 | def runTest(self): |
| 68 | # do nothing in the base case |
| 69 | pass |
| 70 | |
| 71 | def assertTrue(self, cond, msg): |
| 72 | if not cond: |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 73 | logging.error("** FAILED ASSERTION: " + msg) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 74 | unittest.TestCase.assertTrue(self, cond, msg) |
| 75 | |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 76 | class HandshakeNoHello(BaseHandshake): |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 77 | """ |
| 78 | TCP connect to switch, but do not sent hello, |
| 79 | and wait for disconnect. |
| 80 | """ |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 81 | def runTest(self): |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 82 | self.controllerSetup(config["controller_host"], |
| 83 | config["controller_port"]) |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 84 | self.controllers[0].connect(self.default_timeout) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 85 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 86 | logging.info("TCP Connected " + |
Ken Chiang | e875baf | 2012-10-09 15:24:40 -0700 | [diff] [blame] | 87 | str(self.controllers[0].switch_addr)) |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 88 | logging.info("Hello not sent, waiting for timeout") |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 89 | |
| 90 | # wait for controller to die |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 91 | self.assertTrue(self.controllers[0].wait_disconnected(timeout=10), |
| 92 | "Not notified of controller disconnect") |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 93 | |
| 94 | class HandshakeNoFeaturesRequest(BaseHandshake): |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 95 | """ |
| 96 | TCP connect to switch, send hello, but do not send features request, |
| 97 | and wait for disconnect. |
| 98 | """ |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 99 | def runTest(self): |
Rich Lane | 477f481 | 2012-10-04 22:49:00 -0700 | [diff] [blame] | 100 | self.controllerSetup(config["controller_host"], |
| 101 | config["controller_port"]) |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 102 | self.controllers[0].connect(self.default_timeout) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 103 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 104 | logging.info("TCP Connected " + |
Ken Chiang | e875baf | 2012-10-09 15:24:40 -0700 | [diff] [blame] | 105 | str(self.controllers[0].switch_addr)) |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 106 | logging.info("Sending hello") |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 107 | self.controllers[0].message_send(ofp.message.hello()) |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 108 | |
Rich Lane | 9a00381 | 2012-10-04 17:17:59 -0700 | [diff] [blame] | 109 | logging.info("Features request not sent, waiting for timeout") |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 110 | |
| 111 | # wait for controller to die |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 112 | self.assertTrue(self.controllers[0].wait_disconnected(timeout=10), |
| 113 | "Not notified of controller disconnect") |
Ken Chiang | d6f5f86 | 2012-09-28 15:40:33 -0700 | [diff] [blame] | 114 | |
Rich Lane | 0a4f637 | 2013-01-02 14:40:22 -0800 | [diff] [blame] | 115 | @disabled |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 116 | class CompleteHandshake(BaseHandshake): |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 117 | """ |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 118 | Set up multiple controllers and complete handshake, but otherwise do nothing. |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 119 | """ |
Rich Lane | d1d9c28 | 2012-10-04 22:07:10 -0700 | [diff] [blame] | 120 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 121 | def buildControllerList(self): |
| 122 | # controller_list is a list of IP:port tuples |
| 123 | con_list = test_param_get('controller_list') |
| 124 | if con_list is not None: |
| 125 | self.controller_list = [] |
| 126 | for controller in con_list: |
| 127 | ip,portstr = controller.split(':') |
| 128 | try: |
| 129 | port = int(portstr) |
| 130 | except: |
| 131 | self.assertTrue(0, "failure converting port " + |
| 132 | portstr + " to integer") |
| 133 | self.controller_list.append( (ip, int(port)) ) |
| 134 | else: |
| 135 | self.controller_list = [(config["controller_host"], |
| 136 | config["controller_port"])] |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 137 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 138 | def __init__(self, keep_alive=True, cxn_cycles=5, |
| 139 | controller_timeout=-1, hello_timeout=5, |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 140 | features_req_timeout=5, disconnected_timeout=3, |
| 141 | report_pkts=False): |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 142 | BaseHandshake.__init__(self) |
| 143 | self.buildControllerList() |
| 144 | self.keep_alive = keep_alive |
| 145 | self.cxn_cycles = test_param_get('cxn_cycles') \ |
| 146 | or cxn_cycles |
| 147 | self.controller_timeout = test_param_get('controller_timeout') \ |
| 148 | or controller_timeout |
| 149 | self.hello_timeout = test_param_get('hello_timeout') \ |
| 150 | or hello_timeout |
| 151 | self.features_req_timeout = test_param_get('features_req_timeout') \ |
| 152 | or features_req_timeout |
| 153 | self.disconnected_timeout = test_param_get('disconnected_timeout') \ |
| 154 | or disconnected_timeout |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 155 | self.report_pkts = report_pkts |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 156 | |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 157 | # These functions provide per-tick processing |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 158 | def periodic_task_init(self, tick_time): |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 159 | """ |
| 160 | Assumes tick_time is in seconds, usually 1/10 of a sec |
| 161 | """ |
| 162 | if not self.report_pkts: |
| 163 | return |
| 164 | self.start_time = time.time() |
| 165 | self.last_report = self.start_time |
| 166 | self.pkt_in_count = 0 # Total packet in count |
| 167 | self.periodic_pkt_in_count = 0 # Packet-ins this cycle |
| 168 | |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 169 | def periodic_task_tick(self, con): |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 170 | """ |
| 171 | Process one tick. Currently this just counts pkt-in msgs |
| 172 | """ |
| 173 | if not self.report_pkts: |
| 174 | return |
| 175 | if con.cstate != 4: |
| 176 | return |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 177 | |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 178 | # Gather packets from control cxn |
| 179 | current_time = time.time() |
| 180 | new_pkts = con.packet_in_count - self.pkt_in_count |
| 181 | self.pkt_in_count = con.packet_in_count |
| 182 | self.periodic_pkt_in_count += new_pkts |
| 183 | con.clear_queue() |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 184 | |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 185 | # Report every second or so |
| 186 | if (current_time - self.last_report >= 1): |
| 187 | if self.periodic_pkt_in_count: |
| 188 | print "%7.2f: pkt/sec last period: %6d. Total %10d." % ( |
| 189 | current_time - self.start_time, |
| 190 | self.periodic_pkt_in_count/(current_time - self.last_report), |
| 191 | self.pkt_in_count) |
| 192 | self.last_report = current_time |
| 193 | self.periodic_pkt_in_count = 0 |
| 194 | |
| 195 | def periodic_task_done(self): |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 196 | if not self.report_pkts: |
| 197 | return |
| 198 | print "Received %d pkt-ins over %d seconds" % ( |
| 199 | self.pkt_in_count, time.time() - self.start_time) |
| 200 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 201 | def runTest(self): |
| 202 | for conspec in self.controller_list: |
| 203 | self.controllerSetup(conspec[0], conspec[1]) |
| 204 | for i in range(len(self.controller_list)): |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 205 | self.controllers[i].cstate = 0 |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 206 | self.controllers[i].keep_alive = self.keep_alive |
Ken Chiang | 74be472 | 2012-12-21 13:07:03 -0800 | [diff] [blame] | 207 | self.controllers[i].saved_switch_addr = None |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 208 | tick = 0.1 # time period in seconds at which controllers are handled |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 209 | self.periodic_task_init(tick) |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 210 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 211 | disconnected_count = 0 |
| 212 | cycle = 0 |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 213 | while True: |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 214 | states = [] |
Ken Chiang | adc950f | 2012-10-05 13:50:03 -0700 | [diff] [blame] | 215 | for con in self.controllers: |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 216 | condesc = con.host + ":" + str(con.port) + ": " |
| 217 | logging.debug("Checking " + condesc) |
Ken Chiang | 35a7437 | 2012-10-01 15:39:25 -0700 | [diff] [blame] | 218 | |
Ken Chiang | 74be472 | 2012-12-21 13:07:03 -0800 | [diff] [blame] | 219 | if con.switch_socket: |
| 220 | if con.switch_addr != con.saved_switch_addr: |
| 221 | con.saved_switch_addr = con.switch_addr |
| 222 | con.cstate = 0 |
| 223 | |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 224 | if con.cstate == 0: |
| 225 | logging.info(condesc + "Sending hello to " + |
| 226 | str(con.switch_addr)) |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 227 | con.message_send(ofp.message.hello()) |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 228 | con.cstate = 1 |
| 229 | con.count = 0 |
| 230 | elif con.cstate == 1: |
| 231 | reply, pkt = con.poll(exp_msg=ofp.OFPT_HELLO, |
| 232 | timeout=0) |
| 233 | if reply is not None: |
| 234 | logging.info(condesc + |
| 235 | "Hello received from " + |
| 236 | str(con.switch_addr)) |
| 237 | con.cstate = 2 |
| 238 | else: |
| 239 | con.count = con.count + 1 |
| 240 | # fall back to previous state on timeout |
| 241 | if con.count >= self.hello_timeout/tick: |
| 242 | logging.info(condesc + |
| 243 | "Timeout hello from " + |
| 244 | str(con.switch_addr)) |
| 245 | con.cstate = 0 |
| 246 | elif con.cstate == 2: |
| 247 | logging.info(condesc + "Sending features request to " + |
| 248 | str(con.switch_addr)) |
Rich Lane | 28fa927 | 2013-03-08 16:00:25 -0800 | [diff] [blame] | 249 | con.message_send(ofp.message.features_request()) |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 250 | con.cstate = 3 |
| 251 | con.count = 0 |
| 252 | elif con.cstate == 3: |
| 253 | reply, pkt = con.poll(exp_msg=ofp.OFPT_FEATURES_REPLY, |
| 254 | timeout=0) |
| 255 | if reply is not None: |
| 256 | logging.info(condesc + |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 257 | "Features reply received from " + |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 258 | str(con.switch_addr)) |
| 259 | con.cstate = 4 |
| 260 | con.count = 0 |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 261 | cycle = cycle + 1 |
Ken Chiang | 74be472 | 2012-12-21 13:07:03 -0800 | [diff] [blame] | 262 | logging.info("Cycle " + str(cycle)) |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 263 | else: |
| 264 | con.count = con.count + 1 |
| 265 | # fall back to previous state on timeout |
| 266 | if con.count >= self.features_req_timeout/tick: |
| 267 | logging.info(condesc + |
| 268 | "Timeout features request from " + |
| 269 | str(con.switch_addr)) |
| 270 | con.cstate = 2 |
| 271 | elif con.cstate == 4: |
| 272 | if (self.controller_timeout < 0 or |
| 273 | con.count < self.controller_timeout/tick): |
| 274 | logging.debug(condesc + |
| 275 | "Maintaining connection to " + |
| 276 | str(con.switch_addr)) |
| 277 | con.count = con.count + 1 |
| 278 | else: |
| 279 | logging.info(condesc + |
| 280 | "Disconnecting from " + |
| 281 | str(con.switch_addr)) |
| 282 | con.disconnect() |
| 283 | con.cstate = 0 |
| 284 | else: |
| 285 | con.cstate = 0 |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 286 | |
| 287 | states.append(con.cstate) |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 288 | self.periodic_task_tick(con) |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 289 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 290 | logging.debug("Cycle " + str(cycle) + |
| 291 | ", states " + str(states) + |
| 292 | ", disconnected_count " + str(disconnected_count)) |
| 293 | if 4 in states: |
| 294 | disconnected_count = 0 |
| 295 | else: |
| 296 | disconnected_count = disconnected_count + 1 |
| 297 | if cycle != 0: |
| 298 | self.assertTrue(disconnected_count < self.disconnected_timeout/tick, |
| 299 | "Timeout expired connecting to controller") |
| 300 | else: |
| 301 | # on first cycle, allow more time for initial connect |
| 302 | self.assertTrue(disconnected_count < 2*self.disconnected_timeout/tick, |
| 303 | "Timeout expired connecting to controller on init") |
| 304 | |
| 305 | if cycle > self.cxn_cycles: |
| 306 | break |
Ken Chiang | 7717399 | 2012-10-30 15:44:39 -0700 | [diff] [blame] | 307 | time.sleep(tick) |
Dan Talayco | 7071cf1 | 2013-04-16 11:02:13 -0700 | [diff] [blame] | 308 | self.periodic_task_done() |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 309 | |
Rich Lane | 0a4f637 | 2013-01-02 14:40:22 -0800 | [diff] [blame] | 310 | @disabled |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 311 | class HandshakeAndKeepalive(CompleteHandshake): |
| 312 | """ |
| 313 | Complete handshake and respond to echo request, but otherwise do nothing. |
| 314 | Good for manual testing. |
| 315 | """ |
| 316 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 317 | def __init__(self): |
| 318 | CompleteHandshake.__init__(self, keep_alive=True) |
| 319 | |
Rich Lane | 0a4f637 | 2013-01-02 14:40:22 -0800 | [diff] [blame] | 320 | @disabled |
Dan Talayco | 7e45412 | 2013-04-12 08:22:42 -0700 | [diff] [blame] | 321 | class MonitorPacketIn(CompleteHandshake): |
| 322 | """ |
| 323 | Complete handshake and respond to echo request. As packet-in messages |
| 324 | arrive, report the count and pkts/second |
| 325 | """ |
| 326 | |
| 327 | def __init__(self): |
| 328 | CompleteHandshake.__init__(self, keep_alive=True, report_pkts=True) |
| 329 | |
| 330 | @disabled |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 331 | class HandshakeNoEcho(CompleteHandshake): |
| 332 | """ |
| 333 | Complete handshake, but otherwise do nothing, and do not respond to echo. |
| 334 | """ |
| 335 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 336 | def __init__(self): |
| 337 | CompleteHandshake.__init__(self, keep_alive=False) |
| 338 | |
Rich Lane | 0a4f637 | 2013-01-02 14:40:22 -0800 | [diff] [blame] | 339 | @disabled |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 340 | class HandshakeAndDrop(CompleteHandshake): |
| 341 | """ |
| 342 | Complete handshake, but otherwise do nothing, and drop connection after a while. |
| 343 | """ |
| 344 | |
Ken Chiang | 9c93e67 | 2012-12-18 12:00:14 -0800 | [diff] [blame] | 345 | def __init__(self): |
| 346 | CompleteHandshake.__init__(self, keep_alive=True, controller_timeout=10) |
| 347 | |