iot agents (with lightweight m2m)

27
IoT Agents (Advanced) OMA Lightweight M2M Contact email [email protected] om (Reference Orion Context Broker version: 0.21.0) p://bit.ly/fiware-iotAgents-lwm2m

Upload: dmoranj

Post on 14-Aug-2015

145 views

Category:

Software


2 download

TRANSCRIPT

Page 1: IoT Agents (With Lightweight M2M)

IoT Agents (Advanced)OMA Lightweight M2M

Contact [email protected]

(Reference Orion Context Broker version: 0.21.0)

http://bit.ly/fiware-iotAgents-lwm2m

Page 2: IoT Agents (With Lightweight M2M)

• Introduction• IOT Agents• Interaction models• Provisioning APIs• Lightweight M2M• IOT Agent development

Outline

Page 3: IoT Agents (With Lightweight M2M)

FIWARE (IoT) Target: Developers

ContextBroker

App Logic @FIWARE-Cloud

Desktop/Mobile/TabletUser Interface

Web 3D GE / Advanced UIWirecloud GE / Dashboards

OAuth2.0

SANTANDER

SMARTSPACES

SEVILLA 2) IoT Providers. Pretty Heterogeneous solutions/skills.• An incremental approach. Public/Private instances.• KISS philosophy for most (web)developers.• Advanced IoT architecture, e.g. for IoT Advanced

Devel.

1) IoT Consumers. Normally not just IoT.• A single point, API & Protocol for IoT, OpenData, etc.• Context: Data Entities + Data Entities events.• A Public & Secured Ecosystem at FIWARE Lab

MultiMediaEvents

ComplexEvent Processing

IoT GEis

SmartcitiesOpenData

BigDataAnalytics

Page 4: IoT Agents (With Lightweight M2M)

IoT – Typical Scenario I (fully tested, most used so far)

• Simplest scenario at FIWARE Wiki IoT Architecture.• Extensively tested with developers. Most Feedback Implemented. • New features are required (Edge management, more Agents).

Page 5: IoT Agents (With Lightweight M2M)

IOT Agents

• IoT Architecturehttp://bit.ly/iotArchitecture

• Motivation:– Modular approach– Deployment flexibility– Custom IOT Agents

• NGSI Bridge– Constrained set of interactions– One entity per device

• Provisioning of devices and group of devices• Additional services (e.g.: security, device registration,

stats)

Page 6: IoT Agents (With Lightweight M2M)

Interaction models: Active Attributes

IOT Agent

DB

DeviceProtocol

NGSI

Entity information

Interaction begins

Page 7: IoT Agents (With Lightweight M2M)

Interaction models: Lazy Attributes

IOT Agent

DeviceProtocol

NGSI

Entity information

Interaction begins

Requires the IOT Agent to be registered as a Context Provider

Completely synchronous model

Page 8: IoT Agents (With Lightweight M2M)

Interaction models: Commands

IOT Agent

DeviceProtocol

NGSI

CommandExecution

Interaction begins

Result Information

Requires the IOT Agent to be registered as a Context Provider

Page 9: IoT Agents (With Lightweight M2M)

Device Provisioning: Models

9

Context Broker

IoT AgentThinking Things

NGSI

HTTP (2G)

IoT AgentThinking Things

Context BrokerApp Backend

Configuration APIDevice Provisioning API

Page 10: IoT Agents (With Lightweight M2M)

Device Provisioning: Device Provisioning API

{ "name": "Light1", "entity_name": "TheFirstLight", "entity_type": "TheLightType", "attributes": [ { "name": "attr_name", "type": "string" } ], "lazy": [ { "name": "luminance", "type": "lumens" } ], "commands": [ { "name": "commandAttr", "type": "commandType" } ]}

• /iot/devices/:deviceId• REST CRUD:

– POST– GET– DELETE– PUT

• Service headers:– Fiware-service– Fiware-servicepath

• Mandatory– Name– Entity_type

• Internal_attributes

Page 11: IoT Agents (With Lightweight M2M)

Device Provisioning: Configuration API

{ services: [ { resource: '/deviceTest', apikey: '801230BJKL23Y24HV8732', type: 'Light', trust: '8970A9078A803HAMS’, commands: [], lazy: [ { name: 'luminescence', type: 'Lumens' } ], active: [ { name: 'status', type: 'Boolean' } ] } ]}

• /iot/agents/default/services

• Not exactly REST (check doc)

• Service headers:– Fiware-service– Fiware-servicepath

• Mandatory– Resource– Api_key– Type

Page 12: IoT Agents (With Lightweight M2M)

Security

• North bound: using PEP Proxies• South bound: IOTAgent specific• Use of trust tokens for communicating with other GEs

IOT Agent

PEP Proxy

PEP

Prox

y

Keystone

Page 13: IoT Agents (With Lightweight M2M)

Simple Demo: Framework Node.js

• Installationnpm install –g iotagent-node-lib

• Command line interface for testing– agentConsole– iotAgentTester

• Testing of common IOTA features– Service management– Device management– Context Provider registration

Page 14: IoT Agents (With Lightweight M2M)

Lightweight M2M IoT Agent

Page 15: IoT Agents (With Lightweight M2M)

OMA Lightweight M2M

• Based on COAP:– UDP– Lightweight payload– REST Oriented

• Interfaces:– Bootstrapping– Client registration– Device management– Information reporting

• Object model– Based on Object and Resource hierarchy (e.g.: /1/12/3)– OMA Registry

Page 16: IoT Agents (With Lightweight M2M)

OMA Lightweight M2M: operations

LWM2M Client

LWM2M Server

Register (host, port, endpoint, url)

Read /3304/0/5

Write/3304/0/5

Observe /3304/0/5

Notify /3304/0/5

Page 17: IoT Agents (With Lightweight M2M)

Lightweight M2M IOT Agent

• Github projecthttps://github.com/telefonicaid/lightweightm2m-iotagent• Work in progress• Quickstart guides• OMA Registry mapping

– Default lazy mapping for attributes not declared– Attributes can be declared as active using the resource name– Custom mappings by type using Device Provisioning API:

"internal_attributes": { "lwm2mResourceMapping": { "TheTemperature" : { "objectType": 34000, "objectInstance": 0, "objectResource": 5 } }

Page 18: IoT Agents (With Lightweight M2M)

Advanced Demo: Lightweight M2M

• Installationnpm install –g lwm2m-node-lib

• Command line interface for testing– iotagent-lwm2m-server– iotagent-lwm2m-client

• Test the protocol or the clients created

Page 19: IoT Agents (With Lightweight M2M)

Advanced Demo: Lightweight M2M IOTA

• Installationnpm install –g lightweightm2m-iotagent

• Command line interfaces for testing– In the LWM2M IOTA Project

• Testing of specific LWM2M IOTA features– Client registering– Message sending– Context Providers

Page 20: IoT Agents (With Lightweight M2M)

IoT Agent Development

Page 21: IoT Agents (With Lightweight M2M)

Building an IoT Agent: Overview

• Frameworks: Node.js and C++• North bound features provided by the platform:

– NGSI Context Provision server– NGSI Client– Device Provisioning API– Configuration API

• All South bound features are protocol specific– External library– Ad-hoc development

Page 22: IoT Agents (With Lightweight M2M)

IOT Agent

Building an IoT Agent: Node.js

• Device registry (in-memory or MongoDB)• Group Registry (in-memory or MongoDB)• Module provided in NPM Registry:

– Add it to your package.json– Require it as any other module

Context Server

NGSI Client

Dev

ice

Prot

ocol Device

Registry

GroupRegistry

Provision Server

Page 23: IoT Agents (With Lightweight M2M)

Building an IoT Agent: Node.js

• Handlers– setDataQueryHandler()– setDataUpdateHandler()– setConfigurationHandler()– setCommandHandler()

• API Operations (most important)– Activate()– Deactivate()– Register()– Update()

• Registry operations– listDevices()– getDeviceByName()

Page 24: IoT Agents (With Lightweight M2M)

Building an IoT Agent: Node.js

• Available IoT Agents– OMA Lightweight M2M– Sigfox– Thinking Things Closed

Page 25: IoT Agents (With Lightweight M2M)

Exercises

• Suggestion: deploy your local IOT Agent.• Alternative: workshop IOTAgent

– IP: 130.206.80.48– Port: 9500

• Exercise descriptions (and this presentation) in SlideShare• Prerequisites:

– Rest clients– Node.js (environment)

• Nice to have:– Node.js programming skills

Page 26: IoT Agents (With Lightweight M2M)

Resources

• Github Projects:– Node.js IOT Agent frameworkhttps://github.com/telefonicaid/iotagent-node-lib

– C++ IOT Agent frameworkhttps://github.com/telefonicaid/fiware-IoTAgent-Cplusplus

– Node.js LWM2M Libraryhttps://github.com/telefonicaid/lwm2m-node-lib

– LWM2M IOT Agenthttps://github.com/telefonicaid/lightweightm2m-iotagent

• IoT Architecture

http://bit.ly/iotArchitecture

• COAPhttps://tools.ietf.org/html/rfc7252

• Lightweight M2Mhttp://openmobilealliance.org/about-oma/work-program/m2m-enablers/

Page 27: IoT Agents (With Lightweight M2M)

BACKUP SLIDESBackup slides

27