Skip to content

Commit 91d1350

Browse files
committed
Updates to TC_TIMESYNC_2_1 and 2_2 test modules:
- Restored pics_TC_TIMESYNC_2_1 and pics_TC_TIMESYNC_2_2 functions - Added if check for timesource attribute ID for test step 3 in TC_TIMESYNC_2_1 test module - Updated endpoint variable to statically be set to 0
1 parent 9c6aeaf commit 91d1350

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/python_testing/TC_TIMESYNC_2_1.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,43 @@ async def read_ts_attribute_expect_success(self, endpoint, attribute):
2929
cluster = Clusters.Objects.TimeSynchronization
3030
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)
3131

32+
def pics_TC_TIMESYNC_2_1(self) -> list[str]:
33+
return ["TIMESYNC.S"]
34+
3235
@async_test_body
3336
async def test_TC_TIMESYNC_2_1(self):
34-
endpoint = self.user_params.get("endpoint", 0)
37+
endpoint = 0
3538

3639
features = await self.read_single_attribute(dev_ctrl=self.default_controller, node_id=self.dut_node_id,
3740
endpoint=endpoint, attribute=Clusters.TimeSynchronization.Attributes.FeatureMap)
41+
3842
self.supports_time_zone = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kTimeZone)
3943
self.supports_ntpc = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kNTPClient)
4044
self.supports_ntps = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kNTPServer)
4145
self.supports_trusted_time_source = bool(features & Clusters.TimeSynchronization.Bitmaps.Feature.kTimeSyncClient)
46+
timesource_attr_id = Clusters.Objects.TimeSynchronization.Attributes.TimeSource.attribute_id
47+
48+
# Reading attributes from DUT
49+
timesync_attr_list = Clusters.Objects.TimeSynchronization.Attributes.AttributeList
50+
read_request = await self.default_controller.ReadAttribute(self.dut_node_id, [timesync_attr_list])
51+
attributes_list = read_request[0]
52+
53+
# Extracting gathered attributes dictionary values into a list containing only supported attribute ids
54+
attribute_list_confined = list([values for values in attributes_list[list(attributes_list.keys())[0]].values()])[1]
4255

4356
self.print_step(1, "Commissioning, already done")
4457
attributes = Clusters.TimeSynchronization.Attributes
45-
58+
4659
self.print_step(2, "Read Granularity attribute")
4760
granularity_dut = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.Granularity)
4861
asserts.assert_less(granularity_dut, Clusters.TimeSynchronization.Enums.GranularityEnum.kUnknownEnumValue,
4962
"Granularity is not in valid range")
5063

5164
self.print_step(3, "Read TimeSource")
52-
time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeSource)
53-
asserts.assert_less(time_source, Clusters.TimeSynchronization.Enums.TimeSourceEnum.kUnknownEnumValue,
54-
"TimeSource is not in valid range")
65+
if timesource_attr_id in attribute_list_confined:
66+
time_source = await self.read_ts_attribute_expect_success(endpoint=endpoint, attribute=attributes.TimeSource)
67+
asserts.assert_less(time_source, Clusters.TimeSynchronization.Enums.TimeSourceEnum.kUnknownEnumValue,
68+
"TimeSource is not in valid range")
5569

5670
self.print_step(4, "Read TrustedTimeSource")
5771
if self.supports_trusted_time_source:

src/python_testing/TC_TIMESYNC_2_2.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ async def read_ts_attribute_expect_success(self, endpoint, attribute):
2929
cluster = Clusters.Objects.TimeSynchronization
3030
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)
3131

32+
def pics_TC_TIMESYNC_2_2(self) -> list[str]:
33+
return ["TIMESYNC.S"]
34+
3235
@async_test_body
3336
async def test_TC_TIMESYNC_2_2(self):
3437

0 commit comments

Comments
 (0)