-- Copyright (c) 2024 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at:
--         http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

local M = {}

M.TOPO_STATUS = {
    INITIAL_STATE = 0,        -- 初始状态，状态去重之后设置
    -- 基础组件端口状态
    MATCHED = 1,              -- 匹配成功
    INCORRECT_CONNECTION = 2, -- 线缆连接错误
    UNIT_NOT_SUPPORT = 3,     -- 组件不支持，白名单中没有配置该组件信息
    -- 对端组件状态
    UNIT_NOT_EXIT = 4,        -- 组件不存在，基础组件端口没有读取到该组件信息
    INCOMPLETE_CONNECTION = 5, -- 组件连接不完整（部分线缆未插或连接器连接不完整）
    IGNORE_VALUE = 255        -- 状态量255为EVENT忽略值，EVENT不会进行告警产生或恢复
}
M.UB_CABLE_EVENTCODE = {
    ["0x28000039"] = true,
    ["0x28000041"] = true
}
M.UB_CABLE_INCORRECT_CODE = "0x28000041"
M.UB_CABLE_NOT_PRESENT_CODE = "0x28000039"
M.UB_CABLE_SUBJECT_TYPE = 0x28
M.UB_CABLE_EVENT_KEY_ID_MAP = {
    ["0x28000039"] = "Cable.NotPresent",
    ["0x28000041"] = "Cable.NodeIncorrectConnection"
}
M.UB_CABLE_COMPONENT_NAME_PREFIX = "NodePortAddr_"
M.DEFAULT_CONT_NUM = 2 -- 防抖次数
M.IMU_CMD_ALL_PORT = 255 -- 255表示查询所有端口信息
M.STATIC_COMPONENT_NAME_SIZE = 6 -- 静态的Component Name属性拼接个数
M.STATIC_COMPONENT_NAME_OFFSET = 1

-- 获取当前对应的Component，设置Name属性
-- NodePortAddr_CPUId_DieId_MacroId_InterfaceDeviceSlotId_InterfaceDevicePortId .. _ .. NodeId_GUID
-- 前半段是静态配置，NodeId_GUID是节点间同步
M.COMPONENT_NAME_INDEX_CPUID = 2
M.COMPONENT_NAME_INDEX_DIEID = 3
M.COMPONENT_NAME_INDEX_MACROID = 4
M.COMPONENT_NAME_INDEX_SLOTID = 5
M.COMPONENT_NAME_INDEX_PORTID = 6
M.COMPONENT_NAME_INDEX_NODEID = 7
M.COMPONENT_NAME_INDEX_GUID = 8

return M