Open Mobile Alliance (OMA) - Next Generation Services Interface (NGSI)
The ngsi node type implements an interface to FIWARE context brokers.
Currently version 1 of the RESTful HTTP API is implemented and using NGSI10 for the context management interface.
This implementation if currently limited to the updateContext operation.
Therefore only publishing updates is supported. Subscription or polling of events is planned for later versions.
Prerequisites
This node-type requires to following libraries to communicate with the context broker over JSON:
- libjansson (>= 2.7)
- libcurl (>= 7.29.0)
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/ngsi.cpp
Configuration
You can use the vectorize setting to send multiple samples in a vector.
Every ngsi node supports the following special settings:
| endpoint required | string <uri> |
| entity_id | string ID of NGSI entity. |
| entity_type | string Type of NGSI entity. |
| ssl_verify | boolean Verify SSL certificate against local trust store. |
| timeout | number Default: 1 Timeout in seconds for HTTP requests. |
| rate | number Default: 1 Polling rate in Hz for requesting entity updates from broker. |
| access_token | string Send 'Auth-Token' header with every HTTP request. |
| create | boolean Default: true Create NGSI entities during startup of node. |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "entity_id": "string",
- "entity_type": "string",
- "ssl_verify": true,
- "timeout": 1,
- "rate": 1,
- "access_token": "string",
- "create": true,
- "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
ngsi_node = {
type = "ngsi"
# The HTTP REST API endpoint of the FIRWARE context broker
endpoint = "http://46.101.131.212:1026"
# Add an 'Auth-Token' token header to each request
access_token = "aig1aaQuohsh5pee9uiC2Bae3loSh9wu"
entity_id = "S3_ElectricalGrid"
entity_type = "ElectricalGridMonitoring"
# Create the NGSI entities during startup
create = true
# Rate at which we poll the broker for updates
rate = 0.1
# Timeout of HTTP request in seconds (default is 1, must be smaller than 1 / rate)
timeout = 1
# Verification of SSL server certificates (default is true)
verify_ssl = false
in = {
signals = (
{
name = "attr1"
ngsi_attribute_name = "attr1" # Defaults to signal 'name'
ngsi_attribute_type = "Volts" # Default to signal 'unit'
ngsi_attribute_metadatas = (
{ name="accuracy", type="percent", value="5" }
)
}
)
}
out = {
signals = (
{ name="PTotalLosses", unit="MW" },
{ name="QTotalLosses", unit="Mvar" }
)
}
}
}
Further reading
This standard was specified by the Open Mobile Alliance (OMA).