{"id":19640039,"url":"https://github.com/openthread/silk","last_synced_at":"2025-04-28T11:31:02.556Z","repository":{"id":53221111,"uuid":"194942095","full_name":"openthread/silk","owner":"openthread","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-01T05:51:45.000Z","size":606,"stargazers_count":6,"open_issues_count":3,"forks_count":10,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-05T08:25:38.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openthread.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-02T22:18:12.000Z","updated_at":"2025-03-21T21:03:33.000Z","dependencies_parsed_at":"2022-09-08T19:12:17.827Z","dependency_job_id":null,"html_url":"https://github.com/openthread/silk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openthread%2Fsilk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openthread%2Fsilk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openthread%2Fsilk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openthread%2Fsilk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openthread","download_url":"https://codeload.github.com/openthread/silk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251304764,"owners_count":21567933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:04:29.970Z","updated_at":"2025-04-28T11:30:59.367Z","avatar_url":"https://github.com/openthread.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status][build-actions-svg]][build-actions]\n[![Lint Status][lint-actions-svg]][lint-actions]\n[![Test Status][test-actions-svg]][test-actions]\n[![codecov][codecov-svg]][codecov-url]\n---\n\n# Silk\n[build-actions-svg]: https://github.com/openthread/silk/workflows/Build/badge.svg?branch=master\u0026event=push\n[build-actions]: https://github.com/openthread/silk/actions?query=workflow%3ABuild+branch%3Amaster+event%3Apush\n[lint-actions-svg]: https://github.com/openthread/silk/workflows/Lint/badge.svg?branch=master\u0026event=push\n[lint-actions]: https://github.com/openthread/silk/actions?query=workflow%3ALint+branch%3Amaster+event%3Apush\n[test-actions-svg]: https://github.com/openthread/silk/workflows/Test/badge.svg?branch=master\u0026event=push\n[test-actions]: https://github.com/openthread/silk/actions?query=workflow%3ATest+branch%3Amaster+event%3Apush\n[codecov-svg]: https://codecov.io/gh/openthread/silk/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/openthread/silk\n\n## Overview\nSilk is a fully automated test platform for validating OpenThread function, feature and system performance with real \ndevices. This codebase is Python 3 compatible.\nThe initial supported device is Nordic nRF52840 Development board.\n\nSilk runs on a Raspberry Pi or an ubuntu Linux PC. \n \n## Installation\nInstall libraries and dependencies:\n``` shell\ncd silk\n./bootstrap.sh\n``` \nInstall and Build:\n``` shell\nsudo make install-cluster\n``` \n\n### Virtualenv\nThe project can create a Python virtualenv under `env` directory, which avoids collisions with system managed packages. Some of the packages\nused by this project tend to collide with `apt` managed packages (`python3-urllib3` and `python3-psutil`, for example), and will cause some\nsystem tools to fail. This option properly sets up a Python venv that doesn't install to system Python `dist-packages` path.\n\nThis option is by default not applied, since most of the testbeds don't have this problem, because they might not have tools that depend on\nthose libraries; but for development environments that do, it can be activated with:\n``` shell\ncd silk\n./bootstrap.sh -v\n``` \nInstall and Build:\n``` shell\nsudo make install-cluster-venv\n```\n\nTo run any test script using venv, use full path of Python in venv, i.e. `sudo ./env/bin/python3 silk/unit_tests/silk_run_test.py`.\n\n## Configuration\n\n### `hwconfig.ini`\nSilk relies on configuration files to determine what devices that are connected to your computer are eligible to be \nused in tests. \n\nAn example of `hwconfig.ini` is in `silk/tests` folder.\n\nThe hardware model should be defined as 'Nrf52840' or 'NordicSniffer' in `hwconfig.ini` file. A cluster ID should be assigned\nto the config file as well, providing an offset for node IDs for visualizing multiple clusters by the same OTNS service.\nAttaching clusters with the same ID to the OTNS service could result in conflicts.\n\n``` shell\n[DEFAULT]\nClusterID: 0\nLayoutCenter: 300, 300\nLayoutRadius: 100\n\n[Dev-8A7D]\nHwModel: Nrf52840\nHwRev: 1.0\nInterfaceSerialNumber: E1A5012E8A7D\nUSBInterfaceNumber: 1\nDutSerial: 683536778\nOTNSVisPosition: 200, 200\n\n[Dev-6489]\nHwModel: NordicSniffer\nHwRev: 1.0\nInterfaceSerialNumber: E992D833CBAF\nUSBInterfaceNumber: 1\nDutSerial: 683906489\n``` \n\nA tool called usbinfo is installed as part of Silk which can be used to find out the Interface Serial Number and Usb \nInterface Number. DutSerial is the SN number printed on the chip or displayed by usbinfo for J-Link product.   \n\n### `clusters.conf`\nSilk reads thread mode (NCP or RCP mode) from `clusters.conf` which should be added to `/opt/openthread_test` folder.\n\nAn example of `clusters.conf` is in `silk/config` folder. \n\n## Run test\n\n``` shell\nusage: silk_run.py [-h] [-d ResPath] [-c ConfFile] [-v X] [-s OtnsServer] P [P ...]\n\nRun a suite of Silk Tests\npositional arguments:\n  P                     test file search pattern\noptional arguments:\n  -h, --help            show this help message and exit\n  -d ResPath, --results_dir ResPath\n                        Set the directory path for test results\n  -c ConfFile, --hwconfig ConfFile\n                        Name the hardware config file\n  -v X, --verbose X, --verbosity X\n                        Set the verbosity level of the console (0=quiet,\n                        1=default, 2=verbose)\n  -s OtnsServer, --otns OtnsServer,\n                        Set the OTNS server address to send OTNS messages to\n```\n\nThere is an example of test run script `silk_run_test.py` under `unit_tests` folder.\n\n### Using OTNS\n[OpenThread Network Simulator](https://github.com/openthread/ot-ns) is a Thread network visualization and management tool.\nUsing this tool the topology and messages of a network in Silk's control could be visualized. Run the following to install OTNS.\nNote that it requires Go which can be installed from https://golang.org/dl/, after which `$(go env GOPATH)/bin` should be added\nto `$PATH`.\n\n```shell\ngit clone https://github.com/openthread/ot-ns.git ./otns\ncd otns\n./script/install-deps\n./script/install\n```\n\nThen follow these steps to use Silk with OTNS:\n\n1. Configure `ClusterID` for the cluster. There are two ways to lay out nodes for the cluster:\n   1. Specify `OTNSVisPosition` for each node in `hwconfig.ini`. Canvas is the same size in pixel as the\n      monitor on which OTNS runs, so usually a 50px distance is clear enough.\n   2. Specify `LayoutCenter` and `LayoutRadius` for the cluster in `hwconfig.ini` and not `OTNSVisPosition`. This will\n      tell OTNS Manager to calculate each node's position dynamically based on their roles in the network.\n   3. OTNS Manager will default to not using auto layout if all node's visualization positions have been set. Otherwise,\n      it turns to auto layout.\n2. Flash each board with the images compiled with OpenThread `OTNS=1` flag turned on.\n3. Run OTNS in real mode using `otns -raw -real -ot-cli otns-silk-proxy`.\n4. Run Silk with `silk_run.py`, supplying `-s OtnsServer` argument. If the server is running on the same machine, use `localhost`.\n\n### Using Replayer\nThe `SilkReplayer` allows offline playback of Silk log file for visualization on OTNS platform. The playback speed can be controlled\nvia command line arguments. Usage:\n\n``` shell\nusage: silk_replay.py [-h] [-d ResPath] [-c ConfFile] [-v X] [-s OtnsServer] [-p PlaybackSpeed] P\n\nRun a suite of Silk Tests\npositional arguments:\n  P                     Log file path\noptional arguments:\n  -h, --help            show this help message and exit\n  -r ResPath, --results_dir ResPath\n                        Set the path for run results. Defaults to current folder.\n  -c ConfFile, --hwconfig ConfFile\n                        Name the hardware config file. Defaults to `/opt/openthread_test/hwconfig.ini`.\n  -v X, --verbose X, --verbosity X\n                        Set the verbosity level of the console (0=quiet,\n                        1=default, 2=verbose)\n  -s OtnsServer, --otns OtnsServer,\n                        Set the OTNS server address to send OTNS messages to. Defaults to `localhost`.\n  -p PlaybackSpeed, --speed PlaybackSpeed,\n                        Speed of log replay. e.g. 20 means speeding up to 20x. 1.0 by default.\n```\n\nThere is an example of test run script `silk_replay_test.py` under `unit_tests` folder.\n\n## Build Wpantund image\n\n```shell\ngit clone https://github.com/openthread/wpantund.git\ncd silk/silk/shell\n./flash_wpantund.sh\n```\n\n## Build OpenThread image\n\n```shell\ngit clone https://github.com/openthread/openthread.git\n```\n\nPlease note that the openthread image should have child-supervision, mac-filter and log-output enabled (listed in detail in script `build_nrf52840.sh`).\n\n### Testbed devices\n\nTo build openthread image for testbed devices and sniffer you can make use of script `build_nrf52840.sh`.\n\n```shell\ncd silk/silk/shell\n./build_nrf52840.sh\n```\n\nTo utilize OTNS, `OTNS=1` flag needs to be turned on when compiling the image.\n\nWith `build_nrf52840.sh` an openthread image `ot-ncp-ftd.hex` will be created and copied to location `/opt/openthread_test/nrf52840_image/`.\n\nTo flash the build on testbed device attach usb cable to j-link port and replace chip serial number printed on the \nchip(e.g. `683906489`).\n\n```shell\ncd silk/silk/shell\n./nrfjprog.sh --erase-all 683906489\n./nrfjprog.sh --flash /opt/openthread_test/nrf52840_image/ot-ncp-ftd.hex 683906489\n```\n\nNote: On raspberry Pi JLink installed should be of the form `JLink_Linux_XXX_arm.tgz` and present at `/opt/SEGGER`. Create \na symbolic link for `JLink_Linux_XXX` to \"JLink\". Make sure to run the command `sudo cp 99-jlink.rules /etc/udev/rules.d/`\ngiven in `README.txt` of JLink and reboot the system.\nExample output of Jlink executable:\n\n```shell\nuser@user:/opt/SEGGER$ ls -l\ntotal 4\nlrwxrwxrwx 1 root root   23 Sep 26  2018 JLink -\u003e /opt/SEGGER/JLink_V634g\ndrwxr-xr-x 8 root root 4096 Aug 20 10:21 JLink_V634g\n```\n\n## OpenThread Sniffer\nnRF52840 can be used as a Thread Sniffer in Silk which can capture all 15.4 traffic in the specific wireless channel \nduring test suite execution. The pcap file will be saved to the test result folder.\n\nIt is required that the OpenThread spinel-cli tools are installed.\n\n``` shell\ngit clone https://github.com/openthread/pyspinel.git\ncd pyspinel\nsudo python setup.py develop\nwhich sniffer.py (should show up in /usr/local/bin)\n``` \n\nYou now have two options.\n\nOption 1: Add `/usr/local/bin` to your secure path.\n\nOption 2: Create a symlink from a secure path location to the `sniffer.py` you found above.\n\n### Create image for sniffer\nRecommend to flash the image for the Sniffer in a Linux PC. \n\n```shell\n# Prepare firmware\nmake -f examples/Makefile-nrf52840 USB=1\narm-none-eabi-objcopy -O ihex output/nrf52840/bin/ot-rcp ot-rcp-nrf52840-115200.hex\n\n# Flash to device\nnrfjprog -f nrf52 --chiperase --reset --program ot-rcp-nrf52840-115200.hex chip-serial-number\nnrfjprog -f nrf52 --pinresetenable chip-serial-number\nnrfjprog -f nrf52 --reset chip-serial-number\n\n# Disable MSD, this is very important\ncd /opt/SEGGER/JLink_XXX).\n./JLinkExe -SelectEmuBySN 683906489\nmsddisable\nexit\n```\n\n# Note\nThis is not an officially supported Google product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenthread%2Fsilk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenthread%2Fsilk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenthread%2Fsilk/lists"}