15
15
# See the License for the specific language governing permissions and
16
16
# limitations under the License.
17
17
ROOT_DIR=$( realpath $( dirname " $0 " ) /../..)
18
+ TH_SCRIPTS_DIR=" $ROOT_DIR /scripts"
18
19
19
20
DEFAULT_OTBR_INTERFACE=" eth0"
20
21
BR_INTERFACE=${1:- $DEAFULT_OTBR_INTERFACE }
@@ -24,21 +25,27 @@ BR_IMAGE_BASE="nrfconnect/otbr"
24
25
BR_IMAGE_TAG=" 9185bda"
25
26
BR_IMAGE=$BR_IMAGE_BASE " :" $BR_IMAGE_TAG
26
27
28
+ source " $TH_SCRIPTS_DIR /utils.sh"
29
+
30
+ print_start_of_script
31
+
32
+ print_script_step " Removing 'otbr-chip' container"
27
33
docker rm otbr-chip > /dev/null 2>&1
28
34
29
35
if docker images | grep $BR_IMAGE_BASE | grep $BR_IMAGE_TAG ;
30
36
then
31
37
echo " otbr image " $BR_IMAGE " already installed"
32
38
else
33
- echo " pulling otbr image " $BR_IMAGE
39
+ print_script_step " Pulling $BR_IMAGE image"
34
40
docker pull $BR_IMAGE || exit 1
35
41
fi
42
+
43
+ print_script_step " Starting 'otbr-chip' container"
36
44
AVAHI_PATH=$ROOT_DIR /backend/app/otbr_manager/avahi
37
45
sudo modprobe ip6table_filter || exit 1
38
46
sudo docker run --privileged -d --network host --name otbr-chip -e NAT64=1 -e DNS64=0 -e WEB_GUI=0 -v $AVAHI_PATH :/etc/avahi -v /dev/ttyACM0:/dev/radio $BR_IMAGE --radio-url spinel+hdlc+uart:///dev/radio? uart-baudrate=115200 -B $BR_INTERFACE || exit 1
39
47
40
- echo " waiting 10 seconds to give the the docker container enough time to start up..."
41
-
48
+ print_script_step " waiting 10 seconds to give the the docker container enough time to start up..."
42
49
sleep 10
43
50
44
51
BR_CHANNEL_HEX=$( printf ' %02x' $BR_CHANNEL )
@@ -63,15 +70,17 @@ BR_PARAMS=(
63
70
" dataset active -x"
64
71
)
65
72
73
+ print_script_step " Setting up Thread Network"
74
+
66
75
for i in " ${BR_PARAMS[@]} "
67
76
do
68
- echo " Param: '" $i " '"
77
+ printf " Param: '$i '"
69
78
sudo docker exec -t otbr-chip ot-ctl $i || exit 1
70
79
done
71
80
72
81
BR_SIMPLE_DATASET=" 00030000" ${BR_CHANNEL_HEX} " 0208" ${BR_EXTPANID} " 0510" ${BR_NETWORKKEY} " 0102" ${BR_PANID}
73
82
sudo echo ${BR_SIMPLE_DATASET} > /tmp/otbr_simple_dataset.txt
74
- echo " Simple Dataset: " ${ BR_SIMPLE_DATASET}
83
+ printf " Simple Dataset: $ BR_SIMPLE_DATASET"
75
84
76
- # Also make sure to restart the Raspi avahi to have it in a clean state
85
+ print_script_step " Also make sure to restart the Raspi avahi to have it in a clean state"
77
86
sudo service avahi-daemon restart
0 commit comments