25
25
26
26
class TC_ECOINFO_2_1 (MatterBaseTest ):
27
27
28
- def _validate_device_directory (self , device_directory ):
29
- num_of_devices = len (device_directory )
30
- asserts .assert_less_equal (num_of_devices , 256 , "Too many device entries" )
28
+ def _validate_device_directory (self , current_fabric_index , device_directory ):
31
29
for device in device_directory :
32
- # TODO do fabric index check first
30
+ if current_fabric_index != device .fabricIndex :
31
+ # Fabric sensitve field still exist in python, just that they have default values
32
+ asserts .assert_equal (device .deviceName , None , "Unexpected value in deviceName" )
33
+ asserts .assert_equal (device .deviceNameLastEdit , None , "Unexpected value in deviceNameLastEdit" )
34
+ asserts .assert_equal (device .bridgedEndpoint , 0 , "Unexpected value in bridgedEndpoint" )
35
+ asserts .assert_equal (device .originalEndpoint , 0 , "Unexpected value in originalEndpoint" )
36
+ asserts .assert_true (type_matches (device .deviceTypes , list ), "DeviceTypes should be a list" )
37
+ asserts .assert_equal (len (device .deviceTypes ), 0 , "DeviceTypes list should be empty" )
38
+ asserts .assert_true (type_matches (device .uniqueLocationIDs , list ), "UniqueLocationIds should be a list" )
39
+ asserts .assert_equal (len (device .uniqueLocationIDs ), 0 , "uniqueLocationIDs list should be empty" )
40
+ asserts .assert_equal (device .uniqueLocationIDsLastEdit , 0 , "Unexpected value in uniqueLocationIDsLastEdit" )
41
+ continue
42
+
33
43
if device .deviceName is not None :
34
44
asserts .assert_true (type_matches (device .deviceName , str ), "DeviceName should be a string" )
35
45
asserts .assert_less_equal (len (device .deviceName ), 64 , "DeviceName should be <= 64" )
@@ -72,10 +82,20 @@ def _validate_device_directory(self, device_directory):
72
82
if num_of_unique_location_ids :
73
83
asserts .assert_greater (device .uniqueLocationIDsLastEdit , 0 , "UniqueLocationIdsLastEdit must be non-zero" )
74
84
75
- def _validate_location_directory (self , location_directory ):
76
- num_of_locations = len (location_directory )
77
- asserts .assert_less_equal (num_of_locations , 64 , "Too many location entries" )
85
+ def _validate_location_directory (self , current_fabric_index , location_directory ):
78
86
for location in location_directory :
87
+ if current_fabric_index != location .fabricIndex :
88
+ # Fabric sensitve field still exist in python, just that they have default values
89
+ asserts .assert_equal (location .uniqueLocationID , "" , "Unexpected value in uniqueLocationID" )
90
+ asserts .assert_equal (location .locationDescriptor .locationName , "" ,
91
+ "Unexpected value in locationDescriptor.locationName" )
92
+ asserts .assert_equal (location .locationDescriptor .floorNumber , NullValue ,
93
+ "Unexpected value in locationDescriptor.floorNumber" )
94
+ asserts .assert_equal (location .locationDescriptor .areaType , NullValue ,
95
+ "Unexpected value in locationDescriptor.areaType" )
96
+ asserts .assert_equal (location .locationDescriptorLastEdit , 0 , "Unexpected value in locationDescriptorLastEdit" )
97
+ continue
98
+
79
99
asserts .assert_true (type_matches (location .uniqueLocationID , str ), "UniqueLocationId should be a string" )
80
100
location_id_string_length = len (location .uniqueLocationID )
81
101
asserts .assert_greater_equal (location_id_string_length , 1 ,
@@ -120,6 +140,7 @@ async def test_TC_ECOINFO_2_1(self):
120
140
self .wait_for_user_input (
121
141
"Paused test to allow for manufacturer to satisfy precondition where one or more bridged devices of a supported type is connected to DUT" )
122
142
143
+ current_fabric_index = await self .read_single_attribute_check_success (cluster = Clusters .OperationalCredentials , attribute = Clusters .OperationalCredentials .Attributes .CurrentFabricIndex )
123
144
self .step (1 )
124
145
endpoint_wild_card_read = await dev_ctrl .ReadAttribute (dut_node_id , [(Clusters .EcosystemInformation .Attributes .ClusterRevision )])
125
146
list_of_endpoints = list (endpoint_wild_card_read .keys ())
@@ -134,7 +155,7 @@ async def test_TC_ECOINFO_2_1(self):
134
155
attribute = Clusters .EcosystemInformation .Attributes .DeviceDirectory ,
135
156
fabricFiltered = False )
136
157
137
- self ._validate_device_directory (device_directory )
158
+ self ._validate_device_directory (current_fabric_index , device_directory )
138
159
139
160
if idx == 0 :
140
161
self .step (3 )
@@ -145,7 +166,7 @@ async def test_TC_ECOINFO_2_1(self):
145
166
attribute = Clusters .EcosystemInformation .Attributes .LocationDirectory ,
146
167
fabricFiltered = False )
147
168
148
- self ._validate_location_directory (location_directory )
169
+ self ._validate_location_directory (current_fabric_index , location_directory )
149
170
150
171
if idx == 0 :
151
172
self .step (4 )
0 commit comments