• 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 "ipaddr add ::\n"
90expect_line "Done"
91send "ipaddr del ::\n"
92expect_line "Done"
93
94send "leaderweight 1\n"
95expect_line "Done"
96send "leaderweight\n"
97expect "1"
98expect_line "Done"
99
100send "mode rdn\n"
101expect_line "Done"
102send "mode\n"
103expect -re "(?=.*r)(?=.*d)(?=.*n)"
104
105send "parent\n"
106expect_line "Done"
107
108send "singleton\n"
109expect -re "true|false"
110expect_line "Done"
111
112send "state\n"
113expect "disabled"
114expect_line "Done"
115
116send "txpower -10\n"
117expect_line "Done"
118send "txpower\n"
119expect -- "-10 dBm"
120expect_line "Done"
121
122send "thread version\n"
123expect_line "Done"
124
125send "version\n"
126expect_line "Done"
127send "version api\n"
128expect -re {\d+}
129expect_line "Done"
130send "version something_invalid\n"
131expect "Error 35: InvalidCommand"
132
133send "joinerport 10001\n"
134expect_line "Done"
135send "joinerport\n"
136expect "10001"
137expect_line "Done"
138
139send "parentpriority 1\n"
140expect_line "Done"
141send "parentpriority\n"
142expect "1"
143expect_line "Done"
144
145send "pollperiod 100000\n"
146expect_line "Done"
147send "pollperiod\n"
148expect "100000"
149expect_line "Done"
150
151send "prefix add ::/64 low pdcrosn\n"
152expect_line "Done"
153send "prefix\n"
154expect "0:0:0:0::/64 pdcrosn low"
155expect_line "Done"
156
157send "preferrouterid 1\n"
158expect_line "Done"
159
160send "route add ::/64 s low\n"
161expect_line "Done"
162send "route\n"
163expect "0:0:0:0::/64 s low"
164send "route remove ::/64\n"
165expect_line "Done"
166
167send "route add ::/0 s low\n"
168expect_line "Done"
169send "route\n"
170expect "::/0 s low"
171send "route remove ::/0\n"
172expect_line "Done"
173
174send "diag start\n"
175expect ": InvalidState"
176
177send "ba port\n"
178expect "Done"
179
180send "ba state\n"
181expect "Done"
182
183send "prefix meshlocal fd00:dead:beef:cafe::/96\n"
184expect_line "Error 7: InvalidArgs"
185send "prefix meshlocal fd00:dead:beef:cafe::/64\n"
186expect_line "Done"
187send "prefix meshlocal\n"
188expect_line "fd00:dead:beef:cafe::/64"
189
190send "invalidcommand\n"
191expect_line "Error 35: InvalidCommand"
192
193dispose_all
194