blob: d773c84179e67395a8a1e7941c95d5bd4cdca349 [file] [log] [blame]
Dan Talayco48370102010-03-03 15:17:33 -08001"""
2OpenFlow Test Framework
3
4Framework assert definition
5"""
6
7import sys
8import logging
9
10def 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