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:
[x] 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.
This PR adds OTA Updates. I will open a second PR in the next days that adds simulated nodes for testing.
TODO: