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

legacy flag added #37921

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ class MatterTestConfig:
# path to device attestation revocation set json file
dac_revocation_set_path: Optional[pathlib.Path] = None

legacy: bool = False


class ClusterMapper:
"""Describe clusters/attributes using schema names."""
Expand Down Expand Up @@ -1206,6 +1208,20 @@ async def send_single_cmd(
payloadCapability=payloadCapability)
return result

async def check_legacy_test_event_triggers(self, eventTrigger: int) -> int:
target_endpoint = 0

if self.matter_test_config.legacy:
logger.info("Legacy test event trigger activated")
else:
logger.info("Legacy test event trigger deactivated")
target_endpoint = self.get_endpoint()

# Sets endpoint in eventTrigger
eventTrigger = eventTrigger | (target_endpoint << 32)

return eventTrigger

async def send_test_event_triggers(self, eventTrigger: int, enableKey: bytes = None):
"""This helper function sends a test event trigger to the General Diagnostics cluster on endpoint 0

Expand All @@ -1222,13 +1238,11 @@ async def send_test_event_triggers(self, eventTrigger: int, enableKey: bytes = N
else:
enableKey = self.matter_test_config.global_test_params['enableKey']

eventTrigger = await self.check_legacy_test_event_triggers(eventTrigger)

try:
# GeneralDiagnostics cluster is meant to be on Endpoint 0 (Root)
await self.send_single_cmd(endpoint=0,
cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(
enableKey,
eventTrigger)
)
await self.send_single_cmd(endpoint=0, cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey, eventTrigger))

except InteractionModelError as e:
asserts.fail(
Expand Down Expand Up @@ -1862,6 +1876,8 @@ def convert_args_to_matter_config(args: argparse.Namespace) -> MatterTestConfig:
config.app_pid = 0 if args.app_pid is None else args.app_pid
config.fail_on_skipped_tests = args.fail_on_skipped

config.legacy = True if args.use_legacy_test_event_triggers else args.use_legacy_test_event_triggers

config.controller_node_id = args.controller_node_id
config.trace_to = args.trace_to

Expand Down Expand Up @@ -1920,6 +1936,9 @@ def parse_matter_test_args(argv: Optional[List[str]] = None) -> MatterTestConfig
basic_group.add_argument('--timeout', type=int, help="Test timeout in seconds")
basic_group.add_argument("--PICS", help="PICS file path", type=str)

basic_group.add_argument("--use-legacy-test-event-triggers", action="store_true", default=False,
help="Send test event triggers with endpoint 0 for older devices")

commission_group = parser.add_argument_group(title="Commissioning", description="Arguments to commission a node")

commission_group.add_argument('-m', '--commissioning-method', type=str,
Expand Down
Loading