Skip to content
IoT Agent for OPC UA protocol
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
conf Added filter in capability Mar 14, 2019
docker-compose Create docker_compose_instructions.md Feb 14, 2019
docs
iot_agent_modules Test improvement Mar 14, 2019
test Test improvement Mar 14, 2019
.eslintignore Add Text lint and Husky for Markdown Feb 5, 2019
.eslintrc Add Text lint and Husky for Markdown Feb 5, 2019
.gitignore Add Text lint and Husky for Markdown Feb 5, 2019
.prettierrc.json Add Text lint and Husky for Markdown Feb 5, 2019
.textlintrc
.travis.yml Remove net-tools Mar 6, 2019
CHANGES_NEXT_RELEASE Add Docker change to note Feb 4, 2019
CREDITS Update CREDITS Nov 5, 2018
ContributionPolicy.txt Beta Version Apr 30, 2018
Dockerfile Expose North Port Feb 21, 2019
LICENSE First Commit Feb 9, 2018
README.md Added filter in capability Mar 14, 2019
config.js Standardize Whitespace in JavaScript files Feb 5, 2019
docker-entrypoint.sh Update docker-entrypoint.sh Feb 14, 2019
index.js Add get config service Mar 12, 2019
mapping_tool.jar Added filter in capability Mar 14, 2019
mkdocs.yml Update mkdocs.yml Jan 23, 2019
package-lock.json Split Docs and Unit Test into separate jobs Mar 6, 2019
package.json Split Docs and Unit Test into separate jobs Mar 6, 2019
roadmap.md Update roadmap.md May 8, 2019

README.md

F4I OPC UA Agent

FIWARE IoT Agents License: AGPL Docker badge Support badge
Documentation badge Build badge Coverage Status Status Join the chat at https://gitter.im/iotagent-opcua/community Known Vulnerabilities
An Internet of Things Agent accepting data from OPC UA devices. This IoT Agent is designed to be a bridge between the OPC Unified Architecture protocol and the NGSI interface of a context broker.

The intended level of complexity to support these operations should consider a limited human intervention (mainly during the setup of a new OPC UA endpoint), through the mean of a parametrization task (either manual or semi-automatic, using a text-based parametrization or a simple UI to support the configuration) so that no software coding is required to adapt the agent to different OPC UA devices.

It is based on the IoT Agent Node.js Library. Further general information about the FIWARE IoT Agents framework, its architecture and the common interaction model can be found in the library's GitHub repository.

This project is part of FIWARE. For more information check the FIWARE Catalogue entry for the IoT Agents.

📚 Documentation 🐳 Docker Hub 🎯 Roadmap

Contents

Background

Positioning in the overall F4I Reference Architecture

The F4I OPC UA Agent is based on the reference implementation of the FIWARE Backend Device Management Generic Enabler, IDAS, delivered by Telefonica I+D. IDAS provides a collection of Agents - i.e., independent processes that are typically executed in the proximity of IoT devices and that are responsible for bridging a specific IoT protocol to the NGSI standard (e.g. the IDAS distribution includes off-the-shelf Agents for LwM2M and MQTT). To this end, IDAS links the NGSI southbound API of the FIWARE Orion Context Broker to the northbound API of the IoT application stack, by providing a software library (the IoT Agent Lib depicted in the previous figure) for developing custom Agents that may extend the bridging capabilities of IDAS to other protocols. The F4I IDAS OPC UA Agent makes use of this framework to integrate OPC UA-based devices in a publish-subscribe system based on the FIWARE Orion Context Broker.

Install

NPM Install

$ npm install
$ node index.js

Docker Install

You do need to have docker in your machine. See the documentation on how to do this.

1. The Fastest Way

Docker Compose allows you to link an OPC UA Agent container to a MongoDB container in a few minutes. This method requires that you install Docker Compose.

Follow these steps:

  1. Create a directory on your system on which to work (for example, ~/opc-ua-agent).
  2. Create a new file called docker-compose.yml inside your directory with the following contents:
   version: "2.3"
   services:

      iotage:
         hostname: iotage
         image: rdlabengpa/opcuaage:latest
         networks:
            - hostnet
            - iotnet
         ports:
            - "4001:4001"
            - "4081:8080"
      depends_on:
         - iotmongo
      volumes:
         - ./AGECONF:/opt/iotagent-opcua/conf

      iotmongo:
         hostname: iotmongo
         image: mongo:3.4
         networks:
            - iotnet
         volumes:
            - iotmongo_data:/data/db
            - iotmongo_conf:/data/configdb

   volumes:
         iotmongo_data:
         iotmongo_conf:

   networks:
         hostnet:
         iotnet:
  1. Using the command-line and within the directory you created type: sudo docker-compose up.

Before running containers you must create an AGECONF subdirectory in the same directory as the docker-compose.yml file and create in it a config.properties file based on the following template:

namespace-ignore=2
################ OPTIONAL FILTERING ################
nodes-filtering-in=ns\=1;s\=Oxigen,ns\=1;s\=Speed
nodes-filtering-out=ns\=1;s\=Temperature
####################################################
context-broker-host=<ORIONHOSTIP>
context-broker-port=<ORIONPORT>
server-base-root=/
server-port=4001
device-registry-type=memory
mongodb-host=iotmongo
mongodb-port=27017
mongodb-db=iotagent
mongodb-retries=5
mongodb-retry-time=5
fiware-service=<SERVICE>
fiware-service-path=<SERVICE-PATH>
provider-url=http://iotage:4001
device-registration-duration=P1M
endpoint=opc.tcp://<IPADDR>:<PORT>
log-level=DEBUG

#DATATYPE MAPPING OPCUA --> NGSI
OPC-datatype-Number=Number
OPC-datatype-Decimal128=Number
OPC-datatype-Double=Number
OPC-datatype-Float=Number
OPC-datatype-Integer=Integer
OPC-datatype-UInteger=Integer
OPC-datatype-String=Text
OPC-datatype-ByteString=Text
#END DATATYPE MAPPING OPCUA --> NGSI

#SESSION PARAMETERS
requestedPublishingInterval=500
requestedLifetimeCount=1000
requestedMaxKeepAliveCount=5
maxNotificationsPerPublish=10
publishingEnabled=true
priority=10

#SERVER CERT E AUTH
securityMode=NONE
securityPolicy=
userName=
password=

#Administration Services
api-port=4081
#End Administration Services

#POLL COMMANDS SETTINGS
polling=false
polling-commands-timer=30000
pollingDaemonFrequency=20000
pollingExpiration=200000
#END POLL COMMANDS SETTINGS

#AGENT ID
agent-id=<PREFIX>

You can set the properties according to your environment, but you should focus at least on:

context-broker-host=<ORIONHOSTIP>
context-broker-port=<ORIONPORT>

fiware-service=<SERVICE>
fiware-service-path=<SERVICE-PATH>

endpoint=opc.tcp://<IPADDR>:<PORT>

agent-id=<PREFIX>

2. Alternative Start Method

The docker-compose is the preferred method for starting multiple containers and creating related resources, but alternatively you can use the following commands:

docker run -d --name iotmongo -h iotmongo -v iotmongo_data:/data/db -v iotmongo_conf:/data/configdb mongo:3.4
docker run -d --name iotage -h iotage -p 4001:4001 -p 4081:8080 --link iotmongo -v ./AGECONF:/opt/iotagent-opcua/conf rdlabengpa/opcuaage:latest

Further Information about how to install the OPC UA IoT Agent can be found at the corresponding section of the Installation & Administration Guide.

Usage

Information about how to use the IoT Agent can be found in the User & Programmers Manual.

Administration Services

Administration services are reachable at port specified by api-port property (config.properties).

Service Description
GET /status Returns a status message
GET /version Returns information about version, name and agent description
GET /commandsList Returns a list of pending commands (only with polling mode)
GET /config Returns loaded config.json file

Poll commands

Poll commands can be enabled switching polling property to true (config.properties). Once enabled poll command, you can customize the polling Daemon Frequency and Expiration time still in the (config.properties). The polling-commands-timer is referred to the feature developed, that consist in the execution of the older polling command periodically (if exists) ed delete it in case of success.

API

Apiary reference for the Configuration API can be found here More information about IoT Agents and their APIs can be found in the IoT Agent Library documentation.

Testing

For test purpose can create an OPC UA server using the code in the following GitHub repository

Firstly edit the properties in order to set Northbound (NGSI) and Southbound (OPC UA) settings.

Further information about configuration properties can be found here

For checking current status of the Agent, send a request to /status service (http://{agent-ip-address}:api-port/status)

How to get access to the advanced API and Documentation topics

Documentation about the OPC UA Administration API can be found here

Quality Assurance

This project is a new component within FIWARE and will be rated in the current release


License

The IoT Agent for OPC UA is licensed under Affero General Public License (GPL) version 3.

© 2018 Engineering Ingegneria Informatica S.p.A.

The following third-party libraries are used under license

  1. node-opcua - MIT - © 2014-2018 Etienne Rossignon
  2. iotagent-node-lib - AGPL © 2014-2018 Telefonica Investigación y Desarrollo

Are there any legal issues with AGPL 3.0? Is it safe for me to use?

No problem in using a product licensed under AGPL 3.0. Issues with GPL (or AGPL) licenses are mostly related with the fact that different people assign different interpretations on the meaning of the term “derivate work” used in these licenses. Due to this, some people believe that there is a risk in just using software under GPL or AGPL licenses (even without modifying it).

For the avoidance of doubt, the owners of this software licensed under an AGPL 3.0 license
wish to make a clarifying public statement as follows:

Please note that software derived as a result of modifying the source code of this software in order to fix a bug or incorporate enhancements is considered a derivative work of the product. Software that merely uses or aggregates (i.e. links to) an otherwise unmodified version of existing software is not considered a derivative work, and therefore it does not need to be released as under the same license, or even released as open source.

You can’t perform that action at this time.