snaptoolbelt - read the docs...mode, snapstick0for ss200s in usb mode, or a device path like...
TRANSCRIPT
SNAPtoolbeltRelease
May 20, 2016
Contents
1 Getting Started 3
2 Command Reference 9
i
ii
SNAPtoolbelt, Release
SNAPtoolbelt is a collection of scriptable command line tools for interacting with SNAP nodes and networks.
This manual assumes you have some knowledge of SNAP systems. If you aren’t familiar with SNAP, please consultthe SNAP Primer and associated documentation.
Contents 1
SNAPtoolbelt, Release
2 Contents
CHAPTER 1
Getting Started
1.1 Installation
1.1.1 Requirements
Be sure to load these requirements before installing the package:
• Python 2.6 or 2.7
• pip 8.1 or later
• wheel 0.29 or later
• virtualenv 15.0 or later
To ensure that pip, wheel, and virtualenv are installed and up-to-date:
pip install --upgrade pip wheel virtualenv
1.1.2 Setup a Virtual Environment (Recommended)
Using a virtualenv keeps the SNAPtoolbelt’s dependencies from conflicting with your own project dependencies. Thedirections to set up a virtualenv vary based on OS. The vitualenv User Guide has more information.
Windows
To create a new virtual environment:
virtualenv ENV
Where ENV is a directory to place the new virtual environment. Then to activate the new virtual environment:
.\ENV\Scripts\activate
Finally, update pip within the virtual environment, since some versions of virtualenv install very old versions of pip:
(ENV) pip install --upgrade pip
3
SNAPtoolbelt, Release
Mac/Linux
To create a new virtual environment:
$ virtualenv ENV
Where ENV is a directory to place the new virtual environment. Then to activate the new virtual environment:
$ source ./ENV/bin/activate
Finally, update pip within the virtual environment, since some versions of virtualenv install very old versions of pip:
(ENV) $ pip install --upgrade pip
1.1.3 Install via pip
Within the virtual environment use pip to install SNAPtoolbelt:
(ENV) pip install --extra-index-url https://update.synapse-wireless.com/pypi snapbelt
Try it out:
(ENV) snap version
1.1.4 Optional Steps
There are a few optional steps that you made need when using SNAPtoolbelt.
Autocompletion
To make use of autocompletion in a bash shell, a bash-completion script is available using the snap autocompletecommand:
source $(snap autocomplete)
The script will attempt to tab-complete commands, profiles, networks, and nodes you’ve talked to recently. You canalso link the autocomplete script to your ‘/etc/bash_co
Encryption
To talk to AES-128 encrypted networks, you will also need to install PyCrypto:
• PyCrypto
Within the virtual environment use pip to install PyCrypto:
(ENV) pip install pycrypto
Building SNAPpy Scripts
To build SNAPpy scripts, you will also need to install SNAPbuild and related SNAPcore firmware packages:
(ENV) pip install --extra-index-url https://update.synapse-wireless.com/pypi snapbuild snap-firmware-2.7.1
4 Chapter 1. Getting Started
SNAPtoolbelt, Release
Note: You will need to install package that matches the version of SNAPcore you are using.
Use Outside of Virtualenv
You can use SNAPtoolbelt outside its virtualenv by specifying the full path (or adding it to your own $PATH):
~/.virtualenvs/snapbelt/bin/snap version
You can also symlink from the virtualenv to /usr/local/bin:
ln -s ~/.virtualenvs/snapbelt/bin/snap /usr/local/bin/
1.2 Configuration
SNAPtoolbelt needs to know a few things in order to talk to your SNAP networks:
1. Networks - How your SNAP network is configured
2. Profiles - How to connect to your SNAP network
1.2.1 Networks
A Network describes how a SNAP network is configured. All nodes in the SNAP network need to be configured thesame way. It contains the following parameters:
channel Integer from 0-15 (default is 4)
network_id (default is 0x1c2c)
encryption_type None, Basic, or AES-128 (default is None)
encryption_key String, up to 16 characters (defaults is ‘’)
feature_bits (defaults is 0x0100)
1.2.2 Profiles
A Profile describes the method in which SNAPtoolbelt will connect to a SNAP Network. Each of the supportedconnection methods (serial, TCP, and MQTT) have specific parameters.
Serial
A Serial Profile is used when you are talking to a serial node such as a SS200, SN220, or SN171 Protoboard. Itcontains the following parameters:
device Device string can be a COM identifier on Windows such as COM1, USB0 for SN132 paddleboards in USBmode, SnapStick0 for SS200s in USB mode, or a device path like /dev/snap1 on POSIX systems.
address Licensed address to use (or blank to use the default)
1.2. Configuration 5
SNAPtoolbelt, Release
TCP
A TCP Profile is used when you’re talking to a SNAP Connect instance that is accepting TCP connections. It containsthe following parameters:
host Hostname or IP address
port Port to connect to (default is 48625)
ssl Should this connection use SSL? (True or False)
username User to authenticate as
password Password to authenticate with
address Licensed address to use (or blank to use the default)
MQTT
An MQTT Profile is used when you’re talking to a SNAP2MQTT instance via an MQTT gateway. It contains thefollowing parameters:
host Hostname or IP address
port Port to connect to (default is 48625)
ca_certs Path to client SSL certificates
address SNAP2MQTT’s address (default is ‘000080’)
1.2.3 Under the Covers
SNAPtoolbelt stores its configuration in a .snap folder under your user folder:
• %USERPROFILE% on Windows, e.g. “C:\Users\YourName\.snap”
• ~/.snap on Linux/Mac
The configuration (and some other data) is stored in a few files:
profiles.cfg SNAP Profiles, or “how should I talk to your SNAP networks?”
networks.cfg SNAP Networks, or “What networks do you talk to, and how are they configured?”
nodes.cache Node addresses you’ve recently talked to
1.3 Quick Start
If you are using a SNAP Stick such as an SS200 or SN220, SNAPtoolbelt can scan for your node(s):
$ snap config scan
SNAPtoolbelt will automagically add new nodes (including sniffer nodes) to your configuration.
Note: If you get a message about a Read error, you can bypass it by adding the -f/--force flag. Read errorsmay just mean “This node’s actually a SNAP Sniffer, we were looking for non-Sniffer nodes.”, or “It was busy whenwe tried to talk to it.”
6 Chapter 1. Getting Started
SNAPtoolbelt, Release
To make one of them your default, move it (with -f to overwrite the existing default):
$ snap config move profile SNAPstick0 default -f
1.4 Conventions
SNAPtoolbelt is scriptable in addition to being user controlled. If you ask it for information, it will be provided onSTDOUT. Logs and other ancillary chatter are emitted on STDERR. If the command succeeds, the exit status will bezero, otherwise the exit status will be non-zero.
All input needed comes either from the configuration files, or from the invocation.
Note: There are no prompts for “Are you sure?”. If you tell it to erase a script, it will do so or exit(1) trying.
1.4. Conventions 7
SNAPtoolbelt, Release
8 Chapter 1. Getting Started
CHAPTER 2
Command Reference
2.1 snap
SNAPtoolbelt provides access to the fundamental operation on a SNAP network.
Available Commands
2.1.1 snap call
Available Commands
• snap call rpc unicast• snap call rpc multicast• snap call rpc directed_multicast
snap call rpc unicast
Description
Callback Unicast RPC
Usage
snap call rpc unicast <target> <function_name> [<function_args>...] [options]
snap call rpc u <target> <function_name> [<function_args>...] [options]
Positional Arguments
target SNAP address of target node or bridge
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
9
SNAPtoolbelt, Release
Options
-c <name>, --callback_name <name> Specify which function will be called on a response from thetargets
Examples
Ask the bridge node getInfo(5):
snap call rpc u bridge getInfo 5
Ask the bridge node vmStat(6), expect it to return its result via tellVmStat:
snap call rpc u bridge vmStat 6 --callback_name tellVmStat
snap call rpc multicast
Description
Callback Multicast RPC
Usage
snap call rpc multicast <targets> <function_name> [<function_args>...] [options]
snap call rpc m <targets> <function_name> [<function_args>...] [options]
Positional Arguments
targets A comma seperated list of SNAP addresses
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
Options
-g <group>, --group <group> Override the Network’s default multicast group
-t <ttl>, --ttl <ttl> Override the Network’s default multicast TTL
-c <name>, --callback_name <name> Specify which function will be called on a response from thetargets
Examples
Broadcast a request for getInfo(5), expect responses from 123456 and 789abc:
snap call rpc m 123456,789abc getInfo 5
10 Chapter 2. Command Reference
SNAPtoolbelt, Release
snap call rpc directed_multicast
Description
Callback Directed Multicast RPC
Usage
snap call rpc directed_multicast <targets> <function_name> [<function_args>...] [options]
snap call rpc dm <targets> <function_name> [<function_args>...] [options]
Positional Arguments
targets A comma seperated list of SNAP addresses
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
Options
-g <group>, --group <group> Override the Network’s default multicast group
-t <ttl>, --ttl <ttl> Override the Network’s default multicast TTL
-d <delay>, --delay <delay> Specify a response delay in milliseconds from the targets, default is 0
-c <name>, --callback_name <name> Specify which function will be called on a response from thetargets
Examples
Directed Multicast a request for getInfo(5) to 123456 and 789abc, ask them to delay their responses into100ms windows:
snap call rpc dm 123456,789abc getInfo 5 --delay 100
2.1.2 snap config
Available Commands
2.1. snap 11
SNAPtoolbelt, Release
• snap config profile• snap config network• snap config new profile• snap config new network• snap config list• snap config delete• snap config copy• snap config move• snap config scan• snap config node_cache show• snap config node_cache clear
snap config profile
Description
Display a profile
Usage
snap config profile <name> [key [value]]
Positional Arguments
name Name of profile
key (optional) Name of profile parameter to display/set
value (optional) Parameter value to set
Examples
Show the default profile:
snap config profile default
Show the value of the sn220 profile’s device parameter:
snap config profile sn220 device
Set the sn220 profile’s device parameter to /dev/snap1:
snap config profile sn220 device /dev/snap1
snap config network
Description
Display a network
12 Chapter 2. Command Reference
SNAPtoolbelt, Release
Usage
snap config network <name> [key [value]]
Positional Arguments
name Name of network
key (optional) Name of network parameter to display/set
value (optional) Parameter value to set
Examples
Show the default network:
snap config network default
Show the lighting network’s encryption_type parameter:
snap config network lighting encryption_type
Set the solar network’s channel parameter to 7:
snap config network solar channel 7
snap config new profile
Description
Creates a new profile based on the profile type (serial, tcp, or mqtt) specified
Usage
snap config new profile (serial|tcp|mqtt) <name> [options]
Positional Arguments
name Name of profile to be created
Options
-f, --force Overwrite an existing profile/network
Examples
Create a new serial profile named sn132:
2.1. snap 13
SNAPtoolbelt, Release
snap config new profile serial sn132
Create a new mqtt profile named e20:
snap config new profile mqtt e20
snap config new network
Description
Creates a new network
Usage
snap config new network <name> [options]
Positional Arguments
name Name of network to be created
Options
-f, --force Overwrite an existing profile/network
Examples
Overwrite the lighting network with a new one:
snap config new network lighting -f
snap config list
Description
List the available profiles/networks
Usage
snap config list (profile|network)
Examples
List all profiles:
snap config list profile
14 Chapter 2. Command Reference
SNAPtoolbelt, Release
snap config delete
Description
Delete a profile/network
Usage
snap config delete (profile|network) <name>
Positional Arguments
name Profile/Network to be deleted
Examples
Remove the sn220 profile:
snap config delete profile sn220
Remove the power network:
snap config delete network power
snap config copy
Description
Copy a profile or network
Usage
snap config copy (profile|network) <from> <to> [options]
Positional Arguments
from Profile/Network to be copied
to Name of new profile/network
Options
-f, --force Overwrite an existing profile/network
2.1. snap 15
SNAPtoolbelt, Release
Examples
Copy the default profile to snapstick:
snap config copy profile default snapstick
Copy the lighting network to default:
snap config copy network lighting default -f
snap config move
Description
Move/rename a profile or network
Usage
snap config move (profile|network) <from> <to> [options]
Positional Arguments
from Profile/Network to be moved/renamed
to New name of profile/network
Options
-f, --force Overwrite an existing profile/network
Examples
Moves the sn220 profile to the default overriding the current default:
snap config move profile sn220 default -f
Move the solar network to testbed:
snap config move network solar testbed
snap config scan
Description
Scans serial ports for SNAP nodes and creates profiles for any that don’t already exist in your configuration
Usage
snap config scan [options]
16 Chapter 2. Command Reference
SNAPtoolbelt, Release
Options
-d, --dry-run Just scan without creating profiles
-f, --force Add nodes that have read errors
Examples
Scan for all nodes:
snap config scan -f
snap config node_cache show
Description
Lists the entries currently in the Node Cache (nodes which will be available when auto-completing node addresses)
Usage
snap config node_cache show
Examples
Show the Node Cache:
snap config node_cache show
snap config node_cache clear
Description
Removes the specified entries from the Node Cache
Usage
snap config node_cache clear (all|<target>)
Examples
Clear the entire cache:
snap config node_cache clear all
Remove 112233 from the cache:
snap config node_cache clear 112233
2.1. snap 17
SNAPtoolbelt, Release
2.1.3 snap send
Available Commands
• snap send rpc unicast• snap send rpc multicast• snap send rpc directed_multicast• snap send data unicast• snap send data multicast
snap send rpc unicast
Description
Send Unicast RPC
Usage
snap send rpc unicast <target> <function_name> [<function_args>...]
snap send rpc u <target> <function_name> [<function_args>...]
Positional Arguments
target SNAP address of target node or bridge
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
Examples
Send ping() to the bridge node:
snap send rpc u bridge ping
snap send rpc multicast
Description
Send Multicast RPC
Usage
snap send rpc multicast <function_name> [<function_args>...] [options]
snap send rpc m <function_name> [<function_args>...] [options]
18 Chapter 2. Command Reference
SNAPtoolbelt, Release
Positional Arguments
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
Options
-g <group>, --group <group> Override the Network’s default multicast group
-t <ttl>, --ttl <ttl> Override the Network’s default multicast TTL
Examples
Broadcast hunt():
snap send rpc m hunt
snap send rpc directed_multicast
Description
Send Directed Multicast RPC
Usage
snap send rpc directed_multicast <targets> <function_name> [<function_args>...] [options]
snap send rpc dm <targets> <function_name> [<function_args>...] [options]
Positional Arguments
targets A comma seperated list of SNAP addresses
function_name Name of function to call on targets
function_args A space seperated list of arguments to pass to the function
Options
-g <group>, --group <group> Override the Network’s default multicast group
-t <ttl>, --ttl <ttl> Override the Network’s default multicast TTL
-d <delay>, --delay <delay> Specify a response delay in milliseconds from the targets, default is 0
2.1. snap 19
SNAPtoolbelt, Release
Examples
Send nodes 001122, 334455, and 667788 the RPC getData(17, ’blue’, 22):
snap send rpc dm 001122,334455,667788 getData 17 'blue' 22
snap send data unicast
Description
Send Unicast Data
Usage
snap send data unicast <target> <payload> [options]
snap send data u <target> <payload> [options]
Positional Arguments
target SNAP address of target node or bridge
payload The data to send to remote nodes
Options
--base64 Payload is base64 encoded
Examples
Send 012345 the payload This was a triumph.:
snap send data u 012345 "This was a triumph."
snap send data multicast
Description
Send Multicast Data
Usage
snap send data multicast <payload> [options]
snap send data m <payload> [options]
20 Chapter 2. Command Reference
SNAPtoolbelt, Release
Positional Arguments
payload The data to send to remote nodes
Options
-g <group>, --group <group> Override the Network’s default multicast group
-t <ttl>, --ttl <ttl> Override the Network’s default multicast TTL
--base64 Payload is base64 encoded
Examples
Broadcast I’m making a note here: HUGE SUCCESS to group 7 with a ttl of 3:
snap send data m "I'm making a note here: HUGE SUCCESS" -g 7 -t 3
2.1.4 snap flash
Note: On the E20 (and other gateways) when issuing the flash commands you may need to use sudo ‘whichsnap‘ to provide sudo the full path to where SNAPtoolbelt is installed:
sudo `which snap` flash erase_script SM220
Available Commands
• snap flash erase_script• snap flash default_nv• snap flash firmware• snap flash sniffer
snap flash erase_script
Description
Erase any script on the connected module
Usage
snap flash erase_script <module_type>
Positional Arguments
module_type The type of SNAP module that is connected via the serial port
2.1. snap 21
SNAPtoolbelt, Release
Examples
Erase any script on the connected SS200 module:
snap flash erase_script SS200
snap flash default_nv
Description
Restore the NV Params to the factory defaults on the connected module
Usage
snap flash default_nv <module_type>
Positional Arguments
module_type The type of SNAP module that is connected via the serial port
Examples
Factory default the NV Params on the connected SS200 module:
snap flash default_nv SS200
snap flash firmware
Description
Load the specified firmware Load the specified firmware on the connected module via the bootloader
Usage
snap flash firmware <module_type> <core_version> [options]
Positional Arguments
module_type The type of SNAP module that is connected via the serial port
core_version The version of SNAPcore to load
Options
-f <sfi-file>, --file <sfi-file> If firmware support package is not installed, an SFI file path can be pro-vided
22 Chapter 2. Command Reference
SNAPtoolbelt, Release
Examples
Once you have pip installed the snap-firmware-2.7.1 package you will be able to load SNAPcore version 2.7.1on the connected SM220UF1 module:
snap flash firmware SM220UF1 2.7.1
If you have not installed the snap-firmware package, you can still load firmware by specifying an SFI file:
snap flash firmware SS200 2.6.2 -f ./sfifiles/RF200_AES128_SnapV2.6.2.sfi
snap flash sniffer
Description
Load the sniffer firmware on the connected module via the bootloader
Usage
snap flash sniffer <module_type> [options]
Positional Arguments
module_type The type of SNAP module that is connected via the serial port
Options
-f <sfi-file>, --file <sfi-file> If firmware support package is not installed, an SFI file path can be pro-vided
Examples
Load sniffer firmware on the connected RF220SU module:
snap flash sniffer RF220SU
Load sniffer firmware on the connected SS200 module by specifying an SFI file:
snap flash sniffer SS200 -f ./sfifiles/ATmega128RFA1_SnifferV1.3.0.sfi
2.1.5 snap mesh
Available Commands
• snap mesh ping• snap mesh dm_ping• snap mesh intercept• snap mesh listen• snap mesh find
2.1. snap 23
SNAPtoolbelt, Release
snap mesh ping
Description
Send a multicast query to the network and await unicast replies
Usage
snap mesh ping [options]
Options
-t <seconds>, --timeout <seconds> Number of seconds to wait for replies, default is 20
Examples
Ping the mesh, but only wait ~5 seconds for replies:
snap mesh ping -t 5
snap mesh dm_ping
Description
Send a multicast query to the network and await directed multicast replies
Usage
snap mesh dm_ping [options]
Options
-t <seconds>, --timeout <seconds> Number of seconds to wait for replies, default is 20
Examples
Ping the mesh, but only wait ~5 seconds for replies:
snap mesh dm_ping -t 5
snap mesh intercept
Description
Use this command to listen for an intercepted node’s output. This requires first using the snap node intercept startcommand. If you do not specify the -t option, the intercept will run until you use CTRL-C to abort it.
24 Chapter 2. Command Reference
SNAPtoolbelt, Release
Usage
snap mesh intercept [options]
Options
-t <seconds>, --timeout <seconds> Number of seconds to intercept messages, default is forever
Examples
Listen for intercepted output:
snap mesh intercept
Listen for intercepted output for 10 seconds, then quit:
snap mesh intercept -t 10
See Also
• snap node intercept start
snap mesh listen
Description
If you don’t have a real sniffer node available, you can always listen for messages that happen to come your way(multicasts, for instance). If you do not specify the -t option, the intercept will run until you use CTRL-C to abort it.
Usage
snap mesh listen [options]
Options
-t <seconds>, --timeout <seconds> Number of seconds to intercept messages, default is forever
Examples
Listen for messages:
snap mesh listen
Listen for messages for one minute, then exit:
snap mesh listen -t 60
2.1. snap 25
SNAPtoolbelt, Release
snap mesh find
Description
Finds the target node by sweeping through channels, and optionally moves the node to a new network
Note: Cannot find nodes with different encryption settings from the Network/bridge
Usage
snap mesh find <target> [options]
Positional Arguments
target SNAP address of target node
Options
-m <network>, --move <network> Moves the node to the specified network
Examples
Move the bridge node to the lighting network:
snap mesh find bridge -m lighting
Find node 123456:
snap mesh find 123456
2.1.6 snap node
Available Commands
26 Chapter 2. Command Reference
SNAPtoolbelt, Release
• snap node info• snap node traceroute• snap node build• snap node deploy• snap node script• snap node firmware info• snap node firmware load• snap node energy• snap node reboot• snap node stats• snap node nvparam• snap node intercept• snap node module_type• snap node vmstat• snap node move
snap node info
Description
Get information about the <target> node. By default it queries:
• Address
• Current Channel (i.e. “Where is this node now?”)
• Current Network ID
• NVParam Channel (i.e. “Where will this node go if it’s rebooted?”)
• NVParam Network ID
• Feature Bits
Usage
snap node <target> info [options]
Positional Arguments
target SNAP address of target node or bridge
Options
-v Additionally queries: Device Name/Type, Script Name/CRC, Space Available,Platform, Firmware Version
-vv Additionally queries: Radio, UART, and Multicast NV Params
-vvv Additionally queries: Mesh NV Params
2.1. snap 27
SNAPtoolbelt, Release
Examples
Ask the bridge node for its basic information:
snap node bridge info
Ask node 123456 for more details:
snap node 123456 info -v
Ask node 00aabb for all of its information:
snap node 00aabb info -vvv
snap node traceroute
Description
Performs a traceroute to the target node. Returns the round trip time and link quality information for each hop alongthe way. See the SNAP Manual for more details on the traceroute process.
Node Traceroute
Usage
snap node <target> traceroute
Positional Arguments
target SNAP address of target node or bridge
Examples
Traceroute to 00aabb:
snap node 00aabb traceroute
snap node build
Description
Build the script for the TARGET node. Uses SNAPbuild to compile the script to a SPY file for that node’s moduleand core.
By default the output .spy/.map files are placed in the current working directory, use -o to override.
Note: This command requires SNAPbuild to be installed
28 Chapter 2. Command Reference
SNAPtoolbelt, Release
Usage
snap node <target> build <script> [options]
Positional Arguments
target SNAP address of target node or bridge
script todo
Options
-I <include> todo
-p <platform> todo
-o <output_path> todo
Examples
Build SnapStick.py for the bridge node:
snap node bridge build SnapStick.py
snap node deploy
Description
Deploys the script to the <target> node. Uses SNAPbuild to compile the script to a SPY file for that node’s moduleand core. If <script> is already a SPY file, just upload it without rebuilding.
Note: This command requires SNAPbuild to be installed.
Usage
snap node <target> deploy <script> [options]
Positional Arguments
target SNAP address of target node or bridge
script todo
2.1. snap 29
SNAPtoolbelt, Release
Options
-I <include> todo
-p <platform> todo
-o <output_path> todo
Examples
Deploy SnapStick.py to the bridge node:
snap node bridge deploy SnapStick.py
snap node script
Description
Queries the script name and CRC. Erases the script on the target node. Loads the <spy_file> over-the-air on the<target> node.
Usage
snap node <target> script (info | erase | load <spy_file>)
Positional Arguments
target SNAP address of target node or bridge
spy_file todo
Examples
Ask the bridge for its script information:
snap node bridge script info
Erase the script on node 987654:
snap node 987654 script erase
Load SnapStick.spy on the bridge:
snap node bridge script load SnapStick.spy
snap node firmware info
Query the firmware version on the <target> node
30 Chapter 2. Command Reference
SNAPtoolbelt, Release
Usage
snap node <target> firmware info
Positional Arguments
target SNAP address of target node or bridge
Examples
Get firmware info for node 012345:
snap node 012345 firmware info
snap node firmware load
Description
Load the specified firmware on the <target> module.
Usage
snap node <target> firmware load <core_version> [options]
Positional Arguments
target SNAP address of target node or bridge
core_version The version of SNAPcore to load
Options
-f <sfi-file> If firmware support package is not installed, an SFI file path can be provided
Examples
Load the 2.7.1 firmware on node 012345:
snap node 012345 firmware load 2.7.1
Load the RF200_AES128_SnapV2.6.2.sfi firmware on node 00aabb:
snap node 00aabb firmware load 2.6.2 -f RF200_AES128_SnapV2.6.2.sfi
2.1. snap 31
SNAPtoolbelt, Release
snap node energy
Description
Asks the node to check the RF energy on its channels
Usage
snap node <target> energy [options]
Positional Arguments
target SNAP address of target node or bridge
Options
-n <number>, --num_queries <number> Perform <number> queries and average the results
-d <delay>, --delay <delay> Wait for <delay> seconds between queries
Examples
Ask the bridge node to scan 3 times, waiting 2 seconds between scans:
snap node bridge energy -n 3 -d 2
snap node reboot
Description
Ask the target node to reboot, with an optional <delay>
Usage
snap node <target> reboot [<delay>]
Positional Arguments
target SNAP address of target node or bridge
delay todo
Examples
Reboot the bridge node:
32 Chapter 2. Command Reference
SNAPtoolbelt, Release
snap node bridge reboot
snap node stats
Description
Queries <target> for the value of <stat_name>. You can also use the special names stat, info, and all to queryall stats, all info, and all stats and info combined, respectively. See snap help stats for the list of supported statnames.
Usage
snap node <target> stats (stat|info|all|<stat_name>)
Positional Arguments
target SNAP address of target node or bridge
stat_name todo
Examples
todo
snap node nvparam
Description
Either reset the <target> node NVParams to factory default, or query the <target> node for the value of NVParam<nvparam_id> and optioanlly set it <value>. Values are parsed like RPC arguments.
You can reference NVParams by name, see snap help nvparam for details.
Warning: The changes do not take effect until you reboot the node, see snap node reboot
Usage
snap node <target> (reset | nvparam <nvparam_id> [<value>]...)
Positional Arguments
target SNAP address of target node or bridge
nvparam_id todo
value todo
2.1. snap 33
SNAPtoolbelt, Release
Examples
Ask the bridge node for the value of NVParam 128:
snap node bridge nvparam 128
Ask node 123456 for its mesh routing max hop limit:
snap node 123456 nvparam mesh.routing.max-hop-limit
Set NVParam 110 to foo on node 012345:
snap node 012345 nvparam set 110 'foo'
Set the multicast forwarded groups on the bridge node to 5:
snap node bridge nvparam set mcast.forwarded-groups 5
Reset node 001122 NVParams to factory defaults:
snap node 001122 nvparam reset
See Also
• snap node reboot
snap node intercept
Description
Tell the <target> node to start/stop sending its STDOUT and/or STDERR to us
Note: Use the snap mesh intercept command to listen for the output after telling a node to start.
Usage
snap node <target> intercept (start|stop) [options]
Positional Arguments
target SNAP address of target node or bridge
Options
--out-only Send only STDOUT.
--err-only Send only STDERR.
34 Chapter 2. Command Reference
SNAPtoolbelt, Release
Examples
Ask node 001122 to start sending us both STDOUT and STDERR:
``snap node 001122 intercept start``
Ask node 001122 to stop sending us output:
snap node 001122 intercept stop
See Also
• snap mesh intercept
snap node module_type
Description
Query Module Type
Usage
snap node <target> <module_type>
Positional Arguments
target SNAP address of target node or bridge
module_type todo
Examples
todo
snap node vmstat
Description
Queries the specified <vmstat> on the <target> node and breaks down the output.
Usage
snap node <target> vmstat <vmstat> [<argument>]...
2.1. snap 35
SNAPtoolbelt, Release
Positional Arguments
target SNAP address of target node or bridge
vmstat todo
argument todo
Examples
Ask the bridge for its vmStat(6):
snap node bridge vmstat 6
Ask node 001122 for its vmStat(5, 2):
snap node 001122 vmstat 5 2
snap node move
Description
Moves the <target> node to the specified <network>. You must be able to reach the node on the current network. If the<target> node is the bridge, this command also updates the “last used” network for the current profile to the <target>network.
Usage
snap node <target> move <network>
Positional Arguments
target SNAP address of target node or bridge
network todo
Examples
Move the bridge to the ‘lighting’ network:
snap node bridge move lighting
Move node 001122 to the ‘power’ network:
snap node 001122 move power
2.1.7 snap build
SNAPtoolbelt can also call out directly to SNAPbuild, if it has been installed. Calls to snap build will beconverted to snapbuild calls, all arguments will be passed as given.
See the SNAPbuild manual for more details on its options.
36 Chapter 2. Command Reference
SNAPtoolbelt, Release
Examples
snap build -m RF200PF1 -c 2.5.6 myScript.py
2.1.8 snap update
SNAPtoolbelt has the ability to update itself.
snap update check
List packages that may be out of date (equivalent of pip list --outdated)
snap update install
Updates SNAPtoolbelt (equivalent of pip install --upgrade)
Examples
snap update checksnapbelt (0.8.6) - Latest: 0.8.6.post1 [wheel]snapbuild (1.0.0.post36) - Latest: 1.1.0 [wheel]
Note:
• Multicast Group, TTL, and DMCast Delay are all given default values in the Network configuration, but maybe overridden per-command here.
• All target addresses must be in 6-character form: 0deCAF, 012345.
• The special address “bridge” can be used to specify your connection’s bridge node, even if the exact address isnot known. (One way to discover your bridge node’s address is to use snap node info.)
• Arguments in quotes ("test", ’abc’) are parsed as strings.
• "" and ’’ are both parsed as empty strings.
• All numbers are parsed as integers: (0x10 == 16, 100 == 100)
• Booleans (True, False) are parsed as booleans
• None is parsed as None (Pythonic None, not the string ’None’)
• Strings beginning with x that look like hex data will be unhexlify’d: xabcdef == ’\xab\xcd\xef’
2.2 Global Options
SNAPtoolbelt commands are nested. Global options must come after the initial snap, but before the first subcom-mand. These options can be used with all commands.
snap [global-options] subcommand ...
2.2. Global Options 37
SNAPtoolbelt, Release
2.2.1 Log Level
-l (debug|info|warn|error|critical), --log_level (debug|info|warn|error|critical)
Specify the level at which SNAPtoolbelt should log.
Note: SNAPtoolbelt always logs to STDERR. If you need to log to a file, you will need to redirect STDERR usingyour shell of choice.
2.2.2 Output Formats
-o (dkvp|json|json-pretty), --output_format (dkvp|json|json-pretty)
By default, the output is provided in Delimited Key-Value Pair format. MLR can be used to convert DKVP into CSVor other formats.For example, the output of a node info query in DKVP:
address=001c2c1a7603fa1b,current_channel=4,current_netid=0x1c2c,nv_channel=4,nv_net_id=0x1c2c,nv_feature_bits=0x001f
JSON output is also possible:
{"address": "001c2c1a7603fa1b", "current_channel": 4, "current_netid": "0x1c2c", "nv_channel": 4, "nv_net_id": "0x1c2c", "nv_feature_bits": "0x001f"}
2.2.3 Profile
-p <profile>, --profile <profile>
Specify which profile you want to use, default is the default.
2.2.4 Network
-n <network>, --network <network>
Specify which network you want to use, default is the default.
2.2.5 Timeout
-t <timeout>, --timeout <timeout>
Specify the timeout for the command in seconds.
Note: 30 seconds is the default, though some commands override this if it’s too low. For instance, firmware uploadsgenerally take longer than 30 seconds, so the timeout is bumped up for that command.
38 Chapter 2. Command Reference