1 ;Author : Bing Song
 2 ;Date   : 1/9/2019
 3 ;Usage: modify “logfile" according to actual drictory
 4
 5 getdir logdir #获取当前路径
 6 changedir logdir #切换到当前目录下
 7 logfile="test.log"
 8 logopen logfile 0 0 1
 9 logwrite "*****************************************Start  log******************************"#13#10
10     timeout =3 #设置超时时间,超过3秒就执行下面的脚本
11     wait "buildroot login: "
12     sendln "root"
13     wait "#"
14     pause 1
15     sendln "123456"
16     pause 1
17     wait "#"
18     sendln 'cd sdk/'
19     wait "#"
20     sendln "cd R1165-J0003-01_V2.1.5_Shenzhou_SDK"
21     wait "#"
22     sendln './auto_load_user.sh -m PAM4_400G_32'
23     pause 10
24     wait "BCM.0>"
25     num=0
26     do while 32-num >0 #循环执行端口cd0~cd31
27         int2str var num #转换int型变量为str型,并存储到变量var
28         sendln "port cd" var " " "en=off" #""表示空格
29         pause 1
30         wait "BCM.0>"
31         pause 1
32         sendln "ps"
33         pause 1
34         sendln "port cd" var " " "en=on"
35         pause 1
36         wait "BCM.0>"
37         pause 1
38         sendln "ps"
39         num=num+1
40     loop
41     sendln "exit"
42 logclose
43 logwrite "Log End"#13#10
44 logwrite "**************************************End*******************************************"#13#10
12-16 09:12