【待评审】Redfish/web-rest接口新增参数和资源协作接口支持一键导入/导出BMC配置包

背景

当BMC自身硬件发生故障需要更换备件时,更换后需要恢复BMC的客户配置。当前BMC的客户配置恢复操作步骤多,方式不统一,繁琐且容易遗漏,因此需要支持能一键导出/导入客户的所有配置,减少人工操作步骤,提高效率和准确性。

关联ISSUE

整体方案

redfish和web-rest接口新增参数,以及新增资源协作接口方法,支持导出BMC的所有配置为zip包,同时支持zip包一键导入。

评审点

  1. Redfish配置导入接口ImportConfiguration增加可选入参ConfigurationType表示导入配置类型
  2. Redfish配置导出接口ExportConfiguration增加可选入参ConfigurationType表示导出配置类型
  3. web-rest配置导入接口增加可选入参ConfigurationType表示导入配置类型
  4. web-rest配置导出接口增加可选入参ConfigurationType表示导出配置类型
  5. Configurations对象新增资源协作接口方法ImportConfigurationBundle
  6. Configurations对象新增资源协作接口方法ExportConfigurationBundle
  7. 导入导出配置包的名称及内容结构
  8. 导入导出配置包中编排文件的名称及内容

详细描述

评审点1:Redfish配置导入接口ImportConfiguration增加可选入参ConfigurationType表示导入配置类型

资源URI:/redfish/v1/Managers/{manager_id}/Actions/Oem/openUBMC/Manager.ImportConfiguration
资源版本:manager.v1_22_0
操作类型:POST
变更点:新增可选入参ConfigurationType表示导入配置类型
输入参数

参数名 类型 必填 示例/取值约束 描述
ConfigurationType string 枚举值:Profile/Bundle,默认值为Profile Profile表示导入配置文件,Bundle表示导入配置包,不传入ConfigurationType则默认导入配置文件

ActionInfo/redfish/v1/Managers/{manager_id}/Manager.ImportConfigurationActionInfo

{
    "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
    "@odata.id": "/redfish/v1/Managers/1/ImportConfigurationActionInfo",
    "@odata.type": "#ActionInfo.v1_0_1.ActionInfo",
    "Id": "ImportConfigurationActionInfo",
    "Name": "Import Configuration Action Info",
    "Parameters": [
        {
            "Name": "Type",
            "Required": true,
            "DataType": "String",
            "AllowableValues": [
                "URI"
            ]
        },
        {
            "Name": "Content",
            "Required": true,
            "DataType": "String"
        },
        {
            "Name": "ConfigurationType",
            "Required": false,
            "DataType": "String",
            "AllowableValues": [
                "Profile",
                "Bundle"
            ]
        }
    ],
    "Oem": {}
}

Schema定义

{
    "definition": {
        "ImportConfiguration": {
            "patternProperties": {
                "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message|Privileges)\\.[a-zA-Z_][a-zA-Z0-9_.]+$": {
                    "type": [
                        "array",
                        "boolean",
                        "number",
                        "null",
                        "object",
                        "string"
                    ],
                    "description": "This property shall specify a valid odata or Redfish property."
                }
            },
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "title": {
                    "type": "string",
                    "description": "Friendly action name"
                },
                "target": {
                    "type": "string",
                    "format": "uri",
                    "description": "Link to invoke action"
                },
                "@Redfish.ActionInfo": {
                    "description": "The term can be applied to an action to action to specific a URI to an ActionInfo resource that describes the parameters supported by this instance of the action.",
                    "type": "string",
                    "format": "uri-reference",
                    "readonly": true
                }
            },
            "parameters": {
                "Type": {
                    "type": "string",
                    "requiredParameter": true,
                    "enum": [
                        "URI"
                    ],
                    "description": "Method of importing the configuration file."
                },
                "Content": {
                    "type": "string",
                    "requiredParameter": true,
                    "description": "Configuration file import path."
                },
                "ConfigurationType": {
                    "type": "string",
                    "requiredParameter": true,
                    "enum": [
                        "Profile",
                        "Bundle"
                    ],
                    "description": "Configuration type."
                }
            },
            "description": "Action of importing BMC and BIOS information.",
            "longDescription": "Action of importing BMC and BIOS information to the BMC's tmp directory or a specified remote file server."
        }
    }
}

评审点2:Redfish配置导出接口ExportConfiguration增加可选入参ConfigurationType表示导出配置类型

资源URI:/redfish/v1/Managers/{manager_id}/Actions/Oem/openUBMC/Manager.ExportConfiguration
资源版本:manager.v1_22_0
操作类型:POST
变更点:新增可选入参ConfigurationType表示导出配置类型
新增参数

参数名 类型 必填 示例/取值约束 描述
ConfigurationType string 枚举值:Profile/Bundle,默认值为Profile Profile表示导出配置文件,Bundle表示导出配置包,不传入ConfigurationType则默认导出配置文件

ActionInfo/redfish/v1/Managers/{manager_id}/ExportConfigurationActionInfo

{
    "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
    "@odata.id": "/redfish/v1/Managers/1/ExportConfigurationActionInfo",
    "@odata.type": "#ActionInfo.v1_0_1.ActionInfo",
    "Id": "ExportConfigurationActionInfo",
    "Name": "Export Configuration Action Info",
    "Parameters": [
        {
            "Name": "Type",
            "Required": true,
            "DataType": "String",
            "AllowableValues": [
                "URI"
            ]
        },
        {
            "Name": "Content",
            "Required": true,
            "DataType": "String"
        },
        {
            "Name": "ConfigurationType",
            "Required": false,
            "DataType": "String",
            "AllowableValues": [
                "Profile",
                "Bundle"
            ]
        }
    ],
    "Oem": {}
}

Schema定义

{
    "definition": {
        "ExportConfiguration": {
            "patternProperties": {
                "^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message|Privileges)\\.[a-zA-Z_][a-zA-Z0-9_.]+$": {
                    "type": [
                        "array",
                        "boolean",
                        "number",
                        "null",
                        "object",
                        "string"
                    ],
                    "description": "This property shall specify a valid odata or Redfish property."
                }
            },
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "title": {
                    "type": "string",
                    "description": "Friendly action name"
                },
                "target": {
                    "type": "string",
                    "format": "uri",
                    "description": "Link to invoke action"
                },
                "@Redfish.ActionInfo": {
                    "description": "The term can be applied to an action to action to specific a URI to an ActionInfo resource that describes the parameters supported by this instance of the action.",
                    "type": "string",
                    "format": "uri-reference",
                    "readonly": true
                }
            },
            "parameters": {
                "Type": {
                    "type": "string",
                    "requiredParameter": true,
                    "enum": [
                        "URI"
                    ],
                    "description": "Method of exporting the configuration file."
                },
                "Content": {
                    "type": "string",
                    "requiredParameter": true,
                    "description": "Configuration file export path."
                },
                "ConfigurationType": {
                    "type": "string",
                    "requiredParameter": true,
                    "enum": [
                        "Profile",
                        "Bundle"
                    ],
                    "description": "Configuration type."
                }
            },
            "description": "Action of importing BMC and BIOS information.",
            "longDescription": "Action of importing BMC and BIOS information from the tmp directory or a specified remote file server."
        }
    }
}

评审点3:web-rest配置导入接口增加可选入参ConfigurationType表示导入配置类型

接口URI:/UI/Rest/BMCSettings/Configuration/ImportConfig
操作类型:POST
变更点:新增可选入参ConfigurationType表示导入配置类型
新增参数

参数名 类型 必填 示例/取值约束 描述
ConfigurationType string 枚举值:Profile/Bundle,默认值为Profile Profile表示导入配置文件,Bundle表示导入配置包,不传入ConfigurationType则默认导入配置文件

评审点4:web-rest配置导出接口增加可选入参ConfigurationType表示导出配置类型

接口URI:/UI/Rest/BMCSettings/Configuration/ImportConfig
操作类型:POST
变更点:新增可选入参ConfigurationType表示导出配置类型
新增参数

参数名 类型 必填 示例/取值约束 描述
ConfigurationType string 枚举值:Profile/Bundle,默认值为Profile Profile表示导出配置文件,Bundle表示导出配置包,不传入ConfigurationType则默认导出配置文件

评审点5: Configurations对象新增资源协作接口方法ImportConfigurationBundle

资源Path: /bmc/kepler/Managers/:ManagerId/Configurations
资源Interface: bmc.kepler.Managers.Configurations
变化类型:新增方法

方法名称 请求签名 请求参数描述 响应签名 响应参数描述 方法描述 访问权限
ImportConfigurationBundle s BundleURI: 导入BMC配置包路径,支持本地或远程路径 u 任务id 导入BMC配置包 BasicSetting、UserMgmt

评审点6: Configurations对象新增资源协作接口方法ExportConfigurationBundle

资源Path: /bmc/kepler/Managers/:ManagerId/Configurations
资源Interface: bmc.kepler.Managers.Configurations
变化类型:新增方法

方法名称 请求签名 请求参数描述 响应签名 响应参数描述 方法描述 访问权限
ExportConfigurationBundle s BundleURI: 导出BMC配置包路径,支持本地或远程路径 u 任务id 导出BMC配置包 BasicSetting、UserMgmt

评审点7: 导入导出配置包的名称及内容结构

配置包名称:config.zip
配置包内文件结构

.
├── ConfigurationProfile	# 配置文件
│   ├── post_config.json
│   └── pre_config.json
├── Firmware			# 固件升级包
│   ├── bios_protect.hpm
│   └── clear_log.hpm
├── manifest.json			# 配置编排文件
└── ImagePreference		# Web UI界面定制图像
    ├── code1.png
    ├── abc.ico
    ├── header_logo.png
    ├── img_01.png
    ├── login.png
    └── logo.jpg

评审点8:导入导出配置包中编排文件的名称及内容

配置编排文件功能
1、导入配置包时,后台根据配置编排文件的内容确定执行配置导入的步骤顺序,以及每一步需要导入的文件名称,一个步骤需要同时导入多个文件时使用key-value形式表示对应关系;
2、导出配置包时,列出每种配置类型导出的文件名称,一个步骤需要同时导出多个文件时使用key-value形式表示对应关系,不涉及导出的配置类型,置空便于后续修改进行配置导入;

配置编排文件名称
manifest.json(推荐)
备选名称:
setup.json
orchestration.json

导入时配置编排文件内容示例
对象数组表示所需执行的配置导入步骤,数组顺序表示执行顺序;

{
	"Manifest": [											# 和文件名称一致,使用大驼峰,备选Setup、Orchestration
		{
            "ImagePreference": {
                "Favicon": "abc.ico",
                "QRCode": "code1.png",
                "TopBarLogo": "header_logo.png",
                "LoginBackground": "login.png",
                "LoginLogo": "logo.png",
                "ProductPicture1": "img_01.png",
                "ProductPicture2": "",
                "ProductPicture3": ""
            }
		},
        {
            "Firmware": "bios_protect.hpm"
        },
        {
            "Firmware": "clear_log.hpm"
        },
        {
            "ConfigurationProfile": "pre_config.json"
        },
        {
            "RestorePoint": true
        },
        {
            "ConfigurationProfile": "post_config.json"
        }
	]
}

ImagePreference:Web UI界面定制图像,备选名称:WebUIImage/WebImage
Firmware:固件升级
ConfigurationProfile:配置导入
RestorePoint:设置还原点

导出时配置编排文件内容示例
对象数组表示不同配置项导出的文件名称,数组顺序预计按字典序排序,不支持导出的配置项置空或置false,便于后续修改进行配置导入

{
	"Manifest": [
		{
            "ImagePreference": {
                "Favicon": "abc.ico",
                "QRCode": "code1.png",
                "TopBarLogo": "header_logo.png",
                "LoginBackground": "login.png",
                "LoginLogo": "logo.png",
                "ProductPicture1": "img_01.png",
                "ProductPicture2": "",
                "ProductPicture3": ""
            }
		},
        {
            "ConfigurationProfile": "config.json"
        },
		{
            "Firmware": ""
        },
		{
            "RestorePoint": false
        }
	]
}

评审结论

遗留问题

  1. 区分导入导出配置类型,不应该从文件类型区分,应该从业务场景区分;
  2. redfish接口新增参数需要有内部结论;