1#!/usr/bin/expect -f 2# 3# Copyright (c) 2024, 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 32set dataset_valid "0x0e,0x08,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x0d,0x35,0x06,0x00,0x04,0x00,0x1f,0xff,0xe0,0x02,0x08,0x1f,0xeb,0xac,0x0f,0xca,0x10,0x8c,0xcd,0x07,0x08,0xfd,0x26,0x9e,0x9f,0x6b,0x8a,0x2a,0xa1,0x05,0x10,0xd3,0x7e,0x6d,0x55,0x73,0xcc,0x88,0x43,0xdb,0x22,0x3b,0x00,0xcd,0x8f,0xf2,0xb0,0x03,0x0f,0x4f,0x70,0x65,0x6e,0x54,0x68,0x72,0x65,0x61,0x64,0x2d,0x65,0x36,0x62,0x37,0x04,0x10,0x16,0xcc,0x1e,0x42,0x3a,0x9c,0xe9,0x47,0xf6,0x05,0x9a,0xe5,0xb8,0x38,0x17,0xb7,0x0c,0x04,0x02,0xa0,0xf7,0xf8,0x01,0x02,0x99,0x99" 33 34set dataset_has_pending_timestamp "$dataset_valid,0x33,0x08,0x00,0x00,0x07,0x5b,0xcd,0x15,0x00,0x00" 35 36set dataset_has_delay "$dataset_valid,0x34,0x04,0x00,0x00,0x75,0x30" 37 38spawn_node 1 otbr $::env(EXP_OT_NCP_PATH) 39sleep 1 40 41spawn dbus-send --system --dest=io.openthread.BorderRouter.wpan0 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 io.openthread.BorderRouter.ScheduleMigration "array:byte:${dataset_valid}" "uint32:0x7530" 42expect Error.InvalidState 43expect eof 44 45spawn dbus-send --system --dest=io.openthread.BorderRouter.wpan0 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 io.openthread.BorderRouter.ScheduleMigration "array:byte:${dataset_has_pending_timestamp}" "uint32:0x7530" 46expect Error.InvalidArgs 47expect eof 48 49spawn dbus-send --system --dest=io.openthread.BorderRouter.wpan0 --type=method_call --print-reply /io/openthread/BorderRouter/wpan0 io.openthread.BorderRouter.ScheduleMigration "array:byte:${dataset_has_delay}" "uint32:0x7530" 50expect Error.InvalidArgs 51expect eof 52