SPDK provides a sample python script rpc_http_proxy.py, that provides http server which listens for JSON objects from users. It uses HTTP POST method to receive JSON objects including methods and parameters described in this chapter.
| Name | Optional | Type | Description |
|---|---|---|---|
| server IP | Required | string | IP address that JSON objects shall be received on |
| server port | Required | number | Port number that JSON objects shall be received on |
| user name | Required | string | User name that will be used for authentication |
| password | Required | string | Password that will be used for authentication |
| RPC listen address | Optional | string | Path to SPDK JSON RPC socket. Default: /var/tmp/spdk.sock |
spdk/scripts/rpc_http_proxy.py 192.168.0.2 8000 user password
Error 401 - missing or incorrect user and/or password.
Error 400 - wrong JSON syntax or incorrect JSON method
Status 200 with resultant JSON object included on success.
Below is a sample python script acting as a client side. It sends bdev_get_bdevs method with optional name parameter and prints JSON object returned from remote_rpc script.
Output: