Lines Matching +full:otbr +full:- +full:agent
35 set -euxo pipefail
38 # - commissioning
39 # - mdns_service
40 TEST_CASE="${TEST_CASE:-commissioning}"
50 #---------------------------------------
52 #---------------------------------------
53 OT_RCP="ot-rcp"
56 OT_CLI="${OT_CLI:-ot-cli-ftd}"
59 ABS_TOP_BUILDDIR="$(cd "${top_builddir:-"${SCRIPT_DIR}"/../../}" && pwd)"
62 ABS_TOP_SRCDIR="$(cd "${top_srcdir:-"${SCRIPT_DIR}"/../../}" && pwd)"
65 NO_CLEAN="${NO_CLEAN:-1}"
68 IGNORE_INSTALLED="${IGNORE_INSTALLED:-0}"
71 OTBR_USE_WEB_COMMISSIONER="${USE_WEB_COMMISSIONER:-0}"
74 #----------------------------------------
76 #----------------------------------------
77 TEST_BASE=/tmp/test-otbr
80 OTBR_AGENT=otbr-agent
83 OTBR_WEB=otbr-web
86 OT_COMMISSIONER_CLI=commissioner-cli
98 OTBR_AGENT_PATH="${ABS_TOP_BUILDDIR}/src/agent/${OTBR_AGENT}"
101 OTBR_DBUS_CONF="${ABS_TOP_BUILDDIR}/src/agent/otbr-agent.conf"
107 OT_CTL="${ABS_TOP_BUILDDIR}/third_party/openthread/repo/src/posix/ot-ctl"
128 OT_COMMISSIONER_PATH=${BUILD_DIR}/ot-commissioner/build/src/app/cli/commissioner-cli
131 OT_COMMISSIONER_CONFIG=${BUILD_DIR}/ot-commissioner/src/app/etc/commissioner/non-ccm-config.json
146 # The border agent, and ncp needs a pass phrase.
159 OT_SERVICE_INSTANCE='OpenThread\(\\032\| \)BorderRouter\(\\032\| \)#[0-9A-F][0-9A-F][0-9A-F][0-9A-F…
167 #----------------------------------------
169 #----------------------------------------
180 [[ -f $1 ]] || die "Missing file: $1"
185 [[ -x $1 ]] || die "Missing executable: $1"
210 logger -s -p syslog.alert "OPENTHREAD_TEST: $*"
218 # ------
224 # ------
235 tee complete-syslog.log </var/log/syslog
236 echo 'START_LOG: BR-AGENT ================='
237 grep "${OTBR_AGENT}" /var/log/syslog | tee otbr-agent.log
238 echo 'START_LOG: OT-COMISSIONER ========='
240 echo 'START_LOG: OT-RCP ==================='
242 echo 'START_LOG: OT-CLI ==================='
253 [[ ! -d ${STAGE_DIR} ]] || rm -rf "${STAGE_DIR}"
254 [[ ! -d ${BUILD_DIR} ]] || rm -rf "${BUILD_DIR}"
257 [[ -d ${STAGE_DIR} ]] || mkdir -p "${STAGE_DIR}"
258 [[ -d ${BUILD_DIR} ]] || mkdir -p "${BUILD_DIR}"
261 ot_cli=$(command -v "${OT_CLI}")
262 ot_rcp=$(command -v "${OT_RCP}")
283 sudo rm -vrf "${TEST_BASE}/tmp"
285 sudo rm -vf "/tmp/openthread.lock"
291 if [[ -f /etc/logrotate.conf ]]; then
292 sudo logrotate -f /etc/logrotate.conf || true
295 # From now on - all exits are TRAPPED
305 write_syslog "EXIT ${EXIT_CODE} - output logs"
307 sudo pkill -f "${OTBR_AGENT}" || true
308 sudo pkill -f "${OTBR_WEB}" || true
309 sudo pkill -f "${OT_COMMISSIONER_CLI}" || true
310 sudo pkill -f "${OT_CLI}" || true
315 sudo rm /etc/dbus-1/system.d/otbr-agent.conf || true
316 sudo rm -rf "${STAGE_DIR}" || true
317 sudo rm -rf "${BUILD_DIR}" || true
329 sudo cp "${OTBR_DBUS_CONF}" /etc/dbus-1/system.d
331 write_syslog "AGENT: kill old"
334 write_syslog "AGENT: starting"
338 set -e
339 set -x
344 sudo "${OTBR_AGENT_PATH}" -V
346 sudo "${OTBR_AGENT_PATH}" -x && exit $?
348 [[ ! -d tmp ]] || sudo rm -rf tmp
349 …sudo "${OTBR_AGENT_PATH}" -I "${TUN_NAME}" -v -d 6 "spinel+hdlc+forkpty://${ot_rcp}?forkpty-arg=${…
355 pidof ${OTBR_AGENT} || die "AGENT: failed to start"
356 write_syslog "AGENT: start complete"
365 set -e
366 set -x
369 sudo "${OTBR_WEB_PATH}" -I "${TUN_NAME}" -p "${OTBR_WEB_PORT}" -a "${OTBR_WEB_HOST}" &
391 …curl --header "Content-Type: application/json" --request POST --data "{\"networkKey\":\"${OT_NETWO…
395 avahi-browse -art | tee "${mdns_result}"
396 …ER_AGENT_PORT=$(grep -GA3 '^=.\+'"${OT_SERVICE_INSTANCE}"'.\+_meshcop._udp' "${mdns_result}" | hea…
402 if [[ -x ${OT_COMMISSIONER_PATH} ]]; then
406 (mkdir -p "${BUILD_DIR}/ot-commissioner" \
407 && cd "${BUILD_DIR}/ot-commissioner" \
408 && (git --git-dir=.git rev-parse --is-inside-work-tree || git --git-dir=.git init .) \
409 && git fetch --depth 1 https://github.com/openthread/ot-commissioner.git main \
413 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \
428 local commissioner_config_file="${TEST_BASE}"/ot-commissioner.json
429 local commissioner_config_file="${TEST_BASE}"/ot-commissioner.json
433 expect -f- <<EOF &
454 …curl --header "Content-Type: application/json" --request POST --data "{\"pskd\":\"${OT_JOINER_PASS…
462 sudo expect -f- <<EOF || die 'JOINER FAILED'
484 if command -v dns-sd; then
485 timeout 2 dns-sd -Z _meshcop._udp local. || true
487 avahi-browse -aprt || true
493 local network_name="ot-test-net"
508 sudo "${OT_CTL}" dataset pskc -p ${passphrase}
530 # The binary values are not printable with dns-sd.
541 grep -q "${OT_SERVICE_INSTANCE}._meshcop\._udp" <<<"${service}"
543 # Test if the meshcop service is published again when a non-zero
554 local new_network_name="ot-test-net-new"
578 grep -q "${OT_SERVICE_INSTANCE}._meshcop\._udp" <<<"${service}"
585 # Test if the the meshcop service is unpublished when otbr-agent stops.
589 if grep -q "${OT_SERVICE_INSTANCE}._meshcop\._udp" <<<"${service}"; then
590 die "unexpect meshcop service when otbr-agent exits!"