blob: 2d0f7e3273468e0add3ee570342e571b1c277114 [file] [log] [blame]
George Keishingcfa950c2019-07-18 12:46:46 -05001#!/usr/bin/env python
2
3r"""
4This module contains functions for tftp update.
5"""
6
7from robot.libraries.BuiltIn import BuiltIn
8
9import state as st
10import gen_print as gp
11
12
13def get_pre_reboot_state():
14 r"""
15 Get and return a custom state which is comprised of the
16 st.default_req_states plus epoch_seconds.
17 """
18
19 global state
20
21 req_states = ['epoch_seconds'] + st.default_req_states
22
23 gp.qprint_timen("Get system state.")
24 state = st.get_state(req_states=req_states, quiet=0)
25 gp.qprint_var(state)
26 return state
27
28
29def wait_for_reboot(start_boot_seconds):
30 r"""
31 Wait for the BMC to complete a previously initiated reboot.
32
33 Description of argument(s):
34 start_boot_seconds The time that the boot test started. The format is the
35 epoch time in seconds, i.e. the number of seconds since
36 1970-01-01 00:00:00 UTC. This value should be obtained
37 from the BMC so that it is not dependent on any kind of
38 synchronization between this machine and the target BMC
39 This will allow this program to work correctly even in
40 a simulated environment. This value should be obtained
41 by the caller prior to initiating a reboot. It can be
42 obtained as follows:
43 state = st.get_state(req_states=['epoch_seconds'])
44
45 """
46
47 st.wait_for_comm_cycle(int(start_boot_seconds))
48
49 gp.qprintn()
50 st.wait_state(st.standby_match_state, wait_time="10 mins", interval="10 seconds")