├── .github ├── ISSUE_TEMPLATE │ ├── bug-template.yaml │ ├── config.yml │ └── feature-template.yaml └── workflows │ └── update-submodules.yml ├── .gitignore ├── .gitmodules ├── .pullapprove.yml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── NOTICE ├── README.md ├── default.env ├── docker-compose.override-backend-dev.yml ├── docker-compose.override-frontend-dev.yml ├── docker-compose.yml ├── docs ├── Matter_TH_User_Guide │ ├── Matter_TH_User_Guide.adoc │ ├── Matter_TH_User_Guide.pdf │ └── images │ │ ├── img_0.png │ │ ├── img_1.png │ │ ├── img_10.png │ │ ├── img_11.png │ │ ├── img_12.png │ │ ├── img_13.png │ │ ├── img_14.png │ │ ├── img_15.png │ │ ├── img_2.png │ │ ├── img_22.png │ │ ├── img_23.png │ │ ├── img_24.png │ │ ├── img_25.png │ │ ├── img_26.png │ │ ├── img_27.png │ │ ├── img_28.png │ │ ├── img_29.png │ │ ├── img_3.png │ │ ├── img_30.png │ │ ├── img_31.png │ │ ├── img_32.png │ │ ├── img_33.png │ │ ├── img_34.png │ │ ├── img_35.png │ │ ├── img_36.png │ │ ├── img_37.png │ │ ├── img_38.png │ │ ├── img_39.png │ │ ├── img_4.jpg │ │ ├── img_40.png │ │ ├── img_41.png │ │ ├── img_5.jpg │ │ ├── img_56.png │ │ ├── img_59.png │ │ ├── img_6.png │ │ ├── img_60.png │ │ ├── img_61.png │ │ ├── img_62.png │ │ ├── img_63.png │ │ ├── img_64.png │ │ ├── img_65.png │ │ ├── img_66.png │ │ ├── img_67.png │ │ ├── img_7.png │ │ ├── img_8.png │ │ └── img_9.png ├── Raspberry Pi-Setup.md ├── development │ ├── Accessing_the_TH_PostgreSQL_database │ │ ├── Accessing_the_TH_PostgreSQL_database.adoc │ │ └── images │ │ │ ├── conn1.png │ │ │ ├── conn2.png │ │ │ ├── conn3.png │ │ │ ├── pgAdminLogin.png │ │ │ ├── query1.png │ │ │ └── query2.png │ ├── Convert_.adoc_to_.pdf_with_asciidoctor │ │ └── Convert_.adoc_to_.pdf_with_asciidoctor_.adoc │ ├── Development-Environment-Setup.md │ └── Install_Ubuntu_Linux_Subsystem_WSL_in_Windows │ │ ├── Install_Ubuntu_Linux_Subsystem_WSL_in_Windows.adoc │ │ └── images │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ └── 5.png └── enable_wifi_and_ssh_raspi_ubuntu_server.md ├── logs └── .keep └── scripts ├── build.sh ├── clean-up.sh ├── create-release-tag.sh ├── generate-pdf-user-guide.sh ├── install-default-env.sh ├── pi-setup ├── auto-install.sh ├── install-pi-dependencies.sh └── internal-auto-install.sh ├── start.sh ├── stop.sh ├── test-local.sh ├── test.sh ├── th ├── _th-backend.sh ├── _th-cli.sh ├── _th-docker-logs.sh ├── _th-dut.sh ├── _th-env-deps.sh ├── _th-frontend.sh ├── _th-network.sh ├── _th-repo.sh ├── _th-system.sh ├── _th-version.sh └── th-doctor.sh ├── ubuntu ├── 1-install-dependencies.sh ├── 1.1-install-docker-repository.sh ├── 2-machine-cofiguration.sh ├── auto-install.sh ├── auto-update.sh ├── internal-auto-install.sh ├── internal-auto-update.sh └── package-dependency-list.txt ├── update-docker-images.sh ├── update-git-latest-tag.sh ├── update-setup-cli-dependencies.sh ├── update-setup-test-collections.sh ├── update-th-code.sh ├── update.sh ├── utils.sh ├── validate_installation_prerequisites ├── Dockerfile ├── build_and_run.sh └── validate_install.sh └── wifi-connect.sh /.github/ISSUE_TEMPLATE/bug-template.yaml: -------------------------------------------------------------------------------- 1 | name: "\U0001F41B Bug report" 2 | description: Create a report to help us improve 3 | title: "[Bug] " 4 | labels: [Bug, "Needs Triage"] 5 | body: 6 | - type: textarea 7 | id: bug-description 8 | attributes: 9 | label: Describe the bug 10 | description: A clear and concise description of what the bug is 11 | validations: 12 | required: true 13 | - type: textarea 14 | id: use-case 15 | attributes: 16 | label: Steps to reproduce the behavior 17 | description: Please describe how the bug can be reproduced 18 | placeholder: | 19 | 1. Go to '...' 20 | 2. Click on '....' 21 | 3. Scroll down to '....' 22 | 4. See error 23 | - type: textarea 24 | id: expected-behavior 25 | attributes: 26 | label: Expected behavior 27 | description: A clear and concise description of what you expected to happen 28 | validations: 29 | required: false 30 | - type: textarea 31 | id: logs 32 | attributes: 33 | label: Log files 34 | description: If applicable, please provide the log files related to this bug 35 | placeholder: | 36 | E.g.: 37 | - TH logs: ... 38 | - DUT logs: ... 39 | validations: 40 | required: false 41 | - type: textarea 42 | id: pics 43 | attributes: 44 | label: PICS file 45 | description: If applicable, please provide the PICS file that was used 46 | validations: 47 | required: false 48 | - type: textarea 49 | id: screenshot 50 | attributes: 51 | label: Screenshots 52 | description: If applicable, provide screenshots to help explain your problem 53 | validations: 54 | required: false 55 | - type: textarea 56 | id: environment 57 | attributes: 58 | label: Environment 59 | description: Please complete the following information and provide any other enviroment versions you believe that might be relevant 60 | placeholder: | 61 | - TH version: [e.g. v2.8.1] 62 | - OS: [e.g. ubuntu 22.0, macOS 13.0] 63 | - Browser: [e.g. chrome, safari] 64 | validations: 65 | required: false 66 | - type: textarea 67 | id: additional-info 68 | attributes: 69 | label: Additional Information 70 | description: Please include any other additional or relevant information here 71 | validations: 72 | required: false 73 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-template.yaml: -------------------------------------------------------------------------------- 1 | name: "\U0001F4A1 Feature Request" 2 | description: Create a feature to be considered in a future release 3 | title: "[Feature] " 4 | labels: ["Feature", "Needs Triage"] 5 | body: 6 | - type: textarea 7 | id: repro 8 | attributes: 9 | label: Feature description 10 | description: Please provide as much context and details as possible 11 | validations: 12 | required: true 13 | - type: textarea 14 | id: use-case 15 | attributes: 16 | label: Use Cases 17 | description: Please provide some use cases for the feature 18 | placeholder: | 19 | E.g.: 20 | [Use Case 1] Export a test run execution: 21 | 1. Use the backend endpoint to export a test run execution: ... 22 | 2. Then import the exported execution using this endpoint: ... 23 | validations: 24 | required: true 25 | - type: textarea 26 | id: test-case 27 | attributes: 28 | label: Test Cases 29 | description: Please provide some test cases to be used to validate feature behaves as expected. 30 | placeholder: | 31 | E.g.: 32 | [Test Case 1] Test Use Case 1: Test the export a test run execution 33 | 1. Use the backend endpoint to export a test run execution: ... 34 | Expected Result: The endpoind should return a JSON containing the data for a test run execution following the format bellow: 35 | {"db_revision": "9996326cbd1d","test_run_execution": {"title": "UI_Test_Run_2023_05_23_18_43_30"... 36 | validations: 37 | required: false 38 | - type: textarea 39 | attributes: 40 | label: Additional Information 41 | description: Please include any other additional or relevant information here 42 | validations: 43 | required: false 44 | -------------------------------------------------------------------------------- /.github/workflows/update-submodules.yml: -------------------------------------------------------------------------------- 1 | name: Submodules Update Action 2 | on: workflow_dispatch 3 | jobs: 4 | Update-Submodules-PR: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout repo 8 | uses: actions/checkout@v3 9 | with: 10 | submodules: true 11 | token: ${{ secrets.SUBMODULE_WORKFLOW }} 12 | - name: Update submodules remote 13 | run: git submodule update --remote 14 | - name: Create Pull Request 15 | id: cpr 16 | uses: peter-evans/create-pull-request@v3 17 | with: 18 | commit-message: Updating submodules with automated action 19 | title: Update submodules with automated action 20 | - name: Pull Request Output 21 | run: | 22 | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" 23 | echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" 24 | 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .mypy_cache 2 | docker-stack.yml 3 | /backend/.env 4 | .DS_Store 5 | .cache 6 | 7 | # Frontend files 8 | /frontend/node_modules 9 | /frontend/dist 10 | 11 | # local env files 12 | .env.local 13 | .env.*.local 14 | 15 | # Log files 16 | npm-debug.log* 17 | yarn-debug.log* 18 | yarn-error.log* 19 | /logs 20 | 21 | # Editor directories and files 22 | .idea 23 | *.suo 24 | *.ntvs* 25 | *.njsproj 26 | *.sln 27 | *.sw* 28 | .env 29 | 30 | # TH Doctor output files 31 | th-doctor.txt 32 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cli"] 2 | path = cli 3 | branch = main 4 | url = https://github.com/project-chip/certification-tool-cli 5 | [submodule "backend"] 6 | path = backend 7 | branch = main 8 | url = https://github.com/project-chip/certification-tool-backend 9 | [submodule "frontend"] 10 | path = frontend 11 | branch = main 12 | url = https://github.com/project-chip/certification-tool-frontend 13 | -------------------------------------------------------------------------------- /.pullapprove.yml: -------------------------------------------------------------------------------- 1 | 2 | version: 3 3 | 4 | # https://developer.github.com/v3/previews/#draft-pull-requests 5 | github_api_version: "shadow-cat-preview" 6 | 7 | pullapprove_conditions: 8 | - "base.ref == 'develop'" 9 | 10 | ############################################################ 11 | # Notifications 12 | ############################################################ 13 | 14 | notifications: 15 | ############################################################ 16 | # New contributors 17 | ############################################################ 18 | - when: pull_request.opened 19 | if: "author_association == 'FIRST_TIME_CONTRIBUTOR'" 20 | comment: | 21 | Hey @{{ author }}, thanks for the PR! The review will start once 22 | the tests and CI checks have passed. If they don't, please review 23 | the logs and try to fix the issues (ask for help if you can't 24 | figure it out). A reviewer will be assigned once the tests are 25 | passing and they'll walk you through getting the PR finished 26 | and merged. 27 | groups: 28 | ############################################################ 29 | # Shared Reviewer Groups 30 | ############################################################ 31 | dev-team-reviewers: 32 | conditions: 33 | - files.include('*') 34 | reviewers: 35 | teams: [test-harness-devs] 36 | reviews: 37 | request: 2 38 | required: 2 39 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # CSA Open Source Code of Conduct 2 | 3 | This Open Source Code of Conduct applies to all those contributing 4 | to, participating in, or maintaining this CSA open source project, 5 | including Connectivity Standards Alliance members and non-members. 6 | 7 | ## Our Pledge 8 | 9 | In the interest of fostering an open and welcoming environment, we as 10 | contributors and maintainers pledge to make participation in our project and our 11 | community a harassment-free experience for everyone, regardless of age, body 12 | size, disability, ethnicity, sex characteristics, gender identity and 13 | expression, level of experience, education, socio-economic status, nationality, 14 | personal appearance, race, religion, or sexual identity and orientation. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to creating a positive environment 19 | include: 20 | 21 | - Using welcoming and inclusive language 22 | - Being respectful of differing viewpoints and experiences 23 | - Gracefully accepting constructive criticism 24 | - Focusing on what is best for the community 25 | - Showing empathy towards other community members 26 | 27 | Examples of unacceptable behavior by participants include: 28 | 29 | - The use of violent threats, abusive, discriminatory, or derogatory language 30 | - The use of sexualized language or imagery and unwelcome sexual attention or 31 | advances 32 | - Trolling, insulting/derogatory comments, and personal or political attacks 33 | - Public or private harassment 34 | - Publishing others' private information, such as a physical or electronic 35 | address, without explicit permission 36 | - Posting of violent content 37 | - Engaging in unwanted physical contact 38 | - Other conduct which could reasonably be considered inappropriate in a 39 | professional setting 40 | - Advocating for or encouraging any of the above behaviors 41 | 42 | ## Our Responsibilities 43 | 44 | Project maintainers are expected to take appropriate and fair corrective action 45 | in response to any instances of unacceptable behavior. Project maintainers have 46 | the right and responsibility to remove, edit, or reject comments, commits, code, 47 | wiki edits, issues, and other contributions that are not aligned to this Code of 48 | Conduct, or to ban temporarily or permanently any contributor for other 49 | behaviors that they deem inappropriate, threatening, offensive, or harmful. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all project spaces, and it also applies when 54 | an individual is representing the project or its community in public spaces. 55 | Examples of representing a project or community include using an official 56 | project e-mail address, posting via an official social media account, or acting 57 | as an appointed representative at an online or offline event. Representation of 58 | a project may be further defined and clarified by project maintainers. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported by contacting the Project CHIP open source team at help@csa-iot.org. 64 | All complaints will be reviewed and investigated and will result in a 65 | response that is deemed necessary and appropriate to the circumstances. The 66 | CSA open source team should maintain confidentiality with regard to the 67 | reporter of an incident. Further details of specific enforcement policies may be 68 | posted separately. 69 | 70 | Project maintainers who do not follow or enforce the Code of Conduct in good 71 | faith may face temporary or permanent repercussions as determined by CSA open source leadership. 72 | 73 | ## Attribution 74 | 75 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 76 | version 1.4, available at 77 | https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 78 | 79 | [homepage]: https://www.contributor-covenant.org 80 | 81 | For answers to common questions about this code of conduct, see 82 | https://www.contributor-covenant.org/faq 83 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | The Matter Certification Tools are an open source implementation of the Matter Specification 2 | (Matter). Matter is developed by members of the Connectivity Standards Alliance 3 | (Alliance) and promulgated by the Alliance. 4 | 5 | LIMITED RIGHTS TO THE MATTER SDK: Your rights to the Matter SDK are described in 6 | the LICENSE. No warranty or assurance is made with respect to additional rights 7 | that may be required to implement the Matter SDK. Use of the Matter SDK does not 8 | assure compliance with Matter and does not convey the right to identify any 9 | device, software, product or service as Matter compliant, certified or similar. 10 | 11 | CERTIFICATION REQUIRES MEMBERSHIP IN THE ALLIANCE: Certification by the Alliance 12 | of any device, software, product or service is limited to members of the 13 | Alliance, and requires compliance with applicable Alliance policies. 14 | 15 | USE OF ALLIANCE TRADEMARKS AND LOGOS REQUIRES MEMBERSHIP IN THE ALLIANCE: Only 16 | the Alliance and its members may use Alliance trademarks and logos, including, 17 | without limitation, the Matter trademarks and logos. All Alliance trademarks and 18 | logos must be used in accordance with the Connectivity Standards Alliance 19 | Trademark and Logo Usage Guidelines and Terms, a copy of which can be found at 20 | www.csa-iot.org/resources/governing-documents. 21 | 22 | JOINING CONNECTIVITY STANDARDS ALLIANCE: For information on how to become a 23 | member of Connectivity Standards Alliance please visit 24 | www.csa-iot.org/become-member. 25 | 26 | DISCLAIMER: Elements of the SDK & Tools may be subject to third party 27 | intellectual property rights, including without limitation, patent, copyright or 28 | trademark rights (such third party may or may not be a member of the Alliance). 29 | The Alliance is not responsible and shall not be held responsible in any manner 30 | for identifying or failing to identify any or all such third party intellectual 31 | property rights. 32 | 33 | Members of the Alliance may own intellectual property rights related to these 34 | tools and SDK which 35 | rights are subject to the Alliance’s Intellectual Property Rights Policy, which 36 | can be found at www.csa-iot.org/resources/governing-documents, and not the 37 | LICENSE. 38 | 39 | This NOTICE must be included on all copies of the CSA SDK, Tools and Script 40 | repositories. 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 17 | 18 | # CSA Certification Tool 19 | 20 | ## About 21 | 22 | With the goal of simplifying development, testing, and certification of devices, the Connectivity Standards Alliance has developed a standardized set of tools as well a test harness that is presently used for Matter certifications. 23 | 24 | To learn more about the open-source [Matter SDK](https://github.com/project-chip/connectedhomeip), please read more [here](https://github.com/project-chip/connectedhomeip) 25 | 26 | ## Project Overview 27 | 28 | ### Goals 29 | 30 | The test tooling, harness, and scripts are developed with the following goals and principles in mind: 31 | 32 | **Proven:** The test harness and tools are built with and on top of existing technologies where possible. 33 | 34 | **Robust:** The test harness and tools should be reliable and dependable. 35 | 36 | **Low Cost:** The test harness and tools should run on low cost and accessible devices. 37 | 38 | **Flexible:** The test harness and tools are flexible enough to accommodate deployment in different environments. 39 | 40 | **Easy to Use:** The test harness and tools provide a smooth, cohesive, integrated experience. 41 | 42 | **Open:** The Project’s design and technical processes are open and transparent 43 | to the general public, including non-members wherever possible. 44 | 45 | # Instructions 46 | 47 | Detailed instructions for how to use this set of tools with [Matter](https://github.com/project-chip/connectedhomeip) are located [here](./docs/Matter_TH_User_Guide/Matter_TH_User_Guide.adoc) 48 | 49 | ## Related Repositories 50 | 51 | Please be aware of these related repositories that all have to be used in concert to build, develop with, and use the certification tools 52 | 53 | - [Tool Frontend](https://github.com/project-chip/certification-tool-frontend) 54 | - [Tool Backend](https://github.com/project-chip/certification-tool-backend) 55 | - [CLI Tool ](https://github.com/project-chip/certification-tool-cli) 56 | - [Matter Test Scripts](https://github.com/project-chip/matter-test-scripts) 57 | 58 | ## Minimum Hardware Requirements 59 | 60 | - SD card 64 GB or more 61 | - RaspberryPi 4 or newer with at least 4 GB RAM 62 | 63 | ## License 64 | 65 | The test harness and tools are released under the [Apache 2.0 license](./LICENSE). 66 | -------------------------------------------------------------------------------- /default.env: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (c) 2023 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | DOMAIN=localhost 17 | STACK_NAME=chip-test-harness 18 | 19 | # Proxy 20 | TRAEFIK_PUBLIC_NETWORK=traefik-public 21 | TRAEFIK_TAG=chip-test-harness.com 22 | TRAEFIK_PUBLIC_TAG=traefik-public 23 | 24 | # Backend 25 | PROJECT_NAME=CHIP Test Harness 26 | SECRET_KEY=790dd0ee330f50075404bdb3870273b03bf17347f3f256328fc38afaad28dd64 27 | 28 | # Postgres 29 | POSTGRES_SERVER=db 30 | POSTGRES_USER=postgres 31 | POSTGRES_PASSWORD=b461a2eee00db1934aa87d74d218a8a35eb9fbba09fd7c3f85dccc067b65d11e 32 | POSTGRES_DB=app 33 | -------------------------------------------------------------------------------- /docker-compose.override-backend-dev.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (c) 2023 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | services: 17 | backend: 18 | command: bash -c "poetry install --no-root; ./prestart.sh; while true; do sleep 1; done" # Infinite loop to keep container live doing nothing 19 | volumes: 20 | - ./:/app 21 | environment: 22 | - PYTHONPATH=/app/backend 23 | working_dir: /app/backend 24 | build: 25 | context: ./backend 26 | args: 27 | INSTALL_DEV: ${INSTALL_DEV-true} -------------------------------------------------------------------------------- /docker-compose.override-frontend-dev.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (c) 2023 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | services: 17 | frontend: 18 | volumes: 19 | - ./:/app 20 | working_dir: /app/frontend 21 | command: bash -c "npm install && while true; do sleep 1; done" # Infinite loop to keep container live doing nothing 22 | build: 23 | context: ./frontend 24 | args: 25 | INSTALL_DEV: ${INSTALL_DEV-true} 26 | FRONTEND_ENV: dev 27 | INSTALL_PUPPETEER: ${INSTALL_PUPPETEER-false} -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (c) 2023 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | services: 17 | 18 | proxy: 19 | image: traefik:v2.2 20 | ports: 21 | - "80:80" 22 | - "8090:8080" 23 | networks: 24 | - ${TRAEFIK_PUBLIC_NETWORK?Variable not set} 25 | - default 26 | volumes: 27 | - /var/run/docker.sock:/var/run/docker.sock 28 | - ./backend:/app 29 | command: 30 | # Enable Docker in Traefik, so that it reads labels from Docker services 31 | - --providers.docker 32 | # Add a constraint to only use services with the label for this stack 33 | # from the env var TRAEFIK_TAG 34 | - --providers.docker.constraints=Label(`traefik.constraint-label-stack`, `${TRAEFIK_TAG?Variable not set}`) 35 | # Do not expose all Docker services, only the ones explicitly exposed 36 | - --providers.docker.exposedbydefault=false 37 | # Enable the access log, with HTTP requests 38 | - --accesslog 39 | # Enable the Traefik log, for configurations and errors 40 | - --log 41 | # Enable the Dashboard and API 42 | - --api 43 | # Enable the Dashboard and API in insecure mode for local development 44 | - --api.insecure=true 45 | labels: 46 | - traefik.enable=true 47 | - traefik.http.routers.${STACK_NAME?Variable not set}-traefik-public-http.rule=Host(`${DOMAIN?Variable not set}`) 48 | - traefik.http.services.${STACK_NAME?Variable not set}-traefik-public.loadbalancer.server.port=80 49 | 50 | deploy: 51 | placement: 52 | constraints: 53 | - node.role == manager 54 | 55 | db: 56 | image: postgres:12 57 | ports: 58 | - "5432:5432" 59 | volumes: 60 | - app-db-data:/var/lib/postgresql/data/pgdata 61 | env_file: 62 | - .env 63 | environment: 64 | - PGDATA=/var/lib/postgresql/data/pgdata 65 | deploy: 66 | placement: 67 | constraints: 68 | - node.labels.${STACK_NAME?Variable not set}.app-db-data == true 69 | 70 | backend: 71 | image: 'ghcr.io/project-chip/csa-certification-tool-backend:2154a06' 72 | 73 | ports: 74 | - "8888:8888" 75 | - "50000:50000" 76 | volumes: 77 | - /var/run/docker.sock:/var/run/docker.sock 78 | - /usr/bin/docker:/usr/bin/docker 79 | - /var/run/dbus:/var/run/dbus 80 | - ./backend/test_collections:/app/test_collections # mount test_collections in container 81 | depends_on: 82 | - db 83 | env_file: 84 | - .env 85 | environment: 86 | - SERVER_NAME=${DOMAIN?Variable not set} 87 | - SERVER_HOST=https://${DOMAIN?Variable not set} 88 | - BACKEND_FILEPATH_ON_HOST=${BACKEND_FILEPATH_ON_HOST} 89 | privileged: true 90 | build: 91 | context: ./backend 92 | command: bash -c "./prestart.sh; python3 ./app/main.py" 93 | labels: 94 | - traefik.enable=true 95 | - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} 96 | - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(`/api`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`) 97 | - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=80 98 | 99 | frontend: 100 | image: 'ghcr.io/project-chip/csa-certification-tool-frontend:5c0c9dd' 101 | build: 102 | context: ./frontend 103 | labels: 104 | - traefik.enable=true 105 | - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} 106 | - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=PathPrefix(`/`) 107 | - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=4200 108 | volumes: 109 | app-db-data: 110 | 111 | networks: 112 | traefik-public: 113 | # Allow setting it to false for testing 114 | external: ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-false} 115 | default: 116 | name: chip-default 117 | enable_ipv6: true 118 | ipam: 119 | driver: default 120 | config: 121 | # Use fd00:MATTER::/64 ULA prefix which does not collide with the default OTBR one 122 | - subnet: fd00:6d61:7474:6572::/64 123 | -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/Matter_TH_User_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/Matter_TH_User_Guide.pdf -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_0.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_1.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_10.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_11.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_12.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_13.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_14.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_15.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_2.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_22.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_23.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_24.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_25.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_26.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_27.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_28.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_29.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_3.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_30.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_31.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_32.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_33.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_34.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_35.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_36.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_37.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_38.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_39.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_4.jpg -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_40.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_41.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_5.jpg -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_56.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_59.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_6.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_60.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_61.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_62.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_62.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_63.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_63.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_64.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_65.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_65.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_66.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_66.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_67.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_67.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_7.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_8.png -------------------------------------------------------------------------------- /docs/Matter_TH_User_Guide/images/img_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/Matter_TH_User_Guide/images/img_9.png -------------------------------------------------------------------------------- /docs/Raspberry Pi-Setup.md: -------------------------------------------------------------------------------- 1 | 17 | 18 | # Setup Raspberry Pi For Certification Use with Test Harness 19 | 20 | The following will document how to setup a Raspberry Pi so it can be used for certification with Test Harness and all configuration. 21 | 22 | ## Requirements 23 | 24 | - SD card 64 GB or more 25 | - RaspberryPi 4 or newer with at least 4 GB RAM 26 | - Internet access on Raspberry Pi during setup. 27 | 28 | 1. Download and flash a micro SD-card with [Ubuntu Server 22.04](https://ubuntu.com/download/raspberry-pi/thank-you?version=22.04.3&architecture=server-arm64+raspi) for Raspberry Pi using [Raspberry Pi imager](https://www.raspberrypi.com/software/) 29 | 30 | 2. If needed, configure WiFi ([Ubuntu guide](https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#3-wifi-or-ethernet)) 31 | 32 | 3. Boot Ubuntu 22.04 on Raspberry Pi 33 | 4. SSH into the Raspberry Pi: 34 | 35 | ``` 36 | ssh ubuntu@ 37 | ``` 38 | 39 | - Default password is `ubuntu` must be changed. 40 | - If you don't know the IP address you can discover it from another machine on the LAN: 41 | - On Linux and macOS (might require `net-tools` installed) 42 | ``` 43 | arp -na | grep -i "b8:27:eb\|dc:a6:32\|e4:5f:01" 44 | ``` 45 | - On Windows: 46 | ``` 47 | arp -a | findstr b8-27-eb dc-a6-32 e4-5f-01 48 | ``` 49 | 50 | 5. Setup `ssh` key with github 51 | 52 | Either of these works: 53 | 54 | - Copy existing GitHub registered `ssh` keys to `~/.ssh` on Raspberry Pi 55 | - Create new key 56 | - `ssh-keygen -t rsa -C ""` 57 | - and public key to [GitHub Profile](https://github.com/settings/ssh/new) 58 | 59 | 6. Clone Test Harness code: 60 | 61 | ``` 62 | git clone git@github.com:project-chip/certification-tool.git 63 | ``` 64 | 65 | 7. Start auto install 66 | 67 | Note this script takes about 1 hour to run and will reboot the machine in the end. 68 | 69 | Run the following inside `certification-tool` folder: 70 | 71 | ``` 72 | ./scripts/pi-setup/auto-install.sh 73 | ``` 74 | 75 | This script will: 76 | 77 | - Install all dependencies 78 | - Configure Machine 79 | - Pull Test Harness Code 80 | - Install Matter sample apps 81 | 82 | 8. Wait for 5-10 minutes for the test harness to startup, then access it from a browser 83 | 84 | `http://` 85 | -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/Accessing_the_TH_PostgreSQL_database.adoc: -------------------------------------------------------------------------------- 1 | //// 2 | * 3 | * Copyright (c) 2023 Project CHIP Authors 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | //// 17 | = Accessing the TH PostgreSQL database 18 | ifdef::env-github[] 19 | :tip-caption: :bulb: 20 | :note-caption: :information_source: 21 | :important-caption: :heavy_exclamation_mark: 22 | :caution-caption: :fire: 23 | :warning-caption: :warning: 24 | endif::[] 25 | ifndef::env-github[] 26 | :icons: font 27 | endif::[] 28 | :idprefix: 29 | :idseparator: - 30 | :sectlinks: 31 | :sectanchors: 32 | :sectnumlevels: 4 33 | :toc-title: 34 | :toc: 35 | 36 | :image-keep-aspect-ratio: true 37 | 38 | 39 | [discrete] 40 | == *Revision History* 41 | 42 | |=== 43 | | *Revision* | *Date* | *Author* | *Description* 44 | | 1 | 20-Jul-2023 | [CSA]Raul Marquez | * Initial version. 45 | |=== 46 | 47 | :sectnums: 48 | == pgAdmin setup 49 | === Setup command 50 | 51 | To setup *pgAdmin*, run the following command from the TH Ubuntu command line: 52 | 53 | [source,bash] 54 | ----------------- 55 | docker run \ 56 | --name=my_pgadmin \ 57 | --network=chip-default \ 58 | -p 5050:80 \ 59 | -e 'PGADMIN_DEFAULT_EMAIL=myemail@example.com' \ 60 | -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \ 61 | -d dpage/pgadmin4 62 | ----------------- 63 | 64 | === Command breakdown 65 | `name`: Container name, in this case, '_my_pgadmin_'. 66 | 67 | `network`: The network the pgAdmin container should join, '_chip-default_' is the network the TH containers are in. 68 | 69 | `-p 5050:80`: This will map port 80 from the pgAdmin container to port 5050 on the host. 70 | 71 | `PGADMIN_DEFAULT_EMAIL` / `PGADMIN_DEFAULT_PASSWORD`: This is the user that will be used to login to the pgAdmin GUI (this is NOT the DB username and password). 72 | 73 | `-d dpage/pgadmin4`: Specifies the pgAdmin image to use. 74 | 75 | Once the container is up and running, you can access the *pgAdmin GUI* by navigating to `http://{host}:5050` in your browser. 76 | 77 | == TH PostgreSQL database connection 78 | === pgAdmin login 79 | pgAdmin will provide you this login screen, enter the credentials you setup in the docker command here. 80 | 81 | image::images/pgAdminLogin.png[TH PostgreSQL database connection] 82 | 83 | === Enter connection details 84 | Right click on 'Servers', then choose _Register_ > _Server_. 85 | 86 | image::images/conn1.png[width=360,height=360][Enter connection details] 87 | 88 | In the General tab, enter the Server Name, it can be any you want, in this case, TH_DB. 89 | 90 | image::images/conn2.png[width=512,height=512][Enter connection details] 91 | 92 | In the Connection tab, enter the Host name/address, Username, and Password, then hit ‘Save’ 93 | 94 | image::images/conn3.png[width=512,height=512][Enter connection details] 95 | 96 | `Host name/address`: This should match the name of the DB container. 97 | 98 | `Username` / `Password`: These are stored in the *default.env* file in the https://github.com/project-chip/certification-tool[certification-tool^] repo. 99 | 100 | === Explore tables and run queries 101 | To see the available tables, drill down to _Servers_ > _Databases_ > _app_ > _Schemas_ > _public_ > _Tables_. 102 | 103 | image::images/query1.png[Explore tables and run queries] 104 | 105 | To run a query, click on the 'Query Tool' icon, it will provide an editor where you can execute queries. 106 | 107 | image::images/query2.png[Explore tables and run queries] 108 | -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/conn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/conn1.png -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/conn2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/conn2.png -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/conn3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/conn3.png -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/pgAdminLogin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/pgAdminLogin.png -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/query1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/query1.png -------------------------------------------------------------------------------- /docs/development/Accessing_the_TH_PostgreSQL_database/images/query2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Accessing_the_TH_PostgreSQL_database/images/query2.png -------------------------------------------------------------------------------- /docs/development/Convert_.adoc_to_.pdf_with_asciidoctor/Convert_.adoc_to_.pdf_with_asciidoctor_.adoc: -------------------------------------------------------------------------------- 1 | //// 2 | * 3 | * Copyright (c) 2023 Project CHIP Authors 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | //// 17 | = Convert .adoc to .pdf with asciidoctor 18 | ifdef::env-github[] 19 | :tip-caption: :bulb: 20 | :note-caption: :information_source: 21 | :important-caption: :heavy_exclamation_mark: 22 | :caution-caption: :fire: 23 | :warning-caption: :warning: 24 | endif::[] 25 | ifndef::env-github[] 26 | :icons: font 27 | endif::[] 28 | :idprefix: 29 | :idseparator: - 30 | :sectlinks: 31 | :sectanchors: 32 | :sectnumlevels: 4 33 | :toc-title: 34 | :toc: 35 | 36 | [discrete] 37 | == *Revision History* 38 | 39 | |=== 40 | | *Revision* | *Date* | *Author* | *Description* 41 | | 1 | 20-Jul-2023 | [CSA]Raul Marquez | * Initial version. 42 | |=== 43 | 44 | :sectnums: 45 | == Pre-requisites 46 | - Docker https://docs.docker.com/engine/install/[Install Docker^] 47 | 48 | == Build PDF 49 | From the command line, install the docker image 50 | 51 | [source,bash] 52 | ----------------- 53 | docker pull asciidoctor/docker-asciidoctor 54 | ----------------- 55 | 56 | Go to the directory where the .adoc file is, example 57 | 58 | [source,bash] 59 | ----------------- 60 | cd docs\manual 61 | ----------------- 62 | 63 | Build the .pdf file by executing the following command 64 | 65 | [source,bash] 66 | ----------------- 67 | docker run --rm -v .:/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf manual_file.adoc 68 | ----------------- 69 | 70 | A .pdf file will be created with the same name as the .adoc file 71 | 72 | == Explanation 73 | `docker run` Starts a Docker container 74 | 75 | `--rm Cleanup` - removes the Docker container after the command has been executed 76 | 77 | `-v` mount a volume to the image 78 | 79 | `.` The path to the current directory, e.g. the value of [directory to where my manual_file.adoc is located] above 80 | 81 | `documents` The name of the mounted volume in the running container 82 | 83 | `asciidoctor/docker-asciidoctor` The name of the Docker image that is used to create the Docker container 84 | 85 | `asciidoctor-pdf` The command that actually triggers the pdf generation 86 | 87 | `manual_file.adoc` The name of the AsciiDoc source file to generate the pdf from 88 | 89 | 90 | -------------------------------------------------------------------------------- /docs/development/Development-Environment-Setup.md: -------------------------------------------------------------------------------- 1 | 17 | # Develop CHIP Test Harness on Raspberry Pi 18 | 19 | Default development environment for Matter is using [VSCode](https://code.visualstudio.com) and [Dev Containers](https://containers.dev). 20 | 21 | Matter TH must run on Ubuntu 22.04, if your workstation does not run Ubuntu, you need a separate machine to run Matter TH (Ubuntu Virtual Machine, Raspberry Pi 4, etc). 22 | 23 | 24 | ## Prerequisites 25 | ### Workstation Setup 26 | - [VSCode](https://code.visualstudio.com) installed on your workstation 27 | - VSCode extensions installed: 28 | - [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) 29 | - [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) 30 | - [Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) 31 | - [Docker](https://www.docker.com/get-started/) installed on your workstation 32 | 33 | ### Matter TH Host Setup 34 | First you must get Matter TH running on Ubuntu 22.04 35 | - Git clone of Matter TH root project 36 | - Install ubuntu or Raspberry pi script in `./scripts/` 37 | 38 | ## Development on Workstation different from Matter TH Host 39 | When using a workstation diffent from the host running Matter TH we use a Docker context to connect to the running Docker containers on the Matter TH host. This will guide you thru that setup. 40 | 41 | ### Initial setup 42 | You only need to do this once on your workstation. 43 | 44 | #### Configure Docker Context For Matter TH Host 45 | 1. Determine Matter TH host ip address or hostname eg. `192.168.64.8` 46 | 2. Verify that you can successfully ssh to Matter TH host with username. 47 | 48 | Example: 49 | ```sh 50 | ssh mikaelhm@192.168.64.8 51 | ``` 52 | 3. Decide a context name, eg. `matter-context` 53 | 4. Add Docker context via cli: 54 | 55 | ```sh 56 | docker context create --docker "host=ssh://@" 57 | ``` 58 | 59 | Example: 60 | ```sh 61 | docker context create matter-context --docker "host=ssh://mikaelhm@192.168.64.8" 62 | ``` 63 | 5. Select docker context using Docker cli: 64 | 65 | ```sh 66 | docker context use 67 | ``` 68 | 69 | Example: 70 | ```sh 71 | docker context use matter-context 72 | ``` 73 | 74 | ## Starting Development environment 75 | 76 | 1. On Matter TH Host, start the TH in `frontend` or `backend` development mode. 77 | 78 | Example for backend 79 | ```sh 80 | ./scripts/start.sh --backend-dev 81 | ``` 82 | 83 | Example for frontend 84 | ```sh 85 | ./scripts/start.sh --frontend-dev 86 | ``` 87 | 88 | This will start the TH as normal, except for the container that will be used for development. Eg. for backend the python server will not be started when using `--backend-dev`, as the developer can then manually start the server in debug mode. 89 | 90 | 2. Launch VS Code on Workstartion 91 | 3. Connect to `backend` or `frontend` container on Matter TH Host, via Docker tab in VSCode. 92 | 93 | Under containers there should be a `backend:latest` and a `frontend:latest`, plus `postgres` and `traefik`. 94 | 95 | Left click and selecting `Attach Visual Studio Code` on the container you want to connect VSCode to. 96 | 97 | VS Code will open a new window attached inside the docker container with all dev-tools available. 98 | 4. First time connecting VSCode, you need to "Open Folder" `/app/backend` or `/app/frontend`. 99 | 5. Additionally, you might be propted to install recommended extensions. Please install them all. 100 | 101 | 102 | NOTE: in-order to use git inside VS Code you must setup credential sharing: 103 | (https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials)[https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials] 104 | 105 | 106 | 107 | ## Troubleshooting 108 | 109 | #### VSCode opens unexpected folder when attaching to container check the imageConfig on workstation: 110 | 111 | 1. Open new VS Code window (No folder open and not attached to container) 112 | 2. Open Control pallet (CMD+SHIFT+P or F1) 113 | 3. Open "Remote-Containers: Open Container Configuration" 114 | 4. Select image "backend:latest" or "frontend:latest" 115 | 5. Verify `workspaceFolder` is set to the expected `/app/backend` or `/app/frontend` 116 | 117 | 118 | ### When running backend server, sqlalchemy does not find user 119 | 120 | ``` 121 | ... 122 | sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "user" does not exist 123 | LINE 2: FROM "user" 124 | ^ 125 | 126 | [SQL: SELECT "user".id AS user_id, "user".full_name AS user_full_name, "user".email AS user_email, "user".hashed_password AS user_hashed_password, "user".is_active AS user_is_active, "user".is_superuser AS user_is_superuser 127 | FROM "user" 128 | WHERE "user".email = %(email_1)s 129 | LIMIT %(param_1)s] 130 | [parameters: {'email_1': 'admin@admin.com', 'param_1': 1}] 131 | ``` 132 | 133 | reset database by running `python backend/scripts/reset_db.py` in backend container 134 | 135 | ## Useful commands 136 | - `docker context ls` : lists all the docker contexts. Can be used to verify if `chippi` context is created successfully 137 | - `docker context rm ` : removes a docker context 138 | - `docker context use ` : changes the docker context to `` 139 | 140 | 141 | ## Reset DB 142 | - Run the `scripts/reset_db.py` script inside the backend container to drop and create a database, and run all the database migrations. -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows.adoc: -------------------------------------------------------------------------------- 1 | //// 2 | * 3 | * Copyright (c) 2023 Project CHIP Authors 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | //// 17 | = Install Ubuntu Linux Subsystem (WSL) in Windows 18 | ifdef::env-github[] 19 | :tip-caption: :bulb: 20 | :note-caption: :information_source: 21 | :important-caption: :heavy_exclamation_mark: 22 | :caution-caption: :fire: 23 | :warning-caption: :warning: 24 | endif::[] 25 | ifndef::env-github[] 26 | :icons: font 27 | endif::[] 28 | :idprefix: 29 | :idseparator: - 30 | :sectlinks: 31 | :sectanchors: 32 | :sectnumlevels: 4 33 | :toc-title: 34 | :toc: 35 | 36 | [discrete] 37 | == *Revision History* 38 | 39 | |=== 40 | | *Revision* | *Date* | *Author* | *Description* 41 | | 1 | 20-Jul-2023 | [CSA]Raul Marquez | * Initial version. 42 | |=== 43 | 44 | :sectnums: 45 | == Verify Windows Subsystem for Linux (WSL) is enabled 46 | Search for '_windows features_' and click on the '_Turn Windows features on or off_' result 47 | 48 | image::images/1.png[width=480,height=480][Verify Windows Subsystem for Linux (WSL) is enabled] 49 | 50 | If '_Windows Subsystem for Linux_' isn’t checked, check it and restart the computer, if it’s already checked you can move on to the next section 51 | 52 | image::images/2.png[width=360,height=360][Verify Windows Subsystem for Linux (WSL) is enabled] 53 | 54 | == Update WSL 55 | Open a command prompt and run this command 56 | 57 | [source,bash] 58 | ----------------- 59 | wsl --update 60 | ----------------- 61 | 62 | If it’s already up to date, you will see an output similar to this 63 | 64 | image::images/3.png[width=540,height=64][Update WSL] 65 | 66 | Otherwise, wait until WSL is updated 67 | 68 | == Install Ubuntu 69 | To install Ubuntu, run this command 70 | 71 | [source,bash] 72 | ----------------- 73 | wsl --install Ubuntu 74 | ----------------- 75 | 76 | You will be prompted for a new UNIX username and password, enter them, you will see an output similar to this 77 | 78 | image::images/4.png[width=420,height=420][Install Ubuntu] 79 | 80 | At this point, you will be logged into the Ubuntu instance with the user/pass you provided 81 | 82 | To login again in the future, run this command 83 | 84 | [source,bash] 85 | ----------------- 86 | wsl -d Ubuntu 87 | ----------------- 88 | 89 | == Access your Windows files 90 | You can access you Windows files and folders by going to the /mnt/c folder 91 | 92 | [source,bash] 93 | ----------------- 94 | cd /mnt/c 95 | ----------------- 96 | 97 | image::images/5.png[width=440,height=320][Access your Windows files] 98 | 99 | == Reset the Ubuntu instance 100 | If for any reason you need to reset the Ubuntu instance, run this command 101 | 102 | [source,bash] 103 | ----------------- 104 | wsl --unregister Ubuntu 105 | ----------------- 106 | 107 | Then, repeat the install command from the previous section -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/1.png -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/2.png -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/3.png -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/4.png -------------------------------------------------------------------------------- /docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/project-chip/certification-tool/9fb20ce8f911312c038e19523c0ca0771cc851ec/docs/development/Install_Ubuntu_Linux_Subsystem_WSL_in_Windows/images/5.png -------------------------------------------------------------------------------- /docs/enable_wifi_and_ssh_raspi_ubuntu_server.md: -------------------------------------------------------------------------------- 1 | 17 | 18 | ### By default, wifi is disabled in Ubuntu Server, we need the below way to enable WiFi on Raspberry Pi. 19 | 20 | _This manual assumes you have a Raspberry Pi connected to monitor with a keyboard._ 21 | 22 | _There is a way to modify the sd card's files directly after flashing to enable wifi once you put it in your raspi. But finding the IP address to SSH to will be tricky unless you have very few devices on your intended network._ 23 | 24 | _(also... please replace vim with you favorite text editor in the following steps!)_ 25 | 26 | # Create a network plan with your intended wifi's SSID and password: 27 | 28 | 1. `sudo vim /etc/netplan/50-cloud-init.yaml` 29 | 30 | 2. Delete the contents of the file if there is any. 31 | 32 | 3. Paste the following into the file before saving+closing it; making sure to replacing `` & ``: 33 | 34 | ``` 35 | network: 36 | ethernets: 37 | eth0: 38 | dhcp4: true 39 | match: 40 | driver: bcmgenet smsc95xx lan78xx 41 | optional: true 42 | set-name: eth0 43 | version: 2 44 | wifis: 45 | wlan0: 46 | optional: true 47 | access-points: 48 | "": 49 | password: "" 50 | dhcp4: true 51 | ``` 52 | 53 | 4. `$ sudo netplan -debug generate` 54 | 5. `$ sudo reboot` 55 | 56 | _Pro Tip: To change wifi networks in the future, edit the `` & `` and reboot the Raspberry Pi._ 57 | 58 | ## Enable WiFi supplicant permission in Ubuntu server: 59 | 60 | By default, wpa_supplicant is not allowed to update (overwrite) configurations, if you want chip app to be able to store the configuration changes permanently, we need to make the following changes: 61 | 62 | 6. Edit `dbus-fi.w1.wpa_supplicant1.service` to use our own conf file instead: 63 | 64 | `$ sudo vim /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service` 65 | 66 | 7. Change the wpa_supplicant start parameter to match the following, then save+close the file: 67 | 68 | `ExecStart=/sbin/wpa_supplicant -u -s -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf` 69 | 70 | 8. Create the wpa-supplicant conf file: 71 | 72 | ` $ sudo vim /etc/wpa_supplicant/wpa_supplicant.conf` 73 | 74 | 9. Paste the following into the new file before saving+closing the file: 75 | 76 | ``` 77 | ctrl_interface=DIR=/run/wpa_supplicant 78 | update_config=1 79 | ``` 80 | 81 | 10. `$ sudo reboot` 82 | 83 | After reboot your Raspberry Pi should be connected to the wifi-network you specified in step 4. 84 | 85 | 11. Remove any eth cables and run `$ ping 8.8.8.8` to make sure you are connected to the wifi network and online! 86 | 87 | _TROUBLESHOOTING: If this doesn't work, revisit the prior steps double checking you got the SSID and password correct._ 88 | 89 | ## SSHing to your Raspberry Pi over wifi 90 | 91 | 12. Enable ssh on the Raspberry Pi by running `$ sudo raspi-config` _(you may need to intall it)_. 92 | 93 | 13. In the `raspi-config` GUI Navigate to `Interfacte Option` --> `SSH` --> `` --> `` --> `` 94 | 95 | 14. Run `$ hostname -I` on the raspi after reboot to get the ip of the Raspberry Pi on your network. 96 | 97 | 15. While on the same network (via wifi or eth) as the Raspberry Pi, run `$ ssh ubuntu@` from your computer. 98 | 99 | 16. Hopefully you're in! 100 | -------------------------------------------------------------------------------- /logs/.keep: -------------------------------------------------------------------------------- 1 | Do not remove this file -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Exit in case of error 19 | set -e 20 | 21 | ./backend/scripts/build-docker-image.sh "$@" 22 | ./frontend/scripts/build-docker-image.sh "$@" 23 | -------------------------------------------------------------------------------- /scripts/clean-up.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # 3 | # Copyright (c) 2024 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | # Add utility operations to this script 21 | source "$SCRIPT_DIR/utils.sh" 22 | 23 | # Exit in case of error 24 | set -e 25 | 26 | clean_up_environment() { 27 | rm -rf $HOME/apps 28 | rm -rf $HOME/.cache/pypoetry 29 | 30 | print_script_step "Resetting Database" 31 | if [ ! $(docker ps -aq -f name=^certification-tool-backend-1$) ]; then 32 | docker compose -f $ROOT_DIR/docker-compose.yml -f $ROOT_DIR/docker-compose.override-backend-dev.yml up db backend --detach --no-build 33 | fi 34 | docker exec certification-tool-backend-1 bash -c "./prestart.sh ; poetry install ; ./scripts/reset_db.py" 35 | 36 | print_script_step "Stopping all docker containers" 37 | $ROOT_DIR/scripts/stop.sh 38 | 39 | print_script_step "Cleaning All Images" 40 | docker network prune -f 41 | docker system prune -af --volumes 42 | } 43 | 44 | print_start_of_script 45 | 46 | echo 47 | echo "This operation will erase all the data from the database and prune the docker images and networks" 48 | read -p "Are you sure you want to clean up the Test-Harness environment? [y/N] " -n 1 -r 49 | echo 50 | 51 | if [[ $REPLY =~ ^[Yy]$ ]]; then 52 | clean_up_environment 53 | else 54 | echo 55 | echo "Cancelling..." 56 | fi 57 | 58 | print_end_of_script 59 | -------------------------------------------------------------------------------- /scripts/create-release-tag.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # set -x 18 | 19 | TAG_DESCRIPTION="" 20 | REMOTE="origin" 21 | MATTER_PROGRAM_DIR=$(realpath $(dirname "$0")/../backend/test_collections/matter) 22 | 23 | # Get configured SDK_SHA (will default to value in ./backend/test_collection/matter/config.py) 24 | SDK_SHA=$(cat $MATTER_PROGRAM_DIR/config.py | grep SDK_SHA | cut -d'"' -f 2 | cut -d"'" -f 2) 25 | 26 | if [ -z "$SDK_SHA"] 27 | then 28 | echo "### Error: Matter SDK information not found. Please verify the Matter program 'config.py' file" 29 | exit 1 30 | fi 31 | 32 | # Check if a TAG name was provided. 33 | if [ $# -eq 2 ] 34 | then 35 | TAG_NAME="$1" 36 | TAG_DESCRIPTION="$2" 37 | elif [ $# -eq 3 ] 38 | then 39 | TAG_NAME="$1" 40 | TAG_DESCRIPTION="$2" 41 | REMOTE="$3" 42 | else 43 | echo "Usage: ./scripts/create-release-tag.sh tag_name tag_description custom_remote" 44 | echo " tag_name [Required] The git TAG name" 45 | echo " tag_description [Required] The git TAG description" 46 | echo " custom_remote [Optional] you can set a custom remote (default is $REMOTE)" 47 | echo "Example: ./scripts/create-release-tag.sh v2.10+fall2024 \"Release for Fall 2024\"" 48 | exit 1 49 | fi 50 | 51 | echo "*** Deleting old local tag" 52 | git tag -d $TAG_NAME 53 | 54 | echo "*** Creating a local release tag" 55 | GIT_SUBMODULES=$(git submodule) 56 | TAG_SHA_DESCRIPTION=$(printf "$GIT_SUBMODULES\n $SDK_SHA Matter SDK") 57 | git tag -a $TAG_NAME -m "$TAG_NAME" -m "$TAG_DESCRIPTION" -m "$TAG_SHA_DESCRIPTION" 58 | 59 | echo "*** Release tag" 60 | git tag -v $TAG_NAME 61 | 62 | printf "\n\n**********\n" 63 | printf "Do you want to push the tag to remote[$REMOTE]?\n" 64 | select yn in "Push" "Do not Push" 65 | do 66 | case $yn in 67 | Push ) 68 | echo "*** Pushing tag on remote" 69 | git push $REMOTE $TAG_NAME 70 | break 71 | ;; 72 | *) 73 | exit 74 | ;; 75 | esac 76 | done 77 | -------------------------------------------------------------------------------- /scripts/generate-pdf-user-guide.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # This is an Asciidoc to PDF file format bash script 18 | # 19 | # The solution uses the Docker Asciidoctor to convert the Test-Harness User Guide Asciidoc file 20 | # 21 | # Unfortunatly, the Asciidoctor project does not provide multi-arch docker images 22 | # Thus, this script only works for x86_64 CPU architecture machines 23 | # 24 | # For more information on the docker asciidoctor, please refer to: 25 | # https://github.com/asciidoctor/docker-asciidoctor 26 | # 27 | 28 | # Project's root directory 29 | ROOT_DIR=$(realpath $(dirname "$0")/..) 30 | USER_GUIDE_PATH="$ROOT_DIR/docs/Matter_TH_User_Guide/" 31 | 32 | # Docker related variables 33 | DOCKER_IMAGE=asciidoctor/docker-asciidoctor # Official Docker image with Asciidoctor 34 | ALT_DOCKER_IMAGE=kidip/chip-documentation # Alternative Docker Image with Asciidoctor 35 | DOCKER_ARGS="run --rm -v $USER_GUIDE_PATH:/documents/" # Docker arguments with run and volumes bind 36 | 37 | # Call the Docker Asciidoctor PDF application 38 | docker $DOCKER_ARGS $DOCKER_IMAGE asciidoctor-pdf Matter_TH_User_Guide.adoc 39 | -------------------------------------------------------------------------------- /scripts/install-default-env.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | 19 | cd $ROOT_DIR 20 | if [ ! -e ".env" ] 21 | then 22 | cp default.env .env 23 | fi 24 | -------------------------------------------------------------------------------- /scripts/pi-setup/auto-install.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | PI_SCRIPT_DIR="$ROOT_DIR/scripts/pi-setup" 19 | LOG_FILENAME=$(date +"log-pi_setup-auto-install_%F-%H-%M-%S") 20 | LOG_PATH="$ROOT_DIR/logs/$LOG_FILENAME" 21 | 22 | $PI_SCRIPT_DIR/internal-auto-install.sh $* | tee $LOG_PATH 23 | -------------------------------------------------------------------------------- /scripts/pi-setup/install-pi-dependencies.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | set -e 18 | 19 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 20 | SCRIPT_DIR="$ROOT_DIR/scripts" 21 | 22 | source "$SCRIPT_DIR/utils.sh" 23 | 24 | print_start_of_script 25 | 26 | print_script_step "Silence user prompts about reboot and service restart required (script will prompt user to reboot in the end)" 27 | sudo sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf 28 | sudo sed -i "s/#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf 29 | 30 | print_script_step "Upgrade OS" 31 | sudo DEBIAN_FRONTEND=noninteractive apt-get update -y 32 | sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y 33 | 34 | # TODO Comment on what dependency is required for: 35 | packagelist=( 36 | "pi-bluetooth (>=0.1.18ubuntu4)" 37 | "bluetooth (>=5.64-0ubuntu1.1)" 38 | "linux-raspi (>=5.15.0.1055.53)" 39 | ) 40 | 41 | SAVEIFS=$IFS 42 | IFS=$(echo -en "\r") 43 | for package in ${packagelist[@]}; do 44 | print_script_step "Instaling package: ${package[@]}" 45 | sudo DEBIAN_FRONTEND=noninteractive sudo apt-get satisfy ${package[@]} -y --allow-downgrades 46 | done 47 | IFS=$SAVEIFS 48 | 49 | print_end_of_script 50 | -------------------------------------------------------------------------------- /scripts/pi-setup/internal-auto-install.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | PI_SCRIPT_DIR="$SCRIPT_DIR/pi-setup" 20 | UBUNTU_SCRIPT_DIR="$SCRIPT_DIR/ubuntu" 21 | 22 | source "$SCRIPT_DIR/utils.sh" 23 | 24 | print_start_of_script 25 | 26 | check_installation_prerequisites 27 | verify_return_code 28 | 29 | print_script_step "Installing Raspberry Pi Dependencies" 30 | $PI_SCRIPT_DIR/install-pi-dependencies.sh 31 | verify_return_code 32 | 33 | print_script_step "Running Ubuntu auto-install" 34 | $UBUNTU_SCRIPT_DIR/auto-install.sh 35 | verify_return_code 36 | 37 | print_end_of_script 38 | -------------------------------------------------------------------------------- /scripts/start.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | 19 | ## SET BACKEND PATH ENV 20 | KEY="BACKEND_FILEPATH_ON_HOST" 21 | VALUE=$(readlink -f $ROOT_DIR/backend) 22 | export $KEY=$VALUE 23 | 24 | cd $ROOT_DIR 25 | 26 | # Exit in case of error 27 | set -e 28 | 29 | # Ensure .env exists 30 | ./scripts/install-default-env.sh 31 | 32 | # Dev override files 33 | BACKEND_COMPOSE_DEV="-f docker-compose.override-backend-dev.yml" 34 | FRONTEND_COMPOSE_DEV="-f docker-compose.override-frontend-dev.yml" 35 | 36 | # Parse args for which docker compose overrides to use 37 | BACKEND_COMPOSE="" 38 | FRONTEND_COMPOSE="" 39 | COMPOSE_CACHE_OPTION="" 40 | BACKEND_DEV=false 41 | FRONTEND_DEV=false 42 | for arg in "$@" 43 | do 44 | case $arg in 45 | -b|--backend-dev) 46 | BACKEND_DEV=true 47 | BACKEND_COMPOSE=$BACKEND_COMPOSE_DEV 48 | shift # Remove --backend from processing 49 | ;; 50 | -f|--frontend-dev) 51 | FRONTEND_DEV=true 52 | FRONTEND_COMPOSE=$FRONTEND_COMPOSE_DEV 53 | shift # Remove --frontend from processing 54 | ;; 55 | *) 56 | OTHER_ARGUMENTS+=("$1") 57 | shift # Remove generic argument from processing 58 | ;; 59 | esac 60 | done 61 | 62 | # Do not exit in case of error 63 | set +e 64 | 65 | echo "*** Starting 'db' and 'proxy' docker containers" 66 | docker compose -f docker-compose.yml up db proxy --detach 67 | if [ $? -ne 0 ]; then 68 | echo "### Exit with Error ###" 69 | echo " Unable to start containers." 70 | echo " You can also pull the images manually using this command: $ 'docker compose -f docker-compose.yml pull db proxy'" 71 | exit 1 72 | fi 73 | 74 | echo "*** Starting 'backend' docker container" 75 | docker compose -f docker-compose.yml $BACKEND_COMPOSE up backend --detach --no-build 76 | if [ $? -ne 0 ]; then 77 | echo "### Exit with Error ###" 78 | echo " Unable to start backend container." 79 | echo " Check if the tag is correct in the docker compose file." 80 | echo " You can also build the image manually using this command: $ './backend/scripts/build-docker-image.sh'" 81 | exit 1 82 | fi 83 | 84 | echo "*** Starting 'frontend' docker container" 85 | docker compose -f docker-compose.yml $FRONTEND_COMPOSE up frontend --detach --no-build 86 | if [ $? -ne 0 ]; then 87 | echo "### Exit with Error ###" 88 | echo " Unable to start frontend container." 89 | echo " Check if the tag is correct in the docker compose file." 90 | echo " You can also build the image manually using this command: $ './frontend/scripts/build-docker-image.sh'" 91 | exit 1 92 | fi 93 | 94 | if [ "$FRONTEND_DEV" = true ] ; then 95 | echo "!!!! Matter TH frontend started in development mode." 96 | echo "!!!! Manually start frontend by connecting to the frontend container" 97 | else 98 | echo -n "Waiting for frontend to start" 99 | until docker compose exec frontend curl --fail -s --output /dev/null http://localhost:4200 100 | do 101 | echo -n "." 102 | sleep 5 103 | done 104 | echo " done" 105 | fi 106 | 107 | if [ "$BACKEND_DEV" = true ] ; then 108 | echo "!!!! Matter TH backend started in development mode." 109 | echo "!!!! Manually start backend by connecting to the backend container" 110 | else 111 | echo -n "Waiting for backend to start" 112 | until docker compose exec backend curl --fail -s --output /dev/null http://localhost/docs 113 | do 114 | echo -n "." 115 | sleep 5 116 | done 117 | echo " done" 118 | fi 119 | 120 | echo "Script 'start.sh' completed successfully" 121 | -------------------------------------------------------------------------------- /scripts/stop.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | cd $ROOT_DIR 19 | # Exit in case of error 20 | set -e 21 | docker compose -f docker-compose.yml down 22 | 23 | echo "Script 'stop.sh' completed successfully" 24 | -------------------------------------------------------------------------------- /scripts/test-local.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Exit in case of error 19 | set -e 20 | 21 | # Ensure .env exists 22 | ./scripts/install-default-env.sh 23 | 24 | docker-compose down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error 25 | 26 | if [ $(uname -s) = "Linux" ]; then 27 | echo "Remove __pycache__ files" 28 | sudo find . -type d -name __pycache__ -exec rm -r {} \+ 29 | fi 30 | 31 | docker-compose build 32 | docker-compose up -d 33 | docker-compose exec -T backend bash /app/tests-start.sh "$@" 34 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env sh 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Exit in case of error 19 | set -e 20 | 21 | # Ensure .env exists 22 | ./scripts/install-default-env.sh 23 | 24 | DOMAIN=backend \ 25 | TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL=false \ 26 | INSTALL_DEV=true \ 27 | docker-compose \ 28 | -f docker-compose.yml \ 29 | config > docker-stack.yml 30 | 31 | docker-compose -p "chip-cert-tool-test" -f docker-stack.yml build 32 | docker-compose -p "chip-cert-tool-test" -f docker-stack.yml down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error 33 | docker-compose -p "chip-cert-tool-test" -f docker-stack.yml up -d 34 | docker-compose -p "chip-cert-tool-test" -f docker-stack.yml exec -T backend bash /app/tests-start.sh "$@" 35 | docker-compose -p "chip-cert-tool-test" -f docker-stack.yml down -v --remove-orphans 36 | -------------------------------------------------------------------------------- /scripts/th/_th-backend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | CONTAINER_NAME="certification-tool-backend-1" 19 | 20 | # Check if the container is running 21 | container_running=$(docker inspect -f '{{.State.Running}}' $CONTAINER_NAME 2>/dev/null) 22 | 23 | # If the docker inspect command fails or the container is not running, notify and exit 24 | if [ "$?" -ne 0 ] || [ "$container_running" != "true" ]; then 25 | echo "The container \"$CONTAINER_NAME\" is not running.\nPlease start it and try again." 26 | exit 1 27 | fi 28 | 29 | # Function to check if command exists inside the container 30 | command_exists_in_container () { 31 | docker exec $CONTAINER_NAME sh -c "type $1" &> /dev/null 32 | } 33 | 34 | # Fetch pip list from container 35 | echo "----- Python Environment -----" 36 | if command_exists_in_container pip; then 37 | pip_list=$(docker exec $CONTAINER_NAME pip list) 38 | echo "$pip_list" 39 | elif command_exists_in_container pip3; then 40 | pip_list=$(docker exec $CONTAINER_NAME pip3 list) 41 | echo "$pip_list" 42 | else 43 | echo "Neither pip nor pip3 is installed in the container." 44 | fi 45 | 46 | -------------------------------------------------------------------------------- /scripts/th/_th-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 19 | 20 | # Set the path to the file containing the package list 21 | FILE_PATH=$ROOT_DIR"/cli/pyproject.toml" 22 | 23 | # Check if file exists 24 | if [ ! -f "$FILE_PATH" ]; then 25 | echo "File not found! This usually means that the submodule isn't initialized." 26 | exit 1 27 | fi 28 | 29 | # Function to extract and print dependencies from a section 30 | print_dependencies() { 31 | section=$1 32 | echo -e "${section}" 33 | printf "%-30s %-20s\n" "Package Name" "Listed Version" 34 | echo "---------------------------------------------" 35 | awk -v section="$section" 'BEGIN{flag=0} $0 == section {flag=1; next} flag && /^\[/{exit} flag {print $0}' "$FILE_PATH" | \ 36 | grep '=' | sed 's/ = /:/g' | tr -d '"' | tr -d ',' | while read -r line; do 37 | package_name=$(echo $line | cut -d: -f1) 38 | listed_version=$(echo $line | cut -d: -f2) 39 | printf "%-30s %-20s\n" "$package_name" "$listed_version" 40 | done 41 | echo "" # Print an empty line as a separator 42 | } 43 | 44 | # Call the function for each section 45 | print_dependencies "[tool.poetry.dependencies]" 46 | print_dependencies "[tool.poetry.dev-dependencies]" 47 | -------------------------------------------------------------------------------- /scripts/th/_th-docker-logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 19 | 20 | # Containers 21 | BACKEND_CONTAINER_NAME="certification-tool-backend-1" 22 | FRONTEND_CONTAINER_NAME="certification-tool-frontend-1" 23 | DB_CONTAINER_NAME="certification-tool-db-1" 24 | PROXY_CONTAINER_NAME="certification-tool-proxy-1" 25 | 26 | # Function to check if a container is running and print the last 100 log lines 27 | print_container_logs() { 28 | local container_name=$1 29 | 30 | echo 31 | echo 32 | echo "########################################################" 33 | echo "## Docker Logs for '${container_name}'" 34 | echo "## Last 100 log lines:" 35 | echo "########################################################" 36 | 37 | if ! docker ps --format '{{.Names}}' | grep -q "^${container_name}$"; then 38 | echo " The container is not running." 39 | else 40 | docker logs --tail 100 $container_name 41 | fi 42 | } 43 | 44 | echo 45 | echo "^^ THE ABOVE DOCKER LOGS ARE PART OF THE '$DB_CONTAINER_NAME' CONTAINER. ^^" 46 | echo " IT'S UNKNOWN WHY THIS HAPPENS WITH THE DB CONTAINER ONLY, WHICH IS THE" 47 | echo " LOGS APPEARING BEFORE ITS HEADER TITLE, ANY HELP WITH THIS IS APPRECIATED" 48 | echo 49 | 50 | # Call the function for each container 51 | print_container_logs $BACKEND_CONTAINER_NAME 52 | print_container_logs $FRONTEND_CONTAINER_NAME 53 | print_container_logs $DB_CONTAINER_NAME 54 | print_container_logs $PROXY_CONTAINER_NAME 55 | -------------------------------------------------------------------------------- /scripts/th/_th-dut.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Retrieve the hostname 19 | host=$(hostname -I | awk '{print $1}') 20 | 21 | # Define the endpoint with dynamic host 22 | endpoint="http://$host/api/v1/projects/default_config" 23 | 24 | # Make the GET request and store the response along with headers 25 | response=$(curl -si "$endpoint") 26 | 27 | # Check if the curl command was successful 28 | if [ $? -eq 0 ]; then 29 | # Extract the HTTP status code from the response 30 | status_code=$(echo "$response" | grep -oP '(?<=HTTP/1.1 )\d+') 31 | 32 | # Check if the status code indicates an error (i.e., not 2xx) 33 | if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then 34 | echo "Received an error response. Status Code: $status_code" 35 | # Handle the error (e.g., retry, log the error, notify an admin, etc.) 36 | exit 1 37 | else 38 | # Extract the body from the response (exclude headers) 39 | body=$(echo "$response" | sed -n '/^\r$/,$p' | sed '1d') 40 | # Check if the body starts with a valid JSON character 41 | if [[ "$body" =~ ^\{ || "$body" =~ ^\[ ]]; then 42 | # Output the body (pretty-printed with Python) 43 | if command -v python &>/dev/null 44 | then 45 | echo "$body" | python -m json.tool 46 | elif command -v python3 &>/dev/null 47 | then 48 | echo "$body" | python3 -m json.tool 49 | else 50 | echo "Python is not installed. Cannot pretty-print JSON." 51 | fi 52 | else 53 | echo "The endpoint did not return valid JSON data." 54 | echo "Response body: $body" 55 | fi 56 | fi 57 | else 58 | # Output an error message if the curl command fails 59 | echo "Failed to retrieve data from endpoint." 60 | fi 61 | -------------------------------------------------------------------------------- /scripts/th/_th-env-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Function to check if a command exists 19 | command_exists () { 20 | type "$1" &> /dev/null 21 | } 22 | 23 | # Fetch Node, npm, and Angular versions locally 24 | echo "----- JavaScript/TypeScript Environments -----" 25 | 26 | if command_exists node; then 27 | echo "Node version: $(node -v)" 28 | else 29 | echo "Node is not installed." 30 | fi 31 | 32 | if command_exists npm; then 33 | echo "npm version: $(npm -v)" 34 | else 35 | echo "npm is not installed." 36 | fi 37 | 38 | if command_exists ng; then 39 | # Assuming that Angular CLI is installed globally and you can use 'ng version' 40 | angular_version=$(ng version 2>&1 | grep 'Angular CLI:' | awk '{print $3}') 41 | echo "Angular version: $angular_version" 42 | else 43 | echo "Angular CLI is not installed." 44 | fi 45 | echo "" 46 | 47 | # Fetch pip list locally 48 | echo "----- Python Environment -----" 49 | if command_exists pip; then 50 | pip list 51 | elif command_exists pip3; then 52 | pip3 list 53 | else 54 | echo "Neither pip nor pip3 is found on the system." 55 | fi 56 | 57 | -------------------------------------------------------------------------------- /scripts/th/_th-frontend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | CONTAINER_NAME="certification-tool-frontend-1" 19 | 20 | # Check if the container is running 21 | container_running=$(docker inspect -f '{{.State.Running}}' $CONTAINER_NAME 2>/dev/null) 22 | 23 | # If the docker inspect command fails or the container is not running, notify and exit 24 | if [ "$?" -ne 0 ] || [ "$container_running" != "true" ]; then 25 | echo "The container \"$CONTAINER_NAME\" is not running.\nPlease start it and try again." 26 | exit 1 27 | fi 28 | 29 | # Function to check if command exists inside the container 30 | command_exists_in_container () { 31 | docker exec $CONTAINER_NAME sh -c "type $1" &> /dev/null 32 | } 33 | 34 | # Check Node version 35 | if command_exists_in_container node; then 36 | node_version=$(docker exec $CONTAINER_NAME node -v) 37 | else 38 | node_version="Not installed in the container" 39 | fi 40 | 41 | # Check npm version 42 | if command_exists_in_container npm; then 43 | npm_version=$(docker exec $CONTAINER_NAME npm -v) 44 | else 45 | npm_version="Not installed in the container" 46 | fi 47 | 48 | # Fetch Angular version from package.json 49 | angular_version=$(docker exec $CONTAINER_NAME sh -c "cat package.json | grep '@angular/core' | awk -F':' '{print $2}'" | sed 's/[^0-9.]*//g') 50 | 51 | if [ -z "$angular_version" ]; then 52 | angular_version="Not found in package.json" 53 | fi 54 | 55 | # Print versions 56 | echo "----- JavaScript/TypeScript Environments -----" 57 | echo "Node version: $node_version" 58 | echo "npm version: $npm_version" 59 | echo "Angular version: $angular_version" 60 | -------------------------------------------------------------------------------- /scripts/th/_th-network.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Function to display information for each network interface 19 | display_interface_info() { 20 | interface=$1 21 | echo "Interface: $interface" 22 | 23 | # Check if interface is up 24 | if ip link show "$interface" | grep -q 'state UP'; then 25 | echo " Status: UP" 26 | else 27 | echo " Status: DOWN" 28 | fi 29 | 30 | # Get and display the IPv4 address 31 | ipv4_address=$(ip -4 addr show "$interface" | grep -oP '(?<=inet\s)\d+(\.\d+){3}') 32 | [ -z "$ipv4_address" ] && ipv4_address="N/A" 33 | echo " IPv4 Address: $ipv4_address" 34 | 35 | # Get and display the IPv6 address 36 | ipv6_address=$(ip -6 addr show "$interface" | grep -oP '(?<=inet6\s)[a-f0-9:]+') 37 | [ -z "$ipv6_address" ] && ipv6_address="N/A" 38 | echo " IPv6 Address: $ipv6_address" 39 | 40 | # Get and display the subnet mask 41 | subnet_mask=$(ifconfig "$interface" | grep -oP '(?<=Mask:)[0-9.]+') 42 | [ -z "$subnet_mask" ] && subnet_mask="N/A" 43 | echo " Subnet Mask: $subnet_mask" 44 | 45 | # Get and display the MAC address 46 | mac_address=$(ip link show "$interface" | grep -oP '(?<=ether\s)[a-f0-9:]+') 47 | [ -z "$mac_address" ] && mac_address="N/A" 48 | echo " MAC Address: $mac_address" 49 | } 50 | 51 | # Get a list of all network interfaces 52 | interfaces=$(ip link show | grep -oP '(?<=^\d: )[e-w]+[0-9a-zA-Z-]+') 53 | 54 | # Iterate over each interface and display relevant information 55 | for intf in $interfaces; do 56 | display_interface_info "$intf" 57 | echo "" 58 | done 59 | 60 | # Get and display the default gateway 61 | default_gateway=$(ip route | grep default | awk '{print $3}') 62 | [ -z "$default_gateway" ] && default_gateway="N/A" 63 | echo "Default Gateway: $default_gateway" 64 | 65 | # Get and display the DNS server information 66 | mapfile -t dns_servers < <(grep nameserver /etc/resolv.conf | awk '{print $2}') 67 | if [ ${#dns_servers[@]} -eq 0 ]; then 68 | echo "DNS Servers: N/A" 69 | else 70 | echo "DNS Servers: ${dns_servers[*]}" 71 | fi 72 | echo 73 | 74 | # Check if Internet is available 75 | echo "Checking Internet availability..." 76 | if ping -c 1 8.8.8.8 &> /dev/null 77 | then 78 | echo "Internet is available" 79 | else 80 | echo "Internet is not available" 81 | fi 82 | -------------------------------------------------------------------------------- /scripts/th/_th-repo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 19 | cd $ROOT_DIR 20 | 21 | get_repo_and_branch_info() { 22 | # Input validation 23 | if [ -z "$1" ]; then 24 | echo "Please provide a path." 25 | return 1 26 | fi 27 | 28 | path="$1" 29 | repo_friendly_name="Test Harness" 30 | 31 | if [ "$path" != "." ]; then 32 | title_case_path=$(echo "$path" | awk '{ for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2)); }1') 33 | repo_friendly_name=$title_case_path 34 | fi 35 | 36 | # Check if the directory exists 37 | if [ ! -d "$path" ]; then 38 | echo "Directory '$path' does not exist." 39 | return 1 40 | fi 41 | 42 | cd $path 43 | 44 | # Get the URL of the remote origin 45 | remote_url=$(git config --get remote.origin.url) 46 | 47 | if [ -n "$remote_url" ]; then 48 | # Extract the repository name from the URL 49 | repo_name=$(basename -s .git "$remote_url") 50 | 51 | # Calculate the necessary padding to align the end pipe 52 | total_length=95 # Adjust this based on your frame width 53 | text_length=${#repo_friendly_name}+${#repo_name}+4 # 4 for the ": " and two spaces around the repo name 54 | padding_length=$((total_length - text_length)) 55 | 56 | echo '+-----------------------------------------------------------------------------------------------+' 57 | printf "| %s: %s%*s|\n" "$repo_friendly_name" "$repo_name" $padding_length "" 58 | echo '+-----------------------------------------------------------------------------------------------+' 59 | else 60 | # Print error message if there is no remote URL 61 | echo "Not a Git repository or no remote set" 62 | return 1 63 | fi 64 | 65 | # Get the current branch and its tracking branch 66 | git_status=$(git status) 67 | tracking_branch_info=$(echo "$git_status" | grep "Your branch is up to date with") 68 | 69 | # Extract the fork owner and branch from the tracking branch info 70 | if [[ $tracking_branch_info =~ Your\ branch\ is\ up\ to\ date\ with\ \'([^\']+)\' ]]; then 71 | fork_owner_and_branch="${BASH_REMATCH[1]}" 72 | else 73 | fork_owner_and_branch="Not set or not a tracking branch" 74 | fi 75 | 76 | # Get the commit SHA of the current HEAD 77 | commit_sha=$(git rev-parse HEAD) 78 | echo "Commit SHA: $commit_sha" 79 | 80 | # Get the commit message of the current HEAD, remove newlines, and truncate if necessary 81 | commit_message=$(git log -1 --pretty=format:"%B" | tr -d '\n' | awk '{ if (length($0) > 78) { print substr($0, 1, 78) "..." } else { print $0 } }') 82 | echo "Commit Message: $commit_message" 83 | 84 | # Get the commit author of the current HEAD 85 | commit_author=$(git log -1 --pretty=format:"%an") 86 | echo "Commit Author: $commit_author" 87 | 88 | # Get the commit date and time of the current HEAD including timezone 89 | commit_datetime=$(git log -1 --pretty=format:"%cd" --date=format:"%Y-%m-%d %H:%M:%S %z") 90 | echo "Commit Date: $commit_datetime" 91 | 92 | # Attempt to find branches that contain this commit 93 | branches=$(git branch --contains $commit_sha | sed 's/^/ /') 94 | 95 | if [ -n "$branches" ]; then 96 | echo "Contained in branches:" 97 | echo "$branches" 98 | else 99 | echo "This commit is not on any known branch." 100 | fi 101 | 102 | echo " Tracking: $fork_owner_and_branch" 103 | 104 | echo 105 | 106 | # Navigate back to the original directory 107 | cd $ROOT_DIR 108 | } 109 | 110 | get_repo_and_branch_info "." 111 | get_repo_and_branch_info "frontend" 112 | get_repo_and_branch_info "backend" 113 | get_repo_and_branch_info "cli" 114 | -------------------------------------------------------------------------------- /scripts/th/_th-system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 19 | cd $ROOT_DIR 20 | 21 | # Function to display OS information 22 | get_os_info() { 23 | if [ -f /etc/os-release ]; then 24 | # If available, use /etc/os-release file 25 | . /etc/os-release 26 | echo "Name: $NAME" 27 | echo "Version: $VERSION" 28 | echo "ID: $ID" 29 | echo "ID Like: $ID_LIKE" 30 | elif [ -f /etc/*-release ]; then 31 | # If /etc/os-release is not available, use other available /etc/*-release file 32 | echo "OS Information from /etc/*-release:" 33 | cat /etc/*-release 34 | else 35 | # Print a message if unable to determine OS information 36 | echo "Cannot determine OS information." 37 | fi 38 | } 39 | 40 | # Function to display kernel information 41 | get_kernel_info() { 42 | echo "Kernel Information:" 43 | uname -a | fold -w 88 -s 44 | } 45 | 46 | # Function to display CPU information 47 | get_cpu_info() { 48 | echo "CPU Information:" 49 | lscpu | grep -E "^Architecture:|^CPU op-mode\(s\):|^CPU\(s\):|^Vendor ID:|^Model name:|^CPU max MHz:|^CPU min MHz:" \ 50 | | sed 's/^[ \t]*//;s/[ \t]*$//' 51 | } 52 | 53 | # Function to display memory information 54 | get_memory_info() { 55 | echo "Memory Information:" 56 | free -h 57 | } 58 | 59 | # Function to display storage information 60 | get_disk_info() { 61 | echo "Storage Information:" 62 | df -h --total | awk 'END {print "Total: " $2 "\nUsed: " $3 "\nAvailable: " $4 "\nUsed%: " $5}' 63 | } 64 | 65 | # Call the functions to display the information 66 | get_os_info 67 | echo 68 | 69 | get_kernel_info 70 | echo 71 | 72 | get_cpu_info 73 | echo 74 | 75 | get_memory_info 76 | echo 77 | 78 | get_disk_info 79 | -------------------------------------------------------------------------------- /scripts/th/_th-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Containers 19 | BACKEND_CONTAINER_NAME="certification-tool-backend-1" 20 | FRONTEND_CONTAINER_NAME="certification-tool-frontend-1" 21 | DB_CONTAINER_NAME="certification-tool-db-1" 22 | PROXY_CONTAINER_NAME="certification-tool-proxy-1" 23 | 24 | read_version() { 25 | file_path="$1" 26 | title="$2" 27 | 28 | # Check if the container is running 29 | if ! docker ps --format '{{.Names}}' | grep -q "^${BACKEND_CONTAINER_NAME}$"; then 30 | echo "$title: The '$BACKEND_CONTAINER_NAME' container it not running." 31 | return 32 | fi 33 | 34 | # Check if file exists in the container 35 | if ! docker exec "$BACKEND_CONTAINER_NAME" sh -c "[ -f $file_path ]"; then 36 | echo "File '$file_path' not found in the container!" 37 | return 1 38 | fi 39 | 40 | # Read the file content from the container into a variable 41 | file_content=$(docker exec "$BACKEND_CONTAINER_NAME" cat "$file_path") 42 | 43 | if [[ "$file_path" == *"config.py"* ]]; then 44 | SDK_SHA=$(docker exec $BACKEND_CONTAINER_NAME sh -c "grep SDK_SHA $file_path | cut -d'\"' -f 2 | cut -d\"'\" -f 2") 45 | file_content=$SDK_SHA 46 | fi 47 | 48 | if [[ -z "$file_content" ]]; then 49 | file_content="n/a" 50 | fi 51 | 52 | # Print the title and file content 53 | echo "$title: $file_content" 54 | } 55 | 56 | show_backend_info() { 57 | # Check if the container is running 58 | if ! docker ps --format '{{.Names}}' | grep -q "^${BACKEND_CONTAINER_NAME}$"; then 59 | echo 60 | echo "$BACKEND_CONTAINER_NAME" 61 | echo " The container is not running." 62 | return 63 | fi 64 | 65 | # Get info 66 | inspect_output_backend=$(docker inspect $BACKEND_CONTAINER_NAME) 67 | dc_version_backend=$(echo "$inspect_output_backend" | grep -oP '"com.docker.compose.version": "\K[^"]+') 68 | os=$(echo "$inspect_output_backend" | grep -oP '"org.opencontainers.image.ref.name": "\K[^"]+') 69 | os_version=$(echo "$inspect_output_backend" | grep -oP '"org.opencontainers.image.version": "\K[^"]+') 70 | image_backend=$(echo "$inspect_output_backend" | grep -oP '"Image": "\K[^"]+' | grep -v '^sha') 71 | 72 | # Print info 73 | echo 74 | echo "$BACKEND_CONTAINER_NAME" 75 | echo " Docker Compose Version: $dc_version_backend" 76 | echo " Image: $image_backend" 77 | echo " OS: $os $os_version" 78 | } 79 | 80 | show_frontend_info() { 81 | # Check if the container is running 82 | if ! docker ps --format '{{.Names}}' | grep -q "^${FRONTEND_CONTAINER_NAME}$"; then 83 | echo 84 | echo "$FRONTEND_CONTAINER_NAME" 85 | echo " The container is not running." 86 | return 87 | fi 88 | 89 | # Get info 90 | inspect_output_frontend=$(docker inspect $FRONTEND_CONTAINER_NAME) 91 | dc_version_frontend=$(echo "$inspect_output_frontend" | grep -oP '"com.docker.compose.version": "\K[^"]+') 92 | image_frontend=$(echo "$inspect_output_frontend" | grep -oP '"Image": "\K[^"]+' | grep -v '^sha') 93 | 94 | # Print info 95 | echo 96 | echo "$FRONTEND_CONTAINER_NAME" 97 | echo " Docker Compose Version: $dc_version_frontend" 98 | echo " Image: $image_frontend" 99 | } 100 | 101 | show_db_info() { 102 | # Check if the container is running 103 | if ! docker ps --format '{{.Names}}' | grep -q "^${DB_CONTAINER_NAME}$"; then 104 | echo 105 | echo "$DB_CONTAINER_NAME" 106 | echo " The container is not running." 107 | return 108 | fi 109 | 110 | # Get info 111 | inspect_output_db=$(docker inspect $DB_CONTAINER_NAME) 112 | dc_version_db=$(echo "$inspect_output_db" | grep -oP '"com.docker.compose.version": "\K[^"]+') 113 | image_db=$(echo "$inspect_output_db" | grep -oP '"Image": "\K[^"]+' | grep -v '^sha') 114 | version_db_app=$(echo "$inspect_output_db" | grep -oP '"PG_VERSION=[^"]+' | cut -d'=' -f2) 115 | 116 | # Print info 117 | echo 118 | echo "$DB_CONTAINER_NAME" 119 | echo " Docker Compose Version: $dc_version_db" 120 | echo " Image: $image_db" 121 | echo " DB App Version: $version_db_app" 122 | } 123 | 124 | show_proxy_info() { 125 | # Check if the container is running 126 | if ! docker ps --format '{{.Names}}' | grep -q "^${PROXY_CONTAINER_NAME}$"; then 127 | echo 128 | echo "$PROXY_CONTAINER_NAME" 129 | echo " The container is not running." 130 | return 131 | fi 132 | 133 | # Get info 134 | inspect_output_proxy=$(docker inspect $PROXY_CONTAINER_NAME) 135 | dc_version_proxy=$(echo "$inspect_output_proxy" | grep -oP '"com.docker.compose.version": "\K[^"]+') 136 | image_proxy=$(echo "$inspect_output_proxy" | grep -oP '"Image": "\K[^"]+' | grep -v '^sha') 137 | 138 | # Print info 139 | echo 140 | echo "$PROXY_CONTAINER_NAME" 141 | echo " Docker Compose Version: $dc_version_proxy" 142 | echo " Image: $image_proxy" 143 | } 144 | 145 | # Show Test Harness version info 146 | read_version ".version_information" "Test Engine Version" 147 | read_version ".sha_information" "Test Engine SHA" 148 | read_version "test_collections/matter/config.py" "Test Engine SDK SHA" 149 | 150 | # Show Test Harness components version info 151 | show_backend_info 152 | show_frontend_info 153 | show_db_info 154 | show_proxy_info -------------------------------------------------------------------------------- /scripts/th/th-doctor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | { 19 | echo " _____ _ _ _ ____ _ " 20 | echo " |_ _|__ ___| |_ | | | | __ _ _ __ _ __ ___ ___ ___ | _ \ ___ ___| |_ ___ _ __ " 21 | echo " | |/ _ \/ __| __| | |_| |/ _\` | '__| '_ \ / _ \/ __/ __| | | | |/ _ \ / __| __/ _ \| '__|" 22 | echo " | | __/\__ \ |_ | _ | (_| | | | | | | __/\__ \__ \ | |_| | (_) | (__| || (_) | | " 23 | echo " |_|\___||___/\__| |_| |_|\__,_|_| |_| |_|\___||___/___/ |____/ \___/ \___|\__\___/|_| " 24 | echo " " 25 | 26 | usage() { 27 | echo "Displays Test Harness setup information." 28 | echo 29 | echo "Usage:" 30 | echo 31 | echo " Show TH version and repository details: $0" 32 | echo " Show TH host OS system information: $0 --system" 33 | echo " Show TH host OS network information: $0 --network" 34 | echo " Show TH host OS environment details: $0 --environment" 35 | echo " Show TH DUT configuration details: $0 --more" 36 | echo " Show TH Docker Container Logs: $0 --docker-logs" 37 | echo " Show all TH details: $0 --complete" 38 | echo 39 | } 40 | 41 | width=104 42 | 43 | # Get the date string 44 | date_string=$(date) 45 | 46 | # Calculate the length of the date string 47 | date_length=${#date_string} 48 | 49 | # Calculate the padding on each side 50 | padding=$(( (width - date_length) / 2 )) 51 | 52 | # Print spaces for left padding 53 | printf "%${padding}s" 54 | 55 | # Print the date string 56 | echo "$date_string" 57 | echo 58 | 59 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 60 | TH_DEV_SCRIPTS_DIR=$ROOT_DIR/scripts/th 61 | cd $ROOT_DIR 62 | 63 | # Check for arguments 64 | if [ "$#" -gt 1 ]; then 65 | echo "Error: Too many arguments." 66 | usage 67 | exit 1 68 | fi 69 | 70 | print_framed_text() { 71 | # Get the text and title from function arguments 72 | input_text="$1" 73 | title="$2" 74 | 75 | # Ensure 'width' is set and has a reasonable value 76 | if [ -z "$width" ] || [ "$width" -lt 10 ]; then 77 | echo "Error: 'width' is not set or too small." 78 | return 1 79 | fi 80 | 81 | max_line_length=$((width - 6)) # Maximum characters in a line before wrapping 82 | 83 | # Word-wrap the input text 84 | input_text_wrapped=$(echo -e "$input_text" | fold -w $max_line_length -s) 85 | 86 | # Calculate height based on the number of lines in the input text 87 | height=$(echo -e "$input_text_wrapped" | wc -l) 88 | height=$((height + 4)) # Add 4 to account for the top and bottom frame borders and inner padding 89 | 90 | # Print the top border with title 91 | title_with_padding=" $title " 92 | title_padding_left=$(( (width - 2 - ${#title_with_padding}) / 2 )) 93 | [ $title_padding_left -lt 0 ] && title_padding_left=0 94 | title_padding_right=$(( width - 2 - ${#title_with_padding} - title_padding_left )) 95 | [ $title_padding_right -lt 0 ] && title_padding_right=0 96 | echo '+'$(printf "%0.s-" $(seq 1 $title_padding_left))"$title_with_padding"$(printf "%0.s-" $(seq 1 $title_padding_right))'+' 97 | 98 | # Inner top padding 99 | echo "|$(printf ' %.0s' $(seq 1 $((width-2))))|" 100 | 101 | # Print each line of wrapped input text with frame borders and padding 102 | echo -e "$input_text_wrapped" | while IFS= read -r line; do 103 | padding_right=$(( width - 4 - ${#line} - 2 )) # Subtract 4 for the borders and 2 for the left padding 104 | [ $padding_right -lt 0 ] && padding_right=0 105 | echo "| $line$(printf ' %.0s' $(seq 1 $padding_right)) |" 106 | done 107 | 108 | # Inner bottom padding 109 | echo "|$(printf ' %.0s' $(seq 1 $((width-2))))|" 110 | 111 | # Print the bottom border 112 | echo '+'$(printf "%0.s-" $(seq 1 $((width-2))))'+' 113 | echo 114 | } 115 | 116 | show_system() { 117 | # OS 118 | os_output=$("$TH_DEV_SCRIPTS_DIR/_th-system.sh") 119 | print_framed_text "$os_output" "Test Harness Host OS System Information" 120 | } 121 | 122 | show_network() { 123 | # Network 124 | network_output=$("$TH_DEV_SCRIPTS_DIR/_th-network.sh") 125 | print_framed_text "$network_output" "Test Harness Host OS Network Information" 126 | } 127 | 128 | show_environment() { 129 | # Test Harness Host OS Environment 130 | th_env_deps_output=$("$TH_DEV_SCRIPTS_DIR/_th-env-deps.sh") 131 | print_framed_text "$th_env_deps_output" "Test Harness Host OS Environment" 132 | 133 | # Test Harness Frontend Environment (Container) 134 | th_frontend_output=$("$TH_DEV_SCRIPTS_DIR/_th-frontend.sh") 135 | print_framed_text "$th_frontend_output" "Test Harness Frontend Environment (Container)" 136 | 137 | # Test Harness Backend Environment (Container) 138 | th_backend_output=$("$TH_DEV_SCRIPTS_DIR/_th-backend.sh") 139 | print_framed_text "$th_backend_output" "Test Harness Backend Environment (Container)" 140 | 141 | # Test Harness CLI Development Environment 142 | th_cli_output=$("$TH_DEV_SCRIPTS_DIR/_th-cli.sh") 143 | print_framed_text "$th_cli_output" "Test Harness CLI Development Environment" 144 | } 145 | 146 | show_more() { 147 | # Test Harness DUT Configuration 148 | th_net_dut_output=$("$TH_DEV_SCRIPTS_DIR/_th-dut.sh") 149 | print_framed_text "$th_net_dut_output" "Test Harness DUT Configuration" 150 | } 151 | 152 | show_docker_logs() { 153 | # Test Harness Docker Container Logs 154 | th_net_dut_output=$("$TH_DEV_SCRIPTS_DIR/_th-docker-logs.sh") 155 | echo "$th_net_dut_output" 156 | echo 157 | } 158 | 159 | # Test Harness Version 160 | th_version_output=$("$TH_DEV_SCRIPTS_DIR/_th-version.sh") 161 | print_framed_text "$th_version_output" "Test Harness Version" 162 | 163 | # Repository Details 164 | repository_branches_output=$("$TH_DEV_SCRIPTS_DIR/_th-repo.sh") 165 | print_framed_text "$repository_branches_output" "Repository Details" 166 | 167 | # Handle arguments 168 | case "$1" in 169 | --system) 170 | show_system 171 | usage 172 | ;; 173 | --network) 174 | show_network 175 | usage 176 | ;; 177 | --environment) 178 | show_environment 179 | usage 180 | ;; 181 | --more) 182 | show_more 183 | usage 184 | ;; 185 | --docker-logs) 186 | show_docker_logs 187 | usage 188 | ;; 189 | --complete) 190 | show_system 191 | show_network 192 | show_environment 193 | show_more 194 | show_docker_logs 195 | usage 196 | ;; 197 | *) 198 | usage 199 | exit 1 200 | ;; 201 | esac 202 | 203 | 204 | } 2>&1 | tee th-doctor.txt 205 | -------------------------------------------------------------------------------- /scripts/ubuntu/1-install-dependencies.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | set -e 18 | 19 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 20 | SCRIPT_DIR="$ROOT_DIR/scripts" 21 | UBUNTU_SCRIPT_DIR="$SCRIPT_DIR/ubuntu" 22 | 23 | source "$SCRIPT_DIR/utils.sh" 24 | 25 | print_start_of_script 26 | 27 | print_script_step "Set up Docker's apt repository" 28 | $UBUNTU_SCRIPT_DIR/1.1-install-docker-repository.sh 29 | 30 | print_script_step "Silence user prompts about reboot and service restart required (script will prompt user to reboot in the end)" 31 | sudo sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf 32 | sudo sed -i "s/#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf 33 | 34 | sudo DEBIAN_FRONTEND=noninteractive apt-get update -y 35 | sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y 36 | 37 | readarray packagelist < "$UBUNTU_SCRIPT_DIR/package-dependency-list.txt" 38 | 39 | SAVEIFS=$IFS 40 | IFS=$(echo -en "\r") 41 | for package in ${packagelist[@]}; do 42 | print_script_step "Instaling package: ${package[@]}" 43 | sudo DEBIAN_FRONTEND=noninteractive apt-get satisfy ${package[@]} -y --allow-downgrades 44 | done 45 | IFS=$SAVEIFS 46 | 47 | print_script_step "Install Poetry, needed for Test Harness CLI" 48 | curl -sSL https://install.python-poetry.org | python3 - 49 | 50 | print_end_of_script 51 | -------------------------------------------------------------------------------- /scripts/ubuntu/1.1-install-docker-repository.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | set -e 18 | 19 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 20 | SCRIPT_DIR="$ROOT_DIR/scripts" 21 | 22 | source "$SCRIPT_DIR/utils.sh" 23 | 24 | print_start_of_script 25 | 26 | set +e 27 | print_script_step "Verify docker.download.com is reachable" 28 | # Verify docker.download.com is reachable before attempting to install the 29 | # Docker Package Repo (network randomly fails after service restarts). 30 | for i in {1..5} 31 | do 32 | timeout 2 bash -c "(echo >/dev/tcp/docker.download.com/80) &>/dev/null" 33 | retVal=$? 34 | if [ $retVal -eq 0 ]; then 35 | echo "The docker.download.com is reacheable" 36 | break 37 | else 38 | echo "The docker.download.com is unreachable for try $i" 39 | sleep $(expr $i \* 2) 40 | fi 41 | 42 | if [ "$i" -eq '5' ]; then 43 | echo "Failed to stablish connection with the docker.download.com service." 44 | echo "Please verify your connection or try again later." 45 | exit 1 46 | fi 47 | done 48 | 49 | set -e 50 | # Reference link: https://docs.docker.com/engine/install/ubuntu/ 51 | print_script_step "Add Docker's official GPG key" 52 | sudo apt-get update -y 53 | sudo apt-get install ca-certificates curl -y 54 | sudo install -m 0755 -d /etc/apt/keyrings 55 | sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 56 | sudo chmod a+r /etc/apt/keyrings/docker.asc 57 | 58 | print_script_step "Add the repository to Apt sources" 59 | echo \ 60 | "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ 61 | $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ 62 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 63 | sudo apt-get update -y 64 | 65 | print_end_of_script 66 | -------------------------------------------------------------------------------- /scripts/ubuntu/2-machine-cofiguration.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | WLAN_INTERFACE="${WLAN_INTERFACE:-wlan0}" 25 | 26 | # Trust github 27 | print_script_step "Apply github.com fingerprint" 28 | ssh-keygen -F github.com || ssh-keyscan github.com >>~/.ssh/known_hosts 29 | 30 | # Configure docker access from user 31 | print_script_step "Configuring Docker access for user" 32 | sudo groupadd docker 33 | sudo usermod -a -G docker $USER 34 | sudo service docker restart 35 | 36 | # Setup Wifi 37 | print_script_step "Create System Service for wpa_suppliant" 38 | printf "\n Writing: /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service" 39 | cat << EOF | sudo tee /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service 40 | [Unit] 41 | Description=WPA supplicant 42 | Before=network.target 43 | After=dbus.service 44 | Wants=network.target 45 | IgnoreOnIsolate=true 46 | 47 | [Service] 48 | Type=dbus 49 | BusName=fi.w1.wpa_supplicant1 50 | ExecStart=/sbin/wpa_supplicant -u -s -i $WLAN_INTERFACE -c /etc/wpa_supplicant/wpa_supplicant.conf 51 | 52 | [Install] 53 | WantedBy=multi-user.target 54 | Alias=dbus-fi.w1.wpa_supplicant1.service 55 | EOF 56 | sudo systemctl daemon-reload 57 | sudo systemctl enable dbus-fi.w1.wpa_supplicant1 58 | 59 | WPA_SUPPLICANT_FILE=/etc/wpa_supplicant/wpa_supplicant.conf 60 | WPA_SUPPLICANT_SETTINGS=( 61 | "ctrl_interface=DIR=/run/wpa_supplicant" 62 | "update_config=1" 63 | ) 64 | printf "\n Updating: $WPA_SUPPLICANT_FILE\n" 65 | sudo touch "$WPA_SUPPLICANT_FILE" 66 | for setting in ${WPA_SUPPLICANT_SETTINGS[@]}; do 67 | echo " setting: $setting" 68 | grep -qxF "$setting" "$WPA_SUPPLICANT_FILE" || echo "$setting" | sudo tee -a "$WPA_SUPPLICANT_FILE" 69 | done 70 | 71 | # Setup Network 72 | print_script_step "Accept Router Advertisements on network interfaces" 73 | SYSCTL_FILE=/etc/sysctl.conf 74 | SYSCTL_SETTINGS=( 75 | "net.ipv6.conf.eth0.accept_ra=2" 76 | "net.ipv6.conf.eth0.accept_ra_rt_info_max_plen=64" 77 | "net.ipv6.conf.$WLAN_INTERFACE.accept_ra=2" 78 | "net.ipv6.conf.$WLAN_INTERFACE.accept_ra_rt_info_max_plen=64" 79 | ) 80 | printf "\n Updating: $SYSCTL_FILE\n" 81 | sudo touch "$SYSCTL_FILE" 82 | for setting in ${SYSCTL_SETTINGS[@]}; do 83 | echo " setting: $setting" 84 | grep -qxF "$setting" "$SYSCTL_FILE" || echo "$setting" | sudo tee -a "$SYSCTL_FILE" 85 | done 86 | 87 | print_script_step "Enable ip6table_filter in kernel modules" 88 | printf "\n Updating: /etc/modules\n" 89 | grep -qxF "ip6table_filter" /etc/modules || echo "ip6table_filter" | sudo tee -a /etc/modules 90 | 91 | print_script_step "Create System Service for Matter Test Harness" 92 | printf "\n Writing: /etc/systemd/system/matter-th.service" 93 | cat << EOF | sudo tee /etc/systemd/system/matter-th.service 94 | [Unit] 95 | Description=Matter Test Harness 96 | After=network.target 97 | [Service] 98 | Type=oneshot 99 | User=$USER 100 | Group=ubuntu 101 | ExecStart=$ROOT_DIR/scripts/start.sh 102 | [Install] 103 | WantedBy=default.target 104 | EOF 105 | 106 | sudo systemctl daemon-reload 107 | sudo systemctl enable matter-th 108 | 109 | print_script_step "Enable systemd-timesyncd" 110 | sudo systemctl enable systemd-timesyncd 111 | sudo systemctl start systemd-timesyncd 112 | 113 | print_end_of_script 114 | -------------------------------------------------------------------------------- /scripts/ubuntu/auto-install.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | UBUNTU_SCRIPT_DIR="$ROOT_DIR/scripts/ubuntu" 19 | LOG_DIR="$ROOT_DIR/logs" 20 | 21 | LOG_FILENAME=$(date +"log_ubuntu_auto_install_%F-%H-%M-%S") 22 | LOG_PATH="$LOG_DIR/$LOG_FILENAME" 23 | $UBUNTU_SCRIPT_DIR/internal-auto-install.sh $* | tee $LOG_PATH 24 | -------------------------------------------------------------------------------- /scripts/ubuntu/auto-update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | UBUNTU_SCRIPT_DIR="$ROOT_DIR/scripts/ubuntu" 19 | LOG_FILENAME=$(date +"log-ubuntu-auto-update_%F-%H-%M-%S") 20 | LOG_PATH="$ROOT_DIR/logs/$LOG_FILENAME" 21 | 22 | $UBUNTU_SCRIPT_DIR/internal-auto-update.sh $* | tee $LOG_PATH 23 | -------------------------------------------------------------------------------- /scripts/ubuntu/internal-auto-install.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2023 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | UBUNTU_SCRIPT_DIR="$SCRIPT_DIR/ubuntu" 20 | 21 | source "$SCRIPT_DIR/utils.sh" 22 | 23 | print_start_of_script 24 | 25 | check_installation_prerequisites 26 | verify_return_code 27 | 28 | print_script_step "Installing Test Harness Dependencies" 29 | $UBUNTU_SCRIPT_DIR/1-install-dependencies.sh 30 | verify_return_code 31 | 32 | print_script_step "Configure Machine" 33 | $UBUNTU_SCRIPT_DIR/2-machine-cofiguration.sh 34 | verify_return_code 35 | 36 | print_script_step "Update Test Harness code" 37 | # Store the current branch for the update 38 | CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) 39 | $UBUNTU_SCRIPT_DIR/auto-update.sh "$CURRENT_BRANCH" 40 | verify_return_code 41 | 42 | print_script_step "Revert needrestart config to default" 43 | sudo sed -i "s/\$nrconf{kernelhints} = -1;/#\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf 44 | sudo sed -i "s/\$nrconf{restart} = 'a';/#\$nrconf{restart} = 'i';/" /etc/needrestart/needrestart.conf 45 | 46 | print_end_of_script 47 | 48 | print_installation_success 49 | 50 | print_script_step "You need to reboot to finish setup" 51 | printf "Do you want to reboot now? (Press 1 to reboot now)\n" 52 | select yn in "Yes" "No"; do 53 | case $yn in 54 | Yes ) sudo reboot; break;; 55 | No ) exit;; 56 | esac 57 | done 58 | -------------------------------------------------------------------------------- /scripts/ubuntu/internal-auto-update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/../..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | check_installation_prerequisites 25 | verify_return_code 26 | 27 | if [ $# != 1 ] || [ $1 = "--help" ]; then 28 | echo "Usage:" 29 | echo "./scripts/ubuntu/auto-update.sh " 30 | echo "Mandatory: branch name" 31 | exit 1 32 | fi 33 | 34 | print_script_step "Stopping Containers" 35 | $SCRIPT_DIR/stop.sh 36 | 37 | BRANCH_NAME=$1 38 | 39 | print_script_step "Update Test Harness code" 40 | $SCRIPT_DIR/update-th-code.sh "$BRANCH_NAME" 41 | verify_return_code 42 | 43 | print_script_step "Update Test Harness Setup" 44 | $SCRIPT_DIR/update.sh "$BRANCH_NAME" 45 | verify_return_code 46 | 47 | print_end_of_script 48 | -------------------------------------------------------------------------------- /scripts/ubuntu/package-dependency-list.txt: -------------------------------------------------------------------------------- 1 | docker-ce (>=5:24.0.7-1~ubuntu.22.04~jammy) 2 | python3-pip (>=24.0+dfsg-1ubuntu1) 3 | python3-venv (>=3.12.3-0ubuntu1) -------------------------------------------------------------------------------- /scripts/update-docker-images.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | # Exit in case anything goes wrong 21 | set -e 22 | 23 | source "$SCRIPT_DIR/utils.sh" 24 | 25 | print_start_of_script 26 | 27 | cd $ROOT_DIR 28 | # Ensure .env exists 29 | ./scripts/install-default-env.sh 30 | 31 | # Download docker images from docker-compose.yml. 32 | # As this might be run during setup we use `newgrp` command to ensure 33 | # docker works. 34 | BUILD_BACKEND=false 35 | BUILD_FRONTEND=false 36 | set +e 37 | 38 | print_script_step "Downloading backend Docker image" 39 | newgrp docker << END 40 | docker compose pull backend 41 | END 42 | if [ $? -ne 0 ]; then 43 | BUILD_BACKEND=true 44 | fi 45 | 46 | print_script_step "Downloading frontend Docker image" 47 | newgrp docker << END 48 | docker compose pull frontend 49 | END 50 | if [ $? -ne 0 ]; then 51 | BUILD_FRONTEND=true 52 | fi 53 | set -e 54 | 55 | print_script_step "Downloading proxy and db Docker images" 56 | newgrp docker << END 57 | docker compose pull db proxy 58 | END 59 | 60 | # In case of failure, the images will be built locally 61 | if $BUILD_BACKEND; then 62 | newgrp docker << END 63 | $ROOT_DIR/backend/scripts/build-docker-image.sh 64 | END 65 | fi 66 | 67 | if $BUILD_FRONTEND; then 68 | newgrp docker << END 69 | $ROOT_DIR/frontend/scripts/build-docker-image.sh 70 | END 71 | fi 72 | 73 | print_end_of_script 74 | -------------------------------------------------------------------------------- /scripts/update-git-latest-tag.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | TAG_NAME="latest" 18 | TAG_COMMENT="Test Harness latest release version." 19 | REMOTE="origin" 20 | 21 | if [ $# = 0 ] 22 | then 23 | echo "No custom remote defined. Using 'origin' as default." 24 | elif [ $# = 2 ] && [ $1 = "--remote" ] 25 | then 26 | REMOTE=$2 27 | echo "Using '$REMOTE' as remote." 28 | else 29 | echo "This script will update the '$TAG_NAME' tag reference and push it to remote." 30 | echo "To perform the update go to the desired commit/branch and then:" 31 | echo "Usage: ./scripts/update-git-latest-tag.sh --remote custom_remote" 32 | echo " --remote [Optional] you can set a custom remote (default is origin)" 33 | exit 1 34 | fi 35 | 36 | echo "Updating remote '$TAG_NAME' tag references and push it to remote." 37 | 38 | echo "*** Deleting old local tag" 39 | git tag --delete $TAG_NAME 40 | 41 | echo "*** Deleting old remote tag" 42 | git push $REMOTE :refs/tags/$TAG_NAME 43 | 44 | echo "*** Creating a local tag" 45 | git tag --annotate $TAG_NAME -m "$TAG_COMMENT" 46 | 47 | echo "*** Pushing tag on remote" 48 | git push $REMOTE $TAG_NAME 49 | -------------------------------------------------------------------------------- /scripts/update-setup-cli-dependencies.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | set -e 18 | 19 | ROOT_DIR=$(realpath $(dirname "$0")/..) 20 | SCRIPT_DIR="$ROOT_DIR/scripts" 21 | 22 | source "$SCRIPT_DIR/utils.sh" 23 | 24 | print_start_of_script 25 | 26 | print_script_step "Running Poetry install" 27 | source ~/.profile #ensure poetry is in path 28 | cd $ROOT_DIR/cli 29 | poetry install --no-root 30 | 31 | print_end_of_script 32 | -------------------------------------------------------------------------------- /scripts/update-setup-test-collections.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | print_script_step "Setup CLI dependencies" 25 | $SCRIPT_DIR/update-setup-cli-dependencies.sh 26 | verify_return_code 27 | 28 | print_script_step "Setup Test Collections" 29 | cd $ROOT_DIR 30 | 31 | try_to_execute_setup_script() 32 | { 33 | program_folder=$1 34 | 35 | if [ -d $program_folder ]; then 36 | setup_script=$program_folder/setup.sh 37 | # Only run setup.sh if present and it's executable 38 | if [ -x $setup_script ]; then 39 | print_script_step "Running setup script: $setup_script" 40 | $setup_script 41 | if [ $? -ne 0 ]; then 42 | return 1 43 | fi 44 | printf "Setup script finished with success\n" 45 | fi 46 | fi 47 | } 48 | 49 | MATTER_PROGRAM_FOLDER="./backend/test_collections/matter" 50 | try_to_execute_setup_script $MATTER_PROGRAM_FOLDER 51 | if [ $? -ne 0 ]; then 52 | printf "################################################################################\n" 53 | printf "The Matter program setup script failed.\n" 54 | printf "Retry the installation and if the problem persists, contact the Matter program developers.\n" 55 | printf "################################################################################\n" 56 | exit 1 57 | fi 58 | 59 | TEST_COLLECTIONS_FOLDER="./test_collections/*" 60 | for program_folder in $TEST_COLLECTIONS_FOLDER 61 | do 62 | try_to_execute_setup_script $program_folder 63 | if [ $? -ne 0 ]; then 64 | printf "################################################################################\n" 65 | printf "The program's setup script failed.\n" 66 | printf "Please repeat the installation and if the problem persists, contact the program developers.\n" 67 | printf "################################################################################\n" 68 | exit 1 69 | fi 70 | done 71 | 72 | print_end_of_script 73 | -------------------------------------------------------------------------------- /scripts/update-th-code.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | # Store the current branch for the update 25 | ROOT_BRANCH=$(git rev-parse --abbrev-ref HEAD) 26 | 27 | # Exit in case anything goes wrong 28 | set -e 29 | 30 | # Check if a branch name was provided. 31 | if [ $# -eq 1 ]; then 32 | ROOT_BRANCH="$1" 33 | fi 34 | 35 | cd $ROOT_DIR 36 | 37 | print_script_step "Stashing local changes" 38 | git stash 39 | git submodule foreach 'git stash' 40 | 41 | print_script_step "Pulling Test Harness code" 42 | git fetch 43 | git checkout $ROOT_BRANCH 44 | git pull 45 | git submodule update --init --recursive 46 | 47 | print_end_of_script 48 | -------------------------------------------------------------------------------- /scripts/update.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | print_script_step "Update Docker images" 25 | $SCRIPT_DIR/update-docker-images.sh 26 | verify_return_code 27 | 28 | print_script_step "Setup Test Collections" 29 | $SCRIPT_DIR/update-setup-test-collections.sh 30 | verify_return_code 31 | 32 | print_end_of_script 33 | -------------------------------------------------------------------------------- /scripts/utils.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | print_script_step() 19 | { 20 | info=$1 21 | #Retreive the script name 22 | script_name=`basename "$(realpath $0)"` 23 | 24 | printf "\n\n********************************************************************************\n" 25 | printf "$script_name: $info\n" 26 | printf "********************************************************************************\n" 27 | } 28 | 29 | print_start_of_script() 30 | { 31 | #Retreive the script name 32 | script_name=`basename "$(realpath $0)"` 33 | printf "\n\n################################################################################\n" 34 | printf "$script_name: Starting...\n" 35 | printf "################################################################################\n" 36 | } 37 | 38 | print_end_of_script() 39 | { 40 | #Retreive the script name 41 | script_name=`basename "$(realpath $0)"` 42 | printf "\n\n################################################################################\n" 43 | printf "$script_name: Finishing...\n" 44 | printf "################################################################################\n" 45 | } 46 | 47 | verify_return_code() 48 | { 49 | if [ $? -ne 0 ]; then 50 | printf "\n\n" 51 | printf "################################################################################\n" 52 | printf "############################### Exit with Error ################################\n" 53 | printf "################################################################################\n\n" 54 | printf "Please try the installation again and if the problem persists, \n" 55 | printf "please collect as much information as possible and file an issue here: \n" 56 | printf "https://github.com/project-chip/certification-tool/issues \n\n\n" 57 | exit 1 58 | fi 59 | } 60 | 61 | print_installation_success() 62 | { 63 | printf "\n\n" 64 | printf "################################################################################\n" 65 | printf "The installation was completed successfully.\n" 66 | printf "################################################################################\n\n" 67 | } 68 | 69 | check_ubuntu_os_version() 70 | { 71 | UBUNTU_VERSION_NUMBER=$(lsb_release -sr) 72 | if [ "$UBUNTU_VERSION_NUMBER" != "24.04" ]; then 73 | printf "\n\n" 74 | printf "###################################################################################\n" 75 | printf "###### Matter Certification-Tool requires Ubuntu Server 24.04 LTS (64-bit) ######\n" 76 | printf "###################################################################################\n" 77 | printf "# #\n" 78 | printf "# Please format the SDCard and perform a fresh installation or #\n" 79 | printf "# update you OS and then run the auto-install script again. #\n" 80 | printf "# #\n" 81 | printf "###################################################################################\n" 82 | return 1 83 | fi 84 | } 85 | 86 | check_user_name() 87 | { 88 | USER_NAME=$(whoami) 89 | if [ "$USER_NAME" != "ubuntu" ]; then 90 | printf "\n\n" 91 | printf "###################################################################################\n" 92 | printf "###### The Matter certification tool requires the username to be 'ubuntu' #######\n" 93 | printf "###################################################################################\n" 94 | printf "# #\n" 95 | printf "# After creating the 'ubuntu' user, log in and run the auto-install script again. #\n" 96 | printf "# #\n" 97 | printf "###################################################################################\n" 98 | return 1 99 | fi 100 | } 101 | 102 | check_installation_prerequisites() 103 | { 104 | print_script_step "Verify Matter Test Harness Prerequisites" 105 | 106 | check_ubuntu_os_version 107 | INVALID_VERSION=$? 108 | check_user_name 109 | INVALID_USER=$? 110 | 111 | if [ $INVALID_VERSION == 1 ] || [ $INVALID_USER == 1 ]; then 112 | exit 1 113 | fi 114 | } 115 | -------------------------------------------------------------------------------- /scripts/validate_installation_prerequisites/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Copyright (c) 2024 Project CHIP Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | FROM ubuntu:24.04 17 | 18 | RUN apt-get update -y 19 | RUN apt-get install -y iputils-ping sudo apt-utils 20 | -------------------------------------------------------------------------------- /scripts/validate_installation_prerequisites/build_and_run.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # A way to validate the installation of packages used by the Matter Test 19 | # harness has been created. 20 | # This is a common/recurring problem because some packages no longer exist 21 | # or the installation method changes (Docker, for example). 22 | # Therefore, we can use this script to periodically validate whether the 23 | # packages are available for installation without having to perform a 24 | # complete system installation. 25 | # 26 | # Usage: ./scripts/validate_installation_prerequisites/build_and_run.sh 27 | 28 | set -e 29 | 30 | TH_DIR=$(realpath $(dirname "$0")/../..) 31 | 32 | source "$TH_DIR/scripts/utils.sh" 33 | 34 | print_start_of_script 35 | 36 | CONTAINER_TH_DIR="/app/certification-tool" 37 | VALIDATE_SCRIPT_DIR="scripts/validate_installation_prerequisites" 38 | CONTAINER_VALIDATE_SCRIPT="$CONTAINER_TH_DIR/$VALIDATE_SCRIPT_DIR/validate_install.sh" 39 | DOCKER_IMAGE="csa-certification-tool-validation:v1" 40 | 41 | cd $TH_DIR/$VALIDATE_SCRIPT_DIR 42 | 43 | DOCKER_IMAGE_FOUND=$(docker images -q $DOCKER_IMAGE) 44 | 45 | if [[ -z "$DOCKER_IMAGE_FOUND" ]]; then 46 | print_script_step "Building '$DOCKER_IMAGE' image" 47 | docker build -t $DOCKER_IMAGE . 48 | else 49 | print_script_step "Validation Docker image already exists" 50 | echo "$DOCKER_IMAGE" 51 | fi 52 | 53 | print_script_step "Running Validation Script" 54 | docker run -v $TH_DIR:/app/certification-tool:ro -it $DOCKER_IMAGE $CONTAINER_VALIDATE_SCRIPT 55 | 56 | print_end_of_script 57 | -------------------------------------------------------------------------------- /scripts/validate_installation_prerequisites/validate_install.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # Paths 19 | TH_DIR="/app/certification-tool" 20 | TH_DOCKER_REPO_INSTALL_FILE="$TH_DIR/scripts/ubuntu/1.1-install-docker-repository.sh" 21 | TH_PACKAGE_LIST_FILE="$TH_DIR/scripts/ubuntu/package-dependency-list.txt" 22 | MATTER_PROGRAM_DIR="$TH_DIR/backend/test_collections/matter" 23 | MATTER_PACKAGE_LIST_FILE="$MATTER_PROGRAM_DIR/scripts/package-dependency-list.txt" 24 | 25 | source "$TH_DIR/scripts/utils.sh" 26 | 27 | print_start_of_script 28 | 29 | print_script_step "Print SO information" 30 | echo "$(cat /etc/os-release)" 31 | 32 | print_script_step "Calling Install Docker Repository Script" 33 | $TH_DOCKER_REPO_INSTALL_FILE 34 | verify_return_code 35 | 36 | IFS=$(echo -en "\r") 37 | readarray th_package_list < "$TH_PACKAGE_LIST_FILE" 38 | readarray matter_package_list < "$MATTER_PACKAGE_LIST_FILE" 39 | 40 | for package in ${th_package_list[@]}; do 41 | print_script_step "Installing package: ${package[@]}" 42 | DEBIAN_FRONTEND=noninteractive apt-get satisfy ${package[@]} -y --allow-downgrades 43 | verify_return_code 44 | done 45 | 46 | for package in ${matter_package_list[@]}; do 47 | print_script_step "Installing package: ${package[@]}" 48 | DEBIAN_FRONTEND=noninteractive apt-get satisfy ${package[@]} -y --allow-downgrades 49 | verify_return_code 50 | done 51 | 52 | print_installation_success 53 | 54 | print_end_of_script 55 | -------------------------------------------------------------------------------- /scripts/wifi-connect.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # 4 | # Copyright (c) 2024 Project CHIP Authors 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ROOT_DIR=$(realpath $(dirname "$0")/..) 18 | SCRIPT_DIR="$ROOT_DIR/scripts" 19 | 20 | source "$SCRIPT_DIR/utils.sh" 21 | 22 | print_start_of_script 23 | 24 | sudo apt-get install network-manager 25 | sudo nmtui-connect 26 | 27 | print_end_of_script 28 | --------------------------------------------------------------------------------