Paul Vinciguerra | 03f1af2 | 2019-06-25 22:30:19 -0400 | [diff] [blame] | 1 | # Copyright (c) 2019. Vinci Consulting Corp. All Rights Reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | import time |
| 15 | import unittest |
| 16 | from framework import VppTestCase |
| 17 | |
| 18 | |
| 19 | class TestVpeApi(VppTestCase): |
| 20 | """TestVpeApi""" |
| 21 | |
| 22 | def test_log_dump_default(self): |
| 23 | rv = self.vapi.cli('test log notice fib entry this is a test') |
| 24 | rv = self.vapi.log_dump() |
| 25 | # print('\n'.join([str(v) for v in rv])) |
| 26 | self.assertTrue(rv) |
| 27 | |
| 28 | def test_log_dump_timestamp_0(self): |
| 29 | rv = self.vapi.cli('test log notice fib entry this is a test') |
| 30 | rv = self.vapi.log_dump(start_timestamp=0.0) |
| 31 | # print('\n'.join([str(v) for v in rv])) |
| 32 | self.assertTrue(rv) |
| 33 | |
| 34 | @unittest.skip('Requires https://gerrit.fd.io/r/#/c/19581/ ' |
| 35 | 'to use timestamp_ticks.') |
| 36 | def test_log_dump_timestamp_future(self): |
| 37 | rv = self.vapi.cli('test log debug fib entry test') |
| 38 | rv = self.vapi.log_dump(start_timestamp=time.time() + 60.0) |
| 39 | # print('\n'.join([str(v) for v in rv])) |
| 40 | self.assertFalse(rv) |
| 41 | |
| 42 | @unittest.skip('Requires https://gerrit.fd.io/r/#/c/19581/ ' |
| 43 | 'to use timestamp_ticks.') |
| 44 | def test_show_vpe_system_time_ticks(self): |
| 45 | rv = self.vapi.show_vpe_system_time_ticks() |
| 46 | self.assertTrue(rv.vpe_system_time_ticks > 1.0) |