[TOC]
1 配置说明
1.1 背景介绍
自北向接口开发切换为映射器实现后,映射器json配置代码没有DT用例。这导致:
- 映射器代码开发/修改过程中,只能通过出包上板调试,无法本地调试,提前拦截问题,效率低下;
- 映射器开发强依赖后台资源树,后台资源树开发后才能够对映射器代码进行有效调试,无法实现接口与后台并行开发,难以对映射器代码独立验证;
- 映射器后台机制变化后,无法有效感知变化并及时拦截机制变化而导致的问题。
由于当前映射器配置采用json文件格式描述,为保持统一、提高编码DT效率,DT也采用json格式,设计出基于json配置的北向接口DT技术。
映射器配置接口的执行需要资源树数据作为输入或资源树方法作为操作方法,映射器配置作为数据处理流程,且一个属性的变动可能影响多个资源树属性。为了减少对环境的依赖,我们设计了
mocks: 提供资源树数据和资源树方法。通过json配置进行资源树属性、方法打桩,包括打桩资源树属性、方法、资源树变化、资源树属性变化;invokes: 提供属性变动引起的其它资源树变动条件。通过json配置模拟资源树属性变化作为属性变动预置条件,包括属性变化后,所产生的连带资源树变化,由invokes调用mocks中定义的资源树变化、资源树属性变化;cases: 描述DT用例。通过json配置进行DT用例输入以及结果比较,包括输入、输出、预期结果等,由cases调用mocks与invokes中定义的资源树桩和变化。
1.2 通用格式
DT配置的通用格式:
{
"mocks": {
"xxxx": {
"path": "xxxx",
"interface": "xxxx",
"properties": {xxxx},
"methods": {
"xxxx": {
"mocks": [xxxx],
"rsp": {xxxx}
}
}
}
},
"invokes": {
"xxxx": {
"path": "xxxx",
"interface": "xxxx",
"properties": {xxxx}
}
},
"cases": [
{
"name": "xxxx",
"input": {
"uri": "xxxx",
"method": "GET/PATCH/POST/DELETE",
"reqBody": {xxxx}
},
"mocks": [xxxx],
"invokes": [xxxx],
"output": {
"assert": "Equal/NotEqual",
"expect": {xxxx}
},
"Cleanup": "All/This/Skip"
}
]
}
1.3 运行方式
DT配置文件配置于rackmount仓,四个北向接口(redfish/web_backend/cli/snmp)分别放置于test/unit/cases文件夹下的对应北向接口文件夹下,其下的目录结构不做强制要求,推荐与interface_config/xxxx/mapping_config目录结构一致,如映射器配置在interface_config/redfish/mapping_config/AccountService/Accounts/Accounts.json,对应DT配置目录为test/unit/cases/redfish/mapping_config/AccountService/Accounts/Accounts.json,二者目录结构保持一致。
新增DT用例后,直接在rackmount仓执行bingo test即可运行全部DT用例。
执行失败
执行失败用例会打印出实际响应体、预期响应体、失败用例位置信息等用于开发者定位。
2 mocks: 预置资源树
定义资源树打桩配置(打桩资源树属性、方法、资源树变化、资源树属性变化)。
注:mock中仅为定义,如需使用,需要在invokes和cases中调用
2.1 总体结构
{
"mocks": {
"xxxx": {
"path": "xxxx",
"interface": "xxxx",
"properties": {xxxx},
"methods": {
"xxxx": {
"mocks": [xxxx],
"rsp": {xxxx}
}
}
}
}
}
2.2 关键字
| 名称 | 含义 | 是否必须配置 | 类型 | 取值范围 |
|---|---|---|---|---|
| path | 打桩的资源树路径 | 是 | 字符串 | - |
| interface | 打桩的资源树接口 | 否 | 字符串 | - |
| properties | 打桩的资源树属性 | 否 | 字典 | - |
| methods | 打桩的资源树方法 | 否 | 字典 | - |
| mocks | 调用资源树桩方法时所涉及的资源树属性变化 | 否 | 数组 | 必须引用资源树mocks中定义的其他项 |
| rsp | 调用资源树桩方法时的返回值 | 否 | 字典 | - |
| operation | 对资源树桩的操作 | 否 | 字符串 | 枚举值:Update/Delete(默认为Update) |
2.3 样例
"mocks": {
"MockTest_1": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropA": 1,
"PropB": "BB"
},
"methods": {
"SetA": {
"mocks": ["MockSetA_1"],
"rsp": {
"answer": true
}
}
}
},
"MockSetA_1": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropA": 2
}
},
"MockSetA_2": {
"path": "/bmc/kepler/test",
"operation": "Delete"
}
}
说明
MockTest_1: 定义打桩资源树路径、接口、属性、方法:
路径为/bmc/kepler/test,接口为bmc.kepler.test的资源树,其上面挂载两个属性,分别为PropA(值为整型1),PropB(值为字符串BB),若属性没有,则新增;若已经存在,则修改。挂载一个方法为SetA,调用该方法所导致的资源树变化为MockSetA_1,返回值为"answer": true
执行MockTest_1后的资源树桩为:
└─/bmc
└─/bmc/kepler
└─/bmc/kepler/test
/bmc/kepler/test bmc.kepler.test
.PropA
value: 1
.PropB
value: "BB"
rpc.SetA
rsp: true
MockSetA_1为定义打桩资源树属性变化:
打桩路径为/bmc/kepler/test,接口为bmc.kepler.test1的资源树,所产生的资源树变化为PropA变为2
执行MockSetA_1后的资源树桩为:
└─/bmc
└─/bmc/kepler
└─/bmc/kepler/test
/bmc/kepler/test bmc.kepler.test
.PropA
value: 2
.PropB
value: "BB"
rpc.SetA
rsp: true
MockSetA_2为定义打桩资源树路径变化:
打桩路径为/bmc/kepler/test的资源树,变化为该资源树路径下树
执行MockSetA_2后的资源树桩为:
└─/bmc
└─/bmc/kepler
3 invokes: 预置条件
描述属性后产生的连带资源树变化(若没有,可以省略,如GET方法)。
注:invokes中使用的资源树变化必须调用mocks中定义的变化
3.1 总体结构
{
"invokes": {
"xxxx": {
"path": "xxxx",
"interface": "xxxx",
"properties": {xxxx}
}
}
}
3.2 关键字
| 名称 | 含义 | 是否必须配置 | 类型 | 取值范围 |
|---|---|---|---|---|
| path | 打桩的资源树路径 | 是 | 字符串 | - |
| interface | 打桩的资源树接口 | 是 | 字符串 | - |
| properties | 打桩的资源树属性 | 是 | 字典 | - |
3.3 样例
"mocks": {
"MockSetA_1": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropB": 2
}
},
"MockSetA_2": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test1",
"properties": {
"PropAA": false
}
}
},
"invokes": {
"SetTest_1" : {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropA": [
"MockSetA_1",
"MockSetA_2"
]
}
}
}
说明
SetTest_1:
表示路径为/bmc/kepler/test,接口为bmc.kepler.test的资源树上的PropA变化时,会导致MockSetA_1的变化以及MockSetA_2的变化。
PropA变化后(假设从1变为0),会导致资源树变为
└─/bmc
└─/bmc/kepler
└─/bmc/kepler/test
/bmc/kepler/test bmc.kepler.test
.PropA
value: 0
.PropB
value: 2
/bmc/kepler/test bmc.kepler.test1
.PropAA
value: false
4 cases: 描述DT用例
引用mocks和invokes中定义的资源树打桩,描述北向接口DT用例。
4.1 总体结构
{
"cases": [
{
"name": "xxxx",
"input": {
"uri": "xxxx",
"method": "GET/PATCH/POST/DELETE",
"reqBody": {xxxx}
},
"mocks": [xxxx],
"invokes": [xxxx],
"output": {
"assert": "Equal/NotEqual",
"expect": {xxxx}
},
"Cleanup": "All/This/Skip"
}
]
}
4.2 关键字
| 名称 | 含义 | 是否必须配置 | 类型 | 取值范围 |
|---|---|---|---|---|
| name | DT用例名称 | 是 | 字符串 | - |
| input | 用例输入 | 是 | 字典 | 必须包含uri和method,reqBody可省略 |
| uri | 北向接口uri | 是 | 字符串 | 必须与映射器配置文件中配置的uri相同 |
| method | 接口方法 | 是 | 字符串 | 枚举值:GET/PATCH/POST/DELETE |
| reqBody | 请求体 | 否 | 字典 | - |
| mocks | 执行用例前设置桩 | 否 | 数组 | 必须调用mocks中定义的配置项 |
| invokes | 设置属性的变化 | 否 | 数组 | 必须调用invokes中声明的配置项 |
| output | 用例输出 | 是 | 字典 | 必须包含expect,assert可省略 |
| assert | 是否相等 | 否 | 字符串 | 枚举值:Equal/NotEqual(默认为Equal) |
| expect | 预期返回体 | 是 | 字典 | - |
| cleanup | 执行完该用例后资源树桩的清理动作 | 否 | 字符串 | 枚举值:All/This/Skip(默认为Skip) |
4.2.1 name
DT用例名称
4.2.2 input
用例输入
1)uri:北向接口uri(必须与映射器中配置的uri相同)
2)method:接口方法(GET/PATCH/POST/DELETE)
3)reqBody:请求体(没有可省略)
4.2.3 mocks
设置桩(必须调用mocks中定义的配置项,对资源树打桩,可调用多个配置项)
4.2.4 invokes
设置属性的变化(必须调用invokes中声明的配置项,打桩资源树的变化,可调用多个配置项)
4.2.5 output
用例输出(与预期返回体进行比较,判断是否相等/不等)
1)assert:判断是否相等,如果配置为Equal,则与预期返回体相等是符合预期的;如果配置为NotEqual,则与预期返回体不相等是符合预期的(Equal/NotEqual,默认为Equal)
2)expect:预期返回体(即在映射器json配置中的RspBody,不支持无RspBody的场景)
4.2.6 cleanup
执行完该用例后资源树桩的清理动作:
- 不清理资源树桩:
Skip - 仅清理该用例的资源树桩:
This - 清空所有资源树桩:
All
默认为Skip.
4.3 样例
"mocks": {
"MockTest_1": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropA": 1,
"PropB": 1
}
},
"MockSetA_1": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropB": 2
}
},
"MockSetA_2": {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test1",
"properties": {
"PropAA": false
}
}
},
"invokes": {
"SetTest_1" : {
"path": "/bmc/kepler/test",
"interface": "bmc.kepler.test",
"properties": {
"PropA": [
"MockSetA_1",
"MockSetA_2"
]
},
}
},
"cases": [
{
"name": "Case1",
"input": {
"uri": "/redfish/v1/Managers/1/test",
"method": "PATCH",
"reqBody": {
"A": 2
}
},
"mocks": [
"MockTest_1"
],
"invokes": [
"SetTest_1"
],
"output": [
{
"assert": "Equal",
"result": {
"A": 2,
"B": 2,
"AA": false
}
}
],
"cleanup": "Skip"
}
]
说明
Case1表明调用uri/redfish/v1/Managers/1/test的PATCH方法时,先调用MockTest_1对资源树进行打桩,请求体中的A更改为2,假设请求体中A的变化映射为资源树上PropA的变化,那么该变化导致的资源树变化为SetTest_1,该变化会使资源树上的PropB变为2,使资源树上新增PropAA属性
执行前资源树桩为:
└─/bmc
└─/bmc/kepler
└─/bmc/kepler/test
/bmc/kepler/test bmc.kepler.test
.PropA
value: 1
.PropB
value: 1
执行后资源树桩为:
└─/bmc
└─/bmc/kepler
└─/bmc/kepler/test
/bmc/kepler/test bmc.kepler.test
.PropA
value: 2
.PropB
value: 2
/bmc/kepler/test bmc.kepler.test1
.PropAA
value: false
最后在输出中与预期返回体进行比较。
5 样例
5.1 GET
{
"mocks": {
"Managers_LogServices_OperateLog": {
"path": "/bmc/kepler/Managers/1/LogServices/OperateLog",
"interface": "bmc.kepler.Managers.LogService",
"properties": {
"Name": "OperateLog",
"OverWritePolicy": "OperateLogWrapsWhenFull",
"ServiceEnabled": true
},
"methods": {
"GetItems": {
"rsp": {
"Count": 50,
"Log": [
{
"Params": [
{"Key": "ID", "Value": 1},
{"Key": "Time", "Value": "2024-07-04 08:28:29"},
{"Key": "Interface", "Value": "IPMI"},
{"Key": "UserName", "Value": "Administrator"},
{"Key": "IPAddress", "Value": "75.255.241.125"},
{"Key": "Host", "Value": "oms"},
{"Key": "Content", "Value": "Recover manufacturer default configuration successfully"}
]
}
]
}
}
}
},
"Managers_LogServices_RunLog": {
"path": "/bmc/kepler/Managers/1/LogServices/RunLog",
"interface": "bmc.kepler.Managers.LogService",
"properties": {
"Name": "RunLog",
"OverWritePolicy": "RunLogWrapsWhenFull",
"ServiceEnabled": false
},
"methods": {
"GetItems": {
"rsp": {"Count": 100}
}
}
},
"Managers_LogServices_SecurityLog": {
"path": "/bmc/kepler/Managers/1/LogServices/SecurityLog",
"interface": "bmc.kepler.Managers.LogService",
"properties": {
"Name": "SecurityLog",
"OverWritePolicy": "SecurityLogWrapsWhenFull",
"ServiceEnabled": true
},
"methods": {
"GetItems": {
"rsp": {"Count": 150}
}
}
},
"Managers_Time_1": {
"path": "/bmc/kepler/Managers/Time",
"interface": "bmc.kepler.Managers.Time",
"properties": {
"DateTime": "2024-07-11T07:12:42+00:00",
"DateTimeLocalOffset": "+00:00"
}
}
},
"cases": [
{
"name": "LogServices_Case1",
"input": {
"uri": "/redfish/v1/Managers/1/LogServices",
"method": "GET"
},
"mocks": [
"Managers_LogServices_OperateLog",
"Managers_LogServices_RunLog",
"Managers_LogServices_SecurityLog"
],
"output": {
"assert": "Equal",
"expect": {
"@odata.context": "/redfish/v1/$metadata#LogServiceCollection.LogServiceCollection",
"@odata.id": "/redfish/v1/Managers/1/LogServices",
"@odata.type": "#LogServiceCollection.LogServiceCollection",
"Name": "LogService Collection",
"Members@odata.count": 3,
"Members": [
{
"@odata.id": "/redfish/v1/Managers/1/LogServices/OperateLog"
},
{
"@odata.id": "/redfish/v1/Managers/1/LogServices/RunLog"
},
{
"@odata.id": "/redfish/v1/Managers/1/LogServices/SecurityLog"
}
]
}
},
"cleanup": "Skip"
},
{
"name": "LogServices_Case2",
"input": {
"uri": "/redfish/v1/Managers/1/LogServices/OperateLog",
"method": "GET"
},
"mocks": [
"Managers_Time_1"
],
"output": {
"assert": "Equal",
"expect": {
"@odata.context": "/redfish/v1/$metadata#LogService.LogService",
"@odata.id": "/redfish/v1/Managers/1/LogServices/OperateLog",
"@odata.type": "#LogService.v1_0_3.LogService",
"Id": "OperateLog",
"Name": "OperateLog",
"MaxNumberOfRecords": 50,
"OverWritePolicy": "OperateLogWrapsWhenFull",
"DateTime": "2024-07-11T07:12:42+00:00",
"DateTimeLocalOffset": "+00:00",
"ServiceEnabled": true,
"Actions": {
"Oem": {
"Huawei": {
"#LogService.ExportLog": {
"target": "/redfish/v1/Managers/1/LogServices/OperateLog/Actions/Oem/Huawei/LogService.ExportLog",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/LogServices/OperateLog/ExportLogActionInfo"
}
}
}
},
"Entries": {
"@odata.id": "/redfish/v1/Managers/1/LogServices/OperateLog/Entries"
}
}
},
"cleanup": "This"
},
{
"name": "LogServices_Case3",
"input": {
"uri": "/redfish/v1/Managers/1/LogServices/OperateLog/Entries/3",
"method": "GET"
},
"output": {
"assert": "Equal",
"expect": {
"@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
"@odata.id": "/redfish/v1/Managers/1/LogServices/OperateLog/Entries/3",
"@odata.type": "#LogEntry.v1_1_1.LogEntry",
"Id": 3,
"Name": "Operate Log",
"EntryType": "Oem",
"Created": "2024-07-04 08:28:29",
"Message": "Recover manufacturer default configuration successfully",
"Oem": {
"Huawei": {
"Interface": "IPMI",
"User": "Administrator",
"Address": "75.255.241.125"
}
}
}
},
"cleanup": "Skip"
}
]
}
5.2 PATCH
{
"mocks": {
"Managers_Syslog_1": {
"path": "/bmc/kepler/Managers/1/Syslog",
"interface": "bmc.kepler.Managers.Syslog",
"properties": {
"ServerIdentitySource": "BoardSN",
"Enabled": true,
"LowestSeverity": "Normal",
"MessageFormat": "Custom",
"Protocol": "TLS",
"AuthenticateMode": "OneWay"
}
},
"Managers_Syslog_Servers_1": {
"path": "/bmc/kepler/Managers/1/Syslog/Servers/1",
"interface": "bmc.kepler.Managers.Syslog.Server",
"properties": {
"Address": "www.server.rsyslog.com",
"Enabled": true,
"LogType": ["OperationLog", "SecurityLog", "EventLog"],
"MemberId": 1,
"Port": 11514
}
},
"Managers_Syslog_Servers_2": {
"path": "/bmc/kepler/Managers/1/Syslog/Servers/2",
"interface": "bmc.kepler.Managers.Syslog.Server",
"properties": {
"Address": "76.76.18.86",
"Enabled": true,
"LogType": ["OperationLog", "SecurityLog", "EventLog"],
"MemberId": 2,
"Port": 11515
}
},
"Managers_Syslog_Servers_3": {
"path": "/bmc/kepler/Managers/1/Syslog/Servers/3",
"interface": "bmc.kepler.Managers.Syslog.Server",
"properties": {
"Address": "76.76.18.86",
"Enabled": true,
"LogType": ["OperationLog", "SecurityLog", "EventLog"],
"MemberId": 3,
"Port": 11516
}
},
"Managers_Syslog_Servers_4": {
"path": "/bmc/kepler/Managers/1/Syslog/Servers/4",
"interface": "bmc.kepler.Managers.Syslog.Server",
"properties": {
"Address": "76.76.18.88",
"Enabled": true,
"LogType": ["OperationLog", "SecurityLog", "EventLog"],
"MemberId": 4,
"Port": 11515
}
},
"CertificateService_1": {
"path": "/bmc/kepler/CertificateService",
"interface": "bmc.kepler.CertificateService",
"properties": {
"CRLEnabled": false
},
"methods": {
"GetCertChainInfo": {
"rsp": {
"CertInfo": "{\"ServerCert\":{\"KeyLength\":2048,\"Fingerprint\":\"93d311ad3c70d2c40e2d217a2bc6976618c02451d8e3e9bb92b723133d4096d3\",\"Subject\":\"CN=syslog.huawei, OU=IT, O=Huawei, L=ShenZhen, S=GuangDong, C=CN\",\"SerialNumber\":\"5d 0d 77 df a1 ae 85 d1\",\"SignatureAlgorithm\":\"sha256WithRSAEncryption\",\"ValidNotBefore\":\"Jul 01 2024 UTC\",\"ValidNotAfter\":\"Jul 01 2034 UTC\",\"KeyUsage\":\"CRLSigning, KeyCertSign\",\"Issuer\":\"CN=syslog.huawei, OU=IT, O=Huawei, L=ShenZhen, S=GuangDong, C=CN\",\"FingerprintHashAlgorithm\":\"SHA256\"}}"
}
}
}
},
"Certificates_1": {
"path": "/bmc/kepler/Managers/1/Certificates/1",
"interface": "bmc.kepler.CertificateService.Certificate"
},
"Certificates_2": {
"path": "/bmc/kepler/Managers/1/Certificates/2",
"interface": "bmc.kepler.CertificateService.Certificate"
},
"Managers_Syslog_2": {
"path": "/bmc/kepler/Managers/1/Syslog",
"interface": "bmc.kepler.Managers.Syslog",
"properties": {
"ServerIdentitySource": "HostName"
}
}
},
"invokes": {
"Managers_Syslog_MessageFormat": {
"path": "/bmc/kepler/Managers/1/Syslog",
"interface": "bmc.kepler.Managers.Syslog",
"properties": {
"MessageFormat": [
"Managers_Syslog_2"
]
}
}
},
"cases": [
{
"name": "SyslogService_Case1",
"input": {
"uri": "/redfish/v1/Managers/1/SyslogService",
"method": "PATCH",
"reqBody": {
"MessageFormat": "RFC3164",
"ServiceEnabled": false
}
},
"mocks": [
"Managers_Syslog_1",
"Managers_Syslog_Servers_1",
"Managers_Syslog_Servers_2",
"Managers_Syslog_Servers_3",
"Managers_Syslog_Servers_4",
"CertificateService_1",
"Certificates_1",
"Certificates_2"
],
"invokes": [
"Managers_Syslog_MessageFormat"
],
"output": {
"expect": {
"@odata.context": "/redfish/v1/$metadata#HwSyslogService.HwSyslogService",
"@odata.id": "/redfish/v1/Managers/1/SyslogService",
"@odata.type": "#HwSyslogService.v1_0_0.HwSyslogService",
"Id": "SyslogService",
"Name": "Syslog Service",
"ServiceEnabled": false,
"MessageFormat": "RFC3164",
"ServerIdentitySource": "HostName",
"AlarmSeverity": "Normal",
"TransmissionProtocol": "TLS",
"AuthenticateMode": "OneWay",
"CrlValidFrom": null,
"CrlValidTo": null,
"CrlVerificationEnabled": false,
"RootCertificate": {
"Issuer": "CN=, OU=HuaweiIT, O=, L=, S=, C=CN",
"Subject": "CN=, OU=HuaweiIT, O=, L=, S=, C=CN",
"ValidNotBefore": "Feb 07 1999 UTC",
"ValidNotAfter": "Feb 01 2050 UTC",
"SerialNumber": "79 8a ea 65 cb 60 39 be",
"SignatureAlgorithm": "SHA256",
"KeyUsage": "",
"PublicKeyLengthBits": 2048
},
"ClientCertificate": {
"Issuer": "CN=, OU=HuaweiIT, O=, L=, S=, C=CN",
"Subject": "CN=, OU=HuaweiIT, O=, L=, S=, C=CN",
"ValidNotBefore": "Feb 07 1999 UTC",
"ValidNotAfter": "Feb 01 2050 UTC",
"SerialNumber": "79 8a ea 65 cb 60 39 be",
"SignatureAlgorithm": "SHA256",
"KeyUsage": "",
"PublicKeyLengthBits": 2048
},
"SyslogServers": [
{
"MemberId": "0",
"Enabled": true,
"Address": "www.server.rsyslog.com",
"Port": 11514,
"LogType": ["OperationLog", "SecurityLog", "EventLog"]
},
{
"MemberId": "1",
"Enabled": true,
"Address": "76.76.18.86",
"Port": 11515,
"LogType": ["OperationLog", "SecurityLog", "EventLog"]
},
{
"MemberId": "2",
"Enabled": true,
"Address": "76.76.18.86",
"Port": 11516,
"LogType": ["OperationLog", "SecurityLog", "EventLog"]
},
{
"MemberId": "3",
"Enabled": true,
"Address": "76.76.18.88",
"Port": 11515,
"LogType": ["OperationLog", "SecurityLog", "EventLog"]
}
],
"Actions": {
"#SyslogService.ImportRootCertificate": {
"target": "/redfish/v1/Managers/1/SyslogService/Actions/SyslogService.ImportRootCertificate",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SyslogService/ImportRootCertificateActionInfo"
},
"#SyslogService.ImportClientCertificate": {
"target": "/redfish/v1/Managers/1/SyslogService/Actions/SyslogService.ImportClientCertificate",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SyslogService/ImportClientCertificateActionInfo"
},
"#SyslogService.SubmitTestEvent": {
"target": "/redfish/v1/Managers/1/SyslogService/Actions/SyslogService.SubmitTestEvent",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SyslogService/SubmitTestEventActionInfo"
},
"#SyslogService.ImportCrl": {
"target": "/redfish/v1/Managers/1/SyslogService/Actions/SyslogService.ImportCrl",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SyslogService/ImportCrlActionInfo"
},
"#SyslogService.DeleteCrl": {
"target": "/redfish/v1/Managers/1/SyslogService/Actions/SyslogService.DeleteCrl",
"@Redfish.ActionInfo": "/redfish/v1/Managers/1/SyslogService/DeleteCrlActionInfo"
}
}
}
},
"cleanup": "Skip"
}
]
}
5.3 POST
{
"mocks" : {
"AccountService_Accounts" : {
"path" : "/bmc/kepler/AccountService/Accounts",
"interface" : "bmc.kepler.AccountService.ManagerAccounts",
"methods": {
"New": {
"mocks": ["AccountService_Accounts_17_1", "AccountService_Accounts_17_2", "AccountService"],
"rsp": {
"AccountId": 17
}
}
}
},
"AccountService_Accounts_17_1" : {
"path" : "/bmc/kepler/AccountService/Accounts/17",
"interface" : "bmc.kepler.AccountService.ManagerAccount",
"properties": {
"Id": 17,
"UserName": "test",
"RoleId": 3,
"Locked": false,
"Enabled": true,
"Deletable": true,
"FirstLoginPolicy": 2,
"LoginInterface": ["IPMI", "SSH", "SNMP", "Local", "Redfish", "SFTP", "Web"],
"PasswordExpiration": 4294967295,
"SshPublicKeyHash": "",
"PasswordChangeRequired": true,
"LoginRuleIds": []
}
},
"AccountService_Accounts_17_2" : {
"path" : "/bmc/kepler/AccountService/Accounts/17",
"interface" : "bmc.kepler.AccountService.ManagerAccount.SnmpUser",
"properties": {
"AuthenticationProtocol": 4,
"EncryptionProtocol": 2,
"SnmpEncryptionPasswordInitialStatus": false
}
},
"AccountService" : {
"path" : "/bmc/kepler/AccountService",
"interface" : "bmc.kepler.AccountService",
"properties": {
"EmergencyLoginAccountId": 0,
"SNMPv3TrapAccountLimitPolicy": 1,
"SNMPv3TrapAccountId": 3
}
}
},
"cases" : [
{
"name" : "Accounts_Case1",
"input" : {
"uri" : "/redfish/v1/AccountService/Accounts",
"method" : "POST",
"reqBody": {
"Id": "17",
"UserName": "test",
"Password": "xxx",
"RoleId": "Operator"
}
},
"mocks" : [
"AccountService_Accounts"
],
"output" : {
"expect" : {
"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
"@odata.id": "/redfish/v1/AccountService/Accounts/17",
"@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
"Id": "17",
"Name": "User Account",
"Password": null,
"UserName": "test",
"RoleId": "Operator",
"ReauthKey": "null",
"Locked": false,
"Enabled": true,
"Oem": {
"Huawei": {
"AccountInsecurePromptEnabled": true,
"FirstLoginPolicy": "ForcePasswordReset",
"MutualAuthClientCert": null,
"SSHPublicKeyHash": null,
"LoginInterface": [
"IPMI",
"SSH",
"SNMP",
"Local",
"Redfish",
"SFTP",
"Web"
],
"SnmpV3AuthProtocol": "SHA256",
"SnmpV3PrivProtocol": "AES",
"SnmpV3PrivPasswd": null,
"SNMPEncryptPwdInit": false,
"Deleteable": true,
"DelDisableReason": null,
"LoginRule": [],
"PasswordValidityDays": null,
"Actions": {
"#Account.ImportMutualAuthClientCert": {
"target": "/redfish/v1/AccountService/Accounts/17/Oem/Huawei/Actions/Account.ImportMutualAuthClientCert",
"@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/17/ImportMutualAuthClientCertActionInfo"
},
"#Account.DeleteMutualAuthClientCert": {
"target": "/redfish/v1/AccountService/Accounts/17/Oem/Huawei/Actions/Account.DeleteMutualAuthClientCert",
"@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/17/DeleteMutualAuthClientCertActionInfo"
},
"#Account.ImportSSHPublicKey": {
"target": "/redfish/v1/AccountService/Accounts/17/Oem/Huawei/Actions/Account.ImportSSHPublicKey",
"@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/17/ImportSSHPublicKeyActionInfo"
},
"#Account.DeleteSSHPublicKey": {
"target": "/redfish/v1/AccountService/Accounts/17/Oem/Huawei/Actions/Account.DeleteSSHPublicKey",
"@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/17/DeleteSSHPublicKeyActionInfo"
}
}
}
},
"Links": {
"Role": {
"@odata.id": "/redfish/v1/AccountService/Roles/Operator"
}
}
}
},
"Cleanup" : "Skip"
}
]
}