利用vela设备自带的wapi命令行,重复执行联网断网的命令,测试系统稳定性。
实现如下,
# $language = "python"
# $interface = "1.0"# This automatically generated script may need to be
# edited in order to work correctly.import time
import math
import randomcmd_list = ['ifup wlan0\r\n','wapi mode wlan0 2\r\n','wapi psk wlan0 12345678 2\r\n','wapi essid wlan0 asuswifi666 1\r\n','renew wlan0\r\n','wapi disconnect wlan0\r\n'
]
cmd_list_len = len(cmd_list)def Main():crt.Screen.Send("\r\n")CmdNum = 0test_round = 0;while True:crt.Screen.Synchronous = Falsecrt.Screen.Send(cmd_list[CmdNum])crt.Screen.WaitForStrings(["ap>",""],1000)if CmdNum==3:crt.Screen.WaitForStrings(["connect success",""],1000)elif CmdNum==4:time.sleep(5)elif CmdNum==5:crt.Screen.WaitForStrings(["disconnect success",""],1000)test_round = test_round + 1time.sleep(2)CmdNum = (CmdNum + 1) % cmd_list_lentime.sleep(1)if test_round > 100:break;Main()