Skip to content
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

Default version of core object is not handled correctly #1434

Closed
sbernard31 opened this issue Apr 6, 2023 · 13 comments · Fixed by #1452
Closed

Default version of core object is not handled correctly #1434

sbernard31 opened this issue Apr 6, 2023 · 13 comments · Fixed by #1452
Labels
bug Dysfunctionnal behavior core Impact core of Leshan

Comments

@sbernard31
Copy link
Contributor

sbernard31 commented Apr 6, 2023

When client send supported object to the server, it can omit the version of this object.

In Leshan we consider that a missing version always means 1.0.
But this is is not what is described in LWM2M specification concerning core object.

See :

We currently target 1.1.x. (for Leshan v2.x)
I'm not so sure to understand correctly the v1.1.x but I feel both try to describe the same idea... version 1.2.x is much clearer :

If a Core Object version does not correspond to version contained in the LwM2M Enabler release supported by the LwM2M Client, the Object Version MUST be provided by the LwM2M Client to the LwM2M Server.

Here is OMA question relative to this issue : OpenMobileAlliance/OMA_LwM2M_for_Developers#561

@JaroslawLegierski
Copy link
Contributor

Based on information about the Object 4 (Connectivity Monitoring)
In OMA Registry there is all these following versions of this Object 4:
Object_4
if the device says it support globally lwm2m version 1.1, we can see among the 4 above versions, that the Minimum Object Version compatible with LwM2M Version 1.1 is Object Version 1.2
Therefore this is not necessary to explicitly mention ver="1.2" in registration

@JaroslawLegierski
Copy link
Contributor

I also added comment in this discussion.
Together with @Warmek we preparred PoC demonstrated how this issue can be addressed in Leshan. In first commit we are using most recent object version, in second one we getting minimum value (for a given version of the lwm2m) from objects registry.
It would be great for us if "new default object versioning" could be available in the next release of Leshan.

@sbernard31
Copy link
Contributor Author

I looked at the PoC and I do not like so much the idea about giving the "responsibility" to choose the default version in LwM2mModelProvider. I feel maybe we should rather have a new dedicated class. (:warning: I didn't take to much time on this so I can change my mind)

But before to search another way, I have one question : Do we want this behavior customizable or is it OK to have hardcoded behavior which strictly follow LWM2M specification ?

It would be great for us if "new default object versioning" could be available in the next release of Leshan.

Yep, let's try to do it.

@sbernard31
Copy link
Contributor Author

About :

But before to search another way, I have one question : Do we want this behavior customizable or is it OK to have hardcoded behavior which strictly follow LWM2M specification ?

As we have doubt about how specification should be understood maybe safer to have a customizable way. 🤔
I will try to think more about this 🤔

@JaroslawLegierski
Copy link
Contributor

As we have doubt about how specification should be understood maybe safer to have a customizable way. 🤔
I will try to think more about this 🤔

We don't have response from OMA yet. We do not know when we will receive an answer and what will be the this answer. Therefore I think that customization is the best idea.

@sbernard31
Copy link
Contributor Author

I created a PR about that see #1452, you can review / test if you want.
Any feedback is welcomed.

@JaroslawLegierski
Copy link
Contributor

JaroslawLegierski commented Jun 7, 2023

I created a PR about that see #1452, you can review / test if you want.
Any feedback is welcomed.

Thank You very much ! Today I did some tests. They focused on the situation when we will need CustomLwM2mCoreObjectVersionRegistry instance (if, for example, the minimal version of the core object is needed 😉)
For InMemoryRegistrationStore I used:
builder.setRegistrationDataExtractor(new CustomDefaultRegistrationDataExtractor());
and everything works fine.

I plan to test on Monday this scenario for RedisRegistrationStore (tomorrow we have bank holiday in PL).

@sbernard31
Copy link
Contributor Author

If you need to have different default version, it is also possible to override DefaultRegistrationDataExtractor.getDefaultVersion(LwM2mVersion lwM2mVersion, int objectId)

@JaroslawLegierski
Copy link
Contributor

I finished today tests of CustomLwM2mCoreObjectVersionRegistry with RedisRegistrationStore. This feature is working correctly I'm able to define own, custom version for core objects. Thank you!

@sbernard31
Copy link
Contributor Author

Does it mean you think I should consider to integrate #1452 in master ?

@JaroslawLegierski
Copy link
Contributor

I think, it's a very good idea.

@sbernard31
Copy link
Contributor Author

This now be integrated in master.
About ambiguity in the LWM2M specification reported at OpenMobileAlliance/OMA_LwM2M_for_Developers#561, we decide to use last version of object waiting we get clarification from OMA.

See : https://github.com/eclipse/leshan/blob/cd2239184aba4d9df4d55fc8fb43f3b8f62a660a/leshan-core/src/main/java/org/eclipse/leshan/core/model/LwM2mCoreObjectVersionRegistry.java#L60-L75

@JaroslawLegierski thx for your help 🙏

@sbernard31
Copy link
Contributor Author

Just for documentation purpose, I explain more precisely our choice at : OpenMobileAlliance/OMA_LwM2M_for_Developers#561 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Dysfunctionnal behavior core Impact core of Leshan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants