List test results
Get a list of test results.
GET /api/v1/results/{id}/tests/{?page,limit,filter,sort,format}
URL Parameters
Name | Description |
---|---|
page |
integer (optional) See Paging |
limit |
integer (optional) See Paging |
detailed |
boolean (optional) See Summary / Detailed Representations |
filter |
string (optional) See Filtering |
sort |
string (optional) See Sorting |
format |
string (optional) Choices: json , csv Default: json |
Response
200 OK
{
"timestamp": "2016-04-15T12:53:39.335198176-04:00",
"data": [
{
"id": "20150817160428",
"seq": "1",
"loop": "1",
"active": false,
"result": "pass",
"alerts": 0,
"retries": 0,
"started": "2015-08-17T16:04:28-04:00",
"duration": 142,
"flagged": false,
"name": "start",
"description": "CDRouter Startup",
"skip_name": "",
"skip_reason": "",
"log": "start.txt",
"keylog": "keylog.txt",
"note": ""
},
{
"id": "20150817160428",
"seq": "2",
"loop": "1",
"active": true,
"result": "pass",
"alerts": 0,
"retries": 0,
"started": "2015-08-17T16:06:50-04:00",
"duration": 0,
"flagged": false,
"name": "cdrouter_basic_1",
"description": "Router responds to ARP Request on LAN interface",
"skip_name": "",
"skip_reason": "",
"log": "cdrouter_basic_1.txt",
"keylog": "keylog.txt",
"note": ""
},
{
"id": "20150817160428",
"seq": "3",
"loop": "1",
"active": true,
"result": "skipped",
"alerts": 0,
"retries": 0,
"started": "2015-08-17T16:06:50-04:00",
"duration": 0,
"flagged": false,
"name": "cdrouter_dhcp_1",
"description": "DHCP client renews lease when current lease expires",
"skip_name": "",
"skip_reason": "Test case was skipped due to configuration issues",
"log": "",
"keylog": "keylog.txt",
"note": ""
}
],
"links": {
"current": 1,
"first": 1,
"last": 4,
"limit": 3,
"next": 2,
"total": 12
}
}
Response
200 OK with ?format=csv
Content-Type: text/csv
Content-Disposition: inline; filename="{id}.csv"
id,seq,loop,result,retries,started,duration,flagged,name,description,skip_name,skip_reason,log,note
20150817160428,1,1,pass,0,2015-08-17 16:04:28 -0400 EDT,142,false,start,CDRouter Startup,,,start.txt,
20150817160428,2,1,pass,0,2015-08-17 16:06:50 -0400 EDT,0,false,cdrouter_basic_1,Router responds to ARP Request on LAN interface,,,cdrouter_basic_1.txt,
20150817160428,3,1,skipped,0,2015-08-17 16:06:50 -0400 EDT,0,false,cdrouter_dhcp_1,DHCP client renews lease when current lease expires,,Test case was skipped due to configuration issues,,
Get a test result
Get a test result.
GET /api/v1/results/{id}/tests/{seq}
Response
200 OK
{
"timestamp": "2016-04-15T12:56:59.525566301-04:00",
"data": {
"id": "20150817160428",
"seq": "2",
"loop": "1",
"active": true,
"result": "pass",
"alerts": 0,
"retries": 0,
"started": "2015-08-17T16:06:50-04:00",
"duration": 0,
"flagged": false,
"name": "cdrouter_basic_1",
"description": "Router responds to ARP Request on LAN interface",
"skip_name": "",
"skip_reason": "",
"log": "cdrouter_basic_1.txt",
"keylog": "keylog.txt",
"note": ""
}
}
Response
404 Not Found
{
"error": "no such test"
}
Edit a test result
Edit a test result.
PATCH /api/v1/results/{id}/tests/{seq}
Example
PATCH /api/v1/results/20150817160428/tests/2
{
"flagged": true,
"note": "something weird here"
}
200 OK
{
"timestamp": "2016-04-15T12:56:59.525566301-04:00",
"data": {
"id": "20150817160428",
"seq": "2",
"loop": "1",
"active": true,
"result": "pass",
"alerts": 0,
"retries": 0,
"started": "2015-08-17T16:06:50-04:00",
"duration": 0,
"flagged": true,
"name": "cdrouter_basic_1",
"description": "Router responds to ARP Request on LAN interface",
"skip_name": "",
"skip_reason": "",
"log": "cdrouter_basic_1.txt",
"keylog": "keylog.txt",
"note": "something weird here"
}
}
Get a test result’s log
Get a test result’s log.
GET /api/v1/results/{id}/tests/{seq}/log
URL Parameters
Name | Description |
---|---|
offset |
integer (optional) zero-based line number to start from |
limit |
integer (optional) Lines to return per request |
filter |
string (optional) See Filtering or use the following predefined filters Choices: results , logs , packets , alerts |
packets |
boolean (optional) Omit packets if false |
timestamp_format |
string (optional) Prefix timestamp field with YYYY-MM-DD if long and log file was generated by CDRouter 10.1 or later Choices: short , long Default: Value of log_timestamp_format in /usr/cdrouter-data/etc/config.yml |
format |
string (optional) Choices: json , html Default: json |
Example
Get all unsuccessful DNS packet logs from WAN interfaces destined for 202.254.1.2:
GET /api/v1/results/20150817160428/tests/2/log?filter=packets&filter=interface~^wan&filter=dst=202.254.1.2&filter=proto=DNS&filter=info~*error
200 OK
{
"timestamp": "2016-09-19T12:21:54.724671698-04:00",
"data": {
"offset": 0,
"limit": 0,
"lines": [
{
"raw": "2016-09-16 10:47:02.114 O>>>(wan-17): 8.8.8.8 202.254.1.2 DNS Response Name Error",
"line": 163,
"prefix": "O>>>",
"name": "wan",
"timestamp": "2016-09-16 10:47:02.114",
"message": "8.8.8.8 202.254.1.2 DNS Response Name Error",
"interface": "wan",
"packet": "17",
"src": "8.8.8.8",
"dst": "202.254.1.2",
"proto": "DNS",
"info": "Response Name Error"
},
{
"raw": "2016-09-16 10:47:02.119 O>>>(wan-19): 8.8.8.8 202.254.1.2 DNS Response Name Error",
"line": 172,
"prefix": "O>>>",
"name": "wan",
"timestamp": "2016-09-16 10:47:02.119",
"message": "8.8.8.8 202.254.1.2 DNS Response Name Error",
"interface": "wan",
"packet": "19",
"src": "8.8.8.8",
"dst": "202.254.1.2",
"proto": "DNS",
"info": "Response Name Error"
},
{
"raw": "2016-09-16 10:47:02.617 O>>>(wan-25): 8.8.8.8 202.254.1.2 DNS Response Name Error",
"line": 187,
"prefix": "O>>>",
"name": "wan",
"timestamp": "2016-09-16 10:47:02.617",
"message": "8.8.8.8 202.254.1.2 DNS Response Name Error",
"interface": "wan",
"packet": "25",
"src": "8.8.8.8",
"dst": "202.254.1.2",
"proto": "DNS",
"info": "Response Name Error"
}
]
}
}
Get a test result’s log as plaintext
Get a test result’s log as plaintext.
GET /api/v1/results/{id}/tests/{seq}/log?format=text
Response
200 OK
Content-Type: text/plain
Content-Disposition: inline; filename="{log}.txt"