<p>OpenWRT's scripting interface for network configuration primarily utilizes shell script wrapper functions around the commotion command-line client in order to interact with commotiond. Those functions are included in <a href="https://github.com/opentechinstitute/commotiond/blob/master/openwrt/lib/functions/commotion.sh">https://github.com/opentechinstitute/commotiond/blob/master/openwrt/lib/functions/commotion.sh</a> (installed as /lib/functions/commotion.sh on a node). Currently the functions are written assuming that they're using the old-format output from the daemon, as opposed to the new key-value JSON format. These functions need to be updated against the new output format and new commands.</p>

<p>Output is of an arbitrary key-value format:</p>

<pre><code>{ "key": "value", "key": "value" }
</code></pre>

<p>with unique keys. Exact output per command is still being determined. Also, unlike before, the commotion client returns true or false correctly depending on whether the command succeeds. So for some commands, it may be as easy as running the command and interpreting $? in order to echo "Command succeeded!" or "Command failed!". Output can be parsed through grep, sed and the like, but ideal would be proper JSON parsing. OpenWRT has a shell script JSON parser in a shell library called jsn.sh or something similar, which they use for parsing JSON output.</p>

<p>The shell functions should retain their current output format to the extent possible so as to keep from having to update things in other Commotion scripts that utilize the functions. We shouldn't need to add any additional commands unless needed, even though commotiond now supports additional ones. Below is a list of all commotiond commands:</p>

<p>up  -same as before<br>
down  -same as before<br>
status  -same as before<br>
state  -same as before<br>
profiles -replaces list_profiles<br>
set  -allows you to set profile values<br>
get  -allows you to get profile values<br>
save  -allows you to save a profile to a new file in the<br>
profiles.d directory<br>
new  -allows you to create a new profile<br>
delete  -allows you to delete a profile<br>
ipgen  -allows you to generate an arbitrary IP<br>
address from the nodeid<br>
nodeid  -run without arguments, prints the nodeid. Can also set the<br>
nodeid.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/opentechinstitute/commotiond/issues/62'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/3074564__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwMjQ4NTcxOSwiZGF0YSI6eyJpZCI6MjIwMjkwMzR9fQ==--238973320be6dfbe1302d0da94cb25dc0ec350a5.gif' height='1' width='1'></p>