• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/expect -f
2#
3#  Copyright (c) 2020, 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
30source "tests/scripts/expect/_common.exp"
31source "tests/scripts/expect/_multinode.exp"
32
33setup_two_nodes
34
35switch_node 1
36
37send "leaderdata\n"
38expect -re {Partition ID: \d+}
39expect -re {Weighting: \d+}
40expect -re {Data Version: \d+}
41expect -re {Stable Data Version: \d+}
42expect -re {Leader Router ID: \d+}
43expect_line "Done"
44
45send "help\n"
46expect_line "Done"
47
48send "bufferinfo\n"
49expect_line "Done"
50
51send "ccathreshold -62\n"
52expect_line "Done"
53send "ccathreshold\n"
54expect -- "-62 dBm"
55expect_line "Done"
56
57send "parent\n"
58expect_line "Done"
59
60send "delaytimermin 1\n"
61expect_line "Done"
62send "delaytimermin\n"
63expect "1"
64expect_line "Done"
65send "delaytimermin 1 2\n"
66send "counters mac 1\n"
67expect "Error 7: InvalidArgs"
68
69send "fem lnagain 11\n"
70expect_line "Done"
71send "fem lnagain\n"
72expect -- "11"
73expect_line "Done"
74send "fem\n"
75expect -- "LNA gain 11 dBm"
76expect_line "Done"
77
78send "ifconfig down\n"
79expect_line "Done"
80send "ifconfig\n"
81expect "down"
82expect_line "Done"
83send "ifconfig up\n"
84expect_line "Done"
85send "ifconfig\n"
86expect "up"
87expect_line "Done"
88
89send "instanceid\n"
90expect -re {\d+}
91expect_line "Done"
92
93send "ipaddr add ::\n"
94expect_line "Done"
95send "ipaddr del ::\n"
96expect_line "Done"
97
98send "leaderweight 1\n"
99expect_line "Done"
100send "leaderweight\n"
101expect "1"
102expect_line "Done"
103
104send "mode rdn\n"
105expect_line "Done"
106send "mode\n"
107expect -re "(?=.*r)(?=.*d)(?=.*n)"
108
109send "parent\n"
110expect_line "Done"
111
112send "singleton\n"
113expect -re "true|false"
114expect_line "Done"
115
116send "state\n"
117expect "disabled"
118expect_line "Done"
119
120send "txpower -10\n"
121expect_line "Done"
122send "txpower\n"
123expect -- "-10 dBm"
124expect_line "Done"
125
126send "targetpower 12 1000\n"
127expect_line "Done"
128
129send "targetpower 12 -1000\n"
130expect_line "Done"
131
132send "targetpower 10 1000\n"
133expect_line "Error 7: InvalidArgs"
134
135send "thread version\n"
136expect_line "Done"
137
138send "version\n"
139expect_line "Done"
140send "version api\n"
141expect -re {\d+}
142expect_line "Done"
143send "version something_invalid\n"
144expect "Error 35: InvalidCommand"
145
146send "joinerport 10001\n"
147expect_line "Done"
148send "joinerport\n"
149expect "10001"
150expect_line "Done"
151
152send "parentpriority 1\n"
153expect_line "Done"
154send "parentpriority\n"
155expect "1"
156expect_line "Done"
157
158send "pollperiod 100000\n"
159expect_line "Done"
160send "pollperiod\n"
161expect "100000"
162expect_line "Done"
163
164send "prefix add ::/64 low pdcrosn\n"
165expect_line "Done"
166send "prefix\n"
167expect "0:0:0:0::/64 pdcrosn low"
168expect_line "Done"
169
170send "preferrouterid 1\n"
171expect_line "Done"
172
173send "route add ::/64 s low\n"
174expect_line "Done"
175send "route\n"
176expect "0:0:0:0::/64 s low"
177send "route remove ::/64\n"
178expect_line "Done"
179
180send "route add ::/0 s low\n"
181expect_line "Done"
182send "route\n"
183expect "::/0 s low"
184send "route remove ::/0\n"
185expect_line "Done"
186
187send "diag start\n"
188expect ": InvalidState"
189
190send "ba port\n"
191expect "Done"
192
193send "prefix meshlocal fd00:dead:beef:cafe::/96\n"
194expect_line "Error 7: InvalidArgs"
195send "prefix meshlocal fd00:dead:beef:cafe::/64\n"
196expect_line "Done"
197send "prefix meshlocal\n"
198expect_line "fd00:dead:beef:cafe::/64"
199
200send "invalidcommand\n"
201expect_line "Error 35: InvalidCommand"
202
203dispose_all
204