blob: d4f838a48da20d2783ac680b1d151cd352917594 [file] [log] [blame]
Saqib Khanbb8b63f2017-05-24 10:58:01 -05001#!/usr/bin/env python
2
3r"""
4This module is the python counterpart to code_update.robot.
5"""
6
7import os
8import sys
9import re
10import string
11import tarfile
12import time
13
14robot_pgm_dir_path = os.path.dirname(__file__) + os.sep
15repo_lib_path = re.sub('/extended/code_update/', '/lib', robot_pgm_dir_path)
16repo_data_path = re.sub('/extended/code_update/', '/data', robot_pgm_dir_path)
17sys.path.append(repo_lib_path)
18sys.path.append(repo_data_path)
19
20import gen_robot_keyword as keyword
21import gen_print as gp
22import gen_valid as gv
23import variables as var
24from robot.libraries.BuiltIn import BuiltIn
25
26
27###############################################################################
28def wait_for_activation_state_change(version_id, initial_state):
29
30 r"""
31 Wait for the current activation state of ${version_id} to
32 change from the state provided by the calling function.
33
34 Description of argument(s):
35 version_id The version ID whose state change we are waiting for.
36 initial_state The activation state we want to wait for.
37 """
38
39 keyword.run_key_u("Open Connection And Log In")
40 retry = 0
41 while (retry < 20):
42 status, software_state = keyword.run_key("Read Properties " +
George Keishingff1e3ec2017-07-20 01:58:21 -050043 var.SOFTWARE_VERSION_URI + str(version_id))
Saqib Khanbb8b63f2017-05-24 10:58:01 -050044 current_state = (software_state)["Activation"]
45 if (initial_state == current_state):
46 time.sleep(60)
47 retry += 1
48 else:
49 return
50 return
51
52###############################################################################