DHCP Server API
Version: 1.0.0
Status:
DHCPServer interface for Thunder framework.
(Defined by DHCPServer.json)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the DHCPServer interface (version 1.0.0). It includes detailed specification about its methods and properties provided.
Case Sensitivity
All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
Acronyms, Abbreviations and Terms
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
References
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Description
DHCP Server JSON-RPC interface.
Methods
The following methods are provided by the DHCPServer interface:
DHCPServer interface methods:
Method | Description |
---|---|
activate | Activates a DHCP server |
deactivate | Deactivates a DHCP server |
activate method
Activates a DHCP server.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.interface | string | mandatory | Network interface name |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null (default: None) |
Errors
Message | Description |
---|---|
ERROR_GENERAL |
Failed to activate server |
ERROR_UNKNOWN_KEY |
Invalid interface name given |
ERROR_ILLEGAL_STATE |
Server is already activated |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.activate",
"params": {
"interface": "eth0"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
deactivate method
Deactivates a DHCP server.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.interface | string | mandatory | Network interface name |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null (default: None) |
Errors
Message | Description |
---|---|
ERROR_GENERAL |
Failed to deactivate server |
ERROR_UNKNOWN_KEY |
Invalid interface name given |
ERROR_ILLEGAL_STATE |
Server is not activated |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.deactivate",
"params": {
"interface": "eth0"
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
Properties
The following properties are provided by the DHCPServer interface:
DHCPServer interface properties:
Property | R/W | Description |
---|---|---|
status | read-only | Server status |
status property
Provides access to the server status.
This property is read-only.
The server parameter shall be passed as the index to the property, i.e.
status@<server>
.
Index
Name | Type | M/O | Description |
---|---|---|---|
server | string | mandatory | If omitted, status of all configured servers is returned |
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | array | mandatory | List of configured servers |
(property)[#] | object | mandatory | ... |
(property)[#].interface | string | mandatory | Network interface name |
(property)[#].active | boolean | mandatory | Denotes if server is currently active |
(property)[#]?.begin | string | optional | IP address pool start |
(property)[#]?.end | string | optional | IP address pool end |
(property)[#]?.router | string | optional | Router IP address |
(property)[#]?.leases | array | optional | List of IP address leases |
(property)[#]?.leases[#] | object | mandatory | Lease description |
(property)[#]?.leases[#].name | string | mandatory | Client identifier (or client hardware address if identifier is absent) |
(property)[#]?.leases[#].ip | string | mandatory | Client IP address |
(property)[#]?.leases[#]?.expires | string | optional | Client IP expiration time (in ISO8601 format, empty: never expires) |
Errors
Message | Description |
---|---|
ERROR_UNKNOWN_KEY |
Invalid server name given |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.status@eth0"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": [
{
"interface": "eth0",
"active": true,
"begin": "192.168.0.10",
"end": "192.168.0.100",
"router": "192.168.0.1",
"leases": [
{
"name": "00e04c326c56",
"ip": "192.168.0.10",
"expires": "2019-05-07T07:20:26Z"
}
]
}
]
}