Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 1 | """ |
Dan Talayco | 79f3608 | 2010-03-11 16:53:53 -0800 | [diff] [blame] | 2 | Basic protocol and dataplane test cases |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 3 | |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 4 | It is recommended that these definitions be kept in their own |
| 5 | namespace as different groups of tests will likely define |
| 6 | similar identifiers. |
| 7 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 8 | Current Assumptions: |
| 9 | |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 10 | The function test_set_init is called with a complete configuration |
| 11 | dictionary prior to the invocation of any tests from this file. |
| 12 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 13 | The switch is actively attempting to contact the controller at the address |
| 14 | indicated oin oft_config |
| 15 | |
| 16 | """ |
| 17 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 18 | import time |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 19 | import signal |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 20 | import sys |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 21 | import logging |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 22 | |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 23 | import unittest |
Ken Chiang | 1bf0160 | 2012-04-04 10:48:23 -0700 | [diff] [blame] | 24 | import random |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 25 | |
| 26 | import oftest.controller as controller |
| 27 | import oftest.cstruct as ofp |
| 28 | import oftest.message as message |
| 29 | import oftest.dataplane as dataplane |
| 30 | import oftest.action as action |
| 31 | |
Dan Talayco | e605b1b | 2012-09-18 06:56:20 -0700 | [diff] [blame^] | 32 | import oftest.illegal_message as illegal_message |
| 33 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 34 | from testutils import * |
| 35 | |
| 36 | #@var basic_port_map Local copy of the configuration map from OF port |
| 37 | # numbers to OS interfaces |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 38 | basic_port_map = None |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 39 | #@var basic_logger Local logger object |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 40 | basic_logger = None |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 41 | #@var basic_config Local copy of global configuration data |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 42 | basic_config = None |
| 43 | |
Dan Talayco | c24aaae | 2010-07-08 14:05:24 -0700 | [diff] [blame] | 44 | test_prio = {} |
| 45 | |
Ken Chiang | aeb23d6 | 2012-08-23 21:20:07 -0700 | [diff] [blame] | 46 | TEST_VID_DEFAULT = 2 |
| 47 | |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 48 | def test_set_init(config): |
| 49 | """ |
| 50 | Set up function for basic test classes |
| 51 | |
| 52 | @param config The configuration dictionary; see oft |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 53 | """ |
| 54 | |
| 55 | global basic_port_map |
| 56 | global basic_logger |
| 57 | global basic_config |
| 58 | |
| 59 | basic_logger = logging.getLogger("basic") |
| 60 | basic_logger.info("Initializing test set") |
| 61 | basic_port_map = config["port_map"] |
| 62 | basic_config = config |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 63 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 64 | class SimpleProtocol(unittest.TestCase): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 65 | """ |
| 66 | Root class for setting up the controller |
| 67 | """ |
| 68 | |
Dan Talayco | ef701f4 | 2010-05-07 09:22:35 -0700 | [diff] [blame] | 69 | def sig_handler(self, v1, v2): |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 70 | basic_logger.critical("Received interrupt signal; exiting") |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 71 | print "Received interrupt signal; exiting" |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 72 | self.clean_shutdown = False |
| 73 | self.tearDown() |
Rich Lane | 58cf05f | 2012-07-11 16:41:47 -0700 | [diff] [blame] | 74 | raise KeyboardInterrupt |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 75 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 76 | def setUp(self): |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 77 | self.logger = basic_logger |
Dan Talayco | 285a838 | 2010-07-20 14:06:55 -0700 | [diff] [blame] | 78 | self.config = basic_config |
Ed Swierk | 022d02e | 2012-08-22 06:26:36 -0700 | [diff] [blame] | 79 | #@todo Test cases shouldn't monkey with signals; move SIGINT handler |
| 80 | # to top-level oft |
| 81 | try: |
| 82 | signal.signal(signal.SIGINT, self.sig_handler) |
| 83 | except ValueError, e: |
| 84 | basic_logger.info("Could not set SIGINT handler: %s" % e) |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 85 | basic_logger.info("** START TEST CASE " + str(self)) |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 86 | self.controller = controller.Controller( |
| 87 | host=basic_config["controller_host"], |
| 88 | port=basic_config["controller_port"]) |
Dan Talayco | f8f4140 | 2010-03-12 22:17:39 -0800 | [diff] [blame] | 89 | # clean_shutdown should be set to False to force quit app |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 90 | self.clean_shutdown = True |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 91 | self.controller.start() |
Dan Talayco | ef701f4 | 2010-05-07 09:22:35 -0700 | [diff] [blame] | 92 | #@todo Add an option to wait for a pkt transaction to ensure version |
| 93 | # compatibilty? |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 94 | self.controller.connect(timeout=20) |
Dan Talayco | ef701f4 | 2010-05-07 09:22:35 -0700 | [diff] [blame] | 95 | if not self.controller.active: |
Rich Lane | 58cf05f | 2012-07-11 16:41:47 -0700 | [diff] [blame] | 96 | raise Exception("Controller startup failed") |
Dan Talayco | 677c0b7 | 2011-08-23 22:53:38 -0700 | [diff] [blame] | 97 | if self.controller.switch_addr is None: |
Rich Lane | 58cf05f | 2012-07-11 16:41:47 -0700 | [diff] [blame] | 98 | raise Exception("Controller startup failed (no switch addr)") |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 99 | basic_logger.info("Connected " + str(self.controller.switch_addr)) |
Ed Swierk | c7193a2 | 2012-08-22 06:51:02 -0700 | [diff] [blame] | 100 | request = message.features_request() |
| 101 | reply, pkt = self.controller.transact(request, timeout=10) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 102 | self.assertTrue(reply is not None, |
| 103 | "Did not complete features_request for handshake") |
Ed Swierk | c7193a2 | 2012-08-22 06:51:02 -0700 | [diff] [blame] | 104 | self.supported_actions = reply.actions |
| 105 | basic_logger.info("Supported actions: " + hex(self.supported_actions)) |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 106 | |
Dan Talayco | 677cc11 | 2012-03-27 10:28:58 -0700 | [diff] [blame] | 107 | def inheritSetup(self, parent): |
| 108 | """ |
| 109 | Inherit the setup of a parent |
| 110 | |
| 111 | This allows running at test from within another test. Do the |
| 112 | following: |
| 113 | |
| 114 | sub_test = SomeTestClass() # Create an instance of the test class |
| 115 | sub_test.inheritSetup(self) # Inherit setup of parent |
| 116 | sub_test.runTest() # Run the test |
| 117 | |
| 118 | Normally, only the parent's setUp and tearDown are called and |
| 119 | the state after the sub_test is run must be taken into account |
| 120 | by subsequent operations. |
| 121 | """ |
| 122 | self.logger = parent.logger |
| 123 | self.config = parent.config |
| 124 | basic_logger.info("** Setup " + str(self) + " inheriting from " |
| 125 | + str(parent)) |
| 126 | self.controller = parent.controller |
Ed Swierk | 6192e51 | 2012-08-22 11:41:40 -0700 | [diff] [blame] | 127 | self.supported_actions = parent.supported_actions |
Dan Talayco | 677cc11 | 2012-03-27 10:28:58 -0700 | [diff] [blame] | 128 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 129 | def tearDown(self): |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 130 | basic_logger.info("** END TEST CASE " + str(self)) |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 131 | self.controller.shutdown() |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 132 | #@todo Review if join should be done on clean_shutdown |
Dan Talayco | f8f4140 | 2010-03-12 22:17:39 -0800 | [diff] [blame] | 133 | if self.clean_shutdown: |
| 134 | self.controller.join() |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 135 | |
| 136 | def runTest(self): |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 137 | # Just a simple sanity check as illustration |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 138 | basic_logger.info("Running simple proto test") |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 139 | self.assertTrue(self.controller.switch_socket is not None, |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 140 | str(self) + 'No connection to switch') |
| 141 | |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 142 | def assertTrue(self, cond, msg): |
| 143 | if not cond: |
| 144 | basic_logger.error("** FAILED ASSERTION: " + msg) |
| 145 | unittest.TestCase.assertTrue(self, cond, msg) |
| 146 | |
Dan Talayco | c24aaae | 2010-07-08 14:05:24 -0700 | [diff] [blame] | 147 | test_prio["SimpleProtocol"] = 1 |
| 148 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 149 | class SimpleDataPlane(SimpleProtocol): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 150 | """ |
| 151 | Root class that sets up the controller and dataplane |
| 152 | """ |
| 153 | def setUp(self): |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 154 | SimpleProtocol.setUp(self) |
Jeffrey Townsend | 4d5ca92 | 2012-07-11 11:37:35 -0700 | [diff] [blame] | 155 | self.dataplane = dataplane.DataPlane(self.config) |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 156 | for of_port, ifname in basic_port_map.items(): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 157 | self.dataplane.port_add(ifname, of_port) |
| 158 | |
Dan Talayco | 677cc11 | 2012-03-27 10:28:58 -0700 | [diff] [blame] | 159 | def inheritSetup(self, parent): |
| 160 | """ |
| 161 | Inherit the setup of a parent |
| 162 | |
| 163 | See SimpleProtocol.inheritSetup |
| 164 | """ |
| 165 | SimpleProtocol.inheritSetup(self, parent) |
| 166 | self.dataplane = parent.dataplane |
| 167 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 168 | def tearDown(self): |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 169 | basic_logger.info("Teardown for simple dataplane test") |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 170 | SimpleProtocol.tearDown(self) |
Rich Lane | 58cf05f | 2012-07-11 16:41:47 -0700 | [diff] [blame] | 171 | if hasattr(self, 'dataplane'): |
| 172 | self.dataplane.kill(join_threads=self.clean_shutdown) |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 173 | basic_logger.info("Teardown done") |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 174 | |
| 175 | def runTest(self): |
Dan Talayco | 710438c | 2010-02-18 15:16:07 -0800 | [diff] [blame] | 176 | self.assertTrue(self.controller.switch_socket is not None, |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 177 | str(self) + 'No connection to switch') |
| 178 | # self.dataplane.show() |
| 179 | # Would like an assert that checks the data plane |
| 180 | |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 181 | class DataPlaneOnly(unittest.TestCase): |
| 182 | """ |
| 183 | Root class that sets up only the dataplane |
| 184 | """ |
| 185 | |
| 186 | def sig_handler(self, v1, v2): |
| 187 | basic_logger.critical("Received interrupt signal; exiting") |
| 188 | print "Received interrupt signal; exiting" |
| 189 | self.clean_shutdown = False |
| 190 | self.tearDown() |
Rich Lane | 58cf05f | 2012-07-11 16:41:47 -0700 | [diff] [blame] | 191 | raise KeyboardInterrupt |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 192 | |
| 193 | def setUp(self): |
Shudong Zhou | e3582a5 | 2012-08-03 20:46:50 -0700 | [diff] [blame] | 194 | self.clean_shutdown = True |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 195 | self.logger = basic_logger |
Dan Talayco | 285a838 | 2010-07-20 14:06:55 -0700 | [diff] [blame] | 196 | self.config = basic_config |
Ed Swierk | 022d02e | 2012-08-22 06:26:36 -0700 | [diff] [blame] | 197 | #@todo Test cases shouldn't monkey with signals; move SIGINT handler |
| 198 | # to top-level oft |
| 199 | try: |
| 200 | signal.signal(signal.SIGINT, self.sig_handler) |
| 201 | except ValueError, e: |
| 202 | basic_logger.info("Could not set SIGINT handler: %s" % e) |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 203 | basic_logger.info("** START DataPlaneOnly CASE " + str(self)) |
Jeffrey Townsend | 4d5ca92 | 2012-07-11 11:37:35 -0700 | [diff] [blame] | 204 | self.dataplane = dataplane.DataPlane(self.config) |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 205 | for of_port, ifname in basic_port_map.items(): |
| 206 | self.dataplane.port_add(ifname, of_port) |
| 207 | |
| 208 | def tearDown(self): |
| 209 | basic_logger.info("Teardown for simple dataplane test") |
| 210 | self.dataplane.kill(join_threads=self.clean_shutdown) |
| 211 | basic_logger.info("Teardown done") |
| 212 | |
| 213 | def runTest(self): |
Dan Talayco | ba4fd4f | 2010-07-21 21:49:41 -0700 | [diff] [blame] | 214 | basic_logger.info("DataPlaneOnly") |
Dan Talayco | 285a838 | 2010-07-20 14:06:55 -0700 | [diff] [blame] | 215 | # self.dataplane.show() |
Dan Talayco | 551befa | 2010-07-15 17:05:32 -0700 | [diff] [blame] | 216 | # Would like an assert that checks the data plane |
| 217 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 218 | class Echo(SimpleProtocol): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 219 | """ |
| 220 | Test echo response with no data |
| 221 | """ |
| 222 | def runTest(self): |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 223 | request = message.echo_request() |
Dan Talayco | e226eb1 | 2010-02-18 23:06:30 -0800 | [diff] [blame] | 224 | response, pkt = self.controller.transact(request) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 225 | self.assertTrue(response is not None, |
| 226 | "Did not get echo reply") |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 227 | self.assertEqual(response.header.type, ofp.OFPT_ECHO_REPLY, |
Dan Talayco | a92e75b | 2010-02-16 20:53:56 -0800 | [diff] [blame] | 228 | 'response is not echo_reply') |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 229 | self.assertEqual(request.header.xid, response.header.xid, |
| 230 | 'response xid != request xid') |
| 231 | self.assertEqual(len(response.data), 0, 'response data non-empty') |
| 232 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 233 | class EchoWithData(SimpleProtocol): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 234 | """ |
| 235 | Test echo response with short string data |
| 236 | """ |
| 237 | def runTest(self): |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 238 | request = message.echo_request() |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 239 | request.data = 'OpenFlow Will Rule The World' |
Dan Talayco | e226eb1 | 2010-02-18 23:06:30 -0800 | [diff] [blame] | 240 | response, pkt = self.controller.transact(request) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 241 | self.assertTrue(response is not None, |
| 242 | "Did not get echo reply (with data)") |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 243 | self.assertEqual(response.header.type, ofp.OFPT_ECHO_REPLY, |
Dan Talayco | a92e75b | 2010-02-16 20:53:56 -0800 | [diff] [blame] | 244 | 'response is not echo_reply') |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 245 | self.assertEqual(request.header.xid, response.header.xid, |
| 246 | 'response xid != request xid') |
| 247 | self.assertEqual(request.data, response.data, |
| 248 | 'response data does not match request') |
| 249 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 250 | class PacketIn(SimpleDataPlane): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 251 | """ |
| 252 | Test packet in function |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 253 | |
| 254 | Send a packet to each dataplane port and verify that a packet |
| 255 | in message is received from the controller for each |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 256 | """ |
| 257 | def runTest(self): |
| 258 | # Construct packet to send to dataplane |
Dan Talayco | e226eb1 | 2010-02-18 23:06:30 -0800 | [diff] [blame] | 259 | # Send packet to dataplane, once to each port |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 260 | # Poll controller with expect message type packet in |
Dan Talayco | e226eb1 | 2010-02-18 23:06:30 -0800 | [diff] [blame] | 261 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 262 | rc = delete_all_flows(self.controller, basic_logger) |
| 263 | self.assertEqual(rc, 0, "Failed to delete all flows") |
Dan Talayco | 0fc08bd | 2012-04-09 16:56:18 -0700 | [diff] [blame] | 264 | self.assertEqual(do_barrier(self.controller), 0, "Barrier failed") |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 265 | |
Ken Chiang | aeb23d6 | 2012-08-23 21:20:07 -0700 | [diff] [blame] | 266 | vid = test_param_get(self.config, 'vid', default=TEST_VID_DEFAULT) |
| 267 | |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 268 | for of_port in basic_port_map.keys(): |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 269 | for pkt, pt in [ |
| 270 | (simple_tcp_packet(), "simple TCP packet"), |
Ken Chiang | aeb23d6 | 2012-08-23 21:20:07 -0700 | [diff] [blame] | 271 | (simple_tcp_packet(dl_vlan_enable=True,dl_vlan=vid,pktlen=108), |
| 272 | "simple tagged TCP packet"), |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 273 | (simple_eth_packet(), "simple Ethernet packet"), |
| 274 | (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]: |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 275 | |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 276 | basic_logger.info("PKT IN test with %s, port %s" % (pt, of_port)) |
| 277 | self.dataplane.send(of_port, str(pkt)) |
| 278 | #@todo Check for unexpected messages? |
| 279 | count = 0 |
| 280 | while True: |
| 281 | (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN, 2) |
| 282 | if not response: # Timeout |
| 283 | break |
Ed Swierk | 506614a | 2012-03-29 08:16:59 -0700 | [diff] [blame] | 284 | if dataplane.match_exp_pkt(pkt, response.data): # Got match |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 285 | break |
| 286 | if not basic_config["relax"]: # Only one attempt to match |
| 287 | break |
| 288 | count += 1 |
| 289 | if count > 10: # Too many tries |
| 290 | break |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 291 | |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 292 | self.assertTrue(response is not None, |
| 293 | 'Packet in message not received on port ' + |
| 294 | str(of_port)) |
Ed Swierk | 506614a | 2012-03-29 08:16:59 -0700 | [diff] [blame] | 295 | if not dataplane.match_exp_pkt(pkt, response.data): |
Dan Talayco | 2baf8b5 | 2012-03-30 09:55:42 -0700 | [diff] [blame] | 296 | basic_logger.debug("Sent %s" % format_packet(pkt)) |
| 297 | basic_logger.debug("Resp %s" % format_packet(response.data)) |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 298 | self.assertTrue(False, |
| 299 | 'Response packet does not match send packet' + |
| 300 | ' for port ' + str(of_port)) |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 301 | |
Ed Swierk | 3ae7f71 | 2012-08-22 06:45:25 -0700 | [diff] [blame] | 302 | class PacketInDefaultDrop(SimpleDataPlane): |
| 303 | """ |
| 304 | Test packet in function |
| 305 | |
| 306 | Send a packet to each dataplane port and verify that a packet |
| 307 | in message is received from the controller for each |
| 308 | """ |
| 309 | def runTest(self): |
| 310 | rc = delete_all_flows(self.controller, basic_logger) |
| 311 | self.assertEqual(rc, 0, "Failed to delete all flows") |
| 312 | self.assertEqual(do_barrier(self.controller), 0, "Barrier failed") |
| 313 | |
| 314 | for of_port in basic_port_map.keys(): |
| 315 | pkt = simple_tcp_packet() |
| 316 | self.dataplane.send(of_port, str(pkt)) |
| 317 | count = 0 |
| 318 | while True: |
| 319 | (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN, 2) |
| 320 | if not response: # Timeout |
| 321 | break |
| 322 | if dataplane.match_exp_pkt(pkt, response.data): # Got match |
| 323 | break |
| 324 | if not basic_config["relax"]: # Only one attempt to match |
| 325 | break |
| 326 | count += 1 |
| 327 | if count > 10: # Too many tries |
| 328 | break |
| 329 | |
| 330 | self.assertTrue(response is None, |
| 331 | 'Packet in message received on port ' + |
| 332 | str(of_port)) |
| 333 | |
| 334 | test_prio["PacketInDefaultDrop"] = -1 |
| 335 | |
Jeffrey Townsend | 4d5ca92 | 2012-07-11 11:37:35 -0700 | [diff] [blame] | 336 | |
Dan Talayco | 1f648cb | 2012-05-03 09:37:56 -0700 | [diff] [blame] | 337 | class PacketInBroadcastCheck(SimpleDataPlane): |
| 338 | """ |
| 339 | Check if bcast pkts leak when no flows are present |
| 340 | |
| 341 | Clear the flow table |
| 342 | Send in a broadcast pkt |
| 343 | Look for the packet on other dataplane ports. |
| 344 | """ |
| 345 | def runTest(self): |
| 346 | # Need at least two ports |
| 347 | self.assertTrue(len(basic_port_map) > 1, "Too few ports for test") |
| 348 | |
| 349 | rc = delete_all_flows(self.controller, basic_logger) |
| 350 | self.assertEqual(rc, 0, "Failed to delete all flows") |
| 351 | self.assertEqual(do_barrier(self.controller), 0, "Barrier failed") |
| 352 | |
| 353 | of_ports = basic_port_map.keys() |
| 354 | d_port = of_ports[0] |
| 355 | pkt = simple_eth_packet(dl_dst='ff:ff:ff:ff:ff:ff') |
| 356 | |
| 357 | basic_logger.info("BCast Leak Test, send to port %s" % d_port) |
| 358 | self.dataplane.send(d_port, str(pkt)) |
| 359 | |
Rich Lane | c8aaa3e | 2012-07-26 19:28:02 -0700 | [diff] [blame] | 360 | (of_port, pkt_in, pkt_time) = self.dataplane.poll(exp_pkt=pkt) |
Dan Talayco | 1f648cb | 2012-05-03 09:37:56 -0700 | [diff] [blame] | 361 | self.assertTrue(pkt_in is None, |
| 362 | 'BCast packet received on port ' + str(of_port)) |
| 363 | |
| 364 | test_prio["PacketInBroadcastCheck"] = -1 |
| 365 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 366 | class PacketOut(SimpleDataPlane): |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 367 | """ |
| 368 | Test packet out function |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 369 | |
| 370 | Send packet out message to controller for each dataplane port and |
| 371 | verify the packet appears on the appropriate dataplane port |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 372 | """ |
| 373 | def runTest(self): |
| 374 | # Construct packet to send to dataplane |
| 375 | # Send packet to dataplane |
| 376 | # Poll controller with expect message type packet in |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 377 | |
| 378 | rc = delete_all_flows(self.controller, basic_logger) |
| 379 | self.assertEqual(rc, 0, "Failed to delete all flows") |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 380 | |
| 381 | # These will get put into function |
Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 382 | of_ports = basic_port_map.keys() |
| 383 | of_ports.sort() |
| 384 | for dp_port in of_ports: |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 385 | for outpkt, opt in [ |
| 386 | (simple_tcp_packet(), "simple TCP packet"), |
| 387 | (simple_eth_packet(), "simple Ethernet packet"), |
| 388 | (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]: |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 389 | |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 390 | basic_logger.info("PKT OUT test with %s, port %s" % (opt, dp_port)) |
| 391 | msg = message.packet_out() |
| 392 | msg.data = str(outpkt) |
| 393 | act = action.action_output() |
| 394 | act.port = dp_port |
| 395 | self.assertTrue(msg.actions.add(act), 'Could not add action to msg') |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 396 | |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 397 | basic_logger.info("PacketOut to: " + str(dp_port)) |
| 398 | rv = self.controller.message_send(msg) |
| 399 | self.assertTrue(rv == 0, "Error sending out message") |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 400 | |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 401 | exp_pkt_arg = None |
| 402 | exp_port = None |
| 403 | if basic_config["relax"]: |
| 404 | exp_pkt_arg = outpkt |
| 405 | exp_port = dp_port |
Rich Lane | c8aaa3e | 2012-07-26 19:28:02 -0700 | [diff] [blame] | 406 | (of_port, pkt, pkt_time) = self.dataplane.poll(port_number=exp_port, |
Ed Swierk | 0aeff8c | 2012-03-23 20:27:18 -0700 | [diff] [blame] | 407 | exp_pkt=exp_pkt_arg) |
| 408 | |
| 409 | self.assertTrue(pkt is not None, 'Packet not received') |
| 410 | basic_logger.info("PacketOut: got pkt from " + str(of_port)) |
| 411 | if of_port is not None: |
| 412 | self.assertEqual(of_port, dp_port, "Unexpected receive port") |
Ed Swierk | 506614a | 2012-03-29 08:16:59 -0700 | [diff] [blame] | 413 | if not dataplane.match_exp_pkt(outpkt, pkt): |
Dan Talayco | 2baf8b5 | 2012-03-30 09:55:42 -0700 | [diff] [blame] | 414 | basic_logger.debug("Sent %s" % format_packet(outpkt)) |
| 415 | basic_logger.debug("Resp %s" % format_packet( |
| 416 | str(pkt)[:len(str(outpkt))])) |
Dan Talayco | dc6fca3 | 2012-03-30 10:05:49 -0700 | [diff] [blame] | 417 | self.assertEqual(str(outpkt), str(pkt)[:len(str(outpkt))], |
| 418 | 'Response packet does not match send packet') |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 419 | |
Ken Chiang | 1bf0160 | 2012-04-04 10:48:23 -0700 | [diff] [blame] | 420 | class PacketOutMC(SimpleDataPlane): |
| 421 | """ |
| 422 | Test packet out to multiple output ports |
| 423 | |
| 424 | Send packet out message to controller for 1 to N dataplane ports and |
| 425 | verify the packet appears on the appropriate ports |
| 426 | """ |
| 427 | def runTest(self): |
| 428 | # Construct packet to send to dataplane |
| 429 | # Send packet to dataplane |
| 430 | # Poll controller with expect message type packet in |
| 431 | |
| 432 | rc = delete_all_flows(self.controller, basic_logger) |
| 433 | self.assertEqual(rc, 0, "Failed to delete all flows") |
| 434 | |
| 435 | # These will get put into function |
| 436 | of_ports = basic_port_map.keys() |
| 437 | random.shuffle(of_ports) |
| 438 | for num_ports in range(1,len(of_ports)+1): |
| 439 | for outpkt, opt in [ |
| 440 | (simple_tcp_packet(), "simple TCP packet"), |
| 441 | (simple_eth_packet(), "simple Ethernet packet"), |
| 442 | (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]: |
| 443 | |
| 444 | dp_ports = of_ports[0:num_ports] |
| 445 | basic_logger.info("PKT OUT test with " + opt + |
| 446 | ", ports " + str(dp_ports)) |
| 447 | msg = message.packet_out() |
| 448 | msg.data = str(outpkt) |
| 449 | act = action.action_output() |
| 450 | for i in range(0,num_ports): |
| 451 | act.port = dp_ports[i] |
| 452 | self.assertTrue(msg.actions.add(act), |
| 453 | 'Could not add action to msg') |
| 454 | |
| 455 | basic_logger.info("PacketOut to: " + str(dp_ports)) |
| 456 | rv = self.controller.message_send(msg) |
| 457 | self.assertTrue(rv == 0, "Error sending out message") |
| 458 | |
| 459 | receive_pkt_check(self.dataplane, outpkt, dp_ports, |
| 460 | set(of_ports).difference(dp_ports), |
| 461 | self, basic_logger, basic_config) |
| 462 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 463 | class FlowStatsGet(SimpleProtocol): |
| 464 | """ |
| 465 | Get stats |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 466 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 467 | Simply verify stats get transaction |
| 468 | """ |
| 469 | def runTest(self): |
| 470 | basic_logger.info("Running StatsGet") |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 471 | basic_logger.info("Inserting trial flow") |
Dan Talayco | 677c0b7 | 2011-08-23 22:53:38 -0700 | [diff] [blame] | 472 | request = flow_mod_gen(basic_port_map, True) |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 473 | rv = self.controller.message_send(request) |
| 474 | self.assertTrue(rv != -1, "Failed to insert test flow") |
| 475 | |
| 476 | basic_logger.info("Sending flow request") |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 477 | request = message.flow_stats_request() |
| 478 | request.out_port = ofp.OFPP_NONE |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 479 | request.table_id = 0xff |
| 480 | request.match.wildcards = 0 # ofp.OFPFW_ALL |
Rich Lane | c8aaa3e | 2012-07-26 19:28:02 -0700 | [diff] [blame] | 481 | response, pkt = self.controller.transact(request) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 482 | self.assertTrue(response is not None, |
| 483 | "Did not get response for flow stats") |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 484 | basic_logger.debug(response.show()) |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 485 | |
Dan Talayco | 677c0b7 | 2011-08-23 22:53:38 -0700 | [diff] [blame] | 486 | test_prio["FlowStatsGet"] = -1 |
| 487 | |
Dan Talayco | 79c6c4d | 2010-06-08 14:01:53 -0700 | [diff] [blame] | 488 | class TableStatsGet(SimpleProtocol): |
| 489 | """ |
| 490 | Get table stats |
| 491 | |
| 492 | Simply verify table stats get transaction |
| 493 | """ |
| 494 | def runTest(self): |
| 495 | basic_logger.info("Running TableStatsGet") |
| 496 | basic_logger.info("Inserting trial flow") |
Dan Talayco | 677c0b7 | 2011-08-23 22:53:38 -0700 | [diff] [blame] | 497 | request = flow_mod_gen(basic_port_map, True) |
Dan Talayco | 79c6c4d | 2010-06-08 14:01:53 -0700 | [diff] [blame] | 498 | rv = self.controller.message_send(request) |
| 499 | self.assertTrue(rv != -1, "Failed to insert test flow") |
| 500 | |
| 501 | basic_logger.info("Sending table stats request") |
| 502 | request = message.table_stats_request() |
Rich Lane | c8aaa3e | 2012-07-26 19:28:02 -0700 | [diff] [blame] | 503 | response, pkt = self.controller.transact(request) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 504 | self.assertTrue(response is not None, |
| 505 | "Did not get reply for table stats") |
Dan Talayco | 79c6c4d | 2010-06-08 14:01:53 -0700 | [diff] [blame] | 506 | basic_logger.debug(response.show()) |
| 507 | |
Ed Swierk | ae74c36 | 2012-04-02 08:21:41 -0700 | [diff] [blame] | 508 | class DescStatsGet(SimpleProtocol): |
| 509 | """ |
| 510 | Get stats |
| 511 | |
| 512 | Simply verify stats get transaction |
| 513 | """ |
| 514 | def runTest(self): |
| 515 | basic_logger.info("Running DescStatsGet") |
| 516 | |
| 517 | basic_logger.info("Sending stats request") |
| 518 | request = message.desc_stats_request() |
Rich Lane | c8aaa3e | 2012-07-26 19:28:02 -0700 | [diff] [blame] | 519 | response, pkt = self.controller.transact(request) |
Dan Talayco | 97d4f36 | 2012-09-18 03:22:09 -0700 | [diff] [blame] | 520 | self.assertTrue(response is not None, |
| 521 | "Did not get reply for desc stats") |
Ed Swierk | ae74c36 | 2012-04-02 08:21:41 -0700 | [diff] [blame] | 522 | basic_logger.debug(response.show()) |
| 523 | |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 524 | class FlowMod(SimpleProtocol): |
| 525 | """ |
| 526 | Insert a flow |
| 527 | |
| 528 | Simple verification of a flow mod transaction |
| 529 | """ |
| 530 | |
| 531 | def runTest(self): |
| 532 | basic_logger.info("Running " + str(self)) |
Dan Talayco | 677c0b7 | 2011-08-23 22:53:38 -0700 | [diff] [blame] | 533 | request = flow_mod_gen(basic_port_map, True) |
Dan Talayco | 6ce963a | 2010-03-07 21:58:13 -0800 | [diff] [blame] | 534 | rv = self.controller.message_send(request) |
Dan Talayco | 41eae8b | 2010-03-10 13:57:06 -0800 | [diff] [blame] | 535 | self.assertTrue(rv != -1, "Error installing flow mod") |
| 536 | |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 537 | class PortConfigMod(SimpleProtocol): |
| 538 | """ |
| 539 | Modify a bit in port config and verify changed |
| 540 | |
| 541 | Get the switch configuration, modify the port configuration |
| 542 | and write it back; get the config again and verify changed. |
| 543 | Then set it back to the way it was. |
| 544 | """ |
| 545 | |
| 546 | def runTest(self): |
| 547 | basic_logger.info("Running " + str(self)) |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 548 | for of_port, ifname in basic_port_map.items(): # Grab first port |
| 549 | break |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 550 | |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 551 | (hw_addr, config, advert) = \ |
| 552 | port_config_get(self.controller, of_port, basic_logger) |
| 553 | self.assertTrue(config is not None, "Did not get port config") |
| 554 | |
| 555 | basic_logger.debug("No flood bit port " + str(of_port) + " is now " + |
| 556 | str(config & ofp.OFPPC_NO_FLOOD)) |
| 557 | |
| 558 | rv = port_config_set(self.controller, of_port, |
| 559 | config ^ ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD, |
| 560 | basic_logger) |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 561 | self.assertTrue(rv != -1, "Error sending port mod") |
| 562 | |
| 563 | # Verify change took place with same feature request |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 564 | (hw_addr, config2, advert) = \ |
| 565 | port_config_get(self.controller, of_port, basic_logger) |
| 566 | basic_logger.debug("No flood bit port " + str(of_port) + " is now " + |
| 567 | str(config2 & ofp.OFPPC_NO_FLOOD)) |
| 568 | self.assertTrue(config2 is not None, "Did not get port config2") |
| 569 | self.assertTrue(config2 & ofp.OFPPC_NO_FLOOD != |
| 570 | config & ofp.OFPPC_NO_FLOOD, |
| 571 | "Bit change did not take") |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 572 | # Set it back |
Dan Talayco | 9f47f4d | 2010-06-03 13:54:37 -0700 | [diff] [blame] | 573 | rv = port_config_set(self.controller, of_port, config, |
| 574 | ofp.OFPPC_NO_FLOOD, basic_logger) |
| 575 | self.assertTrue(rv != -1, "Error sending port mod") |
Dan Talayco | b3f43fe | 2010-05-13 14:24:20 -0700 | [diff] [blame] | 576 | |
Ken Chiang | aeb23d6 | 2012-08-23 21:20:07 -0700 | [diff] [blame] | 577 | class PortConfigModErr(SimpleProtocol): |
| 578 | """ |
| 579 | Modify a bit in port config on an invalid port and verify |
| 580 | error message is received. |
| 581 | """ |
| 582 | |
| 583 | def runTest(self): |
| 584 | basic_logger.info("Running " + str(self)) |
| 585 | |
| 586 | # pick a random bad port number |
| 587 | bad_port = random.randint(1, ofp.OFPP_MAX) |
| 588 | count = 0 |
| 589 | while (count < 50) and (bad_port in basic_port_map.keys()): |
| 590 | bad_port = random.randint(1, ofp.OFPP_MAX) |
| 591 | count = count + 1 |
| 592 | self.assertTrue(count < 50, "Error selecting bad port") |
| 593 | basic_logger.info("Select " + str(bad_port) + " as invalid port") |
| 594 | |
| 595 | rv = port_config_set(self.controller, bad_port, |
| 596 | ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD, |
| 597 | basic_logger) |
| 598 | self.assertTrue(rv != -1, "Error sending port mod") |
| 599 | |
| 600 | # poll for error message |
| 601 | while True: |
| 602 | (response, raw) = self.controller.poll(ofp.OFPT_ERROR, 2) |
| 603 | if not response: # Timeout |
| 604 | break |
| 605 | if response.code == ofp.OFPPMFC_BAD_PORT: |
| 606 | basic_logger.info("Received error message with OFPPMFC_BAD_PORT code") |
| 607 | break |
| 608 | if not basic_config["relax"]: # Only one attempt to match |
| 609 | break |
| 610 | count += 1 |
| 611 | if count > 10: # Too many tries |
| 612 | break |
| 613 | |
| 614 | self.assertTrue(response is not None, 'Did not receive error message') |
| 615 | |
Dan Talayco | e605b1b | 2012-09-18 06:56:20 -0700 | [diff] [blame^] | 616 | class BadMessage(SimpleProtocol): |
| 617 | """ |
| 618 | Send a message with a bad type and verify an error is returned |
| 619 | """ |
| 620 | |
| 621 | def runTest(self): |
| 622 | basic_logger.info("Running " + str(self)) |
| 623 | request = illegal_message.illegal_message_type() |
| 624 | |
| 625 | reply, pkt = self.controller.transact(request, timeout=10) |
| 626 | self.assertTrue(reply is not None, "Did not get response to bad req") |
| 627 | self.assertTrue(reply.header.type == ofp.OFPT_ERROR, |
| 628 | "reply not an error message") |
| 629 | self.assertTrue(reply.type == ofp.OFPET_BAD_REQUEST, |
| 630 | "reply error type is not bad request") |
| 631 | self.assertTrue(reply.code == ofp.OFPBRC_BAD_TYPE, |
| 632 | "reply error code is not bad type") |
| 633 | |
Dan Talayco | dba244e | 2010-02-15 14:08:53 -0800 | [diff] [blame] | 634 | if __name__ == "__main__": |
Dan Talayco | 2c0dba3 | 2010-03-06 22:47:06 -0800 | [diff] [blame] | 635 | print "Please run through oft script: ./oft --test_spec=basic" |