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

Add software update capability #709

Merged
merged 39 commits into from
Jul 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
612b867
Implement Update check using DCL software information
agners May 17, 2024
17f9f54
Initial implementation of OTA provider
agners May 17, 2024
2bab7e3
Implement update using OTA Provider app
agners May 17, 2024
9d7717f
Setup OTA Provider App automatically when necessary
agners May 17, 2024
ee82e39
Deploy chip-ota-provider-app in container
agners May 23, 2024
1cf634b
Check if DCL software updates are indeed applicable
agners May 24, 2024
f698b51
Introduce hardcoded updates
agners May 24, 2024
93f3894
Split update WebSocket command into two commands
agners May 24, 2024
09a4469
Introduce Update logic specific exceptions
agners May 24, 2024
e1a5941
Implement OTA checksum verification
agners May 24, 2024
116077d
Add client commands for updates
agners May 27, 2024
5b41888
Improve DCL error message when download fails
agners May 27, 2024
4b0911c
Improve OTA Provider handling
agners May 28, 2024
70e9b60
Move almost all update logic into ExternalOtaProvider
agners May 28, 2024
c67c850
Update implementation to work with latest refactoring
agners May 29, 2024
e4bbc47
Simplify ExternalOtaProvider
agners May 30, 2024
be9ee65
Support specific version by string
agners Jun 4, 2024
3c33d5f
Use ephemeral OTA Provider instances
agners Jun 5, 2024
07b8254
Raise update error if the node moves from querying to idle
agners Jun 5, 2024
02d43d6
Improve logging and use Future to mark completion
agners Jun 5, 2024
56d5b06
Make sure that only one updates is running at a time
agners Jun 5, 2024
2f535aa
Use new commissioning API
agners Jun 20, 2024
683b33f
Ignore when there is no software version info on DCL
agners Jun 24, 2024
76ed950
Add MatterSoftwareVersion model for check_node_update
agners Jun 24, 2024
475a1dc
Bump Server schema
agners Jun 24, 2024
23a6e6b
Use OTA Provider from dedicated repository
agners Jul 11, 2024
b0dca4b
Bump OTA Provider to 2024.7.1
agners Jul 11, 2024
87cd0a4
Use new node logger
agners Jul 11, 2024
7e7537b
Complete future only once on error
agners Jul 11, 2024
7a30700
Apply suggestions from code review
agners Jul 11, 2024
07e20dd
Share client session for update check
agners Jul 11, 2024
b057eae
Provide methods to convert dataclass as dict
agners Jul 11, 2024
09c92f7
Log with node logger when checking for updates
agners Jul 11, 2024
57fb7d2
Fix trailing whitespace
agners Jul 11, 2024
9ad2348
Fix tests
agners Jul 12, 2024
507a429
ruff format
agners Jul 12, 2024
39f025e
Support loading updates from local json file
agners Jul 15, 2024
51bec82
Check if update directory exists
agners Jul 15, 2024
d4162fe
Add software update source information
agners Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ignore when there is no software version info on DCL
Don't raise an exception when there is no software version info on DCL.
It is perfectly fine to operate such nodes. An informational message is
good enough for this case.
agners committed Jul 11, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
agners Stefan Agner
commit 683b33f5eb87bb7ec8d4a1ec3a09b981f8470ead
9 changes: 8 additions & 1 deletion matter_server/server/ota/dcl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Handle OTA software version endpoints of the DCL."""

from http import HTTPStatus
import logging
from typing import Any, cast

@@ -13,11 +14,14 @@

async def _get_software_versions(vid: int, pid: int) -> Any:
"""Check DCL if there are updates available for a particular node."""
async with ClientSession(raise_for_status=True) as http_session:
async with ClientSession(raise_for_status=False) as http_session:
# fetch the paa certificates list
async with http_session.get(
f"{DCL_PRODUCTION_URL}/dcl/model/versions/{vid}/{pid}"
) as response:
if response.status == HTTPStatus.NOT_FOUND:
return None
response.raise_for_status()
return await response.json()


@@ -85,6 +89,9 @@ async def check_for_update(

# Get all versions and check each one of them.
versions = await _get_software_versions(vid, pid)
if versions is None:
LOGGER.info("There is no update information for this device on the DCL.")
return None

all_software_versions: list[int] = versions["modelVersions"]["softwareVersions"]
newer_software_versions = [