Dan Talayco | 4837010 | 2010-03-03 15:17:33 -0800 | [diff] [blame] | 1 | """ |
| 2 | OpenFlow Test Framework |
| 3 | |
| 4 | Framework assert definition |
| 5 | """ |
| 6 | |
| 7 | import sys |
| 8 | import logging |
| 9 | |
| 10 | def oft_assert(condition, string): |
| 11 | """ |
| 12 | Test framework assertion check |
| 13 | |
| 14 | @param condition The boolean condition to check |
| 15 | @param string String to print if error |
| 16 | |
| 17 | If condition is not true, it is considered a test framework |
| 18 | failure and exit is called. |
| 19 | |
| 20 | This assert is meant to represent a violation in the |
| 21 | assumptions of how the test framework is supposed to work |
| 22 | (for example, an inconsistent packet queue state) rather than |
| 23 | a test failure. |
| 24 | """ |
| 25 | if not condition: |
| 26 | logging.critical("Internal error: " + string) |
| 27 | sys.exit(1) |
| 28 | |