diff --git a/tests/scripts/expect/_common.exp b/tests/scripts/expect/_common.exp index 820a0c674..4214299b7 100644 --- a/tests/scripts/expect/_common.exp +++ b/tests/scripts/expect/_common.exp @@ -213,11 +213,23 @@ proc get_rloc16 {} { } proc setup_default_network {} { - send "channel 11\n" + send "dataset init new\n" expect_line "Done" - send "panid 0xface\n" + send "dataset channel 11\n" expect_line "Done" - send "networkkey 00112233445566778899aabbccddeeff\n" + send "dataset extpanid 000db80000000000\n" + expect_line "Done" + send "dataset meshlocalprefix fd00:db8::\n" + expect_line "Done" + send "dataset networkkey 00112233445566778899aabbccddeeff\n" + expect_line "Done" + send "dataset networkname OpenThread-face\n" + expect_line "Done" + send "dataset panid 0xface\n" + expect_line "Done" + send "dataset pskc c23a76e98f1a6483639b1ac1271e2e27\n" + expect_line "Done" + send "dataset commit active\n" expect_line "Done" } diff --git a/tests/scripts/expect/cli-multicast-loop.exp b/tests/scripts/expect/cli-multicast-loop.exp index 14f07bd60..8883d639d 100755 --- a/tests/scripts/expect/cli-multicast-loop.exp +++ b/tests/scripts/expect/cli-multicast-loop.exp @@ -41,9 +41,6 @@ setup_default_network set timeout 1 -send "panid 0xface\n" -expect_line "Done" - attach set extaddr1 [get_extaddr] @@ -53,9 +50,6 @@ get_rloc16 spawn_node 2 cli setup_default_network -send "panid 0xface\n" -expect_line "Done" - attach "router" sleep 3 @@ -65,9 +59,6 @@ get_rloc16 spawn_node 3 cli setup_default_network -send "panid 0xface\n" -expect_line "Done" - send "macfilter addr add ${extaddr1}\n" expect_line "Done" @@ -85,9 +76,6 @@ get_rloc16 spawn_node 4 cli setup_default_network -send "panid 0xface\n" -expect_line "Done" - send "mode rn\n" expect_line "Done" diff --git a/tests/scripts/expect/cli-networkname.exp b/tests/scripts/expect/cli-networkname.exp index fc4edb140..6f1289ff7 100755 --- a/tests/scripts/expect/cli-networkname.exp +++ b/tests/scripts/expect/cli-networkname.exp @@ -30,10 +30,15 @@ source "tests/scripts/expect/_common.exp" spawn_node 1 +setup_default_network spawn_node 2 switch_node 1 -send "networkname Thread\\ Network\n" +send "dataset init active\n" +expect_line "Done" +send "dataset networkname Thread\\ Network\n" +expect_line "Done" +send "dataset commit active\n" expect_line "Done" send "ifconfig up\n" expect_line "Done" @@ -52,7 +57,11 @@ expect_line "Done" switch_node 1 send "thread stop\n" expect_line "Done" -send "networkname Thread\\ 网络\n" +send "dataset init active\n" +expect_line "Done" +send "dataset networkname Thread\\ 网络\n" +expect_line "Done" +send "dataset commit active\n" expect_line "Done" send "thread start\n" expect_line "Done" @@ -67,7 +76,11 @@ expect_line "Done" switch_node 1 send "thread stop\n" expect_line "Done" -send "networkname スレッド\n" +send "dataset init active\n" +expect_line "Done" +send "dataset networkname スレッド\n" +expect_line "Done" +send "dataset commit active\n" expect_line "Done" send "thread start\n" expect_line "Done" diff --git a/tests/scripts/expect/cli-reset.exp b/tests/scripts/expect/cli-reset.exp index 644208880..b43069717 100755 --- a/tests/scripts/expect/cli-reset.exp +++ b/tests/scripts/expect/cli-reset.exp @@ -30,11 +30,17 @@ source "tests/scripts/expect/_common.exp" spawn_node 1 +setup_default_network + +send "dataset init active\n" +expect_line "Done" +send "dataset panid 0xabcd\n" +expect_line "Done" +send "dataset commit active\n" +expect_line "Done" send "ifconfig up\n" expect_line "Done" -send "panid 0xabcd\n" -expect_line "Done" send "thread start\n" expect_line "Done" diff --git a/tests/scripts/expect/posix-rcp-restoration.exp b/tests/scripts/expect/posix-rcp-restoration.exp index 1d3fac227..d745474cc 100755 --- a/tests/scripts/expect/posix-rcp-restoration.exp +++ b/tests/scripts/expect/posix-rcp-restoration.exp @@ -251,6 +251,7 @@ try { puts "While energy scanning" spawn_node 1 "rcp" "spinel+hdlc_uart://$host_pty" + setup_default_network attach send "scan energy 100\n" diff --git a/tests/scripts/expect/tun-dns-client.exp b/tests/scripts/expect/tun-dns-client.exp index 3a2ac644d..b349bc699 100755 --- a/tests/scripts/expect/tun-dns-client.exp +++ b/tests/scripts/expect/tun-dns-client.exp @@ -30,9 +30,8 @@ source "tests/scripts/expect/_common.exp" spawn_node 1 +setup_default_network -send "panid 0xface\n" -expect_line "Done" send "ifconfig up\n" expect_line "Done" send "thread start\n" diff --git a/tests/scripts/expect/tun-sntp.exp b/tests/scripts/expect/tun-sntp.exp index fe91233d0..eebbf127e 100755 --- a/tests/scripts/expect/tun-sntp.exp +++ b/tests/scripts/expect/tun-sntp.exp @@ -32,9 +32,8 @@ source "tests/scripts/expect/_common.exp" skip_on_macos spawn_node 1 +setup_default_network -send "panid 0xface\n" -expect_line "Done" attach send "sntp query ::1 123\n" diff --git a/tests/scripts/expect/tun-udp.exp b/tests/scripts/expect/tun-udp.exp index 53cff14e7..65c5b227c 100755 --- a/tests/scripts/expect/tun-udp.exp +++ b/tests/scripts/expect/tun-udp.exp @@ -32,12 +32,10 @@ source "tests/scripts/expect/_common.exp" spawn_node 1 +setup_default_network set timeout 1 -send "panid 0xface\n" -expect_line "Done" - attach send "udp open\n"