Skip to content

Commit

Permalink
#502 Add schema version field to entities
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois123@gmail.com>
  • Loading branch information
Abdulbois committed Mar 20, 2024
1 parent dbcb994 commit 407702b
Show file tree
Hide file tree
Showing 107 changed files with 2,350 additions and 756 deletions.
14 changes: 14 additions & 0 deletions docs/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Adds a record about a Vendor.
- companyLegalName: `string` - Legal name of the vendor company
- companyPreferredName: `optional(string)` - Preferred name of the vendor company
- vendorLandingPageURL: `optional(string)` - URL of the vendor's landing page
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State: `vendorinfo/VendorInfo/value/<vid>`
- Who can send:
- Account with a vendor role who has the matching Vendor ID
Expand All @@ -147,6 +148,7 @@ Updates a record about a Vendor.
- companyLegalName: `optional(string)` - Legal name of the vendor company
- companyPreferredName: `optional(string)` - Preferred name of the vendor company
- vendorLandingPageURL: `optional(string)` - URL of the vendor's landing page
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State: `vendorinfo/VendorInfo/value/<vid>`
- Who can send:
- Account with a vendor role who has the matching Vendor ID
Expand Down Expand Up @@ -209,6 +211,7 @@ Not all fields can be edited (see `EDIT_MODEL`).
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
- lsfURL: `optional(string)` - URL to the Localized String File of this product.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `model/Model/value/<vid>/<pid>`
- `model/VendorProducts/value/<vid>`
Expand Down Expand Up @@ -254,6 +257,7 @@ All non-edited fields remain the same.
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
- lsfURL: `optional(string)` - URL to the Localized String File of this product.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- lsfRevision: `optional(uint32)` - LsfRevision is a monotonically increasing positive integer indicating the latest available version of Localized String File.
- In State: `model/Model/value/<vid>/<pid>`
- Who can send:
Expand Down Expand Up @@ -305,6 +309,7 @@ If one of `OTA_URl`, `OTA_checksum` or `OTA_checksum_type` fields is set, then t
- otaChecksum `optional(string)` - Digest of the entire contents of the associated OTA Software Update Image under the OtaUrl attribute, encoded in base64 string representation. The digest SHALL have been computed using the algorithm specified in OtaChecksumType
- otaChecksumType `optional(string)` - Numeric identifier as defined in IANA Named Information Hash Algorithm Registry for the type of otaChecksum. For example, a value of 1 would match the sha-256 identifier, which maps to the SHA-256 digest algorithm
- releaseNotesURL `optional(string)` - URL that contains product specific web page that contains release notes for the device model.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `model/ModelVersion/value/<vid>/<pid>/<softwareVersion>`
- `model/ModelVersions/value/<vid>/<pid>`
Expand Down Expand Up @@ -351,6 +356,7 @@ All non-edited fields remain the same.
- otaURL `optional(string)` - URL where to obtain the OTA image
- otaFileSize `optional(string)` - OtaFileSize is the total size of the OTA software image in bytes
- otaChecksum `optional(string)` - Digest of the entire contents of the associated OTA Software Update Image under the OtaUrl attribute, encoded in base64 string representation. The digest SHALL have been computed using the algorithm specified in OtaChecksumType
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)

- In State: `model/ModelVersion/value/<vid>/<pid>/<softwareVersion>`
- Who can send:
Expand Down Expand Up @@ -488,6 +494,7 @@ from the revocation list.
- transport `optional(string)` - optional field describing the transport
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
- `compliance/CertifiedModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
Expand Down Expand Up @@ -525,6 +532,7 @@ Updates a compliance info by VID, PID, Software Version and Certification Type.
- transport `optional(string)` - optional field describing the transport
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- Who can send:
- CertificationCenter
- CLI command:
Expand Down Expand Up @@ -572,6 +580,7 @@ is written on the ledger (`CERTIFY_MODEL` was called), or
- revocationDate: `string` - The date of model revocation (rfc3339 encoded), for example 2019-10-12T07:20:50.52Z
- certificationType: `string` - Certification type - Currently 'zigbee' and 'matter', 'access control', 'product security' types are supported
- reason `optional(string)` - optional comment describing the reason of revocation
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
- `compliance/RevokedModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
Expand Down Expand Up @@ -611,6 +620,7 @@ Can not be set if there is already a certification record on the ledger (certifi
- transport `optional(string)` - optional field describing the transport
- parentChild `optional(string)` - optional field describing the parent/child - Currently 'parent' and 'child' types are supported
- certificationIDOfSoftwareComponent `optional(string)` - optional field describing the certification ID of software component
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `compliance/ComplianceInfo/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
- `compliance/ProvisionalModel/value/<vid>/<pid>/<softwareVersion>/<certificationType>`
Expand Down Expand Up @@ -831,6 +841,7 @@ The certificate is immutable. It can only be revoked by either the owner or a qu
- cert: `string` - PEM encoded certificate. The corresponding CLI parameter can contain either a PEM string or a path to a file containing the data.
- info: `optional(string)` - information/notes for the proposal
- time: `optional(int64)` - proposal time (number of nanoseconds elapsed since January 1, 1970 UTC). CLI uses the current time for that field.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State: `pki/ProposedCertificate/value/<Certificate's Subject>/<Certificate's Subject Key ID>`
- Who can send:
- Trustee
Expand Down Expand Up @@ -913,6 +924,7 @@ The certificate is immutable. It can only be revoked by either the owner or a qu
- `vid` field associated with the corresponding PAA on the ledger must be equal to the Vendor account's VID.
- Parameters:
- cert: `string` - PEM encoded certificate. The corresponding CLI parameter can contain either a PEM string or a path to a file containing the data.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `pki/ApprovedCertificates/value/<Certificate's Subject>/<Certificate's Subject Key ID>`
- `pki/ChildCertificates/value/<Certificate's Subject>/<Certificate's Subject Key ID>`
Expand Down Expand Up @@ -1145,6 +1157,7 @@ This transaction adds a NOC root certificate owned by the Vendor.
- the signature (self-signature) and expiration date must be valid.
- Parameters:
- cert: `string` - The NOC Root Certificate, encoded in X.509v3 PEM format. Can be a PEM string or a file path.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `pki/ApprovedCertificates/value/<Subject>/<SubjectKeyID>`
- `pki/ApprovedCertificatesBySubject/value/<Subject>`
Expand Down Expand Up @@ -1175,6 +1188,7 @@ already present on the ledger.
- the signature (self-signature) and expiration date must be valid.
- Parameters:
- cert: `string` - The NOC non-root Certificate, encoded in X.509v3 PEM format. Can be a PEM string or a file path.
- schemaVersion: `optional(uint32)` - Schema version to support backward/forward compatability(default 1)
- In State:
- `pki/ApprovedCertificates/value/<Subject>/<SubjectKeyID>`
- `pki/ApprovedCertificatesBySubject/value/<Subject>`
Expand Down
12 changes: 9 additions & 3 deletions integration_tests/cli/compliance-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ zigbee_certification_type="zigbee"
matter_certification_type="matter"
cd_certificate_id="123"
cd_version_number=1

schema_version_1=1
schema_version_2=2
echo "Certify unknown Model with VID: $vid PID: $pid SV: ${sv} with zigbee certification"
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --from $zb_account --yes)
echo "$result"
Expand Down Expand Up @@ -182,7 +183,7 @@ check_response "$result" "ledger does not have matching CDVersionNumber=0: model
test_divider

echo "Certify Model with VID: $vid PID: $pid SV: ${sv} with zigbee certification"
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=$cd_version_number --from $zb_account --yes)
result=$(echo "$passphrase" | dcld tx compliance certify-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$zigbee_certification_type" --certificationDate="$certification_date" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=$cd_version_number --schemaVersion=$schema_version_2 --from $zb_account --yes)
echo "$result"
check_response "$result" "\"code\": 0"

Expand Down Expand Up @@ -276,6 +277,7 @@ check_response "$result" "\"softwareVersionCertificationStatus\": 2"
check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\""
check_response "$result" "\"date\": \"$certification_date\""
check_response "$result" "\"certificationType\": \"$zigbee_certification_type\""
check_response "$result" "\"schemaVersion\": $schema_version_2"
echo "$result"

test_divider
Expand All @@ -288,6 +290,7 @@ check_response "$result" "\"softwareVersionCertificationStatus\": 2"
check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\""
check_response "$result" "\"date\": \"$certification_date\""
check_response "$result" "\"certificationType\": \"$matter_certification_type\""
check_response "$result" "\"schemaVersion\": $schema_version_1"
echo "$result"

test_divider
Expand Down Expand Up @@ -728,9 +731,10 @@ upd_supported_clusters="brand_new_clusters"
upd_os_version="brand_new_os_version"
upd_parent_child="parent"
upd_certification_id_of_software_component="brand_new_component"
schema_version_3=3

echo "Update Compliance Info for Model with VID: ${vid} PID: ${pid} SV: ${sv} for $zigbee_certification_type with all optional fields set"
result=$(echo "$passphrase" | dcld tx compliance update-compliance-info --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType=$zigbee_certification_type --cdVersionNumber=$upd_cd_version_number --certificationDate=$upd_certification_date --reason=$upd_reason --cdCertificateId=$upd_cd_certificate_id --certificationRoute=$upd_certification_route --programType=$upd_program_type --programTypeVersion=$upd_program_type_version --compliantPlatformUsed=$upd_compliant_platform_used --compliantPlatformVersion=$upd_compliant_platform_version --transport=$upd_transport --familyId=$upd_familyID --supportedClusters=$upd_supported_clusters --OSVersion=$upd_os_version --parentChild=$upd_parent_child --certificationIDOfSoftwareComponent=$upd_certification_id_of_software_component --from=$zb_account --yes)
result=$(echo "$passphrase" | dcld tx compliance update-compliance-info --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType=$zigbee_certification_type --cdVersionNumber=$upd_cd_version_number --certificationDate=$upd_certification_date --reason=$upd_reason --cdCertificateId=$upd_cd_certificate_id --certificationRoute=$upd_certification_route --programType=$upd_program_type --programTypeVersion=$upd_program_type_version --compliantPlatformUsed=$upd_compliant_platform_used --compliantPlatformVersion=$upd_compliant_platform_version --transport=$upd_transport --familyId=$upd_familyID --supportedClusters=$upd_supported_clusters --OSVersion=$upd_os_version --parentChild=$upd_parent_child --certificationIDOfSoftwareComponent=$upd_certification_id_of_software_component --schemaVersion=$schema_version_3 --from=$zb_account --yes)
echo "$result"

echo "Compliance Info for Model with VID: ${vid} PID: ${pid} SV: ${sv} for $zigbee_certification_type all fields updated"
Expand All @@ -754,6 +758,8 @@ check_response "$result" "\"supportedClusters\": \"$upd_supported_clusters\""
check_response "$result" "\"OSVersion\": \"$upd_os_version\""
check_response "$result" "\"parentChild\": \"$upd_parent_child\""
check_response "$result" "\"certificationIdOfSoftwareComponent\": \"$upd_certification_id_of_software_component\""
check_response "$result" "\"schemaVersion\": $schema_version_3"


test_divider

Expand Down
6 changes: 5 additions & 1 deletion integration_tests/cli/compliance-provisioning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ certification_type_matter="matter"
provision_date="2020-02-02T02:20:20Z"
provision_reason="some reason"
cd_certificate_id="123"
schema_version_1=1
schema_version_2=2

test_divider

echo "Add Model and a New Model Version with VID: $vid PID: $pid SV: $sv"
create_model_and_version $vid $pid $sv $svs $vendor_account

echo "Provision for uncertificate Model with VID: $vid PID: $pid for ZB"
result=$(echo "$passphrase" | dcld tx compliance provision-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type_zb" --provisionalDate="$provision_date" --reason "$provision_reason" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --from $zb_account --yes)
result=$(echo "$passphrase" | dcld tx compliance provision-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type_zb" --provisionalDate="$provision_date" --reason "$provision_reason" --cdCertificateId="$cd_certificate_id" --cdVersionNumber=1 --schemaVersion=$schema_version_2 --from $zb_account --yes)
check_response "$result" "\"code\": 0"
echo "$result"

Expand Down Expand Up @@ -148,6 +150,7 @@ check_response "$result" "\"cDCertificateId\": \"$cd_certificate_id\""
check_response "$result" "\"date\": \"$provision_date\""
check_response "$result" "\"reason\": \"$provision_reason\""
check_response "$result" "\"certificationType\": \"$certification_type_zb\""
check_response "$result" "\"schemaVersion\": $schema_version_2"
check_response "$result" "\"history\""
echo "$result"

Expand All @@ -162,6 +165,7 @@ check_response "$result" "\"date\": \"$provision_date\""
check_response "$result" "\"reason\": \"$provision_reason\""
check_response "$result" "\"certificationType\": \"$certification_type_matter\""
check_response "$result" "\"history\""
check_response "$result" "\"schemaVersion\": $schema_version_1"
echo "$result"

test_divider
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/cli/compliance-revocation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ test_divider
echo "Revoke Certification for uncertificate Model with VID: $vid PID: $pid"
revocation_date="2020-02-02T02:20:20Z"
revocation_reason="some reason"
result=$(echo "$passphrase" | dcld tx compliance revoke-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type" --revocationDate="$revocation_date" --reason "$revocation_reason" --cdVersionNumber=1 --from $zb_account --yes)
schema_version_1=1
schema_version_2=2
result=$(echo "$passphrase" | dcld tx compliance revoke-model --vid=$vid --pid=$pid --softwareVersion=$sv --softwareVersionString=$svs --certificationType="$certification_type" --revocationDate="$revocation_date" --reason "$revocation_reason" --cdVersionNumber=1 --schemaVersion=$schema_version_2 --from $zb_account --yes)
check_response "$result" "\"code\": 0"
echo "$result"

Expand Down Expand Up @@ -129,6 +131,7 @@ check_response "$result" "\"softwareVersionCertificationStatus\": 3"
check_response "$result" "\"date\": \"$revocation_date\""
check_response "$result" "\"reason\": \"$revocation_reason\""
check_response "$result" "\"certificationType\": \"$certification_type\""
check_response "$result" "\"schemaVersion\": $schema_version_2"
check_response "$result" "\"history\""
echo "$result"

Expand All @@ -142,6 +145,7 @@ check_response "$result" "\"softwareVersionCertificationStatus\": 3"
check_response "$result" "\"date\": \"$revocation_date\""
check_response "$result" "\"reason\": \"$revocation_reason\""
check_response "$result" "\"certificationType\": \"$certification_type_matter\""
check_response "$result" "\"schemaVersion\": $schema_version_1"
check_response "$result" "\"history\""
echo "$result"

Expand Down
17 changes: 15 additions & 2 deletions integration_tests/cli/model-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ echo "$result"
test_divider

productLabel="Device #1"
schema_version_1=1
schema_version_2=2
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 --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 --schemaVersion=$schema_version_2 --from=$vendor_account --yes)
check_response "$result" "\"code\": 0"
echo "$result"

Expand All @@ -78,6 +80,15 @@ result=$(dcld query model get-model --vid=$vid --pid=$pid)
check_response "$result" "\"vid\": $vid"
check_response "$result" "\"pid\": $pid"
check_response "$result" "\"productLabel\": \"$productLabel\""
check_response "$result" "\"schemaVersion\": $schema_version_2"
echo "$result"

echo "Get Model with VID: $vid_with_pids PID: $pid"
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" "\"productLabel\": \"$productLabel\""
check_response "$result" "\"schemaVersion\": $schema_version_1"
echo "$result"

test_divider
Expand Down Expand Up @@ -115,7 +126,8 @@ test_divider

echo "Update Model with VID: ${vid} PID: ${pid} with new description"
description="New Device Description"
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --from $vendor_account --yes --productLabel "$description")
schema_version_3=3
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --from $vendor_account --yes --productLabel "$description" --schemaVersion=$schema_version_3)
check_response "$result" "\"code\": 0"
echo "$result"

Expand All @@ -133,6 +145,7 @@ result=$(dcld query model get-model --vid=$vid --pid=$pid)
check_response "$result" "\"vid\": $vid"
check_response "$result" "\"pid\": $pid"
check_response "$result" "\"productLabel\": \"$description\""
check_response "$result" "\"schemaVersion\": $schema_version_3"
echo "$result"

test_divider
Expand Down
Loading

0 comments on commit 407702b

Please sign in to comment.