-
Notifications
You must be signed in to change notification settings - Fork 28
Define UA/runtime for WoT #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As you described, assuming a WoT Runtime is modeled as a VM. |
I agree. Let's use the full term |
As mentioned in the call on 06-03-2017 we should clarify also the relation of scripts, runtimes and things |
IMHO we have 2 options for Runtime vs Thing vs Scripts modeling.
Both models would be capable of serving Thing and script aggregation/combination use cases, but IMHO 1. is more adherent to the mission of WoT, i.e. to be an abstraction layer above IoT that connects Things not only via protocols, but to the Web. So rather than replicating or redefining the existing complex IoT models, we'd need a simple and nevertheless powerful concept. IMHO we should strive to a representation that makes runtime configurations irrelevant for or orthogonal to Thing interactions. Moreover, we should be able to move/migrate Things around runtimes without strong ties. Therefore IMHO we should try using 1. with opaque URL addressing. |
We also need to figure out how do we plan to manage scripts: provisioning, configuration, running, etc. This should be a separate deliverable than the Scripting API, but they are connected. I imagine the primary role of a script is to define, expose, represent and encapsulate a Thing with all related HW and SW (that can also contain other scripts). The Script Management Interface (SMI here) allows updating a Thing defined on a HW platform without re-flashing the device - so it's a kind of package manager, possibly connected to TD repository or even a Things Store. HW platforms can define Things without SMI support if they want to control the exposed Things' lifecycle. Most small embedded devices will fall here and we hope WoT can be fit to be supported there by manufacturers. HW platforms that expose a package manager interface, can be updated to support either Wot SMI or "Things as native packages". These are just preliminary thoughts. Please share your views. |
Scripting API deals thing lifecycle as defined in the WG charter. So SMI should be part of it. |
Based on the Current Practices, a Thing has WoT interfaces facing the external world, and the Scripting API is an internal API between a script and the model/bindings. The SMI would be an external facing API for managing scripts, so IMHO clearly different from the Scripting API. I don't know if it's good to include it into the WoT interface, or it'd better be a separate interface at similar level as the WoT interface, but either way it's not there now and we need to add it - if we need it. |
Provisioning in the broader sense is a key requirement, and for me includes the ability to update apps running on a Web of things application platform. This is broader than just script files and extends to all of the resources needed by an app. We also need to consider the resources that make up the application platform itself. These include the drivers for the supported IoT technologies as well as security related resources. Secondary storage will in many cases be on Flash memory, so I would expect this to involve updating Flash memory. |
Yes, there is provisioning that is connected to the underlying platform, for instance OCF provisioning with the resources needed (security keys, certificates, doxm resources etc). AFAIK OCF allows application specific provisioning data as well (from their point of view WoT is an application), but this might change. This part belongs to the WoT bindings since it's platform dependent. This kind of provisioning is out of scope for scripting. What I am asking is that do we need or want a mechanism to deploy WoT scripts to WoT runtimes without re-flashing (where the underlying platform supports that). This would be similar to how web pages can fetch scripts. That interface is what I referred to as SMI (script management interface). Since the main thing SMI would do is to allow fetching remote Things, @knimura is right that we might say we solve this using the Scripting API, but I would add only if the TD can contain scripts as well and we allow execution of those scripts -- to which security people would likely say no-no. So One way out would be to allow TD's to contain recipe/rule/scene/scenario definitions that are composed of operations predefined and standardized in the WG and can be security-hardened. This way when we retrieve a remote Thing (as ConsumeThing), its TD would contain these scenario definitions that the importing script could use in order to combine Things functionality. Now for that we could have support in the Scripting API - if we vote for this model. |
I'd like to clarify what kind of script would be dealed in the SMI and what the recipe/rule/scene/scenario definitions look like . |
In rationale.md you mention that a script has to get to the application layer of a Thing. I am talking about all these scripts and how exactly do they get to the Thing. If the answer is by flashing only, then IMHO WoT is just like one of the IoT islands it tries to abstract (which also try to abstract other islands). What I'd like to get is WoT provisioning based on native application concept, and then WoT applications deployed and run through a WoT interface. TD is one step towards that direction but IMHO not enough. Currently with OCF you can develop a script by reading documentation/RAML then deploy it. This can happen even via a browser, even to microcontrollers. Even though the data model is static, the scripts can be upgraded easily without re-flashing, which is IMHO more generic than just adapting to data model changes with static scripts. We could also say there are different levels of WoT configurability, on some devices WoT support will be flashed, on other you could create dynamic Things based on other Things. This could be dictated by the support level of the native platform. In any case, if we support dynamic WoT at all, we will need to define the script (or recipe) management/lifecycle - which we currently lack. |
It would be part of Scripting API if the script is related to an API and the hook. I agree this is not there yet but it would be optional function since flashing also can be the solution. |
there are much topics in a single issue, but I'll try to comment:
|
maybe to add: the SMI would indeed need two interfaces, one which is the interface I use in my script to react to lifecycle events ("you are being stopped") and one which is exposed so that others can interact with it. |
That can certainly be an option, but it's an implementation detail. We need to standardize that Thing then (possibly among others). To check this, we need to collect the use cases of such a RTI Thing and check if it's indeed the best to represent it by a Thing, or should it better be a simple built-in API object.
This is important, thanks. Then we'll need to update the API. Would these Things each have their mainloop (standalone processes) and network interfaces, or could Things in a runtime share these? If the latter, then we are close to the OCF model of having device (=runtime), resources (things) and eventually platform (= hardware board). We need to clarify this model for WoT. |
Having SMI in a runtime as "WoT Runtime Interface" would be good. |
"things" and "scripts" might need some sort of separation in a runtime from the security point of view. |
The question we need to answer: what is the entity that can be dynamically deployed: script or can it be even a Thing? Under what constraints? Do we define sandboxing, or limited operation context for scripts, or deployable Things? |
Conclusions from Meeting on 27-03-2017:
Lets gather some design examples for the scripting API of the runtime interface to deploy/start/stop/restart/delete a script |
Another input:
Continuing based on the above:
The WR provides the API object that implements functionality like:
This is far from complete, just thinking about how to handle scripts and execution contexts in a WR. To me it seems that having a main script per WR and the possibility to provide a script for an action would be flexible enough, while keeping assumptions relatively simple. @draggett : your feedback would be much appreciated. |
I am not very sure I got the reasoning behind the "main" script. Asking:
In comparison: a Webpage does not have a main. There are several scripts but the general lifetime an main loop is not one of the scripts. |
Yes, we could run multiple scripts in a WR that define Things and handlers, but we can run only one mainloop in a WR. We need a mainloop integration mechanism and one "main" script. One mainloop integration mechanism is to define actions and events on a Thing. It is transparent to clients whether Things are run in separate or shared WR. However, we may also have a use case for replacing a running main script (with all Things within) with a complete new "main" script in a given WR. We might also decide this is not possible, since what I called "main script" is basically the WR implementation and all a client can access is Things. These are just ideas: we still need to decide on the runtime structure. |
One question is whether do we want to go into the full glory of browsing context equivalent in WoT runtimes, and what would it contain. Usually a browsing context consists of a Document, a session [history], a Window, a renderer and an event loop. In WoT case (mostly headless), a WR would mean basically a mainloop (event loop) and the analogous entity to a Document. Basically I called the analogous of that Document (DOM) the "main script". |
My point/assumption would be: |
With the remark that a given HW may run multiple (isolated) WR's that may access the same sensors/actuators. |
agreed. however, would you consider the resource sharing principles be part of standardization? |
Simple (a main loop) model would be used in a device and complex (isolated) model most likely used in cloud/edge. I agree, clarification of the scope of the standardization would be necessary. |
I agree it would be out of scope for standardization (and compliance/test suite). However, the security document will likely contain recommendations on this (from threat management point of view). |
I agree most devices will have one WR, and manufacturer or solution vendor owned/certified. However, there will be WoT bridges (servients) that may need to be able to run multiple WR's. I'd consider cloud security out of scope (if falls within the security ownership of the manufacturer/solution maker), but IMHO WoT should make a threat model/checklists/recommendations on WR security (including integrity and data protection issues). This is under work now. |
Filed an issue about this on WoT WG Architecture & Security |
Signed-off-by: Zoltan Kis <[email protected]>
Signed-off-by: Zoltan Kis <[email protected]>
Signed-off-by: Zoltan Kis <[email protected]>
Signed-off-by: Zoltan Kis <[email protected]>
Signed-off-by: Zoltan Kis <[email protected]>
* Update WoT runtime related text based on discussion in #2 Signed-off-by: Zoltan Kis <[email protected]> * Update discovery API. Update ExposedThing interface. Add ConsumedThings default events. Signed-off-by: Zoltan Kis <[email protected]> * Update rationale with factories vs constructors, discovery, WoT Runtime vs Applications vs Scripts Signed-off-by: Zoltan Kis <[email protected]> * Remove rationale.html Signed-off-by: Zoltan Kis <[email protected]> * Update README Signed-off-by: Zoltan Kis <[email protected]> * Remove remote Thing management Signed-off-by: Zoltan Kis <[email protected]> * Correct text on using lower level APIs from a WoT Runtime Signed-off-by: Zoltan Kis <[email protected]> * Handle review feedback, make API consistent for events and types. Signed-off-by: Zoltan Kis <[email protected]> * Server API: add request definitions Signed-off-by: Zoltan Kis <[email protected]> * Add detailed discovery use cases. Add future use cases for TD changes in local runtimes. Remove semantic translators. Remove handlers for adding and removing property. Add options to property requests. Add discovery type for 'other' extensions. Add references to other WoT WG specifications. Signed-off-by: Zoltan Kis <[email protected]> * preparing for discussion just my 2 cents on some of the TBDs * Syntactic corrections from review. Add rationale for events. Signed-off-by: Zoltan Kis <[email protected]>
After discussion in various issues referenced above, it is now clear what is the scope of the WoT Runtime. Closing for now, reopen if needed. |
Uh oh!
There was an error while loading. Please reload this page.
A User Agent in a browser is a runtime that acts on behalf the user and is part of the security model that is based on user approval.
It is difficult to define a user for WoT.
Should we use a specific term for
WoT Runtime
, orWoT UA
or something else?Temporary formulation:
The text was updated successfully, but these errors were encountered: