TCL脚本--------ping包上下电测试脚本

set Test {2001}         ;#Test的窗口名称
set power {com2}         ;#上下电的窗口名称
set cnt 1
while {1} {
tsend2  $power "0"  
tsend2  $power "0"  
after 5000

tsend2  $power "1"  
tsend2  $power "1"
after 300000        

tsend2  $Test "\n"
tsend2  $Test "\n"
tsend2  $Test "sy"

#连接TC口速率切换
tsend2  $Test "interface range ge0/2 to ge0/3"
after  2000            
tsend2  $Test "speed 10"
after  4000     
#奇数口速率切换
tsend2  $Test "interface ge0/5"
tsend2  $Test "speed 10"
after  3000

tsend2  $Test "interface ge0/7"
tsend2  $Test "speed 10"
after  3000

tsend2  $Test "interface ge0/9"
tsend2  $Test "speed 10"
after  3000
  
set output [tsend2 $Test  "ping -vpn-instance 100 101.0.0.2" -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
set output [tsend2 $Test  "ping -vpn-instance 101 202.0.0.2 " -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
 

set output [tsend2 $Test  "ping -vpn-instance 100 1.0.0.2 " -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
  


set output [tsend2 $Test  "ping -vpn-instance 102 1.0.0.1" -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
  


set output [tsend2 $Test  "ping -vpn-instance 102 1.0.2.2" -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
  


set output [tsend2 $Test  "ping -vpn-instance 103 1.0.2.1" -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
 


set output [tsend2 $Test  "ping -vpn-instance 103 1.0.4.2" -r -t 3600 -s "H3C"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
  

set output [tsend2 $Test  "ping -vpn-instance 101 1.0.4.1" -r -t 3600 -s "huawei"]
after 5000
set isMatch [regexp {out} $output]
#       tsend    "$isMatch"
        if { $isMatch == 1 } {
                 tsend2 $Test  "quit"
                 tsend2 $Test  "quit"
                 tsend2 $Test  "d c i i"
                 tsend2 $Test  "d c o i"
                 break
#          tsend   "dis time all"               
        } else {
                 #tsend   "dis dev"
                 #tsend2 $Test  "quit"
                 #tsend2 $Test  "quit"
        }
        
  
  puts "-------------------$cnt-------------------------------------" 
            set cnt [expr $cnt + 1]       

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值