diff options
author | Klement Sekera <ksekera@cisco.com> | 2016-09-29 14:43:44 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-12-07 19:54:12 +0000 |
commit | 0e3c0de1ed87f3cdf16e26e05e39ea6eebeafb18 (patch) | |
tree | dd5f11c08311a95ce56eb8c33d4e8681940bf877 /test/framework.py | |
parent | d171d48edc1672564db8bb920586b8ea220df14c (diff) |
BFD: basic asynchronous session up/down
This is a work-in-progress basic BFD session handling. Only
asynchronous mode is supported at the moment. Setting the session flags
doesn't work.
Change-Id: Idba27f721b5c35be5a66a6d202a63d23ff7ecf6f
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/framework.py b/test/framework.py index b3cbb08a4b5..aa4f2fdf8fc 100644 --- a/test/framework.py +++ b/test/framework.py @@ -462,6 +462,34 @@ class VppTestCase(unittest.TestCase): if info.dst == dst_index: return info + def assert_equal(self, real_value, expected_value, name_or_class=None): + if name_or_class is None: + self.assertEqual(real_value, expected_value, msg) + return + try: + msg = "Invalid %s: %d('%s') does not match expected value %d('%s')" + msg = msg % (getdoc(name_or_class).strip(), + real_value, str(name_or_class(real_value)), + expected_value, str(name_or_class(expected_value))) + except: + msg = "Invalid %s: %s does not match expected value %s" % ( + name_or_class, real_value, expected_value) + + self.assertEqual(real_value, expected_value, msg) + + def assert_in_range( + self, + real_value, + expected_min, + expected_max, + name=None): + if name is None: + msg = None + else: + msg = "Invalid %s: %s out of range <%s,%s>" % ( + name, real_value, expected_min, expected_max) + self.assertTrue(expected_min <= real_value <= expected_max, msg) + class VppTestResult(unittest.TestResult): """ |