-
Notifications
You must be signed in to change notification settings - Fork 375
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
Not acceptable to replace subset of resources with object write? #674
Comments
(warning I don't really know Wakaama behavior but I can try to answer at LWM2M level) Just to be sure what you call "object replace" is "send a WRITE request targeting an object with replace mode" ? But targeting an object is not allowed by the LWM2M specification, object instance Id is required.
(source : LWM2M v1.1.1@core§Table: 6.3.3.-1 Write Parameters) So let's suppose you "object replace" means "Send a WRITE request targeting object instance with replace mode".
Using Replace Mode will erase existing LWM2M node with the new one you provide. The specification says :
(source : LWM2M v1.1.1@core§6.3.3. Write Operation/V1_1_1-20190617-A/HTML-Version/OMA-TS-LightweightM2M_Core-V1_1_1-20190617-A.html#6-3-3-0-633-Write-Operation) So my understanding is that you don't need to put resource you don't want to write. |
Hi and thanks for the speedy response! Assuming we "Send a WRITE request targeting object instance with replace mode" in this case, should we:
Our implementation uses lwm2m v1.0 if that matters |
AFAIK, on this particular point the LWM2M specification is identical in v1.0.x and v1.1.x :
|
I would then assume that it is option 1 that is the correct way to do this:
Meaning this https://github.com/eclipse/wakaama/blob/89b9d3efda98ce66c33c233f4a5d9cdcb3f45aa7/core/objects.c#L391 Might be because of this conflict in the spec? OpenMobileAlliance/OMA_LwM2M_for_Developers#551 |
Oh OK, I didn't get the question, It's much clear now I guess generally both should works but the specification doesn't explicitly say how this should be encoded ... so this could differ from one implementation to another E.g : For SenML+json from LWM2M v1.1.x : we never get a clear answer about that : OpenMobileAlliance/OMA_LwM2M_for_Developers#494 I tested with Leshan and it support both with some different behavior depending on content format. Let's suppose you have an instance 0 of object 3441 which looks like :
1. if you try to write
All content format will behave the same way and resource /3441/0/1120 will not exist anymore, if you try to read it you get 404 NON_FOUND. 2. if you try to write
All content format will behave like above ☝️ (return NOT FOUND) except for TLV. |
Not sure it's really a bug as the specification is inconsistent but maybe it would be better to support both case. |
Did you try, the 2. way ? Does it work ? |
Following discussion at : eclipse-wakaama/wakaama#674
From my understanding, when we try method 2, our wakaama client rejects the "/3441/0/1120 : { }" part of the write with error code COAP_406_NOT_ACCEPTABLE. |
Arf mandatory resource ... another not clear topic of the LWM2M specification : OpenMobileAlliance/OMA_LwM2M_for_Developers#77 (comment)
That's surprise me, I don't remember there is a kind of checks like this... 🤔 |
I don't remember there is this kind of check at Leshan Server side but anyway if it exits it make sense. Is it a custom Model created by you OR a registered Model from OMA ? But again I think the best will be to support method 2 at wakaama side. It would be great to get feedback from wakaama team ? |
I will see if I can find out more info tomorrow |
A followup question for this: If we implement support for method 2 in wakaama, what should be returned when the resource is read in this case? NOT_FOUND or CONTENT + empty resource? |
Ideally, I agree. In practice, I think that an empty resource or no resource at all (NOT FOUND) is not the same semantically speaking. But we can not implement this for all ContentFormat because some Content Format encodes both exactly in the same way. Eg. for SenML JSON
will be encoded in
and
will also be encoded in :
So I don't know if it is better to :
|
Hi,
I have an object with three multiple type resources. I would like to be able to write either all of them, a subset of them, or one of them using object replace.
If I want to write new values to a subset of the resources using an object replace, I specify the new values for the resources I want to write as well as no value, empty brackets, for the resources I don't want to write. But that makes Wakaama return "NOT_ACCEPTABLE".
I can't find any mention in the LWM2M-specification (v. 1.0) that you're not allowed to write an empty instance to a resource.
Is this a bug in Wakaama or am I using the wrong method to achieve what I want?
Thank you and best regards,
Sam
The text was updated successfully, but these errors were encountered: