Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
swan-amazon committed Jan 15, 2025
1 parent b1508b1 commit 5c8d3ad
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 216 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ jobs:
--target linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang \
--target linux-x64-fabric-sync-ipv6only-no-ble-no-wifi-clang \
--target linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang \
--target linux-x64-terms-and-conditions \
--target linux-x64-python-bindings \
build \
--copy-artifacts-to objdir-clone \
Expand All @@ -518,6 +519,7 @@ jobs:
echo "FABRIC_BRIDGE_APP: out/linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang/fabric-bridge-app" >> /tmp/test_env.yaml
echo "FABRIC_SYNC_APP: out/linux-x64-fabric-sync-ipv6only-no-ble-no-wifi-clang/fabric-sync" >> /tmp/test_env.yaml
echo "LIGHTING_APP_NO_UNIQUE_ID: out/linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang/chip-lighting-app" >> /tmp/test_env.yaml
echo "TERMS_AND_CONDITIONS_APP: out/linux-x64-terms-and-conditions/chip-terms-and-conditions-app" >> /tmp/test_env.yaml
echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
echo "TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
echo "TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
Expand Down
5 changes: 5 additions & 0 deletions integrations/docker/images/chip-cert-bins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ RUN case ${TARGETPLATFORM} in \
--target linux-x64-fabric-admin-rpc-ipv6only \
--target linux-x64-light-data-model-no-unique-id-ipv6only \
--target linux-x64-network-manager-ipv6only \
--target linux-x64-terms-and-conditions \
build \
&& mv out/linux-x64-chip-tool-ipv6only-platform-mdns/chip-tool out/chip-tool \
&& mv out/linux-x64-shell-ipv6only-platform-mdns/chip-shell out/chip-shell \
Expand All @@ -192,6 +193,7 @@ RUN case ${TARGETPLATFORM} in \
&& mv out/linux-x64-fabric-admin-rpc-ipv6only/fabric-admin out/fabric-admin \
&& mv out/linux-x64-light-data-model-no-unique-id-ipv6only/chip-lighting-app out/chip-lighting-data-model-no-unique-id-app \
&& mv out/linux-x64-network-manager-ipv6only/matter-network-manager-app out/matter-network-manager-app \
&& mv out/linux-x64-terms-and-conditions/chip-terms-and-conditions-app out/chip-terms-and-conditions-app \
;; \
"linux/arm64")\
set -x \
Expand Down Expand Up @@ -220,6 +222,7 @@ RUN case ${TARGETPLATFORM} in \
--target linux-arm64-fabric-admin-rpc-ipv6only \
--target linux-arm64-light-data-model-no-unique-id-ipv6only \
--target linux-arm64-network-manager-ipv6only \
--target linux-arm64-terms-and-conditions \
build \
&& mv out/linux-arm64-chip-tool-ipv6only-platform-mdns/chip-tool out/chip-tool \
&& mv out/linux-arm64-shell-ipv6only-platform-mdns/chip-shell out/chip-shell \
Expand All @@ -244,6 +247,7 @@ RUN case ${TARGETPLATFORM} in \
&& mv out/linux-arm64-fabric-admin-rpc-ipv6only/fabric-admin out/fabric-admin \
&& mv out/linux-arm64-light-data-model-no-unique-id-ipv6only/chip-lighting-app out/chip-lighting-data-model-no-unique-id-app \
&& mv out/linux-arm64-network-manager-ipv6only/matter-network-manager-app out/matter-network-manager-app \
&& mv out/linux-arm64-terms-and-conditions/chip-terms-and-conditions-app out/chip-terms-and-conditions-app \
;; \
*) ;; \
esac
Expand Down Expand Up @@ -283,6 +287,7 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/fabric-bridge-app app
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/fabric-admin apps/fabric-admin
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-lighting-data-model-no-unique-id-app apps/chip-lighting-data-model-no-unique-id-app
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/matter-network-manager-app apps/matter-network-manager-app
COPY --from=chip-build-cert-bins /root/connectedhomeip/out/chip-terms-and-conditions-app apps/chip-terms-and-conditions-app

# Create symbolic links for now since this allows users to use existing configurations
# for running just `app-name` instead of `apps/app-name`
Expand Down
1 change: 1 addition & 0 deletions scripts/tests/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ def as_runner(path):
FABRIC_SYNC_APP: {
as_runner(f'out/{target_prefix}-fabric-sync-no-ble-no-wifi-ipv6only-clang-boringssl/fabric-sync')}
LIGHTING_APP_NO_UNIQUE_ID: {as_runner(f'out/{target_prefix}-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang/chip-lighting-app')}
TERMS_AND_CONDITIONS_APP: {as_runner(f'out/{target_prefix}-terms-and-conditions/chip-terms-and-conditions-app')}
TRACE_APP: out/trace_data/app-{{SCRIPT_BASE_NAME}}
TRACE_TEST_JSON: out/trace_data/test-{{SCRIPT_BASE_NAME}}
TRACE_TEST_PERFETTO: out/trace_data/test-{{SCRIPT_BASE_NAME}}
Expand Down
79 changes: 30 additions & 49 deletions src/python_testing/TC_CGEN_2_10.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# --custom-flow 2
# --capabilities 6
# script-args:
# --in-test-commissioning-method on-network
# --commissioning-method on-network
# --tc-version-to-simulate 1
# --tc-user-response-to-simulate 1
# --qr-code MT:-24J0AFN00KA0648G00
Expand All @@ -48,109 +48,90 @@ def desc_TC_CGEN_2_10(self) -> str:

def steps_TC_CGEN_2_10(self) -> list[TestStep]:
return [
TestStep(1, "Read TCAcceptedVersion attribute"),
TestStep(2, "Read TCAcknowledgements attribute"),
TestStep(3, "Send SetTCAcknowledgements with TCVersion=0 and TCUserResponse=65535"),
TestStep(4, "Verify TCAcceptedVersion unchanged"),
TestStep(5, "Verify TCAcknowledgements unchanged"),
TestStep(6, "Send SetTCAcknowledgements with TCVersion=acceptedVersion+1 and TCUserResponse=0"),
TestStep(7, "Verify TCAcceptedVersion unchanged"),
TestStep(8, "Verify TCAcknowledgements unchanged")
TestStep(1, "TH reads from the DUT the attribute TCAcceptedVersion. Store the value as acceptedVersion."),
TestStep(2, "TH reads from the DUT the attribute TCAcknowledgements. Store the value as userAcknowledgements."),
TestStep(3, "TH Sends the SetTCAcknowledgements command to the DUT with the fields set as follows:\n* TCVersion: 0\n* TCUserResponse: 65535"),
TestStep(4, "TH reads from the DUT the attribute TCAcceptedVersion."),
TestStep(5, "TH reads from the DUT the attribute TCAcknowledgements."),
TestStep(6, "TH Sends the SetTCAcknowledgements command to the DUT with the fields set as follows:\n* TCVersion: acceptedVersion + 1\n* TCUserResponse: 0"),
TestStep(7, "TH reads from the DUT the attribute TCAcceptedVersion."),
TestStep(8, "TH reads from the DUT the attribute TCAcknowledgements."),
]

@async_test_body
async def test_TC_CGEN_2_10(self):
commissioner: ChipDeviceCtrl.ChipDeviceController = self.default_controller
await self.commission_devices()

# Step 1: Read TCAcceptedVersion
self.step(1)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
accepted_version = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion]

# Step 2: Read TCAcknowledgements
self.step(2)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
user_acknowledgements = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcknowledgements]

# Step 3: Send SetTCAcknowledgements with invalid version
self.step(3)
response = await commissioner.SendCommand(
nodeid=self.dut_node_id,
endpoint=ROOT_ENDPOINT_ID,
payload=Clusters.GeneralCommissioning.Commands.SetTCAcknowledgements(
TCVersion=0,
TCUserResponse=65535),
timedRequestTimeoutMs=1000)
payload=Clusters.GeneralCommissioning.Commands.SetTCAcknowledgements(TCVersion=0, TCUserResponse=65535),
)

# Verify TCMinVersionNotMet error
asserts.assert_equal(
response.errorCode,
Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kTCMinVersionNotMet,
'Expected TCMinVersionNotMet error')
"Expected TCMinVersionNotMet error",
)

# Step 4: Verify TCAcceptedVersion unchanged
self.step(4)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
current_version = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion]
asserts.assert_equal(
current_version,
accepted_version,
'TCAcceptedVersion changed unexpectedly')
asserts.assert_equal(current_version, accepted_version, "TCAcceptedVersion changed unexpectedly")

# Step 5: Verify TCAcknowledgements unchanged
self.step(5)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
current_acknowledgements = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcknowledgements]
asserts.assert_equal(
current_acknowledgements,
user_acknowledgements,
'TCAcknowledgements changed unexpectedly')
asserts.assert_equal(current_acknowledgements, user_acknowledgements, "TCAcknowledgements changed unexpectedly")

# Step 6: Send SetTCAcknowledgements with invalid response
self.step(6)
response = await commissioner.SendCommand(
nodeid=self.dut_node_id,
endpoint=ROOT_ENDPOINT_ID,
payload=Clusters.GeneralCommissioning.Commands.SetTCAcknowledgements(
TCVersion=accepted_version + 1,
TCUserResponse=0),
timedRequestTimeoutMs=1000)
TCVersion=accepted_version + 1, TCUserResponse=0
),
)

# Verify RequiredTCNotAccepted error
asserts.assert_equal(
response.errorCode,
Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kRequiredTCNotAccepted,
'Expected RequiredTCNotAccepted error')
"Expected RequiredTCNotAccepted error",
)

# Step 7: Verify TCAcceptedVersion still unchanged
self.step(7)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)])
current_version = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion]
asserts.assert_equal(
current_version,
accepted_version,
'TCAcceptedVersion changed unexpectedly after second attempt')
asserts.assert_equal(current_version, accepted_version, "TCAcceptedVersion changed unexpectedly after second attempt")

# Step 8: Verify TCAcknowledgements still unchanged
self.step(8)
response = await commissioner.ReadAttribute(
nodeid=self.dut_node_id,
attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)])
current_acknowledgements = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcknowledgements]
asserts.assert_equal(
current_acknowledgements,
user_acknowledgements,
'TCAcknowledgements changed unexpectedly after second attempt')
"TCAcknowledgements changed unexpectedly after second attempt",
)


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 5c8d3ad

Please sign in to comment.