redfish在plugins下添加的lua脚本执行不了

问题描述

我们有个定制包CTCC,在CTCC/interface_config/redfish/plugins/下添加脚本logservices.lua,并在logservices.lua定义了函数;但在定义redfish接口的json文件中调用不到我定义的函数

环境信息

~ ~ $ ipmcget -d version
------------------- openUBMC INFO -------------------
IPMC CPU: Hi1711
IPMI Version: 2.0
Active openUBMC Version: 1.17.10
Active openUBMC Build: 01
Active openUBMC Built: 14:33:07 Mar 27 2026
Backup openUBMC Version: 1.17.10
Available openUBMC Version: 1.00.16
Available openUBMC Build: 01
Active Uboot Version: 21.3.10.1 (09:53:00 Dec 30 2025)
Backup Uboot Version: 21.3.10.1 (09:53:00 Dec 30 2025)
Active Secure Bootloader Version: 21.3.10.1 (09:51:37 Dec 30 2025)
Backup Secure Bootloader Version: 21.3.10.1 (09:51:37 Dec 30 2025)
Active Secure Firmware Version: 21.3.10.1 (09:51:38 Dec 30 2025)
Backup Secure Firmware Version: 21.3.10.1 (09:51:38 Dec 30 2025)
Active BMCSDK Version: 5.12.00.01
----------------- Product INFO -----------------
Product ID: 0x0000
Product Name: Atlas 800I A3
Product Unique ID: 0x000000010302BF02
Active BIOS Version: (U75)21.23
Backup BIOS Version: 21.23

重现步骤

期望结果

定义redfish接口的json文件中能正常调用新增的lua脚本

实际结果

定义redfish接口的json文件中调用不到新增的lua脚本

尝试过的解决方案

分析结论

是否需要在哪个编译脚本里面添加install新增的lua脚本

请提供一下报错信息 和redfish接口的json文件的配置内容

这是我的CTCC定制仓截图:

执行POST https://192.168.42.55/redfish/v1/Managers/1/LogServices/Actions/Oem/openUBMC/CollectNPULog

/var/log/app.log打印:

由于新用户无法上传附件,现把LogServices.json内容贴出来:

{
“Resources”: [
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices”,
“Interfaces”: [
{
“Type”: “GET”,
“ResourceExist”: {
“${Statements/IsValidManagersId()}”: true
},
“RspBody”: {
@odata.context”: “/redfish/v1/$metadata#LogServiceCollection.LogServiceCollection”,
@odata.id”: “/redfish/v1/Managers/${Uri/managerid}/LogServices”,
@odata.type”: “#LogServiceCollection1.LogServiceCollection1”,
“Name”: “LogService Collection”,
“Members@odata.count”: “${Statements/MembersCount()}”,
“Members”: “${Statements/Members()}”,
“Actions”: {
“Oem”: {
“{{OemIdentifier}}”: {
#LogService.CollectNPULog”: {
“target”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Actions/Oem/{{Oe@Redfish.ActionInfoIdentifier}}/CollectNPULog”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectNPULogActionInfo”
},
#LogService.CollectNPULog.Status”: {
“target”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Actions/Oem/{@Redfish.ActionInfoOemIdentifier}}/CollectNPULog.Status”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectNPULog.StatusActionInfo”
},
#LogService.DownloadNPULog”: {
“target”: “/redfish/v1/Managers/${Uri/managerid}/LogServic@Redfish.ActionInfos/Actions/Oem/{{OemIdentifier}}/DownloadNPULog”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/DownloadNPULogActionInfo”
},
#LogService.CollectAllLog”: {
“target”: “/redfish/v1/Managers/${Uri/managerid@Redfish.ActionInfo/LogServices/Actions/Oem/{{OemIdentifier}}/CollectAllLog”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectAllLogActionInfo”
},
#LogService.CollectAllLog.Status”: {
“target”: “/redfish/v1/Managers/${Uri/manage@Redfish.ActionInfoid}/LogServices/Actions/Oem/{{OemIdentifier}}/CollectAllLog.Status”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectAllLog.StatusActionInfo”
},
#LogService.DownloadAllLog”: {
“target”: “/redfish/v1/Manag@Redfish.ActionInfors/${Uri/managerid}/LogServices/Actions/Oem/{{OemIdentifier}}/DownloadAllLog”,
@Redfish.ActionInfo”: “/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/DownloadAllLogActionInfo”
}
}
}
}
},
“Statements”: {
“MembersCount”: {
“Input”: “${ProcessingFlow[1]/Destination/Members}”,
“Steps”: [
{
“Type”: “Count”
}
]
},
“Members”: {
“Input”: “${ProcessingFlow[1]/Destination/Members}”,
“Steps”: [
{
“Type”: “Prefix-Trim”,
“Formula”: “/bmc/kepler/”
},
{
“T@odata.idpe”: “Prefix-Add”,
“Formula”: “/redfish/v1/”
},
{
“Type”: “L-Pair”,
“Formula”: “@odata.id
}
]
},
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
}
},
“ProcessingFlow”: [
{
“Type”: “List”,
“Path”: “/bmc/kepler/Managers/1/LogServices”,
“Destination”: {
“Members”: “Members”
}
}
]
}
]
},
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/CollectNPULogActionInfo”,
“Interfaces”: [
{
“Type”: “GET@odata.context,
“ResourceExist”: {
“${Statements/IsValidManagersI@odata.id()}”: true
},
“RspBody”: {
@odata.context”: “/redfish/v1/$metadata#ActionInfo.ActionInfo”,
@odata.id”: “/redfish/v1/Manage@odata.types/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectNPULogActionInfo”,
@odata.type”: “#ActionInfo.v1_0_0.ActionInfo”,
“Id”: “CollectNPULogActionInfo”,
“Name”: “Collect NPU Log Action Info”,
“Parameters”: ,
“Oem”: {}
},
“Statements”: {
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
}
}
}
]
},
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices/Actions/Oem/{{OemIdentifier}}/CollectNPULog”,
“Interfaces”: [
{
“Type”: “POST”,
“ResourceExist”: {
“${Statements/IsValidManagersId()}”: true,
“${Statements/CollectNPULog()}”: true
},
“ReqBody”: {
“Type”: “object”,
“Required”: true,
“Properties”: {}
},
“Statements”: {
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
},
“CollectNPULog”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “logservices.collect_npu_log()”
}
]
}
}
}
]
},
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/CollectNPULog.StatusActionInfo”,
“Interfaces”: [
{
“T@odata.contextpe”: “GET”,
“ResourceExist”: {
“${Statements/IsVali@odata.idManagersId()}”: true
},
“RspBody”: {
@odata.context”: “/redfish/v1/$metadata#ActionInfo.ActionInfo”,
@odata.id”: “/redfish/v1/Man@odata.typegers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectNPULog.StatusActionInfo”,
@odata.type”: “#ActionInfo.v1_0_0.ActionInfo”,
“Id”: “CollectNPULog.StatusActionInfo”,
“Name”: “Collect NPU Log Status Action Info”,
“Parameters”: ,
“Oem”: {}
},
“Statements”: {
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
}
}
}
]
},
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices/Actions/Oem/{{OemIdentifier}}/CollectNPULog.Status”,
“Interfaces”: [
{
“Type”: “GET”,
“ResourceExist”: {
“${Statements/IsValidManagersId()}”: true
},
“RspBody”: {
“State”: “${Statements/State()}”,
“Progress”: “${Statements/Progress()}”
},
“Statements”: {
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
},
“State”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “logservices.collect_npu_log_state()”
}
]
},
“Progress”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “logservices.collect_npu_log_progress()”
}
]
}
}
}
]
},
{
“Uri”: “/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/DownloadNPULogActionInfo”,
“Interface@odata.context”: [
{
“Type”: “GET”,
“ResourceExist”: {
“${Stateme@odata.idts/IsValidManagersId()}”: true
},
“RspBody”: {
@odata.context”: “/redfish/v1/$metadata#ActionInfo.ActionInfo”,
@odata.id”: @odata.type/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/DownloadNPULogActionInfo”,
@odata.type”: “#ActionInfo.v1_0_0.ActionInfo”,
“Id”: “DownloadNPULogActionInfo”,
“Name”: “Download NPU Log Action Info”,
“Parameters”: ,
“Oem”: {}
},
“Statements”: {
“IsValidManagersId”: {
“Steps”: [
{
“Type”: “Plugin”,
“Formula”: “utils.is_valid_managers_id(Uri.managerid)”
}
]
}
}
}
]
},

    {
        "Uri": "/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/CollectAllLogActionInfo",
        "Interfaces": [
            {
                "Type": "GET",
                "ResourceExist": {
                    "${Statements/IsValidManagersId()}": true
                },
                "Statements": {
                    "IsValidManagersId": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "utils.is_valid_managers_id(Uri.managerid)"
                            }
                        ]
                    }
                },
                "RspBody": {
                    "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
                    "@odata.id": "/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectAllLogActionInfo",
                    "@odata.type": "#ActionInfo.v1_0_0.ActionInfo",
                    "Id": "CollectAllLogActionInfo",
                    "Name": "Collect All Log Action Info",
                    "Parameters": [],
                    "Oem": {}
                }
            }
        ]
    },
    {
        "Uri": "/redfish/v1/Managers/:managerid/LogServices/Actions/Oem/{{OemIdentifier}}/CollectAllLog",
        "Interfaces": [
            {
                "Type": "POST",
                "LockdownAllow": true,
                "ResourceExist": {
                    "${Statements/IsValidManagersId()}": true,
                    "${Statements/CollectAllLog()}": true
                },
                "ReqBody": {
                    "Type": "object",
                    "Required": true,
                    "Properties": {}
                },
                "Statements": {
                    "IsValidManagersId": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "utils.is_valid_managers_id(Uri.managerid)"
                            }
                        ]
                    },
                    "CollectAllLog": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "logservices.collect_all_log()"
                            }
                        ]
                    }
                }
            }
        ]
    },
    {
        "Uri": "/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/CollectAllLog.StatusActionInfo",
        "Interfaces": [
            {
                "Type": "GET",
                "ResourceExist": {
                    "${Statements/IsValidManagersId()}": true
                },
                "RspBody": {
                    "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
                    "@odata.id": "/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/CollectAllLog.StatusActionInfo",
                    "@odata.type": "#ActionInfo.v1_0_0.ActionInfo",
                    "Id": "CollectAllLog.StatusActionInfo",
                    "Name": "Collect All Log Status Action Info",
                    "Parameters": [],
                    "Oem": {}
                },
                "Statements": {
                    "IsValidManagersId": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "utils.is_valid_managers_id(Uri.managerid)"
                            }
                        ]
                    }
                }
            }
        ]
    },
    {
        "Uri": "/redfish/v1/Managers/:managerid/LogServices/Actions/Oem/{{OemIdentifier}}/CollectAllLog.Status",
        "Interfaces": [
            {
                "Type": "GET",
                "ResourceExist": {
                    "${Statements/IsValidManagersId()}": true
                },
                "RspBody": {
                    "State": "${Statements/State()}",
                    "Progress": "${Statements/Progress()}"
                },
                "Statements": {
                    "IsValidManagersId": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "utils.is_valid_managers_id(Uri.managerid)"
                            }
                        ]
                    },
                    "Progress": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "logservices.collect_all_log_progress()"
                            }
                        ]
                    },
                    "State": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "logservices.collect_all_log_state()"
                            }
                        ]
                    }
                }
            }
        ]
    },
    {
        "Uri": "/redfish/v1/Managers/:managerid/LogServices/Oem/{{OemIdentifier}}/DownloadAllLogActionInfo",
        "Interfaces": [
            {
                "Type": "GET",
                "ResourceExist": {
                    "${Statements/IsValidManagersId()}": true
                },
                "RspBody": {
                    "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
                    "@odata.id": "/redfish/v1/Managers/${Uri/managerid}/LogServices/Oem/{{OemIdentifier}}/DownloadAllLogActionInfo",
                    "@odata.type": "#ActionInfo.v1_0_1.ActionInfo",
                    "Id": "DownloadAllLogActionInfo",
                    "Name": "Download All Log Action Info",
                    "Parameters": [],
                    "Oem": {}
                },
                "Statements": {
                    "IsValidManagersId": {
                        "Steps": [
                            {
                                "Type": "Plugin",
                                "Formula": "utils.is_valid_managers_id(Uri.managerid)"
                            }
                        ]
                    }
                }
            }
        ]
    }
]

}

由于新用户无法上传文件,现在把logservices.lua的内容贴出来:

– 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 cjson = require ‘cjson’
local log = require ‘mc.logging’
local context = require ‘mc.context’
local mdb_service = require ‘mc.mdb.mdb_service’

local m = {}

function m.get_npu_path(npu_id)
if not npu_id then
return ‘’
end
local npu_list = mdb.get_sub_objects(bus, ‘/bmc/kepler/Systems/1/Processors/NPU’,
‘bmc.kepler.Systems.Processor’)
for path, obj in pairs(npu_list) do
if obj.Id == npu_id then
return path
end
end
return ‘’
end

– unimplemented
function m.collect_npu_log()
log:error(‘lbing*************************** cctc collect_npu_log’)
– to collect all npu log here
return true
end

– unimplemented
function m.collect_npu_log_state()
log:error(‘lbing*************************** cctc collect_npu_log_state’)
return ‘New’
end

– unimplemented
function m.collect_npu_log_progress()
log:error(‘lbing*************************** cctc collect_npu_log_progress’)
return 0
end

– unimplemented
function m.collect_all_log()
log:error(‘lbing*************************** cctc collect_all_log’)
return true
end

– unimplemented
function m.collect_all_log_progress()
log:error(‘lbing*************************** cctc collect_all_log_progress’)
return 0
end

– unimplemented
function m.collect_all_log_state()
log:error(‘lbing*************************** cctc collect_all_log_state’)
return ‘New’
end

return m

@Larry_Li

修改redfish日志级别为debug后,再次发送post请求可以看到更详细的错误

@vyasa @Larry_Li 你好,在CTCC/interface_config/redfish/config.json配置脚本拷贝动作就可以正常执行lua脚本了:

        {

            "Source": "plugins/logservices.lua",

            "Target": "plugins/orchestrator/logservices.lua"

        },