【已评审】NtpService资源支持Actions操作

关联issue

支持Redfish资源NtpService下可以导入NTP组密钥-rackmount-GitCode

背景

客户需求需要Redfish资源NtpService下支持导入NTP组密钥

评审点

  • 新增NtpService资源下的Actions属性
  • 新增NtpService资源下的ImportNtpKeyActionInfo资源
  • 新增NtpService资源下的ImportNtpKey请求
  • 新增NtpService资源Actions操作错误引擎

评审点1:新增NtpService资源下的Actions属性

URI:/redfish/v1/Managers/:managerid/NtpService
操作类型:GET
新增属性:Actions
样例:

"Actions": {
    "#NtpService.ImportNtpKey": {
        "target": "/redfish/v1/Managers/:managerid/NtpService/Actions/NtpService.ImportNtpKey",
        "@Redfish.ActionInfo": "/redfish/v1/Managers/:managerid/NtpService/ImportNtpKeyActionInfo"
    }
}

评审点2:新增NtpService资源下的ImportNtpKeyActionInfo资源

URI:/redfish/v1/Managers/:managerid/NtpService/ImportNtpKeyActionInfo
操作类型:GET
响应样例:

{
    "Uri": "/redfish/v1/AccountService/ImportRootCertificateActionInfo",
    "Interfaces": [
        {
            "Type": "GET",
            "RspBody": {
                "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo",
                "@odata.id": "/redfish/v1/Managers/1/NtpService/ImportNtpKeyActionInfo",
                "@odata.type": "#ActionInfo.v1_0_1.ActionInfo",
                "Id": "ImportNtpKeyActionInfo",
                "Name": "Import Ntp Key Action Info",
                "Parameters": [
                    {
                        "Name": "Type",   // 上传NTP组密钥的方式,取值为string
                        "Required": true,
                        "DataType": "String",
                        "AllowableValues": [
                            "text",    // 上传NTP组密钥的方式,类型为text
                            "URI"      // 上传NTP组密钥的方式,类型为URI
                        ]
                    },
                    {
                        "Name": "Content",   // 上传NTP组密钥的内容,取值为string
                        "Required": true,
                        "DataType": "String" 
                    }
                ]
            }
        }
    ]
}

参数说明:

参数名 参数说明 取值约束
type 上传NTP组密钥的方式 ● text方式:表明value值是密钥 ● URI方式:表明value值是URI(本地或者远程)
value 上传NTP组密钥的内容 1:若type的值是text,则value值是密钥的内容; 2:若type的值是URI,则value值是证书的路径,可以是证书本地路径(只能在/tmp目录下)或者远程路径(支持的文件传输协议有https、sftp、nfs、cifs、scp)

评审点3:新增NtpService资源下的ImportNtpKey请求

"Url":"/redfish/v1/Managers/:managerid/NtpService/Actions/NtpService.ImportNtpKey"

操作类型:POST
请求样例:

{
    "Type": "URI",
    "Content": "/tmp/ntp.key"
}

响应样例:

{
    "error": {
        "code": "Base.1.0.GeneralError",
        "message": "A general error has occured. See ExtendedInfo for more information.",
        "@Message.ExtendedInfo": [
            {
                "@odata.type": "#Message.v1_0_0.Message",
                "MessageId": "Base.1.0.UploadNTPSecureGroupKeysuccessfully",
                "RelatedProperties": [],
                "Message": "The NTP group key is uploaded successfully.",
                "MessageArgs": 0,
                "Severity": "OK",
                "Resolution": "None."
            }
        ]
    }
}

评审点4:新增NtpService资源Actions操作错误引擎

  • UploadNTPSecureGroupKeysuccessfully
"UploadNTPSecureGroupKeysuccessfully": {
            "Description": "Indicates that an NTP group key is uploaded successfully.",
            "Message": "The NTP group key is uploaded successfully.",
            "Severity": "OK",
            "NumberOfArgs": 0,
            "Resolution": "None.",
            "HttpStatusCode": 200,
            "IpmiCompletionCode": "0x00",
            "SnmpStatusCode": 0
        }
  • NTPSecureGroupKeyTooLarge
"NTPSecureGroupKeyTooLarge": {
            "Description": "Indicates that an error occuerd during the NTP group key upload process.",
            "Message": "Failed to upload the NTP group key because it is oversized.",
            "Severity": "Warning",
            "NumberOfArgs": 0,
            "Resolution": "Make sure that the content or URI of the NTP group in the request body is valid.",
            "HttpStatusCode": 400,
            "IpmiCompletionCode": "0xFF",
            "SnmpStatusCode": 3
        }
  • NTPGroupKeyNotSupported
"NTPGroupKeyNotSupported": {
            "Description": "Indicates that an error occuerd during the NTP group key upload process.",
            "Message": "Failed to upload the NTP group key because it is not support.",
            "Severity": "Warning",
            "NumberOfArgs": 0,
            "Resolution": "Make sure that the group key is supported by the NTP.",
            "HttpStatusCode": 400,
            "IpmiCompletionCode": "0xFF",
            "SnmpStatusCode": 3
        }
  • UploadNTPSecureGroupKeyFailed
"UploadNTPSecureGroupKeyFailed": {
            "Description": "Indicates that an error occuerd during the NTP group key upload process.",
            "Message": "Failed to upload the NTP group key.",
            "Severity": "Warning",
            "NumberOfArgs": 0,
            "Resolution": "Make sure that the content or URI of the NTP group in the request body is valid.",
            "HttpStatusCode": 400,
            "IpmiCompletionCode": "0xFF",
            "SnmpStatusCode": 3
        }

评审结论

通过,具体结论如下:

  • 同意新增 NtpService 资源下的 Actions 属性
  • 同意新增 NtpService 资源下的 ImportNtpKeyActionInfo 资源
  • 同意新增 NtpService 资源下的 ImportNtpKey 请求
  • 同意新增 NtpService 资源 Actions 操作错误引擎

材料的格式再调整一下,请求和响应以及URI采用代码的方式包裹起来

  • UploadNTPGroupKeyTooLarge
  • UploadNTPGroupKeyNotSupport
  • UploadNTPGroupKeyFailed
    上述这三个 error 的 HTTPStatusCode 是400

【评审意见】确认 Name 的正确性
确认结论:修复为 Import Ntp Key Action Info