OpenThread Commissioner Build and Configuration

Stay organized with collections Save and categorize content based on your preferences.

View source on GitHub

This guide covers the basic build and configuration of OpenThread Commissioner (OT Commissioner). Upon completion of this procedure, you'll have an OT Commissioner CLI executable and a static Commissioner library.

Set up OT Commissioner

  1. Clone the OT Commissioner repository:

    git clone https://github.com/openthread/ot-commissioner
    

  2. Install dependencies:

    cd ot-commissioner
    ./script/bootstrap.sh
    

Build OT Commissioner

OT Commissioner installs to the /usr/local directory. If you'd like to change your installation directory, set -DCMAKE_INSTALL_PREFIX.

  1. Build OT Commissioner:

    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local -GNinja ..
    ninja -j1
    

  2. Create an Environment variable to run commissioner-cli in the next step:

    export COMMISSIONER_CLI=/usr/local/bin/commissioner-cli
    

  3. Optional. Run unit tests:

    ./tests/commissioner-test
    

Install OT Commissioner

OT Commissioner installs the following to your installation directory:

  • OT Commissioner library and header files
  • OT Commissioner CLI executable binary
  • Default configuration files and credentials
  • Scripts to run OT Commissioner CLI as daemon
sudo ninja install

Verify the installation by checking the help menu.

$COMMISSIONER_CLI -h

If you installed to the /usr/local directory, commissioner-cli is available from the command line.

commissioner-cli -h

Configuration

The OT Commissioner CLI supports both Thread 1.2 Commercial Commissioning Mode (CCM) and Thread 1.1 commissioning (Non-CCM). To connect to different Thread networks, a JSON configuration file is needed to start OT Commissioner CLI:

  • ccm-config.json — The default configuration file for CCM Thread Network.
  • non-ccm-config.json — The default configuration file for Non-CCM Thread Network.

By default, these configuration files are installed in /usr/local/etc/commissioner. You can also view sample files on the ot-commissioner GitHub repository.

CCM configuration

To connect to a CCM Thread network, update these fields in ccm-config.json:

Field Description
DomainName Unique identifier within the Enterprise Domain.
PrivateKeyFile The private key file in PEM format.
CertificateFile The certificate file in PEM format.
TrustAnchorFile The trust anchor file in PEM format.

These key and certificate files are used to establish secure sessions between the Commissioner and Border Agent.

Non-CCM configuration

The Pre-Shared Key PSKc is used to establish a secure session between the Commissioner and Border Agent. To connect to a Non-CCM Thread network, you can set your PSKc from the OT Commissioner CLI. For more information, refer to External Commissioning.

Logging

When you run pi@raspberrypi: commissioner-cli from the command line, OT Commissioner creates a commissioner.log file in the current working directory, for example /home/pi/commissioner.log. In the JSON configuration file, you can configure your LogFile path, logging level, and other log settings.

Load configuration

To start OT Commissioner with your configuration settings:

commissioner-cli /usr/local/etc/commissioner/ccm-config.json

Commission a joiner

To use OT Commissioner to commission a joiner, refer to External Commissioning.