OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

53
LwM2M Workshop 2015 Julien Vermillard - Sierra Wireless

Transcript of OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

LwM2M Workshop 2015

Julien Vermillard - Sierra Wireless

Julien Vermillard / @vrmvrm

Software Engineer at Sierra Wirelesshttp://airvantage.net M2M Cloud

Apache foundation memberEclipse committer on Californium, WakaamaEclipse Leshan project lead

Eclipse Foundation & Eclipse IoTOpen Standards and Open Source for the Internet of Things

5-Nov-2014

Eclipse History

• Launched by IBM in 2001– Initial release of the Eclipse technology platform (Platform,

JDT,PDT)– Founding consortium board comprised Borland, IBM, Red

Hat, …

• Eclipse Foundation formed in 2004– Independent not-for-profit organization formed in 2004– Definition of bylaws, membership model, initial IP process

• Eclipse Foundation today, 2014– Members include IBM, Oracle, SAP, CA, Google, Bosch, etc.– 204 members, (10 strategic members), ~1000 committers– ~270 Open Source Projects

2Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Eclipse at a Glance

• Organization – 501(c)6 not-for-profit, USA (Delaware) incorporated,

headquarters in Ottawa, Canada– 18 employees

• License– Eclipse Public License is the default – Other licenses possible by approval of the Board

• Focus areas– Most project implementations are in Java, but starting to

move into web (JavaScript) and C/C++– “Eclipse plug-in model” – Development tools, modeling tools, runtimes, web

development, IoT, Cloud

3Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Eclipse: a sustainable ecosystem

“Eclipse is a vendor-neutral consortium of major software vendors, solution providers, corporations, educational and research institutions and individuals working together to create a sustainable eco-system that enhances,promotes and cultivates the Eclipse open platformwith complementary products, services and capabilities.”

4Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Governance

IP Mgt& Licensing

Projects & Process

Ecosystem Development

Infrastructure

What do you need for open collaboration?

5Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Governance

IP Mgt& Licensing

Projects & Process

Ecossytem Developmen

t

Infra-structure

Eclipse Working Groups

• Eclipse is the industry’s best model for vendor-neutral collaboration

• Eclipse Working Groups:– Licensing model for sharing co-developed innovation

– IP management to maximize commercialization opportunities

– Project model for coordinating investments and activities

– Governance model to ensure a level playing field for all participants

Eclipse gives you these “out of the box”

6Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

7Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

IoT Architectures

Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 8

New and existing devices

IoT Gateways Backend systemsNetwork carriers

Open Source, Open Standards and Community for IoT

IoT Architectures

Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 9

New and existing devices

IoT Gateways Backend systemsNetwork carriers

Protocols

• MQTT– OASIS standard– Client and server implementations in Paho,

Mosquitto and Moquette– Wide commercial adoption: IBM MessageSight,

Facebook Messenger, Eurotech ESF, Sierra Wireless AirVantage, …

• CoAP– IETF standard– Java implementation in Californium– Lots of traction in the WSN space (Thingsquare,

Everythng, …)– Foundation for LWM2M – supported by

Sierra Wireless, Bosch SI, Zebra Technologies

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 10

Frameworks

• Application framework for IoT: Kura– Built on top of Java and OSGi

– Foundation for Eurotech’s Everyware Software Framework

• ETSI SmartM2M and oneM2M implementation: OM2M

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 11

Solutions

• Home Automation: Eclipse SmartHome– Based on Java and OSGi

– Very active community with ~100 home automation driver implementations

– Foundation for Deutsche Telekom’s QIVICON

• IoT network management: Krikkit– Rules engine for IoT devices

– Powering Cisco’s Data in Motion.

• Industrial control: EclipseSCADA

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 12

Tools

• Eclipse Vorto– Information model for « things » + code generators

– Bosch SI leading

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 13

Eclipse IoT Members

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 14

Eclipse IoT in Numbers

• 17 projects

• 90+ committers & contributors

• 1.7 Million lines of code

• 700K+ combined unique visitors

• 3 developer sandboxes (MQTT, CoAP, LWM2M)

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 15

iot.eclipse.org

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 16

Thanks! Questions?

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 17

LeshanOpen-source Lightweight M2M for Java

Directly as a library?

Copy/pasted some code? Like TLV parser?

Testing?

Leshan: Who is using it? ?

Leshan

A Java library for implementing LwM2M servers (and clients)

Friendly for any Java developer (no framework, few dependencies)

But also a Web UI for discovering and testing the protocol

History

Started 22 Jul. 2013 @ Sierra Wireless

First external contribution 10 March 2014

Public sandbox Jul. 2014

Proposed as an Eclipse project Sep. 2014

Client contributed Oct. 2014

Created at Eclipse Dec. 2014

Details

Who?

Move under Eclipse rules

New sandbox: http://leshan.eclipse.org

Committers

Simon Bernard - Sierra Wireless

Kai Hudalla - Bosch Software Innovations

J.F. Schloman - Zebra Technologies, Zatar

Manuel Sangoï - Sierra Wireless

Julien Vermillard - Sierra Wireless

Features

Client initiated bootstrap

Registration/Deregistration

Read, Write, Create objects

TLV encoding/decoding

OSGi friendly

Features

DTLS Pre shared key

DTLS Raw public key

Standalone web-UI for testing

Modules

leshan-core commons elements

leshan-server-core server lwm2m logic

leshan-server-cf californium server

leshan-client client

leshan-all everything above in 1 jar

leshan-client-example

leshan-standalone application with web UI

leshan-bs-server standalone bootstrap

leshan-integration-tests

Server

Simple Java library

Build using “mvn install”

Based on Californium and Scandium

Under refactoring for accepting other CoAP lib

Server API examplepublic void start() { // Build LWM2M server LeshanServerBuilder builder = new LeshanServerBuilder(); lwServer = builder.build(); lwServer.getClientRegistry().addListener(new ClientRegistryListener() {

@Override public void registered(Client client) { System.out.println("New registered client with endpoint: " + client.getEndpoint()); }

@Override public void updated(Client clientUpdated) { System.out.println("Registration updated”); }

@Override public void unregistered(Client client) { System.out.println("Registration deleted”); }

});

// start lwServer.start(); System.out.println("Demo server started"); }

Server API example// prepare the new valueLwM2mResource currentTimeResource = new LwM2mResource(13, Value.newDateValue(new Date()));

// send a write request to a client

WriteRequest writeCurrentTime = new WriteRequest(client, 3, 0, 13, currentTimeResource, ContentFormat.TEXT, true);

ClientResponse response = lwServer.send(writeCurrentTime);

System.out.println("Response to write request from client " + client.getEndpoint() + ": " + response.getCode());

Implements your own store

ClientRegistry: Store currently registered clients

SecurityRegistry: Store security informations

Default implementations are “in-memory”for demo only!

Client

Under construction! API will probably change

Create objects, answer to server requests

DTLS supported in master

Checkout: leshan-client-example

Next steps

Eclipse.org migration

DTLS X.509

CoAP shim, CoAP TCP

Stable API for June

To be done:

Json

SMS

Server initiated bootstrap

How to help?

Use it! Report bugs, issue, missing features

Write documentation

Talk about it (in your company, IoT meetup,...)

Contribute code

Questions?

https://dev.eclipse.org/mailman/listinfo/leshan-dev

Eclipse Wakaama

Lightweight M2M implementation in CPhoto credits: https://www.flickr.com/photos/30126248@N00/2890986348

Wakaama: Who is using it?

Directly as a library?

Copy/pasted some code?

Testing?

?

Wakaama

A C client and server implementation of LwM2M

Not a shared library (.so/.dll)

Embedded friendly but using malloc/free

Plug your own IP stack and DTLS implementation

History

Started as liblwm2m by Intel on May 2013https://github.com/01org/liblwm2m

Proposed as Eclipse project Dec. 2013

Code imported at Eclipse July 2014

Who?

David Navarro - IntelJulien Vermillard - Sierra Wireless

Features

Register, registration update, deregister

Read, write resources

Read, write, create, delete object instances

TLV or plain text

Observe

Structure

core :internals.h liblwm2m.c liblwm2m.hlist.c management.c objects.c observe.cpacket.c registration.c tlv.c transaction.curi.c utils.c

core/er-coap-13 :er-coap-13.c er-coap-13.h

Structure

tests/client:lwm2mclient.c object_device.c object_firmware.c object_location.c object_security.c object_server.c test_object.c

tests/server: lwm2mserver.c

lwm2m_object_t * get_object_device(){ lwm2m_object_t * deviceObj; deviceObj = (lwm2m_object_t *)lwm2m_malloc(sizeof(lwm2m_object_t));

if (NULL != deviceObj) { memset(deviceObj, 0, sizeof(lwm2m_object_t)); deviceObj->objID = 3;

deviceObj->readFunc = prv_device_read; deviceObj->writeFunc = prv_device_write; deviceObj->executeFunc = prv_device_execute; deviceObj->userData = lwm2m_malloc(sizeof(device_data_t));

if (NULL != deviceObj->userData) { ((device_data_t*)deviceObj->userData)->time = 1367491215; strcpy(((device_data_t*)deviceObj->userData)->time_offset, "+01:00"); } else { lwm2m_free(deviceObj); deviceObj = NULL; } }

return deviceObj;}

Create objects!

objArray[0] = get_object_device();if (NULL == objArray[0]){ fprintf(stderr, "Failed to create Device object\r\n"); return -1;}objArray[1] = get_object_firmware();if (NULL == objArray[1]){ fprintf(stderr, "Failed to create Firmware object\r\n"); return -1;}objArray[2] = get_test_object();if (NULL == objArray[2]){ fprintf(stderr, "Failed to create test object\r\n"); return -1;}

lwm2mH = lwm2m_init(prv_connect_server, prv_buffer_send, &data);if (NULL == lwm2mH){ fprintf(stderr, "lwm2m_init() failed\r\n"); return -1;}result = lwm2m_configure(lwm2mH, "testlwm2mclient", BINDING_U, NULL, OBJ_COUNT, objArray);...

result = lwm2m_start(lwm2mH);

ConfigureWakaama

while (0 == g_quit){ struct timeval tv; tv.tv_sec = 60; tv.tv_usec = 0;

/* * This function does two things: * - first it does the work needed by liblwm2m (eg. (re)sending some packets). * - Secondly it adjust the timeout value (default 60s) depending on the state of the transaction * (eg. retransmission) and the time between the next operation */ result = lwm2m_step(lwm2mH, &tv); if (result != 0) { fprintf(stderr, "lwm2m_step() failed: 0x%X\r\n", result); return -1; }

Active loop

Next?

Device initiated bootstrap

More example: https://github.

com/jvermillard/Wakaama-mbed

Server?

Block transfer?

Hack it into real devices!

Courtesy of Bosch Software Innovations!

Spark Core

Cortex-M3 STM32, RAM/ROM 20/128k, 72MHzWiFi

wakaama (old: 09.2014 version)+TinydTLS-0.5:

ROM/RAM: 75,6kB/13,1kB

U-blox MBed.org

Cortex-M3 (NXP LPC1768), RAM/ROM 20/128k, 96MHzGPRS

Current BOSCH wakaama-snapshot:

Function: observe, attribute:

Objects: server, security, device, conn_m, firmware, location,

ROM/RAM: 84kB/22kB

Arduino

AVR, ATmega2560, RAM/ROM 8/256k, 16MHzEthernet

Current BOSCH wakaama-snapshot:

Function: observe, attribute:

Objects: server, security, device, conn_m, firmware, location,

ROM/RAM: 67kB/5kB

Lua binding

https://github.com/sbernard31/lualwm2m

With DTLS support using:https://github.com/sbernard31/luadtlsbinding on http://tinydtls.sf.net