| 1.5 | Hanoch Haim (hhaim)
|
- add more instructions (v1.92)
-
+| 1.6 | Itay Marom (imarom)
+|
+- added API synchronization
|=================
== RPC Commands
The following RPC commands are supported
+=== API Synchronization
+* *Name* - 'api_sync'
+* *API Class* - 'None'
+* *Valid States* - 'not relevant'
+* *Description* - Sync with server about API classes. This allows the server and the client
+ to be sure they are fully synced.
+ The return values are used for furthur communication with the server.
+ every API from a specific class requires its corresponding api_h parameter
+ added to the specific parameters of the function.
+* *Paramters* -
+** *api_vers* [list] - A list of objects of type xref:api_class['api_class']
+* *Result* ['object'] - A list of objects of type xref:api_class_rc['api_class_rc']
+
+.Object type 'api_class'
+[options="header",cols="1,1,3"]
+|=================
+| Field | Type | Description
+| type | string | name of the API class
+| major | int | major version
+| minor | int | minor version
+|=================
+
+.Object type 'api_class_rc'
+[options="header",cols="1,1,3"]
+|=================
+| Field | Type | Description
+| type | string | name of the API class
+| api_h | string | API handler for this API class
+|=================
+
+Example:
+
+[source,bash]
+----
+'Request':
+
+{
+ "id": "6d4e9gs3",
+ "jsonrpc": "2.0",
+ "method": "api_sync",
+ "params": {
+ "api_vers": [
+ {
+ "type": "core"
+ "major": 1,
+ "minor": 0,
+ }
+ ]
+ }
+}
+
+'Response':
+
+{
+ "id": "6d4e9gs3",
+ "jsonrpc": "2.0",
+ "result": {
+ "api_vers": [
+ {
+ "type": "core"
+ "api_h": "SPhoCDIV",
+ }
+ ]
+ }
+}
+
+----
+
=== Ping
* *Name* - 'ping'
+* *API Class* - 'None'
* *Valid States* - 'not relevant'
* *Description* - Pings the TRex server
* *Paramters* - None
=== Get Server Supported Commands
* *Name* - 'get_supported_cmds'
+* *API Class* - 'core'
* *Valid States* - 'not relevant'
* *Description* - Queries the server for all the supported commands
* *Paramters* - None
"jsonrpc": "2.0",
"id": 1,
"method": "get_supported_cmds",
- "params": null
+ "params": {
+ "api_h": "SPhoCDIV"
+ }
}
=== Get Version
* *Name* - 'get_version'
+* *API Class* - 'core'
* *Valid States* - 'not relevant'
* *Description* - Queries the server for version information
* *Paramters* - None
"id": "wapkk8m6",
"jsonrpc": "2.0",
"method": "get_version",
- "params": null
+ "params": {
+ "api_h": "SPhoCDIV"
+ }
}
=== Get System Info
* *Name* - 'get_system_info'
+* *API Class* - 'core'
* *Description* - Queries the server for system properties
* *Paramters* - None
* *Result* ['object'] - See table below
"id": "zweuldlh",
"jsonrpc": "2.0",
"method": "get_system_info",
- "params": null
+ "params": {
+ "api_h": "SPhoCDIV"
+ }
}
'Response':
=== Get Port Status
* *Name* - 'get_port_status'
+* *API Class* - 'core'
* *Valid States* - 'all'
* *Description* - Queries the server for status
* *Paramters* -
"jsonrpc": "2.0",
"method": "get_port_status",
"params": {
+ "api_h": "SPhoCDIV",
"port_id": 2
}
}
=== Acquire
* *Name* - 'Acquire'
+* *API Class* - 'core'
* *Valid States* - 'all'
* *Description* - Takes ownership over the port
* *Paramters* -
"jsonrpc": "2.0",
"method": "Acquire",
"params": {
- "user": "itay"
- "port_id": 1
+ "api_h": "SPhoCDIV",
+ "user": "itay",
+ "port_id": 1,
"force": false,
}
}
=== Release
* *Name* - 'release'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - Release owernship over the device
* *Paramters* -
"jsonrpc": "2.0",
"method": "release",
"params": {
- "handler": "37JncCHr"
+ "api_h": "SPhoCDIV",
+ "handler": "37JncCHr",
"port_id": 1
}
}
=== Add Stream
* *Name* - 'add_stream'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - Adds a stream to a port
* *Paramters*
"jsonrpc": "2.0",
"method": "add_stream",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 1,
"stream_id": 502
=== Remove Stream
* *Name* - 'remove_stream'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - Removes a stream from a port
* *Paramters*
"jsonrpc": "2.0",
"method": "remove_stream",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 1,
"stream_id": 502
=== Get Stream ID List
* *Name* - 'get_stream_list'
+* *API Class* - 'core'
* *Valid States* - 'unowned', 'owned', 'active'
* *Description* - fetch all the assoicated streams for a port
* *Paramters*
"jsonrpc": "2.0",
"method": "get_stream_list",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 1
}
=== Get Stream
* *Name* - 'get_stream'
+* *API Class* - 'core'
* *Valid States* - 'unowned', 'owned', 'active'
* *Description* - get a specific stream object
* *Paramters*
"jsonrpc": "2.0",
"method": "get_stream",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 1,
"stream_id": 7
=== Remove All Streams
* *Name* - 'remove_all_streams'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - remove all streams from a port
* *Paramters*
"jsonrpc": "2.0",
"method": "remove_all_streams",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 2
}
=== Start Traffic
* *Name* - 'start_traffic'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - Starts the traffic on a specific port. if traffic has already started an error will be returned
* *Paramters*
"jsonrpc": "2.0",
"method": "start_traffic",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 3
}
=== Stop Traffic
* *Name* - 'stop_traffic'
+* *API Class* - 'core'
* *Valid States* - 'active'
* *Description* - Stops the traffic on a specific port. if the port has already started nothing will happen
* *Paramters*
"jsonrpc": "2.0",
"method": "stop_traffic",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "37JncCHr",
"port_id": 3
}
=== Remove RX Filters
* *Name* - 'remove_rx_filters'
+* *API Class* - 'core'
* *Valid States* - 'owned'
* *Description* - Post to calling stop, the client should call this function to remove
any RX filters that were attached.
"jsonrpc": "2.0",
"method": "remove_rx_filters",
"params": {
+ "api_h": "SPhoCDIV",
"handler": "ywVlqZa8",
"port_id": 3
}
=== Get Global Stats
* *Name* - 'get_global_stats'
+* *API Class* - 'core'
* *Valid States* - 'unowned', 'owned', 'active'
* *Description* - Get machine global stats
* *Paramters* - None
=== Get Port Stats
* *Name* - 'get_port_stats'
+* *API Class* - 'core'
* *Valid States* - 'unowned', 'owned', 'active'
* *Description* - Get port stats
* *Paramters*
=== Get Stream Stats
* *Name* - 'get_steram_stats'
+* *API Class* - 'core'
* *Valid States* - 'unowned', 'owned', 'active'
* *Description* - Get port stats
* *Paramters*
"jsonrpc" : "2.0",
"method" : "add_stream",
"params" : {
+ "api_h": "SPhoCDIV",
"handler" : "37JncCHr",
"port_id" : 1,
"stream" : {
"jsonrpc" : "2.0",
"method" : "add_stream",
"params" : {
+ "api_h": "SPhoCDIV",
"handler" : "2JjzhMai",
"port_id" : 3,
"stream" : {
"jsonrpc" : "2.0",
"method" : "add_stream",
"params" : {
+ "api_h": "SPhoCDIV",
"handler" : "2JjzhMai",
"port_id" : 3,
"stream" : {