Alibaba CT is based on TCL. As a scripting language, Alibaba CT can achieve automatic interaction (such as passwd, fsck, and telnet) without the participation of administrators ). Secondary CT can also be used to automatically test some applications. Here, the blogger uses login vro as an example. First, let's take a brief look at the process of using login CT to automatically log on to the vrotelnet through telnet. Of course, you can also use the login CT script ssh to log on to the server for automatic management. #! /Usr/bin/expectspawntelnet
Alibaba CT is based on TCL. As a scripting language, Alibaba CT can achieve automatic interaction (such as passwd, fsck, and telnet) without the participation of administrators ). Secondary CT can also be used to automatically test some applications.
Here, the blogger uses login vro as an example. First, let's take a brief look at the process of using login CT to automatically log on to the vrotelnet through telnet. Of course, you can also use the login CT script ssh to log on to the server for automatic management.
#!/usr/bin/expectspawn telnet 192.168.1.1expect"*Username:*"send"yourname\r"expect"*Password:*"send"yourpwd\r"send"en\r"expect"*password:*\r"send"yourpwd\r"send"sys show\r"send"exit\r"expect eof
Running the test is normal.
Spawn telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
Username: yourname
Password:
TP-LINK> en
Enter password:
# Sys show TP-LINK
CPU Used Rate: 17%
TP-LINK> exit
Connection closed by foreign host.