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

Model fields fixes #588

Merged
merged 31 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
845aba9
fixed 0 bit model validations
DenisRybas Aug 1, 2024
4efa4c7
fixed message tests
DenisRybas Aug 1, 2024
522cb51
fixed model CLI tests
DenisRybas Aug 1, 2024
9032130
updated integration tests
DenisRybas Aug 1, 2024
953d0e2
updated https validation in model
DenisRybas Aug 1, 2024
defb1c4
updated model static validations
DenisRybas Aug 1, 2024
8fc23f6
added new field, updated validations and tests
DenisRybas Aug 1, 2024
4f4ff4c
updated CLI commands
DenisRybas Aug 1, 2024
940e2da
linted
DenisRybas Aug 1, 2024
7b1f215
fixed model tests
DenisRybas Aug 2, 2024
7582332
fixed tests
DenisRybas Aug 2, 2024
f5b9c75
debug
DenisRybas Aug 2, 2024
eae8884
fixed failing tests
DenisRybas Aug 2, 2024
9bfdd6f
uncommented tests
DenisRybas Aug 2, 2024
f7d28b8
processed comments
DenisRybas Aug 2, 2024
6dc67a8
int32 -> uint32 for discoveryCapabilitiesBitmask
DenisRybas Aug 2, 2024
c1743ed
added unit tests for static validations
DenisRybas Aug 2, 2024
4c676eb
updated tests and validations
DenisRybas Aug 2, 2024
03c4076
simplified validation logic
DenisRybas Aug 2, 2024
91985c9
simplified validation logic
DenisRybas Aug 2, 2024
1ac61a1
removed DiscoveryCapabilitiesBitmask field
DenisRybas Aug 2, 2024
43f4bd3
uncommented all tests
DenisRybas Aug 2, 2024
b4a39d6
made model url startswith https:
DenisRybas Aug 2, 2024
5166267
processed comments
DenisRybas Aug 2, 2024
61f3a2f
added EnhancedSetupFlowTCRevision check
DenisRybas Aug 2, 2024
7e7f701
updated tests and errors
DenisRybas Aug 2, 2024
26ebd81
updated docs
DenisRybas Aug 2, 2024
0a8021d
Merge branch 'master' of https://github.com/zigbee-alliance/distribut…
DenisRybas Aug 2, 2024
032719b
updated checksum
DenisRybas Aug 2, 2024
de343fd
reverted update checksum
DenisRybas Aug 2, 2024
6f5b5f0
Fix URL validation; added more tests
ashcherbakov Aug 6, 2024
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
2 changes: 2 additions & 0 deletions docs/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ a new model info with a new `vid` or `pid` can be created.

All non-edited fields remain the same.

If one of EnhancedSetupFlow or MaintenanceUrl fields needs to be updated, ALL EnhancedSetupFlow fields MUST be specified, and EnhancedSetupFlowOptions field must have bit 0 set.

- Parameters:
- vid: `uint16` - model vendor ID (positive non-zero)
- pid: `uint16` - model product ID (positive non-zero)
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/cli/auth-demo-hex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test_divider

productName="Device #1"
echo "$user adds Model with VID: $vid_in_hex_format PID: $pid"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=1 --from=$user_address --yes)
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=0 --from=$user_address --yes)
result=$(get_txn_result "$result")
check_response_and_report "$result" "\"code\": 0"

Expand All @@ -86,7 +86,7 @@ test_divider
vid_plus_one_in_hex_format=0xA14
vidPlusOne=$((vid_in_hex_format+1))
echo "$user adds Model with a VID: $vid_plus_one_in_hex_format PID: $pid_in_hex_format, This fails with Permission denied as the VID is not associated with this vendor account."
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_plus_one_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=1 --from=$user_address --yes 2>&1) || true
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_plus_one_in_hex_format --pid=$pid_in_hex_format --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=0 --from=$user_address --yes 2>&1) || true
result=$(get_txn_result "$result")
check_response_and_report "$result" "transaction should be signed by a vendor account containing the vendorID $vidPlusOne"

Expand Down
6 changes: 3 additions & 3 deletions integration_tests/cli/auth-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ vid=$RANDOM
pid=$RANDOM
productName="Device #2"
echo "$user adds Model with VID: $vid PID: $pid"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=1 --from=$user_address --yes 2>&1) || true
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=0 --from=$user_address --yes 2>&1) || true
check_response_and_report "$result" "key not found" raw


Expand Down Expand Up @@ -1335,15 +1335,15 @@ test_divider

productName="Device #1"
echo "$user adds Model with VID: $vid PID: $pid"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=1 --from=$user_address --yes)
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=0 --from=$user_address --yes)
result=$(get_txn_result "$result")
check_response_and_report "$result" "\"code\": 0"

test_divider

vidPlusOne=$((vid+1))
echo "$user adds Model with a VID: $vidPlusOne PID: $pid, This fails with Permission denied as the VID is not associated with this vendor account."
result=$(echo "test1234" | dcld tx model add-model --vid=$vidPlusOne --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=1 --from=$user_address --yes 2>&1) || true
result=$(echo "test1234" | dcld tx model add-model --vid=$vidPlusOne --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --enhancedSetupFlowOptions=0 --from=$user_address --yes 2>&1) || true
result=$(get_txn_result "$result")
check_response_and_report "$result" "transaction should be signed by a vendor account containing the vendorID $vidPlusOne"

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/cli/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ create_model_and_version() {
local _softwareVersion="$3"
local _softwareVersionString="$4"
local _user_address="$5"
result=$(echo "$passphrase" | dcld tx model add-model --vid=$_vid --pid=$_pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=1 --from=$_user_address --yes)
result=$(echo "$passphrase" | dcld tx model add-model --vid=$_vid --pid=$_pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=0 --from=$_user_address --yes)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
result=$(echo "$passphrase" | dcld tx model add-model-version --cdVersionNumber=1 --maxApplicableSoftwareVersion=10 --minApplicableSoftwareVersion=1 --vid=$_vid --pid=$_pid --softwareVersion=$_softwareVersion --softwareVersionString=$_softwareVersionString --from=$_user_address --yes)
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/cli/compliance-demo-hex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ matter_certification_type="matter"
cd_certificate_id="some ID"

echo "Add Model with VID: $vid_in_hex_format PID: $pid_in_hex_format"
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=1 --from $vendor_account --yes)
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=0 --from $vendor_account --yes)
result=$(get_txn_result "$result")
echo $result
check_response "$result" "\"code\": 0"
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/cli/compliance-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ check_response "$result" "No model version"
test_divider

echo "Add Model with VID: $vid PID: $pid"
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=1 --from $vendor_account --yes)
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=0 --from $vendor_account --yes)
result=$(get_txn_result "$result")
echo $result
check_response "$result" "\"code\": 0"
Expand Down Expand Up @@ -551,7 +551,7 @@ svs=$RANDOM

# ADD MODEL
echo "Add Model with VID: $vid PID: $pid"
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --enhancedSetupFlowOptions=1 --commissioningCustomFlow=0 --from $vendor_account --yes)
result=$(echo "$passphrase" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel=TestingProductLabel --partNumber=1 --enhancedSetupFlowOptions=0 --commissioningCustomFlow=0 --from $vendor_account --yes)
result=$(get_txn_result "$result")
echo $result
check_response "$result" "\"code\": 0"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/cli/model-demo-hex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test_divider

productLabel="Device #1"
echo "Add Model with VID: $vid_in_hex_format PID: $pid_in_hex_format"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=1 --from=$vendor_account --yes)
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_in_hex_format --pid=$pid_in_hex_format --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=0 --from=$vendor_account --yes)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
echo "$result"
Expand Down
18 changes: 9 additions & 9 deletions integration_tests/cli/model-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ test_divider
productLabel="Device #1"
schema_version_1=1
schema_version_2=2
enhancedSetupFlowOptions_1=1
enhancedSetupFlowOptions_0=0
echo "Add Model with VID: $vid PID: $pid"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_1 --schemaVersion=$schema_version_2 --from=$vendor_account --yes)
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_0 --schemaVersion=$schema_version_2 --from=$vendor_account --yes)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
echo "$result"

test_divider

productLabel="Device #1"
enhancedSetupFlowOptions_0=0
enhancedSetupFlowOptions_1=1
enhancedSetupFlowTCUrl="https://example.org/file.txt"
enhancedSetupFlowTCRevision=1
enhancedSetupFlowTCDigest="MWRjNGE0NDA0MWRjYWYxMTU0NWI3NTQzZGZlOTQyZjQ3NDJmNTY4YmU2OGZlZTI3NTQ0MWIwOTJiYjYwZGVlZA=="
enhancedSetupFlowTCFileSize=1024
maintenanceUrl="https://example.org"
echo "Add Model with VID: $vid_with_pids PID: $pid"
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_with_pids --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 \
result=$(echo "test1234" | dcld tx model add-model --vid=$vid_with_pids --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_1 \
--enhancedSetupFlowTCUrl=$enhancedSetupFlowTCUrl --enhancedSetupFlowTCRevision=$enhancedSetupFlowTCRevision --enhancedSetupFlowTCDigest=$enhancedSetupFlowTCDigest --enhancedSetupFlowTCFileSize=$enhancedSetupFlowTCFileSize --maintenanceUrl=$maintenanceUrl --from=$vendor_account_with_pids --yes)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
Expand All @@ -91,7 +91,7 @@ check_response "$result" "\"vid\": $vid"
check_response "$result" "\"pid\": $pid"
check_response "$result" "\"productLabel\": \"$productLabel\""
check_response "$result" "\"schemaVersion\": $schema_version_2"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_1"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_0"
echo "$result"

echo "Get Model with VID: $vid_with_pids PID: $pid"
Expand All @@ -100,7 +100,7 @@ check_response "$result" "\"vid\": $vid_with_pids"
check_response "$result" "\"pid\": $pid"
check_response "$result" "\"productLabel\": \"$productLabel\""
check_response "$result" "\"schemaVersion\": $schema_version_1"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_0"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_1"
check_response "$result" "\"enhancedSetupFlowTCUrl\": \"$enhancedSetupFlowTCUrl\""
check_response "$result" "\"enhancedSetupFlowTCRevision\": $enhancedSetupFlowTCRevision"
check_response "$result" "\"enhancedSetupFlowTCDigest\": \"$enhancedSetupFlowTCDigest\""
Expand Down Expand Up @@ -162,7 +162,7 @@ newEnhancedSetupFlowTCDigest="MWRjM2E0MTA0MWRjYWYxMTU0NWI3NTQzZGZlOTQyZjQ3NDJmNT
newEnhancedSetupFlowTCFileSize=2048
newMaintenanceUrl="https://example2.org"
echo "Update Model with VID: ${vid_with_pids} PID: ${pid} with new description, enhancedSetupFlowTCUrl, enhancedSetupFlowTCRevision, enhancedSetupFlowTCDigest, enhancedSetupFlowTCFileSize and maintenanceUrl"
result=$(echo "test1234" | dcld tx model update-model --vid=$vid_with_pids --pid=$pid --from $vendor_account_with_pids --yes --productLabel "$description" \
result=$(echo "test1234" | dcld tx model update-model --vid=$vid_with_pids --pid=$pid --from $vendor_account_with_pids --yes --productLabel "$description" --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_1 \
--enhancedSetupFlowTCUrl=$newEnhancedSetupFlowTCUrl --enhancedSetupFlowTCRevision=$newEnhancedSetupFlowTCRevision --enhancedSetupFlowTCDigest=$newEnhancedSetupFlowTCDigest --enhancedSetupFlowTCFileSize=$newEnhancedSetupFlowTCFileSize --maintenanceUrl=$newMaintenanceUrl --from=$vendor_account_with_pids --yes)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
Expand All @@ -185,7 +185,7 @@ result=$(dcld query model get-model --vid=$vid_with_pids --pid=$pid)
check_response "$result" "\"vid\": $vid_with_pids"
check_response "$result" "\"pid\": $pid"
check_response "$result" "\"schemaVersion\": $schema_version_1"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_0"
check_response "$result" "\"enhancedSetupFlowOptions\": $enhancedSetupFlowOptions_1"
check_response "$result" "\"enhancedSetupFlowTCUrl\": \"$newEnhancedSetupFlowTCUrl\""
check_response "$result" "\"enhancedSetupFlowTCRevision\": $newEnhancedSetupFlowTCRevision"
check_response "$result" "\"enhancedSetupFlowTCDigest\": \"$newEnhancedSetupFlowTCDigest\""
Expand All @@ -197,7 +197,7 @@ test_divider

echo "Update Model with VID: ${vid} PID: ${pid} modifying supportURL"
supportURL="https://newsupporturl.test"
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --from $vendor_account --yes --supportURL "$supportURL" --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_1)
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --from $vendor_account --yes --supportURL "$supportURL" --enhancedSetupFlowOptions=$enhancedSetupFlowOptions_0)
result=$(get_txn_result "$result")
check_response "$result" "\"code\": 0"
echo "$result"
Expand Down
Loading
Loading