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

chip-repl runner: support missing features needed to yaml tests #34130

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 0 additions & 33 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,50 +226,17 @@ def _GetChipReplUnsupportedTests() -> Set[str]:
return {
"Test_AddNewFabricFromExistingFabric.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command
"Test_TC_OPCREDS_3_7.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command
"TestEqualities.yaml", # chip-repl does not support pseudo-cluster commands that return a value
"TestExampleCluster.yaml", # chip-repl does not load custom pseudo clusters
"TestAttributesById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
"TestCommandsById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
"TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023)
"TestReadNoneSubscribeNone.yaml", # chip-repl does not support AnyCommands (07/27/2023)
"Test_TC_DRLK_2_8.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27011#issuecomment-1593339855
"Test_TC_ACE_1_6.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27910#issuecomment-1632485584
"Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023)
"TestGroupKeyManagementCluster.yaml", # chip-repl does not support EqualityCommands (2023-08-04)
"TestIcdManagementCluster.yaml", # TODO(#30430): add ICD registration support in chip-repl
"Test_TC_ICDM_3_4.yaml", # chip-repl does not support ICD registration
"Test_TC_S_2_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_MOD_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_MOD_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_MOD_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_MOD_3_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_BRBINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_DGGEN_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_DGGEN_2_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_LWM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_LWM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_LWM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_OTCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_OTCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_OTCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_G_2_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_RVCRUNM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_RVCCLEANM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_TCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_TCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_TCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_TCTL_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
# chip-repl and chip-tool disagree on what the YAML here should look like: https://github.com/project-chip/connectedhomeip/issues/29110
"TestClusterMultiFabric.yaml",
"Test_TC_ACL_2_5.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884
"Test_TC_ACL_2_6.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884
"Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_BINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate
"Test_TC_EEVSEM_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_EEVSEM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_EEVSEM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_EEVSEM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"TestDiagnosticLogsDownloadCommand.yaml", # chip-repl does not implement the bdx download command
}

Expand Down
18 changes: 10 additions & 8 deletions src/controller/python/chip/yaml/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@
from chip.exceptions import ChipStackError
from chip.yaml.data_model_lookup import DataModelLookup
from chip.yaml.errors import ActionCreationError, UnexpectedActionCreationError
from matter_yamltests.pseudo_clusters.clusters.delay_commands import DelayCommands
from matter_yamltests.pseudo_clusters.clusters.log_commands import LogCommands
from matter_yamltests.pseudo_clusters.clusters.system_commands import SystemCommands
from matter_yamltests.pseudo_clusters.pseudo_clusters import PseudoClusters
from matter_yamltests.pseudo_clusters.pseudo_clusters import get_default_pseudo_clusters

from .data_model_lookup import PreDefinedDataModelLookup

_PSEUDO_CLUSTERS = PseudoClusters([DelayCommands(), LogCommands(), SystemCommands()])
_PSEUDO_CLUSTERS = get_default_pseudo_clusters()
logger = logging.getLogger('YamlParser')


Expand Down Expand Up @@ -129,8 +126,8 @@ def __init__(self, test_step):
raise ActionCreationError(f'Default cluster {test_step.cluster} {test_step.command}, not supported')

async def run_action(self, dev_ctrl: ChipDeviceController) -> _ActionResult:
_ = await _PSEUDO_CLUSTERS.execute(self._test_step)
return _ActionResult(status=_ActionStatus.SUCCESS, response=None)
response = await _PSEUDO_CLUSTERS.execute(self._test_step)
return _ActionResult(status=_ActionStatus.SUCCESS, response=response[0])


class InvokeAction(BaseAction):
Expand Down Expand Up @@ -884,8 +881,12 @@ def decode(self, result: _ActionResult):
response = result.response

decoded_response = {}
if isinstance(response, dict):
return response

if isinstance(response, chip.interaction_model.InteractionModelError):
decoded_response['error'] = stringcase.snakecase(response.status.name).upper()
decoded_response['clusterError'] = response.clusterStatus
return decoded_response

if isinstance(response, chip.interaction_model.Status):
Expand Down Expand Up @@ -939,12 +940,13 @@ def decode(self, result: _ActionResult):
cluster_id = event.Header.ClusterId
cluster_name = self._test_spec_definition.get_cluster_name(cluster_id)
event_id = event.Header.EventId
event_number = event.Header.EventNumber
event_name = self._test_spec_definition.get_event_name(cluster_id, event_id)
event_definition = self._test_spec_definition.get_event_by_name(cluster_name, event_name)
is_fabric_scoped = bool(event_definition.is_fabric_sensitive)
decoded_event = Converter.from_data_model_to_test_definition(
self._test_spec_definition, cluster_name, event_definition.fields, event.Data, is_fabric_scoped)
decoded_response.append({'value': decoded_event})
decoded_response.append({'value': decoded_event, 'eventNumber': event_number})
return decoded_response

if isinstance(response, ChipStackError):
Expand Down
Loading