comparison of aws, azure, and oracle device modelsazure+oracle... · outline this presentaon takes...
TRANSCRIPT
ComparisonofAWS,Azure,andOracleDeviceModelsW3CWebofThingsOpenDay
26.3.2018,[email protected]
OutlineThispresentaJontakesafocusedviewonthedeviceconceptsintheIoTcloudplaNormsofAmazon(AWSDeviceShadows),MicrosoQ(AzureIoTHub)andOracle(IoTCloudService).Thedevicemodelforeachcloudserviceisstructuredinthefollowingway:• HighLevelConcept• DeviceDescripJon• DeviceModel• ProperJes• AcJons• Events• SerializaJonformat• CommunicaJonProtocols,MessagesandFormats,API,SecurityAcompleteoverviewofthesecloudplaNormsisbeyondthescopeofthispresentaJon–thestrikeoutsecJonsareintenJonallyleQout.
TerminologyThingorDevice
AphysicalorlogicalenJtythatismanagedbyanIoTCloudService
DeviceDescripJon(aka.ThingDescripJon)AserializedrepresentaJonofaDevice
DeviceModel(aka.DeviceTemplatesorThingTypes)Ablueprintthatdescribesthestructureandinterfaceofagroupofdevices
ProperJes,aka.AVributesorResourcesApartofthedevicethatcontainsstateinformaJonandmaychangeoverJme
Events(aka.MessagesorAlerts)
AnoJficaJonmechanismbetweentheDeviceandtheIoTCloudService
MICROSOFTAZUREIOTHUBDEVICETWINS
MicrosoQAzureIoTHub-DeviceTwinsReferences
• ThefollowingisderivedfrompublicinformaJonavailableat:
• hVps://docs.microsoQ.com/en-us/azure/iot-hub/iot-hub-node-node-getstarted
• hVps://docs.microsoQ.com/en-us/azure/iot-hub/iot-hub-devguide-query-language
• hVps://github.com/MicrosoQDocs/azure-docs/blob/master/arJcles/iot-hub/iot-hub-devguide-device-twins.md
MicrosoQAzureIoTHub-DeviceTwinsHighLevelSummary
• MicrosoQ'sdevicetwinisanabstracJonofadevicestateusing(desiredandreported)properJesandasetoftags,containingmetadatavalues.
• AcJonsandeventsarenotpartofthemodel,butarehandledbyapplicaJoncode.AcJonscancontainmulJpleparametersandtakeobjectsasparameters.
• MessagesareratherlightweightandthecontentcanbeselectedbytheapplicaJondowntopropertylevel.TheformatofthemessagesisdefinedbyapplicaJonsonly.
• Thedevicetwinmodeldoesnotdefinea"template"oramechanismtoaggregatemulJpledevicesintoacombineddevicemodel.
MicrosoQAzureIoTHubDeviceTwins
Source:MicrosoQ
Devicetwin• AdevicetwinisaJSONdocumentthatincludes:• Tags:AsecJonwherethesoluJonback-endhasaccessto.Theyarenotvisibletodeviceapps.
• Proper<es:UsedtosynchronizedeviceconfiguraJonorcondiJons.
• AllpropertyvaluescanbeofthefollowingJSONtypes:boolean,number,string,object.Arraysarenotallowed.
ProperJes3kindsofproperJes:• Desiredproper<es:CanbesetbythesoluJonbackendandread
bythedeviceapp.TheappcanalsoreceivenoJficaJonsofchanges.
• Reportedproper<es:ThedeviceappcansetreportedproperJes,andthesoluJonbackendcanreadandquerythem.
• Deviceiden<typroper<es:TherootofthedevicetwinJSONdocumentcontainstheread-onlyproperJesfromthecorrespondingdeviceidenJtystoredintheidenJtyregistry.
AcJonsAcJonsdonotcorrespondtoaformaldescripJonintheJSONdocument,butaremodeledviaposJngofapayloadtoa"method"endpoint.AnacJoncantakeanarbitrarynumberofparameters.
EventsThereisnodedicatedeventmechanism.Eventscanbemodeledbyusingdevice-to-cloudmessages,whicharebeingsentunderapplicaJoncontrol.TheeventpayloadformatisnotspecifiedintheJSONdocument.
SerializaJonformat{"deviceId":"myDeviceId","etag":"AAAAAAAAAAc=","status":"enabled","statusUpdateTime":"0001-01-01T00:00:00","connecJonState":"Disconnected", "lastActivityTime": "0001-01-01T00:00:00","cloudToDeviceMessageCount":0,"authenJcaJonType":"sas","x509Thumbprint":{"primaryThumbprint":null,"secondaryThumbprint":null},"version":2,"tags":{"locaJon":{"region":"US","plant":"Redmond43"}},"properJes":{"desired":{"telemetryConfig":{"configId":"db00ebf5-eeeb-42be-86a1-458cccb69e57","sendFrequencyInSecs":300},"$metadata":{
...},"$version":4},"reported":{"connecJvity":{"type":"cellular"},"telemetryConfig":{"configId":"db00ebf5-eeeb-42be-86a1-458cccb69e57","sendFrequencyInSecs":300,"status":"Success"},"$metadata":{...},"$version":7}}}
AWSDEVICESHADOWS
References• ThefollowingisderivedfrompublicinformaJonavailableat:
• hVps://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html
• hVps://docs.aws.amazon.com/iot/latest/developerguide/aws-iot-how-it-works.html
• hVps://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html
• hVps://docs.aws.amazon.com/iot/latest/apireference/API_OperaJons.html
HighLevelConcept• AWSIoTDeviceShadowsenableInternet-connected
devicestoconnecttotheAWSCloudandletapplicaJonsinthecloudinteractwithInternet-connecteddevices.
• DevicesreporttheirstatebypublishingmessagesinJSONformatonMQTTtopics.EachMQTTtopichasahierarchicalnamethatidenJfiesthedevicewhosestateisbeingupdated.WhenamessageispublishedonanMQTTtopic,themessageissenttotheAWSIoTMQTTmessagebroker,whichisresponsibleforsendingallmessagespublishedonanMQTTtopictoallclientssubscribedtothattopic.
Thing–DeviceModelAWSIoTprovidesaregistrytomanagethings.AthingisarepresentaJonofaspecificdeviceorlogicalenJty:aphysicaldeviceorsensororalogicalenJtylikeaninstanceofanapplicaJon.InformaJonaboutathingisstoredintheregistryasJSONdata.Hereisanexamplething:{ "version": 3,"thingName":"MyLightBulb","defaultClientId":"MyLightBulb","thingTypeName":"LightBulb", "attributes": { "model": "123", "wattage": "75" }}
ThingsareidenJfiedbyaname.ThingscanhaveaVributes,whicharename-valuepairsthatcanbeusedtostoreinformaJonaboutthething,suchasitsserialnumberormanufacturer.
Thingtypes(Templates)ThingtypesThingtypesstoredescripJonandconfiguraJoninformaJonthatiscommonforallthingsassociatedwiththesamethingtype.Thissimplifiesthemanagementofallthings.ThinggroupsAllowtomanageseveralthingsatonce.Groupscanalsocontaingroups—youcanbuildahierarchyofgroups.
AVributes/Resources/ProperJes• hVps://docs.aws.amazon.com/iot/latest/apireference/API_ThingAVribute.html
• EachaVributevalueinJSONobjectscanhaveamaximumlengthof800bytes.
• ThespecificaJonissilentaboutthesupportedaVributetypes,theexamplescontainonlysimpletypes.
• HowevertherulesengineissupporJngallJSONtypesincludingarraysandobjects.
AcJons• AcJonsdonotcorrespondtoaformaldescripJonintheJSONdocument,butaremodeledviaposJngofapayloadtoa"method"endpoint.
• AnacJoncantakeanarbitrarynumberofparameters.
Events• Thereisnodedicatedeventmechanism.Eventscanbemodeledbyusingdevice-to-cloudmessages,whicharesentunderapplicaJoncontrol.
• TheyarenotpartoftheJSONdocument.
SerializaJonformat{"deviceId":"myDeviceId","etag":"AAAAAAAAAAc=","status":"enabled","statusUpdateTime":"0001-01-01T00:00:00","connectionState":"Disconnected","lastActivityTime":"0001-01-01T00:00:00","cloudToDeviceMessageCount":0,"authenticationType":"sas","x509Thumbprint":{"primaryThumbprint":null,"secondaryThumbprint":null},"version":2,"tags":{"location":{"region":"US","plant":"Redmond43"}},"properties":{"desired":{"telemetryConfig":{"configId":"db00ebf5-eeeb-42be-86a1-458cccb69e57","sendFrequencyInSecs":300},"$metadata":{
...},"$version":4},"reported":{"connectivity":{"type":"cellular"},"telemetryConfig":{"configId":"db00ebf5-eeeb-42be-86a1-458cccb69e57","sendFrequencyInSecs":300,"status":"Success"},"$metadata":{...},"$version":7}}}
ORACLEDEVICEMODEL
ReferencesThefollowingisderivedfrompublicinformaJonavailableat:• hVps://docs.oracle.com/en/cloud/paas/iot-cloud/iotgs/toc.htm• hVps://docs.oracle.com/en/cloud/paas/iot-cloud/iotrq/index.html• hVp://www.oracle.com/technetwork/indexes/downloads/iot-client-
libraries-2705514.html • hVps://docs.oracle.com/en/cloud/paas/iot-cloud/develop/developing-device-
soQware-using-client-soQware-libraries1.html• hVp://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/iot/
IoT%20Quick%20Start%20JavaScript/IoTQuickStartJavaScript.html
HighLevelSummary• TheOracleIoTCloudServiceplaNormmanagesdevicesandcorrespondingmessages
andevents.Atthecoreoftheserviceisthedevicemodel.• Oracle’sdevicemodelisablueprintfordefiningdevices.Itcanbeusedtocreatedevice
instancesandsimulaJonswithouthavingaphysicaldeviceavailable.• Thiscansignificantlyhelptovalidatethedevicemodel,beforeactuallybuildinga
device.• SeparaJngtheblueprintfromthedeviceinstanceisusefultobuildaggregateddevices,
whichincorporatemulJpledevicemodels.• Adeviceinstanceiscreatedbyregisteringadevice,whichimplementsoneormore
devicemodels,withtheIoTcloudservice.• DevicemodelsanddevicedescripJonsaremanagedbytheIoTCloudService.Theycan
beexportedandimportedinaplainJSONformat,whichissimilartothe“WoTTD”format.
• AsimpleWoT-TD-DMconverterisavailable.
DeviceModel• Adevicemodelisacommonblueprint,thatcanbeappliedtomulJpledevices.
• Itcontainsmetadata,aVributes,acJons,formatsandlinks.
• DevicemodelsareuniquelyidenJfiablevia“urn”• AdevicecanimplementmulJpledevicemodelssimultaneously.
AVributes• AVributescanhavethefollowingtypes:number,integer,numberwithrange,integerwithrange,string,boolean,date&Jme,uri.
• ComplexaVributes(arrays,objects)areintenJonallynotincluded,sincetheintegraJonwithexisJngback-endservices(e.g.AnalyJcs)requiressimpletypes.
• AVributescanbereadonly.
AcJons• AcJonsaretriggeredbysendingapayloadtothecorrespondingendpoint.
• AcJonscancontainonlyasingleparameter.• ThereasonforthisapparentlimitaJonistoenableverylightweightimplementaJons.
• IfcomplexparameterswereneededtheycouldbeencapsulatedinaJSON-string.
Formats• Formatsdefinethepayloadstructureformessages.
• FormatsareuniquelyidenJfiablevia“urn”.• Formatsareeitherregular“data”messagesor“alert”messagesthataresentunderapplicaJoncontrol.
• Thepayloadofthealertmessageisdefinedinthe“formats”secJon.
DevicemodelserializaJonformat{"urn":"urn:com:oracle:iot:device:humidity_sensor","name":"HumiditySensor","description":"Devicemodelforsensorthatmeasureshumidity.","attributes":[{"name":"humidity","description":"Measureshumiditybetween0%and100%","type":"INTEGER","range":"0,100"},{"name":"maxThreshold","description":"Maximumhumiditythreshold","type":"INTEGER","range":"60,100","writable":true,"defaultValue":80}],"actions":[{"alias":"","description":"","name":“normalizeThreshold"}],
"formats":[{"urn":"urn:com:oracle:iot:device:humidity_sensor:too_humid","name":"tooHumidAlert","description":"Samplealertwhenhumidityreachesthemaximumhumiditythreshold","type":"ALERT","value":{"fields":[{"name":"humidity","type":"INTEGER","optional":false}]}}]}
TypicalIoTCSdeploymentscenarioIoT
CloudService
IoT
Gateway
DeviceModel
DeviceModel
MQTTDevice
CoAPDevice
Proprietaryprotocol(messages/alerts)
Apps Apps
OracleIoTClientLibrary
IoTServerRESTAPI
Apps Apps
Node-wotGateway
OracleIoT
CloudService
Node-wot+OracleIoTCloudServiceIntegraJon
DeviceModel
RESTAPI
OracleProtocol(REST/JSON)
IOTCSPlaNorm
Java/Weblogic Node.Js
ManualmappingorautomaJctranslaJon
GWexposesthings
Apps Apps
ThingDescripJon
OracleIoTClientLibrary
Gateway
Apps Apps
GWconsumesthings
3IntegraJonpointsGWconsumesdevicesexposedbyIoTCS(fromothervendors)-RequirestheGWtousetheRESTAPIoftheIoTcloudserviceIoTCSconsumesdevicesconnectedtonode-wotgateway-RequiresintegraJonoftheOracleIoTClientlibraryintotheGWMappingofthingdescrip<ontodevicemodel- Thismappingcouldbedonemanuallyinthefirststep- NoimplementaJoneffort
SUMMARY
Summary+Conclusion• The3IoTserverplaNormssharemanycommonaliJesbetweentheir
devicemodels.Howevertherearesignificantdifferences.• AWSandAzureonlydefineadatamodel,noacJonsandevents.• NoneoftheserializaJonformatsareinterchangeable.• Noneoftheformatsdefinesaprotocolbinding.• Adevicemanufacturer,whowantstoaddresstheseplaNorms,hasto
createcodefor3differentenvironments.ThismayexceedthehardwarecapabiliJesonverysmalldevices.
AunifieddevicemodelwillsimplifytheintegraJontasksacrossdifferentplaNormsandwillaccelerateIoTmarketadopJon.