Version: 1.0
Status: ⚫⚫⚫
NetworkControl plugin for Thunder framework.
This document describes purpose and functionality of the NetworkControl plugin. It includes detailed specification about its configuration, methods and properties as well as sent notifications.
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.
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. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
The Network Control plugin provides functionality for network interface management.
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: NetworkControl) |
classname | string | Class name: NetworkControl |
locator | string | Library name: libThunderNetworkControl.so |
startmode | string | Determines if the plugin shall be started automatically along with the framework |
configuration | object | (optional) |
configuration?.dnsfile | string | (optional) Path to DNS resolve file (default: /etc/resolv.conf) |
configuration?.response | number | (optional) Maximum response time out of the DHCP server |
configuration?.retries | number | (optional) Maximum number of retries to the DHCP server |
This plugin implements the following interfaces:
- INetworkControl (INetworkControl.h) (version 1.0.0) (compliant format)
The following methods are provided by the NetworkControl plugin:
NetworkControl interface methods:
Method | Description |
---|---|
flush | Flush and reload requested interface |
flush method
Flush and reload requested interface.
Name | Type | Description |
---|---|---|
params | object | |
params.interface | string |
Name | Type | Description |
---|---|---|
result | null | Always null |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.flush",
"params": {
"interface": "..."
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
The following properties are provided by the NetworkControl plugin:
NetworkControl interface properties:
Property | Description |
---|---|
interfaces RO | Currently available interfaces |
status RO | Status of requested interface |
network | Network info of requested interface |
dns | DNS list |
up | Provides given requested interface is up or not |
interfaces property
Provides access to the currently available interfaces.
This property is read-only.
Name | Type | Description |
---|---|---|
result | array | Currently available interfaces |
result[#] | string |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.interfaces"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": [
"..."
]
}
status property
Provides access to the status of requested interface.
This property is read-only.
The interface argument shall be passed as the index to the property, e.g. NetworkControl.1.status@xyz.
Name | Type | Description |
---|---|---|
result | string | Status of requested interface (must be one of the following: Unavailable, Available) |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.status@xyz"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "Unavailable"
}
network property
Provides access to the network info of requested interface.
Name | Type | Description |
---|---|---|
(property) | object | Network info of requested interface |
(property).value | array | |
(property).value[#] | object | |
(property).value[#].address | string | |
(property).value[#].defaultgateway | string | |
(property).value[#].mask | integer | |
(property).value[#].mode | string | (must be one of the following: Static, Dynamic) |
The interface argument shall be passed as the index to the property, e.g. NetworkControl.1.network@xyz.
Name | Type | Description |
---|---|---|
result | array | |
result[#] | object | |
result[#].address | string | |
result[#].defaultgateway | string | |
result[#].mask | integer | |
result[#].mode | string | (must be one of the following: Static, Dynamic) |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.network@xyz"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": [
{
"address": "...",
"defaultgateway": "...",
"mask": 0,
"mode": "Static"
}
]
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.network@xyz",
"params": {
"value": [
{
"address": "...",
"defaultgateway": "...",
"mask": 0,
"mode": "Static"
}
]
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
dns property
Provides access to the DNS list.
Name | Type | Description |
---|---|---|
(property) | object | DNS list |
(property).value | array | |
(property).value[#] | string |
Name | Type | Description |
---|---|---|
result | array | |
result[#] | string |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.dns"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": [
"..."
]
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.dns",
"params": {
"value": [
"..."
]
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
up property
Provides access to the provides given requested interface is up or not.
Name | Type | Description |
---|---|---|
(property) | object | Provides given requested interface is up or not |
(property).value | boolean |
The interface argument shall be passed as the index to the property, e.g. NetworkControl.1.up@xyz.
Name | Type | Description |
---|---|---|
result | boolean |
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.up@xyz"
}
{
"jsonrpc": "2.0",
"id": 42,
"result": false
}
{
"jsonrpc": "2.0",
"id": 42,
"method": "NetworkControl.1.up@xyz",
"params": {
"value": false
}
}
{
"jsonrpc": "2.0",
"id": 42,
"result": "null"
}
Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the NetworkControl plugin:
NetworkControl interface events:
Event | Description |
---|---|
update |
update event
Name | Type | Description |
---|---|---|
params | object | |
params.interfacename | string |
{
"jsonrpc": "2.0",
"method": "client.events.1.update",
"params": {
"interfacename": "..."
}
}