Iotivity's Architecture
Total Page:16
File Type:pdf, Size:1020Kb
IoTivity Architecture Ashok Subash Samsung Electronics R & D Institute Bangalore 1 Agenda • IoTivity Overview • IoTivity Architecture • IoTivity Base Layer & APIs • IoTivity Primitive Services & APIs • IoTivity Roadmap 2 IoTivity Overview OCF Topologies Supported • An open source software framework implementing OCF Standards OCF Client OCF Server • Ensures seamless device-to-device P2P Direct connectivity to address emerging needs of IoT OCF Client OCF Client • Licensed under Apache License XMPP/ Cloud STUN/ TURN/ICE Version 2.0 CoAP over TCP OCF Intermediary • Available on TIZEN, Android, Arduino, Gateway Gateway Linux(Ubuntu) Platforms OCF Servers OCF IoTivity OCF Servers Cloud based (Standards) (Open Source) Remote Access intelligent Services 3 IoTivity – High Level Architecture Rich Device Key Goals Consumer Enterprise Industrial Automotive Health …. APIs Common Solution (C/C++/Java/JS) Established Protocols Service Layer Security & Identity Lite Device Device Low-Power Data Standardized Profiles Management Management Management Sensing/Control Application Interoperability Resource Resource Encapsulation Innovation Opportunities Container Base Layer Necessary connectivity Base Layer Messaging Security Discovery Messaging Security Discovery IoTivity Profiles IoTivity Framework IoTivity Connectivities* 4 IoTivity Base Layer & APIs 5 Discovery Subsystem Client announce resource multicast COAP C C OCF “OCF/server” listen OCF [ port 5683 ] Server COAP Server Client HTTP Gateway C C COAP C [ Figure 1 ] Multicast announcement over Wi-Fi / Ethernet Server Discovery within Constrained local network multicast find Environment listen resource [ port 5683 ] OCF OCF Internet Server unicast response “OCF/server” Client Connectivity Discovery Description Mechanism CoAP [ Figure 2 ] Multicast/Unicast over WiFi / Ethernet WiFi & IP Multicast CoAP Multicast Port: 5683 • Open IETF Standard (RFC 7252) Ethernet (Assigned by IANA) • Compact 4 Byte Header advertise scan (over IP) CoAP Secure Port: 5684 • UDP (Default), SMS, TCP OCF service OCF service IP Unicast Precondition: Support • Strong DTLS Security OCF OCF over UDP OIC Server Address & Port are find resource • Asynchronous Subscription Server Client known • Built-In Discovery response “OCF/server” Bluetooth Using Scan & OCF Specific Service UUID (EDR & Advertise [ Figure 3 ] Advertise/Scan over BLE/BT BLE) CoAP: Constrained Application Protocol IANA: Internet Assigned Numbers Authority 6 Discovery – Finding a Resource Function Call Flow Sequence Diagram Application 1 6 OCPlatform::findResource(host, “/light/1”, OCF Light Light Fan connectivityType, resourceHandlerCb); Client 192.168.1.11 192.168.1.12 192.168.1.21 C++ API (SDK) GET /oc/core?rt=light (IP multicast) OCDoResource(resourceHandle, OC_REST_GET, “/light/1”, GET /oc/core?rt=light 2 5 0, payLoad, connectivityType, qos, &cbData, (multicast) headerOptions, numOptions); Sends a GET /oc/core?rt=light C API (SDK) multicast (multicast) CASendRequest(endPoint, requestInfo); JSON/CBOR query Encode/ OCStack Decoder //Devices that matches the query answers as indicated below ACK,CONTENT Connectivity Abstraction CoAP IoTivity IoTivity IoTivity Device Device Device ACK, CONTENT 3 Multicast 4 7 Messaging - Connectivity Abstraction Resource Model CA Control Component - Target network selection, interface control & monitoring CA API - CoAP message serialization & parsing CA Control Network CoAP Blockwise Interface - Block-wise messaging flow control Config. Protocol Transfer Controller Transport Adapter Component Transport Adapter - Data transmission over UDP, TCP, BLE(GATT), BT(SPP) & NFC IP BLE BT TCP NFC Adapter Adapter Adapter Adapter Adapter - Secure data exchanging using DTLS Platform Adapter Platform Adapter Component Ubuntu Android Tizen Arduino Interface Interface Interface Interface - Wi-Fi, Ethernet and BLE - Android Wi-Fi, BLE and BT Ubuntu Android Tizen Arduino - Tizen Wi-Fi, BLE and BT - Arduino Wi-Fi, Ethernet and BLE Legend CA Component CA Module External Ubuntu Android Tizen Arduino 8 Messaging - Remote Access over XMPP STUN/ Signaling DM TURN Server Server GW/Proxy RA Server S1 S2 S3 (LW) (LW) (cRA) C1 Local subnet (RA) Feature - Remote client discover & securely interface with resource servers when not on same subnet - Adheres to access control policies - End-to-End Secure Device Type Use Case Light weight (LW) Device Accessible within subnet. No RA, require GW/proxy device for access Constrained RA (cRA) RA access for non latency-sensitive, low BW applications Endpoint RA Endpoint (RA) Full RA access 9 Messaging – CoAP over TCP TCP and TLS Transport for the CoAP CoAP Default transport - UDP. 3rd Service 3rd Service • Reliable delivery, simple congestion control & flow 3rd Service 3rd Service control • Provided by the message layer of CoAP CoAP over TCP Benefits . CoAP CI(*) Server RD(**) Server • To integrate well with existing enterprise infrastructure, • Ability to work with existing NAT boxes • Advanced Congestion Control algorithms • Integration with Web Environment CoAP over TCP for Cloud extension Resources should be registered to the Resource Directory Service for discovery * CI : Cloud Interface ** RD : Resource Directory 10 Message Switching To Pass IoTivity messages through heterogeneous network Uses DSDV* routing algorithm Table-driven routing scheme for ad-hoc mobile network Uses CoAP Option *Destination-Sequenced Distance-Vector Routing Source Source Address Destination Destination Address Multicast Length Length Sequence No. 1 Byte Length specified in Source 1 Byte Length Specified in Destination 1 Byte Length Length 11 Programming IoTivity Base APIs Steps Involved • Registering a Resource • Finding a Resource OCF Client OCF Server • Querying a Resource State ISV Client IoTivity Client Client Server Server IoTivity ISV Server App SDK Wrapper OCStack OCStack Wrapper SDK App • Setting a Resource State ocresource.get(callBack) • Observing Resource State clientWrapper.get(callBack) OCDoResource Application Profiles GET /light/1 Call entity handler Call OCResource Call OCResource IoTivity Services Return code Return code Return code ACK, CONTENT IoTivity Base API wrapperAsyncCallbackFunc Base Layer asyncResultHandler Resource Messaging Discovery Security Introspection Connectivity Abstraction Querying a Resource State: Sequence Diagram 12 IoTivity Security 13 Security Features & Architecture Key Functionality 1) Onboarding Resource Introspection (RI) layer PM C API 2) Ownership Transfer Secure Resource Manager (SRM) Provisioning Manager (PM) 3) Provisioning layer 4) Access Control Ownership Provisioning Resource Policy Engine Transfer Manager Database Secure Virtual Manager (RM) (PE) (OTM) Manager (PDM) Provisioning Provisioning Database Database Manager Persistent (Admin Device) Storage Secure Resource Provider (SRP) Interface (PSI) Ownership Transfer Ownership Transfer Credential(Key)/ Connectivity Abstraction (CA) layer Credential(Key) ACL Provisioning Provisioning DTLS modules, etc. DTLSDTLS modules, modules, etc. etc. X Security Subsystem Architecture Resource Access Access Denied over DTLS Resource Client Client (Provisioned) Server (Provisioned) (Un-Provisioned) 14 *Platform Hardening not part of the OCF Specs & IoTivity Implementation IoTivity Primitive Services & APIs 15 Purpose of Primitive Services Provides easier and simpler APIs for App developers (Heavy Lifting done by Framework) Soft Sensor Manager Multi-Phy Protocol Easy Setup Bridge Mostly designed to run on Smart or Controller devices Notification Simulator Uses the Iotivity Base APIs Service Primitive Resource Services Scene Applications Directory Manager Resource Resource Server Primitive Services Container Resource Builder Broker IoTivity Base 16 Resource Encapsulation Resource Module Description Container Resource Broker • Remote Resource Presence check (regardless of Remote Server supporting Resource Encapsulation presence feature) Resource • Provide consistent reachability management for discovered resource of Client Wrapper Server interest Builder Resource Resource Resource Cache Broker Cache • Maintains last information of Remote Resource (regardless of Remote Server is observable) • Data Centric API (Send/Recv Message Getter/Setter, Data Cache) IoTivity Base Server Builder • Att. setter to provide easy way to create resource • Changes “msg Handling” to “Data Setting” for users • Monitors value of attributes so that notify-back for observation whenever attribute has changed 17 Protocol Bridge using Resource Container • Integrates non-OCF resources (Bundle) • Handles dynamic loading of resource Maps OCF to bundles & dynamic creation of resources 2. Loads resource Hue light bundles hueLight.cpp • Supports C++ .so files & Java .jar files OCF hueToOCF.so light • Common configuration for bundles and interface configured resources OCF light interface OCF bridge (with resource container) OCF 1. Loads Designed to work devices with non light configuration interface OCF devices containerConfig.xml (resource instance Enables control of legacy devices specific configuration) which are already in market with existing APIs using a OIC complaint device 18 Scene Manager Helps Users to create a Scenario or Scene for controlling “ “Away Home” Scene Multiple IoT devices & their functionality LED Bulb e.g. Away Home – All Lights turned off, Doors locked 15 C Watching Movie – Living Room lights off, TV On, Speaker On Thermostat Door Lock 0. Discover1. Create Scene 2. Add Scene to 3. Add SceneAction 4. Execute Resources Collection