3 # Copyright (c) 2020, The OpenThread Authors.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # 3. Neither the name of the copyright holder nor the
14 # names of its contributors may be used to endorse or promote products
15 # derived from this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # Test build and run otbr dbus server
34 readonly OTBR_DBUS_SERVER_CONF=otbr-test-agent.conf
40 sudo killall otbr-agent || true
41 sudo killall expect || true
42 sudo killall ot-cli-ftd || true
43 sudo killall ot-cli-mtd || true
44 sudo rm "/etc/dbus-1/system.d/${OTBR_DBUS_SERVER_CONF}" || true
46 grep -iE 'ot-cli|otbr' </var/log/syslog
54 sudo install -m 644 "${CMAKE_BINARY_DIR}"/src/agent/otbr-agent.conf /etc/dbus-1/system.d/"${OTBR_DBUS_SERVER_CONF}"
55 sudo service dbus reload
56 sudo "${CMAKE_BINARY_DIR}"/src/agent/otbr-agent -d7 -I wpan0 --radio-version "spinel+hdlc+forkpty://$(command -v ot-rcp)?forkpty-arg=1" | grep "OPENTHREAD"
57 sudo "${CMAKE_BINARY_DIR}"/src/agent/otbr-agent -d7 -I wpan0 "spinel+hdlc+forkpty://$(command -v ot-rcp)?forkpty-arg=1" &
60 sudo "${CMAKE_BINARY_DIR}"/third_party/openthread/repo/src/posix/ot-ctl factoryreset
62 sudo dbus-send --system --dest=io.openthread.BorderRouter.wpan0 \
63 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 \
64 org.freedesktop.DBus.Introspectable.Introspect | grep JoinerStart
65 (sudo dbus-send --system --dest=io.openthread.BorderRouter.wpan0 \
66 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 \
67 io.openthread.BorderRouter.JoinerStart \
68 string:ABCDEF string:mock string:mock \
69 string:mock string:mock string:mock 2>&1 || true) | grep NotFound
70 # The ot-cli-ftd node is used to test Thread attach.
73 send "panid 0x7890\r\n"
75 send "networkname Test1\r\n"
79 send "ifconfig up\r\n"
81 send "thread start\r\n"
87 send "commissioner start\r\n"
88 expect "Commissioner: active"
89 send "commissioner joiner add * ABCDEF\r\n"
92 send "commissioner stop\r\n"
95 # The ot-cli-mtd node is used to test the child and neighbor table.
98 send "panid 0x3456\r\n"
100 send "masterkey 00112233445566778899aabbccddeeff\r\n"
102 send "networkname Test\r\n"
104 send "channel 11\r\n"
106 send "ifconfig up\r\n"
108 send "thread start\r\n"
113 sudo dbus-send --system --dest=io.openthread.BorderRouter.wpan0 \
114 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 \
115 io.openthread.BorderRouter.JoinerStart \
116 string:ABCDEF string:mock string:mock \
117 string:mock string:mock string:mock
118 sudo "${CMAKE_BINARY_DIR}"/third_party/openthread/repo/src/posix/ot-ctl factoryreset
120 sudo "${CMAKE_BINARY_DIR}"/tests/dbus/otbr-test-dbus-client