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

TC-OPCREDS-3.2: Add #32182

Merged
merged 22 commits into from
Jun 5, 2024
Merged
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dc17fbd
chore(TC_OPCREDS-3.2): skeleton base class
gvargas-csa Jan 31, 2024
122207f
chore(TC_OPCREDS_3.2): NOCResponse command
gvargas-csa Feb 2, 2024
8367f6e
chore(TC_OPCREDS_3.2): get currentFabric
gvargas-csa Feb 13, 2024
a01f9ad
chore(TC_OPCREDS_3.2): print some status values
gvargas-csa Feb 26, 2024
76f8533
TC-OPCREDS-3.2: Re-work test
cecille Apr 22, 2024
f24a046
Merge remote-tracking branch 'cecille/tc_opcreds_3_2' into HEAD
gvargas-csa May 15, 2024
c751f6a
Merge branch 'project-chip:master' into TC_OPCREDS_3_2
gvargas-csa May 15, 2024
aeb58bf
Merge branch 'project-chip:master' into TC_OPCREDS_3_2
gvargas-csa May 20, 2024
77ef8b2
chore(TC_OPCREDS_3.2): included new steps (1-6)
gvargas-csa May 20, 2024
314b579
chore(TC_OPCREDS_3.2): all steps are implemtented
gvargas-csa May 20, 2024
9b2f5d8
chore(TC_OPCREDS_3.2): restyled by isort
gvargas-csa May 20, 2024
f015132
chore(TC_OPCREDS_3_2): fix error from python linter (code-lints)
gvargas-csa May 20, 2024
064605f
chore(TC_OPCREDS_3.2): import restyled by isort
gvargas-csa May 20, 2024
81df904
chore(TC_OPCREDS_3.2): fixed the vendorID for prevent fail
gvargas-csa May 30, 2024
a589d37
chore(TC_OPCREDS_3.2): add test to CI Workflow
gvargas-csa May 30, 2024
b24f0b6
chore(TC_OPCREDS_3.2): off auto-format and change the return values l…
gvargas-csa May 30, 2024
05ee254
chore(TC_OPCREDS_3.2): remove if-else validation instead used assert_…
gvargas-csa May 30, 2024
64d090e
chore(TC_OPCREDS_3.2): spacing adjustment for better readability
gvargas-csa May 31, 2024
57c1dd3
chore(TC_OPCREDS_3.2): identation adjustment for better readability
gvargas-csa May 31, 2024
dd220c0
chore(TC_OPCREDS_3.2): restyled patch identation adjustment
gvargas-csa May 31, 2024
400f01f
Merge branch 'master' into HEAD
gvargas-csa Jun 4, 2024
25e23c4
chore(TC_OPCREDS_3.2): reverted addition of test
gvargas-csa Jun 4, 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
79 changes: 79 additions & 0 deletions src/python_testing/TC_OPCREDS_3_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
gvargas-csa marked this conversation as resolved.
Show resolved Hide resolved
# Copyright (c) 2024 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import logging
import random

import chip.clusters as Clusters
from chip.utils import CommissioningBuildingBlocks
from chip import ChipDeviceCtrl
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


class TC_OPCREDS_3_2(MatterBaseTest):
# All global functions
@async_test_body
async def test_TC_OPCREDS_3_2(self):



# It is not necessary implement factory reset to DUT
self.print_step(1, "Step 1: Factory Reset DUT")

dev_ctrl = self.default_controller

new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority()
th1_new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=2222)
th1_nodeid = self.default_controller.nodeId+1
th1_dut_nodeid = self.dut_node_id+1

th1_new_admin_ctrl = th1_new_fabric_admin.NewController(nodeId=th1_nodeid)
resp = await CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting(
commissionerDevCtrl=dev_ctrl, newFabricDevCtrl=th1_new_admin_ctrl,
existingNodeId=self.dut_node_id, newNodeId=th1_dut_nodeid
)

self.print_step(2, "Commission DUT to TH1's Fabric")

# CommissioningBuildingBlocks just return a boolean. I need to get the NOC Response
gvargas-csa marked this conversation as resolved.
Show resolved Hide resolved
# so I just I will add a new step for now update the fabric label just to get the NOC response.
opcreds = Clusters.OperationalCredentials


nocResponse = await self.read_single_attribute_check_success(
dev_ctrl=th1_new_admin_ctrl, node_id=th1_dut_nodeid, cluster=opcreds, attribute=opcreds.Attributes.NOCs, fabric_filtered=False)
)

print("Here is NOCResponse below")
print(nocResponse)
print("Here is NOCResponse")

cmd = opcreds.Commands.UpdateFabricLabel(label="Label1")
resp = await self.send_single_cmd(cmd=cmd, dev_ctrl=th1_new_admin_ctrl, node_id=th1_dut_nodeid)
self.print_step(3, "When DUT sends NOC response save FabricIndex as FabricIndex_TH1")
FabricIndex_TH1 = resp.fabricIndex

self.print_step(4, "Save TH1's Fabric ID as FabricID1")
TH1_CurrentFabricIndex = await self.read_single_attribute_check_success(
cluster=opcreds, attribute=opcreds.Attributes.CurrentFabricIndex, dev_ctrl=th1_new_admin_ctrl, node_id=th1_dut_nodeid)

self.print_step(5, "From TH1 read the CurrentFabricIndex")
print(TH1_CurrentFabricIndex)

if __name__ == "__main__":
default_matter_test_main()
Loading