1#!/usr/bin/env python2 2# Copyright 2020 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6PROFILE_FILE_DIR = '/var/lib/device_health_profile/' 7 8# Constants that will be used as key name in device health profile. 9BOARD_KEY = 'board' 10MODEL_KEY = 'model' 11LAST_UPDATE_TIME_KEY = 'last_update_time' 12REPAIR_FAIL_COUNT_KEY = 'repair_fail_count' 13PROVISION_FAIL_COUNT_KEY = 'provision_fail_count' 14DUT_STATE_KEY = 'dut_state' 15SERVO_STATE_KEY = 'servo_state' 16FAILED_VERIFIERS_KEY = 'failed_verifiers' 17SUCCEED_REPAIR_ACTIONS_KEY = 'succeed_repair_actions' 18FAILED_REPAIR_ACTIONS_KEY = 'failed_repair_actions' 19TIME_ENTER_CURRENT_STATE_KEY = 'time_enter_current_state' 20PROFILE_VERSION_KEY = 'profile_verision' 21CROS_STABLE_VERSION_KEY = 'last_used_cros_stable_version' 22FIRMWARE_STABLE_VERSION_KEY = 'last_used_firmware_stable_version' 23FAFT_STABLE_VERSION_KEY = 'last_used_faft_stable_version' 24LAST_BADBLOCKS_RO_RUN_TIME_KEY = 'last_badblocks_ro_run_time' 25LAST_BADBLOCKS_RW_RUN_TIME_KEY = 'last_badblocks_rw_run_time' 26LAST_SERVO_MICRO_FW_UPDATE_RUN_TIME_KEY = 'last_servo_micro_flash_run_time' 27 28# Constant for values 29DEFAULT_STRING_VALUE = '' 30DEFAULT_TIMESTAMP = '1970-01-01 00:00:00' 31TIME_PATTERN = '%Y-%m-%d %H:%M:%S' 32DUT_STATE_READY = 'ready' 33DUT_STATE_REPAIR_FAILED = 'repair_failed' 34STATES_NEED_RESET_COUNTER = (DUT_STATE_READY, DUT_STATE_REPAIR_FAILED) 35 36# Please update profile version when you update any key name or template. 37PROFILE_VERSION = '0.0.1' 38 39DEVICE_HEALTH_PROFILE_TEMPLATE = { 40 BOARD_KEY: DEFAULT_STRING_VALUE, 41 MODEL_KEY: DEFAULT_STRING_VALUE, 42 LAST_UPDATE_TIME_KEY: DEFAULT_TIMESTAMP, 43 REPAIR_FAIL_COUNT_KEY: 0, 44 PROVISION_FAIL_COUNT_KEY: 0, 45 DUT_STATE_KEY: DEFAULT_STRING_VALUE, 46 SERVO_STATE_KEY: DEFAULT_STRING_VALUE, 47 FAILED_VERIFIERS_KEY: {}, 48 SUCCEED_REPAIR_ACTIONS_KEY: {}, 49 FAILED_REPAIR_ACTIONS_KEY: {}, 50 TIME_ENTER_CURRENT_STATE_KEY: DEFAULT_TIMESTAMP, 51 PROFILE_VERSION_KEY: PROFILE_VERSION, 52 CROS_STABLE_VERSION_KEY: DEFAULT_STRING_VALUE, 53 FIRMWARE_STABLE_VERSION_KEY: DEFAULT_STRING_VALUE, 54 FAFT_STABLE_VERSION_KEY: DEFAULT_STRING_VALUE, 55 LAST_BADBLOCKS_RO_RUN_TIME_KEY: DEFAULT_TIMESTAMP, 56 LAST_BADBLOCKS_RW_RUN_TIME_KEY: DEFAULT_TIMESTAMP, 57 LAST_SERVO_MICRO_FW_UPDATE_RUN_TIME_KEY: DEFAULT_TIMESTAMP 58} 59