|
| 1 | +#!/usr/bin/expect -f |
| 2 | +# |
| 3 | +# Copyright (c) 2025, The OpenThread Authors. |
| 4 | +# All rights reserved. |
| 5 | +# |
| 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. |
| 16 | +# |
| 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. |
| 28 | +# |
| 29 | + |
| 30 | +source "tests/scripts/expect/_common.exp" |
| 31 | + |
| 32 | +set dataset "0e080000000000010000000300001435060004001fffe002087d61eb42cdc48d6a0708fd0d07fca1b9f0500510ba088fc2bd6c3b3897f7a10f58263ff3030f4f70656e5468726561642d353234660102524f04109dc023ccd447b12b50997ef68020f19e0c0402a0f7f8" |
| 33 | + |
| 34 | +# Step 1. Start a Thread node and create a Thread network |
| 35 | +spawn_node 1 cli $::env(EXP_OT_CLI_PATH) |
| 36 | + |
| 37 | +send "dataset set active ${dataset}\n" |
| 38 | +expect_line "Done" |
| 39 | +send "ifconfig up\n" |
| 40 | +expect_line "Done" |
| 41 | +send "thread start\n" |
| 42 | +expect_line "Done" |
| 43 | +wait_for "state" "leader" |
| 44 | +expect_line "Done" |
| 45 | + |
| 46 | + |
| 47 | +# Step 2. Start otbr-agent with a NCP |
| 48 | +spawn_node 2 otbr $::env(EXP_OT_NCP_PATH) |
| 49 | +sleep 1 |
| 50 | + |
| 51 | +# Step 3. Start ot-ctl and join the network |
| 52 | +spawn_node 3 ctl $::env(EXP_OT_CTL_PATH) |
| 53 | + |
| 54 | +send "dataset set active ${dataset}\n" |
| 55 | +expect "Done" |
| 56 | +send "ifconfig up\n" |
| 57 | +expect "Done" |
| 58 | +send "thread start\n" |
| 59 | +expect "Done" |
| 60 | +wait_for "state" "router|child" |
| 61 | +expect "Done" |
| 62 | + |
| 63 | +# Step 4. Leave the network |
| 64 | +send "thread stop\n" |
| 65 | +expect "Done" |
| 66 | +send "ifconfig down\n" |
| 67 | +expect "Done" |
| 68 | + |
| 69 | +# Step 5. Verify the state of otbr-agent is 'disabled' |
| 70 | +wait_for "state" "disabled" |
| 71 | +expect "Done" |
0 commit comments