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

Add support for configuring terms and conditions in device commissioning #173

Open
wants to merge 9 commits into
base: v2.12
Choose a base branch
from
3 changes: 1 addition & 2 deletions app/user_prompt_support/uploaded_file_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class UploadFile(Protocol):
filename: Optional[str]

@property
def content_type(self) -> Optional[str]:
...
def content_type(self) -> Optional[str]: ...
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved


@runtime_checkable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ def generate_summary(
summary_dict["test_summary_record"]["number_of_iterations_completed"] = len(
durations
)
summary_dict["test_summary_record"][
"number_of_iterations_passed"
] = compute_count_state(execution_status, True)
summary_dict["test_summary_record"][
"number_of_iterations_failed"
] = compute_count_state(execution_status, False)
summary_dict["test_summary_record"]["number_of_iterations_passed"] = (
compute_count_state(execution_status, True)
)
summary_dict["test_summary_record"]["number_of_iterations_failed"] = (
compute_count_state(execution_status, False)
)
summary_dict["test_summary_record"]["platform"] = "rpi"
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved
summary_dict["test_summary_record"]["commissioning_method"] = commissioning_method
summary_dict["test_summary_record"]["list_of_iterations_failed"] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
sdk_mandatory_python_test_collection()
)

custom_python_collection: Optional[
TestCollectionDeclaration
] = custom_python_test_collection()
custom_python_collection: Optional[TestCollectionDeclaration] = (
custom_python_test_collection()
)
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2023-2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,16 +55,28 @@ async def generate_command_arguments(
if dut_config.trace_log:
arguments.append("--trace-to json:log")

if not omit_commissioning_method:
if dut_config.enhanced_setup_flow:
arguments.append("--require-tc-acknowledgements 1")
arguments.append(
f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}"
)
arguments.append(
f"--tc-acknowledgements-version {dut_config.enhanced_setup_flow.tc_version}"
)

if omit_commissioning_method:
arguments.append(f"--in-test-commissioning-method {pairing_mode}")

else:
arguments.append(f"--commissioning-method {pairing_mode}")

if pairing_mode == DutPairingModeEnum.BLE_WIFI:
arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
if pairing_mode == DutPairingModeEnum.BLE_WIFI:
arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved

if pairing_mode == DutPairingModeEnum.BLE_THREAD:
dataset_hex = await __thread_dataset_hex(config.network.thread)
arguments.append(f"--thread-dataset-hex {dataset_hex}")
if pairing_mode == DutPairingModeEnum.BLE_THREAD:
dataset_hex = await __thread_dataset_hex(config.network.thread)
arguments.append(f"--thread-dataset-hex {dataset_hex}")
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved

# Retrieve arguments from test_parameters
if test_parameters:
Expand Down
7 changes: 7 additions & 0 deletions test_collections/matter/test_environment_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ class NetworkConfig(BaseModel):
thread: Union[ThreadAutoConfig, ThreadExternalConfig]


class EnhancedSetupFlowConfig(BaseModel):
tc_version: int
tc_user_response: int


class DutConfig(BaseModel):
discriminator: str
setup_code: str
pairing_mode: DutPairingModeEnum
chip_timeout: Optional[str]
chip_use_paa_certs: bool = False
trace_log: bool = True
enhanced_setup_flow: Optional[EnhancedSetupFlowConfig] = None


class TestEnvironmentConfigMatter(TestEnvironmentConfig):
Expand Down Expand Up @@ -99,6 +105,7 @@ def validate_model(self, dict_model: dict) -> None:
# All DutConfig fields but chip_timeout are mandatory
swan-amazon marked this conversation as resolved.
Show resolved Hide resolved
mandatory_fields = valid_properties.copy()
mandatory_fields.remove("chip_timeout")
mandatory_fields.remove("enhanced_setup_flow")
for field in mandatory_fields:
if field not in dut_config:
raise TestEnvironmentConfigMatterError(
Expand Down
Loading