1#!/usr/bin/expect -f 2# 3# Copyright (c) 2022, 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" 31 32spawn_node 1 "cli" 33 34spawn_tcat_client_for_node 1 35 36send "network_name\n" 37expect_line "\tTYPE:\tRESPONSE_W_STATUS" 38expect_line "\tVALUE:\t0x06" 39 40send "get_dataset\n" 41expect_line "\tTYPE:\tRESPONSE_W_STATUS" 42expect_line "\tVALUE:\t0x04" 43 44send "get_comm_cert\n" 45expect_line "\tTYPE:\tRESPONSE_W_STATUS" 46expect_line "\tVALUE:\t0x06" 47 48send "commission\n" 49expect_line "\tTYPE:\tRESPONSE_W_STATUS" 50expect_line "\tVALUE:\t0x00" 51 52send "get_dataset\n" 53expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 54expect_line "\tLEN:\t106" 55expect_line "\tVALUE:\t0x0e080000000000010000000300001235060004001fffe00208ef1398c2fd504b670708fd35344133d1d73e0510fda7c771a27202e232ecd04cf934f476030f4f70656e5468726561642d633634650102c64e04105e9b9b360f80b88be2603fb0135c8d650c0402a0f7f8" 56 57send "get_comm_cert\n" 58expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 59expect_line "\tVALUE:\t0x308201d53082017ba00302010202030e1a83300a06082a8648ce3d04030230713126302406035504030c1d5468726561642043657274696669636174696f6e20446576696365434131193017060355040a0c105468726561642047726f757020496e633112301006035504070c0953616e2052616d6f6e310b300906035504080c024341310b3009060355040613025553301e170d3234303530373039333934355a170d3234303532313039333934355a303a311f301d06035504030c1654434154204578616d706c6520436f6d6d4365727431311730150603550405130e333532332d313534332d303030313059301306072a8648ce3d020106082a8648ce3d030107034200041d9abcbe167cd7a244860a9eeb364a8a830315baca1242659d17d224475f5d96124bde30505287cc41dc018dcf53820f4c69c5e69bac504e35ac96b69fcbc2efa3393037301f0603551d230418301680145fab1b296888a1d4b431a88661e7e76659edf819301406092b0601040182df2a03040704052101010101300a06082a8648ce3d0403020348003045022077847ce3845f78f26b6f9b24ca06104705139e9e50e8dacfd6954edd6ca041bc022100d2d68718da4682313f6f890b5b6edd77c1fe0ff1f990d6eaf49966f5cb74efc6" 60 61send "thread start\n" 62expect_line "\tTYPE:\tRESPONSE_W_STATUS" 63expect_line "\tVALUE:\t0x00" 64 65send "ping\n" 66expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 67expect_line "\tLEN:\t10" 68 69send "ping 255\n" 70expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 71expect_line "\tLEN:\t255" 72 73send "ping 512\n" 74expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 75expect_line "\tLEN:\t512" 76 77send "network_name\n" 78expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 79expect_line "\tLEN:\t15" 80expect_line "\tVALUE:\t0x4f70656e5468726561642d63363465" 81 82send "device_id\n" 83expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 84expect_line "\tLEN:\t8" 85expect_line "\tVALUE:\t0x18b4300000000001" 86 87send "ext_panid\n" 88expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 89expect_line "\tLEN:\t8" 90expect_line "\tVALUE:\t0xef1398c2fd504b67" 91 92send "provisioning_url\n" 93expect_line "\tTYPE:\tRESPONSE_W_PAYLOAD" 94expect_line "\tLEN:\t9" 95expect_line "\tVALUE:\t0x64756d6d795f75726c" 96 97dispose_tcat_client 1 98 99switch_node 1 100send "tcat stop\n" 101expect_line "Done" 102 103send "networkkey\n" 104expect_line "fda7c771a27202e232ecd04cf934f476" 105expect_line "Done" 106 107wait_for "state" "leader" 108expect_line "Done" 109 110dispose_all 111