project-chip / certification-tool

A test harness and tooling designed to simplify development, testing, and certification for devices, guided by the Connectivity Standards Alliance.
https://csa-iot.org/
Apache License 2.0
38 stars 23 forks source link

[Bug] Unable to update chip_use_paa_certs attribute of project config #248

Closed Jardaliao closed 3 months ago

Jardaliao commented 5 months ago

Describe the bug

Add chip_use_paa_certs attribute to dut_config, the GUI says "Project Updated successfully". Re-click the edit button, the GUI shows the original config. Looks similar to this issue: https://github.com/project-chip/certification-tool/issues/151

{
  "config": {
    "network": {
      "wifi": {
        "ssid": "myssid",
        "password": "mypassword"
      },
      "thread": {
        "rcp_serial_path": "/dev/ttyACM0",
        "rcp_baudrate": 115200,
        "on_mesh_prefix": "fd11:22::/64",
        "network_interface": "wlan0",
        "dataset": {
          "channel": "15",
          "panid": "0x1234",
          "extpanid": "1111111122222222",
          "networkkey": "00112233445566778899aabbccddeeff",
          "networkname": "DEMO"
        },
        "otbr_docker_image": null
      }
    },
    "dut_config": {
      "discriminator": "3462",
      "setup_code": "03779409",
      "pairing_mode": "onnetwork",
      "chip_tool_timeout": null,
      "chip_use_paa_certs": false
    },
    "test_parameters": null
  },
  "pics": {
    "clusters": {}
  }
}

Steps to reproduce the behavior

  1. Click on the project edit button
  2. Add chip_use_paa_certs attribute to dut_config
  3. Click on the update button
  4. Re-click on the project edit button

Expected behavior

project config successfully update

Log files

PICS file

No response

Screenshots

image image

Environment

Additional Information

No response

rquidute commented 5 months ago

Hi @Jardaliao , I'm assuming that you created the Project and removed the chip_use_paa_certs attribute in the first screen before clicking Create button, and then you updated the project and add back the chip_use_paa_certs attribute, right?

I performed a test by creating a new project without chip_use_paa_certs attribute, and in the update screen I added back the attribute and it worked. The request is sending the chip_use_paa_certs attribute and I can see the attribute with the new value set, Could you help me to understand if I miss something in this analysis?

Screenshot 2024-04-12 at 08 54 05 Screenshot 2024-04-12 at 08 59 30
Jardaliao commented 5 months ago

Hi @rquidute , I didn't remove the chip_use_paa_certs attribute.

I reproduced the scenario just now.

1

rquidute commented 5 months ago

Hi @Jardaliao, thanks for sharing the video, it helped a lot. Now I can see, you are using the v2.8.1 version. could you please update your version to the latest, following the steps bellow? Please let me know if it worked.

./scripts/stop.sh cd certification-tool git fetch git checkout v2.10-beta3+spring2024 git pull git submodule update --init --recursive ./scripts/start.sh

Jardaliao commented 5 months ago

Hi @rquidute , I've launched v2.10-beta3+spring2024 branch, the backend service failed to start unfortunately:

jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ ls
CODE_OF_CONDUCT.md  README.md  default.env                               docker-compose.yml  scripts
LICENSE             backend    docker-compose.override-backend-dev.yml   docs
NOTICE              cli        docker-compose.override-frontend-dev.yml  frontend
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ git status
On branch v2.10-beta3+spring2024
Your branch is up to date with 'origin/v2.10-beta3+spring2024'.

nothing to commit, working tree clean
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ git remote -v
origin  https://github.com/project-chip/certification-tool.git (fetch)
origin  https://github.com/project-chip/certification-tool.git (push)
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ git submodule update --init --recursive
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ ./scripts/stop.sh
WARN[0000] The "BACKEND_FILEPATH_ON_HOST" variable is not set. Defaulting to a blank string.
jarda@LAPTOP-MM1G26J3:~/projects/certification-tool$ ./scripts/start.sh
[+] Running 4/6
 ⠋ Network certification-tool_traefik-public  Created                                                                         2.0s
 ⠏ Network chip-default                       Created                                                                         2.0s
 ✔ Container certification-tool-db-1          Started                                                                         1.2s
 ✔ Container certification-tool-frontend-1    Started                                                                         1.2s
 ✔ Container certification-tool-proxy-1       Started                                                                         1.6s
 ✔ Container certification-tool-backend-1     Started                                                                         1.8s
Waiting for frontend to start...... done
Waiting for backend to start................................

Here is the docker logs of the backend service:

2024-04-16 13:49:01 Checking for script in /app/prestart.sh
2024-04-16 13:49:01 Running script /app/prestart.sh
2024-04-16 13:49:03 INFO     | 2024-04-16 05:49:03.452 | app.log:__configure_notifier_handler:111 | Exception notifier not enabled
2024-04-16 13:49:03 INFO     | 2024-04-16 05:49:03.792 | __main__:main:50 | Initializing service
2024-04-16 13:49:03 INFO     | 2024-04-16 05:49:03.792 | tenacity.before:log_it:27 | Starting call to '__main__.init', this is the 1st time calling it.
2024-04-16 13:49:03 INFO     | 2024-04-16 05:49:03.812 | __main__:main:52 | Service finished initializing
2024-04-16 13:49:05 INFO     | 2024-04-16 05:49:05.795 | app.log:__configure_notifier_handler:111 | Exception notifier not enabled
2024-04-16 13:49:07 INFO     | 2024-04-16 05:49:07.984 | app.log:__configure_notifier_handler:111 | Exception notifier not enabled
2024-04-16 13:49:09 INFO     | 2024-04-16 05:49:09.535 | __main__:main:31 | Creating initial data
2024-04-16 13:49:09 INFO     | 2024-04-16 05:49:09.536 | __main__:main:33 | Initial data created
2024-04-16 13:49:09 Prestart Complete
2024-04-16 13:49:11 INFO     | 2024-04-16 05:49:11.732 | app.log:__configure_notifier_handler:111 | Exception notifier not enabled
2024-04-16 13:49:06 INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
2024-04-16 13:49:06 INFO  [alembic.runtime.migration] Will assume transactional DDL.
2024-04-16 13:49:10 INFO:     Will watch for changes in these directories: ['/app/app']
2024-04-16 13:49:10 INFO:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
2024-04-16 13:49:10 INFO:     Started reloader process [1] using watchgod
2024-04-16 13:49:13 Process SpawnProcess-1:
2024-04-16 13:49:13 Traceback (most recent call last):
2024-04-16 13:49:13   File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
2024-04-16 13:49:13     self.run()
2024-04-16 13:49:13   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
2024-04-16 13:49:13     self._target(*self._args, **self._kwargs)
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/subprocess.py", line 76, in subprocess_started
2024-04-16 13:49:13     target(sockets=sockets)
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 68, in run
2024-04-16 13:49:13     return asyncio.run(self.serve(sockets=sockets))
2024-04-16 13:49:13   File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
2024-04-16 13:49:13     return loop.run_until_complete(main)
2024-04-16 13:49:13   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 76, in serve
2024-04-16 13:49:13     config.load()
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/config.py", line 448, in load
2024-04-16 13:49:13     self.loaded_app = import_from_string(self.app)
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 24, in import_from_string
2024-04-16 13:49:13     raise exc from None
2024-04-16 13:49:13   File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 21, in import_from_string
2024-04-16 13:49:13     module = importlib.import_module(module_str)
2024-04-16 13:49:13   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
2024-04-16 13:49:13     return _bootstrap._gcd_import(name[level:], package, level)
2024-04-16 13:49:13   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2024-04-16 13:49:13   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2024-04-16 13:49:13   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2024-04-16 13:49:13   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2024-04-16 13:49:13   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2024-04-16 13:49:13   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2024-04-16 13:49:13   File "/app/./app/main.py", line 20, in <module>
2024-04-16 13:49:13     from app.api.api_v1.api import api_router
2024-04-16 13:49:13   File "/app/./app/api/api_v1/api.py", line 18, in <module>
2024-04-16 13:49:13     from app.api.api_v1.endpoints import (
2024-04-16 13:49:13   File "/app/./app/api/api_v1/endpoints/operators.py", line 22, in <module>
2024-04-16 13:49:13     from app import crud, models, schemas
2024-04-16 13:49:13   File "/app/./app/crud/__init__.py", line 21, in <module>
2024-04-16 13:49:13     from .crud_test_run_config import test_run_config
2024-04-16 13:49:13   File "/app/./app/crud/crud_test_run_config.py", line 22, in <module>
2024-04-16 13:49:13     from app.test_engine.test_script_manager import test_script_manager
2024-04-16 13:49:13   File "/app/./app/test_engine/test_script_manager.py", line 351, in <module>
2024-04-16 13:49:13     test_script_manager = TestScriptManager()
2024-04-16 13:49:13   File "/app/./app/singleton.py", line 32, in __call__
2024-04-16 13:49:13     cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
2024-04-16 13:49:13   File "/app/./app/test_engine/test_script_manager.py", line 74, in __init__
2024-04-16 13:49:13     self.test_collections = discover_test_collections()
2024-04-16 13:49:13   File "/app/./app/test_engine/test_collection_discovery.py", line 115, in discover_test_collections
2024-04-16 13:49:13     if found_collections := __find_test_collections(name, disabled_test_cases):
2024-04-16 13:49:13   File "/app/./app/test_engine/test_collection_discovery.py", line 203, in __find_test_collections
2024-04-16 13:49:13     test_collections = __declared_collection_declarations(collection_module_name)
2024-04-16 13:49:13   File "/app/./app/test_engine/test_collection_discovery.py", line 176, in __declared_collection_declarations
2024-04-16 13:49:13     module = importlib.import_module(collection_module_name)
2024-04-16 13:49:13   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
2024-04-16 13:49:13     return _bootstrap._gcd_import(name[level:], package, level)
2024-04-16 13:49:13   File "/app/./test_collections/matter/__init__.py", line 17, in <module>
2024-04-16 13:49:13     from .sdk_tests.support.python_testing import (
2024-04-16 13:49:13   File "/app/./test_collections/matter/sdk_tests/support/python_testing/__init__.py", line 20, in <module>
2024-04-16 13:49:13     from .sdk_python_tests import custom_python_test_collection, sdk_python_test_collection
2024-04-16 13:49:13   File "/app/./test_collections/matter/sdk_tests/support/python_testing/sdk_python_tests.py", line 21, in <module>
2024-04-16 13:49:13     from .models.python_test_models import PythonTestType
2024-04-16 13:49:13   File "/app/./test_collections/matter/sdk_tests/support/python_testing/models/__init__.py", line 16, in <module>
2024-04-16 13:49:13     from .test_case import PythonTestCase
2024-04-16 13:49:13   File "/app/./test_collections/matter/sdk_tests/support/python_testing/models/test_case.py", line 40, in <module>
2024-04-16 13:49:13     from .python_testing_hooks_proxy import (
2024-04-16 13:49:13   File "/app/./test_collections/matter/sdk_tests/support/python_testing/models/python_testing_hooks_proxy.py", line 20, in <module>
2024-04-16 13:49:13     from matter_yamltests.hooks import TestRunnerHooks
2024-04-16 13:49:13 ModuleNotFoundError: No module named 'matter_yamltests'
rquidute commented 5 months ago

HI @Jardaliao in this case could perform the steps bellow, since there were a lot of changes between he versions, so I think it should be better to go to the new version from scratch.

./scripts/stop.sh cd .. rm -rf certification-tool git clone -b v2.10-beta3+spring2024 https://github.com/project-chip/certification-tool.git cd certification-tool git submodule update --init --recursive ./scripts/pi-setup/auto-install.sh

At the end of auto-install.sh script, reboot the OS and wait 10 min, after that the system should be ready to go.

Jardaliao commented 5 months ago

Hi @rquidute , thanks for your help. The original problem was solved by copying paa certs to trusted root path.

By the way, Can I run this tool on the Windows Subsystem running Ubuntu22.04?

I tried these steps:

./scripts/stop.sh
cd ..
rm -rf certification-tool
git clone -b v2.10-beta3+spring2024 https://github.com/project-chip/certification-tool.git
cd certification-tool
git submodule update --init --recursive
./scripts/ubuntu/auto-install.sh
./scripts/start.sh

Successfully started:

[+] Running 4/7
 ⠙ Network chip-default                       Created                                                                                                                                                                                                                              4.0s
 ⠏ Network certification-tool_traefik-public  Created                                                                                                                                                                                                                              3.8s
 ⠇ Volume "certification-tool_app-db-data"    Created                                                                                                                                                                                                                              3.7s
 ✔ Container certification-tool-db-1          Started                                                                                                                                                                                                                              2.9s
 ✔ Container certification-tool-proxy-1       Started                                                                                                                                                                                                                              3.0s
 ✔ Container certification-tool-frontend-1    Started                                                                                                                                                                                                                              2.9s
 ✔ Container certification-tool-backend-1     Started                                                                                                                                                                                                                              2.6s
Waiting for frontend to start....... done
Waiting for backend to start........... done

But GUI didn't work: image image

rquidute commented 5 months ago

Hi @Jardaliao Could you please share the backend logs? docker logs

hiltonlima commented 3 months ago

Hello, . Thanks for the feedback. Looking at the log I noticed that you are using an old version of TH. Could you update to version v2.10+spring2024 and check if the problem still occurs?

If you don't have any related problems, could you close the issue?

willyan2002 commented 5 days ago

I encountered the same issue with TH-Version: v2.8.1-official, and the solution is as follows.

  1. Modify .env file, add 'CHIP_TOOL_USE_PAA_CERTS=True' nano ~/chip-certification-tool/.env ubuntu@ubuntu:~/chip-certification-tool$ cat .env DOMAIN=localhost STACK_NAME=chip-test-harness

TRAEFIK_PUBLIC_NETWORK=traefik-public TRAEFIK_TAG=chip-test-harness.com TRAEFIK_PUBLIC_TAG=traefik-public

PROJECT_NAME=CHIP Test Harness SECRET_KEY=790dd0ee330f50075404bdb3870273b03bf17347f3f256328fc38afaad28dd64

POSTGRES_SERVER=db POSTGRES_USER=postgres POSTGRES_PASSWORD=b461a2eee00db1934aa87d74d218a8a35eb9fbba09fd7c3f85dccc067b65d11e POSTGRES_DB=app

CHIP_TOOL_USE_PAA_CERTS=True

  1. Modify chip-tool.py nano chip-certification-tool/backend/app/chip_tool/chip-tool.py // Line 64 // PAA Cert mount LOCAL_PAA_CERTS_PATH = Path("/var/paa-root-certs") // DOCKER_PAA_CERTS_PATH = "/paa-root-certs" DOCKER_PAA_CERTS_PATH = "/var/paa-root-certs" # put all paa here

  2. reboot TH

  3. My Project config sample, without the attribute "chip_use_paa_certs", it works well. { "config": { "network": { "wifi": { "ssid": "MatterCenter_WWA", "password": "12345678" }, "thread": { "rcp_serial_path": "/dev/ttyACM0", "rcp_baudrate": 115200, "on_mesh_prefix": "fd11:22::/64", "network_interface": "wlan0", "dataset": { "channel": "15", "panid": "0x1234", "extpanid": "1111111122222222", "networkkey": "00112233445566778899aabbccddeeff", "networkname": "DEMO" }, "otbr_docker_image": null } }, "dut_config": { "discriminator": "2718", "setup_code": "88431646", "pairing_mode": "ble-wifi", "chip_tool_timeout": null }, "test_parameters": null },