1*cfb92d14SAndroid Build Coastguard Worker#!/usr/bin/env python3 2*cfb92d14SAndroid Build Coastguard Worker# 3*cfb92d14SAndroid Build Coastguard Worker# Copyright (c) 2018, The OpenThread Authors. 4*cfb92d14SAndroid Build Coastguard Worker# All rights reserved. 5*cfb92d14SAndroid Build Coastguard Worker# 6*cfb92d14SAndroid Build Coastguard Worker# Redistribution and use in source and binary forms, with or without 7*cfb92d14SAndroid Build Coastguard Worker# modification, are permitted provided that the following conditions are met: 8*cfb92d14SAndroid Build Coastguard Worker# 1. Redistributions of source code must retain the above copyright 9*cfb92d14SAndroid Build Coastguard Worker# notice, this list of conditions and the following disclaimer. 10*cfb92d14SAndroid Build Coastguard Worker# 2. Redistributions in binary form must reproduce the above copyright 11*cfb92d14SAndroid Build Coastguard Worker# notice, this list of conditions and the following disclaimer in the 12*cfb92d14SAndroid Build Coastguard Worker# documentation and/or other materials provided with the distribution. 13*cfb92d14SAndroid Build Coastguard Worker# 3. Neither the name of the copyright holder nor the 14*cfb92d14SAndroid Build Coastguard Worker# names of its contributors may be used to endorse or promote products 15*cfb92d14SAndroid Build Coastguard Worker# derived from this software without specific prior written permission. 16*cfb92d14SAndroid Build Coastguard Worker# 17*cfb92d14SAndroid Build Coastguard Worker# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18*cfb92d14SAndroid Build Coastguard Worker# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19*cfb92d14SAndroid Build Coastguard Worker# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20*cfb92d14SAndroid Build Coastguard Worker# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21*cfb92d14SAndroid Build Coastguard Worker# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22*cfb92d14SAndroid Build Coastguard Worker# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23*cfb92d14SAndroid Build Coastguard Worker# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24*cfb92d14SAndroid Build Coastguard Worker# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25*cfb92d14SAndroid Build Coastguard Worker# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26*cfb92d14SAndroid Build Coastguard Worker# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27*cfb92d14SAndroid Build Coastguard Worker# POSSIBILITY OF SUCH DAMAGE. 28*cfb92d14SAndroid Build Coastguard Worker 29*cfb92d14SAndroid Build Coastguard Workerimport time 30*cfb92d14SAndroid Build Coastguard Workerimport wpan 31*cfb92d14SAndroid Build Coastguard Workerfrom wpan import verify 32*cfb92d14SAndroid Build Coastguard Worker 33*cfb92d14SAndroid Build Coastguard Worker# ----------------------------------------------------------------------------------------------------------------------- 34*cfb92d14SAndroid Build Coastguard Worker# Test description: Testing controlling of NCP's MCU power state 35*cfb92d14SAndroid Build Coastguard Worker 36*cfb92d14SAndroid Build Coastguard Workertest_name = __file__[:-3] if __file__.endswith('.py') else __file__ 37*cfb92d14SAndroid Build Coastguard Workerprint('-' * 120) 38*cfb92d14SAndroid Build Coastguard Workerprint('Starting \'{}\''.format(test_name)) 39*cfb92d14SAndroid Build Coastguard Worker 40*cfb92d14SAndroid Build Coastguard Worker# ----------------------------------------------------------------------------------------------------------------------- 41*cfb92d14SAndroid Build Coastguard Worker# Creating `wpan.Nodes` instances 42*cfb92d14SAndroid Build Coastguard Worker 43*cfb92d14SAndroid Build Coastguard Workernode = wpan.Node() 44*cfb92d14SAndroid Build Coastguard Worker 45*cfb92d14SAndroid Build Coastguard Worker# ----------------------------------------------------------------------------------------------------------------------- 46*cfb92d14SAndroid Build Coastguard Worker# Init all nodes 47*cfb92d14SAndroid Build Coastguard Worker 48*cfb92d14SAndroid Build Coastguard Workerwpan.Node.init_all_nodes() 49*cfb92d14SAndroid Build Coastguard Worker 50*cfb92d14SAndroid Build Coastguard Worker# ----------------------------------------------------------------------------------------------------------------------- 51*cfb92d14SAndroid Build Coastguard Worker# Test implementation 52*cfb92d14SAndroid Build Coastguard Worker 53*cfb92d14SAndroid Build Coastguard Worker# Verify that state is ON after a reset 54*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 55*cfb92d14SAndroid Build Coastguard Worker 56*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 57*cfb92d14SAndroid Build Coastguard Worker# Check power state wpantund property get and set 58*cfb92d14SAndroid Build Coastguard Worker 59*cfb92d14SAndroid Build Coastguard WorkerWAIT_TIME = 5 60*cfb92d14SAndroid Build Coastguard Worker 61*cfb92d14SAndroid Build Coastguard Worker 62*cfb92d14SAndroid Build Coastguard Workerdef check_wpan_is_in_offline_state(): 63*cfb92d14SAndroid Build Coastguard Worker verify(node.get(wpan.WPAN_STATE) == wpan.STATE_OFFLINE) 64*cfb92d14SAndroid Build Coastguard Worker 65*cfb92d14SAndroid Build Coastguard Worker 66*cfb92d14SAndroid Build Coastguard Workerdef check_wpan_is_in_deep_sleep_state(): 67*cfb92d14SAndroid Build Coastguard Worker verify(node.get(wpan.WPAN_STATE) == wpan.STATE_DEEP_SLEEP) 68*cfb92d14SAndroid Build Coastguard Worker 69*cfb92d14SAndroid Build Coastguard Worker 70*cfb92d14SAndroid Build Coastguard Workerdef check_wpan_is_in_commissioned_state(): 71*cfb92d14SAndroid Build Coastguard Worker verify(node.get(wpan.WPAN_STATE) == wpan.STATE_COMMISSIONED) 72*cfb92d14SAndroid Build Coastguard Worker 73*cfb92d14SAndroid Build Coastguard Worker 74*cfb92d14SAndroid Build Coastguard Workerdef check_wpan_is_in_associated_state(): 75*cfb92d14SAndroid Build Coastguard Worker verify(node.get(wpan.WPAN_STATE) == wpan.STATE_ASSOCIATED) 76*cfb92d14SAndroid Build Coastguard Worker 77*cfb92d14SAndroid Build Coastguard Worker 78*cfb92d14SAndroid Build Coastguard Workerdef check_wpan_is_in_associating_state(): 79*cfb92d14SAndroid Build Coastguard Worker verify(node.get(wpan.WPAN_STATE) == wpan.STATE_ASSOCIATING) 80*cfb92d14SAndroid Build Coastguard Worker 81*cfb92d14SAndroid Build Coastguard Worker 82*cfb92d14SAndroid Build Coastguard Workernode.form("mcu-power-state") 83*cfb92d14SAndroid Build Coastguard Workerverify(node.is_associated()) 84*cfb92d14SAndroid Build Coastguard Worker 85*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, 'low-power') 86*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 87*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_ASSOCIATED) 88*cfb92d14SAndroid Build Coastguard Worker 89*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, 'on') 90*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 91*cfb92d14SAndroid Build Coastguard Worker 92*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, 'lp') # special short-form string for low-power 93*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 94*cfb92d14SAndroid Build Coastguard Worker 95*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 96*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 97*cfb92d14SAndroid Build Coastguard Worker 98*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_LOW_POWER) 99*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 100*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_ASSOCIATED) 101*cfb92d14SAndroid Build Coastguard Worker 102*cfb92d14SAndroid Build Coastguard Worker# Verify that `wpantund` will restore the user-set value after NCP reset 103*cfb92d14SAndroid Build Coastguard Worker 104*cfb92d14SAndroid Build Coastguard Workernode.reset() 105*cfb92d14SAndroid Build Coastguard Workertime.sleep(1) 106*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 107*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 108*cfb92d14SAndroid Build Coastguard Worker 109*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 110*cfb92d14SAndroid Build Coastguard Worker# Check the `wpantund` state changes between "deep-sleep" and "offline" 111*cfb92d14SAndroid Build Coastguard Worker 112*cfb92d14SAndroid Build Coastguard Workernode.leave() 113*cfb92d14SAndroid Build Coastguard Workerverify(not node.is_associated()) 114*cfb92d14SAndroid Build Coastguard Worker 115*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 116*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_OFFLINE) 117*cfb92d14SAndroid Build Coastguard Worker 118*cfb92d14SAndroid Build Coastguard Worker# Setting the power state to `low-power` should change wpantund state to 119*cfb92d14SAndroid Build Coastguard Worker# `DEEP_SLEEP` 120*cfb92d14SAndroid Build Coastguard Worker 121*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_LOW_POWER) 122*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 123*cfb92d14SAndroid Build Coastguard Worker 124*cfb92d14SAndroid Build Coastguard Worker# Verify that reading/getting a property does not impact the wpantund state. 125*cfb92d14SAndroid Build Coastguard Worker 126*cfb92d14SAndroid Build Coastguard Workernode.get(wpan.WPAN_THREAD_RLOC16) 127*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 128*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_DEEP_SLEEP) 129*cfb92d14SAndroid Build Coastguard Worker 130*cfb92d14SAndroid Build Coastguard Worker# Setting the power state to `on` should change wpantund state to `OFFLINE` 131*cfb92d14SAndroid Build Coastguard Worker 132*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 133*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_offline_state, WAIT_TIME) 134*cfb92d14SAndroid Build Coastguard Worker 135*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 136*cfb92d14SAndroid Build Coastguard Worker# Verify the behavior of `begin-low-power` wpanctl command 137*cfb92d14SAndroid Build Coastguard Worker 138*cfb92d14SAndroid Build Coastguard Workernode.wpanctl('begin-low-power') 139*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 140*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 141*cfb92d14SAndroid Build Coastguard Worker 142*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 143*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_offline_state, WAIT_TIME) 144*cfb92d14SAndroid Build Coastguard Worker 145*cfb92d14SAndroid Build Coastguard Worker# Check the `wpantund` state changes between "offline:commissioned" and 146*cfb92d14SAndroid Build Coastguard Worker# "deep-sleep" 147*cfb92d14SAndroid Build Coastguard Worker 148*cfb92d14SAndroid Build Coastguard Workernode.form("test-network") 149*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:AutoAssociateAfterReset', '0') 150*cfb92d14SAndroid Build Coastguard Worker 151*cfb92d14SAndroid Build Coastguard Worker# Verify that issuing a `begin-low-power` when in "associated" state 152*cfb92d14SAndroid Build Coastguard Worker# does not change the state. 153*cfb92d14SAndroid Build Coastguard Workernode.wpanctl('begin-low-power') 154*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 155*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_ASSOCIATED) 156*cfb92d14SAndroid Build Coastguard Worker 157*cfb92d14SAndroid Build Coastguard Worker# After reset, power state should remain `LOW_POWER` (wpantund would restore the value 158*cfb92d14SAndroid Build Coastguard Worker# on NCP) and since "AutoAssociateAfterReset" is disabled, wpantund state should 159*cfb92d14SAndroid Build Coastguard Worker# be `DEEP_SLEEP`. 160*cfb92d14SAndroid Build Coastguard Worker 161*cfb92d14SAndroid Build Coastguard Workernode.reset() 162*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 163*cfb92d14SAndroid Build Coastguard Worker 164*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 165*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_commissioned_state, WAIT_TIME) 166*cfb92d14SAndroid Build Coastguard Worker 167*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_LOW_POWER) 168*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 169*cfb92d14SAndroid Build Coastguard Worker 170*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_ON) 171*cfb92d14SAndroid Build Coastguard Workernode.leave() 172*cfb92d14SAndroid Build Coastguard Worker 173*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174*cfb92d14SAndroid Build Coastguard Worker# Verify sleep behavior after disabling `wpantund` ("Daemon:Enabled" 175*cfb92d14SAndroid Build Coastguard Worker# property) when state is "offline" 176*cfb92d14SAndroid Build Coastguard Worker 177*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 178*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_STATE) == wpan.STATE_OFFLINE) 179*cfb92d14SAndroid Build Coastguard Workerverify(node.get('Daemon:Enabled') == 'true') 180*cfb92d14SAndroid Build Coastguard Worker 181*cfb92d14SAndroid Build Coastguard Worker# Disabling `wpantund` should put the NCP to deep sleep 182*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:Enabled', 'false') 183*cfb92d14SAndroid Build Coastguard Workerverify(node.get('Daemon:Enabled') == 'false') 184*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 185*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 186*cfb92d14SAndroid Build Coastguard Worker 187*cfb92d14SAndroid Build Coastguard Worker# Enabling `wpantund` should update the `MCU_POWER_STATE` back to `ON`. 188*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:Enabled', 'true') 189*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_offline_state, WAIT_TIME) 190*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 191*cfb92d14SAndroid Build Coastguard Worker 192*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 193*cfb92d14SAndroid Build Coastguard Worker# Verify sleep behavior after disabling `wpantund` ("Daemon:Enabled" 194*cfb92d14SAndroid Build Coastguard Worker# property) when state is "associated" 195*cfb92d14SAndroid Build Coastguard Worker 196*cfb92d14SAndroid Build Coastguard Workernode.form("disable-test") 197*cfb92d14SAndroid Build Coastguard Workerverify(node.is_associated()) 198*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 199*cfb92d14SAndroid Build Coastguard Worker 200*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:Enabled', 'false') 201*cfb92d14SAndroid Build Coastguard Workerverify(node.get('Daemon:Enabled') == 'false') 202*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_deep_sleep_state, WAIT_TIME) 203*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 204*cfb92d14SAndroid Build Coastguard Worker 205*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:Enabled', 'true') 206*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_commissioned_state, WAIT_TIME) 207*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_ON) 208*cfb92d14SAndroid Build Coastguard Worker 209*cfb92d14SAndroid Build Coastguard Workernode.leave() 210*cfb92d14SAndroid Build Coastguard Worker 211*cfb92d14SAndroid Build Coastguard Worker# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212*cfb92d14SAndroid Build Coastguard Worker# Verify `AutoAssociateAfterReset` behavior after reset from "deep-sleep" 213*cfb92d14SAndroid Build Coastguard Worker# (but commissioned). 214*cfb92d14SAndroid Build Coastguard Worker 215*cfb92d14SAndroid Build Coastguard Workernode.set('Daemon:AutoAssociateAfterReset', '1') 216*cfb92d14SAndroid Build Coastguard Worker 217*cfb92d14SAndroid Build Coastguard Workernode.set(wpan.WPAN_NCP_MCU_POWER_STATE, wpan.MCU_POWER_STATE_LOW_POWER) 218*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 219*cfb92d14SAndroid Build Coastguard Worker 220*cfb92d14SAndroid Build Coastguard Workernode.form("resume-test") 221*cfb92d14SAndroid Build Coastguard Workerverify(node.is_associated()) 222*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 223*cfb92d14SAndroid Build Coastguard Worker 224*cfb92d14SAndroid Build Coastguard Workernode.reset() 225*cfb92d14SAndroid Build Coastguard Worker 226*cfb92d14SAndroid Build Coastguard Worker# After reset, power state should remain `LOW_POWER` (wpantund would restore the value 227*cfb92d14SAndroid Build Coastguard Worker# on NCP) and wpantund state should start as "deep-sleep" but since AutoAssociateAfterReset 228*cfb92d14SAndroid Build Coastguard Worker# is enabled, network should be recovered. 229*cfb92d14SAndroid Build Coastguard Worker 230*cfb92d14SAndroid Build Coastguard Workerwpan.verify_within(check_wpan_is_in_associating_state, WAIT_TIME) 231*cfb92d14SAndroid Build Coastguard Workerverify(node.get(wpan.WPAN_NCP_MCU_POWER_STATE) == wpan.MCU_POWER_STATE_LOW_POWER) 232*cfb92d14SAndroid Build Coastguard Worker 233*cfb92d14SAndroid Build Coastguard Worker# ----------------------------------------------------------------------------------------------------------------------- 234*cfb92d14SAndroid Build Coastguard Worker# Test finished 235*cfb92d14SAndroid Build Coastguard Worker 236*cfb92d14SAndroid Build Coastguard Workerwpan.Node.finalize_all_nodes() 237*cfb92d14SAndroid Build Coastguard Worker 238*cfb92d14SAndroid Build Coastguard Workerprint('\'{}\' passed.'.format(test_name)) 239