;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 2002 Routrek Networks,Inc. All rights reserved ; Custom Yamaha Rt definition tested on RT52/105p ; Version 0.1 ; $RCSfile: TargetRt.txt,v $ ; $Revision: 1.1 $ $Date: 2002/12/24 00:41:18 $ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RMC configuration example: ; ; copy terminal running-config (then paste this file.) ; set port comN ; set spy comN tfl0 ml0 (for RMS) ; set spy targetN ml0 (for RMS) ; set speed 115200 (in case of RT52) ; set target-type yamaha-rt [ping_addr] ; set target-login-password ; set target-enable-password ; set target-check ; set network-info-time ; set connect-log ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Note: ; 'console info on' to enable console log of the RT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set user-target-type yamaha-rt ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-filter yamaha-rt tfl0 # Console log. 'console info on' to display system information on the console. # $Revision: 1.1 $ $Date: 2002/12/24 00:41:18 $ logtype != "" && /[>#] / { logtype = "" next } # Ignore log message shown by "show log", "less log" /(show log|less log)/ { logtype = "show-log" next } /[12][0-9][0-9][0-9]\/[0-1][0-9]\/[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]: / { # Remove "Login/'administrator' succeeded for Serial" message if ((logtype == "") && ($0 !~ /succeeded for Serial/) && ($0 !~ /Logout from Serial/)) { print } } ----END OF FILTER---- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-script yamaha-rt login # Login script for Yamaha RT # $Revision: 1.1 $ $Date: 2002/12/24 00:41:18 $ # # Send [enter] and wait password prompt. send "" wait_prompt: expect { "assword:" goto password "# " goto default_conf "> " goto default_conf "---more---" goto more "Incorrect password" goto wait_prompt timeout 2 break } # Maybe stucked by confirmation prompt send "\003\c" expect { "# " goto default_conf "> " goto default_conf timeout 2 break } # TA mode maybe (RT52). send "" send "AT&R" expect { "OK" goto wait_prompt timeout 2 goto error } # Send login password password: send $(TARGET_LOGIN_PASSWORD) expect { "> " break "# " break "Incorrect password" goto password_error "assword:" goto password_error timeout 5 goto error } # Set default config - character code, lines, administrator default_conf: send "console character ascii" expect { "> " break "# " break timeout 5 goto error } send "console lines infinity" expect { "> " break "# " exit 0 timeout 5 goto error } send "administrator" # The command fails if the other admin has been logging in already. expect { "> " exit 0 "# " exit 0 "assword:" break timeout 5 goto error } send $(TARGET_ENABLE_PASSWORD) expect { "> " exit 0 "# " exit 0 timeout 5 goto password_error } exit 0 password_error: exit 3 # quit --More-- prompt more: send "q\c" goto wait_prompt error: exit 1 ----END OF SCRIPT---- set target-script yamaha-rt command # command script for Yamaha RT # $Revision: 1.1 $ $Date: 2002/12/24 00:41:18 $ verbose off call login verbose on # if "show version" command then it is for checking target type ! test "`sendcmd -t`" = "show version" if $? != 0 goto loop print "" print "---start command result---" print "---show version---" send "show environment" gosub wait_prompt goto logout # Command loop loop: # send a command one by one ! sendcmd if $? != 0 goto logout gosub wait_prompt goto loop wait_prompt: expect { "> " break "# " break "assword:" goto enable_password "---more---" goto more "[Y/N]" goto noconfirm "(Y/N)" goto noconfirm timeout 30 goto error } # seems to be a prompt but check interval to confirm. wait_interval: expect { timeout 2 return } # seems not to be a prompt (comment line maybe) # return to wailt prompt again goto wait_prompt # enable password prompt enable_password: send $(TARGET_ENABLE_PASSWORD) goto wait_prompt # send space to "---more---" prompt more: send " \c" goto wait_prompt # send no to (Y/N) prompt noconfirm: send "N\c" goto wait_prompt logout: send "quit" gosub wait_prompt send "quit" sleep 1 exit 0 error: exit 1 ----END OF SCRIPT---- ; set target-script yamaha-rt target-check # target-check script for yamaha-rt # set target-script yamaha-rt target-check # ARG1=ping address set s 0 call login ! test $ARG1 if $? != 0 goto logout # ping check # Note: if some one else has been administrator the ping command fails. # But the above case isn't seems to be error. verbose on send "ping \c" send $(ARG1) expect { "is alive" goto logout "no answer from" break "> " goto logout timeout 30 break } set s 1 expect { "# " break timeout 2 goto logout } # ping failed. proceed to traceroute check send "traceroute \c" send $(ARG1) expect { "# " goto logout timeout 30 send "\003\c" } expect { "# " break timeout 10 break } logout: verbose off send "quit" wait_prompt: expect { "(Y/N)" goto noconfirm "> " break timeout 5 exit 1 } send "quit" sleep 1 if s = 0 exit 0 exit 1 # send no to (Y/N) prompt noconfirm: send "N\c" goto wait_prompt error: set s 1 goto logout #exit 1 ----END OF SCRIPT---- ; set target-script yamaha-rt network-info # command # Network information command for yamaha-rt show environment # This command is necessary for RMS show config # This command is necessary for RMS show ip route show status packet # The following command should be customized # RT105 series show status lan1 show status pri1 show status bri1 # RT52 show account show status lan ----END OF SCRIPT----