Tester API
Introduction
The Tester Application is one of the key run-time components which comprise the N2SVCD run-time service process. The Tester Application is responsible for executing “Test Runs” on behalf of clients. It is managed via a JSON interface.
Clients (such as the IN Tester GUI) wishing to perform Test Management (e.g. execute/query/cancel test runs) can make their requests over a TCP Remote Procedure Call (RPC) interface. The RPC interface offered by the N2SVCD Tester Application is implemented using the JSON-RPC interface.
By default, the TesterApplication will listen on port 9009 for incoming JSON RPC Test Management requests. This port number may be changed by modifying the relevant configuration parameter as described in the N2SVCD Config - Tester.
The first 4 bytes of any RPC request or response are the message length (in bytes) as an unsigned integer in network byte order. The remainder of the request or response is a JSON structure of exactly the specified number of bytes.
JSON Request - Attributes
The JSON request structure has the following properties:
Parameter | Type | Description |
---|---|---|
jsonrpc
|
String | [Required] The JSON RPC version (always "2.0"). |
method
|
String | [Required] Name of the method to be invoked. |
params
|
String | [Required] An Object containing arguments to the method. |
id
|
String | [Required] A correlating ID to identify the request. |
Note: The general JSON-RPC standard allows for multiple RPC requests on a single TCP connection. However, the JSON-RPC implemented by the N2SVCD Tester Application permits only one JSON Test Management request/response per TCP connection.
JSON Request - Example
An example JSON request could be as follows:
{
"jsonrpc" : "2.0",
"id" : 1,
"method" : "ExecuteTest",
"params" : {
"run_id" : "tr_9538",
"distribution" : {
"type" : "single"
},
"operations" : [
{
"type" : "inap.ssp_to_scp.InitialDP",
"arguments" : {
"serviceKey" : 45,
"eventTypeBCSM" : 3,
"callingPartyNumber_digits" : "414511860"
}
},
{
"type": "inap.ssp_from_scp.ReleaseCall"
},
],
"scp" : {
"dssn" : 106,
"dpc" : 4114
}
}
}
JSON Response - Attributes
The response properties are:
Attribute | Type | Description |
---|---|---|
jsonrpc
|
String | [Required] The JSON RPC version (always "2.0"). |
result
|
String | The Object that was returned by the invoked method (null on error). |
error
|
String | An Error object if there was an error invoking the method (null if no error). |
id
|
String | [Required] The correlating ID from the request. |
Note: The structure of the params
and result
objects will vary according
to the particular method
which is executed. The “result” may be a string, an
array, or an object.
The structure of the error
object (when present) created by the Tester
Application is more consistent. It is always as follows:
Attribute | Type | Description |
---|---|---|
code
|
Integer | [Required] A numeric code denoting the nature of the error. |
message
|
String | [Required] An arbitrary human-readable string. |
JSON Response - Example (Success)
A corresponding success response is:
{
"jsonrpc" : "2.0",
"id" : "1",
"result" : "ok"
}
JSON Response - Example (Error)
A corresponding error response is as follows:
{
"jsonrpc" : "2.0",
"id" : "1",
"error" : {
"message" : "Unsupported method \"EgsecuteTest\"",
"code" : 1001
}
}
Error Codes
The current list of error codes is given here. New error codes may be added at any time without notice.
Error Code | Description |
---|---|
1000
|
General Error. |
1001
|
Unknown Method. |
2000
|
Test Run ID not specified. |
2001
|
Test Run ID already in use. |
2002
|
Test Run cannot create. |
2003
|
Test Run cannot start. |
2004
|
Test Run ID Not Known. |