|
109 | 109 | from chip.clusters.ClusterObjects import ClusterAttributeDescriptor, ClusterObjectFieldDescriptor
|
110 | 110 | from chip.interaction_model import InteractionModelError, Status
|
111 | 111 | from chip.tlv import uint
|
112 |
| -from global_attribute_ids import GlobalAttributeIds |
| 112 | +from global_attribute_ids import AttributeIdType, ClusterIdType, GlobalAttributeIds, attribute_id_type, cluster_id_type |
113 | 113 | from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, MatterBaseTest, TestStep,
|
114 | 114 | async_test_body, default_matter_test_main)
|
115 | 115 | from mobly import asserts
|
|
118 | 118 | separate_endpoint_types)
|
119 | 119 |
|
120 | 120 |
|
| 121 | +def get_vendor_id(mei: int) -> int: |
| 122 | + """Get the vendor ID portion (MEI prefix) of an overall MEI.""" |
| 123 | + return (mei >> 16) & 0xffff |
| 124 | + |
| 125 | + |
121 | 126 | def check_int_in_range(min_value: int, max_value: int, allow_null: bool = False) -> Callable:
|
122 | 127 | """Returns a checker for whether `obj` is an int that fits in a range."""
|
123 | 128 | def int_in_range_checker(obj: Any):
|
@@ -488,15 +493,17 @@ class RequiredMandatoryAttribute:
|
488 | 493 | cmd_prefixes = [a & 0xFFFF_0000 for a in cmd_values]
|
489 | 494 | bad_attrs = [a for a in attr_prefixes if a >= bad_prefix_min]
|
490 | 495 | bad_cmds = [a for a in cmd_prefixes if a >= bad_prefix_min]
|
491 |
| - for bad in bad_attrs: |
492 |
| - location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=bad) |
| 496 | + for bad_attrib_id in bad_attrs: |
| 497 | + location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=bad_attrib_id) |
| 498 | + vendor_id = get_vendor_id(bad_attrib_id) |
493 | 499 | self.record_error(self.get_test_name(
|
494 |
| - ), location=location, problem=f'Attribute with bad prefix {attribute_id} in cluster {cluster_id}', spec_location='Manufacturer Extensible Identifier (MEI)') |
| 500 | + ), location=location, problem=f'Attribute 0x{bad_attrib_id:08x} with bad prefix 0x{vendor_id:04x} in cluster 0x{cluster_id:08x}' + (' (Test Vendor)' if attribute_id_type(bad_attrib_id) == AttributeIdType.kTest else ''), spec_location='Manufacturer Extensible Identifier (MEI)') |
495 | 501 | success = False
|
496 |
| - for bad in bad_cmds: |
497 |
| - location = CommandPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, command_id=bad) |
| 502 | + for bad_cmd_id in bad_cmds: |
| 503 | + location = CommandPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, command_id=bad_cmd_id) |
| 504 | + vendor_id = get_vendor_id(bad_cmd_id) |
498 | 505 | self.record_error(self.get_test_name(
|
499 |
| - ), location=location, problem=f'Command with bad prefix {attribute_id} in cluster {cluster_id}', spec_location='Manufacturer Extensible Identifier (MEI)') |
| 506 | + ), location=location, problem=f'Command 0x{bad_cmd_id:08x} with bad prefix 0x{vendor_id:04x} in cluster 0x{cluster_id:08x}', spec_location='Manufacturer Extensible Identifier (MEI)') |
500 | 507 | success = False
|
501 | 508 |
|
502 | 509 | self.print_step(7, "Validate that none of the MEI global attribute IDs contain values outside of the allowed suffix range")
|
@@ -539,10 +546,11 @@ class RequiredMandatoryAttribute:
|
539 | 546 | for endpoint_id, endpoint in self.endpoints_tlv.items():
|
540 | 547 | cluster_prefixes = [a & 0xFFFF_0000 for a in endpoint.keys()]
|
541 | 548 | bad_clusters_ids = [a for a in cluster_prefixes if a >= bad_prefix_min]
|
542 |
| - for bad in bad_clusters_ids: |
543 |
| - location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=bad) |
| 549 | + for bad_cluster_id in bad_clusters_ids: |
| 550 | + location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=bad_cluster_id) |
| 551 | + vendor_id = get_vendor_id(bad_cluster_id) |
544 | 552 | self.record_error(self.get_test_name(), location=location,
|
545 |
| - problem=f'Bad cluster id prefix {bad}', spec_location='Manufacturer Extensible Identifier (MEI)') |
| 553 | + problem=f'Cluster 0x{bad_cluster_id:08x} with bad prefix 0x{vendor_id:04x}' + (' (Test Vendor)' if cluster_id_type(bad_cluster_id) == ClusterIdType.kTest else ''), spec_location='Manufacturer Extensible Identifier (MEI)') |
546 | 554 | success = False
|
547 | 555 |
|
548 | 556 | self.print_step(9, "Validate that all clusters in the standard range have a known cluster ID")
|
|
0 commit comments