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

Refactor BootstrapConfigStore to use a list of "request" #883

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

sbernard31
Copy link
Contributor

@sbernard31 sbernard31 commented Aug 31, 2020

This aims to implements : #437

@sbernard31 sbernard31 changed the base branch from master to jackson_decoder August 31, 2020 17:23
@sbernard31 sbernard31 force-pushed the bootstrap_refactoring branch from 1b8da2f to 7db5373 Compare September 4, 2020 08:42
@sbernard31
Copy link
Contributor Author

First thought about this :

Currently, to define what should be done during a bootstrap session, we need to create a BootstrapConfig.

This is a bean in which you are able to define this actions in this order :

  • delete anything,
  • write security objects,
  • write server objects,
  • write ACLs.

This has several limitation like :

  • you can not choose the order of the requests,
  • you can not write something else than security/server/acl,
  • if models change you need to upgrade/change the BootstrapConfig bean and probably serialization.

So replacing BootstrapConfig bean by a list of BootstrapDownlinkRequest sounds to resolve all those limitations, but this brings new ones :

  1. This makes bootstrap config validation very difficult. (it sounds difficult to have an equivalent for ConfigurationChecker)
  2. Creating LwM2mNode content for WriteRequest is more painful, complicated and error prone than creating BootstrapConfig

So even if this is not so much satisfying to me, maybe we should keep both API...
For issue 2. I also try a kind of experimental API to make more simple LwM2node creation.
At usage it looks like this : 7db5373#diff-cdf3b6c29cc5769b5054f2d8a660d7afR465

Working on this makes me think about other issues relative to Bootstrap server :

  1. Object Model Versioning : unlike to registration, devices does not begin bootstrap session by saying which version it supports. This could be a problem to found object models to use. (Actually I'm not sure if this is a real problem, if object models are backward compatible maybe have the last version of the object is enough)
    => If a solution is needed, we could imagine to start session with a Bootstrap discover request to know which version to use.
  2. If bootstrap server want to apply a config dynamically regarding of device states using Discover or Read request this is currently not possible.
    => Maybe a solution could be that BootstrapConfigurationStore can return read/discover requests OR delete/write requests. If read/discover is returned, once we get the result we call again BootstrapConfigurationStore with read/discover responses in parameter. If delete/write is returned, once we apply all requests we send a bootstrap finished.

@sbernard31 sbernard31 force-pushed the bootstrap_refactoring branch from 7db5373 to d80524c Compare September 14, 2020 09:45
@sbernard31 sbernard31 changed the base branch from jackson_decoder to master September 14, 2020 09:45
@sbernard31
Copy link
Contributor Author

@dachaac do you have any opinions on this ?

@dachaac
Copy link
Contributor

dachaac commented Sep 21, 2020

@sbernard31 kinda sounds into right direction and there might be a needs in certain installations to do custom object writing during bootstrapping -- at least it gives flexibility. What one need to make sure that all operations has been done successfully before bootstrap finish is issued.

About the implementation you have here -- didn't have time to look at it yet -- I will rebase my work on the master now that unsigned integer is there and push it for you for a preview on how I tried to go in between the bootstrapping process and connecting to lwm2m server. With that done we can see if there is something that should be taken into account and I can hopefully give some more though on this issue then.

@dachaac
Copy link
Contributor

dachaac commented Sep 21, 2020

@sbernard31 rebased my https://github.com/dachaac/leshan/commits/est-support branch.

It still needs tidying up and has some traces of ugliness while hacking in ;) and is missing CoAP-EST server stuff as I am wondering currently how to split it and where and what kind of interfaces would be good -- but I would say that is not related to this issue as such.

@sbernard31
Copy link
Contributor Author

About the implementation you have here -- didn't have time to look at it yet

No problem I was mainly interested about your opinion on the idea itself and the new issues it could bring. (The code is currently no so clean it's more a kind of draft)

@sbernard31
Copy link
Contributor Author

I cleaned my code and limit the scope of this PR by letting the bsserver-demo untouched.

The new BootstrapConfigurationStore replace the old BootstrapConfigStore(deprecated now).
About backward compatibility, BootstrapConfigurationStoreAdapter can be used.

About API issues raised in #883 (comment)
If we still want to keep the old BootstrapConfig bean for convenience, there is a BootstrapUtil utility to facilitate conversion to requests.
Another solution could be to explore a new API like : this experimental LwM2mNodeBuilder ...

About bsserver-demo, I didn't touch it for now, meaning it is using lot of deprecated stuff...

@sbernard31
Copy link
Contributor Author

I think this is in reviewable state now.

@sbernard31 sbernard31 requested a review from msangoi October 6, 2020 16:15
@dachaac
Copy link
Contributor

dachaac commented Oct 7, 2020

Lots of changes were just change from on way to another "in cosmetic category". Actual change seems to be the FIFO that gets generated from BootstrapConfig which is probably OK but then again you had BootstrapConfiguration which was planned to replace it?

I am not sure if BootstrapConfiguration is actually serializable in case it needs to be stored in database for persistence?

Or should this just be runtime thing and it gets generated from other config/code?

@sbernard31
Copy link
Contributor Author

I am not sure if BootstrapConfiguration is actually serializable in case it needs to be stored in database for persistence?

This is not serializable as java.io.Serializable meaning, but this is just a list of bean so we should be able to serialize this list of requests.

or should this just be runtime thing and it gets generated from other config/code?

Both are possible.
E.g : In our case in production we don't persist BootstrapConfig or BootstrapConfiguration we create it from data extracted from different places

Lots of changes were just change from on way to another "in cosmetic category". Actual change seems to be the FIFO that gets generated from BootstrapConfig which is probably OK but then again you had BootstrapConfiguration which was planned to replace it?

My first idea was to replace BootstrapConfiguration by BootstrapConfig to bring more flexibility.
But this brings new issues (see #883 (comment))
So for now I didn't get rid off old BootstrapConfig (but if we can I would prefer) or maybe we need both, one for convenience on main bootstrap objects (security, server) and the other for all other objects.

@dachaac
Copy link
Contributor

dachaac commented Oct 9, 2020

Ok. I don't see problems with the changes in here.

Just a comment on deprecated stuff -- Both LWM2M Server Demo and LWM2M Bootstrap Server Demo has a Web UI. They are built with different frameworks.

LWM2M Server is utilizing AngularJS which is going for EOL:
https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c

LWM2M Bootstrap server then again is utilizing Riot.

On my other changes I just tried to adapt what ever was used but was a bit puzzled why the difference.

Do you have some plans on this sector?

@sbernard31
Copy link
Contributor Author

Both LWM2M Server Demo and LWM2M Bootstrap Server Demo has a Web UI. They are built with different frameworks.

As demos are not the priority, we don't invest as many time we would like.
There is a lot of technical debt and the more we add features to it the more it is hard to migrate.
I will create a dedicated issue about current identified problem with our demos.

why the difference.

This is just historical reasons + lack of time.
Angular was chosen at the beginning, I don't know why (I was not in the project at this time) but the team was really disappointing by it. So when we create the bootstrap server demo we try something else : Riot.
My personal feeling is Riot is not so bad, but maybe not enough popular and so could be an obstacle for contribution.

@sbernard31
Copy link
Contributor Author

see #907

Copy link
Contributor

@msangoi msangoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sbernard31 sbernard31 deleted the bootstrap_refactoring branch January 26, 2021 16:03
sbernard31 added a commit that referenced this pull request Jun 10, 2021
After more thoughts, we decide that this was not the good approach. See
#437 (comment) for
more details.

Consequences BootstrapConfig is no more deprecated.
sbernard31 added a commit that referenced this pull request Jun 25, 2021
After more thoughts, we decide that this was not the good approach. See
#437 (comment) for
more details.

Consequences BootstrapConfig is no more deprecated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants