Skip to content

Latest commit

 

History

History
497 lines (371 loc) · 10.7 KB

NetworkControlPlugin.md

File metadata and controls

497 lines (371 loc) · 10.7 KB

Network Control Plugin

Version: 1.0

Status: ⚫⚫⚫

NetworkControl plugin for Thunder framework.

Table of Contents

Introduction

Scope

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.

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

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].

Configuration

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

Interfaces

This plugin implements the following interfaces:

Methods

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.

Parameters

Name Type Description
params object
params.interface string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.flush",
  "params": {
    "interface": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

Properties

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.

Value

Result

Name Type Description
result array Currently available interfaces
result[#] string

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.interfaces"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    "..."
  ]
}

status property

Provides access to the status of requested interface.

This property is read-only.

Value

The interface argument shall be passed as the index to the property, e.g. NetworkControl.1.status@xyz.

Result

Name Type Description
result string Status of requested interface (must be one of the following: Unavailable, Available)

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.status@xyz"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": "Unavailable"
}

network property

Provides access to the network info of requested interface.

Value

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.

Result

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)

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.network@xyz"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "address": "...",
      "defaultgateway": "...",
      "mask": 0,
      "mode": "Static"
    }
  ]
}

Set Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.network@xyz",
  "params": {
    "value": [
      {
        "address": "...",
        "defaultgateway": "...",
        "mask": 0,
        "mode": "Static"
      }
    ]
  }
}

Set Response

{
    "jsonrpc": "2.0",
    "id": 42,
    "result": "null"
}

Provides access to the DNS list.

Value

Name Type Description
(property) object DNS list
(property).value array
(property).value[#] string

Result

Name Type Description
result array
result[#] string

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.dns"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    "..."
  ]
}

Set Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.dns",
  "params": {
    "value": [
      "..."
    ]
  }
}

Set Response

{
    "jsonrpc": "2.0",
    "id": 42,
    "result": "null"
}

Provides access to the provides given requested interface is up or not.

Value

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.

Result

Name Type Description
result boolean

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.up@xyz"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": false
}

Set Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "NetworkControl.1.up@xyz",
  "params": {
    "value": false
  }
}

Set Response

{
    "jsonrpc": "2.0",
    "id": 42,
    "result": "null"
}

Notifications

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

Parameters

Name Type Description
params object
params.interfacename string

Example

{
  "jsonrpc": "2.0",
  "method": "client.events.1.update",
  "params": {
    "interfacename": "..."
  }
}