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

Implement OTA Updates #62

Merged
merged 7 commits into from
Aug 4, 2024
Merged

Implement OTA Updates #62

merged 7 commits into from
Aug 4, 2024

Conversation

jonas-rem
Copy link
Member

@jonas-rem jonas-rem commented Jul 31, 2024

This PR adds OTA Updates. I will open a second PR in the next days that adds simulated nodes for testing.

  • adding a FirmwareUpdate list to the database model. The FirmwareUpdate list is keeping track of the execution of firmware updates for each endpoint. It adds references to the two required resources from server to endpoint (Send URI, execute Update). Furthermore it adds a field for the State and the Result of an update.
  • minor formatting improvements in models.py
  • Implement business logic that initiates an OTA (send PackageURI).
  • Implement remaining business logic in the base serializer. Django reacts on incoming Status/Result updates of the Update Object and updates the FirmwareUpdate representation. In addition it executes the update by default once the endpoint has downloaded the binary and notified django.

TODO:

  • Fix bug where sometimes the Execute endpoint operation is not assigned.
    • looks stable now, rarely observed a concurrency situation with the database. When switching to PostgeSQL there are more possibilities to reliably fit those.
    • In case of a failure, the update still works, just one database entry does not get assigned as expected.
  • Add documentation

LwM2M defines Execute Operations. Execute operations do not have a
payload and are send to Leshan via POST request instead of PUT request.

The LwM2M specification (Appendix C. Data Types) states that "none" "it
exclusively concerns Executable Resource". Therefore to distinguish
between execute operation and write operation the data type can be used.

Signed-off-by: Jonas Remmert <[email protected]>
Resource types are added through an initial database list. This list had
an issue and was not compliant with the LwM2M Specification.

Signed-off-by: Jonas Remmert <[email protected]>
@jonas-rem jonas-rem self-assigned this Jul 31, 2024
@jonas-rem jonas-rem force-pushed the WIP/jonas-rem/fota branch 2 times, most recently from 287035a to 3e9a9e4 Compare August 1, 2024 14:23
This was referenced Aug 2, 2024
Enable firmware update by:
- adding a FirmwareUpdate list to the database model. The FirmwareUpdate
  list is keeping track of the execution of firmware updates for each
  endpoint. It adds references to the two required resources from server
  to endpoint (Send URI, execute Update). Furthermore it adds a field
  for the State and the Result of an update.
- minor formatting improvements in models.py
- Implement business logic that initiates an OTA (send PackageURI).
- Implement remaining business logic in the base serializer. Django
  reacts on incoming Status/Result updates of the Update Object and
  updates the FirmwareUpdate representation. In addition it executes the
  update by default once the endpoint has downloaded the binary and
  notified django.

Signed-off-by: Jonas Remmert <[email protected]>
Signed-off-by: Jonas Remmert <[email protected]>
@jonas-rem jonas-rem marked this pull request as ready for review August 3, 2024 09:09
Signed-off-by: Jonas Remmert <[email protected]>
Copy link
Collaborator

@Kappuccino111 Kappuccino111 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Kappuccino111 Kappuccino111 merged commit babbb7c into main Aug 4, 2024
3 checks passed
@jonas-rem jonas-rem deleted the WIP/jonas-rem/fota branch August 4, 2024 17:03
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.

2 participants