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

[HVAC] Sync atomic write error order with spec #34936

Merged
merged 151 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
46d9098
Add support for Presets attributes and commands to the Thermostat clu…
nivi-apple Jul 26, 2024
5d2c740
Restyled by whitespace
restyled-commits Jul 26, 2024
f14e43e
Restyled by clang-format
restyled-commits Jul 26, 2024
dfe9f7c
Restyled by gn.
restyled-commits Jul 26, 2024
3dad3f3
Fix build error for Linux configure build of all-clusters-app
nivi-apple Jul 26, 2024
8e6db6e
Fix Darwin CI issues
nivi-apple Jul 26, 2024
362ca12
Restyled by clang-format
restyled-commits Jul 26, 2024
cb96615
More fixes
nivi-apple Jul 26, 2024
07e78e0
Restyled by clang-format
restyled-commits Jul 26, 2024
9c511bf
BUILD.gn fixes for CI
nivi-apple Jul 26, 2024
f027069
Apply suggestions from code review
nivi-apple Jul 26, 2024
a2bb5d6
Address review comments.
nivi-apple Jul 27, 2024
0147c71
Restyled by clang-format
restyled-commits Jul 27, 2024
029e9a4
Regenerate Thermostat XML from spec
hasty Jul 28, 2024
48ac309
Move atomic enum to global-enums.xml, actually
hasty Jul 26, 2024
5216415
Regenerate XML and convert thermostat-server to atomic writes
hasty Jul 28, 2024
72d114f
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 29, 2024
38d14fc
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 29, 2024
8511469
Pull in ACCapacityFormat typo un-fix
hasty Jul 29, 2024
dabf994
Update Test_TC_TSTAT_1_1 to know about AtomicResponse command.
bzbarsky-apple Jul 29, 2024
0212f7c
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 29, 2024
90a20c1
Restyled patch
hasty Jul 29, 2024
a567de4
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 29, 2024
1c49a80
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 29, 2024
aef165e
Fix weird merge with upstream
hasty Jul 29, 2024
9efed86
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 29, 2024
4c457a9
Fix emberAfIsTypeSigned not understanding temperature type
hasty Jul 29, 2024
1257477
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 29, 2024
c34a9cb
Merge fixes from atomic write branch
hasty Jul 30, 2024
4665050
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
6d2fda4
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
7acd5d4
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
8dbabb1
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
704c544
Relocate thermostat-manager sample code to all-clusters-common
hasty Jul 30, 2024
9d89cfe
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
7a4f4fd
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
6de046a
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
d67f988
Fix g++ build error on linux
hasty Jul 30, 2024
449379b
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
4c8e0a0
Fix C formatter for long int, cast whole expression
hasty Jul 30, 2024
c76e768
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
3f40391
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
5ce2df1
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
cf780e3
Sync cast fix with master
hasty Jul 30, 2024
af25396
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
c80f42d
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
b4f50f6
Add thermostat-common dependency to thermostat app under linux
hasty Jul 30, 2024
51d8aaa
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
5abc22d
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
637db40
Remove MatterPostAttributeChangeCallback from thermostat-manager, as …
hasty Jul 30, 2024
fadce3b
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
c6e07d0
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 30, 2024
4b03da7
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
0c1b853
Convert Atomic enums and structs to global
hasty Jul 30, 2024
c41d02c
Restyled patch
hasty Jul 30, 2024
924ad8f
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 30, 2024
7d8df6e
Merge branch 'master' into add_presets_to_Sdk
hasty Jul 31, 2024
31ebe9d
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Jul 31, 2024
2740112
Apply suggestions from code review
hasty Jul 31, 2024
dabc3a0
Regen with alchemy 0.6.1
hasty Aug 1, 2024
f08c0cf
Updates based on comments
hasty Aug 1, 2024
77c0dca
Add TC_MCORE_FS_1_3.py test implementation (#34650)
tehampson Jul 31, 2024
608d034
Fix most TC-SWTCH-2.4 remaining issues (#34677)
tcarmelveilleux Jul 31, 2024
dc312d7
Initial test script for Fabric Sync TC_MCORE_FS_1_2 (#34675)
cletnick Jul 31, 2024
ad792f1
Test automation for FabricSync ICD BridgedDeviceBasicInfoCluster (#34…
rochaferraz Jul 31, 2024
60d0429
ServiceArea test scripts (#34548)
plauric Jul 31, 2024
78dab72
Remove manual tests for Thermostat presets (#34679)
nivi-apple Jul 31, 2024
d7cadf9
Dump details about leaked ExchangeContexts before aborting (#34617)
ksperling-apple Jul 31, 2024
153c398
[TI] CC13x4_26x4 build fixes (#34682)
abiradarti Aug 1, 2024
b2e22c7
[ICD] Add missing polling function to NoWifi connectivity manager (#3…
mkardous-silabs Aug 1, 2024
12d0123
[OPSTATE] Add Q test script for CountdownTime (#34632)
rbultman Aug 1, 2024
9351279
YAML update to BRBINFO, ProductId (#34513)
rochaferraz Aug 1, 2024
08cb38b
Fix simplified Linux tv-casting-app gn build error. (#34692)
shaoltan-amazon Aug 1, 2024
ee27016
adding parallel execution to restyle-diff (#34663)
Alami-Amine Aug 1, 2024
aebaedb
Add some bits to exercise global structs/enums to Unit Testing cluste…
bzbarsky-apple Aug 1, 2024
1a7352f
[Silabs] Port platform specific Multi-Chip OTA work (#34440)
mykrupp Aug 1, 2024
eb59fc3
Add python tests for Thermostat presets feature (#34693)
nivi-apple Aug 1, 2024
5c6312b
removing unneccessary git fetch (#34698)
Alami-Amine Aug 1, 2024
687b1ac
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Aug 1, 2024
6cb787b
Merge branch 'master' into add_presets_to_Sdk
hasty Aug 1, 2024
b815bbd
Restyle patch
hasty Aug 1, 2024
cf97803
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Aug 1, 2024
d424a77
Regen to fix ordering of global structs
hasty Aug 1, 2024
b5410d3
Apply suggestions from code review
hasty Aug 1, 2024
353c9c1
Return correct AtomicResponse when committing or rolling back
hasty Aug 1, 2024
c58ab73
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
hasty Aug 1, 2024
f0b8e7d
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Aug 1, 2024
be7ca99
Patch tests for atomic write of presets
hasty Aug 2, 2024
23f3063
Fix tests to work with the new setup.
bzbarsky-apple Aug 2, 2024
ed59a01
Merge pull request #1 from bzbarsky-apple/pr-34570-fixup
hasty Aug 2, 2024
627e3f6
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
hasty Aug 4, 2024
0966a01
Merge branch 'master' into add_presets_to_Sdk
hasty Aug 4, 2024
c37228c
Fix PICS values for atomic requests
hasty Aug 4, 2024
ba877a8
Remove PresetsSchedulesEditable and QueuedPreset from various places
hasty Aug 4, 2024
1106e1f
Restyled patch
hasty Aug 4, 2024
18d202a
Restyled patch, again
hasty Aug 4, 2024
18325f4
Remove PICS value for PresetsSchedulesEditable
hasty Aug 4, 2024
11eda5a
clang-tidy fixes
hasty Aug 5, 2024
0478b52
clang-tidy fixes
hasty Aug 5, 2024
9a4d415
Merge branch 'add_presets_to_Sdk' of github.com:hasty/connectedhomeip…
hasty Aug 5, 2024
12aa64f
Clear associated atomic writes when fabric is removed
hasty Aug 6, 2024
520eb2f
Add tests for fabric removal and lockout of clients outside of atomic…
hasty Aug 6, 2024
62f75c4
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
hasty Aug 6, 2024
c09f01e
Python linter
hasty Aug 6, 2024
f9141fb
Restyled patch
hasty Aug 6, 2024
9fc8882
Merge branch 'master' into granbery/preset_atomic_write_fabric_index
hasty Aug 6, 2024
3d5abb5
Merge branch 'granbery/preset_atomic_write_fabric_index' of github.co…
hasty Aug 6, 2024
4c26dd4
Clear timer when fabric is removed
hasty Aug 6, 2024
2a84acb
Check for open atomic write before resetting
hasty Aug 6, 2024
98e8e2c
Merge branch 'master' into granbery/preset_atomic_write_fabric_index
hasty Aug 6, 2024
bdc747e
Revert auto delegate declaration on lines where there's no collision
hasty Aug 6, 2024
2f9a711
Allow Thermostat delegate to provide timeout for atomic requests
hasty Aug 6, 2024
1b7c152
Merge branch 'master' into granbery/preset_atomic_write_timeout
hasty Aug 6, 2024
0a5d2b8
Relocate thermostat example code to thermostat-common
hasty Aug 6, 2024
cc7f6e5
Remove thermostat-manager code, replace with thermostat delegate
hasty Aug 6, 2024
2a15976
Sync atomic write error order with spec
hasty Aug 8, 2024
c683088
Merge branch 'master' into granbery/preset_atomic
hasty Aug 12, 2024
1ea2a9a
Restyle patch
hasty Aug 12, 2024
b105a27
Drop memset of atomic write sessions
hasty Aug 12, 2024
5f2db17
Add PreCommit stage to allow rollback of multiple attributes when onl…
hasty Aug 13, 2024
04bdb52
Separate OnTimerExpired method, vs ResetWrite
hasty Aug 13, 2024
b40ad4e
Method documentation
hasty Aug 13, 2024
6eb3031
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
hasty Aug 13, 2024
c19c321
Apply suggestions from code review
hasty Aug 13, 2024
802c60c
Remove unused InWrite check
hasty Aug 13, 2024
344e28c
Drop imcode alias
hasty Aug 13, 2024
b4fc09e
Switch AtomicWriteState to enum class
hasty Aug 14, 2024
e9fa63d
DRY up atomic write manager
hasty Aug 14, 2024
c522171
Apply suggestions from code review
hasty Aug 14, 2024
23b8ec2
Drop duplicate doc comments
hasty Aug 14, 2024
345efa3
Rename GetAtomicWriteScopedNodeId to GetAtomicWriteOriginatorScopedNo…
hasty Aug 14, 2024
84ddee2
Updates based on comments
hasty Aug 14, 2024
08190ae
Merge branch 'granbery/preset_atomic' of github.com:hasty/connectedho…
hasty Aug 14, 2024
7cec405
Add MatterReportingAttributeChangeCallback calls for updated attributes
hasty Aug 14, 2024
69a41e9
Merge branch 'master' into granbery/preset_atomic
hasty Aug 16, 2024
2ecf2db
Relocate thermostat example code to thermostat-common, and remove the…
hasty Aug 21, 2024
62a9b4d
Merge atomic write code back into thermostat-server
hasty Aug 21, 2024
186630f
Merge branch 'granbery/preset_atomic_status' into granbery/preset_atomic
hasty Aug 21, 2024
dad5709
Merge remote-tracking branch 'upstream/master' into granbery/preset_a…
hasty Aug 21, 2024
a2f3500
Apply suggestions from code review
hasty Aug 22, 2024
9663f30
Fix build after suggestions
hasty Aug 22, 2024
98051bc
Actually track attribute IDs associated with atomic write
hasty Aug 22, 2024
f6ccf2e
Only commit presets if all attribute precommits were successful
hasty Aug 22, 2024
e1b7033
Fix scope on err
hasty Aug 22, 2024
1b89c4a
Add documentation to methods
hasty Aug 22, 2024
bd82243
Remove duplicate preset check.
hasty Aug 22, 2024
78c0f22
Move various functions into anonymous namespaces, or Thermostat names…
hasty Aug 22, 2024
0c395c1
Drop impossible non-atomic attribute status after rollback
hasty Aug 22, 2024
127a00b
Namespace workaround for compilers on other platforms
hasty Aug 22, 2024
179ceba
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
hasty Aug 22, 2024
0cb88a6
Apply suggestions from code review
bzbarsky-apple Aug 23, 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
ServiceArea test scripts (#34548)
* initial commit

* fix bugs

* fix issues reported by the linter

* fix bug in checking for unique areaDesc

* add TC 1.5

* Update src/python_testing/TC_SEAR_1_2.py

Co-authored-by: William <hicklin@users.noreply.github.com>

* Update src/python_testing/TC_SEAR_1_2.py

Co-authored-by: William <hicklin@users.noreply.github.com>

* address code review comments

* fix issue introduced by the previous commit

* address code review feedback

* Update src/python_testing/TC_SEAR_1_2.py

Co-authored-by: Kiel Oleson <kielo@apple.com>

* address code review feedback

* remove PICS checked by the TC_SEAR_1.6

* more code review updates

* Restyled by autopep8

---------

Co-authored-by: William <hicklin@users.noreply.github.com>
Co-authored-by: Kiel Oleson <kielo@apple.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
4 people authored and hasty committed Aug 1, 2024
commit 60d0429e537fa64e2b5754c224f7c1ae104948d9
368 changes: 368 additions & 0 deletions src/python_testing/TC_SEAR_1_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,368 @@
#
# Copyright (c) 2024 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# TODO - this was copied/pasted from another test, it needs to be reviewed and updated
# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments
# for details about the block below.
#
# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs: run1
# test-runner-run/run1/app: ${CHIP_RVC_APP}
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# === END CI TEST ARGUMENTS ===

import logging
from time import sleep

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


class TC_SEAR_1_2(MatterBaseTest):
def __init__(self, *args):
super().__init__(*args)
self.endpoint = None
self.is_ci = False
self.app_pipe = "/tmp/chip_rvc_fifo_"
self.mapid_list = []

# this must be kept in sync with the definitions from the Common Landmark Semantic Tag Namespace
self.MAX_LANDMARK_ID = 0x33

# this must be kept in sync with the definitions from the Common Relative Position Semantic Tag Namespace
self.MAX_RELPOS_ID = 0x07

async def read_sear_attribute_expect_success(self, endpoint, attribute):
cluster = Clusters.Objects.ServiceArea
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)

async def read_and_validate_supported_maps(self, step):
self.print_step(step, "Read SupportedMaps attribute")
supported_maps = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedMaps)
logging.info("SupportedMaps: %s" % (supported_maps))
asserts.assert_less_equal(len(supported_maps), 255,
"SupportedMaps should have max 255 entries")

mapid_list = [m.mapID for m in supported_maps]
asserts.assert_true(len(set(mapid_list)) == len(mapid_list), "SupportedMaps must have unique MapID values!")

name_list = [m.name for m in supported_maps]
asserts.assert_true(len(set(name_list)) == len(name_list), "SupportedMaps must have unique Name values!")

# save so other methods can use this if neeeded
self.mapid_list = mapid_list

async def read_and_validate_supported_areas(self, step):
self.print_step(step, "Read SupportedAreas attribute")
supported_areas = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas)
logging.info("SupportedAreas: %s" % (supported_areas))
asserts.assert_less_equal(len(supported_areas), 255,
"SupportedAreas should have max 255 entries")
areaid_list = []
areadesc_s = set()
for a in supported_areas:
asserts.assert_true(a.areaID not in areaid_list, "SupportedAreas must have unique AreaID values!")

areaid_list.append(a.areaID)

if len(self.mapid_list) > 0:
asserts.assert_is_not(a.mapID, NullValue,
f"SupportedAreas entry with AreaID({a.areaID}) should not have null MapID")
asserts.assert_is(a.mapID in self.mapid_list,
f"SupportedAreas entry with AreaID({a.areaID}) has unknown MapID({a.mapID})")
k = f"mapID:{a.mapID} areaDesc:{a.areaDesc}"
asserts.assert_true(k not in areadesc_s,
f"SupportedAreas must have unique MapID({a.mapID}) + AreaDesc({a.areaDesc}) values!")
areadesc_s.add(k)
else:
# empty SupportedMaps
asserts.assert_is(a.mapID, NullValue,
f"SupportedAreas entry with AreaID({a.areaID}) should have null MapID")
k = f"areaDesc:{a.areaDesc}"
asserts.assert_true(k not in areadesc_s, f"SupportedAreas must have unique AreaDesc({a.areaDesc}) values!")
areadesc_s.add(k)

if a.locationInfo is NullValue and a.landmarkTag is NullValue:
asserts.assert_true(
f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkTag")
if a.landmarkTag is not NullValue:
asserts.assert_true(a.landmarkTag <= self.MAX_LANDMARK_ID,
f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.landmarkTag})")
asserts.assert_true(a.positionTag is NullValue or a.positionTag in range(0, self.MAX_RELPOS_ID),
f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.positionTag})")
# save so other methods can use this if neeeded
self.areaid_list = areaid_list

async def read_and_validate_selected_areas(self, step):
self.print_step(step, "Read SelectedAreas attribute")
selected_areas = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SelectedAreas)
logging.info(f"SelectedAreas {selected_areas}")

# TODO how to check if all entries are uint32?

asserts.assert_true(len(selected_areas) <= len(self.areaid_list),
f"SelectedAreas(len {len(selected_areas)}) should have at most {len(self.areaid_list)} entries")

asserts.assert_true(len(set(selected_areas)) == len(selected_areas), "SelectedAreas must have unique AreaID values!")

for a in selected_areas:
asserts.assert_true(a in self.areaid_list,
f"SelectedAreas entry {a} has invalid value")
# save so other methods can use this if neeeded
self.selareaid_list = selected_areas

async def read_and_validate_current_area(self, step):
self.print_step(step, "Read CurrentArea attribute")
current_area = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea)
logging.info(f"CurrentArea {current_area}")

asserts.assert_true((len(self.selareaid_list) == 0 and current_area is NullValue)
or
current_area in self.selareaid_list,
f"CurrentArea {current_area} is invalid. SelectedAreas is {self.selareaid_list}.")
# save so other methods can use this if neeeded
self.current_area = current_area

async def read_and_validate_estimated_end_time(self, step):
import time
read_time = int(time.time())
self.print_step(step, "Read EstimatedEndTime attribute")
estimated_end_time = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.EstimatedEndTime)
logging.info(f"EstimatedEndTime {estimated_end_time}")

if self.current_area is NullValue:
asserts.assert_true(estimated_end_time is NullValue,
"EstimatedEndTime should be null if CurrentArea is null.")
else:
# allow for some clock skew
asserts.assert_true(estimated_end_time >= read_time - 3*60,
f"EstimatedEndTime({estimated_end_time}) should be greater than the time when it was read({read_time})")

async def read_and_validate_progress(self, step):
self.print_step(step, "Read Progress attribute")
progress = await self.read_sear_attribute_expect_success(
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress)
logging.info(f"Progress {progress}")

asserts.assert_true(len(progress) <= len(self.areaid_list),
f"Progress(len {len(progress)}) should have at most {len(self.areaid_list)} entries")

progareaid_list = []
for p in progress:
if p.areaID in progareaid_list:
asserts.fail("Progress must have unique AreaID values!")
else:
progareaid_list.append(p.areaID)
asserts.assert_true(p.areaID in self.areaid_list,
f"Progress entry has invalid AreaID value ({p.areaID})")
asserts.assert_true(p.status in (Clusters.ServiceArea.OperationalStatusEnum.kPending,
Clusters.ServiceArea.OperationalStatusEnum.kOperating,
Clusters.ServiceArea.OperationalStatusEnum.kSkipped,
Clusters.ServiceArea.OperationalStatusEnum.kCompleted),
f"Progress entry has invalid Status value ({p.status})")
if p.status not in (Clusters.ServiceArea.OperationalStatusEnum.kSkipped, Clusters.ServiceArea.OperationalStatusEnum.kCompleted):
asserts.assert_true(p.totalOperationalTime is NullValue,
f"Progress entry should have a null TotalOperationalTime value (Status is {p.status})")
# TODO how to check that InitialTimeEstimate is either null or uint32?

# Sends and out-of-band command to the rvc-app
def write_to_app_pipe(self, command):
with open(self.app_pipe, "w") as app_pipe:
app_pipe.write(command + "\n")
# Allow some time for the command to take effect.
# This removes the test flakyness which is very annoying for everyone in CI.
sleep(0.001)

def TC_SEAR_1_2(self) -> list[str]:
return ["SEAR.S"]

@async_test_body
async def test_TC_SEAR_1_2(self):
self.endpoint = self.matter_test_config.endpoint
asserts.assert_false(self.endpoint is None, "--endpoint <endpoint> must be included on the command line in.")
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
if self.is_ci:
app_pid = self.matter_test_config.app_pid
if app_pid == 0:
asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set")
self.app_pipe = self.app_pipe + str(app_pid)

self.print_step(1, "Commissioning, already done")

# Ensure that the device is in the correct state
if self.is_ci:
self.write_to_app_pipe('{"Name": "Reset"}')

if self.check_pics("SEAR.S.F02"):
await self.read_and_validate_supported_maps(step=2)

await self.read_and_validate_supported_areas(step=3)

await self.read_and_validate_selected_areas(step=4)

if self.check_pics("SEAR.S.A0003"):
await self.read_and_validate_current_area(step=5)

if self.check_pics("SEAR.S.A0004"):
await self.read_and_validate_estimated_end_time(step=6)

if self.check_pics("SEAR.S.A0005"):
await self.read_and_validate_progress(step=7)

if self.check_pics("SEAR.S.F02") and self.check_pics("SEAR.S.M.REMOVE_MAP"):
test_step = "Manually ensure the SupportedMaps attribute is not empty and that the device is not operating"
self.print_step("8", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_maps(step=9)
old_supported_maps = self.mapid_list

test_step = "Manually intervene to remove one or more entries in the SupportedMaps list"
self.print_step("10", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_maps(step=11)
new_supported_maps = self.mapid_list
asserts.assert_true(len(old_supported_maps) > len(new_supported_maps), "Failed to remove map(s)")

# NOTE the following operations are all part of step 11 - read all these attributes and check the data consistency
# after removing map(s)
await self.read_and_validate_supported_areas(step=11)

await self.read_and_validate_selected_areas(step=11)

if self.check_pics("SEAR.S.A0003"):
await self.read_and_validate_current_area(step=11)

if self.check_pics("SEAR.S.A0004"):
await self.read_and_validate_estimated_end_time(step=11)

if self.check_pics("SEAR.S.A0005"):
await self.read_and_validate_progress(step=11)

if self.check_pics("SEAR.S.F02") and self.check_pics("SEAR.S.M.ADD_MAP"):
test_step = "Manually ensure the SupportedMaps attribute has less than 255 entries and that the device is not operating"
self.print_step("12", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_maps(step=13)
old_supported_maps = self.mapid_list

test_step = "Manually intervene to add one or more entries to the SupportedMaps list"
self.print_step("14", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_maps(step=15)
new_supported_maps = self.mapid_list
asserts.assert_true(len(old_supported_maps) < len(new_supported_maps), "Failed to add map(s)")

# NOTE the following operations are all part of step 15 - read all these attributes and check the data consistency
# after adding map(s)
await self.read_and_validate_supported_areas(step=15)

await self.read_and_validate_selected_areas(step=15)

if self.check_pics("SEAR.S.A0003"):
await self.read_and_validate_current_area(step=15)

if self.check_pics("SEAR.S.A0004"):
await self.read_and_validate_estimated_end_time(step=15)

if self.check_pics("SEAR.S.A0005"):
await self.read_and_validate_progress(step=15)

if self.check_pics("SEAR.S.M.REMOVE_AREA"):
test_step = "Manually ensure the SupportedAreas attribute is not empty and that the device is not operating"
self.print_step("16", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_areas(step=17)
old_supported_areas = self.areaid_list

test_step = "Manually intervene to remove one or more entries from the SupportedAreas list"
self.print_step("18", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_areas(step=19)
new_supported_areas = self.areaid_list
asserts.assert_true(len(old_supported_areas) > len(new_supported_areas), "Failed to remove area(s)")

# NOTE the following operations are all part of step 19 - read all these attributes and check the data consistency
# after removing areas(s)

await self.read_and_validate_selected_areas(step=19)

if self.check_pics("SEAR.S.A0003"):
await self.read_and_validate_current_area(step=19)

if self.check_pics("SEAR.S.A0004"):
await self.read_and_validate_estimated_end_time(step=19)

if self.check_pics("SEAR.S.A0005"):
await self.read_and_validate_progress(step=19)

if self.check_pics("SEAR.S.M.ADD_AREA"):
test_step = "Manually ensure the SupportedAreas attribute has less than 255 entries and that the device is not operating"
self.print_step("20", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_areas(step=21)
old_supported_areas = self.areaid_list

test_step = "Manually intervene to add one or more entries to the SupportedAreas list"
self.print_step("22", test_step)
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.read_and_validate_supported_areas(step=23)
new_supported_areas = self.areaid_list
asserts.assert_true(len(old_supported_areas) < len(new_supported_areas), "Failed to add area(s)")

# NOTE the following operations are all part of step 23 - read all these attributes and check the data consistency
# after removing areas(s)

await self.read_and_validate_selected_areas(step=23)

if self.check_pics("SEAR.S.A0003"):
await self.read_and_validate_current_area(step=23)

if self.check_pics("SEAR.S.A0004"):
await self.read_and_validate_estimated_end_time(step=23)

if self.check_pics("SEAR.S.A0005"):
await self.read_and_validate_progress(step=23)


if __name__ == "__main__":
default_matter_test_main()
Loading