Beispiel #1
0
    def test_periodic_arm(self, duthost, platform_api_conn, conf):
        ''' arm watchdog several times as watchdog deamon would and verify API behaves correctly '''

        watchdog_timeout = conf['valid_timeout']
        actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
        time.sleep(TEST_WAIT_TIME_SECONDS)
        remaining_time = watchdog.get_remaining_time(platform_api_conn)
        actual_timeout_new = watchdog.arm(platform_api_conn, watchdog_timeout)

        assert actual_timeout == actual_timeout_new
        assert watchdog.get_remaining_time(platform_api_conn) > remaining_time
Beispiel #2
0
    def test_remaining_time(self, duthost, platform_api_conn, conf):
        ''' arm watchdog with a valid timeout and verify that remaining time API works correctly '''

        watchdog_timeout = conf['valid_timeout']

        # in the begginging of the test watchdog is not armed, so
        # get_remaining_time has to return -1
        assert watchdog.get_remaining_time(platform_api_conn) == -1

        actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
        remaining_time = watchdog.get_remaining_time(platform_api_conn)

        assert remaining_time > 0
        assert remaining_time <= actual_timeout

        remaining_time = watchdog.get_remaining_time(platform_api_conn)
        time.sleep(TEST_WAIT_TIME_SECONDS)
        assert watchdog.get_remaining_time(platform_api_conn) < remaining_time
Beispiel #3
0
    def test_arm_different_timeout_smaller(self, duthost, platform_api_conn,
                                           conf):
        ''' arm the watchdog with smaller timeout value and verify new timeout was accepted;
        If platform accepts only single valid timeout value, @greater_timeout should be None.
        '''

        watchdog_timeout = conf['greater_timeout']
        if watchdog_timeout is None:
            pytest.skip(
                '"greater_timeout" parameter is required for this test case')
        watchdog_timeout_smaller = conf['valid_timeout']
        actual_timeout = watchdog.arm(platform_api_conn, watchdog_timeout)
        remaining_time = watchdog.get_remaining_time(platform_api_conn)
        actual_timeout_smaller = watchdog.arm(platform_api_conn,
                                              watchdog_timeout_smaller)

        assert actual_timeout > actual_timeout_smaller
        assert watchdog.get_remaining_time(platform_api_conn) < remaining_time