Skip to content

Commit c192e2d

Browse files
tehampsonrestyled-commits
authored andcommitted
Update ECOINFO cluster to reflect latest spec text (project-chip#35285)
--------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 15532a3 commit c192e2d

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ constexpr size_t kUniqueLocationIdMaxSize = 64;
3434
constexpr size_t kUniqueLocationIdsListMaxSize = 64;
3535
constexpr size_t kLocationDescriptorNameMaxSize = 128;
3636

37-
constexpr size_t kDeviceDirectoryMaxSize = 256;
38-
constexpr size_t kLocationDirectoryMaxSize = 64;
39-
4037
class AttrAccess : public AttributeAccessInterface
4138
{
4239
public:
@@ -264,7 +261,6 @@ CHIP_ERROR EcosystemInformationServer::AddDeviceInfo(EndpointId aEndpoint, std::
264261
VerifyOrReturnError((aEndpoint != kRootEndpointId && aEndpoint != kInvalidEndpointId), CHIP_ERROR_INVALID_ARGUMENT);
265262

266263
auto & deviceInfo = mDevicesMap[aEndpoint];
267-
VerifyOrReturnError((deviceInfo.mDeviceDirectory.size() < kDeviceDirectoryMaxSize), CHIP_ERROR_NO_MEMORY);
268264
deviceInfo.mDeviceDirectory.push_back(std::move(aDevice));
269265
return CHIP_NO_ERROR;
270266
}
@@ -282,7 +278,6 @@ CHIP_ERROR EcosystemInformationServer::AddLocationInfo(EndpointId aEndpoint, con
282278
EcosystemLocationKey key = { .mUniqueLocationId = aLocationId, .mFabricIndex = aFabricIndex };
283279
VerifyOrReturnError((deviceInfo.mLocationDirectory.find(key) == deviceInfo.mLocationDirectory.end()),
284280
CHIP_ERROR_INVALID_ARGUMENT);
285-
VerifyOrReturnError((deviceInfo.mLocationDirectory.size() < kLocationDirectoryMaxSize), CHIP_ERROR_NO_MEMORY);
286281
deviceInfo.mLocationDirectory[key] = std::move(aLocation);
287282
return CHIP_NO_ERROR;
288283
}

src/app/zap-templates/zcl/data-model/chip/ecosystem-information-cluster.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ limitations under the License.
4444
<server init="false" tick="false">true</server>
4545
<!-- cluster revision -->
4646
<globalAttribute code="0xFFFD" side="either" value="1"/>
47-
<attribute code="0x0000" side="server" define="DEVICE_DIRECTORY" type="array" entryType="EcosystemDeviceStruct" length="256" minLength="1">
47+
<attribute code="0x0000" side="server" define="DEVICE_DIRECTORY" type="array" entryType="EcosystemDeviceStruct">
4848
<description>DeviceDirectory</description>
4949
<access op="read" privilege="manage"/>
5050
</attribute>
51-
<attribute code="0x0001" side="server" define="LOCATION_DIRECTORY" type="array" entryType="EcosystemLocationStruct" length="64" minLength="1">
51+
<attribute code="0x0001" side="server" define="LOCATION_DIRECTORY" type="array" entryType="EcosystemLocationStruct">
5252
<description>LocationDirectory</description>
5353
<access op="read" privilege="manage"/>
5454
</attribute>

src/python_testing/TC_ECOINFO_2_1.py

+30-9
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@
2525

2626
class TC_ECOINFO_2_1(MatterBaseTest):
2727

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):
3129
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+
3343
if device.deviceName is not None:
3444
asserts.assert_true(type_matches(device.deviceName, str), "DeviceName should be a string")
3545
asserts.assert_less_equal(len(device.deviceName), 64, "DeviceName should be <= 64")
@@ -72,10 +82,20 @@ def _validate_device_directory(self, device_directory):
7282
if num_of_unique_location_ids:
7383
asserts.assert_greater(device.uniqueLocationIDsLastEdit, 0, "UniqueLocationIdsLastEdit must be non-zero")
7484

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):
7886
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+
7999
asserts.assert_true(type_matches(location.uniqueLocationID, str), "UniqueLocationId should be a string")
80100
location_id_string_length = len(location.uniqueLocationID)
81101
asserts.assert_greater_equal(location_id_string_length, 1,
@@ -120,6 +140,7 @@ async def test_TC_ECOINFO_2_1(self):
120140
self.wait_for_user_input(
121141
"Paused test to allow for manufacturer to satisfy precondition where one or more bridged devices of a supported type is connected to DUT")
122142

143+
current_fabric_index = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.CurrentFabricIndex)
123144
self.step(1)
124145
endpoint_wild_card_read = await dev_ctrl.ReadAttribute(dut_node_id, [(Clusters.EcosystemInformation.Attributes.ClusterRevision)])
125146
list_of_endpoints = list(endpoint_wild_card_read.keys())
@@ -134,7 +155,7 @@ async def test_TC_ECOINFO_2_1(self):
134155
attribute=Clusters.EcosystemInformation.Attributes.DeviceDirectory,
135156
fabricFiltered=False)
136157

137-
self._validate_device_directory(device_directory)
158+
self._validate_device_directory(current_fabric_index, device_directory)
138159

139160
if idx == 0:
140161
self.step(3)
@@ -145,7 +166,7 @@ async def test_TC_ECOINFO_2_1(self):
145166
attribute=Clusters.EcosystemInformation.Attributes.LocationDirectory,
146167
fabricFiltered=False)
147168

148-
self._validate_location_directory(location_directory)
169+
self._validate_location_directory(current_fabric_index, location_directory)
149170

150171
if idx == 0:
151172
self.step(4)

0 commit comments

Comments
 (0)