Resource Management Related APIs Design
Background ¶
This doc is to provide how to use below APIs for test automation support.
- Provide some APIs which can provide creation, update, list and deletion functions for test case and test account at central api.
- Provide some APIs which can request and release machines at resource management.
- Provide one API which can response case yaml body by using case name at worker agent.
API Details ¶
Central API - Test Account ¶
POST /mpi/test-account/site ¶
Description ¶
This API will provide to add and update for test account. The testApp, testAccount, and testPassword are required. If you want to create new record, please don't provide id.
Body ¶
{
"testApp": "meeting",
"testSiteUrl": "mct-ci-testing.webex.com",
"testAccount": "mctuser14@yopmail.net",
"testPassword": "xxx",
"boundMachineIp": "10.224.251.200"
}
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "10.140.212.59" }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "172.16.3.18", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "E00001", "localIp": "172.16.3.18", "errorMessage": "There are existing test cases.", "result": null }
GET /mpi/test-account/site ¶
Description ¶
This API will list all test accounts.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18", "result": [ { "id": 1, "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser15@yopmail.net", "testPassword": "xxx", "boundMachineIp": "10.224.251.200", "status": 0, "createdTime": 1729909779372, "lastModifiedTime": null }, { "id": 2, "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser14@yopmail.net", "testPassword": "xxx", "boundMachineIp": "10.224.251.200", "status": 0, "createdTime": 1729909797212, "lastModifiedTime": null } ] }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource test-account/site1." }
GET /mpi/test-account/site/{siteUrl} ¶
Description ¶
This API will list all test accounts for one site url.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18", "result": [ { "id": 1, "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser15@yopmail.net", "testPassword": "xxx", "boundMachineIp": "10.224.251.200", "status": 0, "createdTime": 1729909779372, "lastModifiedTime": null }, { "id": 2, "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser14@yopmail.net", "testPassword": "xxx", "boundMachineIp": "10.224.251.200", "status": 0, "createdTime": 1729909797212, "lastModifiedTime": null } ] }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource test-account/site1." }
DELETE /mpi/test-account/site/{id} ¶
Description ¶
This API will provide to delete one site.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: Record does not exist." }
Central API - Test Case ¶
POST /mpi/test-case ¶
Description ¶
This API will provide to add and update for test case. The caseVersion, caseName, and CaseYamlBody are required. If you want to create new record, please don't provide id.
Body ¶
{
"caseVersion": "0.1.1.2",
"caseName": "test12",
"caseYamlBody": "abca1111ssss22222"
}
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "10.140.212.59" }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "172.16.3.18", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource test-case1." }
GET /mpi/test-case ¶
Description ¶
This API will list all test cases.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18", "result": [ { "id": 1, "caseVersion": "0.1", "caseName": "test12", "caseYamlBody": "abca1111ssss2", "createdTime": 1729910073085, "lastModifiedTime": null }, { "id": 3, "caseVersion": "0.1.1", "caseName": "test12", "caseYamlBody": "abca1111ssss2", "createdTime": 1729910078302, "lastModifiedTime": null } ] }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource test-case1." }
GET /mpi/test-case/test12 ¶
Description ¶
This API will list all test cases for one case name.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18", "result": [ { "id": 1, "caseVersion": "0.1", "caseName": "test12", "caseYamlBody": "abca1111ssss2", "createdTime": 1729910073085, "lastModifiedTime": null }, { "id": 3, "caseVersion": "0.1.1", "caseName": "test12", "caseYamlBody": "abca1111ssss2", "createdTime": 1729910078302, "lastModifiedTime": null } ] }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource test-case1." }
DELETE /mpi/test-case/{id} ¶
Description ¶
This API will provide to delete one test case.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: Record does not exist." }
Resource Management API ¶
POST /management/resource/win/register ¶
Description ¶
This API will provide to register machine. The ip, hostname, username and port are required.
Body ¶
{
"ip": "10.224.251.200",
"hostname": "mctuser02.webex.com",
"username": "Administrator",
"testApp": "outlook",
"port": 4720,
"osBit": "64"
}
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null, "result": [ { "hostname": "mctuser02.webex.com", "ip": "10.224.251.200", "username": "Administrator", "testApp": "outlook", "port": 4720, "workStatus": "Offline", "lastUpdateTime": "2024-10-26 14:16:54", "assignTime": null, "releaseTime": "2024-10-22 20:22:33", "connectionTime": null, "os": null, "osType": null, "osVersion": null, "osBit": "64", "lab": null, "uuid": null, "meetingTestAccount": null } ] }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "192.168.3.8", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "192.168.3.8", "errorMessage": "Platform internal error: No static resource resource/win/register1." }
PUT /management/resource/win/alive ¶
Description ¶
This API will provide to keep heartbeat between plugin and machine. The ip, username and uuid are required.
Body ¶
{
"ip": "10.224.251.200",
"username": "Administrator",
"uuid": "637aa15f-eeee-4704-be16-31bd61974c5c4"
}
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "192.168.3.8", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "192.168.3.8", "errorMessage": "Platform internal error: No static resource resource/win/alive." }
POST /management/resource/win/offline ¶
Description ¶
This API will provide to force offline machine. The ip, username and uuid are required.
Body ¶
{
"ip": "10.224.251.200",
"username": "Administrator",
"uuid": "637aa15f-eeee-4704-be16-31bd61974c5c4"
}
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "192.168.3.8", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "192.168.3.8", "errorMessage": "Platform internal error: No static resource resource/win/alive." }
GET /management/resource/win ¶
Description ¶
This API will list all machines.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null, "result": [ { "hostname": "mctuser02.webex.com", "ip": "10.224.251.200", "username": "winadmin", "port": 4720, "workStatus": "Offline", "lastUpdateTime": "2024-10-22 20:19:06", "assignTime": null, "releaseTime": "2024-10-22 20:22:32", "connectionTime": null, "os": null, "osType": null, "osVersion": null, "osBit": "64", "lab": null, "uuid": null, "meetingTestAccount": null }, { "hostname": "mctuser02.webex.com", "ip": "10.224.251.200", "username": "Administrator", "port": 4720, "workStatus": "Available", "lastUpdateTime": "2024-10-27 13:27:42", "assignTime": null, "releaseTime": "2024-10-22 20:22:33", "connectionTime": null, "os": null, "osType": null, "osVersion": null, "osBit": "64", "lab": null, "uuid": null, "meetingTestAccount": null } ] }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error: No static resource resource/win1." }
PUT /management/resource/win/release ¶
Description ¶
This API will provide to release machines. The ip, username, and uuid are required.
Body ¶
[
{
"ip": "10.224.251.200",
"username": "winadmin",
"uuid": "9763a28a-258f-4714-bf09-7563ee3e312b"
},
{
"ip": "10.224.251.200",
"username": "Administrator",
"uuid": "e815e2ac-8e06-4068-aa2e-0aca3c2ce617"
}
]
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null, "result": [ { "ip": "10.224.251.200", "port": 4720, "username": "winadmin", "uuid": "37f832c2-44ac-4626-af2d-e3998e8adad1", "meetingTestAccount": { "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser14@yopmail.net", "testPassword": "<[[7IACu9rYZ71gxHVpQtCwSECFDt3YNu0YsfqsrdmEwukPz1JUzEQBq3B5myyu6QW4]]>" } }, { "ip": "10.224.251.200", "port": 4720, "username": "Administrator", "uuid": "0043ea07-918f-470e-a338-7ae3128bb1d0", "meetingTestAccount": { "testApp": "meeting", "testSiteUrl": "mct-ci-testing.webex.com", "testAccount": "mctuser15@yopmail.net", "testPassword": "<[[7IACu9rYZ71gxHVpQtCwSECFDt3YNu0YsfqsrdmEwukPz1JUzEQBq3B5myyu6QW4]]>" } } ] }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "192.168.3.8", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "192.168.3.8", "errorMessage": "Platform internal error: No static resource resource/win/release1." }
GET /management/resource/win/request/2?testApp=meeting ¶
Description ¶
This API will provide to request machines. We need to provide the requested number and testApp.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.8", "errorMessage": null, "result": [ { "ip": "10.224.251.200", "port": 4720, "username": "winadmin", "uuid": "37f832c2-44ac-4626-af2d-e3998e8adad1" }, { "ip": "10.224.251.200", "port": 4720, "username": "Administrator", "uuid": "0043ea07-918f-470e-a338-7ae3128bb1d0" } ] }
-
500 Server Internal Error
{ "errorCode": "B00001", "localIp": "192.168.3.8", "errorMessage": "Don't have enough available machines.", "result": null }
PUT /management/resource/test-account/release ¶
Description ¶
This API will provide to release test accounts. The testApp, testSiteUrl, and testAccount are required. The uuid is not required if there is not related machine.
Body ¶
[
{
"testApp": "meeting",
"testSiteUrl": "mcttest-j-a.webex.com",
"testAccount": "mcttest-j-a-030@wbxlab.us",
"uuid": "ecaa2195-577c-4636-bae8-76d125fece05"
}
]
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.209", "errorMessage": null, "result": null }
-
400 Bad Request
{ "errorCode": "E00001", "localIp": "192.168.3.8", "errorMessage": "Error validating payload, detail: must not be empty" }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "192.168.3.8", "errorMessage": "Platform internal error: No static resource resource/test-account/release1." }
GET /management/resource/test-account/request/1?siteUrl=mcttest-j-a.webex.com&testApp=meeting&ip=10.252.10.181&uuid=ecaa2195-577c-4636-bae8-76d125fece05 ¶
Description ¶
This API will provide to request test accounts. We need to provide the requested number, siteUrl and testApp. The ip and uuid are not required.
If there some related machines or bound machine ip, please provide uuid and ip as well.
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "192.168.3.209", "errorMessage": null, "result": [ { "testApp": "meeting", "testSiteUrl": "mcttest-j-a.webex.com", "testAccount": "mcttest-j-a-030@wbxlab.us", "testPassword": "xxx", "uuid": "ecaa2195-577c-4636-bae8-76d125fece05" } ] }
-
500 Server Internal Error
{ "errorCode": "B00001", "localIp": "192.168.3.8", "errorMessage": "There don't have available site test accounts.", "result": null }
Worker Agent API - Test Case ¶
GET /station/testcase/{name}/{version}" ¶
Description ¶
This API will query test case .
Response ¶
-
200 OK
{ "errorCode": "OKOKOK", "localIp": "172.16.3.18", "testcase": { "caseId": 0, "caseVersion": "1.0", "caseName": "CaseScheduleMeeting", "caseYamlBody": "version: 1.0......" } }
-
500 Server Internal Error
{ "errorCode": "NONONO", "localIp": "172.16.3.18", "errorMessage": "Platform internal error" }
