Skip to content

Commit

Permalink
Merge branch 'master' into hyunuk-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Aug 26, 2022
2 parents 261c30d + 48a4797 commit 44ae724
Show file tree
Hide file tree
Showing 18 changed files with 573 additions and 555 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ jobs:
timeout-minutes: 40
run: |
scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"'
scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_RR_1_1.py" --script-args "--commissioning-method on-network --discriminator 1234 --passcode 20202021"'
# the below tests are broken, enable them when they are fixed.
# the below tests are broken, enable them when they are fixed. Suspect hermetic issues for now
# scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_RR_1_1.py" --script-args "--commissioning-method on-network --discriminator 1234 --passcode 20202021"'
# scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_SC_3_6.py" --script-args "--commissioning-method on-network --discriminator 1234 --passcode 20202021"'
# scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_DA_1_7.py"'
- name: Uploading core files
Expand Down
50 changes: 23 additions & 27 deletions config/nrfconnect/chip-module/generate_factory_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# - To use default certification paths set CONFIG_CHIP_FACTORY_DATA_USE_DEFAULTS_CERTS_PATH=y
#
# During generation process a some file will be created in zephyr's build directory:
# - <factory_data_target>.args a file containing arguments for nrfconnect_generate_partition.py script.
# - <factory_data_target>.json a file containing all factory data written in JSON format.
#
# [Args]:
Expand Down Expand Up @@ -80,6 +79,7 @@ string(APPEND script_args "--spake2_it \"${CONFIG_CHIP_DEVICE_SPAKE2_IT}\"\n")
string(APPEND script_args "--spake2_salt \"${CONFIG_CHIP_DEVICE_SPAKE2_SALT}\"\n")
string(APPEND script_args "--discriminator ${CONFIG_CHIP_DEVICE_DISCRIMINATOR}\n")
string(APPEND script_args "--passcode ${CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE}\n")
string(APPEND script_args "--overwrite\n")

# check if spake2 verifier should be generated using script
if(CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER)
Expand All @@ -98,15 +98,21 @@ string(APPEND script_args "--enable_key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n")
endif()

# Set output JSON file and path to SCHEMA file to validate generated factory data
string(APPEND script_args "-o \"${output_path}/${factory_data_target}.json\"\n")
set(factory_data_json ${output_path}/${factory_data_target}.json)
string(APPEND script_args "-o \"${factory_data_json}\"\n")
string(APPEND script_args "-s \"${schema_path}\"\n")

# execute first script to create a JSON file
separate_arguments(separated_script_args NATIVE_COMMAND ${script_args})
add_custom_target(${factory_data_target} ALL
add_custom_command(
OUTPUT ${factory_data_json}
DEPENDS ${FACTORY_DATA_SCRIPT_PATH}
COMMAND ${Python3_EXECUTABLE} ${FACTORY_DATA_SCRIPT_PATH} ${separated_script_args}
COMMENT "Generating new Factory Data..."
)
add_custom_target(${factory_data_target} ALL
DEPENDS ${factory_data_json}
)

endfunction()

Expand All @@ -117,17 +123,16 @@ endfunction()
#
#
# During generation process some files will be created in zephyr's build directory:
# - <factory_data_target>_cbor.args a file containing arguments for nrfconnect_generate_partition.py script.
# - <factory_data_target>.hex a file containing all factory data in CBOR format.
# - <factory_data_target>.bin a binary file containing all raw factory data in CBOR format.
# - <factory_data_target>.cbor a file containing all factory data in CBOR format.
#
# [Args]:
# factory_data_target - a name for target to generate factory_data.
# script_path - a path to script that makes a factory data .hex file from given arguments.
# output_path - a path to output directory, where created JSON file will be stored.
# output_hex - an output variable to store a .hex file. This variable can be used to merge with firmware .hex file.
function(nrfconnect_create_factory_data_hex_file factory_data_target script_path output_path output_hex)
# factory_data_hex_target - a name for target to generate factory data HEX file.
# factory_data_target - a name for target to generate factory data JSON file.
# script_path - a path to script that makes a factory data .hex file from given arguments.
# output_path - a path to output directory, where created JSON file will be stored.
function(nrfconnect_create_factory_data_hex_file factory_data_hex_target factory_data_target script_path output_path)

# Pass the argument list via file
set(cbor_script_args "-i ${output_path}/${factory_data_target}.json\n")
Expand All @@ -141,12 +146,13 @@ string(APPEND cbor_script_args "-r\n")
separate_arguments(separated_cbor_script_args NATIVE_COMMAND ${cbor_script_args})
set(factory_data_hex ${output_path}/${factory_data_target}.hex)

# return output hex to parent scope
set(${output_hex} ${factory_data_hex} PARENT_SCOPE)
add_custom_command(OUTPUT ${factory_data_hex}
COMMAND ${Python3_EXECUTABLE} ${script_path} ${separated_cbor_script_args}
COMMENT "Generating factory data HEX file..."
DEPENDS ${factory_data_target}
DEPENDS ${factory_data_target} ${script_path}
)
add_custom_target(${factory_data_hex_target}
DEPENDS ${factory_data_hex}
)

endfunction()
Expand All @@ -170,7 +176,6 @@ endif()
# Localize all scripts needed to generate factory data partition
set(FACTORY_DATA_SCRIPT_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py)
set(GENERATE_CBOR_SCRIPT_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_generate_partition.py)
SET(MERGE_HEX_SCRIPT_PATH ${CHIP_ROOT}/config/nrfconnect/chip-module/merge_factory_data.py)
set(FACTORY_DATA_SCHEMA_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_factory_data.schema)
set(OUTPUT_FILE_PATH ${APPLICATION_BINARY_DIR}/zephyr)

Expand All @@ -181,24 +186,15 @@ nrfconnect_create_factory_data_json(factory_data
${OUTPUT_FILE_PATH})

# create a .hex file with factory data in CBOR format based on the JSON file created previously
nrfconnect_create_factory_data_hex_file(factory_data
nrfconnect_create_factory_data_hex_file(factory_data_hex
factory_data
${GENERATE_CBOR_SCRIPT_PATH}
${OUTPUT_FILE_PATH}
factory_data_hex)
${OUTPUT_FILE_PATH})

if(CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
# set custom target for merging factory_data hex file
add_custom_target(factory_data_merge
DEPENDS ${factory_data_hex}
)
set_property(GLOBAL PROPERTY
factory_data_PM_HEX_FILE
${factory_data_hex}
)
set_property(GLOBAL PROPERTY
${parent_slot}_PM_TARGET
${target_name}_merge
)
set_property(GLOBAL PROPERTY factory_data_PM_HEX_FILE ${OUTPUT_FILE_PATH}/factory_data.hex)
set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data_hex)
endif()


Expand Down
18 changes: 11 additions & 7 deletions scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def gen_test_certs(chip_cert_exe: str,
product_id: int,
device_name: str,
generate_cd: bool = False,
cd_type: int = 1,
paa_cert_path: str = None,
paa_key_path: str = None):
"""
Expand Down Expand Up @@ -109,15 +110,15 @@ def gen_test_certs(chip_cert_exe: str,
"--key", CD_KEY_PATH,
"--cert", CD_PATH,
"--out", output + "/CD.der",
"--format-version", str(1),
"--format-version", "1",
"--vendor-id", hex(vendor_id),
"--product-id", hex(product_id),
"--device-type-id", "0xA",
"--certificate-id", "ZIG20142ZB330003-24",
"--security-level", str(0),
"--security-info", str(0),
"--certification-type", str(0),
"--version-number", "0x2694",
"--device-type-id", "0",
"--certificate-id", "FFFFFFFFFFFFFFFFFFF",
"--security-level", "0",
"--security-info", "0",
"--certification-type", str(cd_type),
"--version-number", "0xFFFF",
]
subprocess.run(cmd)

Expand Down Expand Up @@ -270,6 +271,7 @@ def generate_json(self):
self._args.product_id,
self._args.vendor_name + "_" + self._args.product_name,
self._args.gen_cd,
self._args.cd_type,
self._args.paa_cert,
self._args.paa_key)
dac_cert = certs.dac_cert
Expand Down Expand Up @@ -464,6 +466,8 @@ def base64_str(s): return base64.b64decode(s)
help="[string] Provide additional user-specific keys in JSON format: {'name_1': 'value_1', 'name_2': 'value_2', ... 'name_n', 'value_n'}.")
optional_arguments.add_argument("--gen_cd", action="store_true", default=False,
help="Generate a new Certificate Declaration in .der format according to used Vendor ID and Product ID. This certificate will not be included to the factory data.")
optional_arguments.add_argument("--cd_type", type=int, default=1,
help="[int] Type of generated Certification Declaration: 0 - development, 1 - provisional, 2 - official")
optional_arguments.add_argument("--paa_cert", type=str,
help="Provide a path to the Product Attestation Authority (PAA) certificate to generate the PAI certificate. Without providing it, a testing PAA stored in the Matter repository will be used.")
optional_arguments.add_argument("--paa_key", type=str,
Expand Down
9 changes: 3 additions & 6 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5157,12 +5157,6 @@ PICS:
- label: "Does the Controller DUT support Service Advertising?"
id: MCORE.SC.ADV

- label: "Does the DUT(Client) implement sending Keysetwrite Command?"
id: GRPKEY.C.C00.Tx

- label: "Does the DUT(Client) support the GroupKeyMap attribute?"
id: GRPKEY.C.A0000

#133.1. Bridged Device Basic Information Cluster
- label: "Does the DUT(server) support the DataModelRevision attribute?"
id: BRBINFO.S.A0000
Expand Down Expand Up @@ -5564,3 +5558,6 @@ PICS:
"Is the device a Client and supports subscribing for multiple
attribute"
id: MCORE.IDM.C.SubscribeRequest.MultipleAttributes

- label: "Does the device support the Factory Reset Method?"
id: MCORE.UI.FACTORYRESET
11 changes: 10 additions & 1 deletion src/app/tests/suites/certification/Test_TC_ACL_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ tests:
response:
constraints:
type: list
contains: [0, 1, 2, 3, 4, 65528, 65529, 65531, 65532, 65533]
contains: [0, 2, 3, 4, 65528, 65529, 65531, 65532, 65533]

- label: "TH reads optional attribute (Extension) in AttributeList"
PICS: ACL.S.A0001
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [1]

- label: "TH reads AcceptedCommandList attribute from DUT"
command: "readAttribute"
Expand Down
24 changes: 7 additions & 17 deletions src/app/tests/suites/certification/Test_TC_DA_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ tests:
- label:
"Factory reset DUT Perform the device discovery flow checks as covered
in TC-DD-2.2"
PICS: MCORE.UI.FACTORYRESET
verification: |
1. TH starts matter announcement procedure using BLE transport : verify this by sending
"./chip-tool discover commissionables" after launching all-clusters-app on DUT
Expand All @@ -90,31 +91,20 @@ tests:

- label: "Commission DUT to TH2s Fabric"
verification: |
To commission DUT to TH2 follow below procedure
1../chip-tool pairing open-commissioning-window 1 1 400 2000 3840 on TH
Verify manual parin code on TH1 (chip-tool) Log:
CHIP:IN: Sending encrypted msg 0xaaaad3464d10 with MessageCounter:0 to 0x0000000000000001 at monotonic time: 5805157 msec
[1635691999.946536][3822:3827] CHIP:DMG: ICR moving to [CommandSen]
[1635691999.946586][3822:3827] CHIP:CTL: Manual pairing code: [35407541839]
[1635691999.946650][3822:3827] CHIP:CTL: SetupQRCode: [MT:00000CQM00G6V851H10]
[1635691999.946802][3822:3827] CHIP:EM: Sending Standalone Ack for MessageCounter:3234931243 on exchange 35324i
[1635691999.946850][3822:3827] CHIP:IN: Prepared plaintext message 0xffffaa58a960 to 0x0000000000000000 of type 0x10 and protocolId (0, 0) on exchange 35324i with MessageCounter:1726016118.
[1635691999.946895][3822:3827] CHIP:IN: Sending plaintext msg 0xffffaa58a960 with MessageCounter:1726016118 to 0x0000000000000000 at monotonic time: 5805158 msec
[1635691999.946983][3822:3827] CHIP:EM: Flushed pending ack for MessageCounter:3234931243 on exchange 35324i
sudo ./chip-all-clusters-app --wifi
./chip-tool pairing ble-wifi 2 zigbeehome matter123 20202021 3841 --trace_decode 1
2. Verify TH2 is commissioned by using "./chip-tool pairing code 2 36199720672" considering 36199720672 as manualcode generated in TH1
Verify in TH2 log:
Verify whether you got below message on TH2 (chip-tool) log
Device commissioning completed with success
[1650455358.501816][4366:4371] CHIP:TOO: Device commissioning completed with success
disabled: true

- label:
"TH2 does a non-fabric-filtered read of Fabrics attribute list from
DUT"
verification: |
./chip-tool operationalcredentials read fabrics 2 0
./chip-tool operationalcredentials read fabrics 2 0 --commissioner-name beta
Verify there is single entry and FabricID matches the FabricID of TH2 on TH2 (chip-tool) log
Expand All @@ -133,7 +123,7 @@ tests:
- label:
"TH2 does a non-fabric-filtered read of NOCs attribute list from DUT"
verification: |
./chip-tool operationalcredentials read nocs 2 0
./chip-tool operationalcredentials read nocs 2 0 --commissioner-name beta
Verify there is single entry on TH2 (chip-tool) log
Expand Down
Loading

0 comments on commit 44ae724

Please sign in to comment.